mcp-server
БесплатноЗапускает вложенные скриптыНе проверен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…
Об этом скилле
MCP Ruby SDK - Server Development Guide
Build Model Context Protocol servers in Ruby using the official mcp gem (maintained by Anthropic and Shopify).
Design Philosophy
Information Provider, Not Analyzer
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
Context Preservation
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:
- Never return data that wasn't explicitly requested
- Mutations are quiet—return confirmations, not data dumps
- Explicit over implicit—associations only when asked
- Filter large datasets before returning (10,000 rows → 5 relevant rows)
Domain-Aligned Vocabulary
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.
Tool Budget Management
Too many tools overwhelm agents and increase costs. Design toolsets around clear use cases, not API endpoint mirrors.
- Group related functionality intelligently
- Use lazy loading for large tool sets (150K tokens → 2K via on-demand discovery)
- Tool names ≤64 characters, descriptions narrow and unambiguous
Security: The Lethal Trifecta
Three capabilities that, when combined, create vulnerabilities (Simon Willison):
- Access to private data
- Exposure to untrusted content
- External communication capabilities
Required: Explicit user consent before tool invocation, clear UI showing exposed tools, alerts when tool descriptions change.
Domain Components
| 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 |
Key Concepts
| 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 |
Tool Definition Patterns
| 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 |
Transport Decision Tree
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)
Quick Comparison
| 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 |
Protocol Version Features
| Feature | Minimum Version |
|---|---|
description |
2025-11-25 |
instructions |
2025-03-26 |
annotations |
2025-03-26 |
output_schema |
2025-03-26 |
Best Practices
Do
- Use
tool_namefor namespaced classes to avoid conflicts - Use
additionalProperties: falsefor strict schema validation - Use mutex for shared state in HTTP transport (thread safety)
- Return error responses for business errors (
Response.new([...], error: true)) - Check protocol version before using newer features
- Use
server_contextfor request-scoped data (user_id, env)
Don't
- Don't use
$refin schemas (raises ArgumentError, inline only) - Don't assume extra args are rejected (
additionalPropertiesdefaults to allowing extras) - Don't use
rpc.prefix (reserved for protocol methods) - Don't send notifications in stateless mode (raises RuntimeError)
- Don't rely on
Установить mcp-server в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл mcp-server?
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.
Как установить скилл mcp-server?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл mcp-server запускает скрипты?
Да, скилл несёт исполняемые скрипты. Проверь исходник перед установкой.
Похожие скиллы
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when…
от Anthropicclaude-api
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER…
от Anthropicalgorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code…
от Anthropicmcp-integration
This skill should be used when the user asks to "add MCP server", "integrate MCP", "configure MCP in plugin", "use .mcp.json", "set up Model Context…
от Anthropic