Skip to content

What is MCP ​

This page is for a developer who has never worked with MCP and does not want to read a specification. It explains what the protocol is, who talks to whom, what an MCP tool and an MCP resource are, and what actually happens when you paste a JSON block into your AI client's configuration.

Everything is shown on this project's two servers, vue-codebase-mcp (the indexer) and vue-codebase-view-mcp (the live preview), but the mechanics are the same for any MCP server.

In one sentence ​

MCP (Model Context Protocol) is a common language between an AI assistant and your project.

An AI assistant on its own sees only what you paste into the chat. It cannot open your repository, cannot list your components, cannot check whether a UiSelect already exists.

An MCP server is a small program that does all of this for it. Concretely, this project's indexer can:

  • read the project's files and build an index of them: components, composables, Pinia stores, routes, utils;
  • tell you which props, events and slots a component has — with the real types from the code, not a guess;
  • find a component by intent ("button", "dropdown"), even when it is called UiButton;
  • show where a component is used and what depends on it (get_usage_examples, get_dependencies);
  • serve its markdown documentation and its source file.

MCP is the agreement about how the assistant asks that program questions and how the program answers: the message format, plus the two kinds of things you can get — tools and resources.

The word "server" here names a role in the protocol, not a machine in a data centre: one side asks (the client), the other answers (the server). Where the program physically runs — on your laptop or on a remote host — makes no difference to the protocol. Both options are covered below: who is who and how stdio works.

Think of it as a translator standing between two specialists who do not speak the same language: the assistant knows what it wants to find out, the server knows the codebase. Neither needs to understand the other's world.

Who is who ​

text
┌─────────────────┐                      ┌──────────────────────┐                    ┌──────────────────┐
│  MCP client     │   MCP over stdio     │   MCP server         │   reads files      │  your project    │
│  (the AI app)   │ ───────────────────► │   (a Node process)   │ ─────────────────► │  src/**, docs/** │
│                 │ ◄─────────────────── │                      │ ◄───────────────── │                  │
│  Claude Desktop │   tools + resources  │  vue-codebase-mcp    │   parsed model     │  .vue, .ts, .md  │
│  Cursor, VS Code│                      │                      │                    │                  │
│  Qwen Code …    │                      │                      │                    │                  │
└─────────────────┘                      └──────────────────────┘                    └──────────────────┘
RoleWhat it isExamples
ClientThe application you talk to. It runs the model, keeps the chat, and connects to the server — usually by starting the server process itselfClaude Desktop, Cursor, VS Code, Qwen Code, Windsurf
ServerA program that exposes data and actions over MCP. It is not a website: it has no pages and you never open it in a browser. It either runs next to the client on your machine — the client starts it and stops it again — or on a remote host as a permanent process with an address and a token, which the whole team then connects tovue-codebase-mcp, vue-codebase-view-mcp
ProjectYour code. The server reads it and answers from itany Vue 3 repository

Two ways to connect them ​

Locally, over stdio — the default, and enough for a single developer. You write a command into the client's configuration; the client runs it as a process when it needs the server, talks to it, and stops it at the end of the session. You start nothing by hand, you remember no port, and nothing is published to the internet.

On a host, over HTTP — the server is started separately (systemd, Docker, a CI runner) and listens on an address like https://mcp.internal.example/mcp, and clients connect to it over the network with a token. That is how several people share one ready-made index without keeping the project on their own machines.

Local, stdioOn a host, HTTP
Who starts itthe client, for the duration of a sessionyou — once, and it stays up
Addressnone, no port is involveda URL plus a token
Authenticationnot needed: the client owns the processAuthorization: Bearer <token>
Good forone developer on one machinea team, a shared index, CI

HTTP exists for the indexer only; the view server (vue-codebase-view-mcp) speaks stdio, because it starts a Vite dev server and executes your project's code. The step-by-step path from an empty machine to a working address: Deployment → From scratch.

How stdio works ​

The word keeps coming up below, so here it is in detail — starting from what a process is.

A process is a running program. When you execute a command in a terminal, the operating system creates a process: it has its own memory, its own number (PID) and — this is the part that matters here — three standard text channels:

ChannelDirectionWhat goes into it
stdininputwhat the program is "told": a keyboard, a file, another process
stdoutoutputthe ordinary result of its work
stderroutputmessages, warnings, errors

In a terminal all three look the same — text on the screen. The difference appears when one process starts another and wires its channels to itself: the child's stdin can be connected to the parent's output and its stdout to the parent's input, and then the two programs talk directly, bypassing the screen. That is exactly what an MCP client does.

The stdio transport is that conversation: the client starts the server as a process and exchanges lines of JSON with it through the server's stdin and stdout. There is no network, no port, no firewall involved.

text
MCP client                                MCP server
(the process you started)                 (the process the client started)

  request ────► stdin  ┐
                       │  reads the JSON, opens the project's files,
  answer  ◄──── stdout ┘  assembles the answer, prints it as one line

  a human ◄──── stderr    logs and warnings — the client never reads these

This is what the exchange looks like. It is a real session captured in this repository: every message is exactly one line of JSON, with no line breaks inside. The client asks "who are you and what can you do":

json
{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"terminal","version":"1.0"}}}

The server answers on stdout:

json
{"result":{"protocolVersion":"2025-06-18","capabilities":{"tools":{"listChanged":true},"resources":{"listChanged":true}},"serverInfo":{"name":"vue-codebase-mcp","version":"0.1.0"}},"jsonrpc":"2.0","id":1}

and writes its logs to stderr — the client does not read them, you do, when something goes wrong:

text
[vue-codebase-mcp] info: Loaded index snapshot from 2026-11-20T19:14:44.227Z: 12 entities, 10 documents
[vue-codebase-mcp] info: Index: full, 12 entities, 10 documents
[vue-codebase-mcp] info: vue-codebase-mcp: stdio transport started

You can repeat the experiment with no client at all — a process's channels are easy to replace with a pipe:

bash
echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"terminal","version":"1.0"}}}' \
  | npx vue-codebase-mcp serve --root /path/to/project --no-watch

The command prints the server's answer to stdout, its logs to stderr, and then exits. --no-watch is there so the process does not stay alive with a file watcher: without it the server never terminates on its own and you have to stop it with Ctrl+C.

Four properties of stdio follow from how it is built, and they are worth knowing in advance:

  1. The server lives exactly as long as the client session. Close the client and the process stops. You cannot "leave the server running overnight" — the next session starts a new one.
  2. Every client gets its own process. Two editors mean two servers, each with its own in-memory index.
  3. No port is needed, so there are no port conflicts and nothing to allow through a firewall.
  4. stdout is occupied by the protocol — the client expects only JSON there. Everything meant for a human has to go to stderr. Why that is critical is the next section.

What the server gives the client ​

After starting a server, the client asks it two questions: "who are you?" (initialize) and "what can you do?" (tools/list, resources/list). The answer for this project's indexer, taken from a real session:

json
{ "tools": { "listChanged": true }, "resources": { "listChanged": true } }

That is the server's capabilities: it offers tools and resources. So there are two kinds of things:

Tool = a question you can ask ​

A tool is a named operation with a described set of parameters. The assistant decides on its own when to call one — you never press a button. Each tool publishes a JSON Schema, so the model knows exactly what it may pass:

json
{
  "name": "search",
  "description": "Searches components, composables, stores, routes and utils by name, purpose, props, events and tags. Understands Russian queries (\"кнопка\", \"выпадающий список\", \"валидация формы\") through a synonym dictionary, and accepts names in any form (UiButton, ui-button, button). Returns a summary with the match reason — request the full API via `get_entity_details`.",
  "inputSchema": {
    "type": "object",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "properties": {
      "query": {
        "type": "string",
        "description": "Query: the purpose of an entity, its name, or the name of a prop/event"
      },
      "kinds": {
        "description": "Restrict the search to these entity kinds",
        "type": "array",
        "items": { "type": "string", "enum": ["component", "composable", "store", "route", "util"] }
      },
      "project": {
        "description": "Restrict the search to a workspace (project name from the configuration)",
        "type": "string"
      },
      "limit": { "description": "Maximum number of results, 10 by default", "type": "integer", "minimum": 1, "maximum": 100 },
      "includeInternal": { "description": "Include internal entities (excluded by default)", "type": "boolean" },
      "fullText": { "description": "Also search descriptions through the full-text index right away", "type": "boolean" }
    },
    "required": ["query"]
  }
}

The indexer offers 10 tools, the view server 4. The full list with real requests and answers: Indexer tools · View server tools.

Resource = a document you can read ​

A resource is a document with a URI. Where a tool is a verb ("find me a button"), a resource is a noun (component://UiButton). Clients use resources to put data into the context in advance or to subscribe to changes, without "calling" anything:

text
component://UiButton      → the component as JSON: props, events, slots, relations
doc://component/UiButton  → its markdown documentation
file://src/components/ui-button/ui/UiButton.vue → the source file
index://overview          → index summary: mode, counters, projects, warnings

A real resources/list answer from the demo project lists 35 resources under seven URI schemes — Resources shows the whole picture.

A live example ​

You ask your assistant: "Is there a ready-made button in the project?" You did not choose a tool and did not write JSON — the assistant decided. Under the hood this happens:

json
{ "name": "search", "arguments": { "query": "button" } }

and the server answers (real output, demo project playground/ui-library):

text
## Index matches (1)
- **UiButton** · component · `src/components/ui-button/ui/UiButton.vue` (stable)
  Базовая кнопка дизайн-системы: варианты, размеры, состояние загрузки.
  match: exact name, category

Take the answer apart line by line — it also explains why part of it is Russian even though the query was in English:

LineWhere it came from
## Index matches (1)the server's text: the section heading and the number of results
**UiButton** · component · … (stable)data from your code: the entity name, its kind, the file path, the status
Базовая кнопка дизайн-системы: …your code's text: the component description, copied verbatim from the JSDoc comment above it
match: exact name, categorythe server's text: why this result was returned at all — the name matched and the "buttons" category fired

Whose text a line is determines whether --lang affects it:

  • the server's own text — headings, labels, error messages — is translated. With --lang ru the same answer starts with ## Совпадения в индексе (1);
  • your code's text — descriptions of components, props, slots, markdown documentation — is never translated. The server copies it verbatim: in the demo project UiButton.vue carries the JSDoc comment /** Базовая кнопка дизайн-системы: варианты, размеры, состояние загрузки. */, and that is exactly what ends up in the answer. Translating somebody else's code automatically would mean replacing your wording with a machine translation, so the server does not do it.

The practical consequence: the language of the descriptions in an answer is the language of the comments in your repository. The demo project's comments are Russian, so the description is Russian under any --lang. If you want English descriptions, write the JSDoc in English.

The "match reason" line is the server's text as well, so it is translated: under --lang ru the same answer ends with совпадение: точное имя, категория. Reasons are stored as codes (exactName, synonymName, category, …) and the string is assembled on the way out — see Language → What is not translated.

Having got the answer, the assistant will typically call get_entity_details for the exact props, and then write code that uses the existing component instead of inventing a new one. That is the whole point of the exercise.

MCP server vs CLI vs plugin ​

CLIPlugin / extensionMCP server
Who runs ita human, in a terminalthe editor, on its own schedulethe AI client, per session
Interfaceflags and text output for a humanthe editor's extension APIa protocol: tools, resources, JSON Schemas
Who reads the outputyouthe editora model
Portable across appsyes (any shell)no (one editor)yes (any MCP client)

The same package can be both: vue-codebase-mcp index and vue-codebase-view-mcp preview are ordinary CLI commands for a human, while serve starts the MCP server for a client. One codebase, two interfaces.

Why stdout is sacred ​

A reminder from the previous section: a process is a running program, and it has two output text channels, stdout and stderr. In a terminal both look the same, but when the client starts the server itself it wires those channels to itself and can send them to different places. An MCP client sends them exactly that way.

Think of a phone call. stdout is the handset through which the client and the server exchange remarks: every one of them must be a JSON-RPC message, or the other side simply cannot parse it. stderr is a notepad next to the phone where the server writes notes for a human. Say "hang on, let me check the configuration…" into the handset and the other end hears nonsense and concludes the line is broken.

Two rules follow, and both servers in this project obey them:

  • in stdio mode stdout is the protocol channel. A stray console.log inside a tool corrupts the stream, and the client reports "server is not responding" or "invalid JSON". Debugging such a server through its own output is useless: you see somebody else's parse error, not the cause;
  • everything meant for a human — logs, progress, warnings — goes to stderr. In HTTP mode stdout is not occupied by the protocol, but the behaviour is the same: logs always go to stderr, so you never have to look in two places.

What the client does with stderr depends on the client: some show it in an MCP log panel, some write it to a file, some pass it through to their own terminal. In your client's documentation look for "MCP server logs".

Two practical consequences:

  • when a server misbehaves, look at its stderr, not at the client's chat:

    json
    { "mcpServers": { "vue-codebase": { "command": "npx", "args": ["-y", "vue-codebase-mcp", "serve"],
      "env": { "MCP_LOG_LEVEL": "debug" } } } }
  • when you script the CLI yourself, stdout is safe to capture and stderr is safe to ignore:

    bash
    npx vue-codebase-mcp index --root . --mode full --json > report.json

Connecting a client ​

The configuration is JSON; only the file name differs.

Claude Desktop — ~/Library/Application Support/Claude/claude_desktop_config.json on macOS, %APPDATA%\Claude\claude_desktop_config.json on Windows:

json
{
  "mcpServers": {
    "vue-codebase": {
      "command": "npx",
      "args": ["-y", "vue-codebase-mcp", "serve"],
      "env": { "VUE_CODEBASE_MCP_ROOT": "/absolute/path/to/project", "VUE_CODEBASE_MCP_LANG": "en" }
    }
  }
}

Cursor — .cursor/mcp.json in the project (or a global one), same shape. Qwen Code — .mcp.json in the project root or mcpServers in ~/.qwen/settings.json, same shape.

The absolute path in VUE_CODEBASE_MCP_ROOT is what tells the server which project to index; the client's own working directory does not matter. For the view server, use the package name vue-codebase-view-mcp and (optionally) VUE_CODEBASE_VIEW_MCP_LANG.

After a restart of the client:

  1. the client spawns the server and performs the handshake;
  2. it fetches tools/list — you should see search, get_entity_details, preview_project and the rest in the client's tool list;
  3. the indexer loads the snapshot if index was run before, otherwise it builds a light index at once and warns in stderr that types are unresolved;
  4. nothing else is needed — the assistant starts using the tools when it needs them.

All of that is the local option, stdio: the client keeps the process on your own machine. When the server runs on a remote host, the configuration names its address and a token header instead of command and args:

json
{
  "mcpServers": {
    "vue-codebase": {
      "httpUrl": "https://mcp.internal.example/mcp",
      "headers": { "Authorization": "Bearer <your token>" }
    }
  }
}

The exact keys differ from client to client; the shapes for Qwen Code, Cursor and Claude Desktop are in Deployment → Connecting clients.

Step by step, with real outputs: Quick Start.

Words you will meet ​

Short versions; the full glossary with the project's other terms is in Introduction → Glossary.

TermMeaning
MCPThe protocol: how a client and a server exchange tools, resources and messages
ClientThe AI application that runs the model and spawns servers
ServerThe process that answers over MCP; here — the indexer or the preview server
TransportHow they are connected: stdio (the client spawns a process on your machine) or http (the server runs separately and has a URL) — see How stdio works
ToolA named operation with a JSON Schema the model may call
ResourceA document with a URI the client may read (component://UiButton)
IndexThe in-memory model of your project: entities, documents, relations
SnapshotThe index written to .vue-codebase-mcp.cache/index.json by the index command
full / lightIndex modes: with type resolution, or syntactic parsing only
DiagnosticAn error as { code, params }, printed as [code] message — stable for scripts, localized for people

What to do if… ​

SymptomWhat is happening and what to do
The client does not see the server at allThe command could not start. Check that npx vue-codebase-mcp version works in a terminal, and that the path in the configuration is absolute
"Server is not responding" / "invalid JSON"Something writes to stdout, or the process died at startup. Set MCP_LOG_LEVEL=debug and read stderr
Answers say the index is empty, [tools.indexEmpty]No snapshot and nothing matched the auto-detected locations. Run npx vue-codebase-mcp index --root <path> --mode full
[tools.unknownProject]A monorepo workspace is named differently. The answer lists the names that exist; pass one of them as "project"
Types look wrong or missing, api: sfc-liteThe index is light. Run index --mode full — the snapshot is reused by every later session
Answers mention staleThe file was edited after the snapshot was built. Re-run index, or let serve watch files
The preview shows nothingpreview exits with 3 when the index is empty and with 4 when the port is unavailable — the exit code says which

A longer walkthrough with codes and commands: Troubleshooting.

Where to go next ​

MIT Licensed