StackBridge
Parses Axios HTTP calls in frontend code to link them to backend API routes, enabling cross-stack dependency analysis.
Analyzes FastAPI route definitions, parameters, and response models to detect breakages when frontend or database changes.
Traces fetch calls in Next.js applications to map frontend components to backend API routes and database models.
Parses Pydantic models to verify API contract consistency across the full stack.
Analyzes React component ASTs to identify dependencies on API routes and database models.
Parses React Query usage to link data fetching logic to backend endpoints and detect breaking changes.
Traces SQLAlchemy ORM models to understand database schema changes and their impact on API routes and frontend code.
π 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() BillingAccountRelated MCP server: repocontext
β‘ 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.
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