From c6504ec60fed8a9a1cf7be8745dbfad54b620b4b Mon Sep 17 00:00:00 2001 From: Garfield Date: Sat, 16 May 2026 23:39:02 -0400 Subject: [PATCH] =?UTF-8?q?feat:=20/openapi-chatgpt.json=20=E2=80=94=2029-?= =?UTF-8?q?op=20spec=20for=20ChatGPT=20Custom=20GPT=20limit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Drops obsidian (5 ops) and whatsapp/templates list (1 op) to stay under ChatGPT's 30-operation cap. Served at /openapi-chatgpt.json. Co-Authored-By: Claude Sonnet 4.6 --- hermes-k8s.yaml | 2 +- src/index.ts | 6 +++++- src/manifest.ts | 54 +++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 60 insertions(+), 2 deletions(-) diff --git a/hermes-k8s.yaml b/hermes-k8s.yaml index a15a28e..7bce795 100644 --- a/hermes-k8s.yaml +++ b/hermes-k8s.yaml @@ -22,7 +22,7 @@ spec: fsGroup: 1000 containers: - name: hermes-mcp - image: localhost:32000/hermes-mcp@sha256:4f91bf92c5498605a59d54b1a32789e9d125fcff0c0b1d00225fc2bae888f26d + image: localhost:32000/hermes-mcp@sha256:d98ef6d2fde25c11233f614f839b09958bfb772c9a5b26fe8374cf6ffd5417a2 imagePullPolicy: Always securityContext: allowPrivilegeEscalation: false diff --git a/src/index.ts b/src/index.ts index 8e5f253..17cfbaf 100644 --- a/src/index.ts +++ b/src/index.ts @@ -13,7 +13,7 @@ import { isInitializeRequest, } from '@modelcontextprotocol/sdk/types.js'; import { tools, handleToolCall, stripAccountParam } from './tools.js'; -import { getManifest, getOpenApiSpec, getOpenApiSpecMail, getOpenApiSpecSocial } from './manifest.js'; +import { getManifest, getOpenApiSpec, getOpenApiSpecMail, getOpenApiSpecSocial, getOpenApiSpecChatGPT } from './manifest.js'; import { routeWhatsAppWebhook, registerWhatsAppNumber, type RoutedWebhookEvent } from './multitenancy/webhook-router.js'; import { storeCredential, type Platform } from './multitenancy/credential-store.js'; import { meterMiddleware, resolveCustomerByApiKey, resolveCustomerById, type Customer } from './billing/middleware.js'; @@ -1114,6 +1114,10 @@ app.get('/openapi-social.json', (_req, res) => { res.json(getOpenApiSpecSocial(SERVER_URL)); }); +app.get('/openapi-chatgpt.json', (_req, res) => { + res.json(getOpenApiSpecChatGPT(SERVER_URL)); +}); + // ── Obsidian REST API (ChatGPT Actions) ──────────────────────────────────── function parseToolResult(result: { content: Array<{ type: string; text: string }> }): unknown { diff --git a/src/manifest.ts b/src/manifest.ts index 29d7207..3f9d194 100644 --- a/src/manifest.ts +++ b/src/manifest.ts @@ -767,6 +767,60 @@ function filterPaths(fullSpec: Record, allowed: Set): R return filtered; } +const CHATGPT_PATHS = new Set([ + // Email + '/api/email/profile', + '/api/email/search', + '/api/email/read', + '/api/email/send', + // WhatsApp + '/api/whatsapp/send', + '/api/whatsapp/template', + // LinkedIn + '/api/linkedin/profile', + '/api/linkedin/post', + '/api/linkedin/video', + // Telegram + '/api/telegram/message', + '/api/telegram/updates', + // Discord + '/api/discord/guilds', + '/api/discord/message', + '/api/discord/messages', + // Instagram + '/api/instagram/profile', + '/api/instagram/media', + '/api/instagram/post', + '/api/instagram/reel', + // Facebook + '/api/facebook/page', + '/api/facebook/posts', + '/api/facebook/post', + '/api/facebook/photo', + '/api/facebook/video', + // Twitter/X + '/api/twitter/search', + '/api/twitter/user', + '/api/twitter/tweets', + '/api/twitter/video', + // TikTok + '/api/tiktok/profile', + '/api/tiktok/video', +]); + +export function getOpenApiSpecChatGPT(serverUrl: string) { + const full = getOpenApiSpec(serverUrl); + return { + ...full, + info: { + ...full.info, + title: 'SquareMCP', + description: 'AI Social Media Gateway — send WhatsApp, email, LinkedIn, Instagram, Facebook, Twitter/X, TikTok, Telegram, and Discord messages from ChatGPT.', + }, + paths: filterPaths(full, CHATGPT_PATHS), + }; +} + export function getOpenApiSpecMail(serverUrl: string) { const full = getOpenApiSpec(serverUrl); return {