PluginBench
MCP Server
Maintained
MIT

io.github.Codeturion/codesurface MCP Server

io.github.Codeturion/codesurface

Index your codebase's public API and query it via MCP tools—save tokens vs reading source files.

What is the io.github.Codeturion/codesurface MCP server?

The codesurface MCP server indexes your codebase's public API (classes, methods, properties, fields, events) at startup and serves it through compact MCP tool responses. It supports C#, C++, Go, Java, Python, and TypeScript/JavaScript, reducing token usage and hallucination risk compared to file-based lookups.

codesurface parses your source code once and builds a searchable index of public APIs, then exposes 5 MCP tools to query it. Instead of reading full files or grepping blindly, you get exact signatures, line numbers, and class references in compact responses. Benchmarks show 35–77% fewer tokens than skilled grep+read workflows and 87% fewer than naive approaches.

How to install io.github.Codeturion/codesurface

Copy-paste configuration for popular MCP clients.

transport: stdio
Config generated by PluginBench — verify against the source before use.
~/Library/Application Support/Claude/claude_desktop_config.json
{
  "mcpServers": {
    "codesurface": {
      "command": "uvx",
      "args": [
        "codesurface"
      ]
    }
  }
}

Tools & capabilities

Tools this server exposes to the agent.

  • search — Find APIs by keyword across the indexed codebase, with optional file path and test-file filters.
  • get_signature — Retrieve exact method/function signature by name or fully-qualified name, with line numbers.
  • get_class — Fetch a full class reference card showing all public members (methods, fields, properties, events).
  • get_stats — Get an overview of the indexed codebase: file count, record counts, and namespace breakdown.
  • reindex — Trigger an incremental index update (mtime-based), re-parsing only changed, new, or deleted files.

Use cases

  • Look up method signatures and class members without reading full source files
  • Find APIs by keyword to understand what's available in a large codebase
  • Get targeted line numbers for efficient file reads using the Read tool
  • Reduce token usage and hallucination risk in AI-assisted code navigation
  • Index multiple projects separately and query across them in a single AI session

io.github.Codeturion/codesurface MCP server FAQ

What is codesurface?

codesurface is an MCP server that indexes your codebase's public API at startup and serves it through 5 compact tools (search, get_signature, get_class, get_stats, reindex). It supports C#, C++, Go, Java, Python, and TypeScript/JavaScript.

Is codesurface free?

Yes, codesurface is open-source under the MIT license and free to use.

How do I install it in Cursor or Claude?

Add it to your `.mcp.json` with `"command": "uvx"` and `"args": ["codesurface", "--project", "/path/to/your/src"]`, or install via pip and use `"command": "codesurface"`. Restart your AI tool and it will index automatically.

Does it require authentication?

No, codesurface does not require any authentication. It runs locally and indexes files on your machine.

What languages does it support?

C# (.cs), C++ headers (.h, .hpp, .hxx, .h++), Go (.go), Java (.java), Python (.py), and TypeScript/JavaScript (.ts, .tsx, .js, .jsx).

Can I exclude certain directories from indexing?

Yes, create a `.codesurfaceignore` file at your project root with glob patterns, or pass `--exclude` with comma-separated globs. By default it skips node_modules, vendor, build, dist, .git, and other common directories.

README (reference)

Source of truth, from the repository.

<!-- mcp-name: io.github.Codeturion/codesurface -->

codesurface

PyPI Version PyPI Downloads MCP Registry GitHub Stars GitHub Last Commit Languages License: MIT Python 3.10+ Blog Post

MCP server that indexes your codebase's public API at startup and serves it via compact tool responses, saving tokens vs reading source files.

Parses source files, extracts public classes/methods/properties/fields/events, and serves them through 5 MCP tools. Works with Claude Code, Cursor, Windsurf, or any MCP-compatible AI tool.

Supported languages: C# (.cs), C++ headers (.h, .hpp, .hxx, .h++), Go (.go), Java (.java), Python (.py), TypeScript/JavaScript (.ts, .tsx, .js, .jsx)

Quick Start

Add to your .mcp.json:

{
  "mcpServers": {
    "codesurface": {
      "command": "uvx",
      "args": ["codesurface", "--project", "/path/to/your/src"]
    }
  }
}

Point --project at any directory containing supported source files (a Unity Assets/Scripts folder, a Spring Boot project, a .NET src/ tree, a Node.js/React project, a Python package, etc.). Languages are auto-detected.

Restart your AI tool and ask: "What methods does MyService have?"

CLAUDE.md Snippet

Add this to your project's CLAUDE.md (or equivalent instructions file). This step is important. Without it, the AI has the tools but won't know when to reach for them.

## Codebase API Lookup (codesurface MCP)

Use codesurface MCP tools BEFORE Grep, Glob, Read, or Task (subagents) for any class/method/field lookup. This applies to you AND any subagents you spawn.

| Tool | Use when | Example |
|------|----------|---------|
| `search` | Find APIs by keyword | `search("MergeService")` |
| `get_signature` | Need exact signature | `get_signature("TryMerge")` |
| `get_class` | See all members on a class | `get_class("BlastBoardModel")` |
| `get_stats` | Codebase overview | `get_stats()` |

Every result includes file path + line numbers. Use them for targeted reads:
- `File: Service.cs:32` → `Read("Service.cs", offset=32, limit=15)`
- `File: Converter.java:504-506` → `Read("Converter.java", offset=504, limit=10)`

Never read a full file when you have a line number. Only fall back to Grep/Read for implementation details (method bodies, control flow).

Tools

ToolPurposeExample
searchFind APIs by keyword"MergeService", "BlastBoard", "GridCoord"
get_signatureExact signature by name or FQN"TryMerge", "CampGame.Services.IMergeService.TryMerge"
get_classFull class reference card with all public members"BlastBoardModel" → all methods/fields/properties
get_statsOverview of indexed codebaseFile count, record counts, namespace breakdown
reindexIncremental index update (mtime-based)Only re-parses changed/new/deleted files. Also runs automatically on query misses

search, get_signature, and get_class accept two optional filters:

  • file_path: scope results to a directory prefix or exact file (e.g. "src/services/" or "src/services/MergeService.ts")
  • include_tests: include test files in results (default false). Detects __tests__/, tests/, test/, *.test.*, *.spec.*, *_test.*, test_*

Tested On

ProjectLanguageFilesRecordsTime
vscodeTypeScript6,61188,2939.3s
PaperJava2,90933,9732.3s
client-goGo2192,7600.4s
langchainPython1,88012,4181.1s
pydanticPython3659,6480.3s
guavaJava8918,3772.4s
immichTypeScript9197,9570.6s
fastapiPython8815,7130.5s
ant-designTypeScript2,9475,4520.9s
difyTypeScript4,9035,0381.9s
crawlee-pythonPython3862,4730.3s
flaskPython63872<0.1s
cobraGo15249<0.1s
ginGo41574<0.1s
Unity game (private)C#1291,0180.1s

Line Numbers for Targeted Reads

Every record includes line_start and line_end (1-indexed). Multi-line declarations span the full signature:

[METHOD] com.google.common.base.Converter.from
  Signature: static Converter<A, B> from(Function<...> forward, Function<...> backward)
  File: Converter.java:504-506          ← multi-line signature

[METHOD] server.AlbumController.createAlbum
  Signature: createAlbum(@Auth() auth: AuthDto, @Body() dto: CreateAlbumDto)
  File: album.controller.ts:46          ← single-line

This lets AI agents do targeted reads instead of reading full files:

# Instead of reading the entire 600-line file:
Read("Converter.java")                     # 600 lines, ~12k tokens

# Read just the method + context:
Read("Converter.java", offset=504, limit=10)  # 10 lines, ~200 tokens

Benchmarks

Measured across 5 real-world projects in 5 languages, each using a 10-step cross-cutting research workflow.

Total Tokens, Cross-Language Comparison

LanguageProjectFilesRecordsMCPSkilledNaiveMCP vs Skilled
C#Unity game1291,0341,0214,45311,82577% fewer
TypeScriptimmich6948,3441,4514,50014,55068% fewer
Javaguava8918,3771,8514,20026,70056% fewer
Gogin385341,7912,77015,30035% fewer
Pythoncodesurface9407532,00010,40062% fewer

Hallucination Risk

Even with follow-up reads for implementation detail, the hybrid MCP + targeted Read approach uses 44% fewer tokens than a skilled Grep+Read agent and 87% fewer than a naive agent:

Hybrid Workflow

Per-question breakdown

Per Question

See workflow-benchmark.md for the full step-by-step analysis across all languages.

Filtering What Gets Indexed

By default, codesurface skips common vendored, build, and VCS directories: node_modules, vendor, bin, obj, dist, build, target, .git, .venv, __pycache__, and a few dozen others. Git worktrees and submodules are also skipped.

To exclude additional paths:

Project-level (committed): create a .codesurfaceignore file at your project root with one glob per line.

generated/**
docs/**
**/*.pb.go

Per-instance (CLI): pass --exclude with comma-separated globs.

{
  "command": "uvx",
  "args": ["codesurface", "--project", "src", "--exclude", "generated/**,vendor/**"]
}

Other indexing flags:

  • --include-submodules: index git submodules (skipped by default)
  • --language <name>: pin to a single parser (e.g. --language cpp) instead of auto-detecting

Multiple Projects

Each --project flag indexes one directory. To index multiple codebases, run separate instances with different server names:

{
  "mcpServers": {
    "codesurface-backend": {
      "command": "uvx",
      "args": ["codesurface", "--project", "/path/to/backend/src"]
    },
    "codesurface-frontend": {
      "command": "uvx",
      "args": ["codesurface", "--project", "/path/to/frontend/src"]
    }
  }
}

Each instance gets its own in-memory index and tools. The AI agent sees both and can query across projects.

Setup Details

<details> <summary>Alternative installation methods</summary>

Using pip install:

pip install codesurface
{
  "mcpServers": {
    "codesurface": {
      "command": "codesurface",
      "args": ["--project", "/path/to/your/src"]
    }
  }
}
</details> <details> <summary>Project structure</summary>
codesurface/
├── src/codesurface/
│   ├── server.py           # MCP server with 5 tools
│   ├── db.py               # SQLite + FTS5 database layer
│   ├── filters.py          # PathFilter (default exclusions, .codesurfaceignore, --exclude)
│   └── parsers/
│       ├── base.py         # BaseParser ABC
│       ├── cpp.py          # C++ header parser
│       ├── csharp.py       # C# parser
│       ├── go.py           # Go parser
│       ├── java.py         # Java parser
│       ├── python_parser.py # Python parser
│       └── typescript.py   # TypeScript/JavaScript parser
├── pyproject.toml
└── README.md
</details> <details> <summary>Troubleshooting</summary>

"No codebase indexed"

  • Ensure --project points to a directory containing supported source files (.cs, .h, .hpp, .go, .java, .py, .ts, .tsx, .js, .jsx)
  • The server indexes at startup. Check stderr for [codesurface] scanning N files... and [codesurface] done: lines

Server won't start

  • Check Python version: python --version (needs 3.10+)
  • Check mcp[cli] is installed: pip install mcp[cli]

Stale results after editing source files

  • The index auto-refreshes on query misses. If you add a new class and query it, the server reindexes and retries automatically
  • You can also call reindex() manually to force an incremental update
</details>

Contact

fuatcankoseoglu@gmail.com

License

MIT

Related MCP servers

Accurate Unity API documentation for AI agents—prevents hallucinated signatures across Unity 6, 2023, and 2022 LTS.

63
Python
View repository →

Accurate UE5 C++ API documentation for AI agents—prevents hallucinated signatures, includes, and deprecated calls.

87
Python
View repository →
MCmcp-scan logo

mcp-scan

Active

Passive security scanner: audits MCP servers against the OWASP MCP Top 10, graded A-F.

0
TypeScript
MIT
View repository →

Discover software problems, analyze evidence, and create implementation-ready Build plans.

MCP server for Riveter's enrichment, scraping, and monitoring API

An MCP server for natural language inference

3
Python
MIT
View repository →