Ruby MCP server generator
Generate a production-ready Ruby MCP server project from bundled templates, preserving Ruby naming conventions, SDK structure, schemas, annotations, error handling, tests, and both stdio and HTTP usage examples.
When to invoke
- "Generate a Ruby MCP server project."
- "Scaffold an MCP server in Ruby with tools and prompts."
- "Create a Ruby server using the official MCP SDK gem."
- "Add tests and schemas to a Ruby MCP server template."
Request parameters
Ask for project name and description when missing. Convert the project name into snake_case file/module paths and a Ruby module name before generating files.
Project structure
Generate this complete tree, adapting my-mcp-server and my_mcp_server to the user's project name:
my-mcp-server/
├── Gemfile
├── Rakefile
├── lib/
│ ├── my_mcp_server.rb
│ ├── my_mcp_server/
│ │ ├── server.rb
│ │ ├── tools/
│ │ │ ├── greet_tool.rb
│ │ │ └── calculate_tool.rb
│ │ ├── prompts/
│ │ │ └── code_review_prompt.rb
│ │ └── resources/
│ │ └── example_resource.rb
├── bin/
│ └── mcp-server
├── test/
│ ├── test_helper.rb
│ └── tools/
│ ├── greet_tool_test.rb
│ └── calculate_tool_test.rb
└── README.md
Generation rules
| Area |
Rule |
| Templates |
Open references/project-templates.md and copy/adapt the full templates verbatim before inventing structure. |
| Tools and prompts |
Use classes for tools and prompts for better organization. |
| Schemas |
Include input/output schemas for type safety. |
| Annotations |
Add tool annotations that describe behavior and safety hints. |
| Responses |
Include structured content in responses, not only plain text. |
| Errors |
Return proper error responses with an is_error flag. |
| Tests |
Implement comprehensive tests for all tools, including success and error paths. |
| Ruby conventions |
Use snake_case, modules, and frozen_string_literal. |
| Usage |
Provide both stdio and HTTP examples in README.md. |
Procedure
- Collect project name and description if the user did not provide them.
- Normalize names for directory, executable, file paths, and Ruby module constants.
- Read
references/project-templates.md and adapt every required file in the project tree.
- Generate all files with correct naming, module nesting, SDK setup, tools, prompts, resources, and executable entry point.
- Add input/output schemas, tool annotations, structured responses,
is_error error handling, and tests.
- Validate with the existing Ruby test command if dependencies are available; otherwise report the exact command the user should run.
Progressive disclosure and bundled resources
references/project-templates.md: canonical Ruby MCP server project templates; read it before creating project files and copy/adapt the templates verbatim.
Gotchas
- Do not generate only a single server file: the skill requires a complete project tree with tests and README.
- Do not skip schemas: MCP clients depend on clear input/output contracts.
- Do not use ad hoc hashes for everything: classes and modules keep tools, prompts, and resources maintainable.
Output template
### Ruby MCP server generation
**Status:** complete | needs input | blocked
**Project:** `<my-mcp-server>`
**Module:** `<MyMcpServer>`
| Artifact | Path | Notes |
| --- | --- | --- |
| Gemfile | `<project>/Gemfile` | official MCP Ruby SDK gem |
| Server | `<project>/lib/<name>/server.rb` | tools/prompts/resources registered |
| Tools | `<project>/lib/<name>/tools/*.rb` | schemas, annotations, structured content |
| Tests | `<project>/test/tools/*_test.rb` | success and error paths |
| README | `<project>/README.md` | stdio and HTTP usage examples |
**Validation**
- `<ruby test command>`: pass | fail | not run
Quality gate
1---2name: ruby-mcp-server-generator-23description: Generate a complete Ruby Model Context Protocol server project using the official MCP Ruby SDK gem. Use when the user asks to create or scaffold a Ruby MCP server with tools, prompts, resources, schemas, annotations, structured content responses, tests, stdio usage, and HTTP usage examples.4---56# Ruby MCP server generator78Generate a production-ready Ruby MCP server project from bundled templates, preserving Ruby naming conventions, SDK structure, schemas, annotations, error handling, tests, and both stdio and HTTP usage examples.910## When to invoke1112- "Generate a Ruby MCP server project."13- "Scaffold an MCP server in Ruby with tools and prompts."14- "Create a Ruby server using the official MCP SDK gem."15- "Add tests and schemas to a Ruby MCP server template."1617## Request parameters1819Ask for project name and description when missing. Convert the project name into snake_case file/module paths and a Ruby module name before generating files.2021## Project structure2223Generate this complete tree, adapting `my-mcp-server` and `my_mcp_server` to the user's project name:2425```text26my-mcp-server/27├── Gemfile28├── Rakefile29├── lib/30│ ├── my_mcp_server.rb31│ ├── my_mcp_server/32│ │ ├── server.rb33│ │ ├── tools/34│ │ │ ├── greet_tool.rb35│ │ │ └── calculate_tool.rb36│ │ ├── prompts/37│ │ │ └── code_review_prompt.rb38│ │ └── resources/39│ │ └── example_resource.rb40├── bin/41│ └── mcp-server42├── test/43│ ├── test_helper.rb44│ └── tools/45│ ├── greet_tool_test.rb46│ └── calculate_tool_test.rb47└── README.md48```4950## Generation rules5152| Area | Rule |53| --- | --- |54| Templates | Open `references/project-templates.md` and copy/adapt the full templates verbatim before inventing structure. |55| Tools and prompts | Use classes for tools and prompts for better organization. |56| Schemas | Include input/output schemas for type safety. |57| Annotations | Add tool annotations that describe behavior and safety hints. |58| Responses | Include structured content in responses, not only plain text. |59| Errors | Return proper error responses with an `is_error` flag. |60| Tests | Implement comprehensive tests for all tools, including success and error paths. |61| Ruby conventions | Use `snake_case`, modules, and `frozen_string_literal`. |62| Usage | Provide both stdio and HTTP examples in `README.md`. |6364## Procedure65661. Collect project name and description if the user did not provide them.672. Normalize names for directory, executable, file paths, and Ruby module constants.683. Read `references/project-templates.md` and adapt every required file in the project tree.694. Generate all files with correct naming, module nesting, SDK setup, tools, prompts, resources, and executable entry point.705. Add input/output schemas, tool annotations, structured responses, `is_error` error handling, and tests.716. Validate with the existing Ruby test command if dependencies are available; otherwise report the exact command the user should run.7273## Progressive disclosure and bundled resources7475- `references/project-templates.md`: canonical Ruby MCP server project templates; read it before creating project files and copy/adapt the templates verbatim.7677## Gotchas7879- **Do not generate only a single server file**: the skill requires a complete project tree with tests and README.80- **Do not skip schemas**: MCP clients depend on clear input/output contracts.81- **Do not use ad hoc hashes for everything**: classes and modules keep tools, prompts, and resources maintainable.8283## Output template8485```markdown86### Ruby MCP server generation8788**Status:** complete | needs input | blocked89**Project:** `<my-mcp-server>`90**Module:** `<MyMcpServer>`9192| Artifact | Path | Notes |93| --- | --- | --- |94| Gemfile | `<project>/Gemfile` | official MCP Ruby SDK gem |95| Server | `<project>/lib/<name>/server.rb` | tools/prompts/resources registered |96| Tools | `<project>/lib/<name>/tools/*.rb` | schemas, annotations, structured content |97| Tests | `<project>/test/tools/*_test.rb` | success and error paths |98| README | `<project>/README.md` | stdio and HTTP usage examples |99100**Validation**101- `<ruby test command>`: pass | fail | not run102```103104## Quality gate105106- [ ] Project name and description were collected or inferred.107- [ ] `references/project-templates.md` was read before generation.108- [ ] The generated tree includes `Gemfile`, `Rakefile`, `lib/`, `bin/mcp-server`, `test/`, and `README.md`.109- [ ] Tools and prompts are classes with input/output schemas and annotations.110- [ ] Responses include structured content and use `is_error` for error cases.111- [ ] Tests cover all generated tools.112- [ ] Ruby conventions are followed: `snake_case`, modules, and `frozen_string_literal`.113- [ ] README includes both stdio and HTTP usage examples.