プロトタイプ · プレビュー版:公式レジストリのすべてのサーバーを掲載し、30分ごとに同期しています。Google でログインするとレビューを書けます。
PopNx MCPAIを使う人のためのMCPサーバー · やさしい言葉で解説

Surgical Context MCP

作者:erayerturkバージョン 0.1.0i★ 4iパソコンで動く
レジストリ名io.github.erayerturk/surgical-context-mcp

インストール方法

What it does

Local Tree-sitter code graph: surgical edit context for AI agents instead of full-file reads.

  • Connects パソコンで動く
  • Account or key No key needed
  • Category 開発者ツール

インストール

使っているAIアプリを選んで、設定をコピーしてください。

チェック 3/3 合格 · あなたのパソコンで動きます

まず:どの AI を使っていますか?

使っているアプリを選ぶと、下に手順が表示されます。

Claude につなげますが、先に準備が必要です

先にパソコンへ Python (uv) を入れてください(1 回だけ) · パソコン版 Claude アプリ(Windows または Mac)のみ。Web やスマホでは使えません

  1. Python (uv) を入れる

    1 回だけ。Python (uv) が必要なすべてのサーバーで使えます

    Python (uv) のダウンロードページを開く ↗

  2. パソコン版 Claude アプリの設定ファイルを開く

    SettingsDeveloperEdit Config

  3. この設定を貼り付けて保存

    {
      "mcpServers": {
        "surgical-context": {
          "command": "uvx",
          "args": [
            "surgical-context-mcp"
          ]
        }
      }
    }
  4. Claude を終了してもう一度開く

  5. 試してみる

    Surgical Context MCP を使って、私に何ができるか教えて、1 つやってみせて

    ✓ Claude が Surgical Context MCP を使っていると言うか、回答に Surgical Context MCP のツール名が出れば接続成功です

メニュー名は 2026年11月11日 に Anthropic のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります

ChatGPT はまだ Surgical Context MCP につなげません

Surgical Context MCP はパソコンに入れて使うものですが、ChatGPT は Web 上で動くサーバーにしかつなげません

代わりにできること

A · Surgical Context MCP につなげるアプリを使う

  • 先にパソコンへ Python (uv) を入れてください(1 回だけ) · パソコン版 Claude アプリ(Windows または Mac)のみ。Web やスマホでは使えません
  • 先にパソコンへ Python (uv) を入れてください(1 回だけ)
  • 先にパソコンへ Python (uv) を入れてください(1 回だけ)
  • 先にパソコンへ Python (uv) を入れてください(1 回だけ)

B · 開発者ツール の中で ChatGPT につなげる別のサーバー

同じカテゴリでよく使われているものから、キーなしでアドレスだけでつなげるものを選びました

Claude Code につなげますが、先に準備が必要です

先にパソコンへ Python (uv) を入れてください(1 回だけ)

  1. Python (uv) を入れる

    1 回だけ。Python (uv) が必要なすべてのサーバーで使えます

    Python (uv) のダウンロードページを開く ↗

  2. ターミナルを開く

    Mac:Command+スペースで Terminal と入力 · Windows:PowerShell を開く

  3. このコマンドを貼り付けて Enter

    claude mcp add --scope user surgical-context -- uvx surgical-context-mcp
  4. Claude Code で /mcp と入力

    Surgical Context MCP が一覧にあり、接続済みと表示されれば OK です

  5. 試してみる

    Surgical Context MCP を使って、私に何ができるか教えて、1 つやってみせて

    ✓ Claude Code が Surgical Context MCP を使っていると言うか、回答に Surgical Context MCP のツール名が出れば接続成功です

メニュー名は 2026年11月11日 に Anthropic のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります

Cursor につなげますが、先に準備が必要です

先にパソコンへ Python (uv) を入れてください(1 回だけ)

  1. Python (uv) を入れる

    1 回だけ。Python (uv) が必要なすべてのサーバーで使えます

    Python (uv) のダウンロードページを開く ↗

  2. このボタンで Cursor を開く

    Cursor で開く

    Cursor がインストールの確認をするので Install を押します

  3. Cursor の AI チャットを Agent モードで開く

  4. 試してみる

    Surgical Context MCP を使って、私に何ができるか教えて、1 つやってみせて

    ✓ Cursor が Surgical Context MCP を使っていると言うか、回答に Surgical Context MCP のツール名が出れば接続成功です

メニュー名は 2026年11月11日 に Cursor のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります

VS Code につなげますが、先に準備が必要です

先にパソコンへ Python (uv) を入れてください(1 回だけ)

  1. Python (uv) を入れる

    1 回だけ。Python (uv) が必要なすべてのサーバーで使えます

    Python (uv) のダウンロードページを開く ↗

  2. このボタンで VS Code を開く

    VS Code で開く

    VS Code がインストールの確認をするので Install を押します

  3. VS Code の AI チャットを Agent モードで開く

  4. 試してみる

    Surgical Context MCP を使って、私に何ができるか教えて、1 つやってみせて

    ✓ VS Code が Surgical Context MCP を使っていると言うか、回答に Surgical Context MCP のツール名が出れば接続成功です

メニュー名は 2026年11月11日 に VS Code のヘルプページで確認 · アプリのバージョンにより画面が少し違うことがあります

Windsurf、Zed、Gemini CLI など MCP を使える他のアプリは追加方法がそれぞれ違います。アプリ一覧で確認してください

MCP を使えるアプリをすべて見る →

JSON 設定は下の「開発者向け」にあります

つまずいたら?Surgical Context MCP を使っている人に聞いてみましょう💬 ディスカッション →
開発者向け:ターミナルのコマンドと JSON 設定

パソコンにインストール

Claude Code

claude mcp add --scope user surgical-context -- uvx surgical-context-mcp

Claude Desktop (claude_desktop_config.json)

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

Cursor (~/.cursor/mcp.json)

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

VS Code (mcp.json)

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

この設定は、作者のレジストリ登録情報から作成しています。READMEと違う場合は、READMEに従ってください。

ひと目でわかる

週あたりのダウンロードi
56/週
接続方法
パソコンで動く
最新バージョンi
0.1.0
レジストリ公開日i
2026年11月1日
コードの最終更新i
2026年11月1日
作者
erayerturk
パッケージ
pypi: surgical-context-mcp
レジストリでの状態
有効

使えるアプリ

このサーバーのつなぎ方と、各アプリの公式ドキュメントに基づきます。2026年11月10日に確認。

パソコン上で動かせるアプリ

ClaudeGooseLM StudioMsty StudioCherry StudioCursorVS Code + GitHub CopilotVisual StudioWindsurf (Devin Desktop)ZedKiroClineContinueJetBrains AI AssistantClaude CodeCodex CLIGemini CLIOpenCodenodecodeWarpLibreChatRaycast

すべてのアプリと長所・短所 →

できること

パソコンで動くサーバーです。インストールすると、ツール一覧がAIアプリに表示されます。

基本チェックi

誰でも見られる情報をチェックしており、コードは読んでいません。当てはまらない項目は数に入れていません。 · 2026年11月12日にチェック

  • ✓ 合格

    作者とリポジトリが一致

    レジストリ名は、リポジトリを所有するGitHubアカウント erayerturk で確認済みです

  • ✓ 合格

    今もメンテナンスされている

    コードの最終更新:11 日前

  • ✓ 合格

    ライセンスがある

    MITを使用

  • – 対象外

    エンドポイントが応答する

    これはパソコンで動くため、インターネット上のエンドポイントはありません

  • – 対象外

    OAuthでサインイン

    パソコンで動き、代わりにローカルの設定を使います

  • … 未チェック

    ツールの説明に隠れた指示がない

    パソコンで動くサーバーです。ツール一覧を読み取れるのは、インターネット上のエンドポイントがある場合だけです

話し合い

質問、コツの共有、使えないことの報告ができます。「役に立った」の多い順です。

まだ投稿はありません。最初の質問や共有をどうぞ。

ここの投稿は利用者によるもので、PopNx チームのものではありません。

Google でログインして投稿

ユーザーレビュー

まだレビューはありません

Google でログインしてレビューを書く

開発者ツールのほかのサーバーとの比較i

  • このカテゴリのほかの5800件のうち83%よりスターが多い
  • このカテゴリのほかの5800件のうち67%より最近レジストリに公開
  • 基本チェックの結果が、このカテゴリのほかの5800件のうち100%と同じかそれ以上

レジストリでこのカテゴリにある有効なすべてのサーバーと比較しています。スターは、公開者がリポジトリの所有者である場合だけ数えます。

よくある質問

Surgical Context MCPは安全ですか?

当てはまる基本チェック3項目のうち3項目に合格しました。コードは読んでいません。キーやトークンを追加する前に、サーバーがどんなアクセスを求めているかを確認し、必要な権限だけを持つキーを使ってください。

どんなキーやコードが必要ですか?

レジストリには必須のキーは載っていません。ただし、最初に使うときにサインインを求めるサーバーもあります。

パソコンで動きますか、それともクラウドですか?

あなたのパソコンで動きます。必要なときにAIアプリが起動し、データは作者のサーバーを通りません(サーバー自体がオンラインサービスを呼び出す場合を除きます)。

今もメンテナンスされていますか?

GitHubリポジトリの最終更新は11 日前、最新バージョン(0.1.0)がレジストリに届いたのは11 日前です。

どのアプリで使えますか?

Claude Desktop、Claude Code、Cursor、VS CodeなどのMCP対応アプリで使えます。パソコンにPython (uv)も必要です。

代わりに使えるものは?

同じカテゴリには:REA, GitHub, Serena MCP: the IDE for your agent

同じカテゴリのほかの候補

同じカテゴリで、ほかの作者が作ったサーバー。スターの多い順。

カードの見方:↓ 週あたりのダウンロードi★ GitHubスターi3つの柱:レビュー · チェック · 利用状況i更新=最新バージョンをレジストリに公開した日i

REA

Reverse engineer anything from your terminal or agent with one CLI and MCP server.

作者:morluto広く使われている↓ 38.9万/週★ 45.3万18 日前更新

パソコンで動く

GitHub

Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.

作者:github広く使われている★ 3.4万9 日前更新

パソコンでもクラウドでも

作者のREADME

READMEを開く

作者のリポジトリから書かれたとおりにコピーしたものです。PopNx MCPは内容を確認・推奨していません。HTML、画像、スクリプトは取り除いています。リンクはこのサイトの外へ移動します。

surgical-context-mcp — Surgical AST Code Context & Knowledge Graph for AI Coding Agents

Stop feeding 3,000-line files into your LLM context window.

surgical-context-mcp is a zero-LLM-cost, embedded SQLite + Tree-sitter Code Knowledge Graph and MCP Server that gives AI coding agents (Claude Code, Cursor, Windsurf, Cline, Claude Desktop) the exact surgical context they need to edit, refactor, and navigate codebases safely — cutting token consumption by 70–95% without sacrificing code quality.

Real run on this repo: editing a function in a 1,264-line file costs ~3.7k tokens instead of ~13.3k (−72%) — and you still get the skeleton, callers and helpers.

⚡ Quick Start (30 seconds)

# 1. Install (or: pipx install / pip install surgical-context-mcp)

uv tool install surgical-context-mcp

2. Register with Claude Code

claude mcp add code-graph -- code-graph serve

3. Index your project + install the token-saving guard hook

code-graph install-hooks /path/to/your/project

That's it — your agent now calls get_edit_context instead of reading whole files. Using Cursor, Windsurf, Cline or Claude Desktop? See Step 1. Also listed on the official MCP Registry as io.github.erayerturk/surgical-context-mcp.


Table of Contents

  1. Quick Start (30 seconds)
  2. Why Use surgical-context-mcp?
  3. How Much Does It Save & When Should You Use It?
  4. Supported Languages & Ecosystem Resolvers
  5. How It Works (Architecture)
  6. Installation
  7. How to Use (Step-by-Step Setup Guide)
  8. Real Output Examples
  9. MCP Tools Reference
  10. CLI Reference
  11. Recommended CLAUDE.md / .cursorrules Configuration

Why Use surgical-context-mcp?

The 3 Core Problems with AI Coding Agents Today
  1. Full-File Reads Burn Hundreds of Thousands of Tokens: When you ask an AI agent (or when it spawns subagents) to fix a bug or add a feature, its default instinct is to run Grep and then Read entire 1,500–3,000 line files into the context window. Because every subsequent tool call re-sends the entire conversation history (cache reads), a single large file read early in a session compounds into 100k–300k wasted tokens.
  2. Narrow Line-Range Reads Cause Hallucinations & Code Duplication: If you force an agent to read only lines 240–260 of a file to save tokens, the agent becomes blind to:
  • Class attributes, self.x fields, @onready / @export variables, constants, and struct / interface definitions at the top of the file.
  • Helper functions that already exist in the same file (causing the LLM to write duplicate code).
  • How callers actually pass arguments to the function (±5 lines around call sites).
  • The file's coding style (indentation, typing conventions, error handling idioms).
  1. Pure Static AST Graphs Miss Dynamic Dispatch & Scene/Template Wiring: Standard call graphs only see static foo() calls. If a function is invoked via getattr(obj, "foo") in Python, call("foo") or a .tscn signal connection in Godot, SendMessage("foo") in Unity/C#, or referenced in a .vue/.html/.proto file, a naive graph reports *"0 callers — safe to delete"*, breaking production code.
How surgical-context-mcp Solves All Three
  • `get_edit_context(symbol)` — One Call Before Any Edit: Instead of reading a 2,500-line file, the agent makes one MCP call (get_edit_context) and receives a strictly budgeted (≤ 4,000 tokens) surgical package containing:
  1. Target Function Full Body (with exact line numbers for Edit)
  2. File Skeleton (all imports, interface/struct/enum blocks, class fields, constants — without other function bodies)
  3. Used Members & Direct Callees (definitions of class fields used by the target function + full bodies of short same-file helpers ≤ 25 lines)
  4. Direct Callers (`d=1`, `±5` Line Windows) (exact call-site context without dumping 200-line caller functions)
  5. Other Function Signatures in the File (so the agent reuses existing helpers instead of duplicating them)
  6. Style Hints & Coverage Warnings (flags dynamic string calls, .tscn connections, templates, and protocol references)
  • `check_rename_or_delete(symbol)` — One Call Before Any Refactor: Checks AST callers (exact/scoped), inheritance overrides across parent/child classes, .tscn/template connections, signal emit/connect sites, and workspace-wide dynamic string references.
  • Cross-Language Contracts (`shares_contract`) — Server ↔ Client ↔ Config in One Call:
  • Protocol Opcodes (`contract::opcode::0xCC`): Automatically links hex opcode constants across languages (e.g., Go OpSGMOnline = 0xCC and GDScript/TypeScript const S_GM_ONLINE = 0xCC), so querying either constant shows both server senders and client packet handlers together.
  • Config & Schema Keys (`contract::config:: `): Automatically links Go struct json:"max_chars_per_ip" field tags, frontend/panel schema strings ('multi_guard.max_chars_per_ip'), and seed/*.json config entries ("max_chars_per_ip": 2) into a single shared contract node.
  • Data, Seed & Translation (`i18n`) Graph (`check_translations`): Indexes seed/*.json, shared/maps/*.json, locales/*.json, and .po files alongside code. Links tr("...") and noticeT(..., "n.x") calls to locale definitions and audits missing keys, accidental raw non-key literals, %d/%s/{} placeholder count mismatches, and unused locale keys.
  • Automated Test Discovery (`tests_for`) & Git Diff Blast Radius (`get_diff_impact`):
  • tests_for(symbol) identifies every test exercising a symbol and returns the exact runnable CLI command (go test ./pkg -run '^TestFoo$', godot --headless --path client -s tests/..., pytest ... -k ...).
  • get_diff_impact(base_ref="HEAD") parses git diff hunks, maps changed lines to modified AST symbols, and reports their callers, affected cross-language contracts, and runnable test commands in one call — built for code-review subagents (final-reviewer).
  • Concept Search & Engine Lifecycle Noise Suppression:
  • Indexes inline/preceding comments and docstrings (doc_comment) so searching by concept (e.g. "attack stat") finds KOAP (// attack power stat bonus).
  • Recognizes engine-invoked virtual callbacks (_ready, _draw, _process, _physics_process, _input, Awake, Update) and suppresses false text-match noise warnings when AST upstream is empty.
  • Direct Token Savings Telemetry (`get_token_savings`): Every MCP/CLI query records its returned token count vs. the raw token size of touched files in SQLite (usage_telemetry), answering *"How many tokens did code-graph save?"* with direct measurements instead of estimates.
  • Zero LLM Indexing Cost & Sub-Second Speed: Built on native C Tree-sitter grammars and embedded SQLite (WAL mode). Indexes ~600 files in `< 0.6` seconds using 0 API tokens, and automatically refreshes modified files (mtime + SHA-1) on every query.
  • Enforced via Claude Code `PreToolUse` Hook: Includes a built-in hook guard (code-graph install-hooks) that blocks unbounded `Read` calls on files `> 300` lines and returns the file's AST symbol table (Lstart-end: signature), ensuring both main agents and subagents stay on the surgical path.

How Much Does It Save & When Should You Use It?

1. Token & Cost Economics (Single-Turn vs. Multi-Turn Compounding Savings)

In agentic coding tools (Claude Code, Cursor, Cline), every tool call re-sends the entire conversation history up to that point. When an agent reads a 2,500-line file (~22,000 tokens) on Turn 2 of a 12-turn coding task, those 22,000 tokens are billed on Turn 2, Turn 3, Turn 4 ... all the way to Turn 12 (22,000 × 10 = 220,000 cumulative context tokens).

By replacing full-file reads with get_edit_context (~2,500–3,500 tokens), surgical-context-mcp prevents context bloat from compounding across turns.

Benchmark Across Common Developer Tasks

*(Measured on a 593-file multi-language repository: 2,607-line Godot client controller + Go backend + JS web dashboard)*

Developer ScenarioStandard Agent (Read + Grep)With surgical-context-mcpDirect Token Savings10-Turn Compounded Savings
1. Initial Repo Orientation ("How is this codebase structured?")~18,500 tokens (multiple ls, Glob, Read calls)`~650` tokens (GRAPH_REPORT.md / get_architecture_map)96% fewer tokens~178,000 tokens saved
2. Modifying a Function in a Large File (2,607 lines)~22,400 tokens (reads whole target file + 1 caller file)`~2,900` tokens (get_edit_context returns skeleton + body + callers)87% fewer tokens~195,000 tokens saved
3. Tracing an End-to-End Request / Event Flow (Client -> Packet -> Server Handler)~31,000 tokens (grepping strings and reading 4–6 files)`~1,200` tokens (find_flow + get_symbol_impact)96% fewer tokens~298,000 tokens saved
4. Safe Refactoring / Dead-Code Deletion ("Can I delete or rename this method?")~14,000 tokens (grepping & reading candidate files; still misses dynamic refs)`~450` tokens (check_rename_or_delete checks AST + overrides + .tscn + dynamic strings)97% fewer tokens~135,000 tokens saved
5. Multi-Subagent Parallel Execution (Spawning 2–3 subagents for backend/frontend)200,000–350,000 tokens (each subagent independently reads huge files)`35,000–60,000` tokens (PreToolUse hook blocks >300L reads in all subagents)80–85% fewer tokensPrevents rate-limits & context compaction

2. When Does surgical-context-mcp Provide the Biggest Gains?
High-Impact Scenarios (80%–97% Savings & Higher Code Accuracy)
  • Large or Monolithic Source Files (`300` to `5,000+` lines): Game controllers (main.gd, PlayerController.cs), large backend services (`s

冒頭だけを表示しています。続きはリポジトリで読めます