mcp-code-context
You can use this MCP server to map, inspect, search, and safely edit code at the AST/symbol level across a repository.
Generate compressed repository maps and parse files into symbols.
Read full files, line ranges, or specific symbols/classes; batch-read multiple symbols in one call.
Search code patterns and AST symbols with fuzzy matching, filters, and pagination.
Analyze dependency impact and explain symbol signatures/locations/callers.
Preview then confirm surgical code changes: replace, insert, remove, rename, and AST transforms.
Roll back changes, clean backups, manage caches/file watchers, and inspect rate-limit, server, session, and pending-operation status.
Provides code context and surgical editing tools for AI agents within Amazon Q.
Provides code context and surgical editing tools for AI agents within GitHub Copilot.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-code-context extract the function 'login' from user.js"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-code-context
MCP server with Tree-sitter WASM parsers for 100% AST accuracy. Zero native dependencies. Production-ready with persistent caching, structured logging, fuzzy search, multi-process safety, and session-scoped state.
š Quick Start (Claude Desktop)
Install:
npm install -g mcp-code-contextConfigure: Add to
claude_desktop_config.json:
{
"mcpServers": {
"code-context": {
"command": "npx",
"args": ["-y", "mcp-code-context"]
}
}
}Enjoy: Use symbols like
@code-contextto map repos or edit code surgically.
No build tools required - Works on Windows/Mac/Linux without Visual Studio, Python, or node-gyp.
Works with Claude Desktop, Cursor, Windsurf, GitHub Copilot, Amazon Q, and any Model Context Protocol compatible client.
š For AI Agents: See INSTRUCTIONS.md for essential usage patterns and best practices.
Related MCP server: Semantic Cache MCP
š± Certified SRE & Adversarial Resilience Dashboard (v18.0)
"And whatsoever ye do, do it heartily, as to the Lord, and not unto men..." ā Colossians 3:23
mcp-code-context is verified under the rigorous OMNI-MAXIMUS v18.0 adversarial AppSec & SRE verification suite, enforcing zero-sycophancy, physical computation limits, and zero-false-positive executable PoC falsification.
š”ļø Resilience Scorecard
Dimension | Points | Score | Audit Verification |
AppSec & Taint Flow | 25 | 25 / 25 | Static taint flow verified; 0 command injection, 0 path traversal |
Concurrency & ACID | 20 | 20 / 20 |
|
Physical Resource Bounds | 20 | 19 / 20 | Streaming chunks ≤ 8192 B; WASM |
Protocol & Wire Contracts | 20 | 19 / 20 | Stdio & SSE Streamable HTTP; dual-transport contract verified |
Supply Chain & Sentinel NIH | 15 | 15 / 15 | 100% exact semver pinning; 0 wildcard deps; pure WebAssembly |
TOTAL SCORE | 100 | 98 / 100 | CERTIFIED READY FOR PRODUCTION (Threshold ≥ 95) |
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā š± OMNI-MAXIMUS DETERMINISTIC 6-GATE AUDIT PIPELINE ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā [ā] GATE 0: Supply Chain & Sentinel NIH Shield -> 100% Pinned, Pure WASM ā
ā [ā] GATE 1: AST Topology & Cartography (1332 N) -> 53 Tools, 0 Import Loops ā
ā [ā] GATE 2: SRE Physical Limits Matrix (SEV-1..7)-> Fixed Buffers & Locks ā
ā [ā] GATE 3: Interface Forensics & Error Traps -> Dual Stdio/SSE Contract ā
ā [ā] GATE 4: Mandatory PoC Falsification -> 49/49 False Positives ā
ā [ā] GATE 5: Verification & Zero Regressions -> 304/304 Tests Passing ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāCandidate Lead | Trigger | Surgical Inspection & Falsation Verdict | Status |
EXEC_COMMAND (28 sites) |
| 26 are JavaScript | FALSE POSITIVE |
HARDCODED_SECRET (3 sites) |
| String templates explaining write tool confirmations and unit test rejection tokens. Zero credentials. | FALSE POSITIVE |
EVAL / SQL_PATTERN (14 sites) |
| Tree-sitter query rules detecting security antipatterns in analyzed target code, not executions in this server. | FALSE POSITIVE |
š” Why This Exists
This tool was born out of necessity in Caracas, Venezuela š»šŖ, where economic limitations made every API token count. When you're choosing between groceries and Claude API credits, you learn to optimize fast.
What started as a personal script to compress context windows became a full MCP server when I realized others faced the same problem: LLM APIs are expensive, and most tools waste tokens on boilerplate.
If this tool saves you money or time, consider supporting its development. Every contribution helps keep this project maintained and free for everyone.
The Problem
LLMs working with code face two bottlenecks:
Reading: Sending raw source files wastes the context window on function bodies and boilerplate. A 500-line file might contain only 30 lines of structural information the LLM needs.
Writing: Rewriting entire files to change one function is error-prone, token-expensive, and risks corrupting unrelated code.
The Solution
mcp-code-context provides 53 tools ā covering reading, writing, AST transformation, search, and session management ā all operating at the symbol level (functions, classes, methods). Tools support a className scope to correctly isolate identical symbol names in the same file (e.g. Flutter build() methods). Read tools extract structural skeletons. Write tools splice changes into the exact AST location.
File | Original | Compressed | Reduction |
PHP class (426 lines) | 426 | 60 | 85.9% |
Dart repository (230 lines) | 230 | 30 | 87.0% |
PHP config (68 lines) | 68 | 15 | 77.9% |
Token Savings
Real-world results:
TypeScript project: 73% reduction in tokens sent to LLM
PHP application: 82% reduction
Dart codebase: 79% reduction
š§ First-Class Companion Agent Skill (code-context-pro)
mcp-code-context is more than an MCP server: it ships with its own first-class agent skill located at skills/code-context-pro/SKILL.md.
When loaded into Claude Code, Cursor, Windsurf, or Antigravity, this skill equips the AI agent with 3 non-negotiable architectural axioms:
Token Budget Invariant (< 20% Budget Consumption): Prohibits dumping files > 50 lines into context. Enforces
read_file_surgical(filePath, symbolName)for surgical 15-line symbol extraction.Zero-Guessing Architecture Map: Forces agents to run
get_semantic_repo_map(directoryPath, format: "xml")before refactoring, obtaining a complete structural skeleton at 12% of the token cost of raw files.Two-Phase Atomic Mutation (Preview -> Confirm): All write tools (
write_file_surgical,insert_symbol,rename_symbol) generate dry-run diffs with ephemeral cryptographicconfirmationTokens and automatic rolling backups before committing to disk.
š¦ How to Install the Companion Skill:
Claude Code: Copy
skills/code-context-proto~/.claude/skills/code-context-pro/Cursor: Copy to
.cursor/skills/code-context-pro/Antigravity: Copy to
.agents/skills/code-context-pro/or~/.gemini/config/skills/
flowchart TD
Start["Developer asks for code modification or exploration"] --> QueryType{"What is the goal?"}
QueryType -->|"Explore Architecture"| Map["Call get_semantic_repo_map\n(85% Token Compression)"]
QueryType -->|"Find Symbol by Name"| Sym["Call search_symbols\n(AST Query, not text regex)"]
QueryType -->|"Find Exact String / Text"| Grep["Call search_code_pattern\n(Fuzzy or Regex)"]
QueryType -->|"Read Specific Symbol"| SurgRead["read_file_surgical(filePath, symbolName)"]
QueryType -->|"Modify Code Safely"| SurgWrite["write_file_surgical (Preview -> Confirm)"]Reliability & Testing
Built to be robust and precise. Both read and write engines are tested against real-world, complex codebases (including nested generic types in Dart, complex interfaces in PHP, and multi-file rename operations) with a 100% test pass rate across all languages and operations.
Production-Ready Features
Feature | v3.6.x | v3.8.0+ | Benefit |
Multi-process safety | ā | ā | No file corruption |
Persistent cache | ā | ā | <100ms cache hits |
Session-scoped state | ā | ā | No state leakage between clients |
Crash recovery | ā | ā | Pending operations survive restart |
Expanded ReDoS protection | 6 patterns | 15+ patterns | Better security |
Auto-persist before eviction | ā | ā | Cache data preserved |
Features
What's New in v7.0.0 (Enterprise Polyglot)
Feature | Description |
𧬠53 Pure AST WebAssembly Tools | Full enterprise polyglot suite with zero native dependencies across TypeScript, Python, PHP, Dart, Java, Go, C#, Ruby, Rust, and Kotlin. |
š | Tree-sitter S-expression queries with syntax highlighting and regex capture filtering. |
ā” | O(log N) tree diffing with |
š | McCabe Cyclomatic and Sonar Cognitive complexity analysis. |
š§Ŗ | Strongly-typed mocks/factories without LLM hallucination. |
š§ | Dead code and zombie export detection across the workspace. |
š | Complete lexical scope tree and variable shadowing detector. |
š”ļø | Embedded SQL taint analysis and syntax validator. |
š | CST-preserving code transformations (CJS-to-ESM, console stripping). |
ā±ļø | Event loop blocking calls detector in async functions. |
š | Drift auditor between code |
šØ | Empty catch and missing telemetry detector. |
š£ļø | Static endpoint extraction for Express, FastAPI, and Rails. |
š³ | Inheritance flattener resolving ancestor methods and traits. |
š | Tarjan's SCC O(V+E) import cycle detector. |
š” Startup Diagnostics Signature | Startup banner prints |
Previous: v3.9.2
Feature | Description |
š”ļø Smart Project Root Discovery |
|
š Optional Schema Requirements |
|
š”ļø SecurityValidator Fallback Guard |
|
š” Startup Diagnostics Signature | Startup diagnostics banner prints |
Previous: v3.9.1
Feature | Description |
š | Routes inside |
šŗļø Repo map: Gems + Concerns |
|
š§ | Supports |
Previous: v3.9.0
Feature | Description |
š | Parses Gemfile and returns implicit gem behaviors (devise adds |
š | Scans Ruby files for |
šŗļø | Parses |
š Concern resolution in |
|
Previous: v3.8.0
Feature | Description |
š Session-scoped state | Each MCP client gets isolated locks, confirmation store, rate limiter (no state leakage) |
š¾ Crash recovery | SQLite-backed pending operations store - survive restarts |
š Expanded ReDoS protection | 15+ patterns (was 6) - better protection against regex DoS |
ā” Auto-persist before eviction | CacheManager now persists before LRU eviction |
š Higher file limits | MAX_FILES_REPO_MAP = 2000 (was 500) |
š§Ŗ Multi-client tests | New integration tests for concurrent MCP clients |
š New tools: | Session-aware operations |
š Ruby full support | Complete |
šļø ActiveRecord Virtual Schema | Parses |
Previous Versions (v3.6.x)
Feature | Description |
ā” Persistent Cache | WASM SQLite cache ā <100ms hits, 10Ć faster on repeated reads |
š Structured Logging | pino JSON logging to stderr (MCP-safe, never pollutes stdio) |
šļø File Watcher | chokidar auto-invalidates cache on file changes |
š Fuzzy Search | fuse.js finds |
š Pagination | Search defaults to 10 results with |
š Multi-process Safe | Filesystem locks via |
š¾ OS Temp Backups | Backups in |
š§Ŗ 74 Tests | Unit + integration + performance + stress tests |
šÆ Token Savings | 50-80% reduction: compact diffs, no Phase 2 repeat, auto-optimize output |
Read
š³ AST-based compression ā Real Tree-sitter WASM parsers for TypeScript/JavaScript/Python/PHP/Dart. Zero regex-based parsing.
š¬ Surgical symbol extraction ā Extract a single function, class, or method from a file by name. Use
classNameto scope disambiguation (e.g., getting multiplebuild()methods in Dart).š„ Impact analysis ā Discover all files that depend on a given file before refactoring. Supports ES imports, CommonJS
require(), Python imports, PHPuse/require_once/include, and Dart imports.š Smart file walking ā Respects
.gitignoreand.repomixignorerules. Automatically excludesnode_modules,dist,vendor,.git, etc.š Multi-format output ā XML (optimized for LLM consumption) or Markdown (human-readable).
Write
āļø Surgical symbol replacement ā Replace a function, method, or class body without touching the rest of the file. Narrow down the target using the
classNameparameter.ā Precise code insertion ā Insert new code before/after a symbol, or inside a class at the start/end.
š Repository-wide rename ā Rename a symbol in its definition AND all files that import it, atomically.
šļø Safe symbol removal ā Delete code with automatic dependency checking to prevent breakage.
š Mandatory dry-run flow ā Write tools return a preview diff and a
confirmationTokenby default. Changes are only applied after explicit confirmation.š¾ Robust rolling backups ā Automatically keeps the last 5 versions of modified files in the OS temp directory.
āŖ Surgical rollback ā Revert files to any of the 5 previous states using the
rollback_filetool.���� Fuzzy symbol matching ā When a symbol is not found, the server provides structured suggestions based on Levenshtein distance.
š Private symbol support ā Full support for
_and__prefixed symbols in Dart and Python.
Supported Languages
Language | Read (Compress + Extract) | Write (Replace + Insert + Rename + Remove) | Import Analysis |
TypeScript / JavaScript | ā AST (Tree-sitter WASM) | ā AST (Tree-sitter WASM) | ā |
PHP | ā AST (Tree-sitter WASM) | ā AST + line-splice | ā |
Dart | ā AST (Tree-sitter WASM) | ā AST + line-splice | ā |
Python | ā AST (Tree-sitter WASM) | ā Indentation-aware | ā |
Ruby | ā AST (Tree-sitter WASM) + ActiveRecord Virtual Schema | ā AST byte-offset splice | ā |
Others (JSON, YAML, CSS, etc.) | Passthrough / truncation | ā | ā |
ā ļø Known Limitations
rename_symbol Tool
All languages: The definition file is renamed using AST (Tree-sitter) ā safe and precise. ā
Cross-file rename (dependent files): Updated using regex word-boundaries for all languages, including TypeScript, JavaScript, and PHP.
Risk: Regex may match strings, comments, or unrelated identifiers sharing the same name
Dart and Python: Higher risk ā import syntax (
import 'package:...',from module import name) is less reliably matched by the current regex patternsRecommendation: Always review the generated diff carefully before confirming
Alternative: Use
write_file_surgicalto rename within a single file safely
get_semantic_repo_map Tool
Max files: Limited to 2000 files to prevent timeouts (increased from 500 in v3.8.0)
Performance: Synchronous I/O may take 10-30 seconds on large repositories
Recommendation: Use
@foldersyntax to target specific directories
General
Validation: No automatic syntax checking after edits. Always review diffs carefully before confirming.
Backups: 5-version rolling backup system. Use
rollback_fileif something goes wrong.Large files: Files >10MB are skipped for safety.
Phase 2 tokens: Confirmation tokens expire after 5 minutes.
Installation
# Global installation (recommended)
npm install -g mcp-code-context
# Or use directly with npx (no installation)
npx -y mcp-code-contextNote: Unlike v2.x, this version uses web-tree-sitter (WASM) instead of native bindings. No Visual Studio, Python, or node-gyp required!
Session State (v3.8.0+)
Important: v3.8.0 introduced session-scoped state for each MCP client connection. This prevents state leakage when multiple agents (Amazon Q, Kiro, Cursor, etc.) use the same server instance.
What Changed
Before (v3.6.x) | After (v3.8.0+) |
Global | Session-scoped |
Global | Session-scoped confirmation store + SQLite persistence |
Global | Per-session token bucket |
No crash recovery | SQLite-backed pending operations store |
Benefits
ā No state leakage: Each agent gets isolated locks, confirmation store, and rate limiter
ā Crash recovery: Pending operations survive server restarts
ā Multi-agent safe: Amazon Q and Kiro can run simultaneously without conflicts
Configuration
No additional configuration needed. Session isolation is automatic. Just configure your MCP server normally:
{
"mcpServers": {
"mcp-code-context": {
"command": "npx",
"args": ["-y", "mcp-code-context"]
}
}
}Ruby Intelligence Tools (v3.9.x)
get_gemfile_contextā Parse Gemfile, get implicit gem behaviors (devise, sidekiq, pundit, etc.)find_metaprogrammingā Scan fordefine_method,method_missing,class_eval, concerns,has_many :throughget_rails_routesā Parseconfig/routes.rbinto structured route map with namespace supportget_session_statsā Get stats for current session onlyclear_session_cacheā Clear cache for current session onlylist_pending_operationsā List pending operations for recovery
Configuration
Claude Desktop
Add to your claude_desktop_config.json:
{
"mcpServers": {
"mcp-code-context": {
"command": "npx",
"args": ["-y", "mcp-code-context"]
}
}
}Cursor
Add to your Cursor MCP settings (.cursor/mcp.json):
{
"mcpServers": {
"mcp-code-context": {
"command": "npx",
"args": ["-y", "mcp-code-context"]
}
}
}Windsurf
Add to your Windsurf MCP config:
{
"mcpServers": {
"mcp-code-context": {
"command": "npx",
"args": ["-y", "mcp-code-context"]
}
}
}Amazon Q
Add to your Amazon Q MCP config:
{
"mcpServers": {
"mcp-code-context": {
"command": "npx",
"args": ["-y", "mcp-code-context"]
}
}
}Kiro
Add to your Kiro MCP config (.kiro/settings/mcp.json):
{
"mcpServers": {
"mcp-code-context": {
"command": "npx",
"args": ["-y", "mcp-code-context"]
}
}
}Antigravity
Add to your Antigravity MCP config (.antigravity/mcp.json):
{
"mcpServers": {
"mcp-code-context": {
"command": "npx",
"args": ["-y", "mcp-code-context"]
}
}
}Other MCP Clients
Any MCP-compatible client can use this server. The transport is stdio (JSON-RPC over stdin/stdout). Point your client to npx -y mcp-code-context.
Tools
Tool Reference (53 tools)
Read Tools
Tool | Key Params | Description |
|
| Compressed XML/Markdown repo overview with AST symbols |
|
| Extract one symbol or full file |
|
| All files that depend on this file |
|
| Read a line range or pattern context |
|
| Regex search across files (ripgrep-fast) |
|
| All symbols with line numbers (cheap index) |
|
| AST symbol search by name, not text |
|
| Signature + location + callers in one call |
|
| N symbols from N files in 1 round-trip |
| ā | Token balance + |
Write Tools (Two-Phase: preview ā confirm)
All write tools require two calls:
Phase 1 ā Call normally ā returns
diff+confirmationTokenPhase 2 ā Call again with
confirm: true+confirmationTokenā applies changes
newContent/code are not required in Phase 2 ā the server stores them from Phase 1.
Tool | Key Params | Description |
|
| Replace a symbol with new code |
|
| Insert code before/after/inside a symbol |
|
| Remove a symbol (with dependency check) |
|
| Rename across entire repo (AST + regex) |
|
| Declarative transforms: |
Admin / Recovery Tools
Tool | Key Params | Description |
|
| Restore file from rolling backup (up to 5 versions) |
|
| Delete all backups for this project |
| ā | Telemetry, audit stats, rate limiter state |
|
| Cache entries, size, hit rate |
|
| Invalidate cache for this project |
|
| Auto-invalidate cache on file changes |
|
| Watcher state + watched paths |
| ā | Per-session: pending ops, locks, tokens |
|
| Clear cache for current session only |
| ā | List pending Phase 1 tokens (crash recovery) |
Recommended Workflow
Understand ā
get_semantic_repo_mapto see the architectureRead ā
read_file_surgicalwith symbol name for specific implementationsAssess ā
analyze_impactbefore modifying shared filesEdit (Preview) ā Call write tools to generate a
diffandconfirmationTokenConfirm ā Call the same write tool with the token and
confirm: trueto applyRecovery ā Use
rollback_fileif something goes wrong after confirmation
š° Support This Project
Why Support?
This tool was born in Caracas, Venezuela š»šŖ, where economic limitations mean every API token counts. What started as a personal script to save money on Claude API became a full MCP server when I realized others faced the same problem.
Current Reality:
ā° ~10 hours/week of maintenance
šµ ~$20/month in costs (npm, testing, domain)
š 100% free and open source (always will be)
If this tool saves you time or money, consider supporting its development.
š³ Ways to Support
š¹ One-Time Donation
Ko-fi (PayPal + Cards, 0% fees)
ko-fi.com/achatainga
PayPal (Direct)
paypal.me/achatainga
Binance (USDT) (Crypto, lowest fees)
TRC20/ERC20:
0xa68d53f7853ce0175eb96aaad4a30c068ca96444Binance Pay ID:
367669339
Recommended: TRC20 for lower gas fees
Suggested Amounts:
ā $5 - A coffee (1 hour of development)
š $25 - A pizza (testing a new language)
š $100 - Rocket fuel (major feature development)
š¹ Recurring Support
Ko-fi Membership
ko-fi.com/achatainga/tiers
Monthly tiers:
$5/month - Supporter (name in SPONSORS.md)
$25/month - Contributor (priority support, early access)
$100/month - Sponsor (feature requests, 1-on-1 consultation)
š¹ Hire Me
Need custom MCP tools or AI integrations?
š¼ Available for: Freelance contracts
š Location: Caracas, Venezuela (Remote)
š» Skills: TypeScript, Node.js, MCP, AI/LLM integrations
šµ Rate: $50-75/hour
š§ Contact: a.chataing.a@gmail.com
š Details: HIRE_ME.md
š Transparency
I believe in radical transparency:
Current Status:
š° Donations received: $0
šø Expenses: $20/month (npm, testing)
ā° Time invested: ~10 hours/week
š¦ Downloads: 10,000+/month
(Updated monthly)
š Hall of Fame
Thank you to these amazing supporters:
(No sponsors yet - be the first!)
See full list: SPONSORS.md
ā¤ļø Non-Financial Support
Can't donate? No problem! You can still help:
ā Star the repo on GitHub
š Report bugs or suggest features
š Improve documentation
š£ļø Share with others who might benefit
š¬ Join discussions and help other users
Every contribution matters, financial or not.
Development
# Build
npm run build
# Run tests
npm test
# Development (build + start)
npm run devTechnical Details
Transport: stdio (JSON-RPC over stdin/stdout)
Runtime: Node.js >= 18
Protocol: Model Context Protocol
AST Engines: web-tree-sitter@0.25.1 (WASM) for TypeScript/JS/Python/PHP/Dart
Language Grammars: tree-sitter-wasms@0.1.13 (ABI v15)
Cache: sql.js@1.14.1 (WASM SQLite, zero native deps)
Logging: pino@10.3.1 (JSON to stderr, MCP-safe)
File Watcher: chokidar@5.0.0 (auto cache invalidation)
Fuzzy Search: fuse.js@7.3.0 (typo-tolerant matching)
File Locking: proper-lockfile@4.1.2 (multi-process safe, OS temp)
Diff: diff-match-patch@1.0.5 (Myers algorithm, O(n+d²))
Ignore Engine:
ignorenpm package (full .gitignore spec support)Safety Features: Mandatory two-phase confirmation, rolling 5-version backups, fuzzy matching, dependency checking, surgical restoration, ReDoS protection via worker_threads, session-scoped state.
Portability: 100% WASM - no native dependencies, works on all platforms
Tests: 83 passing (unit + integration + performance + stress)
Architectural Evolution (v3.8.0+)
Component | Change | Benefit |
State management | Session-scoped instead of global | No state leakage between clients |
Pending operations | SQLite-backed | Survive server restarts |
ReDoS patterns | 6 ā 15+ | Better security |
Cache eviction | Auto-persist before close | Cache data preserved |
File limits | MAX_FILES = 2000 (was 500) | Better support for large projects |
Tests | Added multi-client concurrency tests | Production readiness verified |
Contributing
See CONTRIBUTING.md for guidelines.
Security
See SECURITY.md for security policies and reporting vulnerabilities.
Troubleshooting
See TROUBLESHOOTING.md for common issues and solutions.
Viewing Logs
Because MCP uses stdout for protocol communication, all logs are safely routed to stderr. You can view them in your client's log files:
Claude Desktop (macOS):
~/Library/Logs/Claude/mcp-server-mcp-code-context.logClaude Desktop (Windows):
%APPDATA%\Claude\logs\mcp-server-mcp-code-context.logCursor:
Outputpanel ā Selectmcp-code-contextfrom the dropdownAmazon Q: Check
stderroutput in the MCP server configurationKiro: Check logs in the MCP server view
Antigravity: Check logs in the MCP server view
Environment Variables (optional):
{
"mcpServers": {
"mcp-code-context": {
"command": "npx",
"args": ["-y", "mcp-code-context"],
"env": {
"NODE_ENV": "development",
"LOG_LEVEL": "debug"
}
}
}
}Supported LOG_LEVEL values: fatal, error, warn, info, debug, trace (default: info).
Changelog
See CHANGELOG.md for version history.
License
šØāš» Author & Maintainer
Alejandro Chataing
Full-Stack Systems Architect & Principal Software Engineer
š Website & Portfolio: https://alejandro-chataing.pages.dev/#
š§ Contact: a.chataing.a@gmail.com
š GitHub: @achatainga
Built with ā¤ļø by Alejandro Chataing from Caracas, Venezuela š»šŖ
Available Tools
25 toolsanalyze_impactC
Find all files that depend on a given file
Inputs: filePath (required), projectRoot (required), rootDir.
ast_transformA
Apply a declarative AST transformation to a symbol. Supports: add_parameter, wrap_with_try_catch, add_decorator, change_return_type, extract_variable. Uses two-phase write (Phase 1: preview diff, Phase 2: confirm with token).
Inputs: filePath (required), projectRoot (required), symbolName (required), transform (required), +4 more.
batch_readA
Read multiple symbols from multiple files in one call. Reduces N round-trips to 1.
Inputs: reads (required), projectRoot (required).
clean_backupsB
Remove all backup files for a project
Inputs: projectRoot (required).
clear_cacheB
Clear all cached parse results for a project
Inputs: projectRoot (required).
clear_session_cacheA
Clear cache for current session only
Inputs: projectRoot.
configure_file_watcherB
Start/stop file watcher for auto-cache invalidation
Inputs: projectRoot (required), action (required), debounceMs.
explain_symbolA
Get signature, location, and callers of a symbol in one call. More efficient than read_file_surgical + analyze_impact separately.
Inputs: filePath (required), projectRoot (required), symbolName (required), className, +1 more.
get_cache_statsB
Get cache statistics (entries, size, hit rate)
Inputs: projectRoot (required).
get_file_watcher_statusC
Get file watcher status for a project
Inputs: projectRoot (required).
get_rate_limit_statusA
Get current rate limiter token balance and operation costs. Use before expensive operations to check available budget.
Inputs: no named parameters.
get_semantic_repo_mapB
Generate a compressed architectural overview of an entire repository
Inputs: directoryPath (required), projectRoot (required), format.
get_server_statsA
Get server telemetry, audit statistics, and health metrics
Inputs: no named parameters.
get_session_statsB
Get statistics for the current MCP client session
Inputs: no named parameters.
insert_symbolA
Insert code at a specific location. Phase 1: returns diff + token. Phase 2: confirm with token to apply.
Inputs: filePath (required), projectRoot (required), code, anchorSymbol, +5 more.
list_pending_operationsB
List pending operations for crash recovery
Inputs: no named parameters.
parse_fileC
Parse a file using Tree-sitter and extract symbols
Inputs: filePath (required), projectRoot (required).
read_file_linesC
Read specific line ranges from a file
Inputs: filePath (required), projectRoot (required), startLine, endLine, +2 more.
read_file_surgicalB
Read a file or extract a specific named symbol
Inputs: filePath (required), projectRoot (required), symbolName, className.
remove_symbolB
Remove a symbol from file. Phase 1: returns diff + token. Phase 2: confirm with token to apply.
Inputs: filePath (required), projectRoot (required), symbolName (required), className, +3 more.
rename_symbolA
Rename a symbol across the entire repository. Phase 1: returns diff + token. Phase 2: confirm with token to apply.
Inputs: filePath (required), projectRoot (required), oldName (required), newName (required), +3 more.
rollback_fileC
Revert a file to its backup state
Inputs: filePath (required), projectRoot (required).
search_code_patternC
Search for code patterns across multiple files
Inputs: rootDir (required), projectRoot (required), pattern (required), fileExtensions, +5 more.
search_symbolsA
Search symbols by name across the repo using AST (not text search). Finds classes, functions, methods by approximate name.
Inputs: rootDir (required), projectRoot (required), query (required), fuzzy, +4 more.
write_file_surgicalA
Replace a symbol with new code. Phase 1 (dry-run): returns diff + token. Phase 2: confirm with token to apply.
Inputs: filePath (required), projectRoot (required), symbolName (required), newContent, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogā¦
TDQS
Scored across 25 tools
Most tools have distinct purposes, but some overlap exists (e.g., read_file_surgical and explain_symbol both retrieve symbol information, though with different focuses). Descriptions generally clarify boundaries.
All tool names follow a consistent snake_case verb_noun pattern. Verbs like get_, read_, search_, and direct verbs (clean, clear, insert) are used uniformly per function.
With 25 tools, the server is at the high end of the 'heavy' range. While the number is justified by the breadth of features (reading, writing, analysis, state management), it feels slightly bloated for a typical code context server.
The tool surface covers core read, write, search, and analysis operations well. However, there is no explicit create/delete file tool, and file-level operations are limited, leaving minor gaps.
Maintenance
Related MCP Connectors
Cuts coding agent token burn up to 72% continuously via contradiction-free memory & verification.
Provide your AI coding tools with token-efficient access to up-to-date technical documentation forā¦
Codebase intelligence for agents: 152 structured artifacts across 21 programs, one call.
Code intelligence platform for AI agents. 20 tools for architecture, security & impact analysis.
Related MCP Servers
- AlicenseAqualityCmaintenanceProvides intelligent code context and analysis through semantic compression, AST parsing, and multi-language support. Offers 60-80% token reduction while enabling AI assistants to understand codebases through local analysis, OpenAI-enhanced insights, and GitHub repository integration.6229 npm3MIT
- AlicenseAqualityBmaintenanceMCP file cache for AI coding agents. Re-reading an unchanged file costs ~40 tokens instead of the whole file; a changed file comes back as a diff. Adds grep, BM25 search and glob over cached files, atomic edits with dry_run, and token-budgeted batch reads. One local daemon serves every client. No API keys, no GPU. Works with Claude Code, Cursor, VS Code, Codex and OpenCode.1479 PyPI3MIT

Code Scalpelofficial
AlicenseNot gradedqualityDmaintenanceEnables AI assistants to surgically extract and analyze code, reducing token usage and costs by up to 200x compared to reading entire files.20MIT- FlicenseAqualityDmaintenanceEnables precise source code retrieval via tree-sitter AST parsing, cutting AI token costs by 86-99% by indexing codebases and fetching only needed symbols and structural queries (e.g., blast radius, importers) on demand.61-