PureContext MCP
Indexes codebases and lets AI agents retrieve precise code snippets (functions, classes, routes) instead of reading entire files, reducing token usage and improving accuracy.
README
PureContext MCP
Stop burning context tokens reading whole files. PureContext MCP indexes your codebase and lets AI agents retrieve exactly the code they need — a single function, a class, a route definition — without loading hundreds of irrelevant lines first.
Without PureContext: 800-line auth file → ~2,000 tokens to find one function
With PureContext: 45-line function → ~150 tokens
Savings: 93%
But token savings are the mechanism, not the point. The point is that AI gets better answers from precise context than from bulk context. Less hallucination. More accurate suggestions. The ability to work effectively on large codebases that don't fit in any context window.
Quick start
# 1. Connect to Claude Code (no global install needed)
claude mcp add purecontext-mcp -- npx purecontext-mcp@latest
# 2. Inside your project, install the workflow rules
# (auto-detects Claude / Cursor / Windsurf / Continue / Cline / Roo Code / VS Code / Claude Desktop)
npx purecontext-mcp@latest install all
Then in a Claude Code conversation:
Index my project at /path/to/my-project
That's it. Claude will index your codebase and you can start navigating it by name, by meaning, or by dependency — without reading files.
What this looks like in practice
A typical "find and understand" conversation, before vs. after:
Without PureContext
You: Where do we handle Stripe webhook signature verification?
Claude: I'll search the codebase.
[reads src/api/webhooks/stripe.ts — 412 lines, ~3,100 tokens]
[reads src/lib/stripe-client.ts — 287 lines, ~2,150 tokens]
[reads src/middleware/webhook.ts — 198 lines, ~1,490 tokens]
Verification happens in verifyStripeSignature() at line 87 of stripe.ts.
Total context used: ~6,740 tokens
With PureContext
You: Where do we handle Stripe webhook signature verification?
Claude: search_symbols(query: "stripe webhook signature")
→ 3 matches, 78 tokens
get_symbol_source(symbolId: "verifyStripeSignature")
→ 32 lines, 180 tokens
verifyStripeSignature() at src/api/webhooks/stripe.ts:87.
It uses the timing-safe HMAC check from Stripe's SDK with a 5-minute tolerance.
Total context used: ~258 tokens — 96% less
The agent stays in the conversation and can keep going (blast radius, related tests, change planning) instead of running out of context after one file read.
Measured search precision
PureContext is benchmarked on 87 real-world open-source projects with 25 curated ground-truth queries each. Top-rank precision (P@1) reaches 84% on NestJS, 84% on Terraform, 72% on Protobuf and GraphQL, 60% on Nix, 52% on LÖVE (Lua/C++), and 40% on Tokio (Rust). Full per-language tables, methodology, and reproduction steps are in BENCHMARKS.md.
Documentation
User Guide — start here
The guide explains what PureContext does, why each feature exists, and how to use it effectively in real-world situations. It covers both solo developers and team deployments.
| Why PureContext | The full case — beyond token savings |
| Navigating a New Codebase | Day one on an unfamiliar project |
| Finding Code | Three search modes with examples |
| Making Changes Safely | Blast radius and dependency analysis |
| Understanding Code Relationships | Call hierarchies, cycles, coupling, implementations |
| Refactoring Safely | Pre-flight checks before rename, delete, or move |
| Understanding Code History | Symbol-level git history and churn |
| The Web UI | Visual graph, heatmap, symbol timeline |
| AI Summaries | Better search on undocumented codebases |
| Code Health & Architecture Analysis | Quality metrics, anti-patterns, arch docs |
| Health Dashboards & Debt Reporting | Health radar, debt scores, PR health diffs |
| Visualizing Code Structure | Mermaid/DOT diagrams, architecture snapshots |
| AST-Level Search | Node types, signatures, decorators, complexity |
| Code Intelligence | Entry points, public API, TODOs, coverage |
| Language Support | All 34 supported languages and what's extracted |
| Framework Adapters | Vue, React, Django, Spring, Rails, Flutter, ORMs, and more |
| Using PureContext with a Team | Shared server, enterprise setup |
Real-world workflows:
| Onboarding to a New Codebase | First day on a 6,000-file microservices platform |
| Refactoring Legacy Code | Replacing auth in a 6-year-old Django monolith |
| Reviewing a Pull Request | 40-file PR, 45 minutes, two real bugs found |
| Running a Tech Debt Sprint | Two-week debt reduction: assess, plan, execute, measure |
Reference Manual
Parameter-level documentation for every tool, configuration option, language, framework adapter, and deployment option lives in docs/README.md. The reference manual is cross-linked with the user guide above — every topic has both a narrative and a reference page where one helps.
What it indexes
Languages
34 languages via bundled tree-sitter WASM grammars — no separate install required.
| Category | Languages |
|---|---|
| Web / Application | TypeScript, JavaScript, Python, PHP, Ruby, Go, Java, Kotlin, C#, Scala, Dart, Swift, Elixir, Haskell, Lua, R, Perl, Groovy, Erlang, Gleam |
| Systems | C, C++, Rust, Fortran, Objective-C |
| Scripting & Game | Bash, GDScript |
| Infrastructure & Config | Terraform / HCL, Nix |
| Data & API | SQL, Protobuf, GraphQL, OpenAPI / YAML, XML |
| Styling (regex-based) | SCSS, SASS, LESS, CSS |
→ Language Support guide · Full reference
Frameworks
Framework-aware extraction — routes, components, hooks, models, ORM entities, and middleware are pulled out as first-class symbols (not just functions and classes).
| Stack | Frameworks |
|---|---|
| JavaScript / TypeScript | Vue 3, React, Nuxt, Next.js (Pages + App Router), Angular, NestJS, Express, Fastify |
| Python | Django, FastAPI, Flask |
| Go | Gin, Echo, Fiber |
| PHP | Laravel, Symfony |
| Ruby | Rails, Sinatra |
| Java | Spring Boot, Micronaut, Quarkus |
| Kotlin | Ktor, Spring (Kotlin) |
| Rust | Axum, Actix-web, Rocket |
| Mobile | Flutter |
| ORMs | Hibernate, SQLAlchemy, Django ORM, Prisma, TypeORM |
→ Framework Adapters guide · Full reference
Installation
Requirements: Node.js 18, 20, or 22. Prebuilt binaries included for Windows, macOS, and Linux — no native compilation needed.
Claude Code
claude mcp add purecontext-mcp -- npx purecontext-mcp@latest
Claude Desktop
Edit ~/.claude/claude_desktop_config.json:
{
"mcpServers": {
"purecontext": {
"command": "npx",
"args": ["purecontext-mcp@latest"]
}
}
}
Cursor
Create .cursor/mcp.json in your project (or ~/.cursor/mcp.json for global):
{
"mcpServers": {
"purecontext": {
"command": "npx",
"args": ["purecontext-mcp@latest"]
}
}
}
Windsurf
Open Windsurf Settings → MCP section, or edit the MCP config file directly:
{
"mcpServers": {
"purecontext": {
"command": "npx",
"args": ["purecontext-mcp@latest"]
}
}
}
VS Code
Create .vscode/mcp.json in your project:
{
"servers": {
"purecontext": {
"type": "stdio",
"command": "npx",
"args": ["purecontext-mcp@latest"]
}
}
}
Shared team server (HTTP)
If your team runs a shared PureContext server, connect with an HTTP transport instead:
{
"mcpServers": {
"purecontext": {
"transport": "http",
"url": "https://purecontext.yourcompany.com/mcp/sse",
"headers": {
"Authorization": "Bearer pctx_yourpersonalkey"
}
}
}
}
Teaching your AI agent to use PureContext well
Installing PureContext gives your agent the tools. Adding the agent instructions tells it how to use them — which tool to pick for each task, in what order, and what to avoid.
Without these instructions, an agent may default to reading entire files rather than using search_symbols, or may not know to call list_repos first to get the repository ID required by every tool.
One-command install (recommended)
Run this once inside your project directory:
npx purecontext-mcp@latest install all
This auto-detects which AI coding tools you have set up in the project and writes the PureContext workflow rules to the right place for each. Re-running is safe — every writer is idempotent (managed blocks are marked and replaced rather than appended).
When no --scope flag is given, the CLI prompts you to choose where to install:
Where should PureContext be installed?
1) Local — this project only
2) Global — all projects (user-level config)
3) Both
Pass --scope to skip the prompt:
npx purecontext-mcp@latest install all --scope=local # this project only
npx purecontext-mcp@latest install all --scope=global # user-level, all projects
npx purecontext-mcp@latest install all --scope=both # both places at once
For a single tool:
npx purecontext-mcp@latest install <tool> --scope=global
To preview without writing files:
npx purecontext-mcp@latest install all --dry-run
npx purecontext-mcp@latest install --list # show which IDEs were detected
Supported tools and where each one writes:
| Tool | Local | Global |
|---|---|---|
claude |
CLAUDE.md in project |
~/.claude/CLAUDE.md + hooks |
cursor |
.cursor/rules/purecontext.mdc |
~/.cursor/rules/purecontext.mdc |
windsurf |
.windsurfrules |
~/.windsurfrules |
continue |
.continue/config.json |
~/.continue/config.json |
cline |
.clinerules |
local only |
roo-code |
.roo/rules-code.md |
local only |
vscode |
.github/copilot-instructions.md |
local only |
claude-desktop |
always global | always global |
Manual install
If you'd rather paste the rules yourself, three instruction files are at the repository root:
AGENT_INSTRUCTIONS_SHORT.md— ~2 KB. Mandatory workflow, tool selection table, core rules. Use for agents with limited system-prompt space.AGENT_INSTRUCTIONS.md— ~15 KB. Adds parameter notes, decision trees, anti-patterns.AGENT_REFERENCE.md— ~30 KB. Full tool reference with every parameter, every navigation pattern, and every known limitation. Installed automatically byhooks --install; read this when an agent needs the canonical answer.
Paste the contents into whatever system prompt, memory, or rules configuration your agent uses.
License
MIT — see LICENSE.
Contributing
Issues and pull requests are welcome at github.com/goranocokoljic/pure-context. Before opening a feature PR, please open an issue to discuss the design — the three-layer architecture (Core → Handlers → Adapters) has hard rules about dependency direction that are easy to violate accidentally. See CLAUDE.md at the project root for the architectural conventions.
For language or framework adapters: pick a real-world repository, add a 25-query ground-truth file in benchmarks/<project>/queries.json, and include benchmark numbers (P@1 / P@3 / R@5) in the PR description so reviewers can confirm the change is a net improvement.
Support
- Bug reports and feature requests: GitHub Issues
- Questions about MCP integration: Open a Discussion on the repository
- Changelog: CHANGELOG.md
- Stability and semver policy: docs/27-api-stability.md
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。