Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Expose generic `SendNotification` on `ServerSession` for custom protocol extensions

未关闭 适合新手
#745 13 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

@ajuijas 已经在做这个了。

开始于 2026年3月15日。

  • #844 来自 @ajuijas —— 未关闭
  • #1146 来自 @delaneyj —— 未关闭

评估

难度
2/5
预计耗时
1-3 小时
新手友好度
72/100
Issue 类型
功能
描述清晰度
基本清楚
活跃度
冷清
技术栈
go

调研方向

从 mcp/server.go 开始,阅读 ServerSession 以及现有的 NotifyProgress 和 Log 辅助函数,然后检查内部 conn.Notify 调用的使用方式。添加 issue 中描述的公开通用通知入口点,并确认调用方可以在不使用 unsafe 或反射的情况下发送诸如 ide/diffAccepted 之类的自定义方法。

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

描述

needs investigation
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/diffAccepted
  • ide/diffRejected
  • ide/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:

  1. The conn field on ServerSession is unexported.
  2. The mcp.Connection interface's Write method 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

环境准备

在 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 摘要。