Skip to main content
Glama
limjonathan

runtime-mcp-connect

by limjonathan

runtime-mcp

将你应用实时的运行时状态——日志、数据库 schema、配置、功能开关——以 MCP 工具的形式提供给编码智能体。

npm core npm integrations npm connect node tests license

把它放进你的应用。你的智能体不再靠猜。


如今,当 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-integrations

1 — 在你的应用中埋点(一次导入):

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 — 启动你的应用。 就这样。智能体会自动连接,并从此看到实时状态。

智能体可以获得什么

工具

工具

说明

get_logs

最近的日志 · 可按级别、全文搜索、时间窗口过滤

get_errors

带堆栈跟踪的错误条目——出问题时首先调用它

db_query

只读 SQL(仅 SELECT/WITH)· 拒绝写入 · 自动加 LIMIT

app_info

名称、版本、PID、运行时长、已注册的路由

资源

资源

说明

config://current

实时配置,密钥已替换为 [REDACTED]

flags://state

各环境下的功能开关状态

schema://tables

表清单

schema://table/{name}

列、主键、索引、外键

架构

┌──────────────────────────────┐          ┌─────────────────────────────┐
│         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 等输出会流入同一个缓冲区。

安全模型

专为本地开发和预发布环境打造。默认纵深防御:

控制项

行为

回环绑定

端点仅监听 127.0.0.1;远程暴露需显式选择加入

令牌认证

每次应用启动生成 Bearer 令牌,以 chmod 600 权限存储在 .runtime-mcp.json

只读 SQL

白名单解析器:拒绝非 SELECT、拒绝堆叠语句、忽略字符串/注释内的关键字

密钥脱敏

密码/令牌/密钥/auth 形状的键以及已知令牌格式在离开进程前变为 [REDACTED]

无遥测

零数据回传

.runtime-mcp.json 加入 .gitignore

为什么是现在

现有方案

局限

Next.js 16 /_next/mcp

被框架锁定

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

用途

runtime-mcp

npm ↗

进程内注册表 · 回环端点 · 发现 · 脱敏

runtime-mcp-connect

npm ↗

智能体在 .mcp.json 中注册的 stdio shim

runtime-mcp-integrations

npm ↗

框架、日志库和数据库适配器

@runtime-mcp/demo-app

带故意埋入 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 中的多项目工作区

许可证

MIT

-
license - not tested
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • Read-only bank access for your AI agent. Connects Claude, ChatGPT, Cursor, Gemini, Codex.

  • Shared, permission-aware company context for AI agents, with provenance, approvals and audit.

  • Read-only access to Auralogs production logs: search logs, inspect errors, review AI analyses.

View all MCP Connectors

Latest Blog Posts

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/limjonathan/runtime-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server