diff --git a/src/highstory/README.md b/src/highstory/README.md new file mode 100644 index 0000000000..c66b66cf4d --- /dev/null +++ b/src/highstory/README.md @@ -0,0 +1,2 @@ +# High Story MCP Server +This server allows Claude to interact with [High Story](https://highstory.io). diff --git a/src/highstory/index.ts b/src/highstory/index.ts new file mode 100644 index 0000000000..1e93e8e16d --- /dev/null +++ b/src/highstory/index.ts @@ -0,0 +1,64 @@ +import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js"; +import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"; +import { z } from "zod"; + +const server = new McpServer({ + name: "High Story", + version: "1.0.0" +}); + +const API_BASE_URL = "https://jeprtikkylotvcddrqvm.supabase.co/functions/v1"; + +/** + * Helper to call High Story Edge Functions + */ +async function callHighStoryAPI(endpoint: string, payload: any) { + const apiKey = process.env.HIGHSTORY_API_KEY; + if (!apiKey) { + throw new Error("Missing HIGHSTORY_API_KEY environment variable. Please generate one in your High Story settings."); + } + + const response = await fetch(`${API_BASE_URL}/${endpoint}`, { + method: 'POST', + headers: { + 'Authorization': `Bearer ${apiKey}`, + 'Content-Type': 'application/json' + }, + body: JSON.stringify(payload) + }); + + if (!response.ok) { + const error = await response.json(); + throw new Error(error.error || `API Error: ${response.statusText}`); + } + + return await response.json(); +} + +// --- Tools Implementation --- + +server.tool( + "execute_campaign", + "Create and execute an AI content campaign for a brand. Generates social media posts based on brand analysis.", + { + brand_url: z.string().optional().describe("The brand website URL (optional)"), + campaign_objective: z.string().describe("The campaign goal"), + workspace_id: z.string().optional().describe("High Story workspace ID (optional)"), + }, + async (args) => { + try { + const data = await callHighStoryAPI('execute-campaign', { + ...args, + is_onboarding: false + }); + return { content: [{ type: "text", text: `Campaign started successfully! View it in your dashboard.` }] }; + } catch (e: any) { + return { isError: true, content: [{ type: "text", text: `Error: ${e.message}` }] }; + } + } +); + +// --- Entry Point --- + +const transport = new StdioServerTransport(); +await server.connect(transport); diff --git a/src/highstory/package.json b/src/highstory/package.json new file mode 100644 index 0000000000..1f37d9f25c --- /dev/null +++ b/src/highstory/package.json @@ -0,0 +1,23 @@ +{ + "name": "@modelcontextprotocol/server-highstory", + "version": "1.0.0", + "description": "High Story MCP server for AI-driven social media automation", + "license": "MIT", + "type": "module", + "bin": { + "mcp-server-highstory": "dist/index.js" + }, + "scripts": { + "build": "tsc && shx chmod +x dist/index.js", + "prepare": "npm run build" + }, + "dependencies": { + "@modelcontextprotocol/sdk": "^1.26.0", + "zod": "^3.25.0" + }, + "devDependencies": { + "@types/node": "^22.10.2", + "shx": "^0.3.4", + "typescript": "^5.6.2" + } +} diff --git a/src/highstory/tsconfig.json b/src/highstory/tsconfig.json new file mode 100644 index 0000000000..ec5da15825 --- /dev/null +++ b/src/highstory/tsconfig.json @@ -0,0 +1,10 @@ +{ + "extends": "../../tsconfig.json", + "compilerOptions": { + "outDir": "./dist", + "rootDir": "." + }, + "include": [ + "./**/*.ts" + ] +}