StackBridge
๐ StackBridge-MCP
Sub-1ms Cross-Stack AST Contract & Verification Layer for AI Coding Agents
๐ก Why StackBridge?
When AI coding agents (Cursor, Claude Code, Windsurf, Antigravity) edit backend models or API routes in full-stack codebases, backend unit tests frequently pass while the frontend silently breaks in production:
An agent modifies an API parameter or Pydantic/SQLAlchemy field in
backend/routes.py.Backend tests pass in isolation. Nothing warns the agent.
The React/Next.js client calling that endpoint across the boundary fails with runtime errors.
StackBridge-MCP is an always-warm Model Context Protocol (MCP) server that parses full-stack AST relationships, discovers cross-stack blast radii in 0.75 ms, and verifies changes using baseline-diffed compiler checks with zero false positives.
React / Next.js Client FastAPI Routes SQLAlchemy ORM Models
(TypeScript AST) โโโโบ (Python AST) โโโโบ (Schema AST)
UserProfile.tsx get_user_billing() BillingAccountโก Key Highlights
๐ฒ Tree-sitter AST Graph: Parses Next.js (
fetch, Axios, React Query) โ FastAPI routes โ SQLAlchemy ORM models without heavy LSP sidecars or runtime imports.โก Sub-1ms Traversal: Persistent SQLite WAL database with recursive Common Table Expressions (0.75 ms traversal query latency).
๐ 99.74% Prompt Token Reduction: Replaces massive multi-file code dumps with compact, mathematically precise AST contract slices.
๐ก๏ธ Root-Cause Diagnostic Ranking: Graph-distance BFS ranks errors (
๐ด PRIMARY ROOT CAUSEvsโ ๏ธ CASCADING BREAKAGE) and outputs immediate Git diff patches.๐งช Test Impact Selection: Isolates test suites impacted by a schema change and highlights untested blast-radius paths (0% coverage).
๐ Interactive Canvas: Built-in localhost tripartite visualizer (
stackbridge ui) onhttp://127.0.0.1:3456.๐ Continuous Intelligence: Background file watcher daemon (
stackbridge watch) and livingAGENTS.mdcontext generator.
๐ Real-World Benchmarks
Empirical performance measured on fastapi-realworld-example-app (44 files, 23 AST dependency nodes, 10 cross-boundary edges):
Benchmark Metric | Raw Codebase Dump | StackBridge Compact Slice | Improvement / Latency |
Context Window Size |
|
| ๐ 99.74% Token Reduction |
Blast Radius Traversal | Full-repo search: | SQLite Recursive CTE: | โก 200x Faster Traversal |
Compiler Verification | Global linter: | Baseline-Diffed Engine: | ๐ก๏ธ Zero False Positives |
Automated Test Suite | โ | 56 / 56 tests passing | โ 100% Passing |
See full benchmark methodology in docs/benchmarks.md and REAL_WORLD_BENCHMARK.md.
๐ Quick Start
Option 1: Zero-Install Execution (Recommended via uvx)
uvx stackbridge serveOption 2: Pip Installation
pip install stackbridge
stackbridge serveโ๏ธ Client Configuration
Connect StackBridge to your AI pair programmer over standard 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 Reference
StackBridge exposes high-ergonomics tools to coding agents:
Tool Name | Arguments | Description |
|
| Traces the full-stack dependency chain: Frontend component โ API route โ Database model. |
|
| Extracts HTTP methods, status codes, response models, and linked frontend fetch callers with confidence scores. |
|
| Runs in-memory compiler checks across impacted files, ranking root causes and proposing diff patches. |
|
| Returns real-time full-stack boundary stats, node counts, edge counts, and breakage drift status. |
๐ป CLI Reference
# 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 Structure
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๐ License
This project is licensed under the MIT License.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ZainUlAbideen02/StackBridge-MCP'
If you have feedback or need assistance with the MCP directory API, please join our Discord server