Skip to content

Conversation

@slimslenderslacks
Copy link
Contributor

mcp: make handleNotify function public

When implementing an MCP proxy use case, the implementations of ResourceListChangedHandler, ToolListChangeHandler, or PromptListChangeHandler are simpler if these handlers can re-use this function from the mcp package. For example, to forward ToolListChangeRequests from a ClientSession to a ServerSession, a simple handler could be written like this:

    ToolListChangedHandler: func(ctx context.Context, req *mcp.ToolListChangedRequest) {
        _ = mcp.HandleNotify(ctx, "notifications/tools/list_changed", newServerRequest(serverSession, req.Params))
    }

Alternatively, since NotifyProgress, Log, Elicit, and ResourceUpdated are on the ServerSession or Session, should an analogous Notify be available on ServerSession?

@jba
Copy link
Contributor

jba commented Aug 25, 2025

We've never thought about a case where an MCP client is a proxy to an MCP server. I suspect other things would have to be different as well. Also, handleNotify has a low-level API (it requires the name of the JSON-RPC method, for example). We can probably support this use case better.

Please open a proposal; I think we are some distance from accepting PRs on this topic.
I am going to gently close this. We can re-open it if we decide to go this way.

@jba jba closed this Aug 25, 2025
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.

2 participants