@publishq/mcp 0.0.1 → 0.0.2
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 +2 -2
- package/dist/index.js +20 -6
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -18,7 +18,7 @@ It runs locally over stdio and talks to the PublishQ API using your API key.
|
|
|
18
18
|
|
|
19
19
|
## Setup
|
|
20
20
|
|
|
21
|
-
You need a PublishQ API key. Create one under **
|
|
21
|
+
You need a PublishQ API key. Create one under **API Keys** in the PublishQ dashboard (it starts with `pq_live_`).
|
|
22
22
|
|
|
23
23
|
### Claude Desktop
|
|
24
24
|
|
|
@@ -68,7 +68,7 @@ Any MCP client that launches a stdio server works the same way — run the comma
|
|
|
68
68
|
| `publishq_create_workspace` | Create a workspace |
|
|
69
69
|
| `publishq_list_media` | List uploaded/generated media |
|
|
70
70
|
| `publishq_get_media` | Get one media file by ID |
|
|
71
|
-
| `publishq_upload_media` | Upload a local file and get a media ID
|
|
71
|
+
| `publishq_upload_media` | Upload a local file (up to 4 GB) and get a media ID |
|
|
72
72
|
|
|
73
73
|
The tools are thin wrappers over [`@publishq/sdk`](https://www.npmjs.com/package/@publishq/sdk), so their behavior and scopes match the [PublishQ API](https://publishq.com/docs). `publishq_create_post` accepts an `accounts` array whose entries contain `accountId` plus optional `postOverrides` and `platformSpecificSettings`. `publishq_update_post` accepts content, scheduling, complete media replacement or removal, and thumbnail timestamp changes. `publishq_list_media` can filter by media IDs, types, and sources. For TikTok, the agent should call `publishq_get_tiktok_creator_info` first and then provide the required privacy and interaction settings in that account object. A tool call that hits an API error returns the API error so the agent can react.
|
|
74
74
|
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// src/index.ts
|
|
4
|
-
import {
|
|
4
|
+
import { openAsBlob, statSync } from "fs";
|
|
5
5
|
import { basename } from "path";
|
|
6
6
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
@@ -27,10 +27,11 @@ import PublishQ, {
|
|
|
27
27
|
zUpdatePostPath
|
|
28
28
|
} from "@publishq/sdk";
|
|
29
29
|
import { toJSONSchema } from "zod/v4-mini";
|
|
30
|
+
var OPEN_AS_BLOB_MAX_BYTES = 2 ** 32;
|
|
30
31
|
var API_KEY = process.env.PUBLISHQ_API_KEY;
|
|
31
32
|
if (!API_KEY) {
|
|
32
33
|
console.error(
|
|
33
|
-
"ERROR: PUBLISHQ_API_KEY environment variable is required. Create a key at https://publishq.com/app/
|
|
34
|
+
"ERROR: PUBLISHQ_API_KEY environment variable is required. Create a key at https://publishq.com/app/api-keys."
|
|
34
35
|
);
|
|
35
36
|
process.exit(1);
|
|
36
37
|
}
|
|
@@ -242,7 +243,7 @@ registerTool(
|
|
|
242
243
|
{
|
|
243
244
|
name: "publishq_upload_media",
|
|
244
245
|
title: "Upload a media file",
|
|
245
|
-
description: "Upload a local media file to PublishQ and get back a media ID you can attach to posts via publishq_create_post (mediaIds). The file is read from the local filesystem where this MCP server runs.",
|
|
246
|
+
description: "Upload a local media file of up to 4 GB to PublishQ and get back a media ID you can attach to posts via publishq_create_post (mediaIds). The file is read from the local filesystem where this MCP server runs.",
|
|
246
247
|
inputSchema: {
|
|
247
248
|
type: "object",
|
|
248
249
|
properties: {
|
|
@@ -260,11 +261,24 @@ registerTool(
|
|
|
260
261
|
},
|
|
261
262
|
annotations: { readOnlyHint: false, openWorldHint: true }
|
|
262
263
|
},
|
|
263
|
-
(args) => {
|
|
264
|
+
async (args) => {
|
|
264
265
|
const filePath = args.filePath;
|
|
265
266
|
const filename = args.filename;
|
|
266
|
-
|
|
267
|
-
|
|
267
|
+
if (statSync(filePath).size >= OPEN_AS_BLOB_MAX_BYTES) {
|
|
268
|
+
return {
|
|
269
|
+
content: [
|
|
270
|
+
{
|
|
271
|
+
type: "text",
|
|
272
|
+
text: `${filePath} is too big to upload: files must be smaller than 4 GB.`
|
|
273
|
+
}
|
|
274
|
+
],
|
|
275
|
+
isError: true
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
const file = new File(
|
|
279
|
+
[await openAsBlob(filePath)],
|
|
280
|
+
filename ?? basename(filePath)
|
|
281
|
+
);
|
|
268
282
|
return run(publishq.media.upload({ file }));
|
|
269
283
|
}
|
|
270
284
|
);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@publishq/mcp",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Model Context Protocol (MCP) server for PublishQ — let AI agents schedule and publish across your social platforms.",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"@modelcontextprotocol/sdk": "1.29.0",
|
|
28
|
-
"
|
|
29
|
-
"
|
|
28
|
+
"@publishq/sdk": "^0.0.2",
|
|
29
|
+
"zod": "4.4.3"
|
|
30
30
|
},
|
|
31
31
|
"devDependencies": {
|
|
32
32
|
"@types/node": "^20",
|