You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
API: declarations prevent subclassing/extending public classes #793
I would like to extend the McpAsyncServer, McpSyncServer and the stateless versions to extend the behavior of these servers via a new MCP extension under development.
Currently, these classes, and a couple of classes that their constructors depend upon (McpServerFeatures.Sync and Async) are package protected meaning that only the code in the sdk can use these constructors, effectively preventing the creation of subclasses.
Environment
version 0.18.0.SNAPSHOT of sdk as of 2/14/2026
Please provide as many details as possible: Spring MCP version, Java version, which vector store you use if any, etc
Expected behavior
Ability to declare subclasses of McpSyncServer, McpAsyncServer, and stateless analogs. Subclass constructors must call the superclass constructor and so currently cannot be from outside of io.modelcontextprotocol package namespace.
Minimal Complete Reproducible example
The follow code will not compile, because the superclass (McpAsyncServer) constructor is package private.
As a rule of thumb, we avoid making our core implementations extensible through subclassing. Instead, we prefer composition, and introducing specific APIs.
Would you be so kind as to open an issue about your specific need, IIRC customizing params in notifications? I think you mentioned notifyToolsListChanged, but this could probably apply to all notifications.
Would you be so kind as to open an issue about your specific need, IIRC customizing params in notifications? I think you mentioned notifyToolsListChanged, but this could probably apply to all notifications.
Activity
Kehrlann commentedon Feb 20, 2026
As I mentioned in #794 :
Would you be so kind as to open an issue about your specific need, IIRC customizing params in notifications? I think you mentioned
notifyToolsListChanged, but this could probably apply to all notifications.scottslewis commentedon Feb 22, 2026
See #831