Skip to content
Documentation

The DiffGuardian MCP server

Expose your project's code knowledge graph and on-device embeddings to Claude Code and other agents over a read-only localhost endpoint. Pro.

The other MCP page is about DiffGuardian calling your tools. This one is the reverse: DiffGuardian can act as an MCP server, so an external coding agent — Claude Code, or anything else that speaks the Model Context Protocol — can query the code knowledge graph and on-device embeddings DiffGuardian has already built for your projects.

Available on Pro. It is off by default.

#Why it exists

DiffGuardian indexes your repository once: a graph of symbols, calls and imports, plus embeddings of the source. That index is expensive to build and useful to more than one tool. Rather than have your agent re-read the repository file by file, you can point it at the index that already exists.

#Turning it on

Settings → Local MCP server → Enable MCP server. The app then shows:

  • Endpoint — a http://127.0.0.1:<port>/mcp URL.
  • Bearer token — generated for you, hidden until you reveal it.
  • A ready-made claude mcp add command with both filled in, to paste into your agent.

You can regenerate the token at any time; doing so invalidates any agent already registered with the old one.

The app must stay open for an agent to connect. Turn the toggle off and nothing outside DiffGuardian can reach your code.

#What an agent can do with it

Every tool is read-only. There is no tool that writes a file, runs a command, or changes anything in DiffGuardian.

ToolWhat it returns
list_projectsThe projects available to query, with their graph and index status.
project_digestA structural overview from the code graph: module groups, key files, exported symbols, import edges.
search_codeSemantic search over the project's source using the on-device embeddings, with file, symbol and similarity score.
find_symbolWhere a symbol is declared, by exact name.
get_callersThe call sites of a symbol — the blast radius of changing it.
get_neighborsGraph edges (imports, calls, contains) touching a node, and the node on the far end.
read_sourceA file, or a line range of it, from the project's local checkout.

If a project has not been indexed yet, search_code says so rather than returning nothing; open the project in DiffGuardian to build the index and retry.

#How it is protected

  • It binds to 127.0.0.1 only — it is not reachable from another machine.
  • Every request must carry the bearer token.
  • The Host and Origin headers are checked, which stops a web page in your browser from reaching the endpoint by DNS rebinding.
  • read_source refuses any path that resolves outside the project's checkout.

Treat the token like a password. Anything holding it can read your indexed code through the endpoint. It never leaves your machine unless you copy it somewhere.

#Next steps