-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Custom MCP requests + hooks #535
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Hey @cmrfrd, love the work here - I think extending the spec is going to be super valuable, and we should make it easy to do in the sdks. However - with the current implementation here it looks like all custom requests will have the jsonrpc method For example, in the listed version over the wire we get:
But ideally we'd have:
I think we'd need some significant work on this sdk to make this easy to do :/ |
hello, any progress here? This feature is really important. |
Allow users to opt-in to defining custom message types for MCP and server/client side hooks for how to process them.
Motivation and Context
This change allows users to define their own opt-in sub-protocols extending MCP to fit their needs outside the specification. With custom messages, users don't need to fork the MCP sdk's in order to extend the protocol.
Our specific use case for is so we can define sub-protocols for sensitive data transfer (ex: payment information, PII, credentials, etc.) but there are other users that may want to implement their own systems.
How Has This Been Tested?
See
examples/custom_requests
or updated readme.Breaking Changes
This feature is opt-in via
experimental_capabilities
and won't break existing code / configs.Types of changes
Checklist
Additional context
This PR only applies to the python sdk, so in order to provide this to MCP as a whole, we would need similar PR's for the other MCP sdk's. Consider this implementation a POC, and we can replicate this approach across the other sdks's.