Skip to content

feat(mcp): inbound request handler registry (sampling/roots/elicitation) #82

Description

@Svagtlys

Description

Handle inbound server→client JSON-RPC requests (sampling, roots, elicitation) via a pluggable handler registry on McpClient. Today the SDK answers these itself (unset callbacks → JSON-RPC error response); the seam is pinned by test_inbound_request_rejected_with_method_not_found.

Why

MCP servers use sampling/createMessage to ask the client to run inference, roots/list to scope file access, and elicitation to request user input. Octave's agent flows (prompt assembly, permission scoping) need to answer these instead of erroring.

Scope

  • Registry API on McpClient (e.g. on_sampling(...)/on_roots(...) callbacks wired into ClientSession kwargs at connect time)
  • Default behavior unchanged: no handler → SDK error response (never silence)
  • Note: SDK 1.30 validates inbound requests against the typed union and answers sampling/createMessage with -32600 via the unset-callback path, not -32601 (see PR feat(mcp): implement MCP client core (JSON-RPC 2.0) #81)
  • Tests over the in-process harness (tests/mcp/conftest.py Peer.send_request)

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions