Skip to main content
Glama

🌉 StackBridge-MCP

Sub-1ms-übergreifende AST-Vertrags- und Verifikationsschicht für KI-Codierungsagenten

PyPI version Python 3.10+ License: MIT CI Tests FastMCP Compatible


💡 Warum StackBridge?

Wenn KI-Codierungsagenten (Cursor, Claude Code, Windsurf, Antigravity) Backend-Modelle oder API-Routen in Full-Stack-Codebasen bearbeiten, bestehen Backend-Unit-Tests häufig, während das Frontend in der Produktion stillschweigend bricht:

  1. Ein Agent ändert einen API-Parameter oder ein Pydantic/SQLAlchemy-Feld in backend/routes.py.

  2. Backend-Tests bestehen isoliert. Nichts warnt den Agenten.

  3. Der React/Next.js-Client, der diesen Endpunkt über die Grenze hinweg aufruft, schlägt mit Laufzeitfehlern fehl.

StackBridge-MCP ist ein stets warmer Model Context Protocol (MCP)-Server, der Full-Stack-AST-Beziehungen parst, übergreifende Auswirkungsbereiche in 0,75 ms erkennt und Änderungen mittels Baseline-Differenz-Compiler-Prüfungen mit null Fehlalarmen verifiziert.

React / Next.js Client            FastAPI Routes            SQLAlchemy ORM Models
   (TypeScript AST)      ───►    (Python AST)     ───►          (Schema AST)
  UserProfile.tsx              get_user_billing()              BillingAccount

Related MCP server: repocontext

⚡ Wichtige Highlights

  • 🌲 Tree-Sitter-AST-Graph: Parst Next.js (fetch, Axios, React Query) ↔ FastAPI-Routen ↔ SQLAlchemy-ORM-Modelle ohne schwere LSP-Seitenprozesse oder Laufzeitimporte.

  • ⚡ Sub-1ms-Durchlauf: Persistente SQLite-WAL-Datenbank mit rekursiven Common Table Expressions (0,75 ms Durchlauf-Abfrage-Latenz).

  • 📉 99,74 % Prompt-Token-Reduktion: Ersetzt massive Multi-File-Code-Dumps durch kompakte, mathematisch präzise AST-Vertragsausschnitte.

  • 🛡️ Ursachen-Diagnose-Ranking: Graph-Distanz-BFS sortiert Fehler (🔴 PRIMÄRE URSACHE vs ⚠️ KASKADIERENDER BRUCH) und gibt sofortige Git-Diff-Patches aus.

  • 🧪 Test-Auswirkungsauswahl: Isoliert Testsuiten, die von einer Schemaänderung betroffen sind, und hebt ungetestete Auswirkungspfade (0 % Abdeckung) hervor.

  • 🌐 Interaktive Leinwand: Integrierter Localhost-Dreiteilungs-Visualisierer (stackbridge ui) auf http://127.0.0.1:3456.

  • 🔄 Kontinuierliche Intelligenz: Hintergrund-Dateiüberwachungs-Daemon (stackbridge watch) und lebendiger AGENTS.md-Kontextgenerator.


📊 Real-World-Benchmarks

Empirische Leistung gemessen an fastapi-realworld-example-app (44 Dateien, 23 AST-Abhängigkeitsknoten, 10 übergreifende Kanten):

Benchmark-Metrik

Roh-Codebase-Dump

StackBridge-Kompakter Ausschnitt

Verbesserung / Latenz

Kontextfenstergröße

19.705 Tokens

51 Tokens

📉 99,74 % Token-Reduktion

Auswirkungsbereich-Durchlauf

Voll-Repo-Suche: ~150 ms

SQLite-Rekursive-CTE: 0,75 ms

⚡ 200x Schnellerer Durchlauf

Compiler-Verifikation

Globaler Linter: ~3.500 ms

Baseline-Differenz-Engine: 312 ms

🛡️ Null Fehlalarme

Automatisierte Testsuite

—

56 / 56 Tests bestanden

✅ 100 % Bestanden

Vollständige Benchmark-Methodik in docs/benchmarks.md und REAL_WORLD_BENCHMARK.md.


🚀 Schnellstart

Option 1: Null-Installations-Ausführung (Empfohlen via uvx)

uvx stackbridge serve

Option 2: Pip-Installation

pip install stackbridge
stackbridge serve

⚙️ Client-Konfiguration

Verbinden Sie StackBridge mit Ihrem KI-Paarprogrammierer über standardmäßiges JSON-RPC 2.0 stdio:

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-Tools-Referenz

StackBridge stellt Codierungsagenten hoch ergonomische Tools zur Verfügung:

Tool-Name

Argumente

Beschreibung

trace_fullstack_path

symbol_or_path: str

Verfolgt die Full-Stack-Abhängigkeitskette: Frontend-Komponente ➔ API-Route ➔ Datenbankmodell.

get_route_contract

route_path: str

Extrahiert HTTP-Methoden, Statuscodes, Antwortmodelle und verknüpfte Frontend-Fetch-Aufrufer mit Konfidenzwerten.

verify_schema_change

modified_files: dict

Führt In-Memory-Compiler-Prüfungen über betroffene Dateien durch, bewertet Ursachen und schlägt Diff-Patches vor.

get_stack_health

repo_path: str

Gibt Echtzeit-Full-Stack-Grenzstatistiken, Knotenanzahlen, Kantenanzahlen und Bruch-Drift-Status zurück.


💻 CLI-Referenz

# 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

📁 Repository-Struktur

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

📄 Lizenz

Dieses Projekt ist unter der MIT-Lizenz lizenziert.

Available Tools

5 tools
get_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

    B3.1/5.0

    Scored across 5 tools

    Disambiguation2/5

    Two tools (verify_schema_change and verify_breakage) have identical descriptions, making them indistinguishable. Other tools are distinct but the duplication severely harms disambiguation.

    Naming Consistency5/5

    All tools follow a consistent snake_case verb_noun pattern (trace_, get_, verify_, get_). No mixing of conventions.

    Tool Count5/5

    Five tools is a well-scoped, focused set for a StackBridge server that handles dependency tracing, contract extraction, verification, and health diagnostics.

    Completeness3/5

    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

    ActivityNo data
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Local-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
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables 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
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables 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 npm
      1
      MIT