Merge pull request #538 from koic/namespace_the_conformance_rake_tasks

Group the conformance Rake tasks under a `conformance` namespace
This commit is contained in:
Koichi ITO 2026-08-31 01:29:29 +09:00 • committed by GitHub
commit 0cd1514bde
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 45 additions and 37 deletions

View file

@ -26,4 +26,4 @@ jobs:
- uses: actions/setup-node@v7 - uses: actions/setup-node@v7
with: with:
node-version: '24' # Specify the latest Node.js version. node-version: '24' # Specify the latest Node.js version.
- run: bundle exec rake conformance - run: bundle exec rake conformance:test

View file

@ -15,8 +15,8 @@ This is the official Ruby SDK for the Model Context Protocol (MCP), implementing
- `bundle install` - Install dependencies - `bundle install` - Install dependencies
- `rake test` - Run all tests - `rake test` - Run all tests
- `rake rubocop` - Run linter - `rake rubocop` - Run linter
- `rake` - Run tests and linting (default task) - `rake` - Run linting, tests, and the conformance suite (default task)
- `bundle exec rake conformance` - Run the MCP conformance suite (see conformance/README.md) - `bundle exec rake conformance:test` - Run the MCP conformance suite (see conformance/README.md)
- `bundle exec rake docs:preview` - Serve the documentation site locally at http://localhost:4000 (PORT to override) - `bundle exec rake docs:preview` - Serve the documentation site locally at http://localhost:4000 (PORT to override)
- `ruby -I lib -I test test/path/to/specific_test.rb` - Run single test file - `ruby -I lib -I test test/path/to/specific_test.rb` - Run single test file
- `gem build mcp.gemspec` - Build the gem - `gem build mcp.gemspec` - Build the gem

View file

@ -14,42 +14,50 @@ require "rubocop/rake_task"
RuboCop::RakeTask.new RuboCop::RakeTask.new
task default: [:rubocop, :test, :conformance] task default: [:rubocop, :test, "conformance:test"]
desc "Run MCP conformance tests (PORT, SCENARIO, SPEC_VERSION, VERBOSE)" namespace :conformance do
task :conformance do |t| desc "Run MCP conformance tests (PORT, SCENARIO, SPEC_VERSION, VERBOSE)"
next unless npx_available?(t.name) task :test do |t|
next unless npx_available?(t.name)
require_relative "conformance/server_runner" require_relative "conformance/server_runner"
require_relative "conformance/client_runner" require_relative "conformance/client_runner"
options = {} options = {}
options[:port] = Integer(ENV["PORT"]) if ENV["PORT"] options[:port] = Integer(ENV["PORT"]) if ENV["PORT"]
options[:scenario] = ENV["SCENARIO"] if ENV["SCENARIO"] options[:scenario] = ENV["SCENARIO"] if ENV["SCENARIO"]
options[:spec_version] = ENV["SPEC_VERSION"] if ENV["SPEC_VERSION"] options[:spec_version] = ENV["SPEC_VERSION"] if ENV["SPEC_VERSION"]
options[:verbose] = true if ENV["VERBOSE"] options[:verbose] = true if ENV["VERBOSE"]
Conformance::ServerRunner.new(**options).run Conformance::ServerRunner.new(**options).run
Conformance::ClientRunner.new(**options.reject { |key, _value| key == :port }).run Conformance::ClientRunner.new(**options.reject { |key, _value| key == :port }).run
end
desc "List available conformance scenarios"
task :list do |t|
next unless npx_available?(t.name)
system("npx", "--yes", "@modelcontextprotocol/conformance", "list", "--server")
system("npx", "--yes", "@modelcontextprotocol/conformance", "list", "--client")
end
desc "Start the conformance server (PORT)"
task :server do
require_relative "conformance/server"
options = {}
options[:port] = Integer(ENV["PORT"]) if ENV["PORT"]
Conformance::Server.new(**options).start
end
end end
desc "List available conformance scenarios" # The other two former names now fail with a "Did you mean?" suggestion, but a bare `conformance`
task :conformance_list do |t| # would match the `conformance/` directory: Rake synthesizes a file task for it and exits 0 without
next unless npx_available?(t.name) # running anything. This keeps the name pointing at the suite instead of at that silent no-op.
desc "Alias for conformance:test"
system("npx", "--yes", "@modelcontextprotocol/conformance", "list", "--server") task conformance: "conformance:test"
system("npx", "--yes", "@modelcontextprotocol/conformance", "list", "--client")
end
desc "Start the conformance server (PORT)"
task :conformance_server do
require_relative "conformance/server"
options = {}
options[:port] = Integer(ENV["PORT"]) if ENV["PORT"]
Conformance::Server.new(**options).start
end
namespace :docs do namespace :docs do
desc "Serve the documentation site locally at http://localhost:4000 (PORT)" desc "Serve the documentation site locally at http://localhost:4000 (PORT)"

View file

@ -12,7 +12,7 @@ Validates the Ruby SDK's conformance to the MCP specification using [`@modelcont
### Run all scenarios ### Run all scenarios
```bash ```bash
bundle exec rake conformance bundle exec rake conformance:test
``` ```
Runs both server and client conformance tests in sequence. Server conformance starts the Runs both server and client conformance tests in sequence. Server conformance starts the
@ -31,20 +31,20 @@ are allowed to fail without affecting the exit code.
```bash ```bash
# Run a single server scenario # Run a single server scenario
bundle exec rake conformance SCENARIO=ping bundle exec rake conformance:test SCENARIO=ping
# Use a different port with verbose output # Use a different port with verbose output
bundle exec rake conformance PORT=3000 VERBOSE=1 bundle exec rake conformance:test PORT=3000 VERBOSE=1
# Start the server on a specific port # Start the server on a specific port
bundle exec rake conformance_server PORT=3000 bundle exec rake conformance:server PORT=3000
``` ```
### Start the server and test separately ### Start the server and test separately
```bash ```bash
# Terminal 1: start the server # Terminal 1: start the server
bundle exec rake conformance_server bundle exec rake conformance:server
# Terminal 2: run all scenarios # Terminal 2: run all scenarios
npx @modelcontextprotocol/conformance@alpha server --url http://localhost:9292/mcp npx @modelcontextprotocol/conformance@alpha server --url http://localhost:9292/mcp
@ -59,7 +59,7 @@ on a single scenario. Stop the server with Ctrl+C when done.
### List available scenarios ### List available scenarios
```bash ```bash
bundle exec rake conformance_list bundle exec rake conformance:list
``` ```
Prints all scenario names that can be passed to `SCENARIO`. Prints all scenario names that can be passed to `SCENARIO`.
@ -76,7 +76,7 @@ repository with the conformance server running:
```bash ```bash
# Terminal 1 (this repository): start the conformance server # Terminal 1 (this repository): start the conformance server
bundle exec rake conformance_server bundle exec rake conformance:server
# Terminal 2 (conformance repository): run the tier audit skill as a slash command in Claude Code # Terminal 2 (conformance repository): run the tier audit skill as a slash command in Claude Code
/mcp-sdk-tier-audit /path/to/modelcontextprotocol/ruby-sdk http://localhost:9292/mcp /mcp-sdk-tier-audit /path/to/modelcontextprotocol/ruby-sdk http://localhost:9292/mcp
@ -102,4 +102,4 @@ conformance/
Known-failing scenarios are registered in `conformance/expected_failures.yml`. They are allowed to Known-failing scenarios are registered in `conformance/expected_failures.yml`. They are allowed to
fail without affecting the exit code and are tracked to catch regressions. fail without affecting the exit code and are tracked to catch regressions.
These are shown in the output of `bundle exec rake conformance`. These are shown in the output of `bundle exec rake conformance:test`.