repo-context
Read-only repository context explorer for coding agents. Provides repository exploration tools via CLI or MCP adapter.
README
repo-context
Read-only repository context explorer for coding agents.
The canonical architecture is a local CLI-first exploration core that talks to an OpenAI-compatible FastContext-style model endpoint. MCP is an adapter around the same core, not the primary abstraction.
Current Status
This repository has the initial Python 3.13+ implementation for spec 001:
CLI, shared exploration core, read-only repository tools, OpenAI-compatible
chat-completions client, optional trajectory logging, and a thin MCP adapter.
It also includes spec 002 hardening for deterministic controller-owned
finalization and citation-mode rendering, plus spec 003 latency controls for
bounded endpoint prompt growth, and spec 004 same-turn parallel local tool
execution. Spec 005 adds a deterministic exact path/symbol fast path for
trivial evidence lookups.
Primary planning artifacts:
- Spec Kit feature spec
- Implementation plan
- Task breakdown
- Deterministic explorer harness
- Latency-bounded explorer harness
- FastContext-compatible parallel tool executor
- Exact path/symbol fast path
- Implementation order
FastContext Alignment
This project intentionally follows Microsoft FastContext's explorer shape:
- Delegated repository exploration: CLI/MCP call a focused explorer core that returns evidence for a downstream coding agent.
- Read-only tools: the only model-callable repository tools are
read_file,repo_glob, andrepo_grep, corresponding to FastContext'sRead,Glob, andGrep. - Same-turn parallel tool calling: independent local tool calls from one model message execute concurrently, while model endpoint requests remain serial.
- Compact evidence: citation mode renders controller-validated
path:start-endlines, with the model prompted toward a<final_answer>block.
Primary references: Microsoft FastContext README, FastContext model card, and FastContext paper.
Usage
Use the CLI first for local debugging, scripts, CI checks, and one-off questions. It has the smallest moving parts and exposes the exact core result.
Use MCP when an MCP-capable editor or agent should call repository exploration as a tool during its workflow. MCP delegates to the same core as the CLI.
Configure
Prefer .repo-context.toml for stable project-local settings:
cp .repo-context.toml.example .repo-context.toml
Use environment variables for temporary overrides, CI, or secrets:
cp .env.example .env
repo-context reads real environment variables from the process environment;
it does not load .env by itself. Configure at least:
FASTCONTEXT_BASE_URL=http://localhost:8000/v1
FASTCONTEXT_MODEL=your-model-name
Endpoint requests use a 120 second default timeout. The harness also caps
model-observation payloads, model-requested read spans, completion tokens, and
temperature to reduce latency variance. Independent same-turn local tool calls
execute concurrently with a default worker cap of 4; model endpoint requests
remain serial.
Exact path or uniquely defined symbol queries can complete locally without an endpoint when the controller can validate the citation deterministically.
Configuration precedence:
defaults < .repo-context.toml < environment variables < CLI overrides
CLI
Text output:
uv run repo-context explore \
--query "Find the request validation logic" \
--repo . \
--max-turns 6 \
--citation
In citation mode, repo-context validates and normalizes citations in the
controller. Text output is only repository-relative path:start-end labels, or
NO_CITATIONS_FOUND; model prose is not emitted. The model is prompted to use a
FastContext-style <final_answer> block, but the public text output is rendered
from controller-validated citations.
JSON output:
uv run repo-context explore \
--query "Find the request validation logic" \
--repo . \
--format json
MCP
Install optional MCP dependencies:
uv sync --extra mcp
Development server command:
uv run repo-context mcp --transport stdio
Tool: explore_repository(query, repo_root?, max_turns?, citation?)
Generic MCP client config shape:
{
"mcpServers": {
"repo-context": {
"command": "uv",
"args": [
"run",
"--project",
"/path/to/repo-context",
"--extra",
"mcp",
"repo-context",
"mcp",
"--transport",
"stdio"
],
"env": {
"FASTCONTEXT_BASE_URL": "http://localhost:8000/v1",
"FASTCONTEXT_MODEL": "your-model-name"
}
}
}
}
Validate
uv run pytest
uv run ruff check .
uv run mypy
Endpoint-backed e2e tests are opt-in and use this repository as the target repo:
REPO_CONTEXT_RUN_E2E=1 \
FASTCONTEXT_BASE_URL=http://localhost:8000/v1 \
FASTCONTEXT_MODEL=your-model-name \
uv run pytest tests/e2e
To print per-prompt timing for the current-repo multi-prompt e2e:
REPO_CONTEXT_RUN_E2E=1 \
FASTCONTEXT_BASE_URL=http://localhost:8000/v1 \
FASTCONTEXT_MODEL=your-model-name \
uv run pytest tests/e2e/test_current_repo_multi_prompt_timing.py -s
Scope
In scope:
- Local, read-only repository exploration.
- Root-scoped
read_file,repo_glob, andrepo_greptools. - OpenAI-compatible chat completion loop with bounded tool observations.
- Same-turn concurrent execution for independent local tool calls.
- CLI output with file paths and line-range citations.
- MCP adapter that delegates to the CLI/core implementation.
Out of scope for the MVP:
- Repository mutation.
- Vector database ownership or embedding/model serving.
- MCP-first
context_search,context_pack, andcontext_gettools. - OKF bundle output.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。