# Surgical Context MCP

> Surgical Context MCP is an open-source MCP server for developer tools. Local Tree-sitter code graph that hands coding agents a small edit context per symbol. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, Self-hosted
- **Repository:** https://github.com/erayerturk/surgical-context-mcp
- **MCP Registry name:** io.github.erayerturk/surgical-context-mcp
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-23

## About

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.

## Features

- **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

## Install

### Claude Code: Add with the CLI (Terminal)

```sh
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.

### Claude Code: Or share it with your project (.mcp.json)

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

### Claude Desktop (claude_desktop_config.json)

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

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

### Cursor (~/.cursor/mcp.json)

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

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

### VS Code (~/.copilot/mcp-config.json)

```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.

### Codex: Add with the CLI (Terminal)

```sh
codex mcp add surgical-context-mcp -- uvx surgical-context-mcp
```

### Codex: Or add to config.toml (~/.codex/config.toml)

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

### Gemini CLI and Antigravity: Gemini CLI (~/.gemini/settings.json)

```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

### Gemini CLI and Antigravity: Antigravity (~/.gemini/config/mcp_config.json)

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

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

### Devin Desktop (~/.config/devin/mcp_config.json)

```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.

### Cline (cline_mcp_settings.json)

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

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

### Zed (Zed settings.json)

```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.

### JetBrains AI Assistant and Junie: AI Assistant (Settings → Tools → AI Assistant → Model Context Protocol (MCP) → Add)

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

### JetBrains AI Assistant and Junie: Junie (~/.junie/mcp/mcp.json)

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

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

### Kiro (~/.kiro/settings/mcp.json)

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

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

### Other clients (your client's MCP settings (most use this shape))

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

## Tools

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_context` (name suggests: reads): Returns a budgeted package of edit context for a symbol
- `check_rename_or_delete` (name suggests: reads): Checks callers, overrides and dynamic references before a rename or delete
- `check_translations` (name suggests: reads): Audits locale and translation keys
- `tests_for`: Finds tests exercising a symbol with a runnable command
- `get_diff_impact` (name suggests: reads): Maps git diff changes to affected symbols, contracts and tests
- `get_token_savings` (name suggests: reads): Reports tokens saved by queries

## 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.

## Alternatives

- [REA](https://ai-powered.com/mcp/rea): REA is an open-source MCP server for developer tools.
- [Context7](https://ai-powered.com/mcp/context7): Context7 is a freemium MCP server for developer tools.
- [Chrome DevTools MCP](https://ai-powered.com/mcp/chrome-devtools-mcp-2): Chrome DevTools MCP is an open-source MCP server for browser automation.
- [Codebase Memory](https://ai-powered.com/mcp/codebase-memory): Codebase Memory is an open-source MCP server for knowledge and memory.
- [GitHub](https://ai-powered.com/mcp/github): GitHub is an open-source MCP server for developer tools.
- [Serena MCP: the IDE for your agent](https://ai-powered.com/mcp/serena-mcp-the-ide-for-your-agent): Serena MCP: the IDE for your agent is an open-source MCP server for developer tools.
- [XERJ](https://ai-powered.com/mcp/xerj): XERJ is an open-source MCP server for knowledge and memory.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/surgical-context-mcp
