The official Ruby SDK for the Model Context Protocol servers and clients.
Repo modelcontextprotocol/ruby-sdk, read from GitHub 1 min ago. modelcontextprotocol has not joined Take My Repo.
This release lets the Streamable HTTP transport resume the SSE streams of the handshake lifecycle (SEP-1699): given an event_store:, it gives each event an id, and a client that reconnects with Last-Event-ID receives the events it missed, including the remaining notifications and the response of a request still running. A handler can close its connection with server_context.close_sse_stream so a long operation does not hold one open. The SDK defines the store contract, and examples/in_memory_event_store.rb is one to copy.
Last-Event-ID in the Streamable HTTP transport (#681)Origin with allowed_origins: :any and keep the Host check (#685)localhost for the URLs Protected Resource Metadata publishes (#683)resources/read (#687)This release validates the Mcp-Param-* headers of a tool call against its body (SEP-2243) and adds an optional issuer: to
the machine-to-machine OAuth providers. The Changed entries alter defaults under the exceptions described in VERSIONING.md: the stdio client passes the server process a reduced environment, a stalled SSE stream is closed after stream_write_timeout: seconds, and an elicitation reply that does not match its schema raises.
Mcp-Param-* headers against the tool call body (#654)issuer: to machine-to-machine providers (#674)MCP::ServerContext from the gem entry point (#656)max_message_bytes to remaining HTTP client responses (#673)base64 in the OAuth client (#678)This release adds the Skills extension (SEP-2640): a server publishes Agent Skills from a directory or a handler, and the client lists, reads and verifies them against the manifest digests. It also keeps a tool's _meta and other members on the client, stops the output schema default from overriding a root $dynamicRef, and answers request headers and _meta values the server could not read with a client error instead of failing. The Changed entry alters an answer on the wire under the exceptions described in VERSIONING.md.
_meta that is not an object as invalid params (#651)_meta, title, icons, and execution on the client (#641)$dynamicRef when defaulting an output schema to an object (#649)_meta that is not an object without raising (#650)This release finishes the encoding fixes of 1.8.1 on the client and the HTTP transport, which no longer fail a request or a stream on a frame or a reply they cannot encode. The Changed entry alters what
a subscriptions/listen stream honors under the exceptions described in VERSIONING.md: a resources_subscribe_handler that raises for a URI now narrows the acknowledgement, and the handler runs for listen streams without a matching resources_unsubscribe_handler call.
resources_subscribe_handler for the resource URIs of a subscriptions/listen stream (#632)This release brings the server's JSON-RPC framing and capability advertisement, and the HTTP client's handling of an initialize answered over SSE, in line with the MCP specification. The Changed entries alter answers on the wire, as fixes of incorrect conformance under the exceptions described in VERSIONING.md. Only senders of null ids and client code that read the error event of a 4xx or 5xx SSE answer, which the client now raises as RequestHandlerError, have to change. A stdio server also survives a frame it cannot strip, parse or answer.
initialize as soon as its SSE response arrives and raise on an error-status SSE answer in the HTTP client (#617)listChanged and subscribe out of a stateless server's initialize result (#620)Accept header (#616)StdioTransport (#621)This release adds OAuth 2.1 resource server support to StreamableHTTPTransport: bearer tokens are verified
by a JWT or an RFC 7662 introspection verifier (or one of your own), requests without a valid token get RFC 6750
challenges, and a Rack middleware serves the RFC 9728 Protected Resource Metadata document; token issuance stays
with an external authorization server.
The bundled client transports now reject server messages that are not JSON-RPC 2.0, which rejects what earlier
releases accepted and ships in a minor release under the exceptions described in VERSIONING.md:
a server whose responses lack "jsonrpc": "2.0" has to send the member, since there is no opt-out.
Authorization header from the errors the HTTP transport retains (#591)subscriptions/listen teardown on transport close (#595)subscriptions/listen stream only from the path that removed its entry (#596)