| layout | default |
|---|---|
| title | Chapter 1: Getting Started and Gem Baseline |
| nav_order | 1 |
| parent | MCP Ruby SDK Tutorial |
Welcome to Chapter 1: Getting Started and Gem Baseline. In this part of MCP Ruby SDK Tutorial: Building MCP Servers and Clients in Ruby, you will build an intuitive mental model first, then move into concrete implementation details and practical production tradeoffs.
This chapter sets up a reliable Ruby baseline for MCP server/client development.
- install and pin the
mcpgem correctly - align Ruby runtime and dependency prerequisites
- establish a first-run workflow for server/client validation
- avoid environment drift before adding protocol features
gem 'mcp'After adding to Gemfile, run bundle install, then validate against a simple stdio or HTTP sample.
- pin gem version for reproducible builds
- run at least one server example and one client example
- verify JSON-RPC request/response flow before custom methods
- add environment-level logging early for troubleshooting
You now have a stable Ruby MCP baseline for deeper server/client implementation.
Next: Chapter 2: Server Architecture and Capability Negotiation
The schemas interface in conformance/server.rb handles a key part of this chapter's functionality:
class TestElicitationSep1330Enums < MCP::Tool
tool_name "test_elicitation_sep1330_enums"
description "A tool that tests elicitation with enum schemas"
class << self
def call(**_args)
MCP::Tool::Response.new(
[MCP::Content::Text.new("Elicitation not supported in this SDK version").to_h],
error: true,
)
end
end
end
class TestReconnection < MCP::Tool
tool_name "test_reconnection"
description "A tool that triggers SSE stream closure to test client reconnection behavior"
class << self
def call(**_args)
MCP::Tool::Response.new([MCP::Content::Text.new("Reconnection test completed").to_h])
end
end
end
end
module Prompts
class TestSimplePrompt < MCP::Prompt
prompt_name "test_simple_prompt"
description "A simple prompt for testing with no arguments"
class << selfThis interface is important because it defines how MCP Ruby SDK Tutorial: Building MCP Servers and Clients in Ruby implements the patterns covered in this chapter.
flowchart TD
A[schemas]