Skip to content
Skillpedia
APIs & servers (backend)40k Β· #7409

ruby-mcp-server-generator

What it does

This feature creates a basic server in Ruby for program communication. It comes with pre-built functions like greeting someone or performing simple calculations.

When to use it

  • βœ“When you need a starting point for a Ruby communication server.
  • βœ“To test interaction between different system parts.
  • βœ“When learning to build servers with the MCP library in Ruby.

Skill link

https://github.com/github/awesome-copilot/blob/main/skills/ruby-mcp-server-generator/SKILL.md

Copy it and paste it into your AI (Claude, ChatGPT or Cursor), asking it to follow the instructions.

How to use

The easiest way: copy the message and paste it into your AI. It reads the skill and follows the instructions.

Ready-to-paste message

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/ruby-mcp-server-generator/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
Want your AI to find skills like this on its own?Install the free Skillpedia MCP: one line, and it searches 15,000+ skills before each task.Install in 1 minute β†’

Example of what to ask your AI

β€œCreate an MCP server in Ruby for me.”

5 new skills a week. 1 minute to read.

How it works

It uses the official MCP for Ruby library to set up the project structure. This includes files to define the server, example tools, and tests.

Technical content (original SKILL.md)

Original text by the author, straight from GitHub.

Ruby MCP Server Generator

Generate a complete, production-ready MCP server in Ruby using the official Ruby SDK.

Project Generation

When asked to create a Ruby MCP server, generate a complete project with this structure:

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

Gemfile Template

source 'https://rubygems.org'

gem 'mcp', '~> 0.4.0'

group :development, :test do
  gem 'minitest', '~> 5.0'
  gem 'rake', '~> 13.0'
  gem 'rubocop', '~> 1.50'
end

Rakefile Template

require 'rake/testtask'
require 'rubocop/rake_task'

Rake::TestTask.new(:test) do |t|
  t.libs << 'test'
  t.libs << 'lib'
  t.test_files = FileList['test/**/*_test.rb']
end

RuboCop::RakeTask.new

task default: %i[test rubocop]

lib/my_mcp_server.rb Template

# frozen_string_literal: true

require 'mcp'
require_relative 'my_mcp_server/server'
require_relative 'my_mcp_server/tools/greet_tool'
require_relative 'my_mcp_server/tools/calculate_tool'
require_relative 'my_mcp_server/prompts/code_review_prompt'
require_relative 'my_mcp_server/resources/example_resource'

module MyMcpServer
  VERSION = '1.0.0'
end

lib/my_mcp_server/server.rb Template

# frozen_string_literal: true

module MyMcpServer
  class Server
    attr_reader :mcp_server
    
    def initialize(server_context: {})
      @mcp_server = MCP::Server.new(
        name: 'my_mcp_server',
        version: MyMcpServer::VERSION,
        tools: [
          Tools::GreetTool,
          Tools::CalculateTool
        ],
        prompts: [
          Prompts::CodeReviewPrompt
        ],
        resources: [
          Resources::ExampleResource.resource
        ],
        server_context: server_context
      )
      
      setup_resource_handler
    end
    
    def handle_json(json_string)
      mcp_server.handle_json(json_string)
    end
    
    def start_stdio
      transport = MCP::Server::Transports::StdioTransport.new(mcp_server)
      transport.open
    end
    
    private
    
    def setup_resource_handler
      mcp_server.resources_read_handler do |params|
        Resources::ExampleResource.read(params[:uri])
      end
    end
  end
end

lib/my_mcp_server/tools/greet_tool.rb Template

# frozen_string_literal: true

module MyMcpServer
  module Tools
    class GreetTool < MCP::Tool
      tool_name 'greet'
      description 'Generate a greeting message'
      
      input_schema(
        properties: {
          name: {
            type: 'string',
            description: 'Name to greet'
          }
        },
        required: ['name']
      )
      
      output_schema(
        properties: {
          message: { type: 'string' },
          timestamp: { type: 'string', format: 'date-time' }
        },
        required: ['message', 'timestamp']
      )
      
      annotations(
        read_only_hint: true,
        idempotent_hint: true
      )
      
      def self.call(name:, server_context:)
        timestamp = Time.now.iso8601
        message = "Hello, #{name}! Welcome to MCP."
        
        structured_data = {
          message: message,
          timestamp: timestamp
        }
        
        MCP::Tool::Response.new(
          [{ type: 'text', text: message }],
          structured_content: structured_data
        )
      end
    end
  end
end

lib/my_mcp_server/tools/calculate_tool.rb Template

# frozen_string_literal: true

module MyMcpServer
  module Tools
    class CalculateTool < MCP::Tool
      tool_name 'calculate'
      description 'Perform mathematical calculations'
      
      input_schema(
        properties: {
          operation: {
            type: 'string',
            description: 'Operation to perform',
            enum: ['add', 'subtract', 'multiply', 'divide']
          },
          a: {
            type: 'number',
            description: 'First operand'
          },
          b: {
            type: 'number',
            description: 'Second operand'
          }
        },
        required: ['operation', 'a', 'b']
      )
      

…
FAQ

What is MCP?

MCP is a way to organize communication between different program parts or systems, defining how they should 'talk' to each other.

What are 'tools'?

These are pre-defined functions the server can use, like the 'greet' tool for saying hello or 'calculate' for doing math.

What is a 'prompt'?

A prompt is an instruction or question the server can use to guide a conversation or task, like a prompt for code review.

Details

Original description by the author

Generate a complete Model Context Protocol server project in Ruby using the official MCP Ruby SDK gem.

repo: github/awesome-copilot

Popularity

GitHub stars
40k
Ranking position
#7409
License
MIT
Updated
10/15/2026

Is this skill useful?

0

Sign in to vote.

Comments

  • …

More skills from this repository

Similar skills