Skip to main content
Glama

tentra-mcp

npm version npm downloads CI License: MIT

AIコーディングエージェントのためのメモリ。永続的なコードグラフとAI生成によるアーキテクチャ図 — MCPネイティブ。Cursor、Claude Code、Codex、Windsurfで動作します。

自社のモノレポでのベンチマーク結果:8つの「Xはどこに実装されているか?」というクエリにおいて、トークンを99.4%削減(156.8倍の効率化)しました。ファイル再読み込みによる114,644トークンに対し、query_symbolsでは731トークンでした。詳細はこちら →

クイックスタート (60秒)

cd your-repo
npx tentra-mcp init --hook

以下のコマンドを実行するだけです:

  1. Cursor / Claude Code / Codex / Windsurf(インストールされているもの)用のMCP設定を書き込みます。

  2. gitの post-commit フックをインストールし、コミットのたびにコードグラフが自動更新されるようにします(手動での再インデックスは不要)。

  3. 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種類のフレームワークに対応したコードエクスポートが得られます。リポジトリをインデックス化することで、エージェントはセッションごとにソースを再検索するのではなく、ファイル、シンボル、インポート、呼び出しエッジの構造化されたグラフに対してクエリを実行できます。

このMCPサーバーは、AIアシスタントに32個のツールを提供します:

アーキテクチャ (9ツール)

ツール

説明

create_architecture

説明から新しいシステムを設計する

update_architecture

既存のアーキテクチャを修正する

get_architecture

アーキテクチャの詳細を読み取る

list_architectures

保存されたすべての設計を閲覧する

analyze_codebase

ローカルコードをスキャンして図を生成する

lint_architecture

品質チェック(9つのルール:孤立ノード、単一障害点、神サービスなど)

sync_architecture

図とコード間の乖離を検出する

export_architecture

14種類のフレームワーク(Java, Python, Go, Rustなど)にエクスポートする

create_flow

ステップバイステップのフロー図を作成する

コードグラフ — 書き込み (4ツール)

ツール

説明

index_code

リポジトリを走査し、ローカルでTree-sitterを実行し、セマンティックインデックス作成ジョブを開始する

index_code_continue

進行中のインデックス作成ジョブを再開する

record_semantic_node

エージェントが抽出したセマンティックアノテーションを永続化する

get_index_job

インデックス作成ジョブのステータスを確認する

コードグラフ — 読み取り (10ツール)

ツール

説明

query_symbols

インデックス化されたシンボルに対するあいまいなトライグラム検索

get_symbol_neighbors

呼び出し/インポートグラフのBFS探索

get_service_code_graph

キャンバスサービスのサブグラフを取得する

explain_code_path

セマンティックコンテキストを伴う2つのシンボル間の最短パスを説明する

find_similar_code

エージェントが生成した埋め込みベクトルに対するpgvectorコサインANN検索

record_embedding

エージェントが生成した埋め込みベクトルを永続化する

list_god_nodes

最もファンイン/ファンアウトが多いシンボル(アーキテクチャ上の問題点)をリストアップする

get_quality_hotspots

チャーン(変更頻度)×複雑度によるランキング

list_snapshots

インデックス化されたスナップショットのタイムトラベルリスト

diff_snapshots

スナップショット間で追加/削除されたファイル/シンボル/神ノードの差分

エンリッチメント — 契約、決定、所有権、ドメイン (9ツール)

ツール

説明

set_service_mapping

インデックス化されたファイルやシンボルをキャンバスサービスにリンクする

set_domain_membership

サービスやファイルをドメイン(境界付けられたコンテキスト)に割り当てる

record_contract

解析されたAPI契約ペイロード(OpenAPI, GraphQL, Protobuf)を保存する

bind_contract

契約をそれを実装するシンボルにリンクする

record_decision

アーキテクチャ決定記録(ADR)を作成し、必要に応じてコードにリンクする

link_decision

ADRから別のシンボル、ファイル、またはサービスへのリンクを追加する

get_ownership

ファイルやサービスの所有者(チームまたは個人)を解決する

get_decisions_for

特定のエンティティにリンクされたADRをリストアップする

get_contracts

種類やサービスでフィルタリングして契約をリストアップする

セットアップ

オプション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とウェブアプリは 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 tools
analyze_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).

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

    B3.4/5.0

    Scored across 32 tools

    Disambiguation4/5

    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.

    Naming Consistency5/5

    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.

    Tool Count3/5

    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.

    Completeness5/5

    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

    ActivityInactive
    ResponsivenessLimited data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Persistent 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 npm
      10
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Self-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.
      30
      6
      Business Source 1.1
    • A
      license
      Not graded
      quality
      C
      maintenance
      MCP 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 npm
      12
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      Persistent, self-curating memory for coding agents. It enables local, zero-cost context recall through MCP tools with hybrid retrieval and autonomous consolidation.
      -