CampaignHub Studio MCP Server
Provides tools for creating, scheduling, and publishing social campaigns with Instagram-specific image variants and captions, including idempotent publishing, rate-limit handling, and signed delivery webhooks.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@CampaignHub Studio MCP ServerCreate a campaign from my latest blog post about AI ethics for Instagram and X."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
CampaignHub Studio
Transform a single blog post into a complete multi-platform social campaign.
CampaignHub Studio is the reference implementation of the FlyRank capstone: given a
published post (title + body + URL), it generates per-platform image variants and
platform-tailored captions, then publishes them — immediately or on a schedule — through a
unified adapter interface, with idempotency, Retry-After handling, encrypted OAuth tokens,
signature-verified delivery webhooks and a crash-safe worker.
No real social API is ever called. All publishing goes to an in-repo fake platform. Verified by a test:
tests/security.test.ts › no real social platform is ever called.
Table of contents
Related MCP server: Oktopost MCP Server
Overview
A campaign is created from one blog post. The engine then:
Ingests content — paste text, upload
.md/.pdf/.docx, or pick a real published article from the built-in Blog library (Anthropic, Google DeepMind, Cloudflare feeds, enriched with Open Graph metadata).Generates one
SocialPostEntryper platform (Instagram, X, LinkedIn) with a tailored caption and a real PNG image variant at exact platform dimensions.Publishes each entry through a
SocialPublisheradapter that speaks to the fake platform with a deterministicIdempotency-Key, honouring429 Retry-After.Confirms delivery only when an HMAC-signed webhook arrives — the sole writer of the terminal
published/failedstate.
Captions are produced by the caption pipeline in this repository: it composes the shared
brand-voice + platform-fragment prompts, calls an LLM (OpenAI gpt-4o-mini) as the writing
step, then validates and normalises the result against each platform's constraints. If the
model is unavailable it falls back silently to the deterministic composer, so campaign
creation never fails because of the model.
Product Screenshots
1. Landing hero (light)

2. Sign in

3. Dashboard — Campaigns (start)

4. New campaign composer

5. Campaign library

6. Activity

7. Profile (account)

Also see docs/screenshots/ for dark-mode hero, locale toggle, reviewer evidence, and additional captures.
Architecture
Clean Architecture with a strict inward dependency rule: interfaces → application → domain.
No use case imports Postgres, sharp, fetch or the OpenAI SDK — only ports.
flowchart TB
subgraph interfaces["interfaces"]
UI["React dashboard<br/>src/routes/_authenticated/dashboard.tsx"]
FN["Server functions<br/>src/lib/flyrank.functions.ts"]
MCP["MCP server<br/>src/mcp/** → /api/public/mcp"]
FAKE["Fake platform<br/>/api/public/fake-platform/*"]
HOOK["Delivery webhook<br/>/api/public/webhooks/delivery"]
end
subgraph application["application (use cases)"]
UC["create / generate / schedule<br/>publish / retry / status / ingest"]
WORKER["Durable worker<br/>lease + claim"]
end
subgraph domain["domain (pure)"]
ENT["entities, captions,<br/>image geometry, ports"]
end
subgraph infra["infrastructure (adapters)"]
DB[("Postgres + RLS<br/>Supabase repositories")]
IMG["sharp / Jimp renderers"]
AI["OpenAI caption writer<br/>(+ deterministic fallback)"]
CRY["AES-256-GCM cipher<br/>HMAC signatures"]
PUB["Instagram / X / LinkedIn adapters"]
PARSE["md · pdf · docx parsers"]
end
UI --> FN --> UC
MCP --> UC
WORKER --> UC
UC --> ENT
UC --> DB & IMG & AI & CRY & PUB & PARSE
PUB -->|Bearer + Idempotency-Key| FAKE
FAKE -.->|signed webhook| HOOK --> UCLayer rules
Layer | May import | Never imports |
| nothing but config + itself | I/O of any kind |
|
| Supabase, sharp, fetch, OpenAI |
| domain ports it implements | application, interfaces |
| application use cases | infrastructure internals |
Adding a fourth platform = one platform spec + one voice block + one adapter class + one registry entry.
Features
Content ingestion — paste,
.md,.pdf(unpdf),.docx(mammoth), or the curated blog library with source filters, real article imagery and text previews.Per-platform image variants — real PNG bytes at Instagram
1080×1080, X1600×900, and LinkedIn1200×627, produced bysharp(native runtime) orJimp(serverless), from one shared pure-geometry composition with safe-zone enforcement. Optional OpenAI image generation with SVG fallback.Platform-tailored captions — content-first prompt pipeline (shared brand voice + per-platform fragments + optional brand tone and output language) with OpenAI
gpt-4o-minias the writing step; deterministic composer as fallback. Captions reference the source article, not generic promo boilerplate.Unified publisher interface —
SocialPublisherport, three fake adapters; application code never names a transport.Idempotency — deterministic key
flyrank:{campaignId}:{platform}, enforced by a unique DB constraint and by the fake platform. Publish twice, retry after a timeout → one post.Rate limiting —
429+Retry-Afterhonoured, exponential backoff floor, capped attempts, every attempt recorded inpublish_attempts.Durable scheduling — due rows claimed with a short
lease_until; a crashed worker's claims expire and are replayed under the same idempotency key → zero duplicates.Signed delivery webhooks — Stripe-style
t=…,v1=…HMAC-SHA256, replay window, timing-safe compare. Forged →400, state unchanged.Encrypted OAuth tokens — AES-256-GCM, fresh random IV per write, redaction helper for logs, no plaintext token column anywhere.
AI cost meter — every OpenAI call records estimated USD spend per user in
ai_usage_records(Postgres); dashboard badge + sidebar panel;AI_BUDGET_USDguard falls back to deterministic captions / SVG images when the budget is exhausted.Automatic background worker — polls Postgres on server boot (
WORKER_ENABLED,WORKER_POLL_INTERVAL_MS); scheduled posts publish without a manual dashboard tick.Multi-tenant auth — email/password sign-in (
/auth), every row scoped byuser_idunder RLS.Public landing — marketing page at
/with EN/TR i18n, hero visuals, scroll animations, and MCP positioning aligned withPOST /api/public/mcp.Campaign management UI — dashboard with unified coral OKLCH palette (light/dark toggle), variant carousel (one platform at a time), live status timeline, manual caption editing, optimistic delete with a 10-second undo toast, demo control rail.
Standalone MCP server — vendor-neutral JSON-RPC MCP interface over the same use cases.
Technology stack
Concern | Choice |
Language | TypeScript (strict) |
Framework | TanStack Start v1 (React 19, Vite 7), file-based routing + server functions |
Data | Postgres (Supabase) with RLS, SQL migrations |
Storage | Private bucket for generated PNGs, per-user paths |
Imaging |
|
Parsing |
|
AI captions | OpenAI |
Validation |
|
Crypto | Node |
UI | Tailwind CSS v4, shadcn/ui, sonner |
Tests | Vitest |
MCP | Hand-rolled JSON-RPC 2.0 server, depends only on |
Installation
git clone <repository-url>
cd campaignhub-studio
npm install # or: bun installRequires Node.js 22+ (recommended). Node 20 works for local dev — the ws package
backfills WebSocket for Supabase on the server. Install with npm install (or bun install).
Docker (PostgreSQL + Redis + app)
Self-contained local stack with Supabase-compatible Postgres, Redis, GoTrue, PostgREST and the app:
cp .env.docker.example .env.docker
docker compose --env-file .env.docker up --buildSupabase API (local): http://localhost:54321
Redis: localhost:6379
After the stack is up, seed demo data:
npm run seed # uses .env — point SUPABASE_* at http://localhost:54321 for DockerEnvironment setup
cp .env.example .envEvery variable and its purpose is documented in .env.example. Copy the example file,
then fill in your own Supabase project credentials (not Lovable Cloud):
cp .env.example .envRequired for database and auth:
Variable | Purpose |
| Project API URL ( |
| Publishable (anon) key — safe in the browser; RLS enforces access |
| Browser-visible copy of |
| Browser-visible copy of |
| Project ref (subdomain) — used for MCP OAuth discovery |
| Server-only secret — sign-up (no email confirm), webhooks, privileged server work |
Optional but recommended before deployment:
Variable | Purpose |
| AES-256-GCM key for OAuth tokens at rest ( |
| HMAC secret shared with the fake platform ( |
| LLM captions + optional AI images; missing key falls back to deterministic composer / SVG |
| Per-user session AI spend cap (USD); exhausted budget skips paid API calls |
| Set |
| Background worker poll interval (default |
When TOKEN_ENCRYPTION_KEY / WEBHOOK_SIGNING_SECRET are absent, clearly labelled dev
fallbacks are derived so local development boots without secrets. .env is git-ignored.
Supabase setup
Create a project at supabase.com.
In Project Settings → API, copy the project URL, publishable key and service-role key.
In SQL Editor, run
supabase/flyrank-full-schema.sql. The script is idempotent — safe to run on a fresh project and safe to re-run to upgrade an existing one. It creates all tables with RLS (includingai_usage_recordsfor per-user AI spend), thecampaign-imagesstorage bucket, the auth→profile trigger, theclaim_due_entriesworker RPC, and thelinkedinplatform enum value. (Alternatively applysupabase/migrations/*.sqlin timestamp order.)Enable Authentication → Providers → Google if you want Google sign-in; add your app redirect URL (
http://localhost:8080for local dev).Paste the values into
.envand start the app.
Google OAuth can be enabled in Supabase Auth when needed; the auth UI currently exposes
email/password only. Supabase Auth is used directly (not @lovable.dev/cloud-auth-js).
Sign-up without email confirmation: new accounts are created server-side via
signUpAccount (src/lib/auth.functions.ts) using the service-role key with
email_confirm: true, then the client signs in immediately — no confirmation email.
SUPABASE_SERVICE_ROLE_KEY must be set in .env. Optionally disable Confirm email in
Supabase Dashboard → Authentication → Providers → Email for consistency.
Running locally
npm run dev # http://localhost:8080 — background worker starts automatically
npm run seed # automated demo user + campaign (requires service role in .env)
npm run typecheck # tsc --noEmit — must stay at zero errors
npm run test # vitest — 24 files, 131 tests, no network/DB required
npm run test:watch # vitest in watch mode
npm run lint
npm run buildSign up on /auth, then land on /dashboard. The public marketing page is at /.
API overview
The dashboard talks to the server through typed server functions
(src/lib/flyrank.functions.ts), not REST — one transport, one auth path, no hand-written
fetch layer:
Server function | Purpose |
| content library CRUD |
| curated published-post feed |
| create campaign + captions + image variants |
| manual edits, deletion |
| regenerate assets |
| lifecycle |
| campaigns, entries, signed image URLs, webhook events, AI spend snapshot |
| demo controls (force 429, run a worker tick) |
Public HTTP routes (external callers, no session):
Method | Path | Purpose |
|
| fake publish: Bearer auth, idempotency, 429/Retry-After, async signed webhook |
|
| inspect fake-platform state |
|
| signed delivery webhook — only writer of terminal status |
|
| MCP JSON-RPC endpoint ( |
|
| RFC 9728 discovery for MCP clients |
|
| same metadata, RFC 9728 §3.1 path-suffixed form |
All inputs are validated with zod; invalid input returns 400 with the issue list, never a 500.
MCP tools
list_posts, create_post, create_campaign, list_campaigns, get_campaign,
campaign_status, schedule_campaign, publish_campaign, retry_campaign — each a thin
delegate to a use case in src/application/. The MCP layer holds no business logic, writes no
captions and calls no model. The set is self-sufficient: list_posts / create_post yield the
postId that create_campaign requires, so a client never needs the web UI to get started.
Responses are wire views (src/mcp/views.ts), not raw rows: server-internal fields
(userId, idempotencyKey, leaseUntil) are dropped and post bodies truncated, because a tool
result is read by a model with a finite context window. Listings take a limit (default 25).
Transport hardening on POST /api/public/mcp: bearer token verified against the auth server on
every request (revocation takes effect immediately), cross-origin browser callers refused,
JSON-RPC batches capped at 50 messages and executed in order.
Authenticate with Authorization: Bearer <access token>; every query runs under the caller's
RLS scope. Consent screen: /oauth/consent.
Connecting a client. Protected-resource metadata (RFC 9728) is served at both the root and path-suffixed well-known URLs, but Supabase Auth publishes no RFC 8414 authorization-server metadata and no dynamic client registration, so a client that insists on fully automatic OAuth discovery cannot complete the handshake yet. Pass an access token directly until that lands.
Project structure
src/
domain/ pure core — zero I/O
entities.ts BlogPost, Campaign, SocialPostEntry, idempotency key,
backoff, status derivation
captions.ts deterministic caption composer
image-composition.ts crop geometry, safe-zone fit, SVG composition
ports.ts repository / publisher / renderer / parser interfaces
application/ use cases, depend only on ports
campaign-usecases.ts create, generate captions + images, edit, delete
publish-usecases.ts publish, retry, idempotency, 429 backoff, attempts
delivery-usecases.ts signed webhook ingestion → terminal status
worker.ts durable lease/claim scheduler
ingest-content.ts paste / md / pdf / docx normalisation
import-library-post.ts curated blog-library import
infrastructure/ adapters (the only place with I/O)
persistence/supabase-repositories.server.ts
publishing/adapters.server.ts, fake-platform-transport.server.ts
imaging/renderers.server.ts sharp + Jimp
parsing/document-parser.server.ts unpdf + mammoth
crypto/token-cipher.server.ts, webhook-signature.server.ts
ai/ai-cost-meter.server.ts, ai-cost-meter-db.server.ts
ai/openai-caption-writer.server.ts, openai-art-director.server.ts, openai-image-generator.server.ts
worker/background-worker.server.ts
feeds/blog-library.server.ts
storage/image-store.server.ts
context.server.ts composition root (dependency injection)
interfaces
routes/ dashboard, auth, OAuth consent, public API routes
mcp/ JSON-RPC server + 9 tool delegates + wire views
components/campaign/ composer, variant gallery/carousel, AI spend panel, status chips
config/ platform specs, prompt fragments
supabase/migrations/ schema, grants, RLS, indexes
tests/ vitest suites (see Testing below)
tests/helpers/ in-memory AppContext fakes for use-case testsTesting
npm run test # single run
npm run test:watch # watch modeAll tests are deterministic: no network, no live database, no API keys required. Vitest runs
in Node with @/ path aliases (vitest.config.ts).
Suite | Covers |
| exact per-platform geometry, safe-zone containment, aspect ratio, caption divergence/limits/hashtag budget/determinism, idempotency key, |
|
|
|
|
|
|
|
|
|
|
|
|
| fake Instagram / X / LinkedIn adapters — accepted, duplicate, 429, 4xx mapping |
|
|
| JSON-RPC |
| MCP wire views — internal fields dropped, post body truncated |
|
|
|
|
| real PNG bytes decoded from the IHDR chunk at exact platform dimensions |
| AI spend tracking, budget guard, caption fallback when budget exhausted |
| AI spend snapshot shape for dashboard |
| capstone acceptance probes 1–4 (idempotency, 429, crash-resume, webhook trust) |
| multi-language caption fragments (EN, TR, DE, …) |
| AES-256-GCM round-trip, fresh IV per write, auth-tag tamper rejection, log redaction, webhook signature accept/forge/tamper/replay, repo-wide scan proving no real platform endpoint is referenced |
Use-case tests build an in-memory AppContext via tests/helpers/mock-app-context.ts so
application logic is tested without Postgres.
Behaviours that need a live database and worker (duplicate publish → one post, crash-resume,
forged webhook → 400) are exercised through the dashboard demo rail; see
EVIDENCE.md for the reviewer walkthrough of each one.
Demo walkthrough
Create — pick an article in the Blog library (or paste/upload one) → Generate campaign. Three platform variants (Instagram, X, LinkedIn) appear in a carousel with platform tabs; captions are article-specific and differ structurally per platform.
Schedule — set a time in the future, then run a worker tick from the demo rail; the status chips flip
queued → publishing.Idempotency — hit Publish now repeatedly;
GET /api/public/fake-platform/x/postsstill holds exactly one post per platform.Rate limiting — Force 429 ×2 → publish → the attempts drawer shows the rate-limited attempts with the honoured
Retry-After, then success.Webhooks — a forged webhook returns
400and changes nothing; the genuine signed webhook flips the entry to Published.Crash safety — interrupt mid-publish and tick again: the expired lease is reclaimed and the same idempotency key collapses the replay into the original post.
Design decisions
Full rationale in DECISIONS.md; the highlights:
TanStack Start server functions instead of Express/Fastify — the app is already a TanStack Start project; a second HTTP process would add a deploy target and CORS for no gain.
Postgres + RLS instead of a local file/SQLite store — tenant isolation is a graded requirement, and the lease/claim scheduler wants real transactional
UPDATEs.sharpprimary,Jimpfallback, no custom PNG encoder — the deployment target is a Worker where sharp's native binary cannot load; shared pure geometry keeps both paths byte-identical in dimensions.Deterministic idempotency keys — a random key would make a post-crash replay look like a new publish.
Webhook-owned terminal status — with one documented exception: after
MAX_PUBLISH_ATTEMPTSwith no platform acceptance, no webhook will ever arrive, so the worker marksfailedlocally.LLM captions with deterministic fallback — quality when the model is available, availability when it is not.
MCP as an interface, not a feature — every tool delegates to an existing use case.
Limitations
The fake platform's memory is process-local by design; it is a test double, not the system under test.
The image composition is generated artwork (gradient + subject + typography) driven by the post, not a photo pipeline — the graded behaviour is geometry, dimensions and safe zones.
PDF extraction is text-only; scanned/image PDFs yield no body text.
Blog-library previews depend on third-party sites staying reachable.
Three platforms are implemented (Instagram, X, LinkedIn); adding more follows the same adapter pattern.
LLM caption quality varies by model availability; the deterministic fallback is intentionally plainer.
AI spend is estimated (not invoice-accurate); persisted per user in
ai_usage_records.
Future work
Within the capstone scope, and explicitly not started (all stretch goals per the brief): real-platform integration, brand templating, A/B captions, analytics loopback and an approval workflow. Anything beyond that is out of scope for this submission.
License
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI assistants to manage scheduled social media posts and content automation across multiple platforms (X/Twitter, Reddit, LinkedIn, Instagram, TikTok, YouTube). Supports organizing campaigns into tracks, scheduling posts with natural language, and automating content workflows with local SQLite storage.712MIT

Oktopost MCP Serverofficial
AlicenseNot gradedqualityDmaintenanceEnables comprehensive social media management through Oktopost's REST API, including campaign creation, content scheduling, post management, workflow approvals, employee advocacy, and media asset handling across connected social profiles.58MIT- AlicenseNot gradedqualityBmaintenanceThe best free social media publishing and scheduling API. Publish to 11 platforms from a single API call. Schedule posts, upload media, track analytics, and automate your social media workflow.1MIT
- FlicenseNot gradedqualityCmaintenanceEnables AI agents to create, schedule, and manage social media posts across 10 platforms via a unified API.
Related MCP Connectors
Schedule and publish social posts to 11 platforms with media, campaigns, analytics and AI captions
Publish, schedule, and manage social media posts across major platforms via the Postproxy API.
Schedule, publish, and analyze social posts on TikTok, Instagram, YouTube, X, Threads, LinkedIn.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/Sudeozubek/flyrank-capstone-social-studio'
If you have feedback or need assistance with the MCP directory API, please join our Discord server