Your Rails 7+ app already routes JSON traffic through controller actions backed by strong parameters and Active Model validations. Here's how to expose those actions as MCP tools an agent can call — without abandoning Rails conventions.
wmcp.sh is not affiliated with 37signals, the Rails Foundation, or Anthropic. Rails and rswag are open-source projects.
Controllers under app/controllers/api/, routes mapped in config/routes.rb, request specs in spec/requests/ exercising every endpoint. Devise + Doorkeeper or a JWT scheme on top.
A Model Context Protocol server with typed tool schemas. rswag generates OpenAPI 3 from your request specs; wmcp.sh ingests it and emits MCP at https://wmcp.sh/mcp/<your-id>. Controllers untouched.
Standard Rails 7 JSON API controller plus an rswag spec emitting OpenAPI.
# app/controllers/api/v1/orders_controller.rb
module Api::V1
class OrdersController < ApplicationController
before_action :authenticate_user!
def update
order = Order.find(params[:id])
if order.update(order_params)
render json: order, status: :ok
else
render json: { errors: order.errors }, status: :unprocessable_entity
end
end
private
def order_params
params.require(:order).permit(:status, :tracking_number)
end
end
end
# spec/requests/api/v1/orders_spec.rb — rswag emits OpenAPI from this
require 'swagger_helper'
RSpec.describe 'Orders API', type: :request do
path '/api/v1/orders/{id}' do
patch 'Update order status' do
tags 'Orders', 'agent'
consumes 'application/json'
parameter name: :id, in: :path, type: :string
parameter name: :order, in: :body, schema: { type: :object, properties: { status: { type: :string } } }
response '200', 'updated' do run_test! end
end
end
end
# rake rswag:specs:swaggerize publishes swagger/v1/swagger.yaml at /api-docs/v1/swagger.yaml
# curl 'https://wmcp.sh/api/v1/tools?url=https://acme.example.com/api-docs/v1/swagger.yaml&tag=agent'
| Capability | Hand-rolled | wmcp.sh + rswag |
|---|---|---|
| Tool schemas tied to tests | ⚠️ Schema and tests drift independently | ✅ rswag derives spec from request specs — tests are the schema |
| Strong params + validations | ✅ Untouched (server-side concern) | ✅ Untouched; spec documents the wire shape, controller enforces |
| Authentication | ⚠️ Re-implement Devise/Doorkeeper at the MCP layer | ✅ securitySchemes declared in swagger_helper flow through |
| MCP transport (Streamable HTTP, SSE) | ⚠️ You build it | ✅ Served at https://wmcp.sh/mcp/<your-id> |
| Per-action gating | ⚠️ Manual | ✅ Tag rswag operations + &tag=agent ingest filter |
| CI integration | ⚠️ Separate sync step | ✅ rake rswag:specs:swaggerize + re-ingest in CI |
securitySchemes in swagger_helper.rb. wmcp.sh reads the spec and forwards credentials. Devise API tokens map to apiKey, Doorkeeper to oauth2, JWT to bearerAuth.spec/requests/ is invisible to MCP clients. Tag and filter for finer control.Audit your controllers, wire up rswag, deploy MCP at mcp.yourbrand.com. Starter $499 one-time setup; Managed Retainer $999/mo for ongoing maintenance; Enterprise $4,999+/mo for SLA + private deploy.