ai newsDi., 1. Dez.

KI-Agenten erstellen über die Hälfte der Beiträge: Entwickler baut MCP-Server in seine Rails-SaaS ein

Der Betreiber des Social-Media-Scheduling-Dienstes RobinReach hat einen MCP-Server ergänzt, über den Nutzer ihre Accounts direkt aus Claude oder ChatGPT verwalten können. Geplant als Nischenfeature, entpuppte sich die Anbindung als deutlich größere Nutzung.

dev.toDonnerstag 12:28 · 26.11.DE5 Min. Lesezeit
Bild: dev.to

Ich betreibe RobinReach, eine auf Rails basierende SaaS für die Planung von Social-Media-Beiträgen. Vor einiger Zeit habe ich einen MCP-Server ergänzt, damit Nutzer ihre Social-Accounts direkt über Claude oder ChatGPT verwalten können.

Anfangs hielt ich das für ein Nebenfeature für einige technische Nutzer. Dann habe ich eine kurze Abfrage auf unserer Posts-Tabelle für die letzten drei Monate laufen lassen:

Post.where(created_at: 3.months.ago..).group(:creation_source).count Enter fullscreen mode Exit fullscreen mode Das Ergebnis: 54,1 % aller Posts wurden über MCP erstellt. Unsere REST API lag bei 13,7 %. Web-App und integrierte Automatisierungen zusammen kamen auf 32,2 %.

KI-Agenten erstellen auf unserer Plattform also inzwischen mehr Inhalte als unser eigenes Dashboard. Hier ist, wie der MCP-Server aufgebaut ist, und die fünf Dinge, die ich jedem Rails-Entwickler mit auf den Weg geben würde, der gerade einen bauen will.

Nichts Exotisches. Es ist ein ganz normaler Rails-Endpoint, der MCPs JSON-RPC spricht und auf derselben App aufsetzt, die auch Dashboard und REST API antreibt.

Claude / ChatGPT | JSON-RPC über HTTP (tools/list, tools/call) v Mcp::V1::MessagesController <- Auth: API-Schlüssel oder OAuth-Token | v Mcp::RobinreachToolRegistry <- ein Schema pro Tool | v Bestehende Service-Objekte <- derselbe Code, den Dashboard und API nutzen | v Sidekiq-Jobs <- Publishing, Medien, Analytics | v Facebook, Instagram, LinkedIn, X, TikTok, YouTube, Threads, Bluesky... Enter fullscreen mode Exit fullscreen mode Der Stack ist absichtlich unspektakulär: Rails, Postgres, Sidekiq auf Redis, Doorkeeper für OAuth. Das Spannende steckt komplett in den Entscheidungen, also kommen wir dazu.

Der größte Fehler, den man machen kann, ist, "MCP-Versionen" der eigenen Features zu schreiben. Jedes MCP-Tool in RobinReach ist ein dünner Adapter über einem Service-Objekt, das bereits existiert: derselbe PostCreator, dieselben Validatoren, dieselben Publish-Jobs, die auch das Dashboard nutzt.

Wenn deine Controller fett sind und die Logik in ihnen steckt, behebe das zuerst. Ein MCP-Server ist ein hervorragender Anlass, endlich Service-Objekte zu extrahieren.

Meine erste Version hatte einige große Tools mit einem Action-Parameter, der das Verhalten umschaltete. Es funktionierte, aber Modelle wählten die falsche Aktion, schickten falsche Felder und wurden von riesigen Schemas verwirrt. Die Aufteilung in viele kleine Tools, jedes mit seinem eigenen fokussierten Schema, machte die Agenten spürbar zuverlässiger.

# Für den Artikel vereinfacht, kein Produktivcode module Mcp class ToolRegistry TOOLS = { "posts_create" => { description: "Einen Post auf einem oder mehreren Social-Profilen erstellen und planen. " \ "Rufe vorher account_profiles auf, um gültige Profil-IDs zu erhalten. " \ "Lasse publish_time weg, um als Entwurf zu speichern.", input_schema: { type: "object", properties: { content: { type: "string" }, profile_ids: { type: "array", items: { type: "string" } }, publish_time: { type: "string", description: "ISO 8601 mit Zeitzone" } }, required: %w[content profile_ids] }, handler: ->(params, brand) { PostCreator.new(brand, params).call } } #...

Dutzende weitere }.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 Enter fullscreen mode Exit fullscreen mode Ein paar Regeln, die ich heute befolge:

Die erste Version authentifizierte sich mit denselben API-Schlüsseln wie unsere REST API. Das ist der schnellste Weg zum Launch und für Entwickler völlig in Ordnung, die einen Schlüssel in eine Config-Datei einfügen.

Aber normale Nutzer fügen keine Schlüssel ein. Um in ChatGPT und Claude als richtiger Connector aufzutauchen, brauchst du OAuth. Ich habe es mit Doorkeeper ergänzt, parallel zur bestehenden Schlüssel-Authentifizierung, sodass für bereits verbundene Nutzer nichts kaputtging.

Die Designregel dahinter: Scope einmalig auf der Auth-Schicht auflösen. Wenn ein Tool läuft, erhält es eine Brand, die es anfassen darf, und muss selbst niemals Berechtigungen prüfen. Weniger Stellen, an denen etwas schiefgehen kann.

Einen Agenten dazu zu bringen, einen Text-Post zu planen, ging schnell. Ihm beizubringen, das richtige Bild anzuhängen, war ein langer Schwanz von Sonderfällen.

Das Kernproblem: Die Dateien des Agenten liegen dort, wo dein Server sie nicht erreichen kann. Ein Kunde erzählte mir, dass ChatGPT seine Posts problemlos planen konnte, aber nicht die Bilder anhängen konnte, die es gerade im Chat generiert hatte. Diese Bilder hatten keine öffentliche URL, und meine Tools akzeptierten nur URLs.

Dann kommen die Plattformen mit ihren eigenen Eigenheiten hinzu. Instagram schlägt zum Beispiel manchmal fehl, wenn es ein Bild abrufen will, das Sekunden zuvor auf ein CDN hochgeladen wurde, und eine Minute später mit exakt derselben URL erfolgreich ist. Die Lösung war, diesen spezifischen Fehler mit exponentiellem Backoff innerhalb jeder Instagram-Service-Klasse zu wiederholen, nicht den gesamten Job.

Die allgemeine Lektion: Jeder Medialschritt, der mehr als ein paar Sekunden dauern kann, sollte ein Background-Job mit einem Status-Tool sein. Agenten kommen mit Polling zurecht. Sie kommen nicht mit Timeouts zurecht.

Ein Mensch plant ein paar Posts, schaut sich um, holt Kaffee. Ein Agent, der aufgefordert wird, "den nächsten Monat für alle meine Brands zu planen", feuert in Sekunden eine Welle von Aufrufen ab. Deine App muss darauf vorbereitet sein.

MCP ist kein Nischenexperiment mehr. OpenAI, Google und Microsoft unterstützen es alle, es wird von der Agentic AI Foundation der Linux Foundation verwaltet, und die offizielle MCP Registry verzeichnete im Oktober 2026 über 47.000 aktive Server (Digital Applied). Für die Rails-Fraktion: Das offizielle Ruby-SDK ist eines der Tier-1-SDKs des Projekts.

Meine Erkenntnis aus unseren Zahlen: Deine Nutzer verbringen ihren Tag bereits in einem KI-Assistenten. Wenn dein Produkt von dort aus nicht erreichbar ist, kopieren sie zwischen Tabs hin und her oder finden ein Tool, das es ist.

Ich habe viel Arbeit in unser Dashboard gesteckt. Dann kam mehr als die Hälfte unserer Inhalte über einen JSON-RPC-Endpoint, den ich fast nicht gebaut hätte.

Das Dashboard bleibt wichtig. Die Leute nutzen es zum Prüfen, Freigeben und Kontrollieren der Ergebnisse. Aber die tägliche Arbeit wandert in den Chat, und die Produkte, die das einfach machen, werden gewinnen.

Wir haben die vollständige Auswertung mit Methodik und den implications für Marketer im RobinReach-Blog veröffentlicht: https://robinreach.com/articles/ai-agents-now-create-54-of-our-social-media.

Wenn du einen MCP-Server in Rails baust und an einer dieser Stellen festhängst, schreib einen Kommentar. Ich teile gerne mehr.

Automatisch übersetzt. Das Original auf Englisch ist unten aufklappbar.

Original (Englisch) anzeigen

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 Enter fullscreen mode Exit fullscreen mode 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.

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... Enter fullscreen mode Exit fullscreen mode 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.

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.

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.

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.

# 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 Enter fullscreen mode Exit fullscreen mode A few rules I now follow:

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 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.

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.

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.

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.

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.

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.

Originaltitel: I Added an MCP Server to My Rails SaaS. Now AI Agents Create 54% of Our PostsQuelle: dev.to (dev.to). Original öffnen