Skip to main content
Glama

在删除旧路径之前先对其进行插桩

CI

MCP 是一个开放协议,供 LLM 应用通过 JSON-RPC 调用工具。

Kent 的作业:你有一条仍然接线的旧路径,而且你还没有统计是否还有人使用它。在删除之前先测量。

本仓库运行一个双时代 MCP 服务器和一个在重启后仍然存活的 SQLite 账本。只要还有任何旧操作存在,你就保留回退路径。

版本控制页面命名了这两条通道。旧版2025-11-25 及更早:会话以 initialize 开始。现代2026-07-28 及更晚:每个请求在 _meta 中携带版本和身份。

统计已完成的工作

一个重连的客户端会改变请求计数。如果客户端每次调用都打开新连接,五次旧版工具调用会花费十五个请求;如果它保持一个连接,则花费七个。旧版握手每次连接都会消耗 initializenotifications/initialized,因此重连的客户端看起来像是大量的旧版流量。每一行都是每条通道相同的五次工具调用:

每条通道五次工具调用

旧版请求

现代请求

旧版占比

客户端每次调用都重连

15

10

60.0%

客户端保持一个连接

7

6

53.8%

已完成的操作

5

5

50.0%

你在操作行上计数 5 和 5。请求行相差六个百分点,因为客户端选择了重连。recommend() 读取操作行。统计在传输重写或客户端改变连接方式后仍然匹配的单位。

Related MCP server: mcpstat

运行它

需要 Node 24 或更新版本。你使用 node:sqlite 存储账本。

先启动收集器,然后启动服务器,再生成流量:

pnpm install

pnpm collector   # http://127.0.0.1:3000, OTLP (the metric export format) and agent tools
pnpm server      # http://127.0.0.1:8787, dual-era MCP server
pnpm traffic     # legacy and modern tool calls, plus DCR and CIMD hits

DCR 是动态客户端注册:客户端在每次连接时向 /register POST 元数据。在 2026-07-28 中已弃用。CIMD 是客户端 ID 元数据文档:客户端 ID 是一个指向静态元数据的 HTTPS URL,是 DCR 的替代方案。

然后读取两个存储:

pnpm report      # verdict from .data/migration-evidence.db
pnpm proof       # lane series from the collector

pnpm traffic 之后等待六秒再运行 pnpm proof,以便抓取完成。

第一次运行会打印以下内容:

Migration readiness: MCP protocol lanes
=======================================
window            : 7 days
active days       : 1/7 required
legacy operations : 5
modern operations : 3
total operations  : 8/100 required
legacy %          : 62.50%
raw requests      : 15 legacy / 6 modern
legacy methods    : initialize x5, notifications/initialized x5, tools/call x5
legacy clients    : legacy-dashboard@0.9.4
modern clients    : modern-agent@2.1.0
auth DCR          : 2 attempts (1 success, 1 failure)
auth CIMD         : 3 attempts (2 success, 1 failure)

recommendation    : keep_both

A legacy client completed an operation. Keep the fallback and check next week.
Ask these clients to upgrade: legacy-dashboard@0.9.4.

pnpm traffic 发送五个旧版客户端和三个现代客户端,这是 Kent 在规范发布几周后描述的混合情况。每个客户端为其一次调用重连,因此请求行显示 15 对 6。报告点名了 legacy-dashboard@0.9.4,所以你知道该给谁发邮件。

策略

默认值:七天窗口,七个活跃流量日,100 次已完成操作。

证据

判定

无操作

no_traffic

一个或多个旧版操作

keep_both

零旧版操作,样本低于守卫

collect_more_data

零旧版操作,两个守卫均通过

safe_to_plan_removal

recommend() 在出现一次旧版操作后返回 keep_both,即使面对两百次现代操作也是如此。那次调用仍然属于某个客户端。现代流量并不能告诉你是否还有人需要旧路径。

弃用窗口

已弃用功能注册表 将 DCR、roots、sampling 和 logging 列为在 2026-07-28 中已弃用。最早移除时间是 2027-07-28 或之后的第一个修订版。一份干净的本地报告不会改变该日期。遵循规范的客户端仍然拥有承诺的窗口。

询问你的代理

保持收集器和服务器运行。.mcp.jsonautotel 指向 http://127.0.0.1:3000/mcp,将 migration 指向 http://127.0.0.1:8787/mcpmigrationStatus 读取持久化窗口。

在 autotel 中列出 mcp.protocol.lane.operations,并比较 lane=legacylane=modern 系列。在迁移服务器上调用 migrationStatus。我们能否移除 2025-11-25 回退路径?引用操作计数、活跃天数和策略守卫。

每周在 cron 中运行该提示,你就能得到 Kent 的答案。

信号

信号

存储

用途

mcp.protocol.lane.requests

OTLP

请求量,每个 lanemcp_method 一个系列

mcp.protocol.lane.operations

OTLP

可比较的操作,每个 lane 一个系列

mcp.auth.registration.attempts

OTLP

DCR 和 CIMD 尝试,每个 modeoutcome 一个系列

mcp.protocol.legacy.days_since_last_operation

OTLP

旧通道的静默天数,从未运行时为 -1

.data/migration-evidence.db

SQLite

报告窗口、客户端名称,跨重启保留

list_metrics 为每个属性集返回一个系列,因此代理按 lane 分组。你需要 autotel-mcp 0.5.1 或更新版本,才能让这些属性在摄取后保留。

Kent 平均每个用户有 125 次 DCR 注册,因为每次重连都会写入另一条记录。CIMD 客户端则不会写入任何记录。对两种模式都进行计数,你就能看到 DCR 何时变得安静。

要复制的决策

先统计量,再测量静默。 读取计数器以了解到达了多少旧版流量。你需要最后一次到达来决定是否移除。mcp.protocol.legacy.days_since_last_operation 在收集器抓取时读取账本,因此你不会在请求路径上重新计算它。当该仪表超过 30 时发出警报。

将方法名放在指标上。将客户端名称放在账本中。 mcp_method 是一个标签,因此每个新值都会创建另一个系列,而未认证的调用者可以选择该值。factory.ts 中的 STANDARD_METHODS 是一个允许列表:任何无法识别的值都记录为 unknown。客户端名称没有边界,因此它们进入 SQLite。多一个名称只多一行。

保留两个守卫。 最小样本量防止你在一个安静的下午批准移除。最小活跃天数防止你在一个错过了每周批处理作业的繁忙星期二批准移除。

无会话地服务两个时代。 createMcpHandlerlegacy: 'stateless' 运行。一个工厂服务两个时代,ctx.era 命名通道。任何实例都可以回答任何请求,因此你编写计数器。你不需要会话表或粘性路由。有状态的回退路径会让你对会话进行插桩。报告随后将依赖于负载均衡器。

每个时代的客户端名称

现代请求会命名其调用者。旧版请求只在 initialize 期间命名一次调用者。

旧版(2025-11-25 及更早)

现代(2026-07-28

方法名

JSON-RPC 正文

MCP-Method

clientInfo

initialize

每个请求的 _meta

现代信封在每个请求的 params._meta 中重复 clientInfo,因此任何实例都可以服务它。旧版通道将名称放在握手上。无状态服务器没有地方为后续的工具调用保留它。factory.ts 读取两者。报告可以点名 legacy-dashboard@0.9.4,因为该名称是在 initialize 时到达的,而不是在被计数的工具调用上。

你可以在 MCP-Method 上路由网关,因为请求描述了自身。你也因此可以在没有会话的情况下归因流量。

activeDays 按 UTC 日期分桶,因此用户在美国晚上工作的客户端可能会落入两个桶。认证路由写入 DCR 和 CIMD 尝试。它们不铸造令牌,也不获取 CIMD 文档。

配置

变量

效果

MIGRATION_EVIDENCE_PATH

账本位置

MIGRATION_WINDOW_DAYS

报告窗口

MIGRATION_RETENTION_DAYS

账本保留期

MIGRATION_MIN_OPERATIONS

样本量守卫

MIGRATION_MIN_ACTIVE_DAYS

活跃天数守卫

GET /metrics/lanes?windowDays=30 接受相同的窗口,最长 90 天。

要查看账本在重启后存活:运行流量,停止服务器,再次启动,运行 pnpm report。计数仍然存在。

pnpm collector 将遥测数据保留在 autotel.db 中 30 天。服务器将证据保留在 .data/migration-evidence.db 中 90 天。Git 忽略两者。

双时代服务器

服务器是双时代的,因为 createMcpHandlerlegacy: 'stateless' 运行,而 ctx.era 命名你计数的通道。有关 2026-07-28 变更集的其余部分,请参阅变更日志

autotel-mcp-instrumentation 在两侧添加跨度(spans)和持续时间直方图。你从计数器和账本回答移除问题。

代码地图

文件

职责

src/server/factory.ts

双时代工具;读取每个请求的时代、方法和客户端

src/server/serve.ts

解析一次正文,与工厂共享

src/telemetry/legacy-metrics.ts

OTel 计数器和窗口化快照

src/telemetry/evidence-store.ts

索引化 SQLite 账本,以及用于测试的内存存储

src/report/recommend.ts

守卫和报告副本

src/server/oauth-routes.ts

DCR 和 CIMD 尝试证据

src/proof/autotel-proof.ts

从 OTLP 读回通道系列

src/client/generate-traffic.ts

两个命名客户端,每条通道一个

验证

pnpm typecheck
pnpm test

十三个测试覆盖了比例偏差、窗口过滤、重启持久性、认证结果、客户端归因、旧版方法计数以及两个移除守卫。

A
license - permissive license
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 Servers

  • A
    license
    Not graded
    quality
    B
    maintenance
    Provides comprehensive monitoring and observability for MCP server ecosystems with real-time health checks, performance metrics, distributed tracing, anomaly detection, and automated performance reports using OpenTelemetry and Prometheus.
    1
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    A Python utility for adding usage tracking, analytics, and audit trails to MCP servers using SQLite-backed persistence. It enables developers to monitor tool, prompt, and resource activity and expose these statistics directly to LLM clients.
    4
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Transparent MCP proxy with OpenTelemetry tracing. Wrap any MCP server, persist traces to SQLite · Postgres · MySQL. No code changes needed.
    2
    33
    11
    Apache 2.0
  • A
    license
    Not graded
    quality
    C
    maintenance
    MCP-native health monitoring that probes MCP servers using the list_tools protocol handshake, detects version drift, stores history in SQLite, and generates an HTML dashboard.
    43
    MIT

View all related MCP servers

Related MCP Connectors

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/jagreehal/mcp-legacy-lane'

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