tentra
tentra-mcp
AI 编码代理的记忆层。持久化代码图谱 + AI 生成的架构图 —— 原生支持 MCP。适用于 Cursor、Claude Code、Codex 和 Windsurf。
在我们自己的代码仓库中进行的基准测试:在 8 个“X 是在哪里实现的?”查询中,Token 减少了 99.4%(比例为 156.8 倍)—— 通过文件重读需要 114,644 个 Token,而通过 query_symbols 仅需 731 个 Token。完整报告 →
快速入门(60 秒)
cd your-repo
npx tentra-mcp init --hook一条命令:
为 Cursor / Claude Code / Codex / Windsurf(已安装的)写入 MCP 配置
安装 git
post-commit钩子,以便在每次提交后自动刷新代码图谱 —— 无需手动重新索引从 git 远程仓库自动推导您的
repo_id并将其保存到.tentra/metadata.json
然后前往 trytentra.com/settings 获取您的 API 密钥,将生成的配置中的 YOUR_TENTRA_API_KEY 替换掉,重新加载您的 IDE,并询问您的代理:
Index this codebase with Tentra and list the god-nodes从现在起,每次 git commit 都会触发后台重新索引。您的代理会自动保持同步。
跳过钩子: 使用
--hook参数 —— 仅写入 IDE 配置。 手动 stdio 安装:npx tentra-mcp(首次调用工具时会打开浏览器进行 GitHub 设备流认证)。 使用 API 密钥:npx tentra-mcp --key YOUR_API_KEY。
Related MCP server: flaiwheel
什么是 Tentra?
Tentra 是 AI 编码代理的持久化记忆层。描述一个系统 —— 即可获得架构图和 14 种框架的代码导出。索引您的仓库 —— 代理查询的是文件、符号、导入和调用边的结构化图谱,而不是每次会话都重新 grep 源代码。
此 MCP 服务器为您的 AI 助手提供了 32 个工具:
架构(9 个工具)
工具 | 描述 |
| 根据描述设计新系统 |
| 修改现有架构 |
| 读取架构详情 |
| 浏览所有已保存的设计 |
| 扫描本地代码并生成图表 |
| 质量检查(9 条规则:孤立节点、单点故障、上帝服务) |
| 检测图表与代码之间的偏差 |
| 导出至 14 种框架(Java, Python, Go, Rust 等) |
| 创建分步流程可视化 |
代码图谱 — 写入(4 个工具)
工具 | 描述 |
| 遍历仓库,本地使用 Tree-sitter,启动语义索引任务 |
| 恢复正在进行的索引任务 |
| 持久化代理提取的语义注释 |
| 检查索引任务的状态 |
代码图谱 — 读取(10 个工具)
工具 | 描述 |
| 跨索引符号的模糊三元组搜索 |
| 在调用/导入图谱中进行 BFS 遍历 |
| 画布服务的子图 |
| 带有语义上下文的两个符号之间的最短路径 |
| 对代理生成的嵌入向量进行 pgvector 余弦 ANN 搜索 |
| 持久化代理生成的嵌入向量 |
| 最高入度/出度的符号(架构异味) |
| 变更率 × 复杂度排名 |
| 已索引快照的时间旅行列表 |
| 快照之间添加/删除的文件 / 符号 / 上帝节点 |
丰富信息 — 合约、决策、所有权、领域(9 个工具)
工具 | 描述 |
| 将索引文件或符号链接到画布服务 |
| 将服务或文件分配给领域(限界上下文) |
| 存储解析后的 API 合约载荷(OpenAPI, GraphQL, Protobuf) |
| 将合约链接到实现它的符号 |
| 创建架构决策记录 (ADR),可选择链接代码 |
| 从 ADR 添加到另一个符号、文件或服务的链接 |
| 解析文件或服务的所有者(团队或个人) |
| 列出链接到给定实体的 ADR |
| 列出合约,可按类型或服务过滤 |
设置
选项 1:SSE(无需安装)
添加到您的 IDE 的 MCP 配置中 —— 无需本地安装:
Cursor (设置 > 功能 > MCP > 添加服务器):
{
"tentra": {
"type": "sse",
"url": "https://trytentra.com/api/mcp?key=YOUR_API_KEY"
}
}Claude Code (项目根目录下的 .mcp.json):
{
"mcpServers": {
"tentra": {
"type": "sse",
"url": "https://trytentra.com/api/mcp?key=YOUR_API_KEY"
}
}
}选项 2:本地安装(代码库扫描所需)
npx tentra-mcp首次使用时通过 GitHub 自动认证。凭据保存至 ~/.tentra/credentials。
Cursor 本地服务器配置:
{
"tentra": {
"command": "npx",
"args": ["tentra-mcp"]
}
}Claude Code (.mcp.json):
{
"mcpServers": {
"tentra": {
"command": "npx",
"args": ["tentra-mcp"]
}
}
}使用示例
连接后,直接与您的 AI 对话:
"Design a payment system with Stripe, Kafka, and PostgreSQL"
→ AI calls create_architecture → diagram at trytentra.com/arch/xxx
"Scan this codebase and generate the architecture"
→ AI calls analyze_codebase → detects services, DBs, queues
"Export this architecture to Java Spring Boot"
→ AI calls export_architecture → downloads zip with project scaffold
"What changed since last time? Is my diagram outdated?"
→ AI calls sync_architecture → drift report with accuracy score导出格式
Java (Spring Boot), Node.js (Fastify), Python (FastAPI), Go (chi), Rust (Axum), .NET (ASP.NET), Kotlin (Ktor), PHP (Laravel), Ruby (Rails), Elixir (Phoenix), Docker Compose, Mermaid, ADR, Terraform
链接
开发
此仓库包含开源的 MCP 服务器。Tentra API 和 Web 应用是托管在 trytentra.com 的独立服务。
npm install --legacy-peer-deps
npm run build # tsc --noEmit + esbuild bundle → dist/index.js
npm start # run the bundled server
npm test # vitest发布的 npm 包 (tentra-mcp) 仅包含打包后的 dist/ —— 源代码在此处以供审计和社区贡献。
许可证
MIT
Available Tools
32 toolsanalyze_codebaseA
Scan a local codebase directory and automatically generate an architecture diagram. Detects services from package.json, docker-compose, pom.xml, go.mod, and Python configs. Infers connections from dependencies, imports, env vars, and docker-compose depends_on. Detects databases, queues, external services, and API gateways automatically. After analysis, creates the architecture and returns the URL. Also runs lint rules and reports quality issues.
Inputs: path (required), name, description.
bind_contractA
Link a symbol to a contract as "provides", "consumes", or "documents". Use after record_contract to attach implementation evidence.
Inputs: contract_id (required), symbol_id (required), snapshot_id (required), relation (required).
create_architectureA
Create a new system architecture artifact. Call this tool whenever the user asks to design, plan, or describe any system, feature, or integration. NEVER respond with plain text architecture descriptions — always call this tool instead. After calling, share the returned URL with the user.
Inputs: name (required), services (required), connections (required), description, +1 more.
create_flowA
Create a step-by-step flow on an existing architecture. Flows visualize request paths, data pipelines, or business processes as sequential steps. Use when the user asks to describe, trace, or explain a flow through the system.
Inputs: architectureId (required), flow (required).
diff_snapshotsA
Compare two snapshots: files added/removed/modified, new/disappeared symbols, god-node deltas. Architectural diff between two commits.
Inputs: from_snapshot_id (required), to_snapshot_id (required).
explain_code_pathA
Finds the shortest call/import path between two symbols and annotates each hop with semantic purpose. Answers "how does X reach Y?"
Inputs: from_symbol (required), to_symbol (required), snapshot_id (required).
export_architectureB
Export an architecture as runnable code, docker-compose, Mermaid diagram, or ADR docs. Available formats: mermaid, markdown-adr, docker-compose, java-spring-boot, nodejs-typescript, python-fastapi, go-chi, dotnet-aspnet, rust-axum, kotlin-ktor, php-laravel, ruby-rails, elixir-phoenix. For code exports, provide output_dir to save files directly into your project.
Inputs: id (required), format (required), output_dir.
find_similar_codeC
Vector similarity search using pgvector cosine distance. Pass a query_vector (embed your text with your native embedding capability first). Returns semantically similar symbols or files.
Inputs: query_vector (required), entity_type, snapshot_id, limit.
get_architectureA
Retrieve a specific architecture by ID. Use this to read the current state before making updates.
Inputs: id (required).
get_contractsB
List all contracts in a workspace, optionally filtered by kind (http, grpc, event, graphql, rabbit, kafka).
Inputs: workspace_id (required), kind.
get_decisions_forA
Retrieve all decisions that affect a specific entity (service, file, symbol, contract, or domain). Use to surface architectural rationale while reviewing code.
Inputs: entity_type (required), entity_id (required), include_superseded.
get_index_jobC
Get the status of an indexing job
Inputs: job_id (required).
get_ownershipA
Resolve the owner(s) of a file path according to the workspace CODEOWNERS rules. Returns a list of team or user handles.
Inputs: workspace_id (required), path (required).
get_quality_hotspotsA
Rank files by a composite score of cyclomatic complexity × churn × (1 - test coverage). Top refactor candidates.
Inputs: repo_id, snapshot_id, top_n.
get_service_code_graphB
Returns the full code subgraph for a Tentra canvas service: files, symbols, and cross-service edges.
Inputs: service_id (required), snapshot_id (required), depth, include_semantics.
get_symbol_neighborsA
BFS graph traversal from a symbol — who calls it, what it calls, imports, inheritance. Eliminates 20+ file reads per question.
Inputs: symbol_id (required), snapshot_id (required), depth, edge_types, +1 more.
index_codeC
Index a code repository (Tier 1 local, Tier 2 via agent)
Inputs: repo_path (required), repo_id (required), service_id, force_reindex, +2 more.
index_code_continueC
Continue an in-progress indexing job
Inputs: job_id (required).
link_decisionB
Link an existing decision to a service, file, symbol, contract, or domain with a typed relationship (motivates, constrains, documents, implements).
Inputs: decision_id (required), entity_type (required), entity_id (required), link_kind (required).
lint_architectureC
Validate an existing architecture for quality issues. Checks for: orphan nodes, duplicate connections, naming violations, single points of failure, god services, missing databases, sync overload, and more.
Inputs: id (required).
list_architecturesA
List all saved architectures. Use when the user asks to see, browse or find existing architectures.
Inputs: no named parameters.
list_god_nodesA
List symbols flagged as god nodes (very high fan-in or fan-out). Use to identify architectural coupling hotspots.
Inputs: repo_id, snapshot_id, top_n.
list_snapshotsA
List all indexed snapshots for a repo, newest first. Use for time-travel — pick two snapshot IDs and call diff_snapshots.
Inputs: repo_id (required).
query_symbolsA
Search for symbols by name or qualified name using fuzzy trigram matching. Replaces 10+ grep calls. Returns symbol kind, file path, fan-in/out, semantic role.
Inputs: snapshot_id (required), q (required), kind, role, +1 more.
record_contractA
Persist a service contract (OpenAPI, proto, event schema, etc.) to the code graph. Returns a contract_id to use with bind_contract.
Inputs: workspace_id (required), kind (required), name (required), version (required), +2 more.
record_decisionB
Persist an Architecture Decision Record (ADR) to the code graph. Supports supersession, lifecycle status, and immediate entity links.
Inputs: workspace_id (required), slug (required), title (required), context (required), +6 more.
record_embeddingA
Store an embedding vector for a symbol or file. Call this after generating an embedding with your native capability. Used to populate the vector search index.
Inputs: entity_type (required), entity_id (required), model (required), vector (required), +2 more.
record_semantic_nodeC
Persist an agent-extracted semantic node for a file or symbol
Inputs: job_id (required), snapshot_id (required), purpose (required), extracted_by (required), +7 more.
set_domain_membershipC
Assign a file, symbol, or service to a domain. Supports AI-inferred or human-confirmed assignments with a confidence score.
Inputs: domain_id (required), entity_type (required), entity_id (required), confidence, +1 more.
set_service_mappingA
Assign one or more files in a snapshot to a Tentra canvas service ID. Use after indexing to declare which service owns each file.
Inputs: snapshot_id (required), mappings (required).
sync_architectureA
Compare a saved architecture against the current codebase to detect drift. Scans the codebase and diffs the detected services/connections against the saved diagram. Reports added, removed, and changed services/connections with an accuracy score.
Inputs: architectureId (required), codebasePath (required).
update_architectureA
Update an existing architecture artifact. Call this when the user wants to modify, evolve, or improve an architecture that already exists. NEVER create a new one if you have an existing ID in context — always update instead. Preserves all existing services/connections unless explicitly replaced.
Inputs: id (required), name, description, services, +1 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 32 tools
Most tools have distinct purposes with clear boundaries, such as analyze_codebase for scanning, create_architecture for design, and diff_snapshots for comparison. However, some overlap exists between tools like get_architecture and list_architectures, or index_code and index_code_continue, which could cause minor confusion in selection.
Tool names follow a highly consistent verb_noun pattern throughout, such as analyze_codebase, create_architecture, and diff_snapshots. This predictability makes it easy for agents to understand and navigate the toolset without ambiguity.
With 32 tools, the count feels heavy for a single server, potentially overwhelming for agents to manage efficiently. While the domain of code analysis and architecture management is broad, the toolset could benefit from consolidation to reduce complexity and improve usability.
The toolset provides comprehensive coverage for codebase analysis, architecture management, and decision tracking, including CRUD operations (e.g., create, get, update, list architectures) and advanced features like diffing, linting, and exporting. No obvious gaps are present, ensuring agents can handle full workflows without dead ends.
Maintenance
Related MCP Connectors
Graph-native persistent memory for AI agents — 33 MCP tools, zero-LLM writes.
Persistent memory, knowledge graph, task management and more for AI agents via MCP.
Long-term memory for AI coding agents: durable project facts, recalled by every MCP client.
Shared project memory for AI coding agents: decisions, lessons, risks and tasks in one graph.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenancePersistent codebase knowledge layer for AI agents. Pre-digests codebases into structured knowledge (symbols, dependency graphs, co-change patterns, architectural decisions) and serves via MCP. 28 languages, 14 tools, ~85% token reduction.22 npm10MIT
- AlicenseAqualityBmaintenanceSelf-hosted memory and governance layer for AI coding agents. 28 MCP tools with hybrid search, structured knowledge capture, behavioral nudges, and git-native storage. Zero cloud dependencies.306Business Source 1.1
- AlicenseNot gradedqualityCmaintenanceMCP memory server for AI coding agents to remember decisions, patterns, and bugs between sessions. Provides persistent memory with 37 MCP tools, multi-session coordination, and token-efficient recall.225 npm12MIT
- FlicenseNot gradedqualityCmaintenancePersistent, self-curating memory for coding agents. It enables local, zero-cost context recall through MCP tools with hybrid retrieval and autonomous consolidation.-