Skip to main content
Glama

๐Ÿ”Œ runtime-mcp: Live Runtime MCP Bridge for AI Agents

Python 3.14+ FastMCP Runtime Tap Cross-Platform License: MIT

Eliminate environment and runtime hallucinations.
runtime-mcp bridges the gap between static code analysis and live application runtime. It transparently inspects live SQLite schemas, intercepts live HTTP errors (4xx/5xx) through an async local reverse proxy, extracts log stack traces, and serves an instant, compact state snapshot to Antigravity, Claude Code, and Cursor via the Model Context Protocol (MCP).


๐Ÿ›‘ The Problem

Modern AI coding agents (Claude, Cursor, Antigravity) are exceptional at reading static code, but they are completely blind to your application's actual runtime state:

  1. Database Hallucinations: Because migrations are often complex or out-of-sync, agents frequently invent non-existent database columns, missing types, or incorrect foreign keys.

  2. Copy-Paste Friction: When an API returns a 500 Internal Server Error, you have to manually copy payloads, headers, and terminal stack traces back into chat.

  3. Stale Context: Agents suggest code changes based on assumptions rather than verified ground-truth runtime state.


Related MCP server: Alma Atlas

โšก The Solution

runtime-mcp acts as a zero-overhead live telemetry sidecar for your local development stack:

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚  Browser / Frontend  โ”‚ โ”€โ”€โ”€โ”€โ”€โ”€> โ”‚  runtime-mcp tap (:8090)     โ”‚ โ”€โ”€โ”€โ”€โ”€> โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚  (Captures 4xx/5xx failures) โ”‚        โ”‚ Local App (:3000)  โ”‚
                                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜        โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
                                                โ”‚
                                    .runtime_state.json
                                                โ”‚
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”         โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ AI Assistant         โ”‚ <====== โ”‚   runtime-mcp serve (MCP)    โ”‚
โ”‚ (Antigravity/Claude) โ”‚  stdio  โ”‚  - get_live_db_schema()      โ”‚ <โ”€โ”€โ”€โ”€โ”€ SQLite DB (?mode=ro)
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜         โ”‚  - get_recent_http_errors()  โ”‚
                                 โ”‚  - get_runtime_snapshot()    โ”‚ <โ”€โ”€โ”€โ”€โ”€ App Logs (*.log)
                                 โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜
  • DatabaseSchemaTap: Connects to your local SQLite database in read-only URI mode (?mode=ro). Extracts real tables, column types, primary/foreign keys, indexes, and row counts into an ultra-compact, hallucination-resistant Markdown schema.

  • HttpTap: An asynchronous local reverse proxy (asyncio + httpx) listening on :8090 (or custom port) and forwarding to your backend (:3000, :8000, etc.). Automatically captures requests and deep response bodies for 4xx/5xx failures into a thread-safe ring buffer.

  • LogTailTap: Automatically tails your application log file and parses Python (Traceback (most recent call last)...) and Node.js (Error: ... at ...) stack traces, as well as ERROR and CRITICAL log events.

  • Zero-Latency State Store: Synchronizes runtime events between the CLI proxy process and the MCP server process using an atomic, cross-platform file buffer (.runtime_state.json).


๐Ÿš€ Quickstart

1. Installation

Requires Python 3.14+:

# Clone the repository
git clone https://github.com/your-username/runtime-mcp.git
cd runtime-mcp

# Create and activate virtual environment
python3 -m venv .venv

# macOS / Linux
source .venv/bin/activate

# Windows (PowerShell)
# .venv\Scripts\Activate.ps1

# Install in editable mode
pip install -e .

2. Run the Live Traffic Tap

Start the interceptor proxy, binding your backend port, database, and log file:

# macOS / Linux / Windows
python -m src.cli tap --listen 8090 --target 3000 --db ./app.db --log ./app.log

Now, point your frontend or API client to http://localhost:8090 instead of 3000. All requests pass through transparently with minimal latency, and all errors are captured in real-time.

3. Check the Runtime Snapshot in Terminal

At any time, inspect the current runtime snapshot directly in your terminal:

python -m src.cli snapshot --db ./app.db --log ./app.log

4. Run the MCP Server

Launch the FastMCP server over standard I/O:

python -m src.cli serve

๐Ÿค– AI Agent Integration (MCP Configuration)

Add runtime-mcp to your AI assistant's MCP configuration.

For Google Antigravity & Claude Code & Cursor

Add this block to your mcpServers configuration file:

  • Antigravity: ~/.gemini/antigravity/mcp_config.json or project settings

  • Claude Code / Desktop: claude_desktop_config.json

  • Cursor: .cursor/mcp.json

{
  "mcpServers": {
    "runtime-mcp": {
      "command": "python",
      "args": [
        "-m",
        "src.cli",
        "serve",
        "--state-file",
        "/absolute/path/to/project/.runtime_state.json"
      ],
      "env": {
        "PYTHONPATH": "/absolute/path/to/runtime-mcp"
      }
    }
  }
}

Tip for Windows users: Use forward slashes or escaped backslashes for paths (e.g. C:/Users/name/projects/runtime-mcp/.runtime_state.json).


๐Ÿ› ๏ธ MCP Tools Reference

Once connected, your AI assistant gains access to three live tools:

Tool

Parameters

Description

get_live_db_schema

db_path: str = ""

Returns verified SQLite table definitions, column types, keys, and row counts in compact Markdown.

get_recent_http_errors

limit: int = 10

Returns recent HTTP 4xx/5xx failures, response payloads, request bodies, and latency.

get_runtime_snapshot

none

Generates a single, consolidated report combining environment telemetry, live DB schema, network failures, and log stack traces.


๐Ÿ’ป CLI Commands Reference

All commands can be invoked either via runtime-mcp <command> or python -m src.cli <command>:

tap

Starts the live HTTP proxy tap and monitors DB / logs:

runtime-mcp tap [OPTIONS]

Options:
  -l, --listen INTEGER  Port to listen on [default: 8090]
  -t, --target TEXT     Target backend port or URL (e.g. 3000 or http://localhost:3000) [default: 3000]
  -d, --db TEXT         Path to local SQLite database file
  --log TEXT            Path to application log file
  --state-file TEXT     Path to state file for persistence [default: .runtime_state.json]

snapshot

Prints the current verified runtime state in terminal with Rich formatting:

runtime-mcp snapshot [OPTIONS]

Options:
  -d, --db TEXT         Path to local SQLite database file
  --log TEXT            Path to application log file
  --state-file TEXT     Path to state file [default: .runtime_state.json]

serve

Runs the FastMCP server over stdio for IDE and AI agent connections:

runtime-mcp serve [OPTIONS]

Options:
  --state-file TEXT     Path to state file [default: .runtime_state.json]

๐Ÿงช Running Tests

The test suite covers SQLite schema extraction, read-only enforcement, async HTTP proxying, status 500 interception, log stack trace parsing, and direct MCP tool execution:

pytest -v

๐Ÿ“„ License

This project is open-source software licensed under the MIT License.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelogโ€ฆ

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Provides AI agents with a live architecture model of a codebase, enabling queries for root cause analysis, blast radius, and dependency traversal through MCP tools.
      255 npm
      34
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to query live schema, lineage, and query-context across data warehouses, dbt projects, orchestration systems, and BI tools via MCP tools.
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables AI agents to investigate production incidents by exposing service health, logs, and deployment data through MCP tools.
      5 npm
      ISC