# Token Context MCP

> Token Context MCP is an open-source MCP server for developer tools. On-demand, local code-context server giving coding agents AST-level symbol retrieval. 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/mck564/token-context-mcp
- **MCP Registry name:** io.github.MCK564/token-context-mcp
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-18

## About

Token Context MCP takes a pull approach to code context. Instead of packing a repository into one static snapshot, the agent asks for a repo map, a symbol, a call graph slice or a file skeleton, and each answer comes back inside a token budget with file, line and SHA-256 evidence. Output is capped at syntax boundaries so a function is not cut in half.

It indexes Python, JavaScript and TypeScript, Go, Rust, Java, C and C++, and C# with Tree-sitter into a SQLite graph, using modification time plus hashes to detect changes. A middleware pipeline resolves agent identity, applies per-agent policies and rate limits, and enforces the result cap. An optional evidence ledger stores verified query-to-answer citations outside the repository and re-checks them on each read.

The default tool list is deliberately small: ten read-only tools, with extension and admin tools hidden until requested. The README reports its own benchmarks against a static packing tool, which are the author's measurements. It also ships an optional desktop GUI controller.

## Features

- **Token-budgeted retrieval:** Each tool returns results within a configurable token cap.
- **Tree-sitter indexing:** Parses eight language families into a persistent SQLite symbol graph.
- **Impact slices:** Traverses downstream call dependencies before a change is made.
- **Evidence ledger:** Stores citation cards with line and hash and re-verifies them against disk.
- **Small default tool list:** Exposes ten read-only tools to limit prompt overhead.
- **Per-agent governance:** Applies access policies, rate limits and an emergency halt.

## Good for

- Give a coding agent exact function bodies instead of a whole-repo dump
- Check what a change might break before editing
- Orient an agent in an unfamiliar codebase with a compact repo map
- Find symbols by wildcard pattern across a project

## Install

### Claude Code (Terminal)

```sh
claude mcp add token-context-mcp -- uvx token-context-mcp
```

### Claude Desktop (claude_desktop_config.json)

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

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

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

### VS Code (.vscode/mcp.json)

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

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

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

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

## Tools

- `list_repositories`: Lists registered repo ids without leaking filesystem paths.
- `get_index_status`: Returns snapshot metadata, indexed file count, commit SHA and freshness.
- `get_repo_map`: PageRank-based symbol hierarchy within a token budget.
- `find_symbols`: Pattern-based symbol matching with wildcards and file coordinates.
- `search_source`: FTS5 code search returning matched lines and enclosing symbol spans.
- `get_file_skeleton`: File outline with imports and signatures with bodies elided.
- `get_symbol_context`: Full function or class body, docstrings and callers and callees.
- `get_impact_slice`: Traverses downstream call graph dependencies before making changes.
- `get_module_dependents`: Tree-sitter import dependency graph between modules.

## FAQ

### How do I run it?

Use uvx token-context-mcp quickstart . or pip install token-context-mcp, then register and index a repo.

### Which agents are documented?

Claude Code, Cursor, Claude Desktop and Google Antigravity or Gemini CLI.

### Does it send code anywhere?

It communicates over local stdio and keeps its index and ledger on your machine.

### Which languages are supported?

Python, JavaScript and TypeScript, Go, Rust, Java, C and C++, and C#.

### Is Token Context MCP free?

Yes. Token Context MCP is open source, so you can use and self-host it for free.

### How do I add Token Context MCP to Claude Code?

Run this command in your terminal: claude mcp add token-context-mcp -- uvx token-context-mcp

### What are the best alternatives to Token Context MCP?

The closest alternatives to Token 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-2): 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.
- [awesome-mcp-servers](https://ai-powered.com/mcp/awesome-mcp-servers-2): awesome-mcp-servers 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.

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