Koichi ITO
cbb81a836c
Add Content::Audio class for audio content type
...
The MCP spec defines an audio content type, but the SDK only had
`Content::Text` and `Content::Image`. Add `Content::Audio` with the
same structure as `Content::Image`.
https://modelcontextprotocol.io/specification/2025-11-25/server/tools#audio-content
2026-03-01 17:30:17 +09:00
Koichi ITO
76ab822ad7
Merge pull request #245 from koic/fix_sse_response_status
...
Return 202 Accepted for SSE responses per MCP spec
2026-03-01 17:17:26 +09:00
Koichi ITO
145dc1f2c5
Merge pull request #242 from koic/support_ref_in_tool_schema
...
Allow `$ref` in `Tool::Schema` for protocol version 2025-11-25
2026-03-01 17:16:47 +09:00
Koichi ITO
c62902b1e8
Merge pull request #241 from koic/fix_content_image_to_h
...
Fix `Content::Image#to_h` to return `mimeType` (camelCase) per MCP spec
2026-03-01 17:16:25 +09:00
Koichi ITO
a02a4572c4
Return 202 Accepted for SSE responses per MCP spec
...
`StreamableHTTPTransport#send_response_to_stream` returned 200 with
`{ accepted: true }` body, but the MCP spec requires 202 with empty body
when a response is sent via SSE stream. This has been a requirement since
Streamable HTTP was introduced in protocol version 2025-03-26.
- 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
2026-02-28 17:59:54 +09:00
Koichi ITO
99cbefc610
Allow $ref in Tool::Schema for protocol version 2025-11-25
...
`Tool::Schema` rejected `$ref` with an `ArgumentError`.
Earlier MCP spec versions (2024-11-05 through 2025-06-18) did not define
a JSON Schema dialect or reference the `$ref` keyword. `inputSchema` was described
only as "JSON Schema defining expected parameters" with no further constraints:
- https://modelcontextprotocol.io/specification/2024-11-05/server/tools
- https://modelcontextprotocol.io/specification/2025-06-18/server/tools
The MCP spec 2025-11-25 introduced a "JSON Schema Usage" section that adopts
JSON Schema 2020-12 as the default dialect. Since `$ref` is a core keyword in 2020-12,
it is now allowed for protocol version 2025-11-25 and later.
- https://modelcontextprotocol.io/specification/2025-11-25/basic#json-schema-usage
- https://modelcontextprotocol.io/specification/2025-11-25/server/tools
- https://json-schema.org/draft/2020-12/release-notes
For backward compatibility with older protocol versions (2025-06-18 and earlier),
`Server#validate!` continues to raise `ArgumentError` when a tool input schema contains `$ref`.
This preserves the existing behavior for servers targeting those spec versions.
2026-02-27 14:33:36 +09:00
Koichi ITO
37563e59bd
Fix Content::Image#to_h to return mimeType (camelCase) per MCP spec
...
This is a fix for a similar bug that remained, as in #235 .
`Content::Image#to_h` returned `mime_type` (snake_case), but the MCP spec
requires `mimeType` (camelCase) for the MIME type field in image content.
2026-02-27 12:51:38 +09:00
Koichi ITO
5b04089e06
Merge pull request #236 from koic/release_0_7_1
...
v0.7.1
Release 0.7.1
2026-02-21 11:15:14 +09:00
Koichi ITO
4af216fa32
Release 0.7.1
...
This is a release that includes several bug fixes.
2026-02-21 03:33:28 +09:00
Koichi ITO
a05da399ba
Merge pull request #235 from koic/fix_property_field_names_in_resource_contents
...
Fix `Resource::Contents#to_h` to use correct property names per MCP spec
2026-02-20 11:51:34 +09:00
Koichi ITO
c8a68da37b
Merge pull request #231 from koic/return_json_rpc_protocol_errors_for_unknown_tool_calls
...
Return JSON-RPC protocol errors for unknown tool calls
2026-02-20 11:51:16 +09:00
Koichi ITO
08832c6b43
Fix Resource::Contents#to_h to use correct property names per MCP spec
...
This PR fixes thr following fields with the MCP specification which requires:
- Text resources use `text` and `mimeType` fields
- Binary resources use `blob` (base64-encoded) and `mimeType` fields
https://modelcontextprotocol.io/specification/2025-11-25/server/resources#resource-contents
Fixes #234 .
2026-02-19 13:50:10 +09:00
Den Delimarsky
6df8e4c74c
Add SECURITY.md with GitHub Security Advisories guidance ( #232 )
2026-02-18 20:49:17 -05:00
Koichi ITO
15710ef0aa
Return JSON-RPC protocol errors for unknown tool calls
...
Per the MCP specification, an unknown tool call is a protocol-level error, not a tool execution error.
Return JSON-RPC -32602 (Invalid params) instead of successful responses with `isError: true`.
https://modelcontextprotocol.io/specification/2025-11-25/server/tools#error-handling
Fixes #228 .
2026-02-19 02:53:39 +09:00
Koichi ITO
b8f1cc92e6
Merge pull request #230 from koic/fix_logging_set_level
...
Fix `logging/setLevel` to return empty hash per MCP specification
2026-02-19 02:52:51 +09:00
Koichi ITO
34b7c68b5a
Merge pull request #219 from koic/acknowledge_shopify_in_the_initial_release
...
[Doc] Acknowledge Shopify in the initial release
2026-02-17 12:40:08 +09:00
Koichi ITO
4dc2a8eb4a
Fix logging/setLevel to return empty hash per MCP specification
...
This PR fixes `logging/setLevel` to return empty hash per MCP specification.
The MCP specification requires `logging/setLevel` to return an empty result
on success, not nil or the `LoggingMessageNotification` object.
Specification reference:
https://modelcontextprotocol.io/specification/2025-11-25/server/utilities/logging
Fixes #229 .
2026-02-17 01:00:15 +09:00
Koichi ITO
2b790d6804
Merge pull request #227 from koic/release_0_7_0
...
v0.7.0
Release 0.7.0
2026-02-14 15:44:43 +09:00
Koichi ITO
0175fff4dd
Release 0.7.0
...
Some new features and fixes have been added, and it seems like a good time to cut a release.
- https://github.com/modelcontextprotocol/ruby-sdk/pull/103
- https://github.com/modelcontextprotocol/ruby-sdk/pull/223
- https://github.com/modelcontextprotocol/ruby-sdk/pull/218
- https://github.com/modelcontextprotocol/ruby-sdk/pull/221
- https://github.com/modelcontextprotocol/ruby-sdk/pull/225
- https://github.com/modelcontextprotocol/ruby-sdk/pull/224
- https://github.com/modelcontextprotocol/ruby-sdk/pull/220
For now, the features completed so far can be included in this release,
and subsequent feature proposals can continue to be incorporated into future releases.
2026-02-14 10:07:07 +09:00
Koichi ITO
c11393f4c4
Merge pull request #224 from koic/extract_annotations_from_mcp
...
Extract `MCP::Annotations` into a dedicated file
2026-02-10 02:30:42 +09:00
Koichi ITO
1a2750d6d7
Merge pull request #222 from koic/update_readme_for_instrumentation_callback
...
[Doc] Add `tool_arguments` to instrumentation callback documentation
2026-02-09 00:48:46 +09:00
Koichi ITO
ebd658d50d
Merge pull request #226 from sjrct/remove-unused-require
...
Remove unused require from logging_message_notification.rb
2026-02-07 02:59:16 +09:00
Koichi ITO
0e30dff80b
Merge pull request #225 from sjrct/add-client-resource-templates
...
Add resource_templates to MCP::Client
2026-02-07 02:58:52 +09:00
Chris Harding
d0107c304a
logging_message_notification: Remove unused require
2026-02-05 16:05:08 -05:00
Chris Harding
c145fe39df
Add resource_templates to MCP::Client
...
Includes relevant README addition and tests
2026-02-05 16:02:07 -05:00
Koichi ITO
15ef5ebda2
Merge pull request #223 from chattermill/md-protocol-negotiation
...
Add protocol version negotiation to server initialization
2026-02-06 00:11:28 +09:00
Mikhail Dubov
077a5cf15a
Add protocol version negotiation to server initialization
...
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-05 10:43:59 +00:00
Koichi ITO
4a71fa8ec4
Merge pull request #221 from chattermill/md-client-instrumentation
...
Add client info to instrumentation callback
2026-02-05 11:28:14 +09:00
Mikhail Dubov
2d926ab386
Add client info to instrumentation callback
2026-02-04 12:03:03 +00:00
Koichi ITO
248c1ec532
Merge pull request #220 from koic/fix_resource_embedded_not_setting_resource_in_initialize
...
Fix `Resource::Embedded` not setting `@resource` in `initialize`
2026-02-04 10:58:49 +09:00
Koichi ITO
a85fa028f7
Extract MCP::Annotations into a dedicated file
...
This PR moves `MCP::Annotations` from lib/mcp.rb to lib/mcp/annotations.rb for better organization,
following the pattern used for other classes such as `Tool::Annotations`.
This PR also adds the missing `last_modified` attribute to `MCP::Annotations`:
https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/schema/2025-11-25/schema.ts#L1701-L1736
It also adds a `to_h` method for serialization and includes comprehensive test coverage.
NOTE: This code is unused within the ruby-sdk repository, but it is kept for compatibility, as it may be used by users.
2026-02-03 15:38:04 +09:00
Koichi ITO
1c449ae549
[Doc] Add tool_arguments to instrumentation callback documentation
...
Follow-up to #218 , which added the `tool_arguments` feature to the instrumentation callback.
This updates README.md to document the new `tool_arguments` key in both instrumentation callback sections,
and removes redundant instrumentation documentation.
2026-01-31 15:47:56 +09:00
Koichi ITO
0ab77c318f
Merge pull request #103 from dak2/support-logging
...
Add `logging` support
2026-01-30 12:29:29 +09:00
dak2
afa2fb4077
Add logging support
...
A server can send structured logging messages to the client.
https://modelcontextprotocol.io/specification/2025-06-18/server/utilities/logging#logging
Logging was specified in the 2024-11-05 specification, but since it was not supported in ruby-sdk, I implemented it.
https://modelcontextprotocol.io/specification/2024-11-05/server/utilities/logging
I also made it possible to output a simple notification message in the examples.
2026-01-26 22:23:46 +09:00
Koichi ITO
05c0119e53
Fix Resource::Embedded not setting @resource in initialize
...
The `initialize` method was missing the assignment of `@resource`,
causing the resource method to always return `nil` and `to_h` to return
an incorrect hash with an empty resource value.
Added comprehensive tests to verify the fix and prevent regression.
2026-01-26 11:37:33 +09:00
Koichi ITO
5331c237bd
[Doc] Acknowledge Shopify in the initial release
...
The repository's "About" section currently states,
"The official Ruby SDK for the Model Context Protocol. Maintained in collaboration with Shopify."
However, now that MCP governance has been established, maintenance is handled by the MCP steering group.
Given this, it seems more accurate to remove the maintenance wording from the "About" section.
That said, I think it would be good to preserve acknowledgment of Shopify, which originally developed and released the Ruby SDK.
There may be a more appropriate place for this, but at the very least, it could be recorded in the changelog as part of the project's history.
2026-01-25 16:11:27 +09:00
Koichi ITO
3addc525df
Merge pull request #218 from chattermill/add-tool-arguments-to-instrumentation
...
Add Tool Arguments to Instrumentation Data
2026-01-23 01:11:28 +09:00
Mikhail Dubov
7412197e52
feat: add tool_arguments to instrumentation data
...
Include the tool arguments in instrumentation callback data when
tools/call is invoked. This allows consumers to track which arguments
were passed to each tool call for analytics and debugging purposes.
2026-01-21 17:18:28 +00:00
Koichi ITO
830913be5a
Merge pull request #214 from koic/add_explicit_permissions_to_ci_workflow
...
Add explicit permissions to CI workflow
2026-01-21 02:12:47 +09:00
Koichi ITO
ade3d1fa80
Merge pull request #216 from koic/release_0_6_0
...
v0.6.0
Release 0.6.0
2026-01-16 15:31:38 +09:00
Koichi ITO
c4fd83debf
Release 0.6.0
...
This would have been 0.5.1 release with only the fix from #212 , but it has been released as 0.6.0
because it also includes the license change in #213 .
2026-01-16 14:58:48 +09:00
Koichi ITO
7bef102224
Merge pull request #212 from koic/omit_icons_from_response_when_empty_or_nil
...
Omit `icons` from responses when empty or nil
2026-01-15 08:53:14 +09:00
Koichi ITO
27e5dc9c80
Merge pull request #213 from modelcontextprotocol/chore/apache-2.0-license
...
chore: update licensing to Apache 2.0 for new contributions
2026-01-14 01:04:45 +09:00
Adam Jones
685a4913d4
chore: update licensing to Apache 2.0 for new contributions
2026-01-12 22:49:19 +00:00
Koichi ITO
e484029d53
Add explicit permissions to CI workflow
...
Set minimal `contents: read` permission following the principle of least privilege.
This prevents using overly permissive repository defaults.
2026-01-13 03:06:05 +09:00
Koichi ITO
bd416c7a5f
Omit icons from responses when empty or nil
...
Previously, the `icons` parameter was always included in responses (as an empty array)
even when not configured. This differs from the response representation in MCP Ruby SDK 0.4.0.
Since `icons` is optional, it should be omitted from responses when unused to reduce
unnecessary context window usage.
https://modelcontextprotocol.io/specification/2025-11-25/schema#implementation
This fix applies to `Tool#to_h`, `Prompt#to_h`, `Resource#to_h`, `ResourceTemplate#to_h`,
and `Server#server_info`.
It doesn't seem critical, but if there are no other issues, it would be good to cut 0.5.1 bugfix release soon.
2026-01-12 09:46:45 +09:00
Koichi ITO
fd1d7a61ec
Merge pull request #211 from koic/release_0_5_0
...
v0.5.0
Release 0.5.0
2026-01-11 12:27:34 +09:00
Koichi ITO
7a21bbd14b
Release 0.5.0
...
Many new features and fixes have been added, and it seems like a good time to cut a release.
This release enables the following user feedback to be addressed:
* https://github.com/modelcontextprotocol/ruby-sdk/issues/99#issuecomment-3667416303
* https://github.com/modelcontextprotocol/ruby-sdk/pull/206#issuecomment-3717086100
For now, the features completed so far can be included in this release,
and subsequent feature proposals can continue to be incorporated into future releases.
2026-01-11 03:37:34 +09:00
Koichi ITO
6b18ca41be
Merge pull request #209 from koic/avoid_redos_in_ruby_3_1_and_earlier
...
Fix ReDoS vulnerability in `StringUtils#underscore`
2026-01-10 01:16:27 +09:00
Koichi ITO
248b4d2dad
Fix ReDoS vulnerability in StringUtils#underscore
...
## Summary
Replace regex patterns with lookahead/lookbehind assertions to prevent
catastrophic backtracking on Ruby 3.1 and earlier.
This issue only affects Ruby 3.1 and earlier. Since it does not occur on Ruby 3.2+,
it is not an issue in the current stable release (0.4.0), which does not include #206 .
## Regression Testing
Ensure the regex patterns complete within 1 second for a 50,000-character input
that would otherwise trigger superlinear backtracking.
2026-01-09 01:14:52 +09:00