runtime-mcp-connect
runtime-mcp
将你应用实时的运行时状态——日志、数据库 schema、配置、功能开关——以 MCP 工具的形式提供给编码智能体。
把它放进你的应用。你的智能体不再靠猜。
如今,当 opencode、Claude Code 或 Cursor 调试你的应用时,它们是在盲人摸象:过时的 schema 猜测、粘贴的日志片段、凭空捏造的配置值。
runtime-mcp 填补了这一空白。两行配置,任何支持 MCP 的智能体就能查询你的运行中进程实际看到的状态:
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."快速开始
0 — 安装:
npm install runtime-mcp runtime-mcp-integrations1 — 在你的应用中埋点(一次导入):
import { runtimeMcp } from 'runtime-mcp';
import { pgAdapter } from 'runtime-mcp-integrations/pg';
await runtimeMcp({
db: pgAdapter(pool),
config: process.env,
flags: myFlagRegistry,
});2 — 在项目的 .mcp.json 中注册 shim:
{
"mcpServers": {
"runtime": { "command": "npx", "args": ["-y", "runtime-mcp-connect"] }
}
}3 — 启动你的应用。 就这样。智能体会自动连接,并从此看到实时状态。
Related MCP server: Engineering Intelligence MCP
智能体可以获得什么
工具
工具 | 说明 |
| 最近的日志 · 可按级别、全文搜索、时间窗口过滤 |
| 带堆栈跟踪的错误条目——出问题时首先调用它 |
| 只读 SQL(仅 |
| 名称、版本、PID、运行时长、已注册的路由 |
资源
资源 | 说明 |
| 实时配置,密钥已替换为 |
| 各环境下的功能开关状态 |
| 表清单 |
| 列、主键、索引、外键 |
架构
┌──────────────────────────────┐ ┌─────────────────────────────┐
│ 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) │
└──────────────────────────────┘ └─────────────────────────────┘为什么分成两部分? 智能体会启动自己的进程——它们无法直接探入你的应用。发现文件在两者之间架起桥梁:库在启动时写入它,shim 在每次调用时读取它。应用重启后换了端口或令牌?shim 会自动重连。永远无需重新配置。
适配器
npm install runtime-mcp runtime-mcp-integrations结构化日志示例:
import pino from 'pino';
import { createRuntimeMcpPinoDestination } from 'runtime-mcp-integrations/pino';
const logger = pino(pino.multistream([
pino.destination(1),
createRuntimeMcpPinoDestination(),
]));没有接入日志库?控制台捕获默认开启——console.error 等输出会流入同一个缓冲区。
安全模型
专为本地开发和预发布环境打造。默认纵深防御:
控制项 | 行为 |
回环绑定 | 端点仅监听 |
令牌认证 | 每次应用启动生成 Bearer 令牌,以 chmod 600 权限存储在 |
只读 SQL | 白名单解析器:拒绝非 |
密钥脱敏 | 密码/令牌/密钥/auth 形状的键以及已知令牌格式在离开进程前变为 |
无遥测 | 零数据回传 |
将 .runtime-mcp.json 加入 .gitignore。
为什么是现在
现有方案 | 局限 |
Next.js 16 | 被框架锁定 |
Vercel 运行时日志 MCP | 仅限云平台 |
Datadog / Sentry / Supabase MCP | 需要 SaaS 账号;不是你的本地开发进程 |
每个平台都在朝这个方向自建。但没有人做出通用方案。 这就是那个通用方案。
演示
packages/demo-app 是一个 Express + SQLite 商店,内置两个故意埋下的 bug——/orders 上的 N+1 查询,以及一个拼写错误的 DEMO_TAX_RATE 环境变量,导致结账税费被静默清零。让智能体指向它,然后问*"为什么结账总额不对?"*
pnpm install && pnpm -r build
pnpm --filter @runtime-mcp/demo-app dev包
所有包均已发布到 npm(v0.1.0):
包 | npm | 用途 |
进程内注册表 · 回环端点 · 发现 · 脱敏 | ||
智能体在 | ||
框架、日志库和数据库适配器 | ||
— | 带故意埋入 bug 的调试演示(仅仓库内) |
需要 Node ≥ 20。ESM。
开发
pnpm install
pnpm -r build
pnpm test # unit + end-to-end over real HTTP and stdio transports通过 MCP 资源订阅实现实时日志流
Fastify / Hono 适配器
MySQL / Drizzle 内省适配器
Python SDK 对等实现(FastAPI / Django)
connect shim 中的多项目工作区
许可证
This server cannot be deployed
Maintenance
Related MCP Connectors
- SuperlogOAuthsh.superlog
Open-source agent that observes and fixes your application. Query logs, traces, metrics, incidents.
Deploy local apps, add managed Postgres, and inspect logs from your AI coding agent.
Safe, read-only Postgres and MySQL access for AI agents. Audit log + column-level controls.
- BugTapeOAuthai.bugtape
Production bugs with replay, network, console and stack, ranked for your coding agent to fix.
Related MCP Servers
- FlicenseNot gradedqualityCmaintenanceGives AI coding assistants live, structured access to running apps' state and UI elements, enabling real-time verification and interaction across web, mobile, and desktop.36-
- AlicenseNot gradedqualityDmaintenanceEnables AI clients to inspect backend systems through structured engineering tools including Git history, Winston logs, OpenAPI contracts, and sandboxed source code.2ISC
- AlicenseNot gradedqualityBmaintenanceEnables coding agents to access live runtime observability data such as logs, deploys, and health metrics for evidence-based incident triage.1MIT
- FlicenseAqualityBmaintenanceProvides AI coding agents with real-time visibility into local development runtime state, enabling them to tail application logs, inspect ports, monitor process metrics, and diagnose network errors.1-