
mcp ruby sdk
Ruby SDK for the MCP Protocol
Repository Info
About This Server
Ruby SDK for the MCP Protocol
Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.
Documentation
MCP Ruby SDK
Ruby implementation of the Model Context Protocol (MCP).
Installation
Add this line to your application's Gemfile:
gem 'mcp'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install mcp
Quick Start
Here's a simple example of creating an MCP server with a calculator tool:
require 'mcp'
# Create an MCP server
server = MCP::Server.new(
name: "Demo",
version: "1.0.0"
)
# Add an addition tool
server.add_tool("add") do |params|
result = params["a"] + params["b"]
{
content: [{ type: "text", text: result.to_s }]
}
end
# Add a dynamic greeting resource
server.add_resource("greeting") do |uri, params|
{
contents: [{
uri: uri,
text: "Hello, #{params['name']}!"
}]
}
end
# Start the server using stdio transport
transport = MCP::Transport::Stdio.new
server.connect(transport)
Features
- Full implementation of the MCP specification
- Support for Resources, Tools, and Prompts
- Multiple transport options (stdio, HTTP/SSE)
- Easy-to-use high-level interfaces
- Async/await support
- Comprehensive type system
Documentation
For detailed documentation, please visit:
- API Documentation
- MCP Specification
- Examples
Development
After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/modelcontextprotocol/ruby-sdk. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
License
The gem is available as open source under the terms of the MIT License.
Quick Start
Clone the repository
git clone https://github.com/tangentus/mcp-ruby-sdkInstall dependencies
cd mcp-ruby-sdk
npm installFollow the documentation
Check the repository's README.md file for specific installation and usage instructions.
Repository Details
Recommended MCP Servers
Discord MCP
Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.
Knit MCP
Connect AI agents to 200+ SaaS applications and automate workflows.
Apify MCP Server
Deploy and interact with Apify actors for web scraping and data extraction.
BrowserStack MCP
BrowserStack MCP Server for automated testing across multiple browsers.
Zapier MCP
A Zapier server that provides automation capabilities for various apps.