Skip to main content

Repository Intelligence Engine — MCP server for AI coding agents

Project description

contextl-mcp

v1.3.0 is our most stable, thoroughly benchmarked release yet.

Architecture intelligence for AI coding agents.

Stop letting your AI agent read your entire codebase to make one small change. contextl finds the exact files that matter — using graph theory, not guesswork.

"fix the broken checkout flow"
        ↓
components/Checkout.tsx      [high confidence]
lib/api.ts                   [high confidence]
types/index.ts                [medium confidence]

No LLM. No embeddings. No API keys. No vector database. Pure dependency graph + text scoring — runs entirely on your machine, your code never leaves your system.


Install (60 seconds)

Requires Python 3.9+. All required dependencies — graph processing and tree-sitter parsers for 7 languages — are automatically bundled via pip.

pip install contextl-mcp && contextl install

This will globally install the contextl CLI and automatically inject the correct configuration into your AI IDE (Cursor, Windsurf, Claude Code, etc.).

Restart your IDE and the contextl tools will be instantly available to your agent!

Manual Configuration (Fallback)

If the auto-installer doesn't detect your IDE, or if you prefer to configure it manually, add this to your IDE's MCP config file:

{
  "mcpServers": {
    "contextl": {
      "command": "contextl"
    }
  }
}

Where to find your config file:

IDE Config path
Antigravity ~/.gemini/config/mcp_config.json
Claude Desktop ~/.config/Claude/claude_desktop_config.json (varies by OS)
Cline / Roo ~/Documents/Cline/cline_mcp_settings.json (varies by OS)
Cursor ~/.cursor/mcp.json
Claude Code ~/.claude.json
Windsurf ~/.codeium/windsurf/mcp_config.json
VS Code (Workspace) .vscode/mcp.json

Restart your IDE. The contextl command is now available — pip install registered it on your PATH.


What it gives your agent

Seven tools, automatically available once connected:

query_repo

"Find the files relevant to this change."

Ranks every file in your repo against a natural-language query using filename matching, content matching, and graph proximity. Returns confidence-scored results with plain-English reasoning.

{
  "repo_path": "/path/to/repo",
  "query": "fix the upload error handler",
  "top_n": 5
}

analyze_impact

"If I change this file, what breaks?"

Walks the dependency graph upstream from any file to find every direct and transitive dependent. Flags likely test files so your agent knows what to re-run. Essential before touching shared files like types/, utils/, or config.

{
  "repo_path": "/path/to/repo",
  "target_file": "src/types/index.ts"
}

scan_repo

"What files exist here?"

Lists every source file contextl can see — useful for the agent to orient itself before doing anything else.

find_dead_files

"Which files are never imported by anything?"

Find files in the repository that are never imported by any other file (in-degree of 0 in the dependency graph).

Note: The engine automatically detects and excludes standard entry points (e.g. src/index.ts, main.py, app.tsx) and test files from these results, as they are intentionally not imported by other files.

Arguments:

{
  "repo_path": "/path/to/repo"
}

export_obsidian_vault

"Visualize this codebase in Obsidian."

Takes the exact dependency graph built by the intelligence engine and physically writes it to disk as a directory of interconnected Markdown files. Automatically injects file metadata, JSDoc/Docstring explanations, and uses standard [[wikilinks]] to map out dependencies. Open the generated folder as an Obsidian vault for a stunning 3D interactive graph of your architecture!

{
  "repo_path": "/path/to/repo",
  "output_dir": "/path/to/save/vault"
}

review_changes

"I'm reviewing or changing some code. What's the impact?"

Git-aware context builder. Reads the current git diff to find what files you are editing, then automatically runs impact analysis to find every file that depends on your changes. Returns a structured context bundle with the changed files, full blast radius, and suggested tests to re-run.

{
  "repo_path": "/path/to/repo",
  "staged": true,
  "unstaged": true
}

get_skeleton

"Show me the API of this huge file."

Extracts the structural skeleton (API surface) of a source file using Tree-sitter — including all class names, method signatures, return types, and docstrings — without pulling in any implementation bodies. Shrinks a 5,000-line file into a ~100-line reference header.

{
  "file_path": "/path/to/src/api.py"
}

Benchmarks & Token Reduction

Instead of dumping an entire repository into your agent's context window, contextl surgically extracts only the relevant dependencies. Across 9 real-world open source repositories, this results in massive token savings while maintaining high relationship accuracy:

  • JavaScript (Express): 93.58% context reduction
  • C++ (JSON): 84.31% context reduction
  • Python (Flask): 52.69% context reduction

See the full live telemetry and methodology breakdown at our official documentation and metrics dashboard.

How the ranking works

contextl relies strictly on deterministic mathematical scoring based on Okapi BM25 and graph theory. There are no LLMs or embeddings involved.

  1. Keyword Match (Path / Filename)
    • Exact filename matches receive a massive 4.0x IDF multiplier.
    • Exact path matches receive a 2.0x IDF multiplier.
    • Substring and canonical abbreviation matches (e.g., db matching database.py) also receive significant boosts.
  2. Content Match (BM25 TF-IDF & Structural Analysis)
    • Calculates Okapi BM25 Term Frequency (k1=1.5, b=0.75), using Document Length Normalization to aggressively penalize huge files (e.g., 5,000-line god classes) and normalize token counts.
    • TypeScript Exports: Matches on export const / class / function receive a permanent 8.0x multiplier.
    • Classes / Interfaces: Matches on OOP class definitions receive up to a 10.0x structural multiplier for short vibe queries.
    • Functions / Annotations: Matches on method signatures and annotations receive a 4.0x or 5.0x boost.
  3. Graph Proximity Bonus
    • Files directly adjacent in the dependency graph to high-scoring files receive a 0.2x recursive relevance boost, pulling tightly coupled dependencies up the ranking.
  4. Centrality Tiebreaker
    • The engine calculates PageRank across the entire repository graph. When files have identical or highly similar relevance scores, highly-central files heavily depended on by the rest of the codebase (like core utils.py or base classes) rank slightly higher.

(Note: Test files are automatically penalized by 50% unless the natural language query explicitly contains words like "test" or "spec".)

No machine learning involved — every score is fully explainable and traceable back to a specific signal.


Supported languages

JavaScript ecosystem: TypeScript, TSX, JavaScript, JSX. Backend ecosystem: Python (.py), Java (.java), Rust (.rs), Go (.go), C/C++ (.cpp, .c, .h).

The engine natively understands dot-notation module paths (from X import Y, import com.example.X;) and correctly resolves them to physical file paths to build the architecture graph.

Note: Wildcard imports (e.g. use super::*, use crate::*) are intentionally left unresolved. ContextL maps explicit dependency paths only.


The Global CLI

contextl isn't just an AI tool; it installs a global command-line interface on your system so you can access all the intelligence features natively:

# 1. Search the codebase
contextl search ./my-repo "fix the auth flow"

# 2. Analyze impact of changing a file
contextl impact ./my-repo src/api.py

# 3. Find dead unused files
contextl standalone ./my-repo

# 4. Generate an Obsidian vault
contextl obsidian ./my-repo ./my_vault

# 5. Git-aware review / impact of current edits
contextl review ./my-repo

(Note: If you omit the sub-command, contextl ./my-repo "query" will automatically default to search for backwards compatibility).


Why this exists

AI coding agents are increasingly good at writing code. They're still bad at knowing where to look. On a massive monorepo, an agent might blindly read 100+ files just to change a logo. contextl exists to fix that by giving agents a deterministic, graph-based map of your architecture.

And it scales. We rigorously benchmark against massive open source repositories to ensure it can handle your monorepo. On typeorm (3,572 TypeScript files), the engine scans, parses, graphs, and searches the entire architecture in under 3 seconds. On Apache superset (5,897 mixed language files), the full end-to-end pipeline executes in ~44 seconds. No vector DBs, no cloud latency, just pure on-device intelligence.


Also available via npm

npx -y contextl

Same engine, same tools — installable via npm for JS/TS-first workflows.


Links

License

MIT

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

contextl_mcp-1.3.0.tar.gz (41.2 kB view details)

Uploaded Source

Built Distribution

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

contextl_mcp-1.3.0-py3-none-any.whl (48.1 kB view details)

Uploaded Python 3

File details

Details for the file contextl_mcp-1.3.0.tar.gz.

File metadata

  • Download URL: contextl_mcp-1.3.0.tar.gz
  • Upload date:
  • Size: 41.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for contextl_mcp-1.3.0.tar.gz
Algorithm Hash digest
SHA256 2b491c92aa5c9b04293c228cb6599d3b403118d4adb393ddd71881f70a227d71
MD5 d0ba8655bb881f1141f6ed516a1fd45a
BLAKE2b-256 03c7ad4847934678f519b021d1e8cb853fdfb606fedd47c43099c370ccc01a72

See more details on using hashes here.

File details

Details for the file contextl_mcp-1.3.0-py3-none-any.whl.

File metadata

  • Download URL: contextl_mcp-1.3.0-py3-none-any.whl
  • Upload date:
  • Size: 48.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.14.4

File hashes

Hashes for contextl_mcp-1.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17a9fa1914c09e0c70ef2ec3e045c93d03cb4675d39762f0d2322e7099e9ec4b
MD5 808f4ba697023862e52f5fe98d4eff1f
BLAKE2b-256 f8cbef66b61508a183bd2e61ce923732a21f5de319cda88f6595dd2ecbcc3e73

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