I run RobinReach, a social media scheduling SaaS built on Rails. A while back I added an MCP server so people could manage their social accounts from Claude or ChatGPT.
I thought of it as a side feature for a few technical users. Then I ran a quick query on our posts table for the last three months:
Post.where(created_at: 3.months.ago..).group(:creation_source).count The result: 54.1% of all posts were created through MCP. Our REST API was 13.7%. The web app and built-in automations together were 32.2%.
So AI agents now create more content on our platform than our own dashboard does. Here's how the MCP server is built, and the five things I'd tell any Rails dev about to build one.
What I built
Nothing exotic. It's a regular Rails endpoint that speaks MCP's JSON-RPC, sitting on top of the same app that powers the dashboard and the REST API.
Claude / ChatGPT | JSON-RPC over HTTP (tools/list, tools/call) v Mcp::V1::MessagesController <- auth: API key or OAuth token | v Mcp::RobinreachToolRegistry <- one schema per tool | v Existing service objects <- same code the dashboard and API use | v Sidekiq jobs <- publishing, media, analytics | v Facebook, Instagram, LinkedIn, X, TikTok, YouTube, Threads, Bluesky... The stack is boring on purpose: Rails, Postgres, Sidekiq on Redis, Doorkeeper for OAuth. The interesting part is all in the decisions, so let's get into those.
Lesson 1: Don't build a second app
The biggest mistake you can make is writing "MCP versions" of your features. Every MCP tool in RobinReach is a thin adapter over a service object that already exists: the same PostCreator, the same validators, the same publish jobs the dashboard uses.
This paid off more than I expected:
- Fixes land everywhere. When I fixed a TikTok or Instagram publishing bug, MCP users got the fix the same minute dashboard users did.
- Validation is consistent. An agent can't create a post the UI would reject, because it hits the exact same rules.
- Refactors are safer. When I moved media delivery behind a CDN, I only had to check one path.
PostCreatormatches attached media by storage key, not by URL, so tool responses could switch to CDN URLs without breaking anything downstream.
If your controllers are fat and your logic lives in them, fix that first. An MCP server is a great excuse to finally extract service objects.
Lesson 2: Tool design is product design
My first version had a few big tools with an action parameter that switched behavior. It worked, but models picked the wrong action, sent the wrong fields, and got confused by giant schemas. Splitting it into many small tools, each with its own focused schema, made agents noticeably more reliable.
Here's the shape of it, simplified:
# Simplified for the article, not production code module Mcp class ToolRegistry TOOLS = { "posts_create" => { description: "Create and schedule a post on one or more social profiles. " \ "Call account_profiles first to get valid profile ids. " \ "Omit publish_time to save as a draft.", input_schema: { type: "object", properties: { content: { type: "string" }, profile_ids: { type: "array", items: { type: "string" } }, publish_time: { type: "string", description: "ISO 8601 with timezone" } }, required: %w[content profile_ids] }, handler: ->(params, brand) { PostCreator.new(brand, params).call } } # ...dozens more }.freeze def self.list TOOLS.map do |name, tool| { name:, description: tool[:description], inputSchema: tool[:input_schema] } end end def self.call(name, params, brand) tool = TOOLS.fetch(name) { raise UnknownToolError, name } tool[:handler].call(params, brand) end end end A few rules I now follow:
- Descriptions are your docs. The model reads them, not your help center. Say when to call the tool, what to call first, and what happens if a field is missing.
- Name tools by noun then verb.
posts_create,posts_reschedule,analytics_top_posts. Related tools group together and models find them faster. - Return errors an agent can act on. "profile_ids contains a Pinterest profile, but no board_id was given" gets fixed on the next call. "Validation failed" gets you a confused user.
- Give agents a dry run. A
posts_validatetool lets the model check a post before creating it, which cuts down on half-created content.
Lesson 3: Start with API keys, but plan for OAuth
The first version authenticated with the same API keys as our REST API. That's the fastest way to ship, and it's fine for developers pasting a key into a config file.
But normal users don't paste keys. To show up as a proper connector in ChatGPT and Claude, you need OAuth. I added it with Doorkeeper, alongside the existing key auth, so nothing broke for people already connected.
The part worth copying is the consent screen. When someone connects, they choose to give the assistant their whole account or a single brand. For agencies that's huge: you can let an assistant work on one client without it ever seeing the others. We do the same with API keys, where each brand can have its own key scoped to that brand only.
The design rule behind it: resolve scope once, at the auth layer. By the time a tool runs, it receives a brand it's allowed to touch, and it never has to check permissions itself. Fewer places to get it wrong.
Lesson 4: Text is easy, media is the hard part
Getting an agent to schedule a text post was quick. Getting it to attach the right image was a long tail of edge cases.
The core problem: the agent's files don't live where your server can reach them. A customer told me ChatGPT could schedule their posts fine, but couldn't attach the images it had just generated in the chat. Those images had no public URL, and my tools only accepted URLs.
So media ended up with several ways in:
- Public URL: the agent passes a link, a background job downloads it, and a status tool lets the agent poll until it's ready.
- From the chat: a dedicated tool that accepts the assistant's own file references, so images generated or uploaded in ChatGPT can go straight into a post.
- Direct upload: a signed upload URL for local files, created and finalized in two steps.
- Generated or found in-app: AI image generation and stock photo search as tools of their own.
Then the platforms add their own fun. Instagram, for example, sometimes fails to fetch an image that was uploaded to a CDN a second earlier, then succeeds a minute later with the exact same URL. The fix was retrying that specific error with exponential backoff inside each Instagram service class, not retrying the whole job.
The general lesson: any media step that can take more than a couple of seconds should be a background job with a status tool. Agents are fine with polling. They're not fine with timeouts.
Lesson 5: Agents are your most demanding power users
A human schedules a few posts, looks around, goes for coffee. An agent asked to "plan next month for all my brands" fires off a burst of calls in seconds. Your app needs to be ready for that.
Things that bit me or almost did:
- Synchronous uploads. One upload endpoint stored files inline on the request thread. A single upload was fine. A burst of them from one agent tied up Puma threads and caused timeouts that cleared on their own minutes later. Classic "works on my machine" bug that only appears under agent traffic.
- Rate limits. You need them, and you need to document them correctly. Agents read your docs literally.
- Batch tools. Instead of making the model call
posts_createtwenty times, a bulk tool that takes up to 20 posts per call is faster for everyone and easier on your server. - Queue priorities. Publishing has to stay fast no matter how many analytics or media jobs agents kick off. Give publishing its own Sidekiq queue and keep heavy work like video processing in a separate container.
- Cost controls on expensive tools. Anything that calls a paid AI API (image generation, video edits) needs per-plan limits, or one enthusiastic agent will show up on your bill.
Why this matters if you run a SaaS
MCP isn't a niche experiment anymore. OpenAI, Google and Microsoft all support it, it's governed by the Linux Foundation's Agentic AI Foundation, and the official MCP Registry listed over 47,000 active servers in October 2026 (Digital Applied). For Rails folks, the official Ruby SDK is one of the project's Tier 1 SDKs.
My takeaway from our numbers: your users already spend their day in an AI assistant. If your product isn't reachable from there, they'll either copy and paste between tabs or find a tool that is.
If you're starting out:
- Track the source of everything from day one. A simple
creation_sourcecolumn is how I found out any of this. Without it, I'd still think MCP was a side feature. - Start with read tools plus one write tool. "List my stuff" and "create one thing" covers a surprising amount of real use.
- Wrap your existing services. No new business logic in the MCP layer.
- Ship API keys first, OAuth second. Then get listed in the Claude and ChatGPT connector directories, because that's where non-technical users find you.
- Watch your logs, not just your metrics. The tool calls agents make tell you exactly which tools are confusing and which ones are missing.
Wrapping up
I put a lot of work into our dashboard. Then more than half of our content started arriving through a JSON-RPC endpoint I almost didn't build.
The dashboard still matters. People use it to review, approve and check results. But the daily work is moving into the chat, and the products that make that easy are going to win.
We published the full breakdown, with methodology and what it means for marketers, on the RobinReach blog: https://robinreach.com/articles/ai-agents-now-create-54-of-our-social-media.
If you're building an MCP server in Rails and get stuck on any of this, drop a comment. Happy to share more.
