server/discover is not customizable or host-invokable (no DiscoverHandler option / session Discover API)
维护者通常 1 天内回复
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- go
调研方向
先阅读 server.go、未导出的 Server.discover 实现、serverMethodInfos 以及 dispatch 中的特殊处理,以了解 server/discover 是如何组装的。比较 ServerOptions 和 ServerSession API,然后定义并验证一个受支持的自定义或主机调用扩展点,在保留现有 discover 行为的同时支持租户特定的结果和会话内省。
由索引模型根据 Issue 内容生成。
描述
Use case
We run a multi-tenant MCP gateway (Arcade) on v1.7.0-pre.2, stateless StreamableHTTP, one logical server per gateway. Two things we cannot do today:
- Customize the
server/discoverpayload beyond whatServerOptionsstatics allow (e.g. tenant-specificsupportedVersions, augmenting the result at build time rather than post-hoc). - Invoke discover from the host (for health/introspection: "what would this session advertise right now?") without synthesizing an HTTP request against ourselves.
Current behavior
server/discoveris handled entirely internally: unexportedServer.discover(server.go), registered inserverMethodInfos, special-cased in dispatch. It buildsDiscoverResultfroms.capabilities(),s.impl,s.opts.Instructions, and the session version list.- No
ServerOptionsfield touches discover (checked the full option set on pre.2), and there is no exportedDiscover(...)onServer/ServerSession.
Why middleware isn't a workaround
Receiving middleware can type-assert *DiscoverResult and mutate it post-hoc, keyed off the method string — reactive, fragile, and only for inbound requests. It cannot let the host invoke discover, and it runs strictly after the SDK computed the payload.
Per the maintainers' stance in #565 (keep the API small), the concrete need here is not "export the internals" but a supported seam:
Proposal (either would do)
type ServerOptions struct {
// DiscoverHandler, if non-nil, can augment the server/discover
// response after the SDK builds it.
DiscoverHandler func(context.Context, *DiscoverRequest, *DiscoverResult) (*DiscoverResult, error)
}
or an exported, host-callable form:
func (ss *ServerSession) Discover(ctx context.Context) (*DiscoverResult, error)
Related but distinct: #1034 fixed a discover/initialize parity bug; this asks for a customization/introspection seam.
🐕 Written by Kyoto, an AI agent, on Pascal's behalf —
- 主要语言
- Go
- 星标
- 5.4k
- 派生
- 623
- 平均合并
- 22 小时 10 分钟
- 30 天内合并 PR
- 30
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/go-sdk 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 82/100
modelcontextprotocol/go-sdk#1557 ·
维护者通常 1 天内回复
-
Streamable HTTP (2026-07-28): tools/call with an out-of-range number in arguments fails because extractName decodes Arguments into any可能重新可做 @beiryu 于 10 天前认领,目前没有进行中的 PR。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
modelcontextprotocol/go-sdk#1534 · 1 条评论 ·
维护者通常 1 天内回复
-
Expose generic `SendNotification` on `ServerSession` for custom protocol extensions可能重新可做 关联的 PR 已关闭且未合并。 未关闭needs investigation
难度 2/5 1-3 小时 新手友好度 72/100
modelcontextprotocol/go-sdk#745 · 13 条评论 · 1 个 reaction ·
维护者通常 1 天内回复
-
难度 5/5 一周以上 新手友好度 18/100
modelcontextprotocol/go-sdk#1555 ·
维护者通常 1 天内回复
-
mcp: 2026-07-28 client runs elicitation and sampling handlers for standalone server requests可能重新可做 关联的 PR 已关闭且未合并。 未关闭
难度 3/5 1-2 天 新手友好度 35/100
modelcontextprotocol/go-sdk#1552 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/go-sdk 的全部 Issue
相似的 Issue
-
难度 1/5 1-3 小时 新手友好度 88/100
-
难度 2/5 1-3 小时 新手友好度 70/100
compiler-explorer/compiler-explorer#9738 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 85/100
evilmartians/lefthook#1674 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
维护者通常 1 天内回复