Skip to content
MCP server

Surgical Context MCP

Local Tree-sitter code graph that hands coding agents a small edit context per symbol

Runs locally

Surgical Context MCP is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.

Pricing
Open source
Platforms
CLI, Self-hosted
Runs
Locally
Version
0.1.0
Listing updated

Similar MCP servers

Install

Add with the CLI

Run in a terminal

claude mcp add surgical-context-mcp -- uvx surgical-context-mcp

Add --scope user to use it in every project, or --scope project to share it in .mcp.json.

Or share it with your project

Add to .mcp.json

{
  "mcpServers": {
    "surgical-context-mcp": {
      "command": "uvx",
      "args": [
        "surgical-context-mcp"
      ]
    }
  }
}

Claude Code setup guide

Add to claude_desktop_config.json

{
  "mcpServers": {
    "surgical-context-mcp": {
      "command": "uvx",
      "args": [
        "surgical-context-mcp"
      ]
    }
  }
}

Settings → Developer → Edit Config, then quit and reopen Claude Desktop.

Claude Desktop setup guide

Install in CursorOpens Cursor, which asks you to confirm. Or add it by hand:

Add to ~/.cursor/mcp.json

{
  "mcpServers": {
    "surgical-context-mcp": {
      "command": "uvx",
      "args": [
        "surgical-context-mcp"
      ]
    }
  }
}

Use .cursor/mcp.json in a project to share it with the project.

Cursor setup guide

Install in VS CodeOpens VS Code, which asks you to confirm. Or add it by hand:

Add to ~/.copilot/mcp-config.json

{
  "mcpServers": {
    "surgical-context-mcp": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "surgical-context-mcp"
      ]
    }
  }
}

Or put the same entry in .mcp.json at your workspace root to share it.

VS Code setup guide

Add with the CLI

Run in a terminal

codex mcp add surgical-context-mcp -- uvx surgical-context-mcp

Or add to config.toml

Add to ~/.codex/config.toml

[mcp_servers.surgical-context-mcp]
command = "uvx"
args = ["surgical-context-mcp"]

Codex setup guide

Add to your client's MCP settings (most use this shape)

{
  "mcpServers": {
    "surgical-context-mcp": {
      "command": "uvx",
      "args": [
        "surgical-context-mcp"
      ]
    }
  }
}
  • Gemini CLI and Antigravity

    Gemini CLI

    Add to ~/.gemini/settings.json

    {
      "mcpServers": {
        "surgical-context-mcp": {
          "command": "uvx",
          "args": [
            "surgical-context-mcp"
          ]
        }
      }
    }

    Or run: gemini mcp add -s user surgical-context-mcp uvx -- surgical-context-mcp

    Antigravity

    Add to ~/.gemini/config/mcp_config.json

    {
      "mcpServers": {
        "surgical-context-mcp": {
          "command": "uvx",
          "args": [
            "surgical-context-mcp"
          ]
        }
      }
    }

    Use .agents/mcp_config.json to add it to one workspace only.

    Gemini CLI and Antigravity setup guide

  • Devin Desktop (formerly Windsurf)

    Add to ~/.config/devin/mcp_config.json

    {
      "mcpServers": {
        "surgical-context-mcp": {
          "command": "uvx",
          "args": [
            "surgical-context-mcp"
          ]
        }
      }
    }

    On Windows the file is %APPDATA%\devin\mcp_config.json. Use .devin/mcp_config.json to share it with a project.

    Devin Desktop setup guide

  • Cline

    Add to cline_mcp_settings.json

    {
      "mcpServers": {
        "surgical-context-mcp": {
          "command": "uvx",
          "args": [
            "surgical-context-mcp"
          ]
        }
      }
    }

    Open it from the MCP Servers icon → Configure → Configure MCP Servers.

    Cline setup guide

  • Zed

    Add to Zed settings.json

    {
      "context_servers": {
        "surgical-context-mcp": {
          "command": "uvx",
          "args": [
            "surgical-context-mcp"
          ]
        }
      }
    }

    Open it with zed: open settings file. Merge context_servers into the settings you already have.

    Zed setup guide

  • JetBrains AI Assistant and Junie

    AI Assistant

    Add to Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add

    {
      "mcpServers": {
        "surgical-context-mcp": {
          "command": "uvx",
          "args": [
            "surgical-context-mcp"
          ]
        }
      }
    }

    Junie

    Add to ~/.junie/mcp/mcp.json

    {
      "mcpServers": {
        "surgical-context-mcp": {
          "command": "uvx",
          "args": [
            "surgical-context-mcp"
          ]
        }
      }
    }

    Use .junie/mcp/mcp.json to share it with a project.

    JetBrains AI Assistant and Junie setup guide

  • Kiro

    Add to ~/.kiro/settings/mcp.json

    {
      "mcpServers": {
        "surgical-context-mcp": {
          "command": "uvx",
          "args": [
            "surgical-context-mcp"
          ]
        }
      }
    }

    Use .kiro/settings/mcp.json to add it to one workspace only.

    Kiro setup guide

Using several servers? Build one config file with the MCP config generator.

About Surgical Context MCP

Instead of letting an agent read a 2,500-line file, one call to get_edit_context returns a package capped at 4,000 tokens: the target function body with line numbers, a skeleton of the file with imports, types and fields, the members it uses, short helper bodies, callers shown with five lines either side, and signatures of the other functions so existing helpers get reused. The README's own example on a 1,264-line file measured about 3.7k tokens against 13.3k for a full read.

Before a rename or delete, check_rename_or_delete looks at AST callers, overrides across parent and child classes, Godot scene connections, signal emit and connect sites, and dynamic string references that a plain call graph would report as zero callers. Other tools link constants across languages, such as an opcode defined in Go and used in GDScript, audit translation keys and placeholder mismatches, find tests for a symbol with a runnable command, and map a git diff to affected symbols and tests.

Indexing uses native Tree-sitter grammars with an embedded SQLite database, costs no LLM tokens, and the README claims about 600 files in under 0.6 seconds, refreshing changed files on each query. It installs from PyPI, registers with Claude Code, Cursor, Windsurf, Cline or Claude Desktop, and can add a hook that nudges agents away from whole-file reads.

Tools this server provides (6)

Taken from the project documentation; the running server may differ.

From the tool list in its README, going by the names, 5 of 6 tools read data; 1 name doesn't say.

From the server's own tool labels and tool names; not verified by us.

get_edit_contextName suggests: reads
Returns a budgeted package of edit context for a symbol
check_rename_or_deleteName suggests: reads
Checks callers, overrides and dynamic references before a rename or delete
check_translationsName suggests: reads
Audits locale and translation keys
tests_for
Finds tests exercising a symbol with a runnable command
get_diff_impactName suggests: reads
Maps git diff changes to affected symbols, contracts and tests
get_token_savingsName suggests: reads
Reports tokens saved by queries

What it does

Edit context
One budgeted call returns the target function, file skeleton, callers and helper signatures.
Safe rename and delete checks
Finds AST callers, overrides, scene connections and dynamic string references.
Cross-language contracts
Links shared constants and config keys across Go, GDScript, TypeScript and JSON.
Translation audit
Flags missing locale keys, placeholder mismatches and unused keys.
Test discovery
Finds tests for a symbol with the exact command to run them.
Diff impact
Maps git diff hunks to changed symbols, callers and tests.
Token savings log
Records returned tokens against the raw size of touched files.

Good for

  • Cut token spend when an agent edits a function in a very large file
  • Check what breaks before renaming or deleting a symbol
  • Review a git diff for affected callers and tests
  • Audit locale files in a game or app for missing keys
  • Keep server and client constants in sync across languages

Pricing

Open source

Free; runs locally

Surgical Context MCP FAQ

Does Surgical Context MCP call an LLM to index my code?

No. The README says indexing costs zero LLM tokens and uses Tree-sitter with SQLite locally.

Which clients does Surgical Context MCP support?

Claude Code, Cursor, Windsurf, Cline and Claude Desktop.

How do I install Surgical Context MCP?

With uv tool install surgical-context-mcp, pipx or pip, then register it with claude mcp add code-graph -- code-graph serve.

How much does Surgical Context MCP save?

The README claims 70 to 95 percent fewer tokens; its example on one file saved 72 percent.

What is the token limit per context?

At most 4,000 tokens per get_edit_context package.

Is Surgical Context MCP free?

Yes. Surgical Context MCP is open source, so you can use and self-host it for free.

How do I add Surgical Context MCP to Claude Code?

Run this command in your terminal: claude mcp add surgical-context-mcp -- uvx surgical-context-mcp

What are the best alternatives to Surgical Context MCP?

The closest alternatives to Surgical Context MCP are REA, Context7, Chrome DevTools MCP, Codebase Memory and GitHub.

Where this comes from

  • Description: written from the project's README.
  • Install steps: from the official MCP Registry entry.

How AIPoweredBot checks servers