Graph Indexer for VS Code Copilot is a local MCP server that lets Copilot’s agent mode call exact reference, call-graph and change-impact tools on your workspace. Run npx graph-indexer init; it writes .vscode/mcp.json in VS Code’s own format, which uses servers and "type": "stdio".
How do I add Graph Indexer to VS Code Copilot?
From the repository root, with Node.js 22.5 or later:
npx graph-indexer init
init picks VS Code when the repository contains a .vscode directory. To target it explicitly, run npx graph-indexer init --agents vscode.
What does npx graph-indexer init write for VS Code?
For VS Code Copilot, init writes:
| File | Content |
|---|---|
.vscode/mcp.json | A graph-indexer entry under servers, merged with servers already there |
AGENTS.md | A managed block with the lookup rules |
.gitignore | .graph-indexer/ |
What does the VS Code MCP configuration look like?
VS Code differs from most agents in two ways: the top-level key is servers, and each server declares "type": "stdio". The entry init writes is:
{
"servers": {
"graph-indexer": {
"type": "stdio",
"command": "npx",
"args": ["-y", "graph-indexer@3", "serve", "--repo", "${workspaceFolder}"]
}
}
}
The ${workspaceFolder} variable makes the file portable across machines.
Does Graph Indexer add hooks for VS Code?
Graph Indexer’s hook command reads the Claude Code payload format, which the source documents as shared by VS Code, Codex, Copilot CLI and Devin. init --hooks only writes hooks to .claude/settings.json for Claude Code and Devin; it does not write a VS Code-specific hook file. For VS Code Copilot, rely on the MCP tools, which work without hooks.
What does VS Code Copilot gain from Graph Indexer?
In agent mode Copilot can call eight read-only tools. Typical replies are 400 to 1,500 tokens: the right function with line numbers instead of a 2,000-line file.
find_referencesseparates the real callers ofUserService.findfrom every other method namedfind, and states whether the list is complete.change_impactlists dependents by distance and the tests to run.search_codefinds where a behaviour lives from a natural-language query.read_codereads several symbols or line ranges in one call, with the definition of each name they use.
The index re-syncs with the files on disk before each answer, so edits Copilot made a moment ago are included. Reference accuracy is measured against compilers and type checkers; see the benchmarks and the tools reference.
Frequently asked questions
Why does the VS Code file use servers and not mcpServers?
VS Code's MCP configuration format uses a servers key and an explicit type stdio, unlike most other agents, which use mcpServers. init writes the VS Code shape for you so you do not have to translate it.
Does this work in Copilot chat, or only agent mode?
MCP tools are called by Copilot's agent mode, where the model chooses tools itself. Graph Indexer is a tool provider, so it needs a Copilot mode that can call MCP tools.
Is the .vscode/mcp.json safe to commit?
The entry contains only a command and ${workspaceFolder}, no secrets and no absolute paths unless you used --local. Committing it lets the whole team get the server; the .graph-indexer index directory is gitignored.
What if my .vscode/mcp.json has comments?
init does not rewrite files with comments or non-plain JSON, because a JSON round trip would lose them. It leaves the file and prints the exact entry to add by hand.