
Evil Martians · 14 min readBackend & APIs
Building Uscreen’s remote, multi-tenant MCP server inside a Rails app
The post explains how to embed a Model Context Protocol server inside a Rails application, detailing authentication, tool design, and request scoping. It shows concrete steps for building reusable tools that leverage existing Rails models and how to preview destructive changes. This approach simplifies AI integration for creators without extra installs.
- Use Doorkeeper for OAuth 2.1 and mcp gem for stateless transport.
- Wrap each tool in Mcp::ApplicationTool to auto‑handle scopes and errors.
- Preview destructive actions by default to show impact before execution.