mcp-intelligence-context
Click on "Install 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-intelligence-contextWhat imports and dependencies does the auth module have?"
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 Intelligence Context
A Repository Intelligence MCP server that indexes a codebase's files, symbols, imports and dependency graph, and hands Copilot/agents a small, focused context package instead of making them scan the entire repository.
Why
When an agent gets an ambiguous question about a large repo, it often has to repeatedly list directories, open unrelated files, and re-derive structure before finding the relevant code — burning tokens and time. This project builds a persistent, incrementally-updated index of the repo (files, symbols, imports, reverse dependencies) and exposes MCP tools that return only the context relevant to a query, with an approximate token budget.
Related MCP server: lens
How it works
index_repositorywalks the repo (honoring.gitignore), parses Python (viaast) and JS/TS (via lightweight regex heuristics) files for functions/classes/methods/imports/exports, and builds a reverse dependency graph. The index is cached at.mcp_intel_cache/index.jsonand refreshed incrementally (only changed files are re-parsed, based on mtime/size).search_code/get_relevant_contextrank files by symbol-name, filename, docstring/summary, and import matches (lexical/symbol search — no embeddings in this MVP) and return a token-budgeted context package: symbol tables + small code excerpts, not whole files.get_relevant_contextalso reports atoken_savingscomparison against a naive full-repo-scan baseline, so the savings are visible in the tool's own response.get_file_summary/get_dependencieslet an agent drill into a specific file's symbols or blast radius (importers/imports) without reading the whole file.Tools report a staleness warning if the cached index is older than 5 minutes and no live watcher is active. In practice, the first tool call for a repo starts a background file watcher (via
watchdog) that applies create/modify/delete events to the in-memory index immediately, so the index stays continuously up to date as the code changes — no manual reindex needed during a session. The on-disk cache is flushed on a debounce (~2s) so rapid saves don't cause a write per keystroke.
Repository layout
src/mcp_intelligence_context/ Python MCP server package
walker.py gitignore-aware file walker
parsers/ Python (ast) and JS/TS (regex) symbol extraction
indexer.py builds/caches the RepoIndex, resolves imports
watcher.py background file watcher that keeps the index live
search.py lexical/symbol search + reverse-dep lookups
context_builder.py token-budgeted context package assembly
server.py MCP tool definitions (stdio server)
vscode-extension/ VS Code extension wrapper (setup/reindex/status commands)
scripts/ one-command bootstrap for new usersQuick Start (New Users)
If you are new to MCP and just want this working in VS Code quickly:
git clone https://github.com/LeoChimal09/MCP-INTELLIGENCE-CONTEXT.git
cd MCP-INTELLIGENCE-CONTEXT
bash scripts/setup_mcp_workspace.shWhat this script does:
Installs (or updates)
mcp-intelligence-contextwithpipx.Writes
.vscode/mcp.jsonfor this workspace.Restricts indexing to the current workspace folder by setting
MCP_INTEL_ALLOWED_ROOTS=${workspaceFolder}.
Then in VS Code:
Command Palette ->
MCP: List Servers.Start/Restart
mcp-intelligence-context.In Copilot Chat tool picker, enable
mcp-intelligence-context.
If the script says pipx is missing, install it once:
brew install pipx
pipx ensurepathRunning the MCP server standalone
python3 -m venv .venv
.venv/bin/pip install -e .
.venv/bin/mcp-intelligence-context # or: python -m mcp_intelligence_context.serverPoint the repo to index by setting MCP_INTEL_REPO_ROOT, or pass repo_root
explicitly to any tool call (defaults to the server's current working
directory).
Installing without cloning this repo
Other users don't need a local checkout — install directly from the git repository (or from PyPI, once published there):
python3 -m venv .venv
.venv/bin/pip install "git+https://github.com/LeoChimal09/MCP-INTELLIGENCE-CONTEXT.git"
# once published: .venv/bin/pip install mcp-intelligence-contextThe mcp-intelligence-context console script and MCP_INTEL_REPO_ROOT env
var work exactly the same either way — only the pip install source differs.
Register with an MCP client (e.g. VS Code)
Add to .vscode/mcp.json in the target workspace:
{
"servers": {
"mcp-intelligence-context": {
"type": "stdio",
"command": "/absolute/path/to/.venv/bin/python",
"args": ["-m", "mcp_intelligence_context.server"],
"env": { "MCP_INTEL_REPO_ROOT": "${workspaceFolder}" }
}
}
}VS Code extension
vscode-extension/ bundles a thin wrapper with three commands:
MCP Intelligence: Setup Server — creates a venv and installs the Python package, then writes the
.vscode/mcp.jsonentry above.MCP Intelligence: Reindex Repository — forces a re-index of the open workspace.
MCP Intelligence: Show Status — prints the cached index's file count, git commit, and age.
By default, "Setup Server" installs the package from this project's git repository into a venv under the extension's private storage — no local clone required. Two settings control this:
mcpIntelligenceContext.serverPath— point at a local editable checkout (used for development on this monorepo); leave empty otherwise.mcpIntelligenceContext.pythonPackageSource— override the pip install target (e.g. a PyPI package name) whenserverPathis empty.
To build it:
cd vscode-extension
npm install
npm run compileThen press F5 in VS Code (with vscode-extension/ open) to launch an
Extension Development Host.
Available MCP tools
Tool | Purpose |
| Build/refresh the index for a repo root |
| Top-level directories, language breakdown, core modules |
| Ranked file/symbol hits for a query |
| Symbol table, imports, exports for one file |
| What a file imports and who imports it |
| Token-budgeted context package for a query, plus a |
Evaluating whether this actually helps
eval/ contains a small, honest benchmark against this repo's own code
(no LLM calls, no fabricated numbers): 10 hand-written queries with known
ground-truth files, comparing our indexed tool against a naive baseline
(list the tree, grep, read whole matching files).
.venv/bin/python eval/run_eval.pyIt reports hit@1/hit@3 (does the top result point at the right file), average token reduction, and latency. This only measures retrieval/token mechanics — it does not measure whether a real Copilot answer is actually better, since that requires live model calls.
Current limitations (MVP)
JS/TS parsing is regex-based (not a full AST), so unusual syntax may be missed. Python parsing uses the standard
astmodule and is exact.Search is lexical/symbol-based only (with stopword filtering and accumulated multi-signal scoring); no embeddings/semantic search yet.
The file watcher applies per-file changes but does not re-walk
.gitignorechanges themselves at runtime — if.gitignoreis edited, runindex_repositorywithrefresh=trueonce to pick up the new rules.
Security considerations before broader/production use
Already fixed:
Shell injection — the VS Code extension previously interpolated workspace settings into shell command strings; it now uses
execFilewith argument arrays (no shell), and refuses to run "Setup Server" in untrusted workspaces.Symlink escape — the walker skips symlinks that resolve outside the repo root (blocks a planted symlink from exposing files like
/etc/passwd).Secret leakage — filenames matching common credential patterns (
.env,*.pem,id_rsa,credentials.json, etc., seeSENSITIVE_FILENAME_PATTERNSinconfig.py) are skipped even if not gitignored, so their contents can't end up in tool output.Corrupted-cache crash — a malformed/tampered
.mcp_intel_cache/index.jsonnow triggers a clean rebuild instead of crashing the server on launch.ReDoS — the JS/TS regex parser skips pathologically long single lines (minified files) to avoid catastrophic-backtracking DoS.
Unrestricted
repo_root— setMCP_INTEL_ALLOWED_ROOTS(a:-separated list of absolute paths) to restrict which directories the server will index; unset by default to preserve today's flexible single-user behavior.
Still architectural, not fully solved — read before deploying beyond a single local user:
Not safe as a shared/multi-tenant network service. This is designed as a local, one-process-per-user stdio server. The in-memory index/watcher caches have no per-user isolation or authentication. Do not expose this as a shared HTTP/SSE endpoint without adding per-caller sandboxing and auth.
Dependencies are unpinned (
>=only) — pin exact versions or use a lock file for reproducible, vetted production installs (this already bit us once with anmcp1.x → 2.0 breaking API change).No automated regression tests for this codebase itself yet — changes are currently verified via the manual
eval/harness and ad hoc runs, not a CI-gated test suite.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
FlicenseNot gradedqualityDmaintenanceProvides AI coding agents with structured access to indexed codebases via semantic search, symbol analysis, and file reading tools.12- AlicenseNot gradedqualityBmaintenanceProvides token-efficient code retrieval for coding agents by indexing repositories and enabling ranked snippet search, symbol outlines, and surgical line reads.MIT
- AlicenseNot gradedqualityBmaintenanceEnables LLM agents to efficiently understand and navigate a codebase by providing semantic search over symbols and a reference graph, replacing expensive grep/glob calls with structured tools like definition lookup, caller/callee queries, and change-impact analysis.1MIT
- AlicenseNot gradedqualityAmaintenanceProvides AI agents with causal code memory by indexing repositories into a graph of symbols and edges, enabling context-aware retrieval of relevant code slices.3MIT
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Deterministic context layer for your codebase: change impact, blast radius, answers with receipts.
Give your AI agent a persistent map of your project's structure, dependencies, and bugs.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/LeoChimal09/MCP-INTELLIGENCE-CONTEXT'
If you have feedback or need assistance with the MCP directory API, please join our Discord server