Skip to main content

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 root
  • query — natural-language description of the change (e.g. "change the download button color")
  • top_n — max results to return (default 5, max 20)

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


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-0.1.2.tar.gz (14.3 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-0.1.2-py3-none-any.whl (18.6 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for contextl_mcp-0.1.2.tar.gz
Algorithm Hash digest
SHA256 a881e65ca4063fc6a3ff957954b3217d492ded7c2adece4d28730a29093d857a
MD5 221e7bb637aad0c9384cf0e38b595244
BLAKE2b-256 2a0c4de3e6e42e516cfe22f9511f87a9bd74da233a4798eaf0591529874dfb96

See more details on using hashes here.

File details

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

File metadata

  • Download URL: contextl_mcp-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 18.6 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-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 4c6677b175f1dccbdf4dbc3a5e4ad287b77f97ffce174de64651924b110a3401
MD5 cb9e5c406dbe0ae728b18e3e4dba0eea
BLAKE2b-256 db0e81cd70638f5137bac36f91a9aaebc34dfce290ede89404fea6db6cf00c0b

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