@omnisocials/mcp-server 1.7.0 → 1.7.1
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/build/client.d.ts +11 -0
- package/build/client.js +11 -0
- package/build/index.js +1 -1
- package/build/tools/media.js +61 -5
- package/package.json +1 -1
package/build/client.d.ts
CHANGED
|
@@ -141,6 +141,17 @@ export declare class OmniSocialsClient {
|
|
|
141
141
|
name?: string;
|
|
142
142
|
folder?: string;
|
|
143
143
|
}): Promise<ApiResponse<unknown>>;
|
|
144
|
+
/**
|
|
145
|
+
* Preflight a file's compatibility with the workspace's connected platforms
|
|
146
|
+
* BEFORE uploading. Provide one of: a public `url`, an existing `media_id`,
|
|
147
|
+
* or `size_bytes` + `mime`.
|
|
148
|
+
*/
|
|
149
|
+
checkMediaCompatibility(data: {
|
|
150
|
+
url?: string;
|
|
151
|
+
media_id?: string;
|
|
152
|
+
size_bytes?: number;
|
|
153
|
+
mime?: string;
|
|
154
|
+
}): Promise<ApiResponse<unknown>>;
|
|
144
155
|
deleteMedia(id: string): Promise<ApiResponse<unknown>>;
|
|
145
156
|
updateMedia(id: string, data: {
|
|
146
157
|
name?: string;
|
package/build/client.js
CHANGED
|
@@ -162,11 +162,22 @@ export class OmniSocialsClient {
|
|
|
162
162
|
return this.request("GET", "/media", undefined, params);
|
|
163
163
|
}
|
|
164
164
|
async uploadMedia(data) {
|
|
165
|
+
// Videos up to 1 GB: the API streams files >100 MB in the background and
|
|
166
|
+
// responds with the item in `processing` state. Includes a `compatibility`
|
|
167
|
+
// block listing connected platforms that would reject the file.
|
|
165
168
|
return this.request("POST", "/media/upload-from-url", data);
|
|
166
169
|
}
|
|
167
170
|
async uploadMediaFromBase64(data) {
|
|
168
171
|
return this.request("POST", "/media/upload-from-base64", data);
|
|
169
172
|
}
|
|
173
|
+
/**
|
|
174
|
+
* Preflight a file's compatibility with the workspace's connected platforms
|
|
175
|
+
* BEFORE uploading. Provide one of: a public `url`, an existing `media_id`,
|
|
176
|
+
* or `size_bytes` + `mime`.
|
|
177
|
+
*/
|
|
178
|
+
async checkMediaCompatibility(data) {
|
|
179
|
+
return this.request("POST", "/media/check", data);
|
|
180
|
+
}
|
|
170
181
|
async deleteMedia(id) {
|
|
171
182
|
return this.request("DELETE", `/media/${id}`);
|
|
172
183
|
}
|
package/build/index.js
CHANGED
|
@@ -27,7 +27,7 @@ const sessionState = { activeIndex: 0 };
|
|
|
27
27
|
const getActiveClient = () => workspaceClients[sessionState.activeIndex].client;
|
|
28
28
|
const server = new McpServer({
|
|
29
29
|
name: "OmniSocials",
|
|
30
|
-
version: "1.7.
|
|
30
|
+
version: "1.7.1",
|
|
31
31
|
});
|
|
32
32
|
// Register all tools - pass getter function so tools always use the active workspace's client
|
|
33
33
|
registerPostTools(server, getActiveClient);
|
package/build/tools/media.js
CHANGED
|
@@ -32,7 +32,7 @@ export function registerMediaTools(server, getClient) {
|
|
|
32
32
|
const isVideo = rawType === "video" || rawType.startsWith("video/");
|
|
33
33
|
const type = isVideo ? "Video" : "Image";
|
|
34
34
|
const folder = m.folder_id ? `\`${m.folder_id}\`` : "—";
|
|
35
|
-
md += `| ${i + 1} | ${type} | ${m.name || m.filename || "—"} | ${folder} | ${
|
|
35
|
+
md += `| ${i + 1} | ${type} | ${m.name || m.filename || "—"} | ${folder} | ${(m.size || "—")} | \`${m.id}\` |\n`;
|
|
36
36
|
}
|
|
37
37
|
md += `\nUse the **Media ID** with \`media_ids\` when creating posts. Rename or move a file with \`update_media\`. See folders with \`list_folders\`.`;
|
|
38
38
|
// Fetch thumbnails for image files (max 4)
|
|
@@ -55,7 +55,13 @@ export function registerMediaTools(server, getClient) {
|
|
|
55
55
|
content.push({ type: "text", text: md });
|
|
56
56
|
return { content };
|
|
57
57
|
});
|
|
58
|
-
server.tool("upload_media", `Upload media to the library. Accepts EITHER a public URL OR base64-encoded image data (e.g. when the user pastes an image directly in chat).
|
|
58
|
+
server.tool("upload_media", `Upload media to the library. Accepts EITHER a public URL OR base64-encoded image data (e.g. when the user pastes an image directly in chat). Supported: JPEG, PNG, GIF, WebP, MP4, MOV, AVI.
|
|
59
|
+
|
|
60
|
+
Size limits: base64 and direct uploads are capped at 100 MB (and base64 inflates the request body, so the practical ceiling is ~75 MB). For anything larger — up to 1 GB — use ONE of: (a) pass a public 'url' and the server fetches it (handles up to 1 GB), or (b) have the user upload the file in the OmniSocials Library UI at https://app.omnisocials.com/library . IMPORTANT: if the user has a large LOCAL file (over ~100 MB) with no public URL, do NOT tell them to compress or shrink it — instead point them to the Library UI link above, which uploads files up to 1 GB directly.
|
|
61
|
+
|
|
62
|
+
Large videos (over 100 MB) are processed in the background: the response comes back with status "processing" — the file is NOT usable in a post until its status is "ready". Re-check with list_media (search by the name you gave it) until its status is "ready".
|
|
63
|
+
|
|
64
|
+
Compatibility: the response includes a "compatibility" summary of any CONNECTED platforms that would reject the file (e.g. too large for Instagram). If there are warnings, RELAY them to the user and ask whether to continue before using the media in a post — the file still uploads and can post to the platforms that DO accept it. To check BEFORE uploading, use check_media_compatibility first.
|
|
59
65
|
|
|
60
66
|
When the user provides an image in the conversation (not a URL), use base64_data + mime_type to upload it directly.`, {
|
|
61
67
|
url: z.string().optional().describe("Public URL of the media file to upload. Use this OR base64_data, not both."),
|
|
@@ -89,22 +95,72 @@ When the user provides an image in the conversation (not a URL), use base64_data
|
|
|
89
95
|
};
|
|
90
96
|
}
|
|
91
97
|
const m = result.data;
|
|
92
|
-
|
|
98
|
+
const compatibility = result.compatibility;
|
|
99
|
+
const isProcessing = m.status === "processing";
|
|
100
|
+
let md = isProcessing ? `## Media Processing\n\n` : `## Media Uploaded\n\n`;
|
|
93
101
|
md += `| Field | Value |\n`;
|
|
94
102
|
md += `|-------|-------|\n`;
|
|
95
103
|
md += `| **Media ID** | \`${m.id}\` |\n`;
|
|
96
104
|
md += `| **Name** | ${m.name || m.filename || "—"} |\n`;
|
|
97
105
|
md += `| **Type** | ${m.type || "—"} |\n`;
|
|
106
|
+
if (m.status)
|
|
107
|
+
md += `| **Status** | ${m.status} |\n`;
|
|
98
108
|
if (m.folder_id)
|
|
99
109
|
md += `| **Folder** | \`${m.folder_id}\` |\n`;
|
|
100
|
-
md += `| **Size** | ${
|
|
110
|
+
md += `| **Size** | ${(m.size || "—")} |\n`;
|
|
101
111
|
if (m.url)
|
|
102
112
|
md += `| **URL** | ${m.url} |\n`;
|
|
103
|
-
|
|
113
|
+
if (isProcessing) {
|
|
114
|
+
md += `\n⏳ This large video is still being processed. Re-check with list_media (search by its name) until its status is **ready** before using it in a post.`;
|
|
115
|
+
}
|
|
116
|
+
if (compatibility && compatibility.compatible === false && compatibility.summary) {
|
|
117
|
+
md += `\n\n⚠️ **${compatibility.summary}** It will still post to your other connected platforms. Ask the user whether to continue before adding it to a post.`;
|
|
118
|
+
}
|
|
119
|
+
md += `\n\nUse this Media ID with \`media_ids\` when creating posts (including inside \`x.thread_parts[].media_ids\`). The public URL above also works anywhere \`media_urls\` is accepted.`;
|
|
104
120
|
return {
|
|
105
121
|
content: [{ type: "text", text: md }],
|
|
106
122
|
};
|
|
107
123
|
});
|
|
124
|
+
server.tool("check_media_compatibility", `Check whether a video/image will be accepted by the platforms CONNECTED to this workspace, BEFORE uploading or posting. Use this when the user gives you a file (URL) so you can warn them upfront — e.g. "this 995 MB video won't post to Instagram (max 300 MB), continue?" — and confirm before uploading.
|
|
125
|
+
|
|
126
|
+
Provide ONE of: a public 'url' (its size/type is read via a HEAD request), an existing 'media_id', or explicit 'size_bytes' + 'mime'. Returns the connected platforms and any that would reject the file by size or format.`, {
|
|
127
|
+
url: z.string().optional().describe("Public URL of the file to check. Use this OR media_id OR size_bytes+mime."),
|
|
128
|
+
media_id: z.string().optional().describe("Id of an already-uploaded library item to check."),
|
|
129
|
+
size_bytes: z.number().optional().describe("File size in bytes (use with mime when you already know them)."),
|
|
130
|
+
mime: z.string().optional().describe("MIME type, e.g. 'video/mp4' (use with size_bytes)."),
|
|
131
|
+
}, async (params) => {
|
|
132
|
+
if (!params.url && !params.media_id && !(params.size_bytes && params.mime)) {
|
|
133
|
+
return {
|
|
134
|
+
content: [{ type: "text", text: "Error: Provide one of 'url', 'media_id', or 'size_bytes' + 'mime'." }],
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
const result = await getClient().checkMediaCompatibility(params);
|
|
138
|
+
if (result.error) {
|
|
139
|
+
return {
|
|
140
|
+
content: [{ type: "text", text: `Error (${result.error.code}): ${result.error.message}` }],
|
|
141
|
+
};
|
|
142
|
+
}
|
|
143
|
+
const r = result;
|
|
144
|
+
const connected = r.connected_platforms || [];
|
|
145
|
+
let md = `## Compatibility Check\n\n`;
|
|
146
|
+
if (r.file) {
|
|
147
|
+
const sz = r.file.size_known ? formatBytes(r.file.size_bytes) : "unknown size";
|
|
148
|
+
md += `File: ${sz}${r.file.mime ? ` · ${r.file.mime}` : ""}\n`;
|
|
149
|
+
}
|
|
150
|
+
md += `Connected platforms: ${connected.length ? connected.join(", ") : "none"}\n\n`;
|
|
151
|
+
if (r.compatible) {
|
|
152
|
+
md += `✅ This file posts to all your connected platforms.`;
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
md += `⚠️ ${r.summary || "Some connected platforms would reject this file:"}\n\n`;
|
|
156
|
+
md += `| Platform | Why |\n|----------|-----|\n`;
|
|
157
|
+
for (const w of r.warnings || []) {
|
|
158
|
+
md += `| ${w.display_name} | ${(w.reasons || []).join(", ")} |\n`;
|
|
159
|
+
}
|
|
160
|
+
md += `\nAsk the user whether to continue. It will still post to the platforms not listed above.`;
|
|
161
|
+
}
|
|
162
|
+
return { content: [{ type: "text", text: md }] };
|
|
163
|
+
});
|
|
108
164
|
server.tool("update_media", "Rename an existing media file or move it into a folder (so it's findable later instead of re-uploading it). Only the fields you pass are changed.", {
|
|
109
165
|
id: z.string().describe("The media ID to update"),
|
|
110
166
|
name: z.string().optional().describe('New human-readable label, e.g. "pp-play5get50". Pass an empty string to clear it.'),
|
package/package.json
CHANGED