@onlypult/mcp 0.1.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/LICENSE +21 -0
- package/README.md +94 -0
- package/dist/api-client.d.ts +23 -0
- package/dist/api-client.js +74 -0
- package/dist/api-client.js.map +1 -0
- package/dist/api-error.d.ts +9 -0
- package/dist/api-error.js +28 -0
- package/dist/api-error.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +73 -0
- package/dist/cli.js.map +1 -0
- package/dist/media-upload.d.ts +28 -0
- package/dist/media-upload.js +123 -0
- package/dist/media-upload.js.map +1 -0
- package/dist/package-version.d.ts +2 -0
- package/dist/package-version.js +10 -0
- package/dist/package-version.js.map +1 -0
- package/dist/schemas/platform-options.d.ts +1145 -0
- package/dist/schemas/platform-options.js +80 -0
- package/dist/schemas/platform-options.js.map +1 -0
- package/dist/tools/media.d.ts +3 -0
- package/dist/tools/media.js +170 -0
- package/dist/tools/media.js.map +1 -0
- package/dist/tools/posts.d.ts +3 -0
- package/dist/tools/posts.js +188 -0
- package/dist/tools/posts.js.map +1 -0
- package/dist/tools/profiles.d.ts +3 -0
- package/dist/tools/profiles.js +98 -0
- package/dist/tools/profiles.js.map +1 -0
- package/dist/types.d.ts +50 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +49 -0
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* Per-platform settings passed as platform_options.{key} in POST/PUT /v1/posts.
|
|
4
|
+
* Keys: instagram, facebook, youtube, tiktok, telegram, linkedin, pinterest,
|
|
5
|
+
* twitter, threads, bluesky, wordpress, google_my_business, vkontakte.
|
|
6
|
+
*/
|
|
7
|
+
export const platformSettingsSchema = z
|
|
8
|
+
.object({
|
|
9
|
+
is_story: z.boolean().optional().describe('Instagram/Facebook/VK story (mutually exclusive with is_reels, is_shorts)'),
|
|
10
|
+
is_reels: z.boolean().optional().describe('Instagram/Facebook Reels (mutually exclusive with is_story, is_shorts)'),
|
|
11
|
+
is_shorts: z.boolean().optional().describe('YouTube Shorts (mutually exclusive with is_story, is_reels)'),
|
|
12
|
+
title: z.string().optional().describe('Platform-specific title (overrides top-level title)'),
|
|
13
|
+
privacy: z
|
|
14
|
+
.string()
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('YouTube: public|unlisted|private. TikTok: PUBLIC_TO_EVERYONE|MUTUAL_FOLLOW_FRIENDS|FOLLOWER_OF_CREATOR|SELF_ONLY'),
|
|
17
|
+
category: z.string().optional().describe('YouTube category ID — call profiles_get_youtube_categories first'),
|
|
18
|
+
disable_comment: z.boolean().optional().describe('TikTok: disable comments'),
|
|
19
|
+
disable_duet: z.boolean().optional().describe('TikTok: disable duet'),
|
|
20
|
+
disable_stitch: z.boolean().optional().describe('TikTok: disable stitch'),
|
|
21
|
+
disable_notification: z.boolean().optional().describe('Telegram: send silently'),
|
|
22
|
+
pin_message: z.boolean().optional().describe('Telegram: pin after publish'),
|
|
23
|
+
visibility: z.enum(['PUBLIC', 'CONNECTIONS']).optional().describe('LinkedIn post visibility'),
|
|
24
|
+
board_id: z.string().optional().describe('Pinterest board ID — call profiles_get_pinterest_boards first'),
|
|
25
|
+
link: z.string().optional().describe('Pinterest destination link'),
|
|
26
|
+
alt_text: z.string().optional().describe('Pinterest image alt text'),
|
|
27
|
+
})
|
|
28
|
+
.strict();
|
|
29
|
+
export const platformOptionsSchema = z
|
|
30
|
+
.object({
|
|
31
|
+
instagram: platformSettingsSchema.optional(),
|
|
32
|
+
facebook: platformSettingsSchema.optional(),
|
|
33
|
+
youtube: platformSettingsSchema.optional(),
|
|
34
|
+
tiktok: platformSettingsSchema.optional(),
|
|
35
|
+
telegram: platformSettingsSchema.optional(),
|
|
36
|
+
linkedin: platformSettingsSchema.optional(),
|
|
37
|
+
pinterest: platformSettingsSchema.optional(),
|
|
38
|
+
twitter: platformSettingsSchema.optional(),
|
|
39
|
+
threads: platformSettingsSchema.optional(),
|
|
40
|
+
bluesky: platformSettingsSchema.optional(),
|
|
41
|
+
wordpress: platformSettingsSchema.optional(),
|
|
42
|
+
google_my_business: platformSettingsSchema.optional(),
|
|
43
|
+
vkontakte: platformSettingsSchema.optional(),
|
|
44
|
+
})
|
|
45
|
+
.strict()
|
|
46
|
+
.optional();
|
|
47
|
+
export const PLATFORM_OPTIONS_HINT = `platform_options: per-platform settings object. Example:
|
|
48
|
+
{ "instagram": { "is_reels": true }, "youtube": { "is_shorts": true, "privacy": "public" } }
|
|
49
|
+
Post type flags (at most one per platform): is_story, is_reels, is_shorts.
|
|
50
|
+
Other fields: privacy, category (YouTube — use profiles_get_youtube_categories); disable_comment, disable_duet, disable_stitch (TikTok);
|
|
51
|
+
disable_notification, pin_message (Telegram); visibility (LinkedIn); board_id (Pinterest — use profiles_get_pinterest_boards), link, alt_text (Pinterest).`;
|
|
52
|
+
export function mergePlatformOptions(base, overrides) {
|
|
53
|
+
if (!base && !overrides) {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
const result = { ...(base ?? {}) };
|
|
57
|
+
if (overrides) {
|
|
58
|
+
for (const [platform, settings] of Object.entries(overrides)) {
|
|
59
|
+
if (!settings) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
const key = platform;
|
|
63
|
+
result[key] = { ...(result[key] ?? {}), ...settings };
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
return result;
|
|
67
|
+
}
|
|
68
|
+
export const STORY_PLATFORM_OPTIONS = {
|
|
69
|
+
instagram: { is_story: true },
|
|
70
|
+
facebook: { is_story: true },
|
|
71
|
+
vkontakte: { is_story: true },
|
|
72
|
+
};
|
|
73
|
+
export const REELS_PLATFORM_OPTIONS = {
|
|
74
|
+
instagram: { is_reels: true },
|
|
75
|
+
facebook: { is_reels: true },
|
|
76
|
+
};
|
|
77
|
+
export const SHORTS_PLATFORM_OPTIONS = {
|
|
78
|
+
youtube: { is_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0,0 +1,170 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiErrorResult } from '../api-error.js';
|
|
3
|
+
import { isLocalFileUploadError, uploadLocalFile } from '../media-upload.js';
|
|
4
|
+
const BROWSER_UPLOAD_TOOL_DESCRIPTION = `Generate a browser upload URL for images or videos (fallback upload flow).
|
|
5
|
+
|
|
6
|
+
**When to use:**
|
|
7
|
+
- No readable file_path on disk (chat attachment only, path unknown)
|
|
8
|
+
- User prefers to upload manually in a browser
|
|
9
|
+
- Multiple files in one drag-and-drop session
|
|
10
|
+
|
|
11
|
+
**When NOT to use (prefer media_upload_file instead):**
|
|
12
|
+
- @onlypult/mcp runs locally (this package) and you have a workspace file path
|
|
13
|
+
- Example: ./assets/photo.jpg or /home/user/project/temp/118.jpg
|
|
14
|
+
- File already at a public HTTP(S) URL → use media_urls in posts_create
|
|
15
|
+
|
|
16
|
+
Flow:
|
|
17
|
+
1. Call this tool → get upload_url and token
|
|
18
|
+
2. Ask user to open upload_url in browser
|
|
19
|
+
3. User uploads files via the web page
|
|
20
|
+
4. Call media_check_status with the token
|
|
21
|
+
5. Use file IDs in posts_create / posts_update (media_ids)
|
|
22
|
+
|
|
23
|
+
Match is_story / is_reels with post tools and platform_options when applicable.
|
|
24
|
+
|
|
25
|
+
Supported: JPG, PNG, WebP, GIF, MP4, MOV, WebM. Max size: plan-dependent (up to 1GB).`;
|
|
26
|
+
const LOCAL_UPLOAD_TOOL_DESCRIPTION = `Upload a local image or video file directly to Onlypult (no browser step).
|
|
27
|
+
|
|
28
|
+
**When to use (preferred with @onlypult/mcp local package):**
|
|
29
|
+
- This MCP server runs on the user's machine via stdio (Cursor, Claude Desktop, Windsurf)
|
|
30
|
+
- You have an absolute or workspace-relative file_path the server can read
|
|
31
|
+
- Example: /home/user/project/assets/photo.jpg or ./marketing/video.mp4
|
|
32
|
+
|
|
33
|
+
**When NOT to use:**
|
|
34
|
+
- file_path is missing or not on disk → use media_get_upload_url (browser) instead
|
|
35
|
+
- File is only a chat attachment without a saved path on disk
|
|
36
|
+
- File is already at a public URL → use media_urls in posts_create
|
|
37
|
+
|
|
38
|
+
Creates an upload session automatically unless token is provided (from media_get_upload_url).
|
|
39
|
+
Uses multipart upload internally for files larger than 5MB.
|
|
40
|
+
|
|
41
|
+
Returns file id for media_ids in posts_create / posts_update.`;
|
|
42
|
+
export function registerMediaTools(server, ctx) {
|
|
43
|
+
server.tool('media_get_upload_url', BROWSER_UPLOAD_TOOL_DESCRIPTION, {
|
|
44
|
+
is_story: z.boolean().optional().describe('Upload as Instagram/Facebook story (default: false)'),
|
|
45
|
+
is_reels: z.boolean().optional().describe('Upload as Instagram Reels (default: false)'),
|
|
46
|
+
}, async ({ is_story, is_reels }) => {
|
|
47
|
+
try {
|
|
48
|
+
const { api } = ctx();
|
|
49
|
+
const data = await api.post('/v1/media/upload-url', {
|
|
50
|
+
is_story: is_story ?? false,
|
|
51
|
+
is_reels: is_reels ?? false,
|
|
52
|
+
});
|
|
53
|
+
return {
|
|
54
|
+
content: [
|
|
55
|
+
{
|
|
56
|
+
type: 'text',
|
|
57
|
+
text: [
|
|
58
|
+
`Upload URL generated (browser flow).`,
|
|
59
|
+
``,
|
|
60
|
+
`Open this link in your browser to upload files:`,
|
|
61
|
+
data.upload_url,
|
|
62
|
+
``,
|
|
63
|
+
`Token: ${data.token}`,
|
|
64
|
+
``,
|
|
65
|
+
`After uploading, say "done" and I'll check the status with media_check_status.`,
|
|
66
|
+
``,
|
|
67
|
+
`Tip: with @onlypult/mcp (local), prefer media_upload_file when you have a file_path on disk.`,
|
|
68
|
+
].join('\n'),
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
catch (err) {
|
|
74
|
+
return apiErrorResult(err);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
server.tool('media_upload_file', LOCAL_UPLOAD_TOOL_DESCRIPTION, {
|
|
78
|
+
file_path: z.string().describe('Absolute or relative path to a local file readable by the MCP server'),
|
|
79
|
+
token: z.string().optional().describe('Optional upload session token from media_get_upload_url (auto-created if omitted)'),
|
|
80
|
+
is_story: z.boolean().optional().describe('Upload as Instagram/Facebook story (default: false)'),
|
|
81
|
+
is_reels: z.boolean().optional().describe('Upload as Instagram Reels (default: false)'),
|
|
82
|
+
}, async ({ file_path, token, is_story, is_reels }) => {
|
|
83
|
+
try {
|
|
84
|
+
const { api, apiKey } = ctx();
|
|
85
|
+
const file = await uploadLocalFile(apiKey, api, file_path, {
|
|
86
|
+
token,
|
|
87
|
+
is_story,
|
|
88
|
+
is_reels,
|
|
89
|
+
});
|
|
90
|
+
return {
|
|
91
|
+
content: [
|
|
92
|
+
{
|
|
93
|
+
type: 'text',
|
|
94
|
+
text: [
|
|
95
|
+
`File uploaded successfully.`,
|
|
96
|
+
``,
|
|
97
|
+
`ID: ${file.id}`,
|
|
98
|
+
`Filename: ${file.filename ?? file_path}`,
|
|
99
|
+
`Type: ${file.type ?? 'unknown'}`,
|
|
100
|
+
`Session token: ${file.token}`,
|
|
101
|
+
``,
|
|
102
|
+
`Use media_ids: ["${file.id}"] in posts_create or posts_update.`,
|
|
103
|
+
].join('\n'),
|
|
104
|
+
},
|
|
105
|
+
],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
catch (err) {
|
|
109
|
+
if (isLocalFileUploadError(err)) {
|
|
110
|
+
return {
|
|
111
|
+
isError: true,
|
|
112
|
+
content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }],
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return apiErrorResult(err);
|
|
116
|
+
}
|
|
117
|
+
});
|
|
118
|
+
server.tool('media_check_status', `Check upload session status and list file IDs.
|
|
119
|
+
|
|
120
|
+
Use after media_get_upload_url browser flow when the user says "done".
|
|
121
|
+
Not needed after media_upload_file (file id is returned immediately).
|
|
122
|
+
|
|
123
|
+
| token | string | Yes | Token from media_get_upload_url |`, {
|
|
124
|
+
token: z.string().describe('The upload token from media_get_upload_url'),
|
|
125
|
+
}, async ({ token }) => {
|
|
126
|
+
try {
|
|
127
|
+
const { api } = ctx();
|
|
128
|
+
const data = await api.get(`/v1/media/upload-status/${token}`);
|
|
129
|
+
if (data.status === 'pending') {
|
|
130
|
+
return {
|
|
131
|
+
content: [
|
|
132
|
+
{
|
|
133
|
+
type: 'text',
|
|
134
|
+
text: 'Upload is still in progress. Please wait a moment and try again.',
|
|
135
|
+
},
|
|
136
|
+
],
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
if (data.status === 'failed') {
|
|
140
|
+
return {
|
|
141
|
+
content: [
|
|
142
|
+
{
|
|
143
|
+
type: 'text',
|
|
144
|
+
text: 'Upload failed. Please try again using media_get_upload_url or media_upload_file.',
|
|
145
|
+
},
|
|
146
|
+
],
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
const fileList = data.files.map(f => `- ${f.filename} (${f.type}) — ID: ${f.id}`).join('\n');
|
|
150
|
+
return {
|
|
151
|
+
content: [
|
|
152
|
+
{
|
|
153
|
+
type: 'text',
|
|
154
|
+
text: [
|
|
155
|
+
`Upload completed! ${data.files.length} file(s) ready:`,
|
|
156
|
+
fileList,
|
|
157
|
+
``,
|
|
158
|
+
`File IDs: ${data.files.map(f => f.id).join(', ')}`,
|
|
159
|
+
`Use these IDs in the media_ids parameter when creating your post.`,
|
|
160
|
+
].join('\n'),
|
|
161
|
+
},
|
|
162
|
+
],
|
|
163
|
+
};
|
|
164
|
+
}
|
|
165
|
+
catch (err) {
|
|
166
|
+
return apiErrorResult(err);
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
//# sourceMappingURL=media.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"media.js","sourceRoot":"","sources":["../../src/tools/media.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB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C;YAC7F,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE;4BACJ,qBAAqB,IAAI,CAAC,KAAK,CAAC,MAAM,iBAAiB;4BACvD,QAAQ;4BACR,EAAE;4BACF,aAAa,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE;4BACnD,mEAAmE;yBACpE,CAAC,IAAI,CAAC,IAAI,CAAC;qBACb;iBACF;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,188 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { apiErrorResult } from '../api-error.js';
|
|
3
|
+
import { PLATFORM_OPTIONS_HINT, REELS_PLATFORM_OPTIONS, SHORTS_PLATFORM_OPTIONS, STORY_PLATFORM_OPTIONS, mergePlatformOptions, platformOptionsSchema, } from '../schemas/platform-options.js';
|
|
4
|
+
const PUBLISH_AT_HINT = 'Schedule time in account timezone, format "Y-m-d H:i" (e.g. "2026-07-07 14:00"). Call account_get for timezone and plan_end_at.';
|
|
5
|
+
const postCreateBaseSchema = {
|
|
6
|
+
content: z.string().optional().describe('Post text/content. Required unless media_ids or media_urls provided.'),
|
|
7
|
+
profile_ids: z.array(z.string()).describe('Profile IDs to post to (from profiles_list)'),
|
|
8
|
+
is_draft: z.boolean().optional().describe('Save as draft without publishing (default: false)'),
|
|
9
|
+
publish_now: z.boolean().optional().describe('Publish immediately (default: false)'),
|
|
10
|
+
publish_at: z.string().optional().describe(PUBLISH_AT_HINT),
|
|
11
|
+
title: z.string().optional().describe('Post title (required for YouTube, recommended for Pinterest)'),
|
|
12
|
+
media_ids: z.array(z.string()).optional().describe('Media file IDs from media_check_status'),
|
|
13
|
+
media_urls: z
|
|
14
|
+
.array(z.string().url())
|
|
15
|
+
.optional()
|
|
16
|
+
.describe('Public image/video URLs (downloaded server-side, up to 10)'),
|
|
17
|
+
platform_options: platformOptionsSchema.describe(PLATFORM_OPTIONS_HINT),
|
|
18
|
+
};
|
|
19
|
+
async function createPost(ctx, params) {
|
|
20
|
+
try {
|
|
21
|
+
const { api } = ctx();
|
|
22
|
+
const data = await api.post('/v1/posts', params);
|
|
23
|
+
return {
|
|
24
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
return apiErrorResult(err);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
export function registerPostTools(server, ctx) {
|
|
32
|
+
server.tool('posts_create', `Create a social media post in Onlypult. Choose the correct mode:
|
|
33
|
+
- DRAFT (is_draft=true): save without scheduling
|
|
34
|
+
- PUBLISH NOW (publish_now=true): post immediately
|
|
35
|
+
- SCHEDULED (default): provide publish_at in "Y-m-d H:i" format (account timezone)
|
|
36
|
+
|
|
37
|
+
Before scheduling, call account_get to check plan_end_at and timezone.
|
|
38
|
+
If API returns retryable=false, do NOT retry — explain the issue to the user.
|
|
39
|
+
|
|
40
|
+
For Story / Reels / Shorts use posts_create_story, posts_create_reels, posts_create_shorts,
|
|
41
|
+
or set platform_options (e.g. instagram.is_reels=true, youtube.is_shorts=true).
|
|
42
|
+
|
|
43
|
+
${PLATFORM_OPTIONS_HINT}
|
|
44
|
+
|
|
45
|
+
Call profiles_list first to get profile IDs.`, postCreateBaseSchema, async (params) => createPost(ctx, params));
|
|
46
|
+
server.tool('posts_create_story', `Create a Story post (Instagram, Facebook, VK). Requires video or image media.
|
|
47
|
+
Sets platform_options is_story=true for supported platforms. Merge with platform_options for extra settings.`, postCreateBaseSchema, async (params) => createPost(ctx, {
|
|
48
|
+
...params,
|
|
49
|
+
platform_options: mergePlatformOptions(STORY_PLATFORM_OPTIONS, params.platform_options),
|
|
50
|
+
}));
|
|
51
|
+
server.tool('posts_create_reels', `Create an Instagram/Facebook Reels post. Requires vertical video media.
|
|
52
|
+
Sets platform_options is_reels=true for Instagram and Facebook.`, postCreateBaseSchema, async (params) => createPost(ctx, {
|
|
53
|
+
...params,
|
|
54
|
+
platform_options: mergePlatformOptions(REELS_PLATFORM_OPTIONS, params.platform_options),
|
|
55
|
+
}));
|
|
56
|
+
server.tool('posts_create_shorts', `Create a YouTube Shorts post. Requires short vertical video.
|
|
57
|
+
Sets platform_options youtube.is_shorts=true.`, postCreateBaseSchema, async (params) => createPost(ctx, {
|
|
58
|
+
...params,
|
|
59
|
+
platform_options: mergePlatformOptions(SHORTS_PLATFORM_OPTIONS, params.platform_options),
|
|
60
|
+
}));
|
|
61
|
+
server.tool('posts_publish_now', 'Publish a post immediately. Convenience shortcut — sets publish_now=true.', {
|
|
62
|
+
content: z.string().optional().describe('Post text/content'),
|
|
63
|
+
profile_ids: z.array(z.string()).describe('Profile IDs to post to'),
|
|
64
|
+
title: z.string().optional().describe('Post title (required for YouTube)'),
|
|
65
|
+
media_ids: z.array(z.string()).optional().describe('Media file IDs'),
|
|
66
|
+
media_urls: z.array(z.string().url()).optional().describe('Public media URLs'),
|
|
67
|
+
platform_options: platformOptionsSchema.describe(PLATFORM_OPTIONS_HINT),
|
|
68
|
+
}, async (params) => createPost(ctx, { ...params, publish_now: true }));
|
|
69
|
+
server.tool('posts_cross_post', 'Post the same content to multiple profiles at once. Can publish now or schedule.', {
|
|
70
|
+
content: z.string().optional().describe('Post text/content'),
|
|
71
|
+
profile_ids: z.array(z.string()).min(2).describe('At least 2 profile IDs'),
|
|
72
|
+
publish_now: z.boolean().optional().describe('Publish immediately (default: false)'),
|
|
73
|
+
publish_at: z.string().optional().describe(PUBLISH_AT_HINT),
|
|
74
|
+
media_ids: z.array(z.string()).optional().describe('Media file IDs'),
|
|
75
|
+
media_urls: z.array(z.string().url()).optional().describe('Public media URLs'),
|
|
76
|
+
platform_options: platformOptionsSchema.describe(PLATFORM_OPTIONS_HINT),
|
|
77
|
+
}, async (params) => createPost(ctx, params));
|
|
78
|
+
server.tool('posts_list', 'List posts in your Onlypult workspace with optional filters.', {
|
|
79
|
+
status: z.enum(['draft', 'scheduled', 'published', 'failed']).optional().describe('Filter by post status'),
|
|
80
|
+
profile_id: z.string().optional().describe('Filter by profile ID'),
|
|
81
|
+
limit: z.number().int().min(1).max(100).optional().describe('Max posts to return (default: 20)'),
|
|
82
|
+
page: z.number().int().min(1).optional().describe('Page number (default: 1)'),
|
|
83
|
+
}, async (params) => {
|
|
84
|
+
try {
|
|
85
|
+
const { api } = ctx();
|
|
86
|
+
const data = await api.get('/v1/posts', params);
|
|
87
|
+
return {
|
|
88
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
catch (err) {
|
|
92
|
+
return apiErrorResult(err);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
server.tool('posts_list_failed', 'List all failed posts that need to be retried.', {
|
|
96
|
+
profile_id: z.string().optional().describe('Filter by profile ID'),
|
|
97
|
+
limit: z.number().int().min(1).max(100).optional().describe('Max posts to return (default: 20)'),
|
|
98
|
+
}, async (params) => {
|
|
99
|
+
try {
|
|
100
|
+
const { api } = ctx();
|
|
101
|
+
const data = await api.get('/v1/posts', { ...params, status: 'failed' });
|
|
102
|
+
return {
|
|
103
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
catch (err) {
|
|
107
|
+
return apiErrorResult(err);
|
|
108
|
+
}
|
|
109
|
+
});
|
|
110
|
+
server.tool('posts_get', 'Get post details including is_story, is_reels, is_shorts flags, status, and error info if failed.', {
|
|
111
|
+
post_id: z.string().describe('The post ID'),
|
|
112
|
+
}, async ({ post_id }) => {
|
|
113
|
+
try {
|
|
114
|
+
const { api } = ctx();
|
|
115
|
+
const data = await api.get(`/v1/posts/${post_id}`);
|
|
116
|
+
return {
|
|
117
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
catch (err) {
|
|
121
|
+
return apiErrorResult(err);
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
server.tool('posts_update', `Update a draft or scheduled post. Cannot update published posts.
|
|
125
|
+
${PLATFORM_OPTIONS_HINT}`, {
|
|
126
|
+
post_id: z.string().describe('The post ID to update'),
|
|
127
|
+
content: z.string().optional().describe('New post text/content'),
|
|
128
|
+
publish_at: z.string().optional().describe(PUBLISH_AT_HINT),
|
|
129
|
+
title: z.string().optional().describe('New title'),
|
|
130
|
+
media_ids: z.array(z.string()).optional().describe('New media file IDs (replaces existing)'),
|
|
131
|
+
media_urls: z.array(z.string().url()).optional().describe('Public URLs merged with media_ids'),
|
|
132
|
+
platform_options: platformOptionsSchema.describe(PLATFORM_OPTIONS_HINT),
|
|
133
|
+
}, async ({ post_id, ...params }) => {
|
|
134
|
+
try {
|
|
135
|
+
const { api } = ctx();
|
|
136
|
+
const data = await api.put(`/v1/posts/${post_id}`, params);
|
|
137
|
+
return {
|
|
138
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
catch (err) {
|
|
142
|
+
return apiErrorResult(err);
|
|
143
|
+
}
|
|
144
|
+
});
|
|
145
|
+
server.tool('posts_delete', 'Delete a post. Only draft and scheduled posts can be deleted.', {
|
|
146
|
+
post_id: z.string().describe('The post ID to delete'),
|
|
147
|
+
}, async ({ post_id }) => {
|
|
148
|
+
try {
|
|
149
|
+
const { api } = ctx();
|
|
150
|
+
await api.delete(`/v1/posts/${post_id}`);
|
|
151
|
+
return {
|
|
152
|
+
content: [{ type: 'text', text: `Post ${post_id} deleted successfully.` }],
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
catch (err) {
|
|
156
|
+
return apiErrorResult(err);
|
|
157
|
+
}
|
|
158
|
+
});
|
|
159
|
+
server.tool('posts_retry', 'Retry a failed post. The post will be re-queued for publishing.', {
|
|
160
|
+
post_id: z.string().describe('The ID of the failed post to retry'),
|
|
161
|
+
}, async ({ post_id }) => {
|
|
162
|
+
try {
|
|
163
|
+
const { api } = ctx();
|
|
164
|
+
const data = await api.post(`/v1/posts/${post_id}/retry`);
|
|
165
|
+
return {
|
|
166
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
167
|
+
};
|
|
168
|
+
}
|
|
169
|
+
catch (err) {
|
|
170
|
+
return apiErrorResult(err);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
server.tool('posts_retry_all_failed', 'Retry all failed posts at once, optionally filtered by profile.', {
|
|
174
|
+
profile_id: z.string().optional().describe('Only retry failed posts for this profile'),
|
|
175
|
+
}, async (params) => {
|
|
176
|
+
try {
|
|
177
|
+
const { api } = ctx();
|
|
178
|
+
const data = await api.post('/v1/posts/retry-all-failed', params);
|
|
179
|
+
return {
|
|
180
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
catch (err) {
|
|
184
|
+
return apiErrorResult(err);
|
|
185
|
+
}
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
//# sourceMappingURL=posts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"posts.js","sourceRoot":"","sources":["../../src/tools/posts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EACtB,uBAAuB,EACvB,sBAAsB,EACtB,oBAAoB,EACpB,qBAAqB,GACtB,MAAM,gCAAgC,CAAC;AAExC,MAAM,eAAe,GACnB,iIAAiI,CAAC;AAEpI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
+
import { apiErrorResult } from '../api-error.js';
|
|
3
|
+
export function registerProfileTools(server, ctx) {
|
|
4
|
+
server.tool('account_get', 'Get account scheduling context: timezone, plan end date, and publish_at format. Call before scheduling posts.', {}, async () => {
|
|
5
|
+
try {
|
|
6
|
+
const { api } = ctx();
|
|
7
|
+
const data = await api.get('/v1/account');
|
|
8
|
+
return {
|
|
9
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
catch (err) {
|
|
13
|
+
return apiErrorResult(err);
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
server.tool('profiles_list', 'List all connected social media profiles (accounts) in your Onlypult workspace. Returns platform, name, username, status, and profile ID for each account.', {}, async () => {
|
|
17
|
+
try {
|
|
18
|
+
const { api } = ctx();
|
|
19
|
+
const data = await api.get('/v1/profiles');
|
|
20
|
+
return {
|
|
21
|
+
content: [
|
|
22
|
+
{
|
|
23
|
+
type: 'text',
|
|
24
|
+
text: JSON.stringify(data, null, 2),
|
|
25
|
+
},
|
|
26
|
+
],
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
return apiErrorResult(err);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
server.tool('profiles_get', 'Get details of a specific social media profile by its ID.', {
|
|
34
|
+
profile_id: z.string().describe('The profile ID (from profiles_list)'),
|
|
35
|
+
}, async ({ profile_id }) => {
|
|
36
|
+
try {
|
|
37
|
+
const { api } = ctx();
|
|
38
|
+
const data = await api.get(`/v1/profiles/${profile_id}`);
|
|
39
|
+
return {
|
|
40
|
+
content: [
|
|
41
|
+
{
|
|
42
|
+
type: 'text',
|
|
43
|
+
text: JSON.stringify(data, null, 2),
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
return apiErrorResult(err);
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
server.tool('profiles_platforms_list', 'List all social media platforms supported by Onlypult (e.g. instagram, facebook, twitter, tiktok, youtube, linkedin, telegram, bluesky, threads, pinterest, googleGmb, wordpress, vkontakte).', {}, async () => {
|
|
53
|
+
try {
|
|
54
|
+
const { api } = ctx();
|
|
55
|
+
const data = await api.get('/v1/profiles/platforms');
|
|
56
|
+
return {
|
|
57
|
+
content: [
|
|
58
|
+
{
|
|
59
|
+
type: 'text',
|
|
60
|
+
text: JSON.stringify(data, null, 2),
|
|
61
|
+
},
|
|
62
|
+
],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
return apiErrorResult(err);
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
server.tool('profiles_get_pinterest_boards', 'List Pinterest boards for a profile. Returns id and name for each board — use id in platform_options.pinterest.board_id when creating a post.', {
|
|
70
|
+
profile_id: z.string().describe('Pinterest profile ID (from profiles_list)'),
|
|
71
|
+
}, async ({ profile_id }) => {
|
|
72
|
+
try {
|
|
73
|
+
const { api } = ctx();
|
|
74
|
+
const data = await api.get(`/v1/profiles/${profile_id}/pinterest-boards`);
|
|
75
|
+
return {
|
|
76
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
catch (err) {
|
|
80
|
+
return apiErrorResult(err);
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
server.tool('profiles_get_youtube_categories', 'List YouTube video categories for a profile. Returns id and name — use id in platform_options.youtube.category when creating a post.', {
|
|
84
|
+
profile_id: z.string().describe('YouTube profile ID (from profiles_list)'),
|
|
85
|
+
}, async ({ profile_id }) => {
|
|
86
|
+
try {
|
|
87
|
+
const { api } = ctx();
|
|
88
|
+
const data = await api.get(`/v1/profiles/${profile_id}/youtube-categories`);
|
|
89
|
+
return {
|
|
90
|
+
content: [{ type: 'text', text: JSON.stringify(data, null, 2) }],
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (err) {
|
|
94
|
+
return apiErrorResult(err);
|
|
95
|
+
}
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
//# sourceMappingURL=profiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"profiles.js","sourceRoot":"","sources":["../../src/tools/profiles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,UAAU,oBAAoB,CAAC,MAAiB,EAAE,GAAsB;IAC5E,MAAM,CAAC,IAAI,CACT,aAAa,EACb,+GAA+G,EAC/G,EAAE,EACF,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;YACtB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,GAAG,CAAU,aAAa,CAAC,CAAC;YACnD,OAAO;gBACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;aAC1E,CAAC;QACJ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CACF,CAAC;IAEF,MAAM,CAAC,IAAI,CACT,eAAe,EACf,4JAA4J,EAC5J,EAAE,EACF,KAAK,IAAI,EAAE;QACT,IAAI,CAAC;YACH,MAAM,EAAE,GAAG,EAAE,GAAG,GAAG,EAAE,CAAC;YACtB,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,GAAG,CAAY,cAAc,CAAC,CAAC;YACtD,OAAO;gBACL,OAAO,EAAE;oBACP;wBACE,IAAI,EAAE,MAAe;wBACrB,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,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AO,GAAG,EAAE,CAAC;YACb,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC;QAC7B,CAAC;IACH,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { ApiClient } from './api-client.js';
|
|
2
|
+
export interface ToolContext {
|
|
3
|
+
api: ApiClient;
|
|
4
|
+
apiKey: string;
|
|
5
|
+
}
|
|
6
|
+
export interface Profile {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
username: string | null;
|
|
10
|
+
platform: string;
|
|
11
|
+
profile_type: string;
|
|
12
|
+
status: string;
|
|
13
|
+
picture: string | null;
|
|
14
|
+
platform_id: string;
|
|
15
|
+
typeName: string;
|
|
16
|
+
}
|
|
17
|
+
export interface Post {
|
|
18
|
+
id: string;
|
|
19
|
+
status: 'draft' | 'scheduled' | 'published' | 'failed';
|
|
20
|
+
content: string;
|
|
21
|
+
publish_at: string | null;
|
|
22
|
+
published_at: string | null;
|
|
23
|
+
platform: string;
|
|
24
|
+
profile_id: string;
|
|
25
|
+
media: MediaFile[];
|
|
26
|
+
error?: string;
|
|
27
|
+
}
|
|
28
|
+
export interface MediaFile {
|
|
29
|
+
id: string;
|
|
30
|
+
url: string;
|
|
31
|
+
type: 'image' | 'video';
|
|
32
|
+
filename: string;
|
|
33
|
+
}
|
|
34
|
+
export interface PostCreateParams {
|
|
35
|
+
content: string;
|
|
36
|
+
profile_ids: string[];
|
|
37
|
+
publish_at?: string;
|
|
38
|
+
publish_now?: boolean;
|
|
39
|
+
is_draft?: boolean;
|
|
40
|
+
media_ids?: string[];
|
|
41
|
+
title?: string;
|
|
42
|
+
}
|
|
43
|
+
export interface UploadUrlResponse {
|
|
44
|
+
token: string;
|
|
45
|
+
upload_url: string;
|
|
46
|
+
}
|
|
47
|
+
export interface UploadStatusResponse {
|
|
48
|
+
status: 'pending' | 'done' | 'failed';
|
|
49
|
+
files: MediaFile[];
|
|
50
|
+
}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
|