Files
hermes-mcp/docs/styles.css
Garfield 61dab40585 feat(saas): SquareMCP v2 — multi-tenant MCP platform complete
Steps 0–10 of the v2 plan, 194 tests passing.

Core infrastructure
- Shared Redis client (src/redis.ts); all four Redis consumers migrated
- Vitest test harness with vitest.config.ts and npm test/test:watch scripts

Billing & invoicing (Steps 1–2)
- Monthly invoice generation with idempotency (MySQL uq_customer_period unique key)
- Cron job with Redis distributed lock (Lua compare-delete, 1-hr TTL)
- Invoice emailer via nodemailer (FETCHERPAY SMTP)
- Billing middleware: checkLimit gate in handleToolCall; platform attribution fix

Email multi-tenancy (Step 3)
- EmailCtx = Account | EmailCredentials; imap.ts + smtp.ts accept both
- resolveEmailCtx helper in tools.ts; all email tools use customer credentials

Analytics + platform health (Steps 4–5)
- Chart.js bar charts for platform breakdown and daily activity
- Token expiry check in getCredential with dynamic import refresh
- platform-health.ts: per-platform health probe with 10-min Redis cache
- GET /api/health/platforms; "Token expired" amber badge in dashboard

Tool schema filtering (Step 6)
- stripAccountParam deep-clones tool schemas; multi-tenant sessions never
  see the internal account enum

OAuth hardening (Step 7)
- Atomic auth code consumption: UPDATE SET used=TRUE, check affectedRows
- customer_id threaded through oauth_auth_codes → oauth_tokens
- getTokenCustomer(); requireAuth resolves req.customer from Bearer token
- Consent page requires authenticated session; redirect_uri validated
  against registered URIs; http://localhost:* loopback wildcard

DCR browser flow (Step 8)
- ensureOAuthAppRegistered() upserts pre-registered SquareMCP OAuth app
  on startup with redirect URIs for mcp-callback, localhost:*, claude-desktop,
  opencode
- GET /oauth/connect-mcp → server-side redirect (client_id off frontend)
- GET /oauth/mcp-callback → exchanges code, renders config snippet page
  with copy buttons for Claude Desktop and Codex CLI

Webhooks (Step 9)
- webhook_url + webhook_secret columns on customers
- deliverWebhook(): HMAC-SHA256 signing, 3× exponential retry (1s/4s/16s),
  Redis DLQ with 7-day TTL on total failure
- isValidWebhookUrl(): SSRF protection (blocks RFC-1918, localhost, .local)
- POST /api/webhooks/config (secret returned once), GET, DELETE
- GET /api/admin/webhooks/dlq/:customerId
- WhatsApp POST route uses express.raw() for raw body preservation
- Dashboard Webhooks tab with secret-once display and copy button

Developer docs (Step 10)
- docs/ static HTML site (GitHub Pages, no build pipeline)
- index.html: landing page with client + platform overview
- getting-started.html: tabbed MCP config for Claude Desktop, Codex CLI, opencode
- platforms.html: LinkedIn, TikTok, WhatsApp, Instagram, Twitter, Telegram guides
- agent-tutorial.html: complete Node.js agent (Anthropic SDK + MCP SDK),
  LinkedIn posting loop, extensions for multi-platform + inbound webhook reaction

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-13 23:43:56 -04:00

294 lines
6.3 KiB
CSS

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg: #0f0f10;
--surface: #1a1a1b;
--surface-hover: #222223;
--border: #2a2a2b;
--text: #e5e5e5;
--text-secondary: #888;
--accent: #10a37f;
--accent-hover: #0d8c6d;
--code-bg: #161617;
--radius: 10px;
}
body {
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
background: var(--bg);
color: var(--text);
line-height: 1.6;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
/* ── Nav ── */
.site-nav {
background: var(--surface);
border-bottom: 1px solid var(--border);
position: sticky;
top: 0;
z-index: 10;
}
.nav-inner {
max-width: 1100px;
margin: 0 auto;
padding: 0 24px;
height: 56px;
display: flex;
align-items: center;
gap: 32px;
}
.nav-logo {
display: flex;
align-items: center;
gap: 10px;
font-weight: 700;
font-size: 16px;
color: var(--text);
text-decoration: none;
}
.nav-logo-mark {
width: 28px;
height: 28px;
background: linear-gradient(135deg, var(--accent), #0d8c6d);
border-radius: 7px;
display: flex;
align-items: center;
justify-content: center;
color: #fff;
font-weight: 700;
font-size: 14px;
}
.nav-links {
display: flex;
gap: 4px;
flex: 1;
}
.nav-links a {
padding: 6px 12px;
border-radius: 6px;
font-size: 14px;
color: var(--text-secondary);
transition: all 0.15s;
}
.nav-links a:hover { color: var(--text); background: var(--surface-hover); text-decoration: none; }
.nav-links a.active { color: var(--text); background: var(--bg); }
.nav-cta {
background: var(--accent);
color: #fff !important;
padding: 7px 16px;
border-radius: 8px;
font-size: 13px;
font-weight: 600;
transition: background 0.15s;
}
.nav-cta:hover { background: var(--accent-hover) !important; text-decoration: none !important; }
/* ── Layout ── */
.page {
max-width: 860px;
margin: 0 auto;
padding: 56px 24px 96px;
}
.hero {
margin-bottom: 48px;
}
.hero h1 {
font-size: 36px;
font-weight: 700;
line-height: 1.25;
margin-bottom: 12px;
}
.hero p {
font-size: 18px;
color: var(--text-secondary);
max-width: 620px;
}
/* ── Section headers ── */
h2 {
font-size: 22px;
font-weight: 600;
margin: 48px 0 16px;
padding-top: 8px;
border-top: 1px solid var(--border);
}
h3 {
font-size: 17px;
font-weight: 600;
margin: 28px 0 10px;
color: var(--text);
}
p { margin-bottom: 14px; color: var(--text); }
ul, ol { padding-left: 20px; margin-bottom: 14px; }
li { margin-bottom: 6px; }
/* ── Code ── */
pre {
background: var(--code-bg);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px 24px;
overflow-x: auto;
margin: 16px 0;
position: relative;
}
code {
font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
font-size: 13px;
line-height: 1.7;
color: #d4d4d4;
}
p code, li code {
background: #2a2a2b;
padding: 2px 7px;
border-radius: 5px;
font-size: 12.5px;
color: #e5e5e5;
}
.code-label {
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.06em;
color: var(--text-secondary);
margin-bottom: 6px;
margin-top: 20px;
}
/* Syntax colours */
.kw { color: #569cd6; }
.str { color: #ce9178; }
.cmt { color: #6a9955; }
.fn { color: #dcdcaa; }
.num { color: #b5cea8; }
.cls { color: #4ec9b0; }
/* ── Callout ── */
.callout {
background: rgba(16, 163, 127, 0.08);
border: 1px solid rgba(16, 163, 127, 0.25);
border-radius: var(--radius);
padding: 16px 20px;
margin: 20px 0;
font-size: 14px;
}
.callout-warn {
background: rgba(245, 158, 11, 0.08);
border-color: rgba(245, 158, 11, 0.25);
}
.callout strong { display: block; margin-bottom: 4px; }
/* ── Steps ── */
.steps { counter-reset: step; margin: 0; padding: 0; list-style: none; }
.steps li {
counter-increment: step;
display: flex;
gap: 16px;
margin-bottom: 28px;
}
.steps li::before {
content: counter(step);
background: var(--accent);
color: #fff;
width: 26px;
height: 26px;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
font-size: 12px;
font-weight: 700;
flex-shrink: 0;
margin-top: 2px;
}
.steps li > div { flex: 1; }
.steps li strong { display: block; margin-bottom: 4px; font-size: 15px; }
/* ── Cards ── */
.card-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
gap: 14px;
margin: 20px 0;
}
.card {
background: var(--surface);
border: 1px solid var(--border);
border-radius: var(--radius);
padding: 20px;
transition: border-color 0.15s;
}
.card:hover { border-color: #3a3a3b; }
.card h4 { font-size: 15px; margin-bottom: 6px; }
.card p { font-size: 13px; color: var(--text-secondary); margin: 0; }
/* ── Tab switcher ── */
.tabs { display: flex; gap: 4px; margin-bottom: -1px; }
.tab {
padding: 8px 16px;
background: transparent;
border: 1px solid transparent;
border-bottom: none;
border-radius: 8px 8px 0 0;
font-size: 13px;
font-weight: 500;
color: var(--text-secondary);
cursor: pointer;
transition: all 0.15s;
}
.tab.active { background: var(--code-bg); border-color: var(--border); color: var(--text); }
.tab-content { display: none; }
.tab-content.active { display: block; }
.tab-panel { border: 1px solid var(--border); border-radius: 0 var(--radius) var(--radius) var(--radius); }
.tab-panel pre { border: none; border-radius: 0 var(--radius) var(--radius) var(--radius); margin: 0; }
/* ── Badge ── */
.badge {
display: inline-block;
padding: 2px 8px;
border-radius: 10px;
font-size: 11px;
font-weight: 600;
text-transform: uppercase;
letter-spacing: 0.03em;
}
.badge-green { background: rgba(16,163,127,0.15); color: var(--accent); }
.badge-blue { background: rgba(59,130,246,0.15); color: #60a5fa; }
.badge-amber { background: rgba(245,158,11,0.15); color: #f59e0b; }
/* ── Platform icon ── */
.platform-icon { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.icon { width: 24px; height: 24px; border-radius: 6px; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; }
@media (max-width: 640px) {
.hero h1 { font-size: 26px; }
.nav-links { display: none; }
pre { padding: 14px 16px; }
}