runtime-mcp-connect
Exposes a live application's runtime state to coding agents, including logs, DB schema, config, and feature flags, with read-only SQL and secret redaction.
README
<div align="center">
runtime-mcp
Your app's live runtime state — logs, DB schema, config, feature flags — as MCP tools for coding agents.
Drop it into your app. Your agent stops guessing.
</div>
When opencode, Claude Code, or Cursor debug your app today, they work blind: stale guesses about your schema, pasted log fragments, invented config values.
runtime-mcp closes that gap. Two lines of setup and any MCP-speaking agent can query what your running process actually sees:
Agent: "why is checkout failing?"
├─ get_errors → TypeError at checkout.ts:42, full stack trace
├─ db_query → orders table has no `coupon_id` column
├─ config:// → STRIPE_KEY: [REDACTED], TAX_RATE: 0 ← there it is
└─ "Found it — you renamed the env var."
Quickstart
0 — Install:
npm install runtime-mcp runtime-mcp-integrations
1 — Instrument your app (one import):
import { runtimeMcp } from 'runtime-mcp';
import { pgAdapter } from 'runtime-mcp-integrations/pg';
await runtimeMcp({
db: pgAdapter(pool),
config: process.env,
flags: myFlagRegistry,
});
2 — Register the shim in your project's .mcp.json:
{
"mcpServers": {
"runtime": { "command": "npx", "args": ["-y", "runtime-mcp-connect"] }
}
}
3 — Start your app. That's it. The agent connects automatically and sees live state from then on.
What agents get
Tools
| Tool | Description |
|---|---|
get_logs |
Recent logs · filter by level, free-text query, time window |
get_errors |
Error entries with stack traces — first call when something broke |
db_query |
Read-only SQL (SELECT/WITH only) · writes rejected · auto LIMIT |
app_info |
Name, version, PID, uptime, registered routes |
Resources
| Resource | Description |
|---|---|
config://current |
Live config with secrets replaced by [REDACTED] |
flags://state |
Feature flag states per environment |
schema://tables |
Table inventory |
schema://table/{name} |
Columns, primary keys, indexes, foreign keys |
Architecture
┌──────────────────────────────┐ ┌─────────────────────────────┐
│ Your App │ │ Agent (opencode/Claude) │
│ │ │ │
│ runtimeMcp({ db, config }) │ │ .mcp.json │
│ ├─ log ring buffer │ │ └─ runtime-mcp-connect │
│ ├─ schema introspection │ │ │ stdio │
│ ├─ config + redaction │◄─────────┼──────────┘ │
│ └─ feature flags │ loopback│ │
│ │ HTTP │ │
│ 127.0.0.1:<port>/mcp │ │ │
│ .runtime-mcp.json ──────────┼─ pid·url·token·(chmod 600) │
└──────────────────────────────┘ └─────────────────────────────┘
Why two pieces? Agents spawn their own processes — they can't reach into your app. The discovery file bridges them: the library writes it on boot, the shim reads it on every call. App restarted with a new port or token? The shim reconnects automatically. Nothing to reconfigure, ever.
Adapters
npm install runtime-mcp runtime-mcp-integrations
<table> <tr><th>Import</th><th>Use with</th></tr> <tr><td><code>runtime-mcp-integrations/pg</code></td><td><code>pg</code> Pool — full introspection + queries</td></tr> <tr><td><code>runtime-mcp-integrations/prisma</code></td><td>PrismaClient (Postgres)</td></tr> <tr><td><code>runtime-mcp-integrations/node-sqlite</code></td><td><code>node:sqlite</code> DatabaseSync — zero native deps</td></tr> <tr><td><code>runtime-mcp-integrations/pino</code></td><td>Pino destination mirroring into the buffer</td></tr> <tr><td><code>runtime-mcp-integrations/winston</code></td><td>Winston transport</td></tr> <tr><td><code>runtime-mcp-integrations/express</code></td><td>Error middleware recording request failures</td></tr> </table>
Structured logging example:
import pino from 'pino';
import { createRuntimeMcpPinoDestination } from 'runtime-mcp-integrations/pino';
const logger = pino(pino.multistream([
pino.destination(1),
createRuntimeMcpPinoDestination(),
]));
No logger wired up? Console capture is on by default — console.error and friends flow into the same buffer.
Security model
Built for local development and staging. Defense in depth by default:
| Control | Behavior |
|---|---|
| Loopback bind | Endpoint listens on 127.0.0.1 only; remote exposure requires explicit opt-in |
| Token auth | Bearer token per app start, stored chmod 600 in .runtime-mcp.json |
| Read-only SQL | Allowlist parser: non-SELECT rejected, stacked statements rejected, keywords inside strings/comments ignored |
| Secret redaction | Password/token/key/auth-shaped keys and known token formats become [REDACTED] before leaving the process |
| No telemetry | Zero phone-home |
Add .runtime-mcp.json to .gitignore.
Why now
| Existing solution | Limitation |
|---|---|
Next.js 16 /_next/mcp |
Framework-locked |
| Vercel runtime logs MCP | Cloud platform only |
| Datadog / Sentry / Supabase MCPs | SaaS accounts; not your live dev process |
Every platform is building this inward. Nobody built it generically. This is that.
Demo
packages/demo-app is an Express + SQLite store with two planted bugs — an N+1 query on /orders, and a misnamed DEMO_TAX_RATE env var that silently zeroes checkout tax. Point your agent at it and ask "why are checkout totals wrong?"
pnpm install && pnpm -r build
pnpm --filter @runtime-mcp/demo-app dev
Packages
All packages are published to npm (v0.1.0):
| Package | npm | Purpose |
|---|---|---|
runtime-mcp |
npm ↗ | In-process registry · loopback endpoint · discovery · redaction |
runtime-mcp-connect |
npm ↗ | stdio shim agents register in .mcp.json |
runtime-mcp-integrations |
npm ↗ | Framework, logger, and database adapters |
@runtime-mcp/demo-app |
— | Debugging demo with planted bugs (repo only) |
Requires Node ≥ 20. ESM.
Development
pnpm install
pnpm -r build
pnpm test # unit + end-to-end over real HTTP and stdio transports
<details> <summary><strong>Roadmap</strong></summary>
- [ ] Live log tailing via MCP resource subscriptions
- [ ] Fastify / Hono adapters
- [ ] MySQL / Drizzle introspection adapters
- [ ] Python SDK parity (FastAPI / Django)
- [ ] Multi-project workspaces in the connect shim
</details>
License
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。