Last 12 weeks · 98 commits
5 of 6 standards met
Motivation and Context The previous example used directly, which does not control HTTP status codes. Notifications such as require 202 Accepted per the MCP spec, but the example always returned 200. Use instead, which returns the correct HTTP status code for each request type. https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#sending-messages-to-the-server https://modelcontextprotocol.io/specification/2025-11-25/basic/transports#sending-messages-to-the-server Closes #158 Types of changes [ ] Bug fix (non-breaking change which fixes an issue) [ ] New feature (non-breaking change which adds functionality) [ ] Breaking change (fix or feature that would cause existing functionality to change) [x] Documentation update Checklist [x] I have read the MCP Documentation [x] My code follows the repository's style guidelines [x] New and existing tests pass locally [x] I have added appropriate error handling [x] I have added or updated documentation as needed
Summary This PR adds native support for the MCP protocol's parameter, eliminating the need for manual extraction in controllers. Background The MCP specification defines a field that allows clients to pass request-specific metadata. Previously, Ruby SDK users had to manually extract this field from request parameters. Changes Automatic extraction: The server now automatically extracts from request parameters in and methods Nested structure: is passed as a nested field within (accessible via ) Compatibility: This implementation matches the TypeScript and Python SDKs, which also nest within the context Efficient context creation: Context is only created when there's either or present Testing Added comprehensive tests for extraction and nesting behavior All tests pass with the new implementation Provider-agnostic test examples (no vendor-specific references) Documentation Updated README with usage examples Added link to official MCP specification Included both access patterns and client request examples Usage Example Breaking Changes None - this is backwards compatible. Tools that don't use or don't access will continue to work unchanged. Notes While implementing this feature, we discovered that the README incorrectly states that server_context is passed to exception and instrumentation callbacks, though the actual implementation only passes contextual error information to these callbacks.
Repository: modelcontextprotocol/ruby-sdk. Description: The official Ruby SDK for the Model Context Protocol. Stars: 744, Forks: 99. Primary language: Ruby. Languages: Ruby (98.9%), Shell (1.1%). Homepage: https://rubygems.org/gems/mcp Latest release: v0.8.0 (2d ago). Open PRs: 6, open issues: 7. Last activity: 1d ago. Community health: 87%. Top contributors: koic, topherbullock, atesgoral, kfischer-okarin, Ginja, dak2, sambostock, andyw8, tylerrowsell, jcat4 and others.
make the Streamable HTTP a bit more out-of-the back Rack startable than it is now... which probably just means: exposing a way to add middlewares adding an option for the endpoint name (/mcp by default) ...? _Originally posted by @kfischer-okarin in https://github.com/modelcontextprotocol/ruby-sdk/pull/33#discussion_r2142858840_