Track SEP-3371 (consistent SDK extension points): gaps on main

未关闭
#1,555 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
18/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
go
领域
api

调研方向

The gaps are spread across mcp/protocol.go (AddExtension on the capability types), mcp/server.go and mcp/client.go (AddReceivingCustomMethod, AddSendingCustomMethod, CallCustomMethod), and mcp/shared.go (middleware). Read the table and the cited lines first, then check the claims against the code. Done depends on a maintainer choosing the extension-registration API design, which this issue does not settle, so ask for that decision before writing code.

由索引模型根据 Issue 内容生成。

描述

SEP-3371 (Consistent SDK Extension Points) was accepted by Core Maintainer vote on 28 November 2026. I'm the SEP author, and this issue tracks where main stands against it.

The SEP requires Tier 1 SDKs to provide three public extension points for protocol version 2026-07-28 and later: extension registration, custom methods, and JSON-RPC middleware. The API shape is the SDK's choice; only the outcomes are required. It takes effect with the first specification release after the SEP reaches Final.

This follows #954, where the cost of bundling extensions was first discussed.

Where main stands

Based on reading the code at 13d3c71f. Nothing was built or run, so corrections are welcome.

Already met: middleware in both directions and both roles, over one MethodHandler shape that covers requests and notifications; list-changed notifications on subscriptions/listen and progress go through sending middleware one message at a time.

Area Status Detail
Registration Gap No extension type or register-by-identifier API in either role.
Capabilities Partial ClientCapabilities.AddExtension and ServerCapabilities.AddExtension write the map, but as an application step, not part of a registration; a second call with the same id overwrites. protocol.go:594
Dependencies Gap No dependency mechanism.
Lifecycle Gap No list of registered extensions and no all-or-nothing install of an extension's contributions.
Custom requests Partial Typed AddReceivingCustomMethod on the server and AddSendingCustomMethod / CallCustomMethod on the client; no server-to-client custom requests. server.go:2610, client.go:1730
Custom notifications Gap No API found to register or send a custom notification in either role; the only notification handler options are built-in ones such as ProgressNotificationHandler.
Method conflicts Partial Standard method names are rejected; registering the same custom method twice replaces the earlier handler. server.go:2608, client.go:1728
Middleware coverage Met AddSendingMiddleware / AddReceivingMiddleware on Server and Client; notifications are sent through the sending handler. shared.go:112, shared.go:180
Middleware abilities Likely met A Middleware can act before and after, return early and replace params or results. Suppressing a notification (returning without calling next) is not documented.
Streams Partial Each listen notification and each progress notification passes through sending middleware separately. Listen notifications are sent with context.Background(), so middleware cannot tie them to the listen request or its cancellation. server.go:850
Ordering Partial Deterministic and documented in godoc: within one call the first middleware is outermost, and each later call wraps the existing chain. Nothing documents where the SDK's own MRTR middleware sits relative to user middleware. server.go:2095, mrtr.go:138
Documentation Gap No extension-points page. JSON-RPC middleware is described in godoc; in docs/ it appears only for MRTR, and the other middleware there is HTTP. SEP-3371 is not mentioned in the repo.
Packaging docs (SHOULD) Gap None for third-party extensions.
Main gaps
  1. No extension registration: no identifier, duplicate rejection, dependency check, list of registered extensions or all-or-nothing install.
  2. No custom notifications in either role, and no custom requests from server to client.
  3. Duplicate custom method registration replaces instead of failing, so two extensions can silently take one method.
  4. No SEP-3371 statement per role or single extension-points page.
Not verified
  • Whether a sending-middleware error on a listen notification reaches anyone besides the server log.
  • Preservation of unknown and nested _meta keys through Params round trips.
  • Stability: whether the custom-method and middleware APIs carry any experimental marker.
Conformance

The conformance approach is proposed in modelcontextprotocol/conformance#606. It would have the Go conformance fixtures install small synthetic extensions built only on the SDK's public APIs.

What would help
  • Corrections to the table above.
  • A maintainer view on which gaps you would close and how; the SEP leaves the design to each SDK. Middleware is already close, so registration and custom notifications are the main design work.
  • Whether a maintainer has time to work on this with me. I can help with the conformance fixture.

AI assistance: the code read and this write-up were done with Claude at my direction.

主要语言
Go
星标
5.4k
派生
623
平均合并
22 小时 10 分钟
30 天内合并 PR
30

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

modelcontextprotocol/go-sdk 的其他 Issue

查看 modelcontextprotocol/go-sdk 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。