Project

mewmew

0.0
No release in over 3 years
Load any Thor CLI directly as a StdIO MCP server
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 0
>= 0
 Project Readme

Mewmew

Just add Mewmew to make any Thor CLI into an MCP server.

Mewmew automatically converts Thor CLI commands into MCP (Model Context Protocol) tools that can be used by AI assistants.

Installation

Add to your Gemfile:

gem 'mewmew'

or add to a gemspec for a command that already uses Thor.

Usage

1. Include Mewmew in your Thor class

Simply add include Mewmew to your Thor CLI class:

require 'thor'
require 'mewmew'

class MyCli < Thor
  include Mewmew  # MCP command is automatically added!

  # Optional: Customize MCP server options
  # add_mcp_command(name: "my_custom_name", version: "2.0.0")

  desc "hello NAME", "Say hello to someone"
  def hello(name)
    puts "Hello, #{name}!"
  end

  desc "greet", "Greet the world"
  method_option :style, type: :string, default: "normal", desc: "Greeting style"
  def greet
    style = options[:style]
    case style
    when "loud"
      puts "HELLO WORLD!"
    when "quiet"
      puts "hello world..."
    else
      puts "Hello world!"
    end
  end
end

2. Start the MCP server

Run your CLI with the mcp command:

ruby my_cli mcp

Cursor Integration

To use your CLI with Cursor:

  1. Configure MCP in Cursor: Add this to your .cursor/mcp.json:
{
  "mcpServers": {
    "my_cli": {
      "command": "/path/to/ruby",
      "args": ["/path/to/your/my_cli.rb", "mcp"]
    }
  }
}
  1. Restart Cursor to pick up the MCP configuration

  2. Use in Cursor: Your CLI commands will now be available as tools that Cursor can call automatically!

Example

Check out the complete example in examples/example_cli.rb which creates a Wikipedia lookup CLI that can be used with Cursor.

Features

  • 🚀 Automatic detection: Just include Mewmew in any Thor class
  • Zero configuration: MCP tools are automatically added - no extra steps needed
  • 🛠️ Works with existing Thor commands out of the box
  • 📝 Full option support: Method options, descriptions, and arguments are preserved
  • 🔄 Live updates: Changes to your CLI are immediately available to Cursor

Requirements

  • Ruby 3.0+
  • Thor gem
  • MCP gem (installed automatically)