Expose generic `SendNotification` on `ServerSession` for custom protocol extensions
维护者通常 1 天内回复
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 72/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 冷清
- 技术栈
- go
调研方向
从 mcp/server.go 开始,阅读 ServerSession 以及现有的 NotifyProgress 和 Log 辅助函数,然后检查内部 conn.Notify 调用的使用方式。添加 issue 中描述的公开通用通知入口点,并确认调用方可以在不使用 unsafe 或反射的情况下发送诸如 ide/diffAccepted 之类的自定义方法。
由索引模型根据 Issue 内容生成。
描述
Use Case
I am implementing an MCP Server for the Gemini CLI IDE Integration. The specification requires the server to send custom notifications to the client to signal specific events.
Specifically, I need to send:
ide/diffAcceptedide/diffRejectedide/contextUpdate
The Problem
Currently, the mcp.ServerSession struct only exposes specific notification helpers (like NotifyProgress and Log). There is no public API to send a generic/custom JSON-RPC notification.
I attempted to use session.Notify(ctx, method, params), but:
- The
connfield onServerSessionis unexported. - The
mcp.Connectioninterface'sWritemethod requires*mcp.JSONRPCMessage, which is an unexported struct.
Proposed Solution
Please expose a generic notification method on ServerSession, similar to:
// In mcp/server.go
func (s *ServerSession) SendNotification(ctx context.Context, method string, params any) error {
return s.conn.Notify(ctx, method, params)
}
Current Workaround
I am currently forced to use unsafe and reflect to access the underlying conn field to call its Notify method, which is fragile for obvious reasons.
- 主要语言
- Go
- 星标
- 5.2k
- 派生
- 568
- 平均合并
- 1 天 18 小时
- 30 天内合并 PR
- 36
环境准备
在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
modelcontextprotocol/go-sdk 的其他 Issue
-
Session-lifecycle bookkeeping logs at info, spamming multiple log lines per request on stateless streamable HTTP可能已有人在做 @anneheartrecord 于 41 天前认领。 未关闭P3
难度 2/5 1-3 小时 新手友好度 75/100
modelcontextprotocol/go-sdk#1204 · 1 个 reaction ·
维护者通常 1 天内回复
-
auth: Authorize fails against a 2025-03-26 server whose URL has a query string可能已有人在做 @akshita317 于 1 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 40/100
modelcontextprotocol/go-sdk#1347 ·
维护者通常 1 天内回复
-
P3
难度 4/5 3-5 天 新手友好度 48/100
modelcontextprotocol/go-sdk#1337 · 1 条评论 ·
维护者通常 1 天内回复
-
mcp: Client.Connect never falls back to initialize when a stdio server ignores server/discover可能已有人在做 @crossxr 于 5 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 45/100
modelcontextprotocol/go-sdk#1332 · 3 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 76/100
modelcontextprotocol/go-sdk#1331 · 2 条评论 ·
维护者通常 1 天内回复
查看 modelcontextprotocol/go-sdk 的全部 Issue
相似的 Issue
-
agent-research-recommend agent-review-finding chore
难度 2/5 1-3 小时 新手友好度 78/100
jordansmall/spindrift#4821 · 1 条评论 ·
维护者通常 1 天内回复
-
area:web
难度 2/5 1-3 小时 新手友好度 82/100
praetorianer777/GoTome#178 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100
oracle/go-oracledb#105 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 84/100
-
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复