Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đang mở Phù hợp với người mới
#745 13 bình luận 1 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

@ajuijas đang làm issue này rồi.

Từ ngày 15/3/2026.

  • #844 của @ajuijas — đang mở
  • #1146 của @delaneyj — đang mở

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
72/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Công nghệ
go
Lĩnh vực
api, backend-api-design

Hướng nghiên cứu

Bắt đầu trong mcp/server.go bằng cách đọc ServerSession cùng các helper NotifyProgress và Log hiện có, sau đó kiểm tra cách lời gọi conn.Notify nội bộ được sử dụng. Thêm entry point công khai, generic cho notification được mô tả trong issue, và xác nhận rằng các caller có thể gửi các method tùy chỉnh như ide/diffAccepted mà không cần unsafe hoặc reflection.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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.

Ngôn ngữ chính
Go
Star
5.2k
Fork
568
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
36

Chuẩn bị môi trường

Mở trong Codespaces

Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của modelcontextprotocol/go-sdk

Tất cả issue của modelcontextprotocol/go-sdk

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.