feat: /openapi-chatgpt.json — 29-op spec for ChatGPT Custom GPT limit

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 <noreply@anthropic.com>
This commit is contained in:
Garfield
2026-05-16 23:39:02 -04:00
parent b67146dfc8
commit c6504ec60f
3 changed files with 60 additions and 2 deletions

View File

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

View File

@@ -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 {

View File

@@ -767,6 +767,60 @@ function filterPaths(fullSpec: Record<string, unknown>, allowed: Set<string>): 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 {