Skip to content

mcp: Allow registration of custom JSON-RPC methods#956

Open
guglielmo-san wants to merge 5 commits into
mainfrom
guglielmoc/SEP-2133_extensions_framework
Open

mcp: Allow registration of custom JSON-RPC methods#956
guglielmo-san wants to merge 5 commits into
mainfrom
guglielmoc/SEP-2133_extensions_framework

Conversation

@guglielmo-san
Copy link
Copy Markdown
Contributor

@guglielmo-san guglielmo-san commented May 13, 2026

Description

This PR introduces support for custom (non-standard) JSON-RPC methods in the MCP Go SDK.
This feature enables servers to handle arbitrary JSON-RPC methods and clients to invoke them, all while maintaining full type safety and integrating seamlessly with the SDK's existing middleware and session management.

  • Server-Side Registration: Added AddReceivingCustomMethod to allow servers to register handlers for custom methods. Incoming requests are automatically unmarshaled into user-defined parameter structs.
  • Client-Side Calling: Added AddSendingCustomMethod which returns a strongly-typed caller function that clients can use to invoke custom methods and receive strongly-typed results.
  • Helper Structs: Provided ParamsBase and ResultBase for users to embed in their custom structs. This allows them to easily satisfy the SDK's internal Params and Result interfaces.

Fixes #954

@guglielmo-san guglielmo-san marked this pull request as ready for review May 13, 2026 13:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Allow registration of custom JSON-RPC methods

1 participant