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

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
12/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
活跃
技术栈
nodejs, typescript

调研方向

This is a tracking issue, not a single task: the table lists gaps in packages/core-internal/src/shared/extensions.ts (ctx.require at line 161, setup at line 85, method conflicts at line 184, use at line 149), packages/server/src/server/extension.ts (line 60) and protocol.ts (line 252), plus docs/advanced/extensions.md. Start by reading extensions.ts and the docs page, then check the conformance fixtures in test/conformance/src. Done would mean the maintainers have agreed on an API design for notification and sending-direction middleware and a fix for each Partial or Gap row, which needs a design decision first.

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

描述

v2

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 #2820, whose description already lists the first two gaps.

Where main stands

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

Already met: extension registration with duplicate-id rejection, capability declaration, custom requests, cleanup, and a documented deterministic middleware order.

Area Status Detail
Dependencies Partial ctx.require(extensionId) is order-independent and names both extensions; there is no way to depend on a core capability such as resources. extensions.ts:161
Lifecycle Partial A failed setup fails construction or connect; there is no API listing the installed extension ids. extensions.ts:85
Custom notifications Partial Validated setNotificationHandler and notification() exist on Server and Client, but neither extension context has a notification member, so extensions use the unchecked general API. extension.ts:60
Method conflicts Partial The extension path rejects core names and already-handled request names; it has no notification registration, so notification names are not checked. extensions.ts:184
Middleware coverage Partial use() / ctx.use wrap incoming requests only, one exact method each. No middleware for notifications, outgoing requests or their responses, and use throws for subscriptions/listen on a server. extensions.ts:149
Middleware abilities Partial Incoming-request middleware can act before and after, return early, and replace the request or result; notifications cannot be forwarded or suppressed. protocol.ts:252
Streams Gap Middleware is request-to-result with no per-message hook; progress notifications and subscriptions/listen bypass it. extensions.md:136
Documentation Partial One extensions page is linked from the docs nav; nothing in docs/ or the README states that the SDK implements SEP-3371 per role. extensions.md:5
Stability Gap extensions, the extension shapes and contexts, use and acceptResultType are marked experimental ("may change in a minor release"). The SEP requires the SDK's normal stability policy. extensions.md:8
Packaging docs (SHOULD) Partial Exporting and enabling an extension is shown; declaring SDK compatibility is not covered. extensions.md:34
Main gaps
  1. No middleware for notifications or the sending direction, so a client on 2026-07-28 has nothing to wrap.
  2. No per-message middleware for streams (progress, intermediate results, subscriptions/listen).
  3. The extension and middleware APIs are experimental.
  4. No checked notification registration on the extension path, and no core-capability dependencies.
  5. No documented SEP-3371 statement per role.
Not verified
  • Whether application middleware can be placed outside extension middleware (the docs say extension middleware always runs outside it).
  • Preservation of nested _meta through result encoding.
  • Whether custom client-to-server notifications are delivered on 2026-07-28 over HTTP.
Conformance

The conformance approach is proposed in modelcontextprotocol/conformance#606. It would have each SDK's fixtures (test/conformance/src/everythingServer.ts and everythingClient.ts) 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.
  • 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 GitHub Copilot (Claude) at my direction.

主要语言
TypeScript
星标
13.8k
派生
2.5k
平均合并
6 天 23 小时
30 天内合并 PR
2

环境准备

  • 没有 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 阅读贡献指南

从这里开始

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

modelcontextprotocol/typescript-sdk 的其他 Issue

查看 modelcontextprotocol/typescript-sdk 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

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