Repository Context MCP
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., "@Repository Context MCP find all callers of the echo function"
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.
Repository Context MCP
Read-only Python repository analysis for AI clients. Eight MCP tools expose symbols, cited source excerpts, import dependencies and supported static caller relationships. The inspected code is parsed with Python AST and never imported or executed.
Version 0.2.0 was created with AI assistance as a portfolio project in November 2026. Its scope and verification results are explicit: this is a working developer-tool prototype, not a production deployment or a complete runtime call graph.
See it work
Open the expandable Click demo. It replays real tool calls made by the official MCP Python SDK against a pinned public repository. Machine-readable results are in click-demo.json.
Verified item | Result |
Automated tests | 36 passed, one Windows symlink test skipped |
Official client | MCP Python SDK 2.3.0, automatic and legacy connection modes |
Negotiated protocol | 2025-11-25 over stdio |
Tools exercised through SDK | All eight |
Public repository | pallets/click at |
Parsed inventory | 91 Python files, 2,078 symbols, no truncation or skipped files |
The inventory includes Click's examples and tests. Counts are not accuracy measurements. No LLM session, GUI host or OpenCode integration has been tested. See the verification record.
Related MCP server: Ariadne
Quick start
Python 3.11 or newer. The server has no third-party runtime dependencies. From this project directory:
python -m repocontext examples --summary
python -m repocontext /absolute/path/to/a/python/repositoryThe second command waits for MCP messages on stdin; it is not an interactive chat prompt. server_entry.py is an alternative absolute-path entry point that works from another working directory.
Install the optional test/client dependencies in a project environment:
python -m venv .venv
# Activate .venv with your shell's normal activation command.
python -m pip install ".[test]"
python -m unittest discover -s tests -vWithout the test extra, the core tests run and official-client tests are skipped. Full local verification used normal Windows subprocess permissions; a restricted process sandbox stalled the SDK's stdio connection.
Tools
Tool | Purpose |
| Inventory, limits, skipped files and stable snapshot hash |
| Classes, functions and async functions with qualified names and line citations |
| Source excerpt, file hash and explicit character/line truncation |
| Import evidence and uniquely indexed module paths |
| Syntactic calls, supported static targets and unresolved reasons |
| Literal source search with line citations |
| Indexed dependencies supported by import statements |
| Callers found through supported lexical and import-alias analysis |
Successful results include structuredContent: {"data": ...} and matching JSON text. Each tool advertises input and output schemas. Invalid protocol arguments use JSON-RPC errors; a valid request for an unavailable symbol/path returns a tool error.
Connect an MCP host
Generate a configuration using the interpreter you intend the host to run:
python tools/write_mcp_config.py /absolute/path/to/repositoryThis prints a conventional mcpServers configuration with absolute interpreter, entry-point and repository paths. It does not modify host settings. Host configuration formats may differ. The verified integration is the official Python SDK client.
Reproduce the public repository demo
The Click checkout is not shipped in this project. With Git and the test extra installed:
git clone https://github.com/pallets/click.git ../click-demo
git -C ../click-demo checkout 2247b35ea1c47c727d7a06e51fa280e12a863ff6
python tools/demo_client.py ../click-demo --query echo --repository-url https://github.com/pallets/click --revision 2247b35ea1c47c727d7a06e51fa280e12a863ff6 --output evidence/click-demo.jsonThe client discovers all tools, fetches a real declaration, inspects its callers and imports, and checks rejection of an outside-root path. It writes JSON, Markdown and HTML. This is a tool replay, not an LLM reasoning evaluation. A source snapshot hash helps identify the exact analyzed content.
Design and practical limits
Supports lexical declarations, import aliases, relative imports, conventional
srcroots and simple re-exports. Ambiguous modules, rebound names, parameters and wildcard imports remain unresolved.Static references do not establish runtime dispatch. Instance types, inheritance, monkeypatches, decorator behavior,
exec, custom import hooks and arbitrary module roots are not modeled. Comprehension bindings are treated conservatively in the enclosing analysis scope.A snapshot is built at startup. Restart to see changed source. Duplicate qualified declarations cannot be selected silently.
Defaults: 500 successfully indexed Python files, 256 KiB per file and 16 MiB total source. Truncation and skipped files are reported. Symlinks and resolved out-of-root directories are excluded during the walk.
Tool paths are looked up only in the snapshot. Parent traversal, absolute paths and drive prefixes are rejected without new filesystem or network reads.
Source excerpts are capped at 120 lines and a configurable character budget. Characters are not model tokens.
Indexing does not interpret repository text as instructions. The consuming AI client must handle untrusted source appropriately.
Only MCP tools over sequential stdio are implemented. No HTTP server, sampling, resources, live reindexing or cancellation protocol is claimed.
The fixed ignored-directory policy does not implement arbitrary
.gitignorepatterns. Dependencies outside the snapshot remain unresolved.
Learn and present it
The explanation guide includes an architecture walkthrough, a one-minute demo route, interview questions and a suggested first personal change. Resume wording should describe actual reviewed work and the candidate's contribution.
Original project code is available under the MIT license. Click excerpts in the demo are covered by the included Click license. Click and the MCP SDK projects do not endorse this portfolio project.
References: MCP lifecycle, stdio transport, tools, official SDK client, and Python AST.
Available Tools
8 toolsfind_callsCRead-onlyIdempotent
Find calls with supported static references or explicit unresolved reasons; not runtime guarantees.
Inputs: query (required), limit. Returns: data
get_callersCRead-onlyIdempotent
Find callers linked by supported static name and import analysis.
Inputs: name (required), path (required), limit. Returns: data
get_dependenciesCRead-onlyIdempotent
Inspect import statements and indexed module dependencies.
Inputs: path (required). Returns: data
get_importsBRead-onlyIdempotent
List a Python file's syntactic import statements.
Inputs: path (required). Returns: data
get_symbol_contextCRead-onlyIdempotent
Read a bounded source excerpt for a qualified symbol.
Inputs: name (required), path (required), max_chars. Returns: data
list_symbolsCRead-onlyIdempotent
Find classes and functions with path and source lines.
Inputs: limit, query. Returns: data
repository_summaryBRead-onlyIdempotent
Summarize the read-only Python AST index.
Inputs: no named parameters. Returns: data
search_codeARead-onlyIdempotent
Search indexed Python source literally and return bounded line citations.
Inputs: query (required), limit. Returns: data
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Most tools have clearly distinct purposes: summary, symbol listing, symbol context, search, call finding, and caller finding are easy to differentiate. The only notable overlap is get_imports versus get_dependencies, both of which involve import inspection, though the descriptions distinguish per-file syntax from module-level dependency analysis.
Almost all tools follow a clear verb_noun snake_case pattern: list_symbols, get_imports, find_calls, search_code, get_dependencies, get_callers. The main deviation is repository_summary, which is noun-based rather than verb-led, but it is still readable and not confusing.
Eight tools is a well-scoped size for a read-only Python AST context server. Each tool covers a distinct query dimension such as symbols, imports, calls, callers, search, and summary, with no obviously redundant tool inflating the set.
The surface covers the core static-analysis context workflow: summary, symbol discovery, bounded source excerpts, imports, dependencies, search, call sites, and callers. Minor gaps exist around broader reference/definition lookup or file/module enumeration, but agents can likely work around these using the provided tools.
Maintenance
Related MCP Connectors
Read-only MCP tools for AI agent discovery, structured resources, and NIULAI information.
Read-only AI coding tools for change verification, release readiness, capacity, and guidance.
The Cortex MCP server provides read-only access to real-time engineering context from the Cortex developer portal, allowing AI coding assistants to answer natural language questions about your organization's catalog (microservices, libraries, domains, teams, infrastructure), scorecards (engineering standards and best practices), initiatives (goals and deadlines), and Engineering Intelligence metrics. It includes tools for querying documentation, tracking personal entities, and accessing AI-assisted insights across the entire Cortex ecosystem.
Hosted code graph over MCP: exact callers, dependencies, and cross-repo blast radius for AI agents.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides structural code intelligence via 26 MCP tools, enabling AI assistants to query code symbols, dependencies, and call graphs accurately without file-pasting.-
- AlicenseNot gradedqualityDmaintenanceSemantic code index and gatekeeper that exposes 14 read-only MCP tools for AI agents, enabling symbol search, definition lookup, reference finding, and impact analysis via static analysis of codebases.MIT
- FlicenseBqualityDmaintenanceEnables interaction with indexed Python repositories through MCP tools for repository map, symbol search, file reading, and reference lookup.4-
- AlicenseNot gradedqualityCmaintenanceProvides coding agents with read-only MCP tools to search Python repositories, retrieve size-bounded cited source context, analyze dependency impact, and check index status—all via local incremental AST indexing and BM25 retrieval.MIT