Skip to content
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

Implement "roots" capability support + extract some shared logic #21

Merged
merged 7 commits into from
Mar 31, 2025

Conversation

jakemac53
Copy link
Contributor

@jakemac53 jakemac53 commented Mar 31, 2025

See https://spec.modelcontextprotocol.io/specification/2025-03-26/client/roots/

Refactor details

  • Added the MCPBase class now that both clients and servers can handle requests, and deal with progress notifications for those, etc.
    • Hides the _peer from the other classes, exposing instead its own registerMethodHandler and registerNotificationHandler, sendRequest and sendNotification.
  • The MCPClient class also now has a similar mixin pattern to the MCPServer class, with RootsSupport being the first one.
  • Added an initialize lifecycle method for clients, which is called in the base class constructor. This allows mixins to run code on construction of the object - specifically this is useful for updating the capabilities object for the client, which must be done prior to connecting to any servers.

@jakemac53 jakemac53 merged commit 4a91dc9 into main Mar 31, 2025
6 checks passed
@jakemac53 jakemac53 deleted the roots branch March 31, 2025 19:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants