Skip to main content

MCP server for AI agents — structured code analysis that cuts token usage by 87%

Project description

CCTX-MCP

Cut AI agent token usage by 87%.
Structure-aware code analysis via the Model Context Protocol — returns symbol trees, dependencies, and docs instead of raw file contents.

PyPI Python Stars CI License Beta


Overview

CCTX-MCP — Code ConTeXt via Model Context Protocol. An MCP server that gives AI agents a structured view of source code without reading entire files.

Built for Claude, Cursor, OpenCode, and any MCP-compatible AI coding tool.

uvx cctx-mcp  ·  Tools  ·  Savings  ·  Install


Quick Start

uvx cctx-mcp

Add to your MCP client config:

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

Tools

Code Analysis

Tool Returns Replaces Savings
smart_read symbol hierarchy, deps, docs, line counts cat + manual parsing ~87%
find_symbols symbol locations by name or type grep -r + file reads ~99%
get_dependencies all imports of a file in one shot grep ^import ~96%
trace_calls every call site with file + line grep across repo ~90%
analyze_project language breakdown, file counts, tree find + wc ~98%
get_symbol_summaries AI semantic descriptions per symbol reading implementation ~85%

Git & Commits

Tool Returns Replaces Savings
compact_change_intelligence structured git diff with intent cues git diff + git status ~75%
draft_commit AI-generated conventional commit message writing from scratch ~90%
approve_commit_draft executes the commit after review git add + git commit

Observability

get_config · get_health · get_version


Token Savings

Operation Native With CCTX-MCP Savings
Read 500-line file ~1,500 tokens ~200 tokens 87%
Find function across project ~5,000 tokens ~50 tokens 99%
Understand imports ~800 tokens ~30 tokens 96%
Analyze project structure ~10,000 tokens ~150 tokens 98%
Git change summary ~3,000 tokens ~750 tokens 75%

Typical session: 80%+ aggregate savings.


Supported Languages

Swift Python TypeScript JavaScript Rust Go Dart

Powered by tree-sitter AST — each language has a dedicated parser.


Install

uvx (recommended)

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

pip

pip install cctx-mcp
{
  "mcpServers": {
    "cctx-mcp": {
      "command": "python",
      "args": ["-m", "code_context.server"]
    }
  }
}

source

git clone https://github.com/nikondrat/cctx-mcp.git
cd cctx-mcp
uv sync
uv run python -m code_context.server --skip-index

Configuration

Variable Default Description
CC_OLLAMA_URL http://localhost:11434 Ollama server address
CC_OPENROUTER_API_KEY Remote inference key
CC_LLM_ROUTER local-first local-first, local-only, remote-first, remote-only
CC_COMMIT_MODEL gemma4:latest Local model for commit drafting
CC_EMBED_MODEL nomic-embed-text Local model for embeddings
CC_SEMANTIC_SUMMARIES 1 Enable AI symbol summaries

Development

uv sync
uv run pytest tests/ -v

Debug Logging

Tool calls are logged to ~/.code-context-cache/debug.jsonl with args, result preview, latency, and status:

tail -f ~/.code-context-cache/debug.jsonl

Set CC_DEBUG_LOG env var to change the log path.

PRs welcome. Open issues.


License

MIT — free for any use.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cctx_mcp-0.5.4.tar.gz (62.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cctx_mcp-0.5.4-py3-none-any.whl (60.4 kB view details)

Uploaded Python 3

File details

Details for the file cctx_mcp-0.5.4.tar.gz.

File metadata

  • Download URL: cctx_mcp-0.5.4.tar.gz
  • Upload date:
  • Size: 62.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cctx_mcp-0.5.4.tar.gz
Algorithm Hash digest
SHA256 358e8f48b441115bda11983dff5da8f2c26086fc5ca891f9b2e621f62112cdfc
MD5 b61f577de0f9931a57b763f9141c8fa3
BLAKE2b-256 dbbc2e68b326e4e0d3798929608a0b3dd0693cdbc88753de61187d8d1936a3b5

See more details on using hashes here.

File details

Details for the file cctx_mcp-0.5.4-py3-none-any.whl.

File metadata

  • Download URL: cctx_mcp-0.5.4-py3-none-any.whl
  • Upload date:
  • Size: 60.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.14 {"installer":{"name":"uv","version":"0.11.14","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for cctx_mcp-0.5.4-py3-none-any.whl
Algorithm Hash digest
SHA256 cc921735e034a5929e4796aba1d25ba13cb8f4319ebc2c872aae484245b48806
MD5 c648c8615a6d8774bb1f1f68ff002800
BLAKE2b-256 9d18c0c6bfa3217112c09638cc0b363235560021fd0d7f152c618ff4d3a52211

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page