MCP Hub
Back to servers

codesurface

Indexes your codebase's public API and serves it via compact MCP tool responses.

Stars
4
Updated
Feb 26, 2026
Validated
Feb 28, 2026

Quick Install

uvx codesurface

codesurface

PyPI Version PyPI Downloads MCP Registry 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), Go (.go), Java (.java), Python (.py), TypeScript/TSX (.ts, .tsx)

Quick Start

pip install codesurface

Then add to your .mcp.json:

{
  "mcpServers": {
    "codesurface": {
      "command": "codesurface",
      "args": ["--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?"

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

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

Benchmarks

Measured against a real Unity game project (129 files, 1,018 API records) across a 10-step cross-cutting research workflow.

StrategyTotal Tokensvs MCP
MCP (codesurface)1,021
Skilled Agent (Grep + partial Read)4,4534.4x more
Naive Agent (Grep + full Read)11,82511.6x more

Even with follow-up reads for implementation detail, the hybrid MCP + targeted Read approach uses 54% fewer tokens than a skilled Grep+Read agent.

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

Setup Details

Claude Code configuration

Add to <project>/.mcp.json:

Using uv (recommended):

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

Using pip install:

{
  "mcpServers": {
    "codesurface": {
      "command": "codesurface",
      "args": ["--project", "/path/to/your/src"]
    }
  }
}
CLAUDE.md snippet (recommended)

Add to your project's CLAUDE.md so the AI knows when to use the tools:

## Codebase API Lookup (codesurface MCP)

Use the `codesurface` MCP tools to look up your project's classes, methods, properties, and fields instead of reading source files.

| When | Tool | Example |
|------|------|---------|
| Searching for an API by keyword | `search` | `search("MergeService")` |
| Need exact method signature | `get_signature` | `get_signature("TryMerge")` |
| Want all members on a class | `get_class` | `get_class("BlastBoardModel")` |
| Overview of indexed codebase | `get_stats` | `get_stats()` |
| After creating/deleting source files | `reindex` | `reindex()` |
Project structure
codesurface/
├── src/codesurface/
│   ├── server.py           # MCP server — 5 tools
│   ├── db.py               # SQLite + FTS5 database layer
│   └── parsers/
│       ├── base.py         # BaseParser ABC
│       ├── csharp.py       # C# parser
│       ├── go.py           # Go parser
│       ├── java.py         # Java parser
│       ├── python_parser.py # Python parser
│       └── typescript.py   # TypeScript/TSX parser
├── pyproject.toml
└── README.md
Troubleshooting

"No codebase indexed"

  • Ensure --project points to a directory containing supported source files (.cs, .go, .java, .py, .ts, .tsx)
  • The server indexes at startup — check stderr for the "Indexed N records" message

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

  • Call reindex() — only re-parses files whose modification time changed, fast even on large codebases

Contact

fuatcankoseoglu@gmail.com

License

MIT

Reviews

No reviews yet

Sign in to write a review