registree
Provides coding agents with a live registry of class definitions and constructor signatures from the codebase, enabling verification of calls before writing them to prevent hallucinated parameters.
README
registree
An anti-hallucination class registry for coding agents, served over MCP.
Coding agents guess constructor signatures from memory — a keyword that
doesn't exist, a required argument left out — and you pay for the guess in a
TypeError and a debugging round-trip. registree removes the guess: it walks
your codebase with ast (never imports), builds a registry of every class
definition, and serves it as MCP tools so the agent can verify the
signature before writing the call.
Two principles run through every tool:
- Names map to lists. A duplicated class name returns every definition; the server never silently picks the first match.
- Honesty over confidence. An open-ended constructor (
**kwargs, Pydanticextra=/alias=) reports its contract as unknowable, never as an empty list pretending to be an answer.
How it works
- Scan — an AST walk over your source tree extracts every class:
constructor parameters (including
**kwargsand positional-only), typed fields with defaults, inheritance, docstrings. Classification is transitive: a model routed through your project's own base class is still recognized as a Pydantic model. - Serve — the registry is cached as JSON and exposed over MCP stdio. It maintains itself: generated on first use, regenerated whenever a scanned file is newer than the cache.
- Answer — the agent queries it at the moment of use, instead of guessing.
MCP tools
| tool | use it |
|---|---|
get_signature |
before writing a constructor call — required args, accepted keywords, every definition of a duplicated name |
verify_snippet |
after drafting code — checks constructor calls against the registry |
search_classes |
when unsure of the exact class name |
list_duplicates |
which names need an explicit import to disambiguate |
get_usages |
before a rename — every usage, including through import aliases (X as XDB) |
server_info |
server status and registry size |
Install
No install needed with uv — MCP clients launch
it with uvx. For direct CLI use:
uv tool install registree # or: pip install registree
Requires Python 3.12+.
Wire it into your agent
Any MCP client, JSON config form:
{
"mcpServers": {
"registree": {
"command": "uvx",
"args": ["registree", "serve", "--root", "/path/to/your/project"]
}
}
}
Omitting --root serves the directory the client launches the server in,
which for most MCP clients is the project root.
- Quickstart (any agent): docs/quickstart.md
- Claude Code setup, including the hook integration: docs/claude-code.md
Agent compatibility
The MCP tools work with any MCP client — Claude Code, Claude Desktop, Cursor, Windsurf, Cline, Zed, VS Code Copilot agent mode, Gemini CLI, and anything else that speaks MCP over stdio. Structured tool output degrades gracefully for clients that only read text content.
The hook adapters (hook-check, hook-regen) target Claude Code's hook
protocol, which can intercept a pending file edit and hand the model
advisory feedback before the write lands — a deterministic checkpoint the
MCP layer alone can't provide. See docs/claude-code.md.
That protocol is spreading: VS Code Copilot agent mode (Preview) reads the
same format — same events, same stdin JSON, even .claude/settings.json —
and the adapters tolerate its camelCase field names. Codex CLI and Gemini
CLI use close-enough hook contracts that ports are straightforward. Agents
whose hook systems can't intercept file edits pre-application (Cursor,
Windsurf without model feedback, Zed with no hooks yet) still get the full
MCP toolset — the hooks just add a deterministic layer where the platform
supports one.
CLI
The same engine is available directly:
registree gen # build the registry
registree conflicts # duplicate names: accepted layering vs smells
registree usages SomeClass # every usage, alias-aware — run before renames
registree hook-check # Claude Code PreToolUse adapter (advisory)
registree hook-regen # Claude Code PostToolUse adapter (debounced)
registree conflicts exits non-zero only for duplicate names that are
genuine smells — the accepted ORM/domain layered pair passes — so it is safe
to wire into CI from day one.
The registry cache
Lives at .registree/registry.json by default — add .registree/ to your
.gitignore. Every command that touches it accepts --registry-path to put
it anywhere else; relative paths are anchored to the project root.
Development
uv sync # creates .venv, installs deps + dev tools
uv run pytest # includes a real stdio JSON-RPC handshake test
uv run mypy src tests
uv run ruff check .
uv run black --check .
Run the server directly (speaks MCP over stdio; exits on EOF):
uv run registree
License
推荐服务器
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 模型以安全和受控的方式获取实时的网络信息。