@ssemble/mcp-server 1.1.9 → 1.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -84,6 +84,7 @@ Add to your MCP settings:
84
84
  | `get_status` | Check processing progress (0-100%) and current step |
85
85
  | `get_shorts` | Retrieve completed clips with video URLs, titles, viral scores |
86
86
  | `list_requests` | List all your requests with pagination and status filtering |
87
+ | `list_posts` | List your scheduled / published social posts (YouTube, Instagram, TikTok) with status, public URL, publish time and failure reasons |
87
88
  | `delete_request` | Permanently delete a request and its videos |
88
89
  | `list_templates` | Browse caption style templates |
89
90
  | `list_music` | Browse background music tracks |
@@ -160,6 +161,18 @@ Webhook payload example:
160
161
  **Get results:**
161
162
  > "Show me the clips for request 507f1f77bcf86cd799439011, sorted by viral score"
162
163
 
164
+ ## Remote endpoint (`https://mcp.ssemble.com/mcp`)
165
+
166
+ No install needed — point any Streamable-HTTP MCP client at `https://mcp.ssemble.com/mcp` and send your API key in **any one** of these headers:
167
+
168
+ | Header | Example |
169
+ |--------|---------|
170
+ | `X-Ssemble-API-Key` | `X-Ssemble-API-Key: sk_ssemble_...` |
171
+ | `X-API-Key` | `X-API-Key: sk_ssemble_...` |
172
+ | `Authorization` | `Authorization: Bearer sk_ssemble_...` |
173
+
174
+ Clients that only allow standard headers (for example Claude custom connectors) should use `Authorization: Bearer sk_ssemble_...` or `X-API-Key`.
175
+
163
176
  ## Environment Variables
164
177
 
165
178
  | Variable | Required | Description |
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ssemble/mcp-server",
3
- "version": "1.1.9",
3
+ "version": "1.1.11",
4
4
  "mcpName": "com.ssemble/mcp-server",
5
5
  "description": "MCP server for Ssemble AI Clipping — create viral short-form videos from any AI assistant. Webhook callbacks for n8n, Zapier, and Make automation.",
6
6
  "type": "module",
package/server.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "name": "com.ssemble/mcp-server",
4
4
  "title": "Ssemble AI Clipping",
5
5
  "description": "Create AI-powered short-form video clips from YouTube videos. Supports webhook callbacks.",
6
- "version": "1.1.9",
6
+ "version": "1.1.11",
7
7
  "websiteUrl": "https://www.ssemble.com/mcp",
8
8
  "repository": {
9
9
  "url": "https://github.com/ssembleinc/ssemble-mcp-server",
@@ -14,7 +14,7 @@
14
14
  "registryType": "npm",
15
15
  "registryBaseUrl": "https://registry.npmjs.org",
16
16
  "identifier": "@ssemble/mcp-server",
17
- "version": "1.1.9",
17
+ "version": "1.1.11",
18
18
  "transport": {
19
19
  "type": "stdio"
20
20
  },
package/src/api/client.js CHANGED
@@ -63,7 +63,7 @@ export class SsembleClient {
63
63
  if (!this.apiKey) {
64
64
  throw new SsembleApiError(401, {
65
65
  code: 'missing_api_key',
66
- message: 'Ssemble API key required. Pass via X-Ssemble-API-Key header when using the remote endpoint, or set SSEMBLE_API_KEY env var for local usage. Get your key at https://app.ssemble.com/api-keys',
66
+ message: 'Ssemble API key required. When using the remote endpoint pass it via the X-Ssemble-API-Key header, the X-API-Key header, or "Authorization: Bearer sk_ssemble_..."; for local usage set the SSEMBLE_API_KEY env var. Get your key at https://app.ssemble.com/api-keys',
67
67
  });
68
68
  }
69
69
  if (!this.apiKey.startsWith('sk_ssemble_')) {
@@ -185,6 +185,11 @@ export class SsembleClient {
185
185
  return this._request('GET', '/shorts', { query });
186
186
  }
187
187
 
188
+ // Endpoint 5b: GET /posts — scheduled / published social posts
189
+ async listPosts(query) {
190
+ return this._request('GET', '/posts', { query });
191
+ }
192
+
188
193
  // Endpoint 6: DELETE /shorts/:id
189
194
  async deleteRequest(requestId) {
190
195
  return this._request('DELETE', `/shorts/${requestId}`);
package/src/index.js CHANGED
@@ -11,6 +11,7 @@ import { registerCreateShort } from './tools/create-short.js';
11
11
  import { registerGetStatus } from './tools/get-status.js';
12
12
  import { registerGetShorts } from './tools/get-shorts.js';
13
13
  import { registerListRequests } from './tools/list-requests.js';
14
+ import { registerListPosts } from './tools/list-posts.js';
14
15
  import { registerDeleteRequest } from './tools/delete-request.js';
15
16
  import { registerListTemplates } from './tools/list-templates.js';
16
17
  import { registerListMusic } from './tools/list-music.js';
@@ -46,6 +47,7 @@ export function createSsembleMcpServer(apiKey, baseUrl) {
46
47
  registerListMusic(server, client);
47
48
  registerListGameVideos(server, client);
48
49
  registerListMemeHooks(server, client);
50
+ registerListPosts(server, client);
49
51
 
50
52
  // Register resources
51
53
  registerResources(server);
@@ -0,0 +1,36 @@
1
+ import { z } from 'zod';
2
+ import { formatListPostsResponse, formatError } from '../utils/format.js';
3
+
4
+ // Mirrors GET /api/v1/posts (plugin-shortsmaker-node-backend services/postsService.js).
5
+ const POST_STATUSES = ['scheduled', 'processing', 'published', 'failed', 'canceled'];
6
+ const PLATFORMS = ['youtube', 'instagram', 'tiktok'];
7
+ const SOURCES = ['manual', 'automation'];
8
+
9
+ const schema = {
10
+ status: z.enum(POST_STATUSES).describe('Filter by post status: scheduled (queued), processing (uploading or waiting for the platform), published (live, has url), failed (has error), canceled').optional(),
11
+ platform: z.enum(PLATFORMS).describe('Filter by platform').optional(),
12
+ source: z.enum(SOURCES).describe('manual = scheduled by hand from the shorts list; automation = posted by channel automation').optional(),
13
+ requestId: z.string().regex(/^[0-9a-fA-F]{24}$/).describe('Only posts made from this request (24-char hex request ID)').optional(),
14
+ shortId: z.string().uuid().describe('Only posts made from this clip (short ID)').optional(),
15
+ since: z.string().datetime({ offset: true }).describe('ISO 8601 lower bound. Applies to scheduledAt, or to publishedAt when date=published').optional(),
16
+ until: z.string().datetime({ offset: true }).describe('ISO 8601 upper bound (same field as since)').optional(),
17
+ date: z.enum(['scheduled', 'published']).describe('Which timestamp since/until filter and sort by. Use "published" with since to poll for newly live posts.').optional(),
18
+ page: z.number().int().min(1).default(1).describe('Page number').optional(),
19
+ limit: z.number().int().min(1).max(100).default(50).describe('Items per page (1-100)').optional(),
20
+ };
21
+
22
+ export function registerListPosts(server, client) {
23
+ server.tool(
24
+ 'list_posts',
25
+ 'List your scheduled and published social posts (YouTube, Instagram, TikTok) with status, public URL and publish time. Filter by status, platform, request, clip or time window; use date=published with since to find posts that went live after a given moment.',
26
+ schema,
27
+ async (params) => {
28
+ try {
29
+ const result = await client.listPosts(params);
30
+ return { content: [{ type: 'text', text: formatListPostsResponse(result) }] };
31
+ } catch (error) {
32
+ return { content: [{ type: 'text', text: formatError(error) }], isError: true };
33
+ }
34
+ }
35
+ );
36
+ }
@@ -0,0 +1,27 @@
1
+ /**
2
+ * Resolve the Ssemble API key for an incoming HTTP MCP request.
3
+ *
4
+ * Accepted, in order of precedence:
5
+ * 1. X-Ssemble-API-Key: sk_ssemble_... (original header)
6
+ * 2. X-API-Key: sk_ssemble_... (same header the REST API accepts)
7
+ * 3. Authorization: Bearer sk_ssemble_... (standard header — the only kind
8
+ * some MCP clients, e.g. Claude custom connectors, allow)
9
+ * 4. SSEMBLE_API_KEY env var (single-tenant deployments)
10
+ *
11
+ * Returns null when nothing is present so the server can answer with the
12
+ * usual missing_api_key error.
13
+ */
14
+ export function resolveApiKey(headers = {}, env = process.env) {
15
+ const first = (v) => (Array.isArray(v) ? v[0] : v);
16
+
17
+ const direct = first(headers['x-ssemble-api-key']) || first(headers['x-api-key']);
18
+ if (typeof direct === 'string' && direct.trim()) return direct.trim();
19
+
20
+ const auth = first(headers['authorization']);
21
+ if (typeof auth === 'string') {
22
+ const m = /^\s*Bearer\s+(\S+)\s*$/i.exec(auth);
23
+ if (m) return m[1];
24
+ }
25
+
26
+ return env.SSEMBLE_API_KEY || null;
27
+ }
@@ -9,6 +9,7 @@
9
9
  import express from 'express';
10
10
  import { StreamableHTTPServerTransport } from '@modelcontextprotocol/sdk/server/streamableHttp.js';
11
11
  import { createSsembleMcpServer, PKG_VERSION } from '../index.js';
12
+ import { resolveApiKey } from './apiKey.js';
12
13
 
13
14
  const app = express();
14
15
  app.use(express.json());
@@ -25,8 +26,8 @@ const SERVER_CARD = {
25
26
  },
26
27
  authentication: {
27
28
  required: true,
28
- schemes: ['api_key'],
29
- instructions: 'Pass your Ssemble API key via the X-Ssemble-API-Key header or set SSEMBLE_API_KEY env var on the server.',
29
+ schemes: ['api_key', 'bearer'],
30
+ instructions: 'Pass your Ssemble API key via the X-Ssemble-API-Key header, the X-API-Key header, or "Authorization: Bearer sk_ssemble_..." — or set SSEMBLE_API_KEY env var on the server.',
30
31
  },
31
32
  };
32
33
 
@@ -42,7 +43,7 @@ app.get('/.well-known/mcp/server-card.json', (_req, res) => {
42
43
 
43
44
  // MCP endpoint — stateless mode (each request is independent)
44
45
  app.all('/mcp', async (req, res) => {
45
- const apiKey = req.headers['x-ssemble-api-key'] || process.env.SSEMBLE_API_KEY || null;
46
+ const apiKey = resolveApiKey(req.headers);
46
47
  const baseUrl = process.env.SSEMBLE_API_BASE_URL;
47
48
 
48
49
  // Log MCP requests (tool calls) for usage tracking
@@ -126,6 +126,37 @@ export function formatListRequestsResponse(result) {
126
126
  return text;
127
127
  }
128
128
 
129
+ /**
130
+ * Formats GET /posts: one line per post with platform, status, time and URL or failure reason.
131
+ */
132
+ export function formatListPostsResponse(result) {
133
+ const d = result.data || {};
134
+ const posts = d.posts || [];
135
+ const p = d.pagination || { page: 1, totalPages: 0, totalCount: 0, limit: posts.length };
136
+
137
+ if (posts.length === 0) {
138
+ return `No posts found for these filters.${formatRateLimits(result.rateLimits)}`;
139
+ }
140
+
141
+ let text = `## Your Posts (Page ${p.page}/${p.totalPages}, ${p.totalCount} total)\n\n`;
142
+ posts.forEach((post, i) => {
143
+ const num = (p.page - 1) * p.limit + i + 1;
144
+ const when = post.status === 'published' && post.publishedAt
145
+ ? `published ${new Date(post.publishedAt).toLocaleString()}`
146
+ : post.scheduledAt ? `scheduled for ${new Date(post.scheduledAt).toLocaleString()}` : '';
147
+ const handle = post.account && post.account.handle ? ` @${post.account.handle}` : '';
148
+ text += `**${num}. ${post.platform}${handle} — ${post.status}** (${post.source})\n`;
149
+ if (post.title) text += ` ${post.title}\n`;
150
+ if (when) text += ` ${when}\n`;
151
+ if (post.url) text += ` URL: ${post.url}\n`;
152
+ if (post.status === 'failed' && post.error) text += ` Failed (${post.errorCode}${post.retryable ? ', retryable' : ''}): ${post.error}\n`;
153
+ text += ` ID: \`${post.id}\` | clip: \`${post.shortId}\` | request: \`${post.requestId}\`\n\n`;
154
+ });
155
+ if (p.totalPages > 1) text += `Page ${p.page} of ${p.totalPages}. Use \`page\` to browse more.`;
156
+ text += formatRateLimits(result.rateLimits);
157
+ return text;
158
+ }
159
+
129
160
  /**
130
161
  * Formats recent requests for the "no requestId given" UX.
131
162
  * Used by get_status and get_shorts when called without a requestId.