postproxy-mcp 0.1.1 → 0.2.0
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 +30 -24
- package/dist/server.d.ts +5 -5
- package/dist/server.js +5 -5
- package/dist/server.js.map +1 -1
- package/dist/tools/post.d.ts +1 -1
- package/dist/tools/post.d.ts.map +1 -1
- package/dist/tools/post.js +6 -28
- package/dist/tools/post.js.map +1 -1
- package/dist/tools/profiles.js +3 -3
- package/dist/tools/profiles.js.map +1 -1
- package/dist/utils/validation.d.ts +3 -3
- package/dist/utils/validation.js +1 -1
- package/dist/utils/validation.js.map +1 -1
- package/package.json +1 -1
- package/src/server.ts +5 -5
- package/src/tools/post.ts +7 -36
- package/src/tools/profiles.ts +3 -3
- package/src/utils/validation.ts +1 -1
- package/worker/index.ts +19 -5
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# PostProxy MCP Server
|
|
2
2
|
|
|
3
|
-
MCP (Model Context Protocol) server for integrating PostProxy API with Claude Code. This server provides tools for publishing posts, checking statuses, and managing social media profiles through Claude Code.
|
|
3
|
+
MCP (Model Context Protocol) server for integrating [PostProxy](https://postproxy.dev/) API with Claude Code. This server provides tools for publishing posts, checking statuses, and managing social media profiles through Claude Code.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -76,19 +76,19 @@ Check authentication status, API configuration, and workspace information.
|
|
|
76
76
|
|
|
77
77
|
#### `profiles.list`
|
|
78
78
|
|
|
79
|
-
List all available social media profiles
|
|
79
|
+
List all available social media profiles for posting.
|
|
80
80
|
|
|
81
81
|
**Parameters**: None
|
|
82
82
|
|
|
83
83
|
**Returns**:
|
|
84
84
|
```json
|
|
85
85
|
{
|
|
86
|
-
"
|
|
86
|
+
"profiles": [
|
|
87
87
|
{
|
|
88
88
|
"id": "profile-123",
|
|
89
89
|
"name": "My Twitter Account",
|
|
90
90
|
"platform": "twitter",
|
|
91
|
-
"profile_group_id":
|
|
91
|
+
"profile_group_id": "group-abc"
|
|
92
92
|
}
|
|
93
93
|
]
|
|
94
94
|
}
|
|
@@ -98,13 +98,13 @@ List all available social media profiles (targets) for posting.
|
|
|
98
98
|
|
|
99
99
|
#### `post.publish`
|
|
100
100
|
|
|
101
|
-
Publish a post to specified
|
|
101
|
+
Publish a post to specified social media profiles.
|
|
102
102
|
|
|
103
103
|
**Parameters**:
|
|
104
104
|
- `content` (string, required): Post content text
|
|
105
|
-
- `
|
|
105
|
+
- `profiles` (string[], required): Array of profile IDs (hashids) or platform names (e.g., `"linkedin"`, `"instagram"`, `"twitter"`). When using platform names, posts to the first connected profile for that platform.
|
|
106
106
|
- `schedule` (string, optional): ISO 8601 scheduled time
|
|
107
|
-
- `media` (string[], optional): Array of media URLs
|
|
107
|
+
- `media` (string[], optional): Array of media URLs or local file paths
|
|
108
108
|
- `idempotency_key` (string, optional): Idempotency key for deduplication
|
|
109
109
|
- `require_confirmation` (boolean, optional): If true, return summary without publishing
|
|
110
110
|
- `draft` (boolean, optional): If true, creates a draft post that won't publish automatically
|
|
@@ -250,8 +250,14 @@ Show me all my available social media profiles
|
|
|
250
250
|
|
|
251
251
|
### Publish a Post
|
|
252
252
|
|
|
253
|
+
Using profile IDs:
|
|
253
254
|
```
|
|
254
|
-
Publish this post: "Check out our new product!" to
|
|
255
|
+
Publish this post: "Check out our new product!" to profiles ["profile-123"]
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
Using platform names:
|
|
259
|
+
```
|
|
260
|
+
Publish "Exciting news!" to linkedin and twitter
|
|
255
261
|
```
|
|
256
262
|
|
|
257
263
|
### Publish with Platform Parameters
|
|
@@ -269,7 +275,7 @@ Or with explicit parameters:
|
|
|
269
275
|
```json
|
|
270
276
|
{
|
|
271
277
|
"content": "Amazing content!",
|
|
272
|
-
"
|
|
278
|
+
"profiles": ["instagram"],
|
|
273
279
|
"media": ["https://example.com/image.jpg"],
|
|
274
280
|
"platforms": {
|
|
275
281
|
"instagram": {
|
|
@@ -285,7 +291,7 @@ Or with explicit parameters:
|
|
|
285
291
|
```json
|
|
286
292
|
{
|
|
287
293
|
"content": "Check out this reel! #viral",
|
|
288
|
-
"
|
|
294
|
+
"profiles": ["instagram"],
|
|
289
295
|
"media": ["https://example.com/video.mp4"],
|
|
290
296
|
"platforms": {
|
|
291
297
|
"instagram": {
|
|
@@ -302,7 +308,7 @@ Or with explicit parameters:
|
|
|
302
308
|
**Instagram Story:**
|
|
303
309
|
```json
|
|
304
310
|
{
|
|
305
|
-
"
|
|
311
|
+
"profiles": ["instagram"],
|
|
306
312
|
"media": ["https://example.com/story-image.jpg"],
|
|
307
313
|
"platforms": {
|
|
308
314
|
"instagram": {
|
|
@@ -323,7 +329,7 @@ Or with explicit parameters:
|
|
|
323
329
|
```json
|
|
324
330
|
{
|
|
325
331
|
"content": "This is the video description with links and details",
|
|
326
|
-
"
|
|
332
|
+
"profiles": ["youtube"],
|
|
327
333
|
"media": ["https://example.com/video.mp4"],
|
|
328
334
|
"platforms": {
|
|
329
335
|
"youtube": {
|
|
@@ -339,7 +345,7 @@ Or with explicit parameters:
|
|
|
339
345
|
```json
|
|
340
346
|
{
|
|
341
347
|
"content": "Video description",
|
|
342
|
-
"
|
|
348
|
+
"profiles": ["youtube"],
|
|
343
349
|
"media": ["https://example.com/video.mp4"],
|
|
344
350
|
"platforms": {
|
|
345
351
|
"youtube": {
|
|
@@ -356,7 +362,7 @@ Or with explicit parameters:
|
|
|
356
362
|
```json
|
|
357
363
|
{
|
|
358
364
|
"content": "Check this out! #fyp",
|
|
359
|
-
"
|
|
365
|
+
"profiles": ["tiktok"],
|
|
360
366
|
"media": ["https://example.com/video.mp4"],
|
|
361
367
|
"platforms": {
|
|
362
368
|
"tiktok": {
|
|
@@ -374,7 +380,7 @@ Or with explicit parameters:
|
|
|
374
380
|
```json
|
|
375
381
|
{
|
|
376
382
|
"content": "Special content for followers",
|
|
377
|
-
"
|
|
383
|
+
"profiles": ["tiktok"],
|
|
378
384
|
"media": ["https://example.com/video.mp4"],
|
|
379
385
|
"platforms": {
|
|
380
386
|
"tiktok": {
|
|
@@ -392,7 +398,7 @@ Or with explicit parameters:
|
|
|
392
398
|
```json
|
|
393
399
|
{
|
|
394
400
|
"content": "Check out our new product!",
|
|
395
|
-
"
|
|
401
|
+
"profiles": ["facebook"],
|
|
396
402
|
"media": ["https://example.com/product.jpg"],
|
|
397
403
|
"platforms": {
|
|
398
404
|
"facebook": {
|
|
@@ -406,7 +412,7 @@ Or with explicit parameters:
|
|
|
406
412
|
**Facebook Story:**
|
|
407
413
|
```json
|
|
408
414
|
{
|
|
409
|
-
"
|
|
415
|
+
"profiles": ["facebook"],
|
|
410
416
|
"media": ["https://example.com/story-video.mp4"],
|
|
411
417
|
"platforms": {
|
|
412
418
|
"facebook": {
|
|
@@ -420,7 +426,7 @@ Or with explicit parameters:
|
|
|
420
426
|
```json
|
|
421
427
|
{
|
|
422
428
|
"content": "Company announcement",
|
|
423
|
-
"
|
|
429
|
+
"profiles": ["facebook"],
|
|
424
430
|
"platforms": {
|
|
425
431
|
"facebook": {
|
|
426
432
|
"page_id": "123456789",
|
|
@@ -436,7 +442,7 @@ Or with explicit parameters:
|
|
|
436
442
|
```json
|
|
437
443
|
{
|
|
438
444
|
"content": "Excited to share my latest article on AI",
|
|
439
|
-
"
|
|
445
|
+
"profiles": ["linkedin"],
|
|
440
446
|
"media": ["https://example.com/article-cover.jpg"]
|
|
441
447
|
}
|
|
442
448
|
```
|
|
@@ -445,7 +451,7 @@ Or with explicit parameters:
|
|
|
445
451
|
```json
|
|
446
452
|
{
|
|
447
453
|
"content": "We're hiring! Join our team",
|
|
448
|
-
"
|
|
454
|
+
"profiles": ["linkedin"],
|
|
449
455
|
"media": ["https://example.com/careers.jpg"],
|
|
450
456
|
"platforms": {
|
|
451
457
|
"linkedin": {
|
|
@@ -461,7 +467,7 @@ Or with explicit parameters:
|
|
|
461
467
|
```json
|
|
462
468
|
{
|
|
463
469
|
"content": "New product launch! 🚀",
|
|
464
|
-
"
|
|
470
|
+
"profiles": ["instagram", "twitter", "linkedin"],
|
|
465
471
|
"media": ["https://example.com/product.jpg"]
|
|
466
472
|
}
|
|
467
473
|
```
|
|
@@ -470,7 +476,7 @@ Or with explicit parameters:
|
|
|
470
476
|
```json
|
|
471
477
|
{
|
|
472
478
|
"content": "Product launch video",
|
|
473
|
-
"
|
|
479
|
+
"profiles": ["instagram", "youtube", "tiktok"],
|
|
474
480
|
"media": ["https://example.com/video.mp4"],
|
|
475
481
|
"platforms": {
|
|
476
482
|
"instagram": {
|
|
@@ -533,7 +539,7 @@ For complete documentation, see the [Platform Parameters Reference](https://post
|
|
|
533
539
|
### Create a Draft Post
|
|
534
540
|
|
|
535
541
|
```
|
|
536
|
-
Create a draft post: "Review this before publishing" to
|
|
542
|
+
Create a draft post: "Review this before publishing" to linkedin
|
|
537
543
|
```
|
|
538
544
|
|
|
539
545
|
### Publish a Draft Post
|
|
@@ -577,7 +583,7 @@ Show me the last 5 posts I published
|
|
|
577
583
|
|
|
578
584
|
### Validation Errors
|
|
579
585
|
|
|
580
|
-
- **TARGET_NOT_FOUND**: One or more
|
|
586
|
+
- **TARGET_NOT_FOUND**: One or more profile IDs don't exist. Use `profiles.list` to see available profiles.
|
|
581
587
|
- **VALIDATION_ERROR**: Post content or parameters are invalid. The API now returns detailed error messages:
|
|
582
588
|
- **400 errors**: `{"status":400,"error":"Bad Request","message":"..."}`
|
|
583
589
|
- **422 errors**: `{"errors": ["Error 1", "Error 2"]}` - Array of validation error messages
|
package/dist/server.d.ts
CHANGED
|
@@ -16,14 +16,14 @@ export declare const TOOL_DEFINITIONS: readonly [{
|
|
|
16
16
|
};
|
|
17
17
|
}, {
|
|
18
18
|
readonly name: "profiles.list";
|
|
19
|
-
readonly description: "List all available social media profiles
|
|
19
|
+
readonly description: "List all available social media profiles for posting";
|
|
20
20
|
readonly inputSchema: {
|
|
21
21
|
readonly type: "object";
|
|
22
22
|
readonly properties: {};
|
|
23
23
|
};
|
|
24
24
|
}, {
|
|
25
25
|
readonly name: "post.publish";
|
|
26
|
-
readonly description: "Publish a post to specified social media
|
|
26
|
+
readonly description: "Publish a post to specified social media profiles. Supports text content, media attachments, scheduling, drafts, and platform-specific customization via the 'platforms' parameter.";
|
|
27
27
|
readonly inputSchema: {
|
|
28
28
|
readonly type: "object";
|
|
29
29
|
readonly properties: {
|
|
@@ -31,12 +31,12 @@ export declare const TOOL_DEFINITIONS: readonly [{
|
|
|
31
31
|
readonly type: "string";
|
|
32
32
|
readonly description: "Post content text (caption/description)";
|
|
33
33
|
};
|
|
34
|
-
readonly
|
|
34
|
+
readonly profiles: {
|
|
35
35
|
readonly type: "array";
|
|
36
36
|
readonly items: {
|
|
37
37
|
readonly type: "string";
|
|
38
38
|
};
|
|
39
|
-
readonly description: "Array of
|
|
39
|
+
readonly description: "Array of profile IDs (hashids) or platform names (e.g., 'linkedin', 'instagram', 'twitter'). When using platform names, posts to the first connected profile for that platform.";
|
|
40
40
|
};
|
|
41
41
|
readonly schedule: {
|
|
42
42
|
readonly type: "string";
|
|
@@ -104,7 +104,7 @@ export declare const TOOL_DEFINITIONS: readonly [{
|
|
|
104
104
|
readonly additionalProperties: true;
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
|
-
readonly required: readonly ["content", "
|
|
107
|
+
readonly required: readonly ["content", "profiles"];
|
|
108
108
|
};
|
|
109
109
|
}, {
|
|
110
110
|
readonly name: "post.status";
|
package/dist/server.js
CHANGED
|
@@ -24,7 +24,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
24
24
|
},
|
|
25
25
|
{
|
|
26
26
|
name: "profiles.list",
|
|
27
|
-
description: "List all available social media profiles
|
|
27
|
+
description: "List all available social media profiles for posting",
|
|
28
28
|
inputSchema: {
|
|
29
29
|
type: "object",
|
|
30
30
|
properties: {},
|
|
@@ -32,7 +32,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
name: "post.publish",
|
|
35
|
-
description: "Publish a post to specified social media
|
|
35
|
+
description: "Publish a post to specified social media profiles. Supports text content, media attachments, scheduling, drafts, and platform-specific customization via the 'platforms' parameter.",
|
|
36
36
|
inputSchema: {
|
|
37
37
|
type: "object",
|
|
38
38
|
properties: {
|
|
@@ -40,10 +40,10 @@ export const TOOL_DEFINITIONS = [
|
|
|
40
40
|
type: "string",
|
|
41
41
|
description: "Post content text (caption/description)",
|
|
42
42
|
},
|
|
43
|
-
|
|
43
|
+
profiles: {
|
|
44
44
|
type: "array",
|
|
45
45
|
items: { type: "string" },
|
|
46
|
-
description: "Array of
|
|
46
|
+
description: "Array of profile IDs (hashids) or platform names (e.g., 'linkedin', 'instagram', 'twitter'). When using platform names, posts to the first connected profile for that platform.",
|
|
47
47
|
},
|
|
48
48
|
schedule: {
|
|
49
49
|
type: "string",
|
|
@@ -109,7 +109,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
109
109
|
additionalProperties: true,
|
|
110
110
|
},
|
|
111
111
|
},
|
|
112
|
-
required: ["content", "
|
|
112
|
+
required: ["content", "profiles"],
|
|
113
113
|
},
|
|
114
114
|
},
|
|
115
115
|
{
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AACnE,OAAO,EAAE,sBAAsB,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAEnG,OAAO,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AACnD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,sBAAsB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,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K,aAAa;oBAChB,OAAO,MAAM,gBAAgB,CAAC,MAAM,EAAE,IAAW,CAAC,CAAC;gBACrD,KAAK,cAAc;oBACjB,OAAO,MAAM,iBAAiB,CAAC,MAAM,EAAE,IAAW,CAAC,CAAC;gBACtD;oBACE,MAAM,WAAW,CAAC,UAAU,CAAC,SAAS,EAAE,iBAAiB,IAAI,EAAE,CAAC,CAAC;YACrE,CAAC;QACH,CAAC;QAAC,OAAO,KAAU,EAAE,CAAC;YACpB,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBAChC,sBAAsB;gBACtB,MAAM,KAAK,CAAC;YACd,CAAC;YACD,MAAM,WAAW,CAAC,UAAU,CAAC,SAAS,EAAE,KAAK,CAAC,OAAO,IAAI,uBAAuB,CAAC,CAAC;QACpF,CAAC;IACH,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
package/dist/tools/post.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import type { PostProxyClient } from "../api/client.js";
|
|
5
5
|
export declare function handlePostPublish(client: PostProxyClient, args: {
|
|
6
6
|
content: string;
|
|
7
|
-
|
|
7
|
+
profiles: string[];
|
|
8
8
|
schedule?: string;
|
|
9
9
|
media?: string[];
|
|
10
10
|
idempotency_key?: string;
|
package/dist/tools/post.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../src/tools/post.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"post.d.ts","sourceRoot":"","sources":["../../src/tools/post.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,kBAAkB,CAAC;AAMxD,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE;IACJ,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,EAAE,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;CACjD;;;;;GAmGF;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;;;;GA8FzB;AAED,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;;;;GAoDzB;AAED,wBAAsB,gBAAgB,CACpC,MAAM,EAAE,eAAe,EACvB,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE;;;;;GA8BzB"}
|
package/dist/tools/post.js
CHANGED
|
@@ -5,7 +5,6 @@ import { PostPublishSchema } from "../utils/validation.js";
|
|
|
5
5
|
import { generateIdempotencyKey } from "../utils/idempotency.js";
|
|
6
6
|
import { createError, ErrorCodes } from "../utils/errors.js";
|
|
7
7
|
import { logError } from "../utils/logger.js";
|
|
8
|
-
import { handleProfilesList } from "./profiles.js";
|
|
9
8
|
export async function handlePostPublish(client, args) {
|
|
10
9
|
// Validate input
|
|
11
10
|
try {
|
|
@@ -22,7 +21,7 @@ export async function handlePostPublish(client, args) {
|
|
|
22
21
|
type: "text",
|
|
23
22
|
text: JSON.stringify({
|
|
24
23
|
summary: {
|
|
25
|
-
|
|
24
|
+
profiles: args.profiles,
|
|
26
25
|
content_preview: args.content.substring(0, 100) + (args.content.length > 100 ? "..." : ""),
|
|
27
26
|
media_count: args.media?.length || 0,
|
|
28
27
|
schedule_time: args.schedule,
|
|
@@ -34,32 +33,11 @@ export async function handlePostPublish(client, args) {
|
|
|
34
33
|
],
|
|
35
34
|
};
|
|
36
35
|
}
|
|
37
|
-
//
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
const targetsMap = new Map();
|
|
41
|
-
for (const target of profilesData.targets || []) {
|
|
42
|
-
targetsMap.set(target.id, target);
|
|
43
|
-
}
|
|
44
|
-
// Convert target IDs to platform names (API expects platform names, not IDs)
|
|
45
|
-
const platformNames = [];
|
|
46
|
-
for (const targetId of args.targets) {
|
|
47
|
-
const target = targetsMap.get(targetId);
|
|
48
|
-
if (!target) {
|
|
49
|
-
throw createError(ErrorCodes.TARGET_NOT_FOUND, `Target ${targetId} not found`);
|
|
50
|
-
}
|
|
51
|
-
platformNames.push(target.platform); // platform name (e.g., "twitter")
|
|
52
|
-
}
|
|
53
|
-
// Validate that platforms keys match platform names if platforms are provided
|
|
54
|
-
if (args.platforms) {
|
|
55
|
-
const platformKeys = Object.keys(args.platforms);
|
|
56
|
-
const invalidPlatforms = platformKeys.filter((key) => !platformNames.includes(key));
|
|
57
|
-
if (invalidPlatforms.length > 0) {
|
|
58
|
-
throw createError(ErrorCodes.VALIDATION_ERROR, `Platform parameters specified for platforms not in targets: ${invalidPlatforms.join(", ")}. Available platforms: ${platformNames.join(", ")}`);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
36
|
+
// Note: The API accepts both profile IDs (hashids) and platform names (e.g., "linkedin", "twitter")
|
|
37
|
+
// We pass the profiles array directly without conversion
|
|
38
|
+
// Platform parameter validation is optional - if provided, it should match the platforms being posted to
|
|
61
39
|
// Generate idempotency key if not provided
|
|
62
|
-
const idempotencyKey = args.idempotency_key || generateIdempotencyKey(args.content, args.
|
|
40
|
+
const idempotencyKey = args.idempotency_key || generateIdempotencyKey(args.content, args.profiles, args.schedule);
|
|
63
41
|
// Validate draft parameter is correctly passed
|
|
64
42
|
// Ensure draft is explicitly set (true, false, or undefined) and will be handled correctly
|
|
65
43
|
const draftValue = args.draft !== undefined ? args.draft : undefined;
|
|
@@ -67,7 +45,7 @@ export async function handlePostPublish(client, args) {
|
|
|
67
45
|
try {
|
|
68
46
|
const response = await client.createPost({
|
|
69
47
|
content: args.content,
|
|
70
|
-
profiles:
|
|
48
|
+
profiles: args.profiles, // API accepts both profile IDs (hashids) and platform names
|
|
71
49
|
schedule: args.schedule,
|
|
72
50
|
media: args.media,
|
|
73
51
|
idempotency_key: idempotencyKey,
|
package/dist/tools/post.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","sourceRoot":"","sources":["../../src/tools/post.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"post.js","sourceRoot":"","sources":["../../src/tools/post.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAE9C,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,MAAuB,EACvB,IASC;IAED,iBAAiB;IACjB,IAAI,CAAC;QACH,iBAAiB,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAChC,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,MAAM,WAAW,CAAC,UAAU,CAAC,gBAAgB,EAAE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 +15,12 @@ export async function handleProfilesList(client) {
|
|
|
15
15
|
// Get all profile groups
|
|
16
16
|
const profileGroups = await client.getProfileGroups();
|
|
17
17
|
// Get profiles for each group
|
|
18
|
-
const
|
|
18
|
+
const allProfiles = [];
|
|
19
19
|
for (const group of profileGroups) {
|
|
20
20
|
try {
|
|
21
21
|
const profiles = await client.getProfiles(group.id);
|
|
22
22
|
for (const profile of profiles) {
|
|
23
|
-
|
|
23
|
+
allProfiles.push({
|
|
24
24
|
id: profile.id, // Already a string
|
|
25
25
|
name: profile.name,
|
|
26
26
|
platform: profile.platform,
|
|
@@ -38,7 +38,7 @@ export async function handleProfilesList(client) {
|
|
|
38
38
|
{
|
|
39
39
|
type: "text",
|
|
40
40
|
text: JSON.stringify({
|
|
41
|
-
|
|
41
|
+
profiles: allProfiles,
|
|
42
42
|
}, null, 2),
|
|
43
43
|
},
|
|
44
44
|
],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/tools/profiles.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7D,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAE3D,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,MAAuB;IAC9D,WAAW,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC;IAEjC,gBAAgB;IAChB,MAAM,MAAM,GAAG,SAAS,EAAE,CAAC;IAC3B,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,MAAM,WAAW,CAAC,UAAU,CAAC,YAAY,EAAE,2BAA2B,CAAC,CAAC;IAC1E,CAAC;IAED,IAAI,CAAC;QACH,yBAAyB;QACzB,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,gBAAgB,EAAE,CAAC;QAEtD,8BAA8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E,wBAAwB,KAAK,CAAC,EAAE,GAAG,CAAC,CAAC;gBAC9D,+CAA+C;YACjD,CAAC;QACH,CAAC;QAED,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAM;oBACZ,IAAI,EAAE,IAAI,CAAC,SAAS,CAClB;wBACE,QAAQ,EAAE,WAAW;qBACtB,EACD,IAAI,EACJ,CAAC,CACF;iBACF;aACF;SACF,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,QAAQ,CAAC,KAAc,EAAE,eAAe,CAAC,CAAC;QAC1C,MAAM,WAAW,CACf,UAAU,CAAC,SAAS,EACpB,gCAAiC,KAAe,CAAC,OAAO,EAAE,CAC3D,CAAC;IACJ,CAAC;AACH,CAAC"}
|
|
@@ -282,7 +282,7 @@ export declare const PlatformParamsSchema: z.ZodOptional<z.ZodObject<{
|
|
|
282
282
|
*/
|
|
283
283
|
export declare const PostPublishSchema: z.ZodObject<{
|
|
284
284
|
content: z.ZodString;
|
|
285
|
-
|
|
285
|
+
profiles: z.ZodArray<z.ZodString, "many">;
|
|
286
286
|
schedule: z.ZodOptional<z.ZodEffects<z.ZodString, string, string>>;
|
|
287
287
|
media: z.ZodOptional<z.ZodArray<z.ZodEffects<z.ZodString, string, string>, "many">>;
|
|
288
288
|
idempotency_key: z.ZodOptional<z.ZodString>;
|
|
@@ -455,7 +455,7 @@ export declare const PostPublishSchema: z.ZodObject<{
|
|
|
455
455
|
}>>;
|
|
456
456
|
}, "strip", z.ZodTypeAny, {
|
|
457
457
|
content: string;
|
|
458
|
-
|
|
458
|
+
profiles: string[];
|
|
459
459
|
draft?: boolean | undefined;
|
|
460
460
|
schedule?: string | undefined;
|
|
461
461
|
media?: string[] | undefined;
|
|
@@ -500,7 +500,7 @@ export declare const PostPublishSchema: z.ZodObject<{
|
|
|
500
500
|
} | undefined;
|
|
501
501
|
}, {
|
|
502
502
|
content: string;
|
|
503
|
-
|
|
503
|
+
profiles: string[];
|
|
504
504
|
draft?: boolean | undefined;
|
|
505
505
|
schedule?: string | undefined;
|
|
506
506
|
media?: string[] | undefined;
|
package/dist/utils/validation.js
CHANGED
|
@@ -126,7 +126,7 @@ export const PlatformParamsSchema = z.object({
|
|
|
126
126
|
*/
|
|
127
127
|
export const PostPublishSchema = z.object({
|
|
128
128
|
content: z.string().min(1, "Content cannot be empty"),
|
|
129
|
-
|
|
129
|
+
profiles: z.array(z.string()).min(1, "At least one profile is required"),
|
|
130
130
|
schedule: ISO8601DateSchema.optional(),
|
|
131
131
|
media: z.array(MediaItemSchema).optional(),
|
|
132
132
|
idempotency_key: z.string().optional(),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAChD,CAAC,IAAI,EAAE,EAAE;IACP,MAAM,CAAC,GAAG,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC;IACzB,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACnD,CAAC,EACD;IACE,OAAO,EAAE,mEAAmE;CAC7E,CACF,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC;IACtC,OAAO,EAAE,qBAAqB;CAC/B,CAAC,CAAC;AAEH;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,0DAA0D;IAC1D,OAAO,CACL,KAAK,CAAC,UAAU,CAAC,GAAG,CAAC;QACrB,KAAK,CAAC,UAAU,CAAC,IAAI,CAAC;QACtB,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC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AY,GAAG,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,IAAI,IAAI,EAAE,CAAC;IACvB,OAAO,YAAY,GAAG,GAAG,CAAC;AAC5B,CAAC"}
|
package/package.json
CHANGED
package/src/server.ts
CHANGED
|
@@ -32,7 +32,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
32
32
|
},
|
|
33
33
|
{
|
|
34
34
|
name: "profiles.list",
|
|
35
|
-
description: "List all available social media profiles
|
|
35
|
+
description: "List all available social media profiles for posting",
|
|
36
36
|
inputSchema: {
|
|
37
37
|
type: "object",
|
|
38
38
|
properties: {},
|
|
@@ -40,7 +40,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
name: "post.publish",
|
|
43
|
-
description: "Publish a post to specified social media
|
|
43
|
+
description: "Publish a post to specified social media profiles. Supports text content, media attachments, scheduling, drafts, and platform-specific customization via the 'platforms' parameter.",
|
|
44
44
|
inputSchema: {
|
|
45
45
|
type: "object",
|
|
46
46
|
properties: {
|
|
@@ -48,10 +48,10 @@ export const TOOL_DEFINITIONS = [
|
|
|
48
48
|
type: "string",
|
|
49
49
|
description: "Post content text (caption/description)",
|
|
50
50
|
},
|
|
51
|
-
|
|
51
|
+
profiles: {
|
|
52
52
|
type: "array",
|
|
53
53
|
items: { type: "string" },
|
|
54
|
-
description: "Array of
|
|
54
|
+
description: "Array of profile IDs (hashids) or platform names (e.g., 'linkedin', 'instagram', 'twitter'). When using platform names, posts to the first connected profile for that platform.",
|
|
55
55
|
},
|
|
56
56
|
schedule: {
|
|
57
57
|
type: "string",
|
|
@@ -117,7 +117,7 @@ export const TOOL_DEFINITIONS = [
|
|
|
117
117
|
additionalProperties: true,
|
|
118
118
|
},
|
|
119
119
|
},
|
|
120
|
-
required: ["content", "
|
|
120
|
+
required: ["content", "profiles"],
|
|
121
121
|
},
|
|
122
122
|
},
|
|
123
123
|
{
|
package/src/tools/post.ts
CHANGED
|
@@ -7,13 +7,12 @@ import { PostPublishSchema } from "../utils/validation.js";
|
|
|
7
7
|
import { generateIdempotencyKey } from "../utils/idempotency.js";
|
|
8
8
|
import { createError, ErrorCodes } from "../utils/errors.js";
|
|
9
9
|
import { logError } from "../utils/logger.js";
|
|
10
|
-
import { handleProfilesList } from "./profiles.js";
|
|
11
10
|
|
|
12
11
|
export async function handlePostPublish(
|
|
13
12
|
client: PostProxyClient,
|
|
14
13
|
args: {
|
|
15
14
|
content: string;
|
|
16
|
-
|
|
15
|
+
profiles: string[];
|
|
17
16
|
schedule?: string;
|
|
18
17
|
media?: string[];
|
|
19
18
|
idempotency_key?: string;
|
|
@@ -38,7 +37,7 @@ export async function handlePostPublish(
|
|
|
38
37
|
text: JSON.stringify(
|
|
39
38
|
{
|
|
40
39
|
summary: {
|
|
41
|
-
|
|
40
|
+
profiles: args.profiles,
|
|
42
41
|
content_preview: args.content.substring(0, 100) + (args.content.length > 100 ? "..." : ""),
|
|
43
42
|
media_count: args.media?.length || 0,
|
|
44
43
|
schedule_time: args.schedule,
|
|
@@ -54,42 +53,14 @@ export async function handlePostPublish(
|
|
|
54
53
|
};
|
|
55
54
|
}
|
|
56
55
|
|
|
57
|
-
//
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
const targetsMap = new Map<string, any>();
|
|
61
|
-
for (const target of profilesData.targets || []) {
|
|
62
|
-
targetsMap.set(target.id, target);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Convert target IDs to platform names (API expects platform names, not IDs)
|
|
66
|
-
const platformNames: string[] = [];
|
|
67
|
-
for (const targetId of args.targets) {
|
|
68
|
-
const target = targetsMap.get(targetId);
|
|
69
|
-
if (!target) {
|
|
70
|
-
throw createError(ErrorCodes.TARGET_NOT_FOUND, `Target ${targetId} not found`);
|
|
71
|
-
}
|
|
72
|
-
platformNames.push(target.platform); // platform name (e.g., "twitter")
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// Validate that platforms keys match platform names if platforms are provided
|
|
76
|
-
if (args.platforms) {
|
|
77
|
-
const platformKeys = Object.keys(args.platforms);
|
|
78
|
-
const invalidPlatforms = platformKeys.filter(
|
|
79
|
-
(key) => !platformNames.includes(key)
|
|
80
|
-
);
|
|
81
|
-
if (invalidPlatforms.length > 0) {
|
|
82
|
-
throw createError(
|
|
83
|
-
ErrorCodes.VALIDATION_ERROR,
|
|
84
|
-
`Platform parameters specified for platforms not in targets: ${invalidPlatforms.join(", ")}. Available platforms: ${platformNames.join(", ")}`
|
|
85
|
-
);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
56
|
+
// Note: The API accepts both profile IDs (hashids) and platform names (e.g., "linkedin", "twitter")
|
|
57
|
+
// We pass the profiles array directly without conversion
|
|
58
|
+
// Platform parameter validation is optional - if provided, it should match the platforms being posted to
|
|
88
59
|
|
|
89
60
|
// Generate idempotency key if not provided
|
|
90
61
|
const idempotencyKey = args.idempotency_key || generateIdempotencyKey(
|
|
91
62
|
args.content,
|
|
92
|
-
args.
|
|
63
|
+
args.profiles,
|
|
93
64
|
args.schedule
|
|
94
65
|
);
|
|
95
66
|
|
|
@@ -101,7 +72,7 @@ export async function handlePostPublish(
|
|
|
101
72
|
try {
|
|
102
73
|
const response = await client.createPost({
|
|
103
74
|
content: args.content,
|
|
104
|
-
profiles:
|
|
75
|
+
profiles: args.profiles, // API accepts both profile IDs (hashids) and platform names
|
|
105
76
|
schedule: args.schedule,
|
|
106
77
|
media: args.media,
|
|
107
78
|
idempotency_key: idempotencyKey,
|
package/src/tools/profiles.ts
CHANGED
|
@@ -21,7 +21,7 @@ export async function handleProfilesList(client: PostProxyClient) {
|
|
|
21
21
|
const profileGroups = await client.getProfileGroups();
|
|
22
22
|
|
|
23
23
|
// Get profiles for each group
|
|
24
|
-
const
|
|
24
|
+
const allProfiles: Array<{
|
|
25
25
|
id: string;
|
|
26
26
|
name: string;
|
|
27
27
|
platform: string;
|
|
@@ -32,7 +32,7 @@ export async function handleProfilesList(client: PostProxyClient) {
|
|
|
32
32
|
try {
|
|
33
33
|
const profiles = await client.getProfiles(group.id);
|
|
34
34
|
for (const profile of profiles) {
|
|
35
|
-
|
|
35
|
+
allProfiles.push({
|
|
36
36
|
id: profile.id, // Already a string
|
|
37
37
|
name: profile.name,
|
|
38
38
|
platform: profile.platform,
|
|
@@ -51,7 +51,7 @@ export async function handleProfilesList(client: PostProxyClient) {
|
|
|
51
51
|
type: "text",
|
|
52
52
|
text: JSON.stringify(
|
|
53
53
|
{
|
|
54
|
-
|
|
54
|
+
profiles: allProfiles,
|
|
55
55
|
},
|
|
56
56
|
null,
|
|
57
57
|
2
|
package/src/utils/validation.ts
CHANGED
|
@@ -147,7 +147,7 @@ export const PlatformParamsSchema = z.object({
|
|
|
147
147
|
*/
|
|
148
148
|
export const PostPublishSchema = z.object({
|
|
149
149
|
content: z.string().min(1, "Content cannot be empty"),
|
|
150
|
-
|
|
150
|
+
profiles: z.array(z.string()).min(1, "At least one profile is required"),
|
|
151
151
|
schedule: ISO8601DateSchema.optional(),
|
|
152
152
|
media: z.array(MediaItemSchema).optional(),
|
|
153
153
|
idempotency_key: z.string().optional(),
|
package/worker/index.ts
CHANGED
|
@@ -855,15 +855,29 @@ export default class PostProxyMCP extends WorkerEntrypoint<Env> {
|
|
|
855
855
|
}
|
|
856
856
|
}
|
|
857
857
|
|
|
858
|
+
/**
|
|
859
|
+
* CORS headers for all responses
|
|
860
|
+
*/
|
|
861
|
+
private corsHeaders = {
|
|
862
|
+
"Access-Control-Allow-Origin": "*",
|
|
863
|
+
"Access-Control-Allow-Methods": "GET, POST, OPTIONS",
|
|
864
|
+
"Access-Control-Allow-Headers": "Content-Type, X-PostProxy-API-Key",
|
|
865
|
+
};
|
|
866
|
+
|
|
858
867
|
/**
|
|
859
868
|
* Handle incoming requests
|
|
860
869
|
*/
|
|
861
870
|
async fetch(request: Request): Promise<Response> {
|
|
862
871
|
const url = new URL(request.url);
|
|
863
872
|
|
|
873
|
+
// Handle CORS preflight
|
|
874
|
+
if (request.method === "OPTIONS") {
|
|
875
|
+
return new Response(null, { status: 204, headers: this.corsHeaders });
|
|
876
|
+
}
|
|
877
|
+
|
|
864
878
|
// Only handle /mcp path
|
|
865
879
|
if (url.pathname !== "/mcp") {
|
|
866
|
-
return new Response("Not Found", { status: 404 });
|
|
880
|
+
return new Response("Not Found", { status: 404, headers: this.corsHeaders });
|
|
867
881
|
}
|
|
868
882
|
|
|
869
883
|
// Extract API key from header or query parameter
|
|
@@ -877,16 +891,16 @@ export default class PostProxyMCP extends WorkerEntrypoint<Env> {
|
|
|
877
891
|
|
|
878
892
|
// Notifications don't get a response
|
|
879
893
|
if (result === null) {
|
|
880
|
-
return new Response(null, { status: 204 });
|
|
894
|
+
return new Response(null, { status: 204, headers: this.corsHeaders });
|
|
881
895
|
}
|
|
882
896
|
|
|
883
|
-
return Response.json(result);
|
|
897
|
+
return Response.json(result, { headers: this.corsHeaders });
|
|
884
898
|
} catch (e: any) {
|
|
885
899
|
return Response.json({
|
|
886
900
|
jsonrpc: "2.0",
|
|
887
901
|
error: { code: -32700, message: "Parse error" },
|
|
888
902
|
id: null,
|
|
889
|
-
}, { status: 400 });
|
|
903
|
+
}, { status: 400, headers: this.corsHeaders });
|
|
890
904
|
}
|
|
891
905
|
}
|
|
892
906
|
|
|
@@ -896,6 +910,6 @@ export default class PostProxyMCP extends WorkerEntrypoint<Env> {
|
|
|
896
910
|
version: "0.1.0",
|
|
897
911
|
description: "MCP server for PostProxy API",
|
|
898
912
|
tools: this.getTools().map(t => t.name),
|
|
899
|
-
});
|
|
913
|
+
}, { headers: this.corsHeaders });
|
|
900
914
|
}
|
|
901
915
|
}
|