Repository Intelligence Engine — MCP server for AI coding agents
Project description
contextl
Context-selection engine for AI coding assistants.
Finds the most relevant files in your codebase for a natural-language change request — no LLM, no embeddings, no vector database. Pure graph + text scoring.
"fix the upload error" → [FileUploader.tsx, lib/upload.ts, UploadSection.tsx]
Instead of feeding your entire repo to an AI, contextl reduces 5 000 files down to the 5 most relevant ones in milliseconds.
Installation
pip install contextl
Python 3.9+ required. networkx and mcp are installed automatically as dependencies.
Quick start — connect to your IDE
Paste this into your IDE's MCP config file:
{
"mcpServers": {
"contextl": {
"command": "contextl"
}
}
}
Config file locations
| IDE | Config file |
|---|---|
| Antigravity | ~/.gemini/antigravity/mcp/ (MCP server directory) |
| Cursor | ~/.cursor/mcp.json |
| Windsurf | ~/.codeium/windsurf/mcp_config.json |
| Claude Code | ~/.claude.json (or run claude mcp add) |
| VS Code | .vscode/mcp.json in your workspace root |
Use it
Just talk to your IDE's AI normally:
You: "fix the file upload error handler"
IDE: calls query_repo → gets [FileUploader.tsx, lib/upload.ts, …]
IDE: reads only those 5 files instead of the whole repo
Tools exposed
query_repo(repo_path, query, top_n?)
Ranks the most relevant files for a change request.
Parameters:
repo_path— absolute path to the repository rootquery— natural-language description of the change (e.g."change the download button color")top_n— max results to return (default5, max20)
Returns:
{
"query": "change the download button",
"repo": "/path/to/repo",
"total_files_scanned": 142,
"results": [
{
"rank": 1,
"path": "components/DownloadButton.tsx",
"score": 0.9800,
"confidence": "high",
"matched_terms": ["button", "download"],
"reasoning": "Filename strongly matches query terms; file contents heavily reference query terms."
}
]
}
scan_repo(repo_path)
Lists all source files the engine can see in a repository.
How it works
The engine runs entirely locally — no network calls, no AI APIs, no data leaves your machine.
Scoring uses four signals:
| Signal | Weight | Description |
|---|---|---|
| Keyword match | 0.5 | Query terms in the file path / name |
| Content match | 0.5 | Query terms inside the file source |
| Neighbor bonus | +0.15 | Files near high-scoring files in the import graph |
| PageRank | 0.05 | Tiebreaker: more connected files rank slightly higher |
Supports Next.js / React / TypeScript repos (.ts, .tsx, .js, .jsx). Automatically detects @/ path aliases from tsconfig.json.
Also available as an npm package
npx contextl
For IDE configs that prefer npx over a Python command.
License
MIT
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 contextl_mcp-0.2.0.tar.gz.
File metadata
- Download URL: contextl_mcp-0.2.0.tar.gz
- Upload date:
- Size: 16.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8c16e312e54506053e1f3ebdd541edf1a5d172bbabe050e5424b8c72d3a8de0
|
|
| MD5 |
ab544667039076353deafc6be2fb86b6
|
|
| BLAKE2b-256 |
97d57cbf75102fcd1465835446a3ca191ce0c18089e45d45d33e454d617f463c
|
File details
Details for the file contextl_mcp-0.2.0-py3-none-any.whl.
File metadata
- Download URL: contextl_mcp-0.2.0-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
82f241231d5b1c33958dd61f139e14c17033b49b9da64ea2eb1dce06663a9dcf
|
|
| MD5 |
2a2ef721b9b42e80cfb6861a4ece2969
|
|
| BLAKE2b-256 |
4e5c8bc8249dc2938188eac13168c24b9552b791d17da9c716c022a4560bd7e5
|