ต้นแบบ · รุ่นทดลอง: มีทุก server ในทะเบียนทางการ อัปเดตทุก 30 นาที รีวิวและบัญชีผู้ใช้จะมาในขั้นถัดไป
PopNx MCPที่รวม MCP สำหรับคนใช้ AI · อธิบายเป็นภาษาคน

Surgical Context MCP

โดย erayerturkรุ่น 0.1.0i★ –iรันบนเครื่อง
ชื่อใน registryio.github.erayerturk/surgical-context-mcp

ติดตั้ง

ภาพรวม

คำอธิบายจากผู้ทำ (ภาษาอังกฤษตามต้นฉบับ)

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

สามเสาของ PopNx MCP

สามเรื่องนี้ไม่รวมเป็นคะแนนเดียว เพราะความเห็น การวัด และความนิยม เป็นคนละเรื่องกัน

ใช้ทำอะไรได้

ตัวนี้ยังไม่ได้เรียบเรียงเป็นภาษาไทย ด้านล่างคือข้อเท็จจริงที่เราอ่านจาก registry

  • การเชื่อมต่อ: รันบนเครื่อง
  • ช่องทาง (transport): stdio
  • หมวด: เครื่องมือนักพัฒนา

ติดตั้ง

เลือกโปรแกรม AI ที่คุณใช้ แล้วคัดลอกค่าตั้งไปวาง

ก่อนติดตั้ง

ต้องเตรียมก่อน

  • PyPIติดตั้ง uv ของ Python (มีคำสั่ง uvx) ในเครื่อง

คุณใช้แอปไหน

เลือกแอปด้านบน เราจำไว้ให้ ครั้งหน้าปุ่มจะขึ้นว่า “ติดตั้งลง …”

เปิด Claude Desktop → Settings → Developer → Edit Config แล้ววางค่านี้ในไฟล์ claude_desktop_config.json

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

พิมพ์คำสั่งนี้ใน Terminal

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

เปิดใน Cursor

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .cursor/mcp.json ของโปรเจกต์ หรือ ~/.cursor/mcp.json

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

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

เปิดใน VS Code

หรือคัดลอกค่าตั้งเอง

วางในไฟล์ .vscode/mcp.json ของโปรเจกต์

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

เบราว์เซอร์จะถามก่อนเปิดแอป จากนั้นแอปแสดงค่าตั้งให้ตรวจแล้วกดยืนยัน ช่อง key เว้นว่างไว้ให้คุณใส่เอง

ตัวนี้รันในเครื่องคุณ แต่ ChatGPT ต่อได้เฉพาะ server บนอินเทอร์เน็ต ลองเลือกแอปอื่น

ตัวเลือกเก็บในคุกกี้บนเครื่องนี้ ไม่ต้องมีบัญชี

ค่าตั้งนี้สร้างจากข้อมูลใน registry ของผู้ทำ ถ้าไม่ตรงกับ README ให้เชื่อ README

ทำอะไรได้บ้าง

รันในเครื่องคุณ รายการเครื่องมือจะขึ้นในแอป AI หลังติดตั้ง

ผลตรวจเบื้องต้นi

เราตรวจจากข้อมูลที่ใครก็เปิดดูได้ ยังไม่ได้อ่านโค้ด ข้อที่ไม่เกี่ยวกับตัวนี้ไม่นับในตัวหาร · ตรวจเมื่อ 9 พ.ย. 2569

  • ✓ ผ่าน

    ตัวตนผู้ทำตรงกับ repo

    ชื่อใน registry ยืนยันด้วยบัญชี GitHub erayerturk ซึ่งเป็นเจ้าของ repo

  • … ยังไม่ตรวจ

    ยังมีคนดูแล

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • … ยังไม่ตรวจ

    มีสัญญาอนุญาต (license)

    ยังไม่ได้อ่านข้อมูล repo จาก GitHub

  • – ไม่เกี่ยว

    endpoint ตอบ

    ตัวนี้รันบนเครื่องคุณ ไม่มี endpoint บนอินเทอร์เน็ต

  • – ไม่เกี่ยว

    ล็อกอินแบบ OAuth

    ตัวนี้รันบนเครื่อง ใช้ค่าที่ตั้งในเครื่องแทน

  • … ยังไม่ตรวจ

    คำอธิบายเครื่องมือไม่มีคำสั่งแอบแฝง

    รันในเครื่องคุณ เราอ่านรายการเครื่องมือได้เฉพาะตัวที่มี endpoint บนอินเทอร์เน็ต

เทียบกับตัวอื่นในหมวด เครื่องมือนักพัฒนาi

  • ดาวมากกว่า 0% ของอีก 5559 ตัวในหมวดนี้
  • ส่งรุ่นใหม่เข้า registry ล่าสุดกว่า 73% ของอีก 5559 ตัวในหมวดนี้
  • ผลตรวจเบื้องต้นดีกว่าหรือเท่ากับ 100% ของอีก 5559 ตัวในหมวดนี้

เทียบกับทุก server ที่ยังใช้งานในหมวดนี้ทั้งทะเบียน ดาวนับเฉพาะเมื่อผู้ลงทะเบียนเป็นเจ้าของ repo

คำถามที่พบบ่อย

Surgical Context MCP ปลอดภัยไหม?

จากการตรวจเบื้องต้นของเรา ผ่าน 1 จาก 1 ข้อที่ตรวจได้ เรายังไม่ได้อ่านโค้ด ก่อนใส่กุญแจหรือ token ให้ดูว่า server ขอสิทธิ์อะไร และเลือกกุญแจที่ทำได้เท่าที่จำเป็น

ต้องใช้กุญแจหรือรหัสอะไรบ้าง?

registry ไม่ได้ระบุว่าต้องใช้กุญแจ แต่บางตัวจะขอให้ล็อกอินตอนใช้ครั้งแรก

ตัวนี้รันบนเครื่องหรือบนคลาวด์?

รันบนเครื่องของคุณ โปรแกรม AI จะเปิด server ขึ้นมาเองเมื่อใช้ ข้อมูลไม่ต้องผ่านเซิร์ฟเวอร์ของผู้ทำ (ยกเว้นตัวที่ไปเรียกบริการออนไลน์ต่อ)

ยังมีคนดูแลอยู่ไหม?

repo บน GitHub มีการแก้โค้ดล่าสุด – และส่งรุ่นล่าสุด (0.1.0) เข้า registry 7 วันที่ผ่านมา

ใช้กับโปรแกรมไหนได้บ้าง?

โปรแกรมที่รองรับ MCP เช่น Claude Desktop, Claude Code, Cursor และ VS Code ตัวนี้ต้องมี Python (uv) ในเครื่องด้วย

มีตัวไหนใช้แทนได้บ้าง?

ในหมวดเดียวกันมี GitHub, Desktop Commander, Cloudflare MCP

ตัวที่ใช้แทนได้

server หมวดเดียวกันจากผู้ทำคนอื่น เรียงตามดาว

อ่านการ์ด:↓ ดาวน์โหลดต่อสัปดาห์i★ ดาว GitHubiสามเสา: รีวิว · ผลตรวจ · การใช้งานiอัปเดต = วันที่ส่งรุ่นล่าสุดเข้า registryi

GitHub

server ทางการของ GitHub ให้ AI อ่านและจัดการโค้ด issue และ pull request ในบัญชีของคุณได้ ใช้ผ่านคลาวด์ของ GitHub หรือรันในเครื่องด้วย Docker ก็ได้

โดย githubใช้กันมาก★ 34.2Kอัปเดต 5 วันที่ผ่านมา

บนเครื่องหรือคลาวด์

Desktop Commander

MCP server for terminal commands, file operations, and process management

โดย wonderwhy-erใช้กันมาก↓ 709.6K/สัปดาห์★ 10.2Kอัปเดต 17 วันที่ผ่านมา

รันบนเครื่อง

Cloudflare MCP

Cloudflare MCP servers

โดย cloudflareใช้กันมาก★ 4.4Kอัปเดต 14 เดือนที่ผ่านมา

รันบนคลาวด์✓ mcp.cloudflare.com

README จากผู้ทำ

เปิดอ่าน README

ส่วนนี้คัดจาก repo ของผู้ทำตามต้นฉบับ 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

ตัดมาแค่ช่วงต้น อ่านต่อใน repo

ถาม PopNx