Commit graph

326 commits

Author SHA1 Message Date
Devon Boyer
b34fae93f0 Fix symlink path comparison in schema validation 2025-12-04 22:39:23 -05:00
Koichi ITO
00392b660d
Merge pull request #181 from jonathanhefner/generate-api-docs
Add API documentation with GitHub Pages deployment
2025-11-27 12:54:46 +09:00
Koichi ITO
6bb96dd891
Merge pull request #183 from modelcontextprotocol/dependabot/github_actions/actions/checkout-6
Bump actions/checkout from 5 to 6
2025-11-26 00:45:37 +09:00
dependabot[bot]
fecf33588c
Bump actions/checkout from 5 to 6
Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-11-24 20:51:26 +00:00
Koichi ITO
d31c3da8f2
Merge pull request #178 from koic/add_elicitation_skeleton
Add Elicitation skeleton
2025-11-25 01:02:30 +09:00
Koichi ITO
14ef006cd3
Merge pull request #182 from koic/update_agents_md
Update AGENTS.md
2025-11-24 03:49:49 +09:00
Koichi ITO
056b0a61b4 Update AGENTS.md
Follow-up to #175.

Since `json_rpc_handler` was merged in #175, it has been removed from AGENTS.md.

The "Dependencies" section was also removed because the information there would have become redundant.
2025-11-23 02:48:03 +09:00
Jonathan Hefner
281c334075 Add API documentation with GitHub Pages deployment
This adds automated deployment of a versioned API documentation landing
page using GitHub Pages. The landing page links to documentation hosted
on RubyDoc.info, the de facto standard documentation site for the Ruby
ecosystem. The landing page will update to reflect new releases.

Changes
-------

1. **Documentation generation script** (see `bin/generate-gh-pages.sh`)

    Copies and commits documentation files to the gh-pages branch. The
    script uses git worktrees to isolate the process from the main
    workspace.

    The script:

    - Creates the gh-pages branch as an orphan branch if it doesn't exist
    - Parses semantic versions from tag names, ignoring arbitrary
      prefixes (e.g., tags `1.2.3`, `v1.2.3`, and `release-1.2.3` all
      create `v1.2.3`)
    - Determines the latest version using semantic version sorting
    - Copies static Jekyll template files from `docs/` to the gh-pages
      root (for the latest version only)
    - Generates `docs/_data/versions.yml` with a list of all versions
      for the Jekyll templates to consume

2. **Jekyll template files** (see `docs/` directory)

    - `docs/_config.yml` - Jekyll configuration
    - `docs/index.md` - Landing page template that links to all versions
      on RubyDoc.info based on generated `docs/_data/versions.yml`
    - `docs/latest/index.html` - Redirect page template that redirects
      to the latest documentation on RubyDoc.info

3. **GitHub Actions workflow** (see `.github/workflows/release.yml`)

    Added a `publish_gh_pages` job that runs after the `publish_gem` job
    on release events. The job invokes the generation script with the
    release tag name, then pushes the updated gh-pages branch to deploy
    the documentation.

4. **CI validation** (see `.github/workflows/ci.yml`)

    Added a `yard` job that runs YARD validation with `--no-output`.
    This ensures YARD can successfully parse the codebase (without
    generating output), catching documentation issues early in CI.

5. **YARD dependencies** (see `Gemfile`)

    Added `yard` and `yard-sorbet` gems as development dependencies to
    support documentation validation in CI.

    YARD documentation is automatically generated and hosted by
    RubyDoc.info when the gem is published to RubyGems.org.

6. **Documentation links** (see `README.md` and `mcp.gemspec`)

    Added links to the published API documentation on RubyDoc.info in
    the README and gemspec metadata.

Documentation URL
-----------------

Custom documentation will be available at:
https://modelcontextprotocol.github.io/ruby-sdk/

RubyDoc.info documentation will be accessible at:
- https://rubydoc.info/gems/mcp (latest version)
- https://rubydoc.info/gems/mcp/1.2.3 (specific versions)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 12:21:38 -06:00
Koichi ITO
11aea51c42
Merge pull request #179 from koic/add_draft_version
Add "Draft" protocol version to supported protocol versions
2025-11-22 01:57:51 +09:00
Koichi ITO
26bbdfc28c
Merge pull request #180 from koic/refactor_mcp_server
Refactor to extract duplicate error tool response in `MCP::Server`
2025-11-21 02:43:05 +09:00
Koichi ITO
dd458b1fb7 Add Elicitation skeleton
The MCP 2025-06-18 specification includes a feature called Elicitation:
https://modelcontextprotocol.io/specification/2025-06-18/client/elicitation

Like Log Level, an implementation is expected to be provided in the near future.
This PR adds Elicitation as a skeleton implementation for now.
2025-11-21 02:42:20 +09:00
Koichi ITO
3c452b807c
Merge pull request #176 from koic/tweak_the_readme_doc_for_stateless
[Doc] Tweak the README for stateless
2025-11-20 10:10:31 +09:00
Koichi ITO
1c4ac125e1 Refactor to extract duplicate error tool response in MCP::Server
Consolidates four identical constructions of error `Tool::Response` in
`handle_call_tool_request` into a single private `error_tool_response` method,
reducing duplication and improving maintainability. No behavior change.
2025-11-14 13:54:44 +09:00
Koichi ITO
bf729baef2 Add "Draft" protocol version to supported protocol versions
For example, the `title` introduced in #109 is not supported in the latest stable protocol version "2025-06-18":
https://modelcontextprotocol.io/specification/2025-06-18

It is supported in the Draft of the next version:
https://modelcontextprotocol.io/specification/draft

In other words, the fact that the Ruby SDK treats "2025-06-18" as the default protocol version while `title` is
only supported in the Draft results in an inconsistency.

Because of this, a new version `"Draft"` has been added to the list of supported versions.
Its value follows the schema below and is defined as `DRAFT-2025-v3`:
14ec41c/schema/draft/schema.ts (L15)

It was also considered to continue using the latest stable version "2025-06-18" as the Ruby SDK default instead of the Draft.
However, in that case, users would need to explicitly specify `MCP::Server.new(protocol_version: 'DRAFT-2025-v3')`,
which adds extra burden. In this PR, Draft is made the default in order to provide the following benefits:

- Users are likely to prefer using the Draft version over the latest stable version
- No need to specify the `protocol_version` option when initializing `MCP::Server`
- Users generally do not need to know the internal development value `DRAFT-2025-v3`

The primary case for specifying `protocol_version` explicitly is when strict adherence to a particular version is required.
However, it seems more practical to prioritize use cases where backward-compatible features, including those from the Draft,
are desirable. This is the rationale behind making the Draft version the default.

In addition, making the Draft version the default protocol version preserves backward compatibility for `MCP::Server`.

NOTE: `DRAFT-2025-v3` is a development code, so its value cannot be set externally.
It is applied either when `protocol_version` is omitted or when `nil` is set explicitly,
such as with `MCP::Configuration.new(protocol_version: nil)`.
This prevents users from creating implementations that depend on development codes like `DRAFT-2025-v3`.
2025-11-11 15:44:36 +09:00
Koichi ITO
b8719ce04f [Doc] Tweak the README for stateless
`stateless` was supported in #101. However, as shown in the official specification below,
the supported transports are stdout and Streamable HTTP, and whether it is stateless is
a detail specific to Streamable HTTP:
https://modelcontextprotocol.io/specification/2025-06-18/basic/transports

This PR updates the documentation to describe `stateless` as part of the Streamable HTTP section.
2025-11-08 12:55:35 +09:00
Koichi ITO
400a56e83d
Merge pull request #101 from 1debit/stateless
Add `stateless` feature to Streamable HTTP protocol
2025-11-07 09:11:33 +09:00
Hiren Hiranandani
08a84c7320
Introduce stateless mode to allow for HA
- Create failing tests for `stateless` mode
- Implement `stateless` mode by turning of SSE in Streamable HTTP,
  making the interaction a standard HTTP Req/Resp
2025-11-04 15:26:12 -08:00
Koichi ITO
55dfbdc3b6
Merge pull request #174 from koic/extract_release_from_readme_to_a_new_file
[Docs] Extract release documentation to RELEASE.md
2025-11-04 12:33:39 +09:00
Koichi ITO
5b737eb9c3 [Docs] Extract release documentation to RELEASE.md
README is generally better kept focused on information that is most valuable to users.
For that reason, release procedures that are not relevant to end users have been moved to
a separate RELEASE.md file.
2025-11-04 11:13:39 +09:00
Ateş Göral
3f5f6f8494
Internalize json_rpc_handler along with an XSS vulnerability fix (#175)
* Copy-paste of files from original gem

* Update copied code to match repo style

* Use the lib instead of the gem
2025-10-30 17:43:31 -04:00
Koichi ITO
c152f15a25
Merge pull request #173 from koic/add_bug_tracker_url_to_gemspec
Add bug tracker URL metadata to gemspec
2025-10-29 09:36:38 +08:00
Koichi ITO
fc59f440b0 Add bug tracker URL metadata to gemspec
It would be convenient if users could visit to the bug tracker directly from the published RubyGems.
https://rubygems.org/gems/mcp
2025-10-28 08:15:30 +09:00
Topher Bullock
ea216047dc
Merge pull request #169 from koic/remove_redundant_require_rack_gem
Remove redundant `rack` gem
2025-10-27 11:06:01 -04:00
Koichi ITO
cdf5b1cf92
Merge pull request #171 from koic/fix_incorrect_schema_name
[Doc] Fix incorrect schema name
2025-10-27 00:24:31 +09:00
Koichi ITO
fb67a9b969 [Doc] Fix incorrect schema name
This PR fixes an incorrect schema name.

The test code already uses `items:`.
https://github.com/modelcontextprotocol/ruby-sdk/blob/v0.4.0/test/mcp/tool/output_schema_test.rb#L135-L141

Fixes #170.
2025-10-26 01:24:45 +09:00
Koichi ITO
61d48cd6d9
Merge pull request #165 from Jflick58/fix/make-tool-error-spec-compliant
Fix tool error handling to follow MCP spec
2025-10-22 10:58:29 +09:00
Justin Flick
389cc2e8e6 Fix tool error handling to follow MCP spec
Tool execution errors now return successful responses with isError: true
instead of JSON-RPC protocol errors, per the MCP specification.

This allows clients to distinguish between protocol-level errors and
tool execution errors, providing better error context.

Fixes #159
2025-10-21 18:33:42 -07:00
Koichi ITO
4851a16d39 Remove redundant rack gem
This PR removes the existing `rack` dependency.
`rack` is a dependency of `rackup`.
2025-10-20 19:24:21 +09:00
Koichi ITO
ad87c8d805
Merge pull request #163 from dak2/add-client-prompts-support
Add `prompts/list` and `prompts/get` support to client
2025-10-19 02:24:36 +09:00
Koichi ITO
b36aea0716
Merge pull request #168 from koic/add_changelog_url_metadata_to_gemspec
Add changelog URL metadata to gemspec
2025-10-17 03:31:56 +09:00
Koichi ITO
e03222d206 Add changelog URL metadata to gemspec
It would be convenient if users could trace the change history directly from the published RubyGems.
https://rubygems.org/gems/mcp
2025-10-16 11:43:41 +09:00
Topher Bullock
944660a8b0
Merge pull request #167 from modelcontextprotocol/release-0.4.0 v0.4.0
Release v0.4.0
2025-10-15 14:56:18 -04:00
Topher Bullock
9aafc9add5 Release 0.4.0 2025-10-15 01:25:05 -04:00
dak2
e88deb6b65 Add prompts/list and prompts/get support to client
This commit adds two new methods to `MCP::Client`:
- prompts: Lists available prompts from the server via `prompts/list`
- get_prompt: Retrieves a specific prompt by name via `prompts/get`

Both methods follow the same pattern as the existing resources support,
including comprehensive test coverage and README documentation updates.

ref. https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-03-26/server/prompts.mdx#protocol-messages
2025-10-15 13:16:41 +09:00
Koichi ITO
f312695798
Merge pull request #153 from modelcontextprotocol/prompt-spec-compliance
fix `Prompt` type gaps with 2025-06-18 spec
2025-10-15 01:22:45 +09:00
Koichi ITO
f8557e5ceb
Merge pull request #166 from dak2/fix-client-tools-test
Fix and add test for client tools functionality
2025-10-14 01:49:22 +09:00
dak2
7b4ece294b Fix and add test for client tools functionality
- Add test for empty tools array response to ensure client handles empty
  results correctly
- Update call_tool test to use proper content format (array of content
  objects) instead of plain string based on
  modelcontextprotocol spec.
  https://github.com/modelcontextprotocol/modelcontextprotocol/blob/main/docs/specification/2025-03-26/server/tools.mdx#calling-tools

Follow up: modelcontextprotocol#160
2025-10-13 11:14:48 +09:00
Koichi ITO
92a08bafc7
Merge pull request #162 from dak2/fix-client-resouces-test
Fix test for empty resources response of client
2025-10-13 02:02:25 +09:00
Koichi ITO
5b57563738
Merge pull request #161 from koic/mention_mcp_client_resources_methods_to_readme
[Doc] Mention `resources/list` and `resources/read` in the README
2025-10-12 11:28:30 +09:00
dak2
ad3c1b1b72 Fix test for empty resources response
Update test_resources_returns_empty_array_when_no_resources to use
correct mock response format with empty resources array instead of
empty result object. Also reorder test to group with other resources
tests.

Follow up: https://github.com/modelcontextprotocol/ruby-sdk/pull/160
2025-10-12 00:44:17 +09:00
Koichi ITO
93215f4d52 [Doc] Mention resources/list and resources/read in the README
Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/160
2025-10-12 00:33:01 +09:00
Koichi ITO
c51060031a
Merge pull request #160 from modelcontextprotocol/client-add-resource-support
add `resources/list` and `resources/read` support to client
2025-10-11 01:16:06 +09:00
Topher Bullock
2d1a1da937 add resources/list and resources/read support to client 2025-10-10 10:51:42 -04:00
Topher Bullock
a1dd3dd005 add _meta field to Prompt
> See [General fields: `_meta`](/specification/2025-06-18/basic/index#meta) for notes on `_meta` usage.

51e093b8eb/schema/2025-06-18/schema.ts (L680-L683)
2025-10-10 09:05:55 -04:00
Koichi ITO
b10a469013
Merge pull request #157 from koic/fix_a_typo_for_streamable_http_transport
[Doc] Fix incorrect example code in README
2025-10-10 01:03:52 +09:00
Koichi ITO
a217f70d95 [Doc] Fix incorrect example code in README
Follow-up to https://github.com/modelcontextprotocol/ruby-sdk/pull/33.

A `NameError` occurs because `MCP::Transports::HTTP` does not exist.
The correct constant is `MCP::Server::Transports::StreamableHTTPTransport`.
2025-10-09 11:44:58 +09:00
Koichi ITO
77370cbb93
Merge pull request #154 from koic/remove_redundant_requiring_transports
Remove unnecessary transport requires
2025-10-08 12:06:31 +09:00
Koichi ITO
bee6eace22 Remove unnecessary transport requires
The transports are already required by `require 'mcp'`:
https://github.com/modelcontextprotocol/ruby-sdk/blob/v0.3.0/lib/mcp.rb#L16-L17
2025-10-07 14:10:48 +09:00
Topher Bullock
701f6faab6 add title field to prompt argument
`PromptArgument extends BaseMetadata`, which includes both name and
title
 - 51e093b8eb/schema/2025-06-18/schema.ts (L686-L698)
 - 51e093b8eb/schema/2025-06-18/schema.ts (L294-l309)
2025-10-06 09:35:42 -04:00
Koichi ITO
b5e344e456
Merge pull request #132 from dr03ramos/patch-1
Update metaschema URI format in input_schema.rb
2025-10-06 10:34:47 +09:00