{
  "markdown": "# tentra-mcp\n\n[![npm version](https://img.shields.io/npm/v/tentra-mcp.svg)](https://www.npmjs.com/package/tentra-mcp) [![npm downloads](https://img.shields.io/npm/dw/tentra-mcp.svg)](https://www.npmjs.com/package/tentra-mcp) [![CI](https://github.com/rdanieli/tentra-mcp/actions/workflows/ci.yml/badge.svg)](https://github.com/rdanieli/tentra-mcp/actions/workflows/ci.yml) [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)\n\nMemory for AI coding agents. Persistent code graph + AI-generated architecture diagrams — MCP-native. Works in Cursor, Claude Code, Codex, and Windsurf.\n\nDogfood benchmark on our own monorepo: **99.4% token reduction** (156.8× ratio) across 8 \"where is X implemented?\" queries — 114,644 tokens via file re-read vs 731 tokens via `query_symbols`. [Full write-up →](https://trytentra.com/blog/we-measured-99-percent-token-savings-with-a-code-graph)\n\n## Quick Start (60 seconds)\n\n```bash\ncd your-repo\nnpx tentra-mcp init --hook\n```\n\nOne command:\n\n1. Writes MCP config for **Cursor / Claude Code / Codex / Windsurf** (whichever are installed)\n2. Installs a git `post-commit` hook so the code graph auto-refreshes after every commit — no manual re-indexing\n3. Auto-derives your `repo_id` from the git remote and saves it to `.tentra/metadata.json`\n\nThen grab your API key at [trytentra.com/settings](https://trytentra.com/settings), replace `YOUR_TENTRA_API_KEY` in the generated config, reload your IDE, and ask your agent:\n\n```\nIndex this codebase with Tentra and list the god-nodes\n```\n\nFrom here on, every `git commit` fires a background re-index. Your agents stay caught up automatically.\n\n> **Skip the hook:** drop `--hook` — just writes IDE configs.\n> **Manual stdio install:** `npx tentra-mcp` (opens browser for GitHub device-flow auth on first tool call).\n> **API key instead:** `npx tentra-mcp --key YOUR_API_KEY`.\n\n## What is Tentra?\n\nTentra is an AI-native architecture platform for engineering teams. Describe a system — get a diagram and 14-framework code exports. Index your repo — agents query a structured graph of files, symbols, imports, and call edges instead of re-grepping source every session.\n\nThis MCP server gives your AI assistant **36 tools**:\n\n### Architecture (10 tools)\n| Tool | Description |\n|------|-------------|\n| `create_architecture` | Design a new system from a description |\n| `update_architecture` | Modify an existing architecture |\n| `get_architecture` | Read architecture details |\n| `list_architectures` | Browse all saved designs |\n| `analyze_codebase` | Scan local code and generate diagram |\n| `lint_architecture` | Quality checks (9 rules: orphans, SPOFs, god services) |\n| `sync_architecture` | Detect drift between diagram and code |\n| `get_spec_alignment` | Mid-implementation drift check — changed files in, spec context + drift signals out |\n| `export_architecture` | Export to 14 frameworks (Java, Python, Go, Rust, etc.) |\n| `create_flow` | Create step-by-step flow visualization |\n\n### Code Graph — Write (4 tools)\n| Tool | Description |\n|------|-------------|\n| `index_code` | Walk a repo, Tree-sitter locally, start a semantic indexing job |\n| `index_code_continue` | Resume an in-progress indexing job |\n| `record_semantic_node` | Persist an agent-extracted semantic annotation |\n| `get_index_job` | Check status of an indexing job |\n\n### Code Graph — Read (13 tools)\n| Tool | Description |\n|------|-------------|\n| `query_symbols` | Fuzzy trigram search across indexed symbols |\n| `find_references` | Every resolved caller of a symbol — refactor-safety primitive |\n| `safe_rename` | Patch plan (definition + every call site) for renaming a symbol |\n| `explain_codebase` | Agent-ready narrative walkthrough of a whole repo |\n| `get_symbol_neighbors` | BFS traversal in the call/import graph |\n| `get_service_code_graph` | Subgraph for a canvas service |\n| `explain_code_path` | Shortest path between two symbols with semantic context |\n| `find_similar_code` | pgvector cosine ANN over agent-generated embeddings |\n| `record_embedding` | Persist an agent-generated embedding vector |\n| `list_god_nodes` | Highest fan-in/out symbols (architectural smells) |\n| `get_quality_hotspots` | Churn × complexity ranking |\n| `list_snapshots` | Time-travel listing of indexed snapshots |\n| `diff_snapshots` | Files / symbols / god-nodes added/removed between snapshots |\n\n### Enrichment — Contracts, Decisions, Ownership, Domains (9 tools)\n| Tool | Description |\n|------|-------------|\n| `set_service_mapping` | Link an indexed file or symbol to a canvas service |\n| `set_domain_membership` | Assign a service or file to a domain (bounded context) |\n| `record_contract` | Store a parsed API contract payload (OpenAPI, GraphQL, Protobuf) |\n| `bind_contract` | Link a contract to the symbol that implements it |\n| `record_decision` | Create an Architecture Decision Record, optionally linking code |\n| `link_decision` | Append a link from an ADR to another symbol, file, or service |\n| `get_ownership` | Resolve the owner (team or person) for a file or service |\n| `get_decisions_for` | List ADRs linked to a given entity |\n| `get_contracts` | List contracts, optionally filtered by kind or service |\n\n## Setup\n\n### Option 1: SSE (zero install)\n\nAdd to your IDE's MCP config — no local install needed:\n\n**Cursor** (Settings > Features > MCP > Add Server):\n```json\n{\n  \"tentra\": {\n    \"type\": \"sse\",\n    \"url\": \"https://trytentra.com/api/mcp?key=YOUR_API_KEY\"\n  }\n}\n```\n\n**Claude Code** (`.mcp.json` in project root):\n```json\n{\n  \"mcpServers\": {\n    \"tentra\": {\n      \"type\": \"sse\",\n      \"url\": \"https://trytentra.com/api/mcp?key=YOUR_API_KEY\"\n    }\n  }\n}\n```\n\n### Option 2: Local install (needed for codebase scanning)\n\n```bash\nnpx tentra-mcp\n```\n\nAuthenticates automatically via GitHub on first use. Credentials are saved to `~/.tentra/credentials`.\n\n**Cursor** config for local server:\n```json\n{\n  \"tentra\": {\n    \"command\": \"npx\",\n    \"args\": [\"tentra-mcp\"]\n  }\n}\n```\n\n**Claude Code** (`.mcp.json`):\n```json\n{\n  \"mcpServers\": {\n    \"tentra\": {\n      \"command\": \"npx\",\n      \"args\": [\"tentra-mcp\"]\n    }\n  }\n}\n```\n\n## Usage Examples\n\nOnce connected, just talk to your AI:\n\n```\n\"Design a payment system with Stripe, Kafka, and PostgreSQL\"\n→ AI calls create_architecture → diagram at trytentra.com/arch/xxx\n\n\"Scan this codebase and generate the architecture\"\n→ AI calls analyze_codebase → detects services, DBs, queues\n\n\"Export this architecture to Java Spring Boot\"\n→ AI calls export_architecture → downloads zip with project scaffold\n\n\"What changed since last time? Is my diagram outdated?\"\n→ AI calls sync_architecture → drift report with accuracy score\n```\n\n## Export Formats\n\nJava (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\n\n## Links\n\n- Website: [trytentra.com](https://trytentra.com)\n- Documentation: [trytentra.com/docs](https://trytentra.com/docs)\n- Setup Guide: [trytentra.com/docs/setup](https://trytentra.com/docs/setup)\n- Gallery: [trytentra.com/gallery](https://trytentra.com/gallery)\n\n## Development\n\nThis repo contains the open-source MCP server. The Tentra API and web app are a separate hosted service at [trytentra.com](https://trytentra.com).\n\n```bash\nnpm install --legacy-peer-deps\nnpm run build      # tsc --noEmit + esbuild bundle → dist/index.js\nnpm start          # run the bundled server\nnpm test           # vitest\n```\n\nThe published npm package (`tentra-mcp`) ships only the bundled `dist/` — source is here for auditability and community contributions.\n\n## License\n\nMIT\n",
  "bytes": 7642,
  "sha": "20a0c6624163944694e3cd314bcfcaac2234882516c5210eca41ce2f82b03ca3",
  "repo_slug": "rdanieli/tentra-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_rdanieli_tentra_b2c49a13/readme"
}