# Mcp On Ruby

> 💎 A Ruby implementation of the Model Context Protocol

- **Type:** MCP server
- **Install:** `agentstack add mcp-nagstler-mcp-on-ruby`
- **Verified:** Yes — security-reviewed for prompt injection and unsafe behavior
- **Seller:** [nagstler](https://agentstack.voostack.com/s/nagstler)
- **Installs:** 0
- **Category:** [AI & ML](https://agentstack.voostack.com/c/ai-and-ml)
- **Latest version:** 0.1.0
- **License:** MIT
- **Upstream author:** [nagstler](https://github.com/nagstler)
- **Source:** https://github.com/nagstler/mcp_on_ruby

## Install

```sh
agentstack add mcp-nagstler-mcp-on-ruby
```

Requires the [AgentStack CLI](https://agentstack.voostack.com/docs/cli). Works with Claude Code, Cursor, and any MCP-compatible agent.

## About

# MCP on Ruby

[](https://badge.fury.io/rb/mcp_on_ruby)
[](https://opensource.org/licenses/MIT)
[](https://www.ruby-lang.org/)

**Model Context Protocol (MCP) server for Rails applications**

Expose your Rails app as an AI accessible interface — define tools and resources the Rails way.

---

## Features

🚀 **Production-Ready** - Authentication, rate limiting, error handling, security  
🔧 **Rails Integration** - Generators, autoloading, middleware, Railtie  
🛠️ **Tools System** - Callable functions with JSON Schema validation  
📊 **Resources System** - Data exposure with URI templating  
🔒 **Security** - DNS rebinding protection, CORS, token authentication  
⚡ **Real-time** - Server Events (SSE) foundation (full implementation coming soon)  
🎯 **Developer-Friendly** - Clean DSL, generators, testing support  

## Installation

Add to your `Gemfile`:

```ruby
gem 'mcp_on_ruby'
```

Then run:

```bash
bundle install
rails generate mcp_on_ruby:install
```

## Quick Start

### 1. Install and Configure

```bash
# Generate MCP server files
rails generate mcp_on_ruby:install

# Create a tool
rails generate mcp_on_ruby:tool UserManager --description "Manage application users"

# Create a resource  
rails generate mcp_on_ruby:resource UserStats --uri "users/{id}/stats" --template
```

### 2. Configure MCP Server

```ruby
# config/initializers/mcp_on_ruby.rb
McpOnRuby.configure do |config|
  config.authentication_required = true
  config.authentication_token = ENV['MCP_AUTH_TOKEN']
  config.rate_limit_per_minute = 60
  config.allowed_origins = [/\.yourdomain\.com$/]
end

Rails.application.configure do
  config.mcp.enabled = true
  config.mcp.auto_register_tools = true
  config.mcp.auto_register_resources = true
end
```

### 3. Create Tools

```ruby
# app/tools/user_manager_tool.rb
class UserManagerTool  3.0) - JSON Schema validation
- `rack` (~> 2.2) - HTTP transport layer
- `webrick` (~> 1.7) - HTTP server

## Contributing

1. Fork the repository
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Write tests for your changes
4. Ensure all tests pass (`bundle exec rspec`)
5. Commit your changes (`git commit -am 'Add some feature'`)
6. Push to the branch (`git push origin my-new-feature`)
7. Create a Pull Request

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE.txt) file for details.

## 🙏 Acknowledgments

- The [Model Context Protocol](https://modelcontextprotocol.io) team at Anthropic for creating the specification
- The Ruby on Rails community for inspiration and conventions

---

Made with ❤️ for the Ruby community

## Source & license

This open-source MCP server is cataloged on AgentStack and links to its original source — we do not rehost the code.

- **Author:** [nagstler](https://github.com/nagstler)
- **Source:** [nagstler/mcp_on_ruby](https://github.com/nagstler/mcp_on_ruby)
- **License:** MIT

Install and usage instructions live in the source repository linked above.

## Pricing

- **Free** — Free

## Security capabilities

Automated source analysis of v0.1.0 — what this tool can access:

- **Network access:** no
- **Filesystem access:** no
- **Shell / process execution:** no
- **Environment & secrets:** no
- **Dynamic code execution:** no

*"Yes" means the capability is present in the source — more access means more to trust, not that it is unsafe.*


## Versions

- **0.1.0** — security scan: passed — Imported from the upstream source.

## Links

- Listing page: https://agentstack.voostack.com/l/mcp-nagstler-mcp-on-ruby
- Seller: https://agentstack.voostack.com/s/nagstler
- Browse the marketplace: https://agentstack.voostack.com/browse

---
Listed on AgentStack — the marketplace for AI agent skills and MCP servers. Every listing is security-reviewed. Creators keep 70%.
