Commit graph

183 commits

Author SHA1 Message Date
Koichi ITO
d1ca0cbcfe
Merge pull request #91 from dak2/fix/json-rpc-of-notification
Fix JSON-RPC notification format in Streamable HTTP transport
2025-07-29 02:05:16 +09:00
Ateş Göral
db1ae35cec
Merge pull request #94 from andyw8/andyw8/use-valid-syntax-for-uri-examples
Use valid syntax for URIs in examples and tests
2025-07-27 11:40:14 -04:00
Andy Waite
8b92ce005f Use valid syntax for URI examples 2025-07-27 11:29:03 -04:00
Koichi ITO
52c92c7af5
Merge pull request #96 from dak2/fix/typo
[Doc] Fix a typo in READEME.md
2025-07-27 11:53:22 +09:00
dak2
f6eb5ed785 Fix a typo in READEME.md 2025-07-27 10:34:14 +09:00
dak2
e7fafddf94 Fix JSON-RPC notification format in Streamable HTTP transport
Update send_notification method to properly construct JSON-RPC notification objects with jsonrpc version and method fields.
This ensures notifications conform to the JSON-RPC 2.0 specification when sent over HTTP transport.

https://www.jsonrpc.org/specification#notification

Another goal is to standardise the `send_notification` interface.
Before the revision, it was sufficient to pass the method and parameters in the case of stdio.
However, in the case of Streamable, a hash based on the JSON-RPC specification must be passed.
2025-07-26 17:58:31 +09:00
Koichi ITO
eb6156c272
Merge pull request #89 from andyw8/andyw8/fix-namespacing-in-readme-examples
Fix namespacing in README examples
2025-07-26 14:54:02 +09:00
Andy Waite
f2f7a3fc12 Fix namespacing in README examples 2025-07-25 16:59:54 -04:00
Koichi ITO
4f9bc6e316
Merge pull request #86 from alexandru-calinoiu/account-for-missing-arguments
Account for missing arguments
2025-07-25 01:37:36 +09:00
calin
47215c98ce Account for missing arguments 2025-07-23 15:17:23 +03:00
Koichi ITO
a84b56c87a
Merge pull request #85 from SheldonNunes/sheldon.fix-tools-with-no-args
Fix tools with no args
2025-07-23 12:06:56 +09:00
Sheldon Nunes
74737223a0 Fix tools with no args 2025-07-23 13:42:19 +12:00
Koichi ITO
6bace861b2
Merge pull request #83 from koic/make_default_protocol_version_latest_spec_version
Set default protocol version to the latest specification
2025-07-21 12:54:14 +09:00
Koichi ITO
2b36bf6b2d Set default protocol version to the latest specification
Currently, MCP has three versions: 2024-11-05, 2025-03-26, and 2025-06-18.

- https://modelcontextprotocol.io/specification/2024-11-05/basic/transports (stdio and HTTP with SSE)
- https://modelcontextprotocol.io/specification/2025-03-26/basic/transports (stdio and Streamable HTTP)
- https://modelcontextprotocol.io/specification/2025-06-18/basic/transports (stdio and Streamable HTTP)

The newer specification supports stdio and Streamable HTTP as transport mechanisms.
Only the oldest version, 2024-11-05, supports stdin and HTTP with SSE,
but that version is now considered legacy.

Given the current behavior of the Ruby SDK, it likely makes more sense to set
the default protocol version to the latest one, 2025-06-18, rather than the oldest, 2024-11-05.

Ideally, the implementation should adjust its behavior based on the version,
but this PR is limited to updating the default protocol version only.
2025-07-20 16:36:18 +09:00
Koichi ITO
e4d5f19574
Merge pull request #80 from koic/validate_protocol_version_value
Validate `protocol_version` value
2025-07-19 16:14:49 +09:00
Koichi ITO
54c1f969d6
Merge pull request #82 from honzasterba/fix_test_warnings
[tests] Fix test warnings
2025-07-18 11:28:18 +09:00
Jan Sterba
ed9e0fbc9c [tests] fix warnings and erros after warnings removed 2025-07-17 14:50:10 +02:00
Koichi ITO
f13522d416 Validate protocol_version value
## Motivation and Context

Currently, MCP supports the following three protocol versions:
"2025-06-18", "2025-03-26", and "2024-11-05".
https://modelcontextprotocol.io/introduction

As shown in the changes to `test/mcp/configuration_test.rb`,
the `protocol_version` value is not currently being validated,
which allows unexpected `protocol_version` values to be accepted.

This PR ensures that only supported protocol versions are accepted.

## How Has This Been Tested?

Existing tests have been updated and new tests have been added.

## Breaking Changes

None. If it becomes an issue, it means a value that was not originally intended has been used.

## Additional context

While one possible approach might be to fall back to a default protocol version
when an invalid `protocol_version` value is provided,
this PR opts to reject invalid `protocol_version` values explicitly.
The reasoning is that encouraging users to provide intentional,
valid input is preferable to silently falling back to a default,
which could lead to unexpected behavior.
2025-07-16 12:38:49 +09:00
Ateş Göral
efeef2831e
Merge pull request #79 from atesgoral/v0.2.0 v0.2.0
v0.2.0
2025-07-15 16:01:32 -04:00
Ates Goral
d853cc92d5 Add new version to CHANGELOG.md 2025-07-15 15:45:05 -04:00
Ates Goral
bdd118a568 Update release process
fixup: Remove "the"
2025-07-15 15:44:58 -04:00
Ates Goral
d234d011e6 Bump version 2025-07-15 15:40:15 -04:00
Ateş Göral
e2fe23b7be
Merge pull request #78 from atesgoral/changelog
Add CHANGELOG.md and update rules
2025-07-15 15:15:23 -04:00
Ates Goral
e046b8a95c Update CHANGELOG update rules and ask Cursor to populate Unreleased 2025-07-15 12:11:35 -04:00
Ates Goral
4dbbfdfcfa Add CHANGELOG.md 2025-07-15 11:16:42 -04:00
Topher Bullock
3d5451ad32
Merge pull request #77 from modelcontextprotocol/run-release-workflow-in-environment
run `workflows/release.yml` in release environment
2025-07-15 10:27:40 -04:00
Ateş Göral
fcb2a8cf0b
Merge pull request #75 from atesgoral/custom-methods
Add define_custom_method to define custom methods (and notifications)
2025-07-15 10:02:55 -04:00
Topher Bullock
520205cad2 run workflows/release.yml in release environment 2025-07-15 09:48:24 -04:00
Koichi ITO
ad2240798a
Merge pull request #76 from atesgoral/curl-json
Use the not-so-new --json arg of curl
2025-07-15 10:20:16 +09:00
Ates Goral
c8fdf25cdb Use the new --json arg of curl 2025-07-14 20:43:43 -04:00
Ates Goral
1ed313951a Add define_custom_method to define custom methods 2025-07-14 20:12:29 -04:00
Koichi ITO
189d5fc5a5
Merge pull request #74 from mogox/increase_streamable_coverage
Adding test for streamable errors for StreamableHTTPTransport
2025-07-14 09:34:23 +09:00
Enrique Mogollan
b1fa433a47 Adding test for streamable errors for http transport 2025-07-13 02:24:20 -07:00
Koichi ITO
13bee9f60e
Merge pull request #63 from kfischer-okarin/check-notification-capabilities
Check all methods & capabilities
2025-07-13 11:34:42 +09:00
Koichi ITO
1a89cc5537
Merge pull request #61 from kfischer-okarin/simplify-and-add-missing-capabilities
Remove automatic capability determination and add missing capabilities
2025-07-12 19:01:35 +09:00
Ateş Göral
2a7511c8f2
Merge pull request #73 from planio-gmbh/fix/input-schema-without-required-fields
fixes input schema validation for schemas without required fields
2025-07-11 07:18:49 -04:00
Jens Kraemer
271ccb43d0 fixes input schema validation for schemas without required fields 2025-07-11 11:27:59 +02:00
Topher Bullock
b94a938d95
Merge pull request #54 from julianojulio/make_server_context_optional_and_sorbet_friendly
Make `server_context` optional for Tools and Prompts
2025-07-09 13:59:09 -04:00
Topher Bullock
db98dbc13d
Merge pull request #72 from koic/use_console_instead_of_bash
[Doc] Use `console` instead of `bash` for code block highlighting
2025-07-02 12:58:05 -04:00
Koichi ITO
6335d21349 [Doc] Use console instead of bash for code block highlighting
Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/67#discussion_r2162083685.

This PR updates code blocks for command examples to use `console` as the language identifier.
2025-06-25 19:14:30 +09:00
Sam Bostock
40e8b47334
Merge pull request #71 from sambostock/curl-headers
Include response headers in `curl` examples
2025-06-24 13:17:41 -04:00
Sam Bostock
9a85975d12
Log headers in all curl examples
The examples showcase to the user how the server works, so it makes
sense to include headers to show the full picture.
2025-06-24 11:23:33 -04:00
Sam Bostock
cccb7494fa
Log headers in curl initialize requests
The user needs the `mcp-session-id` header, so we should log headers.
2025-06-24 11:22:46 -04:00
Sam Bostock
7a2043b49c
Add space before pipe 2025-06-24 11:21:27 -04:00
Koichi ITO
c806e1ecd2
Merge pull request #67 from koic/remove_chebang_from_example_files
Remove shebang from example files
2025-06-24 02:21:12 +09:00
Koichi ITO
b28a477727
Merge pull request #70 from dak2/fix-error-handling-when-sending-notification
Fix handling response when sending notifications in `examples/streamable_http_client.rb`
2025-06-21 20:19:35 +09:00
dak2
7a5bd7c18f Fix handling response when sending notifications in examples/streamable_http_client.rb
Even though the 'tools/call' request to 'notification_tool' is successful and an 'MCP::Tool::Response' is returned, the logger still prints 'Error:'.

```
% ruby examples/streamable_http_client.rb
=== MCP SSE Test Client ===

[CLIENT] INFO 15:41:04.696 - Initializing session...
[CLIENT] INFO 15:41:04.698 - Session initialized: SESSION_ID
[CLIENT] INFO 15:41:04.698 - Server info: {"name" => "sse_test_server", "version" => "0.1.0"}
[CLIENT] INFO 15:41:04.698 - Connecting to SSE stream...
[CLIENT] INFO 15:41:04.698 - SSE stream connected successfully

=== Available Actions ===
1. Send custom notification
2. Test echo
3. List tools
0. Exit

Choose an action: 1
Enter notification message: notification test
Enter delay in seconds (0 for immediate):
[CLIENT] INFO 15:41:11.248 - SSE data: {"jsonrpc":"2.0","id":"0f657eeb-3e05-47bb-b7b4-898e2cb503af","result":{"content":[{"type":"text","text":"Notification: notification test (timestamp: 2025-06-21T15:41:11+09:00)"}],"isError":false}}
[CLIENT] ERROR 15:41:11.249 - Error:

=== Available Actions ===
1. Send custom notification
2. Test echo
3. List tools
0. Exit
```

It is probably trying to output an MCP::Tool::Response, but these appear in the SSE stream. Therefore, the response it is handling this time should either be accepted or an error.

I modified it so that it could handle them.
2025-06-21 19:38:33 +09:00
Ateş Göral
0fe0289a39
Merge pull request #69 from andyw8/andyw8/disable-release-workflow-on-forks
Disable release workflow on forks
2025-06-20 01:42:20 +03:00
Andy Waite
e955cecb61 Disable release workflow on forks 2025-06-19 15:40:18 -04:00
Koichi ITO
55a3cda66f
Merge pull request #68 from sambostock/deps
Remove `json-schema` limit and reorganize dev deps
2025-06-20 03:51:46 +09:00