mcpField
S
sample-mcp-rails

sample-mcp-rails

github.com/funwarioisiiFrameworks & SDKs11Updated 86w ago

About sample-mcp-rails

sample-mcp-rails is a sample Rails application for developers learning to call a remote MCP server with the mcp-rb gem. It connects to a sample server when the application starts and demonstrates invoking it through a Rails endpoint.

Key features

  1. 01Rails application calling an MCP server
  2. 02Uses the mcp-rb gem
  3. 03Connects to a sample server at startup
  4. 04Exposes a /hello HTTP endpoint

Use cases

  1. 01Learning MCP calls from a Rails application
  2. 02Trying the mcp-rb gem with a sample server

MCP support

The Rails application connects to an MCP server at startup and uses mcp-rb to call it. The repository includes a sample server in mcps/hello_world.rb.

Details

From the project README

sample-mcp-rails

This is a sample Rails application that uses the MCP protocol to call a remote MCP server.

And it introduces how to use mcp-rb gem to call the MCP server.

https://github.com/funwarioisii/mcp-rb

How to run

# install dependencies
bundle install

# run the Rails application
rails s

# create HTTP request to the Rails application
curl http://localhost:3000/hello

Architecture

This project has /mcps directory that contains the MCP server. There is a sample MCP server in mcps/hello_world.rb.

When the Rails application starts, it will connect to the MCP server. see: config/initializers/mcp_hello_world.rb

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.