This skill should be used when the user asks to "create an MCP server", "build MCP tools", "define MCP prompts", "register MCP resources", "implement Model Context Protocol", or mentions the mcp gem, MCP::Server, MCP::Tool, JSON-RPC transport, stdio transport, or streamable HTTP transport. Should also be used when editing MCP server files, working with tool/prompt/resource definitions, or discussing LLM tool integrations in Ruby.
/plugin marketplace add hoblin/claude-ruby-marketplace/plugin install mcp@claude-ruby-marketplaceThis skill inherits all available tools. When active, it can use any tool Claude has access to.
examples/dynamic_tools.rbexamples/file_manager_tool.rbexamples/http_client.rbexamples/http_server.rbexamples/rails_integration.rbexamples/stdio_server.rbexamples/streaming_client.rbreferences/gotchas.mdreferences/prompts.mdreferences/resources.mdreferences/server.mdreferences/tools.mdreferences/transport.mdBuild Model Context Protocol servers in Ruby using the official mcp gem (maintained by Anthropic and Shopify).
MCP servers provide structured data; LLMs do the reasoning. Return comprehensive frameworks and raw information—let the client perform analysis and context-dependent decisions.
"The MCP server's job is to be the world's best research assistant, not a competing analyst." — Matt Adams
Agents have limited context windows. Every byte returned that wasn't requested is a byte that could have held useful context. Treat context preservation as a first-class design constraint.
Principles:
Tools should speak the language of your domain, not database/CRUD terminology. Agents are collaborators in your domain process, not database clients.
Example: A visual novel asset server uses create_image, make_sprite, place_character, explore_variations, compare_images—not generate, remove_background, composite, batch_generate, get_diff.
Too many tools overwhelm agents and increase costs. Design toolsets around clear use cases, not API endpoint mirrors.
Three capabilities that, when combined, create vulnerabilities (Simon Willison):
Required: Explicit user consent before tool invocation, clear UI showing exposed tools, alerts when tool descriptions change.
| Component | Purpose | Reference |
|---|---|---|
| Tools | Define callable functions with input/output schemas | references/tools.md |
| Prompts | Template-based message generators | references/prompts.md |
| Resources | Static and dynamic file/data registration | references/resources.md |
| Server | Core server initialization and configuration | references/server.md |
| Transport | STDIO and HTTP transport options | references/transport.md |
| Gotchas | Tricky behaviors and error handling | references/gotchas.md |
| Concept | Purpose |
|---|---|
MCP::Tool | Base class for defining callable tools |
MCP::Prompt | Base class for prompt templates |
MCP::Resource | Static resource registration |
MCP::ResourceTemplate | Dynamic URI-based resources |
server_context | Request-scoped data passed to handlers |
MCP::Tool::Response | Structured tool return value |
| Pattern | Use Case |
|---|---|
Class-based (< MCP::Tool) | Reusable tools with complex logic |
Block-based (MCP::Tool.define) | Inline, simple tools |
Dynamic (server.define_tool) | Runtime tool registration |
What environment?
├── CLI tool / Local server
│ └── Use STDIO transport
└── Web server / Production
└── Need sessions and notifications?
├── YES → Use Streamable HTTP (stateful)
└── NO → Use Streamable HTTP (stateless)
| Transport | Sessions | Notifications | Use For |
|---|---|---|---|
| STDIO | N/A | Yes | CLI tools, local dev |
| HTTP (stateful) | Yes | Yes | Web apps, long-lived connections |
| HTTP (stateless) | No | No | Simple request/response APIs |
| Feature | Minimum Version |
|---|---|
description | 2025-11-25 |
instructions | 2025-03-26 |
annotations | 2025-03-26 |
output_schema | 2025-03-26 |
tool_name for namespaced classes to avoid conflictsadditionalProperties: false for strict schema validationResponse.new([...], error: true))server_context for request-scoped data (user_id, env)$ref in schemas (raises ArgumentError, inline only)additionalProperties defaults to allowing extras)rpc. prefix (reserved for protocol methods)| Anti-Pattern | Solution |
|---|---|
Missing additionalProperties: false | Add to schema for strict validation |
Using $ref in schemas | Inline all definitions |
| Notifications in stateless mode | Use stateful transport or skip notifications |
| Hardcoded server_context | Pass dynamically based on request |
| Ignoring protocol version | Check version before using gated features |
| Blocking in tool handlers | Use async patterns for long operations |
server_context: parameter)For detailed DSL syntax by domain:
references/tools.md - Tool definition, responses, schemas, annotationsreferences/prompts.md - Prompt definition, arguments, content typesreferences/resources.md - Resource registration, templates, read handlersreferences/server.md - Server initialization, configuration, custom methodsreferences/transport.md - Transport config, protocol methods, sessionsreferences/gotchas.md - Tricky behaviors, error handling, edge casesWorking examples in examples/:
examples/stdio_server.rb - Complete STDIO server with tools, prompts, resourcesexamples/http_server.rb - HTTP server with Rack and loggingexamples/rails_integration.rb - Rails controller, routes, and initializerexamples/file_manager_tool.rb - Sandboxed file operations with security patternsexamples/dynamic_tools.rb - Runtime tool registration with notificationsexamples/http_client.rb - HTTP client connecting to MCP serverexamples/streaming_client.rb - SSE streaming client for real-time notificationsThis skill should be used when the user asks to "create an agent", "add an agent", "write a subagent", "agent frontmatter", "when to use description", "agent examples", "agent tools", "agent colors", "autonomous agent", or needs guidance on agent structure, system prompts, triggering conditions, or agent development best practices for Claude Code plugins.
This skill should be used when the user asks to "create a slash command", "add a command", "write a custom command", "define command arguments", "use command frontmatter", "organize commands", "create command with file references", "interactive command", "use AskUserQuestion in command", or needs guidance on slash command structure, YAML frontmatter fields, dynamic arguments, bash execution in commands, user interaction patterns, or command development best practices for Claude Code.
This skill should be used when the user asks to "create a hook", "add a PreToolUse/PostToolUse/Stop hook", "validate tool use", "implement prompt-based hooks", "use ${CLAUDE_PLUGIN_ROOT}", "set up event-driven automation", "block dangerous commands", or mentions hook events (PreToolUse, PostToolUse, Stop, SubagentStop, SessionStart, SessionEnd, UserPromptSubmit, PreCompact, Notification). Provides comprehensive guidance for creating and implementing Claude Code plugin hooks with focus on advanced prompt-based hooks API.