StackBridge
🌉 StackBridge-MCP
AIコーディングエージェント向けのサブミリ秒クロススタックAST契約・検証レイヤー
💡 StackBridgeが解決する課題
AIコーディングエージェント(Cursor, Claude Code, Windsurf, Antigravity)がフルスタックコードベースでバックエンドのモデルやAPIルートを編集するとき、バックエンドの単体テストは頻繁にパスする一方、フロントエンドは本番環境で静かに壊れます:
エージェントが
backend/routes.py内のAPIパラメータやPydantic/SQLAlchemyフィールドを変更する。バックエンドのテストは独立してパスする。エージェントに警告は発せられない。
そのエンドポイントを呼び出すReact/Next.jsクライアントが境界を越えてランタイムエラーで失敗する。
StackBridge-MCP は常時ウォームな Model Context Protocol (MCP) サーバーで、フルスタックのAST関係を解析し、0.75 ms でクロススタックの影響範囲を発見し、ベースライン差分によるコンパイラチェックで、誤検知ゼロで変更を検証します。
React / Next.js Client FastAPI Routes SQLAlchemy ORM Models
(TypeScript AST) ───► (Python AST) ───► (Schema AST)
UserProfile.tsx get_user_billing() BillingAccountRelated MCP server: repocontext
⚡ 主なハイライト
🌲 Tree-sitter ASTグラフ: Next.js(
fetch、Axios、React Query)↔ FastAPIルート↔ SQLAlchemy ORMモデルを、重いLSPサイドカーやランタイムインポートなしで解析。⚡ サブミリ秒トラバーサル: 永続的なSQLite WALデータベースと再帰的共通テーブル式(0.75 ms のトラバーサルクエリレイテンシ)。
📉 プロンプトトークン99.74%削減: 巨大な複数ファイルのコードダンプを、コンパクトで数学的に正確なAST契約スライスに置き換え。
🛡️ 根本原因診断ランキング: グラフ距離BFSによるエラーのランク付け(
🔴 PRIMARY ROOT CAUSEvs⚠️ CASCADING BREAKAGE)と、即時のGit差分パッチ出力。🧪 テスト影響選択: スキーマ変更の影響を受けるテストスイートを分離し、未テストの影響範囲パス(カバレッジ0%)を強調表示。
🌐 インタラクティブキャンバス: 内蔵のlocalhost三者可視化ツール(
stackbridge ui)をhttp://127.0.0.1:3456で提供。🔄 継続的インテリジェンス: バックグラウンドファイル監視デーモン(
stackbridge watch)と、生きたAGENTS.mdコンテキストジェネレーター。
📊 実世界ベンチマーク
fastapi-realworld-example-app(44ファイル、23のAST依存関係ノード、10のクロスバウンダリエッジ)で測定した実証的性能:
ベンチマーク指標 | 生コードベースダンプ | StackBridgeコンパクトスライス | 改善 / レイテンシ |
コンテキストウィンドウサイズ |
|
| 📉 トークン99.74%削減 |
影響範囲トラバーサル | 全リポジトリ検索: | SQLite再帰CTE: | ⚡ 200倍高速なトラバーサル |
コンパイラ検証 | グローバルリンター: | ベースライン差分エンジン: | 🛡️ 誤検知ゼロ |
自動テストスイート | — | 56 / 56 テスト合格 | ✅ 100%合格 |
完全なベンチマーク手法は docs/benchmarks.md および REAL_WORLD_BENCHMARK.md を参照。
🚀 クイックスタート
オプション1: インストール不要の実行(uvx推奨)
uvx stackbridge serveオプション2: Pipインストール
pip install stackbridge
stackbridge serve⚙️ クライアント設定
StackBridgeを標準のJSON-RPC 2.0 stdioでAIペアプログラマに接続:
1. Cursor (.cursor/mcp.json)
{
"mcpServers": {
"stackbridge": {
"command": "uvx",
"args": ["stackbridge", "serve"]
}
}
}2. Claude Desktop (claude_desktop_config.json)
{
"mcpServers": {
"stackbridge": {
"command": "python",
"args": ["-m", "stackbridge.main", "serve", "--transport", "stdio"]
}
}
}🤖 MCPツールリファレンス
StackBridgeはコーディングエージェントに高エルゴノミクスのツールを提供:
ツール名 | 引数 | 説明 |
|
| フルスタックの依存関係チェーンをトレース:フロントエンドコンポーネント ➔ APIルート ➔ データベースモデル。 |
|
| HTTPメソッド、ステータスコード、レスポンスモデル、および関連するフロントエンドfetch呼び出し元を信頼度スコア付きで抽出。 |
|
| 影響を受けるファイル全体でインメモリコンパイラチェックを実行し、根本原因をランク付けし、差分パッチを提案。 |
|
| リアルタイムのフルスタック境界統計、ノード数、エッジ数、および破損ドリフト状況を返す。 |
💻 CLIリファレンス
# Index a repository and export the dependency graph
stackbridge index --repo-path . --force
# Trace blast radius for a model or route
stackbridge trace --target BillingAccount
# Run pre-commit boundary verification guard
stackbridge guard --fail-on-error
# Launch interactive tripartite web visualizer
stackbridge ui --port 3456
# Start continuous background watcher daemon
stackbridge watch
# Generate living AGENTS.md boundary architecture guide
stackbridge init-agents
# Execute performance and token reduction benchmarks
stackbridge benchmark --runs 3 --output BENCHMARK.md📁 リポジトリ構造
StackBridge-MCP/
├── .github/
│ ├── workflows/ci.yml # CI pipeline (Python 3.10-3.13 on Ubuntu/Windows/macOS)
│ ├── ISSUE_TEMPLATE/ # Bug report and feature request issue templates
│ └── PULL_REQUEST_TEMPLATE.md # Standard PR checklist
├── docs/
│ ├── architecture.md # Subsystem breakdown and Mermaid diagrams
│ ├── benchmarks.md # Benchmark methodology and raw metrics
│ └── ast_extraction_spec.md # Tree-sitter extractor grammar specifications
├── stackbridge/
│ ├── core/ # Unified StackGraph, SQLite CTE store, watcher, route matcher
│ ├── parsers/ # Tree-sitter parsers (TS fetch, Python routes, SQLAlchemy)
│ ├── verifier/ # Baseline-diffed verifier, root-cause ranker, test impact selector
│ ├── mcp_server/ # FastMCP stdio server and JSON-RPC tools
│ ├── benchmarks/ # Benchmark runner and markdown report generator
│ └── ui/ # Localhost tripartite interactive canvas
├── tests/ # 56 automated test suites (parsers, verifiers, MCP E2E, CTE)
├── AGENTS.md # Living agent architecture guide
├── CHANGELOG.md # Version release notes
├── CONTRIBUTING.md # Contribution and development guidelines
├── LICENSE # MIT License
└── pyproject.toml # Package metadata and tool configurations📄 ライセンス
このプロジェクトは MITライセンス の下で提供されています。
Available Tools
5 toolsget_route_contractB
Extracts the API contract for a route, including HTTP method, status codes, response model, and all linked frontend fetch callers with confidence scores.
Inputs: route_path (required), repo_path. Returns: result
get_stack_healthC
Returns stack health diagnostics, graph statistics, and verification metrics.
Inputs: repo_path. Returns: result
trace_fullstack_pathB
Traces fullstack dependency chain across Frontend, API Routes, and SQLAlchemy ORM models.
Returns the complete path: Frontend component -> API Route handler -> Database Model.
Inputs: target, repo_path, symbol_or_path. Returns: result
verify_breakageA
Runs compiler and schema verification across all files impacted by a change.
Inputs: repo_path, modified_files. Returns: result
verify_schema_changeC
Runs compiler and schema verification across all files impacted by a change.
Inputs: repo_path, modified_files, schema_changes. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Two tools (verify_schema_change and verify_breakage) have identical descriptions, making them indistinguishable. Other tools are distinct but the duplication severely harms disambiguation.
All tools follow a consistent snake_case verb_noun pattern (trace_, get_, verify_, get_). No mixing of conventions.
Five tools is a well-scoped, focused set for a StackBridge server that handles dependency tracing, contract extraction, verification, and health diagnostics.
Core analysis features are present, but the duplicate verify tools indicate poor domain modeling. Missing a tool to list all routes or contracts, and it's unclear if schema verification and breakage verification are truly separate concepts.
Maintenance
Related MCP Connectors
Design domain models and generate deterministic multi-stack code, driven by your coding agent.
AI-native programming language and toolchain for accountable, verifiable agent-driven development.
Coding agents in multi-service codebases routinely rebuild existing helpers, trust stale type definitions, and modify API contracts without knowing who consumes them. Carrick solves this by indexing your entire TypeScript ecosystem across service and repository boundaries. By integrating deeply with the TypeScript compiler, Carrick traces every route, type, and cross-service call while recording function behaviour so agents search by intent rather than name. Delivered via MCP for AI agents and LSP for IDEs, Carrick ensures models see existing endpoints and utilities before generating new code. The scanner is source-available and runs from your CLI or CI pipeline.
Backend platform for AI agents: one agentstack.execute tool runs batched steps over +700 actions (hosting, storage, auth, payments, CRM, app builder).
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceLocal-first cross-service code intelligence engine for AI agents, connecting frontend, gateways, backend services, and databases to enable impact analysis and change planning.Apache 2.0
- AlicenseAqualityBmaintenanceNext-gen AST codebase map, token compression (70%~85% savings), and context packaging engine for AI coding agents & IDEs.43MIT
- AlicenseNot gradedqualityCmaintenanceEnables autonomous frontend and backend AI agents to asynchronously coordinate development by registering and discovering OpenAPI-compatible route contracts, tracking integration issues, and managing route groups for efficient LLM context.MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to retrieve precise, real-time architectural context—such as domains, models, routes, and events—from a codebase, avoiding the need to dump entire files into prompts.19 npm1MIT