MCP server for AI agents — structured code analysis that cuts token usage by 87%
Project description
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.
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% |
get_symbol_summaries |
AI semantic descriptions per symbol | reading implementation | ~85% |
Search & Navigation
| Tool | Returns | Replaces | Savings |
|---|---|---|---|
analyze_project |
language breakdown, file counts, tree | find + wc |
~98% |
code_search |
regex matches with context lines | grep + cat |
~90% |
semantic_search |
natural language query over indexed codebase | reading everything | ~96% |
dir_summary |
directory listing with sizes | ls -la |
~80% |
find_files |
files matching name, extension, path | find |
~80% |
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_metrics_report · get_metrics_events · get_metrics_daily_trend · get_metrics_slowest · 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% |
| Semantic query across codebase | ~8,000 tokens | ~300 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
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
PRs welcome. Open issues.
License
MIT — free for any use.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file cctx_mcp-0.5.3.tar.gz.
File metadata
- Download URL: cctx_mcp-0.5.3.tar.gz
- Upload date:
- Size: 61.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
88027a547e3d07a6be206215b582e4e535dca2fda0eea4343382d855e45e3ea6
|
|
| MD5 |
c76e28dfa96139f4c4b7982134369914
|
|
| BLAKE2b-256 |
a953481c587da10aed154fbe95e06cc5c0a634fe678798c0d67690de743ed3b4
|
File details
Details for the file cctx_mcp-0.5.3-py3-none-any.whl.
File metadata
- Download URL: cctx_mcp-0.5.3-py3-none-any.whl
- Upload date:
- Size: 59.0 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a0fc9d0f83ce7a8a03e1fffbb427636163c638c380a48d77ca9774ce27d2fec3
|
|
| MD5 |
d6f461d941d1604e4c4ffb841a3940ca
|
|
| BLAKE2b-256 |
131efc47653fc643b8548f13b121cfc7c1084d174a0d20ae9f8082d506c67877
|