6.0 KiB
status, source, generated, implemented
| status | source | generated | implemented |
|---|---|---|---|
| IMPLEMENTED | gstack /plan-ceo-review | 2026-05-13 | 2026-05-13 |
CEO Plan: SquareMCP v2 — Complete Foundation + MCP-Native Platform
Generated by /plan-ceo-review on 2026-05-13 Branch: main | Mode: SELECTIVE EXPANSION Repo: garfield/hermes-mcp
Context
hermes-mcp is the backend for SquareMCP — a unified MCP gateway for 9 social/messaging platforms (WhatsApp, LinkedIn, Telegram, Discord, Instagram, Twitter, TikTok, Facebook, Obsidian). Multi-tenancy was added 2026-05-08. SaaS web app was shipped 2026-05-13. YC application is being prepared.
All 10 scope items were implemented and deployed 2026-05-13. Commit: 61dab40.
What Was Built (v2)
Step 1 — MCP session threading + plan limit enforcement
createMcpServer(customer?)pattern: customer resolved fromrequireAuthmiddleware, threaded throughsessionCustomersMap into MCP tool callshandleToolCallgates oncheckLimit(customer.id, customer.plan)at entry — returnsisError: truewhen over limit- Usage platform attribution fixed: known-prefix matching replaces broken
name.split('_')[0] stripAccountParam(tool)deep-clones Tool objects, removesaccountenum for multi-tenant sessions
Step 2 — Invoice fixes + cron
generateMonthlyInvoice: billing period uses previous month (not current month bug fixed)- Idempotency: UNIQUE constraint on
(customer_id, period_start)+ duplicate cleanup migration - Invoice number:
crypto.randomBytes(4).toString('hex')(notMath.random()) emailInvoice()sends HTML invoice via system SMTP- Cron
0 9 1 * *with compare-delete Redis lock (SET NX+ Lua DEL)
Step 3 — Email multi-tenancy + platform coverage
src/imap.ts/src/smtp.tsacceptcustomer?param, useEmailCredentials.smtpHost/smtpPort- TikTok, Facebook, Snapchat added to growth/enterprise plan tiers
Step 4 — Analytics dashboard
GET /api/usage/daily→{ date, count }[]for Chart.js- Platform breakdown bars + daily sparkline in SaaS app
Step 5 — Platform health checks
src/multitenancy/platform-health.ts: all 11 platforms checked in parallel- Redis cache key
health:{customerId}:{platform}, 10-min TTL - Status values:
healthy | expired | disconnected | unknown - Token refresh on near-expiry (60s buffer) via dynamic import to avoid circular dep
Step 6 — Dynamic tool schema filtering
stripAccountParamexported fromsrc/tools.ts- Multi-tenant sessions get tools array without internal
accountparam
Steps 7–8 — OAuth hardening + DCR browser flow
- Atomic auth code consumption:
UPDATE SET used=TRUE WHERE used=FALSE+affectedRowscheck customer_idthreaded through auth codes → tokensgetTokenCustomer()insrc/oauth.tsisValidRedirectUri()withhttp://localhost:*wildcard supportensureOAuthAppRegistered()on startup (ON DUPLICATE KEY UPDATE)GET /oauth/connect-mcp→ server-side redirect keeps client_id off frontend- Callback page renders MCP client config snippets
Step 9 — Inbound webhooks
src/webhooks/delivery.ts: HMAC-SHA256 (X-SquareMCP-Signature: sha256=...)- 3× exponential retry: 1s → 4s → 16s
- Redis DLQ
webhook:dlq:{customerId}with 7-day TTL - SSRF protection: blocks private IPs, localhost, .local, non-http schemes
GET/POST/DELETE /api/webhooks/config,GET /api/admin/webhooks/dlq/:customerId
Step 10 — Developer docs
- Static HTML + GitHub Pages in
/docs - Pages: index, getting-started, platforms, agent-tutorial
- Full Node.js MCP agent code example with Anthropic SDK
Vision
10x version: An AI agent is set up once, automatically discovers all the user's social platforms via MCP tool listing, and can publish to all 9 platforms without writing a single API client. Setup is a browser OAuth flow. Monthly invoices arrive automatically. Revenue scales to 100+ customers with zero marginal billing work.
Delight opportunities shipped:
- Green/yellow/amber health indicators per platform in dashboard
- Platform-by-platform usage chart
- Browser OAuth for MCP clients — no API key config files
- Invoice in email inbox
- Inbound message routing — reactive AI agents
Landscape
All competitors (Ayrshare, Socialync, Zernio, Bundle.social) are REST-first adding MCP as afterthought. Cloudflare, Zuplo, Apigee are doing enterprise MCP governance but not social. SquareMCP is uniquely positioned as MCP-native from day one — this is the real moat.
NOT in Scope (deferred)
- Stripe/payment processing (invoicing-first until revenue validates)
- Team workspaces / multi-user accounts
- Connector marketplace / SDK for third-party connectors
- Mobile app
- Token refresh flows for all platforms (LinkedIn, Twitter, TikTok, Instagram done; others deferred to v1.2)
- Customer-facing webhook DLQ drain (deferred to v2.1)
- Session hijack protection (store
{ transport, customerId }, return 403 on mismatch — v2.1)
Dream State Delta
BEFORE v2 (2026-05-13) AFTER v2 12-MONTH IDEAL
MCP server: single-tenant → MCP server: multi-tenant → 50+ paying customers
SaaS app: no metering + metering enforced Stripe or equivalent
Invoices: manual + auto monthly invoices Team workspaces
No analytics + analytics dashboard Analytics product
No platform health + health checks + refresh Connector marketplace
API key setup only + OAuth MCP connections SDK for devs
Publish-only + inbound webhooks Reactive agent platform
No docs + developer docs site Category-defining docs
Review Verdicts
| Review | Status |
|---|---|
| CEO Review (/plan-ceo-review) | CLEARED |
| Outside Voice — Codex (CEO) | 18 findings → all resolved |
| Eng Review (/plan-eng-review) | CLEARED |
| Outside Voice — Codex (Eng) | 20 findings → all resolved |
0 unresolved issues. Implemented and deployed 2026-05-13.