bundlesocial-mcp 1.5.0 → 1.6.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/CHANGELOG.md +7 -0
- package/README.md +15 -8
- package/dist/chunk-UDAYUBLK.js +4 -0
- package/dist/chunk-UDAYUBLK.js.map +1 -0
- package/dist/index.js +1 -1
- package/dist/lib.js +1 -1
- package/package.json +1 -1
- package/dist/chunk-6UV2Y3F4.js +0 -4
- package/dist/chunk-6UV2Y3F4.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
# [1.6.0](https://github.com/bundleglobal/bundlesocial-mcp/compare/v1.5.0...v1.6.0) (2026-11-23)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Features
|
|
5
|
+
|
|
6
|
+
* local files on the hosted server through direct (signed) uploads ([#6](https://github.com/bundleglobal/bundlesocial-mcp/issues/6)) ([75700d6](https://github.com/bundleglobal/bundlesocial-mcp/commit/75700d6cd59edbf1ea7aa68f7cd8445594c1887f))
|
|
7
|
+
|
|
1
8
|
# [1.5.0](https://github.com/bundleglobal/bundlesocial-mcp/compare/v1.4.0...v1.5.0) (2026-11-23)
|
|
2
9
|
|
|
3
10
|
|
package/README.md
CHANGED
|
@@ -94,7 +94,7 @@ Team-scoped tools take an optional `teamId`, either a team id or the exact team
|
|
|
94
94
|
| `upload_media` | Upload an image/video/document from a public URL (or local path in stdio mode). Local files >90 MB use the large-upload flow automatically (.jpg/.jpeg/.png/.gif/.mp4/.pdf only above that size). Returns the upload object — pass its `id` to `create_post`/`schedule_post` via `data` (e.g. `{"TWITTER":{"text":"hi","uploadIds":["<id>"]}}`). |
|
|
95
95
|
| `list_media` / `get_media` | List / fetch media uploads (filter by type and USED/UNUSED). |
|
|
96
96
|
| `delete_media` / `delete_media_many` | Delete one or several uploads (destructive). |
|
|
97
|
-
| `init_large_upload` / `finalize_large_upload` |
|
|
97
|
+
| `init_large_upload` / `finalize_large_upload` | Direct upload of any file up to 5 GB — `init` returns a signed PUT `url` + `path`; PUT the bytes there, then `finalize`. The way to send local files to the hosted server; in stdio mode `upload_media` with a local path does it for you. |
|
|
98
98
|
|
|
99
99
|
### Post-history imports
|
|
100
100
|
|
|
@@ -152,7 +152,7 @@ Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/
|
|
|
152
152
|
"command": "npx",
|
|
153
153
|
"args": ["-y", "bundlesocial-mcp"],
|
|
154
154
|
"env": {
|
|
155
|
-
"BUNDLESOCIAL_API_KEY": "
|
|
155
|
+
"BUNDLESOCIAL_API_KEY": "YOUR_API_KEY"
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
}
|
|
@@ -162,7 +162,7 @@ Edit `claude_desktop_config.json` (macOS: `~/Library/Application Support/Claude/
|
|
|
162
162
|
### Claude Code
|
|
163
163
|
|
|
164
164
|
```bash
|
|
165
|
-
claude mcp add bundlesocial --env BUNDLESOCIAL_API_KEY=
|
|
165
|
+
claude mcp add bundlesocial --env BUNDLESOCIAL_API_KEY=YOUR_API_KEY -- npx -y bundlesocial-mcp
|
|
166
166
|
```
|
|
167
167
|
|
|
168
168
|
Or add to `.mcp.json` in your project:
|
|
@@ -173,7 +173,7 @@ Or add to `.mcp.json` in your project:
|
|
|
173
173
|
"bundlesocial": {
|
|
174
174
|
"command": "npx",
|
|
175
175
|
"args": ["-y", "bundlesocial-mcp"],
|
|
176
|
-
"env": { "BUNDLESOCIAL_API_KEY": "
|
|
176
|
+
"env": { "BUNDLESOCIAL_API_KEY": "YOUR_API_KEY" }
|
|
177
177
|
}
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -189,20 +189,27 @@ Add to `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` (project):
|
|
|
189
189
|
"bundlesocial": {
|
|
190
190
|
"command": "npx",
|
|
191
191
|
"args": ["-y", "bundlesocial-mcp"],
|
|
192
|
-
"env": { "BUNDLESOCIAL_API_KEY": "
|
|
192
|
+
"env": { "BUNDLESOCIAL_API_KEY": "YOUR_API_KEY" }
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
```
|
|
197
197
|
|
|
198
|
-
###
|
|
198
|
+
### Hosted server
|
|
199
199
|
|
|
200
|
-
|
|
200
|
+
The same tools run at `https://mcp.bundle.social` (Streamable HTTP), so there is nothing to install. Send your API key as `Authorization: Bearer YOUR_API_KEY` (or `x-api-key`), and optionally a default team as `x-bundle-team-id`:
|
|
201
|
+
|
|
202
|
+
```bash
|
|
203
|
+
claude mcp add --transport http bundlesocial https://mcp.bundle.social \
|
|
204
|
+
--header "Authorization: Bearer YOUR_API_KEY"
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The hosted server cannot read local file paths: pass media and CSV files as public `https://` URLs. To send a file from your machine, an agent with a shell calls `init_large_upload`, PUTs the bytes to the returned signed `url` (for example `curl -X PUT -H "Content-Type: video/mp4" --upload-file ./clip.mp4 "<url>"`), then calls `finalize_large_upload`. Setup for other clients: <https://info.bundle.social/api-reference/mcp>.
|
|
201
208
|
|
|
202
209
|
## Try it without a client
|
|
203
210
|
|
|
204
211
|
```bash
|
|
205
|
-
BUNDLESOCIAL_API_KEY=
|
|
212
|
+
BUNDLESOCIAL_API_KEY=YOUR_API_KEY npx bundlesocial-mcp
|
|
206
213
|
```
|
|
207
214
|
|
|
208
215
|
It speaks MCP over stdio — pair it with the [MCP Inspector](https://github.com/modelcontextprotocol/inspector):
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import{Bundlesocial as tt,OpenAPI as ot}from"bundlesocial";import{z as nt}from"zod";import{ApiError as Te}from"bundlesocial";var c=class extends Error{code;details;constructor(e,t,n){super(t),this.name="McpToolError",this.code=e,this.details=n}};function et(o){if(o instanceof c)return{code:o.code,message:o.message,details:o.details};if(o instanceof Te){let e=o.body,t=typeof e=="object"&&e&&typeof e.message=="string"&&e.message||typeof e=="object"&&e&&typeof e.error=="string"&&e.error||o.statusText||o.message||`HTTP ${o.status}`;return{code:`HTTP_${o.status}`,message:t,details:{status:o.status,url:o.url,body:o.body}}}return o instanceof Error?{code:"UNEXPECTED_ERROR",message:o.message||"Unexpected error",details:process.env.BUNDLESOCIAL_DEBUG?{stack:o.stack}:void 0}:{code:"UNEXPECTED_ERROR",message:String(o)}}function v(o){return o instanceof Te?`HTTP ${o.status}${o.statusText?` ${o.statusText}`:""}`:o instanceof Error?o.message:String(o)}function s(o){return{content:[{type:"text",text:JSON.stringify(o,null,2)}]}}function be(o){return{content:[{type:"text",text:JSON.stringify({error:et(o)},null,2)}],isError:!0}}var Z="https://api.bundle.social",zt="https://bundle.social/dashboard/organization/api-keys",Ie="https://bundle.social/dashboard/general/social-accounts",at=100,Se=100;async function G(o){let e=[];for(let t=0;t<Se;t++){let{items:n,total:a}=await o.team.teamGetList({offset:e.length,limit:at});if(e.push(...n??[]),!n?.length||e.length>=a)return e}return process.stderr.write(`bundlesocial-mcp: team list truncated at ${e.length} teams (page cap ${Se} reached)
|
|
2
|
+
`),e}function Ae(o,e=Z,t){return new tt(o,{...ot,BASE:e,...t?{HEADERS:{"x-bundle-client":t}}:{}})}var g=nt.string().min(1).optional().describe("bundle.social team id or exact team name. Optional when the organization has one team or a default team is configured; otherwise list_teams shows the choices."),it=/^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,X=o=>o.map(e=>({id:e.id,name:e.name}));async function h(o,e){if(e){let n=e.trim();if(it.test(n))return n;let a=await G(o.client);if(a.some(r=>r.id===n))return n;let i=a.filter(r=>r.name?.trim().toLowerCase()===n.toLowerCase());if(i.length===1)return i[0].id;throw i.length>1?new c("TEAM_AMBIGUOUS",`${i.length} teams are named "${n}". Pass the team id instead.`,{teams:X(i)}):new c("TEAM_NOT_FOUND",`No team with id or name "${n}". Pick one of the teams listed in details.`,{teams:X(a)})}if(o.defaultTeamId)return o.defaultTeamId;let t=await G(o.client);if(t.length===1)return t[0].id;throw t.length===0?new c("NO_TEAMS","This organization has no teams yet. Create one in the bundle.social dashboard first."):new c("TEAM_ID_REQUIRED",`This organization has ${t.length} teams and no default team. Pass "teamId" (a team id or name) from the teams listed in details.`,{teams:X(t)})}import rt from"dns";import st from"https";import J from"net";function Q(o){if(J.isIPv4(o)){let[e,t]=o.split(".").map(Number);return e===0||e===10||e===127||e===100&&t>=64&&t<=127||e===169&&t===254||e===172&&t>=16&&t<=31||e===192&&t===168||e===192&&t===0||e===198&&(t===18||t===19)||e>=224}if(J.isIPv6(o)){let e=o.toLowerCase(),t=e.match(/^::ffff:(\d+\.\d+\.\d+\.\d+)$/);return t?Q(t[1]):e==="::"||e==="::1"||e.startsWith("fc")||e.startsWith("fd")||e.startsWith("fe8")||e.startsWith("fe9")||e.startsWith("fea")||e.startsWith("feb")||e.startsWith("ff")}return!0}var lt=(o,e,t)=>{rt.lookup(o,{...e,all:!0},(n,a)=>{if(n)return t(n,"",4);let i=a;if(i.find(m=>Q(m.address))||i.length===0)return t(Object.assign(new Error(`Refusing to fetch ${o}: not a public address`),{code:"EPRIVATE"}),"",4);if(e.all)return t(null,i);t(null,i[0].address,i[0].family)})};function Ee(o,{maxBytes:e,timeoutMs:t=3e4}){let n;try{n=new URL(o)}catch{return Promise.reject(new c("INVALID_URL",`"${o}" is not a valid URL.`))}if(n.protocol!=="https:")return Promise.reject(new c("INVALID_URL",`Only https:// URLs are supported, got "${n.protocol}".`));let a=n.hostname.replace(/^\[|\]$/g,"");return J.isIP(a)&&Q(a)?Promise.reject(new c("URL_NOT_PUBLIC",`"${o}" does not point to a public internet address.`)):new Promise((i,r)=>{let m=st.get(n,{lookup:lt,timeout:t},d=>{let p=d.statusCode??0;if(p>=300&&p<400)return d.resume(),r(new c("FETCH_REDIRECT",`"${o}" redirects (HTTP ${p}). Pass the final URL instead.`,{status:p}));if(p<200||p>=300)return d.resume(),r(new c("FETCH_FAILED",`Could not download "${o}" (HTTP ${p}).`,{status:p}));let I=[],b=0;d.on("data",y=>{if(b+=y.length,b>e){m.destroy(),r(new c("FILE_TOO_LARGE",`"${o}" is larger than ${Math.round(e/1024/1024)} MB.`));return}I.push(y)}),d.on("end",()=>i(Buffer.concat(I))),d.on("error",r)});m.on("timeout",()=>m.destroy(new c("FETCH_TIMEOUT",`Downloading "${o}" timed out.`))),m.on("error",d=>{if(d instanceof c)return r(d);if(d.code==="EPRIVATE")return r(new c("URL_NOT_PUBLIC",`"${o}" does not point to a public internet address.`));r(new c("FETCH_FAILED",`Could not download "${o}": ${d.message}`))})})}import{McpServer as Bt}from"@modelcontextprotocol/sdk/server/mcp.js";var Y={name:"bundlesocial-mcp",version:"1.6.0",mcpName:"io.github.bundleglobal/bundlesocial-mcp",description:"Model Context Protocol server for the bundle.social social-media API \u2014 post to 14+ platforms from Claude, Cursor and other MCP clients.",keywords:["bundle.social","bundlesocial","mcp","model context protocol","social media","api","agents","claude","cursor"],author:"bundle.global",license:"MIT",homepage:"https://github.com/bundleglobal/bundlesocial-mcp#readme",bugs:{url:"https://github.com/bundleglobal/bundlesocial-mcp/issues"},repository:{type:"git",url:"git+https://github.com/bundleglobal/bundlesocial-mcp.git"},type:"module",bin:{"bundlesocial-mcp":"./dist/index.js"},exports:{".":{types:"./dist/lib.d.ts",import:"./dist/lib.js"},"./package.json":"./package.json"},files:["dist/**","server.json","README.md","CHANGELOG.md","LICENSE"],engines:{node:">=20"},scripts:{build:"tsup",dev:"tsup --watch",typecheck:"tsc --noEmit",start:"node dist/index.js",test:"vitest run","test:watch":"vitest",prepublishOnly:"npm run build"},dependencies:{"@modelcontextprotocol/sdk":"^1.12.0",bundlesocial:"^2.71.0",zod:"^3.23.8"},devDependencies:{"@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@types/node":"^20.14.0","semantic-release":"^25.0.2",tsup:"^8.2.4",typescript:"^5.5.4",vitest:"^2.0.5"}};import{z as A}from"zod";var k=["TIKTOK","YOUTUBE","INSTAGRAM","FACEBOOK","TWITTER","THREADS","LINKEDIN","PINTEREST","REDDIT","MASTODON","DISCORD","SLACK","BLUESKY","GOOGLE_BUSINESS","SNAPCHAT"],we=["TIKTOK","YOUTUBE","INSTAGRAM","FACEBOOK","THREADS","REDDIT","PINTEREST","MASTODON","LINKEDIN","BLUESKY","GOOGLE_BUSINESS","SNAPCHAT"],mt={X:"TWITTER",TWITTER:"TWITTER",TIKTOK:"TIKTOK",TT:"TIKTOK",YOUTUBE:"YOUTUBE",YT:"YOUTUBE",INSTAGRAM:"INSTAGRAM",IG:"INSTAGRAM",INSTA:"INSTAGRAM",FACEBOOK:"FACEBOOK",FB:"FACEBOOK",THREADS:"THREADS",LINKEDIN:"LINKEDIN",LI:"LINKEDIN",PINTEREST:"PINTEREST",PIN:"PINTEREST",REDDIT:"REDDIT",MASTODON:"MASTODON",MASTO:"MASTODON",DISCORD:"DISCORD",SLACK:"SLACK",BLUESKY:"BLUESKY",BSKY:"BLUESKY",GOOGLE_BUSINESS:"GOOGLE_BUSINESS","GOOGLE-BUSINESS":"GOOGLE_BUSINESS",GBP:"GOOGLE_BUSINESS",GOOGLEBUSINESS:"GOOGLE_BUSINESS",GMB:"GOOGLE_BUSINESS",SNAPCHAT:"SNAPCHAT",SNAP:"SNAPCHAT"};function x(o){return mt[o.trim().toUpperCase().replace(/\s+/g,"_")]}function S(o){let e=x(o);if(!e)throw new c("UNKNOWN_PLATFORM",`Unknown platform "${o}". Supported: ${k.join(", ")} (aliases like "x" and "gbp" are accepted too).`);return e}function ee(o){return we.includes(o)}var U=["TIKTOK","YOUTUBE","INSTAGRAM","FACEBOOK","THREADS","LINKEDIN","REDDIT","MASTODON","DISCORD","SLACK","BLUESKY"];function H(o){return U.includes(o)}function M(o){let e=S(o);if(!ee(e))throw new c("ANALYTICS_NOT_SUPPORTED",`Analytics are not available for ${e}. Supported: ${we.join(", ")}.`);return e}function l(o,e,t,n){o.registerTool(e,t,(async a=>{try{return await n(a??{})}catch(i){return be(i)}}))}var ct=10,B=A.string().min(1).describe("Platform name/alias (x, tiktok, instagram, youtube, facebook, threads, linkedin, pinterest, reddit, mastodon, discord, slack, gbp).");function te(o){return(o??[]).map(e=>({id:e.id,type:e.type,username:e.username??null,displayName:e.displayName??null,avatarUrl:e.avatarUrl??null,channels:(e.channels??[]).map(t=>({id:t.id,name:t.name??null,username:t.username??null,address:t.address??null}))}))}function Pe(o,e){l(o,"list_integrations",{title:"List connected integrations",description:"List the social-media integrations (accounts) connected to a bundle.social team \u2014 each with its `id`, `type` (platform), `username` and channels. Use this to discover which platforms are available and to get integration ids. Without a team id it lists every team in the organization.",inputSchema:{teamId:g},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({teamId:t})=>{if(t??e.defaultTeamId){let r=await h(e,t),m=await e.client.team.teamGetTeam({id:r});return s({teamId:m.id,teamName:m.name,integrations:te(m.socialAccounts)})}let n=await G(e.client);if(n.length===1){let r=await e.client.team.teamGetTeam({id:n[0].id});return s({teamId:r.id,teamName:r.name,integrations:te(r.socialAccounts)})}if(n.length>ct)return s({message:`${n.length} teams. Call again with teamId (a team id or name) to see one team's integrations.`,teams:n.map(r=>({id:r.id,name:r.name}))});let a=await e.client.organization.organizationGetOrganization(),i=[];for(let r of n){let m=await e.client.team.teamGetTeam({id:r.id});i.push({teamId:m.id,teamName:m.name,integrations:te(m.socialAccounts)})}return s({organizationId:a.id,organizationName:a.name??null,teams:i})}),l(o,"connect_integration",{title:"Connect a social account",description:"Start connecting a social account to a team. Returns an OAuth `url` \u2014 open it in a browser to authorize the account; bundle.social redirects back to `redirectUrl` afterwards. For Mastodon/Bluesky pass `serverUrl`.",inputSchema:{platform:B,redirectUrl:A.string().min(1).describe("URL bundle.social redirects to after the user finishes (or cancels) the OAuth flow."),serverUrl:A.string().optional().describe("Mastodon/Bluesky instance URL (required for those platforms)."),teamId:g,options:A.record(A.string(),A.unknown()).optional().describe('Advanced provider flags, e.g. {"instagramConnectionMethod":"INSTAGRAM","withBusinessScope":true,"disableAutoLogin":true,"forceBrowserOAuth":true,"tiktokForceLogin":true}. `withBusinessScope` also unlocks YouTube monetization analytics; `tiktokForceLogin` (experimental) forces TikTok\'s account picker when it keeps reusing the wrong active account; `snapchatConnectionMethod` "PERSONAL" (default, the login\'s own Public Profile) or "BUSINESS" (lists the Public Profiles of the login\'s Snap Business organizations \u2014 pick one with set_integration_channel).')},annotations:{destructiveHint:!0,openWorldHint:!0}},async({platform:t,redirectUrl:n,serverUrl:a,teamId:i,options:r})=>{let m=await h(e,i),d={type:S(t),teamId:m,redirectUrl:n,...a?{serverUrl:a}:{},...r??{}};return s(await e.client.socialAccount.socialAccountConnect({requestBody:d}))}),l(o,"disconnect_integration",{title:"Disconnect a social account",description:"Disconnect a social account of the given platform from a team. Destructive \u2014 also removes it from scheduled posts.",inputSchema:{platform:B,teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({platform:t,teamId:n})=>{let a=await h(e,n);return s(await e.client.socialAccount.socialAccountDisconnect({requestBody:{type:S(t),teamId:a}}))}),l(o,"set_integration_channel",{title:"Set a social account's channel/page",description:"Select the page/channel for a connected account (needed for FACEBOOK, INSTAGRAM, LINKEDIN, YOUTUBE, GOOGLE_BUSINESS, and SNAPCHAT connected with snapchatConnectionMethod BUSINESS). Get channel ids from list_integrations / refresh_integration_channels.",inputSchema:{platform:B,channelId:A.string().min(1).describe("Channel/page id to select."),teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({platform:t,channelId:n,teamId:a})=>{let i=await h(e,a);return s(await e.client.socialAccount.socialAccountSetChannel({requestBody:{type:S(t),teamId:i,channelId:n}}))}),l(o,"unset_integration_channel",{title:"Clear a social account's channel/page",description:"Clear the selected page/channel for a connected account (FACEBOOK, INSTAGRAM, LINKEDIN, YOUTUBE, GOOGLE_BUSINESS, SNAPCHAT) while keeping the authorization.",inputSchema:{platform:B,teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({platform:t,teamId:n})=>{let a=await h(e,n);return s(await e.client.socialAccount.socialAccountUnsetChannel({requestBody:{type:S(t),teamId:a}}))}),l(o,"refresh_integration_channels",{title:"Refresh a social account's channels",description:"Re-fetch the available channels for a connected account (needed for REDDIT, DISCORD, SLACK, PINTEREST and the page-based platforms).",inputSchema:{platform:B,teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({platform:t,teamId:n})=>{let a=await h(e,n);return s(await e.client.socialAccount.socialAccountRefreshChannels({requestBody:{type:S(t),teamId:a}}))}),l(o,"create_integration_portal_link",{title:"Create a connect-portal link",description:"Create a hosted bundle.social portal link a user can open to connect/manage social accounts without you implementing the OAuth flow. Returns a `url`.",inputSchema:{platforms:A.array(A.string().min(1)).min(1).describe("Platforms the portal should offer to connect (names/aliases)."),redirectUrl:A.string().optional().describe("URL to redirect to when the user finishes."),teamId:g,expiresInMinutes:A.number().int().min(5).max(2880).optional().describe("Link lifetime in minutes (5 min \u2013 48 h)."),options:A.record(A.string(),A.unknown()).optional().describe("Advanced portal options \u2014 branding (logoUrl, userLogoUrl, userName, goBackButtonText, hidePoweredBy, hideGoBackButton, hideUserLogo, hideUserName, hideLanguageSwitcher, showModalOnConnectSuccess, language, maxSocialAccountsConnected) and the same OAuth flags as connect_integration (serverUrl, instagramConnectionMethod, snapchatConnectionMethod, withBusinessScope, disableAutoLogin, forceBrowserOAuth, tiktokForceLogin).")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({platforms:t,redirectUrl:n,teamId:a,expiresInMinutes:i,options:r})=>{let d={teamId:await h(e,a),socialAccountTypes:t.map(p=>S(p)),...n?{redirectUrl:n}:{},...i?{expiresIn:i}:{},...r??{}};return s(await e.client.socialAccount.socialAccountCreatePortalLink({requestBody:d}))}),l(o,"check_integration_connection",{title:"Check a social account's connection",description:"Run an on-demand connection/disconnect health check for a connected account of the given platform.",inputSchema:{platform:B,teamId:g},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({platform:t,teamId:n})=>{let a=await h(e,n);return s(await e.client.socialAccount.socialAccountConnectionCheck({requestBody:{type:S(t),teamId:a}}))}),l(o,"refresh_integration_profile",{title:"Refresh a social account's profile",description:"Re-fetch the profile info (username, display name, avatar) for a connected account of the given platform.",inputSchema:{platform:B,teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({platform:t,teamId:n})=>{let a=await h(e,n);return s(await e.client.socialAccount.socialAccountProfileRefresh({requestBody:{type:S(t),teamId:a}}))}),l(o,"get_integration_by_type",{title:"Get a social account by platform",description:"Fetch the connected social account of a given platform for a team (including its channels).",inputSchema:{platform:B,teamId:g},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({platform:t,teamId:n})=>{let a=await h(e,n);return s(await e.client.socialAccount.socialAccountGetByType({teamId:a,type:S(t)}))}),l(o,"copy_integration",{title:"Copy social accounts between teams",description:"Copy connected social accounts of the given platforms from one team to another. Set `resetChannel` to require re-picking the page (Facebook/Instagram/LinkedIn/YouTube).",inputSchema:{fromTeamId:A.string().min(1).describe("Source team id."),toTeamId:A.string().min(1).describe("Destination team id."),platforms:A.array(A.string().min(1)).min(1).describe("Platforms to copy (names/aliases)."),resetChannel:A.boolean().optional().describe("If true, the destination must re-select the page/channel.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({fromTeamId:t,toTeamId:n,platforms:a,resetChannel:i})=>s(await e.client.socialAccount.socialAccountCopy({requestBody:{fromTeamId:t,toTeamId:n,...i!==void 0?{resetChannel:i}:{},socialAccountTypes:a.map(r=>S(r))}}))),l(o,"list_integrations_to_delete",{title:"List social accounts pending deletion",description:"List social accounts scheduled to be deleted (paginated) across the organization.",inputSchema:{page:A.number().int().positive().optional().describe("Page (1-based)."),pageSize:A.number().int().positive().max(100).optional().describe("Page size.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({page:t,pageSize:n})=>s(await e.client.socialAccount.socialAccountGetAccountsToDelete({page:t,pageSize:n})))}import{z as f}from"zod";import pt from"fs/promises";import K from"path";var ut={".jpg":"image/jpeg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".webp":"image/webp",".bmp":"image/bmp",".tif":"image/tiff",".tiff":"image/tiff",".heic":"image/heic",".heif":"image/heif",".mp4":"video/mp4",".m4v":"video/x-m4v",".mov":"video/quicktime",".webm":"video/webm",".avi":"video/x-msvideo",".mkv":"video/x-matroska",".pdf":"application/pdf",".mp3":"audio/mpeg",".m4a":"audio/mp4",".wav":"audio/wav"};function ft(o){return/^https?:\/\//i.test(o.trim())}var gt=90*1024*1024,ht={".jpg":"image/jpg",".jpeg":"image/jpeg",".png":"image/png",".gif":"image/gif",".mp4":"video/mp4",".mov":"video/quicktime",".pdf":"application/pdf"};function oe(o,e,t){if(o.mode==="hosted")throw new c("LOCAL_FILES_NOT_SUPPORTED",t==="media"?`"${e}" is not a public https:// URL. This bundle.social server runs remotely and cannot read files from your computer. Pass a public https:// URL, or, if you can run shell commands, call init_large_upload, PUT the file to the returned url (curl -X PUT -H "Content-Type: <mimeType>" --upload-file "${e}" "<url>"), then call finalize_large_upload.`:`"${e}" is not a public https:// URL. This bundle.social server runs remotely and cannot read files from your computer; pass a public https:// URL to the ${t} instead.`)}async function ne(o,e,t){let{client:n}=o;if(ft(t))return n.upload.uploadCreateFromUrl({requestBody:{teamId:e,url:t.trim()}});oe(o,t,"media");let a=K.resolve(t),i;try{i=await pt.readFile(a)}catch{throw new c("MEDIA_NOT_FOUND",`Could not read media "${t}". Provide a public https:// URL, or a local file path that exists on the machine running this MCP server (stdio mode only).`,{path:a})}if(i.byteLength>gt)return yt(n,e,a,i);let r=ut[K.extname(a).toLowerCase()]??"application/octet-stream",m=new File([i],K.basename(a),{type:r});return n.upload.uploadCreate({formData:{teamId:e,file:m}})}async function yt(o,e,t,n){let a=K.extname(t).toLowerCase(),i=ht[a];if(!i)throw new c("LARGE_UPLOAD_UNSUPPORTED_TYPE",`Large uploads (>90 MB) only support .jpg, .jpeg, .png, .gif, .mp4 and .pdf \u2014 got "${a||"no extension"}".`,{path:t});let r=await o.upload.uploadInitLargeUpload({requestBody:{teamId:e,fileName:K.basename(t),mimeType:i}}),m=await fetch(r.url,{method:"PUT",headers:{"content-type":i},body:new Uint8Array(n)});if(!m.ok)throw new c("LARGE_UPLOAD_FAILED",`Uploading the file to storage failed (HTTP ${m.status}).`,{status:m.status});return o.upload.uploadFinalizeLargeUpload({requestBody:{teamId:e,path:r.path}})}async function ae(o,e,t){let n=[];for(let a of t){let i=await ne(o,e,a);n.push(i.id)}return n}function Tt(o,e){if(typeof o!="object"||o===null||Array.isArray(o))throw new c("INVALID_INPUT",`${e} must be a JSON object.`);return o}async function z(o,e,t){let n=new Set,a=[];for(let i of t){let r=x(i);r?n.add(r):a.push(i.trim())}if(a.length>0){let r=(await o.team.teamGetTeam({id:e})).socialAccounts??[];for(let m of a){let d=r.find(p=>p.id===m);if(!d)throw new c("INTEGRATION_NOT_FOUND",`No connected integration with id "${m}" in team ${e}. Call list_integrations to see ids, or use a platform name like "x" or "tiktok".`,{availableIntegrations:r.map(p=>({id:p.id,type:p.type,username:p.username}))});n.add(d.type)}}return[...n]}function bt(o){let e=Object.keys(o);return e.length>0&&e.every(t=>k.includes(t.trim().toUpperCase()))}function St(o,e){let t=Object.fromEntries(e.map(n=>[n,{}]));if(!o)return t;if(bt(o)){for(let[n,a]of Object.entries(o)){let i=n.trim().toUpperCase();i in t&&(t[i]={...t[i],...Tt(a,`platformSettings.${n}`)})}return t}for(let n of e)t[n]={...o};return t}function ie(o,e){if(e.data)return e.data;let t=St(e.platformSettings,o),n={};for(let a of o)n[a]={...e.content!==void 0?{text:e.content}:{},...e.mediaUploadIds.length>0?{uploadIds:e.mediaUploadIds}:{},...t[a]};return n}function re(o){return Object.keys(o).map(e=>S(e))}function Oe(o,e){let t=(o??"").split(`
|
|
3
|
+
`).map(n=>n.trim()).find(n=>n.length>0);return t?t.length>80?`${t.slice(0,79)}\u2026`:t:e}function W(o,e){let t=new Date(o);if(Number.isNaN(t.getTime()))throw new c("INVALID_DATE",`${e} is not a valid ISO 8601 date/time: "${o}". Example: 2026-06-01T09:00:00Z`);return t.toISOString()}function se(o,e){if(o===void 0)return;if(typeof o=="string"){let n=e.filter(H);if(n.length===0)throw new c("COMMENTS_NOT_SUPPORTED",`None of the targeted platforms support comments, so firstComment has no effect. Supported: ${U.join(", ")}.`);let a={};for(let i of n)a[i]=o;return a}let t={};for(let[n,a]of Object.entries(o)){let i=S(n);if(!H(i))throw new c("COMMENTS_NOT_SUPPORTED",`A first comment is not supported on ${i}. Supported: ${U.join(", ")}.`);t[i]=a}return t}var le=f.string().min(1).optional().describe("Your own identifier for this post. Look the post up later with get_post_by_reference_key."),de=f.union([f.string().min(1),f.record(f.string(),f.string())]).optional().describe('Comment published as soon as the post itself goes live. A string applies to every comment-capable target; a platform-keyed object targets specific platforms, e.g. {"INSTAGRAM":"more below \u{1F447}"}. Supported on TIKTOK, YOUTUBE, INSTAGRAM, FACEBOOK, THREADS, LINKEDIN, REDDIT, MASTODON, DISCORD, SLACK, BLUESKY.'),me=f.array(f.string().min(1)).optional().describe('Target platforms \u2014 names/aliases (x, tiktok, instagram, youtube, facebook, threads, linkedin, pinterest, reddit, mastodon, discord, slack, bluesky, gbp, snapchat) and/or connected integration ids from list_integrations. Required unless "data" is provided with platform keys.'),ce=f.array(f.string().min(1)).optional().describe("Media to attach: public https:// URLs (or local file paths when this server runs in stdio mode). Uploaded automatically and attached to every targeted platform. For per-platform media, use upload_media + the `data` argument instead."),pe=f.record(f.string(),f.unknown()).optional().describe('Per-platform options. Either keyed by platform name, e.g. {"TIKTOK":{"privacy":"PUBLIC_TO_EVERYONE"},"YOUTUBE":{"type":"SHORT","privacyStatus":"PUBLIC","madeForKids":false}}, or a flat object applied to every targeted platform. Use this for platform-required fields (Reddit `sr`, Pinterest `boardName`, TikTok `privacy`, YouTube `madeForKids`/`privacyStatus`, Instagram/Facebook `type`).'),ue=f.record(f.string(),f.unknown()).optional().describe('Advanced: the full post `data` object keyed by platform, e.g. {"REDDIT":{"sr":"r/test","text":"hello","uploadIds":["<uploadId>"]}}. Overrides content/media/platformSettings. Targeted platforms are inferred from its keys unless `platforms` is also given.'),Re=f.string().min(1).optional().describe("Post title. Defaults to the first line of `content`. Also used as the YouTube video title.");async function ve(o,e){let t=await h(o,e.teamId),n;if(e.platforms&&e.platforms.length>0)n=await z(o.client,t,e.platforms);else if(e.data)n=re(e.data);else throw new c("NO_TARGET",'Provide "platforms" (platform names or integration ids), or a "data" object keyed by platform.');if(n.length===0)throw new c("NO_TARGET","Could not determine any target platform for this post.");let a=await ae(o,t,e.media??[]),i=ie(n,{content:e.content,mediaUploadIds:a,platformSettings:e.platformSettings,data:e.data});return{teamId:t,socialAccountTypes:n,data:i,title:e.title??Oe(e.content,"Untitled post")}}function Ce(o,e){l(o,"create_post",{title:"Create a post (publish now)",description:"Publish a post immediately to one or more connected social-media integrations. Returns the created post (with its id and status). Set `draft: true` to save it as a draft instead of publishing. For a future-dated post use schedule_post.",inputSchema:{teamId:g,content:f.string().optional().describe("Post text, applied to every targeted platform."),platforms:me,media:ce,platformSettings:pe,data:ue,title:Re,referenceKey:le,firstComment:de,draft:f.boolean().optional().default(!1).describe("If true, save as a DRAFT instead of publishing now.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({teamId:t,content:n,platforms:a,media:i,platformSettings:r,data:m,title:d,referenceKey:p,firstComment:I,draft:b})=>{let y=await ve(e,{teamId:t,content:n,platforms:a,media:i,platformSettings:r,data:m,title:d}),T={teamId:y.teamId,title:y.title,postDate:new Date().toISOString(),status:b?"DRAFT":"SCHEDULED",socialAccountTypes:y.socialAccountTypes,data:y.data};p!==void 0&&(T.referenceKey=p);let P=se(I,y.socialAccountTypes);return P&&(T.firstComment=P),s(await e.client.post.postCreate({requestBody:T}))}),l(o,"schedule_post",{title:"Schedule a post for later",description:"Schedule a post to be published at a specific date/time on one or more connected integrations. Same inputs as create_post plus a required ISO-8601 `date`. Returns the scheduled post.",inputSchema:{teamId:g,date:f.string().min(1).describe("When to publish \u2014 ISO 8601, e.g. 2026-06-01T09:00:00Z."),content:f.string().optional().describe("Post text, applied to every targeted platform."),platforms:me,media:ce,platformSettings:pe,data:ue,title:Re,referenceKey:le,firstComment:de},annotations:{destructiveHint:!0,openWorldHint:!0}},async({teamId:t,date:n,content:a,platforms:i,media:r,platformSettings:m,data:d,title:p,referenceKey:I,firstComment:b})=>{let y=W(n,"date"),T=await ve(e,{teamId:t,content:a,platforms:i,media:r,platformSettings:m,data:d,title:p}),P={teamId:T.teamId,title:T.title,postDate:y,status:"SCHEDULED",socialAccountTypes:T.socialAccountTypes,data:T.data};I!==void 0&&(P.referenceKey=I);let R=se(b,T.socialAccountTypes);return R&&(P.firstComment=R),s(await e.client.post.postCreate({requestBody:P}))}),l(o,"list_posts",{title:"List recent posts",description:"List recent posts for a team, newest first, with optional filters by status, platform, date range and free-text query.",inputSchema:{teamId:g,limit:f.number().int().positive().max(100).optional().default(20).describe("Max number of posts to return (default 20, max 100)."),offset:f.number().int().nonnegative().optional().describe("Number of posts to skip (for pagination)."),status:f.enum(["DRAFT","SCHEDULED","POSTED","ERROR","DELETED","PROCESSING","REVIEW","RETRYING"]).optional().describe("Filter by post status."),platforms:f.array(f.string().min(1)).optional().describe("Filter by platform name/alias."),from:f.string().optional().describe("Only posts with postDate on/after this ISO-8601 date."),to:f.string().optional().describe("Only posts with postDate on/before this ISO-8601 date."),query:f.string().optional().describe("Free-text search over post titles/content."),order:f.enum(["ASC","DESC"]).optional().describe("Sort direction (default DESC)."),orderBy:f.enum(["createdAt","updatedAt","postDate","postedDate","deletedAt"]).optional().describe("Sort field (default postDate).")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({teamId:t,limit:n,offset:a,status:i,platforms:r,from:m,to:d,query:p,order:I,orderBy:b})=>{let y=await h(e,t),T=(r??[]).map(S),P={teamId:y,limit:n,offset:a,status:i??void 0,platforms:T.length>0?T:void 0,postDateFrom:m?W(m,"from"):void 0,postDateTo:d?W(d,"to"):void 0,q:p,order:I??void 0,orderBy:b??void 0};return s(await e.client.post.postGetList(P))}),l(o,"get_post",{title:"Get a post by id",description:"Fetch a single post by its bundle.social id, including its per-platform data and status.",inputSchema:{id:f.string().min(1).describe("Post id.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.post.postGet({id:t}))),l(o,"delete_post",{title:"Delete a post",description:"Delete a post by its bundle.social id. This is destructive and cannot be undone.",inputSchema:{id:f.string().min(1).describe("Post id.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.post.postDelete({id:t}))),l(o,"update_post",{title:"Update a post",description:"Update an existing post by id \u2014 change its title, publish date, status (DRAFT/SCHEDULED), targeted platforms and/or per-platform content. Only the fields you pass are changed. If you change content/media without `platforms`, the post's current platforms are reused.",inputSchema:{id:f.string().min(1).describe("Post id."),title:f.string().optional().describe("New post title."),date:f.string().optional().describe("New publish date, ISO 8601."),status:f.enum(["DRAFT","SCHEDULED"]).optional().describe("New status."),content:f.string().optional().describe("New post text, applied to every targeted platform."),platforms:me,media:ce,platformSettings:pe,data:ue,referenceKey:le,firstComment:de,teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({id:t,title:n,date:a,status:i,content:r,platforms:m,media:d,platformSettings:p,data:I,referenceKey:b,firstComment:y,teamId:T})=>{let P=await h(e,T),R=r!==void 0||(d?.length??0)>0||p!==void 0||I!==void 0,E;if(m&&m.length>0)E=await z(e.client,P,m);else if(I)E=re(I);else if(R){let L=await e.client.post.postGet({id:t});if(E=Object.keys(L.data??{}),E.length===0)throw new c("NO_TARGET","Could not determine the post's platforms \u2014 pass `platforms`.")}let w={};if(n!==void 0&&(w.title=n),b!==void 0&&(w.referenceKey=b),y!==void 0){let L=E??Object.keys((await e.client.post.postGet({id:t})).data??{});w.firstComment=se(y,L)}if(a&&(w.postDate=W(a,"date")),i&&(w.status=i),E&&E.length>0&&(w.socialAccountTypes=E),R&&E&&E.length>0){let L=await ae(e,P,d??[]);w.data=ie(E,{content:r,mediaUploadIds:L,platformSettings:p,data:I})}if(Object.keys(w).length===0)throw new c("NOTHING_TO_UPDATE","Nothing to update \u2014 pass at least one of title, date, status, content, media, platformSettings, data, referenceKey, firstComment, platforms.");return s(await e.client.post.postUpdate({id:t,requestBody:w}))}),l(o,"retry_post",{title:"Retry a failed post",description:"Retry publishing a post that ended in the ERROR state.",inputSchema:{id:f.string().min(1).describe("Post id.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.post.postRetry({id:t}))),l(o,"get_post_by_reference_key",{title:"Get a post by reference key",description:"Fetch a single post by the `referenceKey` set when it was created, instead of by bundle.social post id. Use this when you track posts under your own identifiers.",inputSchema:{referenceKey:f.string().min(1).describe("The reference key you set on the post.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({referenceKey:t})=>s(await e.client.post.postGetByReferenceKey({referenceKey:t}))),l(o,"list_reconnect_candidates",{title:"List posts waiting for a reconnected account",description:"List draft/scheduled posts that lost their link to a social account after a disconnect and can be reattached to a newly connected account of the same platform. Pair with reconnect_posts.",inputSchema:{teamId:g,platform:f.string().min(1).describe("Platform of the reconnected account (name or alias)."),limit:f.number().int().positive().max(100).optional().describe("Max number of posts to return."),offset:f.number().int().nonnegative().optional().describe("Number of posts to skip.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({teamId:t,platform:n,limit:a,offset:i})=>{let m={teamId:await h(e,t),type:S(n),limit:a,offset:i};return s(await e.client.post.postGetReconnectSocialAccountCandidates(m))}),l(o,"reconnect_posts",{title:"Reattach posts to a reconnected account",description:"Attach a newly connected social account to posts that lost their link to the previous account of that platform. Without `postIds`, every candidate is reattached.",inputSchema:{teamId:g,platform:f.string().min(1).describe("Platform of the reconnected account (name or alias)."),postIds:f.array(f.string().min(1)).optional().describe("Only reattach these post ids. Defaults to every candidate.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({teamId:t,platform:n,postIds:a})=>{let i=await h(e,t);return s(await e.client.post.postReconnectSocialAccount({requestBody:{teamId:i,type:S(n),...a&&a.length>0?{postIds:a}:{}}}))})}import{z as u}from"zod";var It=u.enum(["PENDING","FETCHING","RETRYING","COMPLETED","SKIPPED","FAILED","RATE_LIMITED"]);function fe(o){let e=o.filter(t=>!H(t));if(e.length>0)throw new c("COMMENTS_NOT_SUPPORTED",`Comments are not available for ${e.join(", ")}. Supported: ${U.join(", ")}.`);return o}function At(o){let e=new Date(o);if(Number.isNaN(e.getTime()))throw new c("INVALID_DATE",`date is not a valid ISO 8601 date/time: "${o}". Example: 2026-06-01T09:00:00Z`);return e.toISOString()}function _e(o,e){l(o,"create_comment",{title:"Comment on a post",description:"Post one or more comments on a post you created (`postId`) or on a post brought in by create_post_import (`importedPostId`). Pass `content` multiple times to create a chain (the first replies to the post, each subsequent one replies to the previous comment) \u2014 useful for X-style threads via comments. Use `fetchedParentCommentId` to reply to a comment pulled in by create_comment_import. Comments are supported on TIKTOK, YOUTUBE, INSTAGRAM, FACEBOOK, THREADS, LINKEDIN, REDDIT, MASTODON, DISCORD, SLACK, BLUESKY. Returns the created comment(s).",inputSchema:{postId:u.string().min(1).optional().describe("Id of the bundle.social post to comment on. Either this or importedPostId is required."),importedPostId:u.string().min(1).optional().describe("Id of an imported (post-history) post to comment on instead of postId. Requires `platforms`."),fetchedParentCommentId:u.string().min(1).optional().describe("Reply to a comment fetched by create_comment_import (its imported-comment id) instead of to the post itself."),content:u.array(u.string().min(1)).min(1).describe("Comment text. Pass multiple to create a chain of replies."),platforms:u.array(u.string().min(1)).optional().describe("Target comment-capable platform names/aliases and/or integration ids. Defaults to the post's platforms (filtered to comment-capable ones)."),date:u.string().optional().describe("When to post the (first) comment, ISO 8601. Default: now."),delayMinutes:u.number().int().nonnegative().optional().default(0).describe("For a chain, minutes to wait between each comment."),draft:u.boolean().optional().default(!1).describe("If true, create the comment(s) as DRAFT instead of posting."),teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({postId:t,importedPostId:n,fetchedParentCommentId:a,content:i,platforms:r,date:m,delayMinutes:d,draft:p,teamId:I})=>{let b=await h(e,I);if(!t&&!n)throw new c("NO_POST","Pass `postId` (a bundle.social post) or `importedPostId` (a post brought in by create_post_import).");let y;if(r&&r.length>0)y=fe(await z(e.client,b,r));else if(t){let w=await e.client.post.postGet({id:t});if(y=Object.keys(w.data??{}).filter(H),y.length===0)throw new c("NO_TARGET","Could not determine comment platforms from the post \u2014 pass `platforms` (comment-capable only).")}else throw new c("NO_TARGET","Pass `platforms` when commenting on an imported post (comment-capable only).");let T=p?"DRAFT":"SCHEDULED",P=m?new Date(At(m)):new Date,R=[],E;for(let w=0;w<i.length;w+=1){let L=i[w],Ze=new Date(P.getTime()+w*(d??0)*6e4).toISOString(),Je=Object.fromEntries(y.map(Qe=>[Qe,{text:L}])),ye=await e.client.comment.commentCreate({requestBody:{teamId:b,...t?{internalPostId:t}:{importedPostId:n},...E?{internalParentCommentId:E}:{},...!E&&a?{fetchedParentCommentId:a}:{},status:T,postDate:Ze,socialAccountTypes:y,data:Je,text:L}});R.push(ye),E=ye.id}return s(R.length===1?R[0]:R)}),l(o,"list_comments",{title:"List comments",description:"List comments for a team, optionally filtered by post, status and platform.",inputSchema:{postId:u.string().optional().describe("Only comments on this post."),limit:u.number().int().positive().max(100).optional().default(20),offset:u.number().int().nonnegative().optional(),status:u.enum(["DRAFT","SCHEDULED","POSTED","ERROR","DELETED","PROCESSING","RETRYING"]).optional(),platforms:u.array(u.string().min(1)).optional().describe("Filter by comment-capable platform name/alias."),query:u.string().optional(),order:u.enum(["ASC","DESC"]).optional(),orderBy:u.enum(["createdAt","updatedAt","deletedAt"]).optional(),teamId:g},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({postId:t,limit:n,offset:a,status:i,platforms:r,query:m,order:d,orderBy:p,teamId:I})=>{let b=await h(e,I),y=fe((r??[]).map(S)),T={teamId:b,postId:t,limit:n,offset:a,status:i??void 0,platforms:y.length>0?y:void 0,q:m,order:d??void 0,orderBy:p??void 0};return s(await e.client.comment.commentGetList(T))}),l(o,"get_comment",{title:"Get a comment by id",description:"Fetch a single comment by its bundle.social id.",inputSchema:{id:u.string().min(1).describe("Comment id.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.comment.commentGet({id:t}))),l(o,"delete_comment",{title:"Delete a comment",description:"Delete a comment by its bundle.social id. Destructive.",inputSchema:{id:u.string().min(1).describe("Comment id.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.comment.commentDelete({id:t}))),l(o,"update_comment",{title:"Update a comment",description:"Update an existing comment by id \u2014 change its title, scheduled date, status (DRAFT/SCHEDULED), targeted platforms and/or per-platform text. Only the fields you pass are changed. Use `data` for the full per-platform object, or `content` + `platforms` for a same-text-everywhere change.",inputSchema:{id:u.string().min(1).describe("Comment id."),title:u.string().optional().describe("New title."),date:u.string().optional().describe("New scheduled date, ISO 8601."),status:u.enum(["DRAFT","SCHEDULED"]).optional().describe("New status."),content:u.string().optional().describe("New comment text, applied to every platform in `platforms`."),platforms:u.array(u.string().min(1)).optional().describe("Comment-capable platform name/alias. Required when changing `content` without supplying `data`."),data:u.record(u.string(),u.unknown()).optional().describe('Advanced: the full comment `data` object keyed by platform, e.g. {"LINKEDIN":{"text":"new"}}.')},annotations:{destructiveHint:!0,openWorldHint:!0}},async({id:t,title:n,date:a,status:i,content:r,platforms:m,data:d})=>{let p=fe((m??[]).map(S)),I=r!==void 0||d!==void 0,b={};if(n!==void 0&&(b.title=n),a){let y=new Date(a);if(Number.isNaN(y.getTime()))throw new c("INVALID_DATE",`date is not a valid ISO 8601 date/time: "${a}". Example: 2026-06-01T09:00:00Z`);b.postDate=y.toISOString()}if(i&&(b.status=i),p.length>0&&(b.socialAccountTypes=p),I)if(d)b.data=d;else{if(p.length===0)throw new c("NO_TARGET","Pass `platforms` when changing `content` (the per-platform comment text needs to know which platforms to target).");let y=Object.fromEntries(p.map(T=>[T,{text:r}]));b.data=y}if(Object.keys(b).length===0)throw new c("NOTHING_TO_UPDATE","Nothing to update \u2014 pass at least one of title, date, status, content (+ platforms), data.");return s(await e.client.comment.commentUpdate({id:t,requestBody:b}))}),l(o,"retry_comment",{title:"Retry a failed comment",description:"Retry publishing a comment that ended in the ERROR state.",inputSchema:{id:u.string().min(1).describe("Comment id.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.comment.commentRetry({id:t}))),l(o,"create_comment_import",{title:"Import comments on a post",description:"Start an async import of the (incoming) comments on a published post for one platform. Comment imports are available on FACEBOOK, INSTAGRAM, LINKEDIN, YOUTUBE, TIKTOK, REDDIT, THREADS, MASTODON, BLUESKY. Poll get_comment_import / list_comment_imports for status and list_imported_comments for the fetched comments.",inputSchema:{postId:u.string().min(1).describe("Id of the published post to import comments for."),platform:u.string().min(1).describe("Platform name/alias to import comments from."),teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({postId:t,platform:n,teamId:a})=>{let i=await h(e,a);return s(await e.client.comment.commentImportCreate({requestBody:{teamId:i,postId:t,socialAccountType:S(n)}}))}),l(o,"list_comment_imports",{title:"List comment imports",description:"List comment-import jobs for a team, optionally filtered by post and status.",inputSchema:{teamId:g,postId:u.string().optional().describe("Only imports for this post."),status:It.optional().describe("Filter by import status."),limit:u.number().int().positive().max(100).optional(),offset:u.number().int().nonnegative().optional()},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({teamId:t,postId:n,status:a,limit:i,offset:r})=>{let m=await h(e,t);return s(await e.client.comment.commentImportGetList({teamId:m,postId:n,status:a,limit:i??null,offset:r??null}))}),l(o,"get_comment_import",{title:"Get a comment import by id",description:"Fetch a single comment-import job by its id, including its status and the number of comments imported.",inputSchema:{importId:u.string().min(1).describe("Comment import id.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({importId:t})=>s(await e.client.comment.commentImportGetById({importId:t}))),l(o,"list_imported_comments",{title:"List imported comments for a post",description:"List the comments fetched by comment imports for a post, optionally filtered by platform / social account.",inputSchema:{postId:u.string().min(1).describe("Id of the post whose imported comments to list."),platform:u.string().optional().describe("Filter by platform name/alias."),socialAccountId:u.string().optional().describe("Filter by social-account id."),teamId:g,limit:u.number().int().positive().max(100).optional(),offset:u.number().int().nonnegative().optional()},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({postId:t,platform:n,socialAccountId:a,teamId:i,limit:r,offset:m})=>{let d=await h(e,i);return s(await e.client.comment.commentImportGetFetchedComments({teamId:d,postId:t,platform:n?S(n):void 0,socialAccountId:a,limit:r??null,offset:m??null}))}),l(o,"act_on_imported_comment",{title:"Moderate an imported comment",description:"Act on a comment fetched by a comment import \u2014 delete, hide/unhide, like/unlike, or approve/reject it. Supported actions vary by platform; DELETE and HIDE are the widely available ones.",inputSchema:{commentId:u.string().min(1).describe("Id of the fetched (imported) comment."),action:u.enum(["DELETE","HIDE","UNHIDE","LIKE","UNLIKE","APPROVE","REJECT"]).describe("What to do with the comment."),reason:u.string().optional().describe("Optional reason recorded with the action."),banAuthor:u.boolean().optional().describe("Also ban the comment's author, where the platform supports it."),teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({commentId:t,action:n,reason:a,banAuthor:i,teamId:r})=>{let m=await h(e,r);return s(await e.client.comment.commentImportActionFetchedComment({commentId:t,requestBody:{teamId:m,action:n,...a!==void 0?{reason:a}:{},...i?{banAuthor:!0}:{}}}))})}import{z as _}from"zod";function De(o,e){l(o,"upload_media",{title:"Upload media",description:'Upload a media file (image, video or document) to a bundle.social team from a public https:// URL \u2014 or, when this server runs in stdio mode, a local file path. Local files larger than ~90 MB are uploaded via the large-upload flow automatically (only .jpg/.jpeg/.png/.gif/.mp4/.mov/.pdf are supported above that size). On the hosted server, send local files with init_large_upload instead. Returns the upload object; pass its `id` to create_post/schedule_post via the `data` argument (e.g. {"TWITTER":{"text":"hi","uploadIds":["<id>"]}}).',inputSchema:{teamId:g,source:_.string().min(1).describe("A public https:// URL, or a local file path (stdio mode only).")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({teamId:t,source:n})=>{let a=await h(e,t);return s(await ne(e,a,n))}),l(o,"list_media",{title:"List uploaded media",description:"List media uploads for a team, optionally filtered by type (image/video/document) and usage status (USED/UNUSED).",inputSchema:{teamId:g,type:_.enum(["image","video","document"]).optional().describe("Filter by media type."),status:_.enum(["USED","UNUSED"]).optional().describe("Filter by whether the upload is attached to a post.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({teamId:t,type:n,status:a})=>{let i=await h(e,t);return s(await e.client.upload.uploadGetList({teamId:i,type:n??null,status:a??null}))}),l(o,"get_media",{title:"Get an upload by id",description:"Fetch a single media upload by its bundle.social id.",inputSchema:{id:_.string().min(1).describe("Upload id.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.upload.uploadGet({id:t}))),l(o,"delete_media",{title:"Delete an upload",description:"Delete a media upload by its bundle.social id. Destructive.",inputSchema:{id:_.string().min(1).describe("Upload id.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.upload.uploadDelete({id:t}))),l(o,"delete_media_many",{title:"Delete multiple uploads",description:"Delete several media uploads at once by their ids. Destructive.",inputSchema:{ids:_.array(_.string().min(1)).min(1).describe("Upload ids to delete.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({ids:t})=>s(await e.client.upload.uploadDeleteMany({requestBody:{ids:t}}))),l(o,"init_large_upload",{title:"Initialize a large upload",description:'Start a direct upload of a file of any size up to 5 GB. Returns a signed `url` (valid 30 minutes) and a `path`. PUT the raw file bytes to `url` with the same Content-Type as `mimeType`, for example `curl -X PUT -H "Content-Type: video/mp4" --upload-file ./clip.mp4 "<url>"`, then call finalize_large_upload with `path`. Use this to send a file from the user\'s machine to the hosted server (it cannot read local paths) or for files over ~90 MB. In stdio mode, upload_media with a local path does all of this automatically.',inputSchema:{teamId:g,fileName:_.string().min(1).describe("File name."),mimeType:_.enum(["image/jpg","image/jpeg","image/png","image/gif","video/mp4","video/quicktime","application/pdf"]).describe("File MIME type; also the Content-Type of the PUT.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({teamId:t,fileName:n,mimeType:a})=>{let i=await h(e,t);return s(await e.client.upload.uploadInitLargeUpload({requestBody:{teamId:i,fileName:n,mimeType:a}}))}),l(o,"finalize_large_upload",{title:"Finalize a large upload",description:"Finish a direct upload after the file bytes have been PUT to the signed url from init_large_upload. Returns the upload object; pass its `id` to create_post/schedule_post.",inputSchema:{teamId:g,path:_.string().min(1).describe("The `path` returned by init_large_upload.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({teamId:t,path:n})=>{let a=await h(e,t);return s(await e.client.upload.uploadFinalizeLargeUpload({requestBody:{teamId:a,path:n}}))})}import{z as O}from"zod";function Et(o,e,t){if(!e&&!t)return!0;if(!o)return!1;let n=new Date(o).getTime();return!(Number.isNaN(n)||e&&n<new Date(e).getTime()||t&&n>new Date(t).getTime())}function ke(o,e){l(o,"get_post_analytics",{title:"Get post analytics",description:"Get engagement metrics (impressions, views, likes, comments, \u2026) for a single post by its bundle.social id. Optionally limit to one platform. Set `raw: true` for the unprocessed provider payload.",inputSchema:{id:O.string().min(1).describe("Post id."),platform:O.string().optional().describe("Limit to a single platform name/alias (e.g. instagram, tiktok, youtube). Analytics are not available for X/Twitter, Discord or Slack."),raw:O.boolean().optional().default(!1).describe("If true, return the raw provider analytics payload instead of the normalized metrics.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({id:t,platform:n,raw:a})=>{let i=n?M(n):void 0,r=a?await e.client.analytics.analyticsGetPostAnalyticsRaw({postId:t,platformType:i}):await e.client.analytics.analyticsGetPostAnalytics({postId:t,platformType:i});return s(r)}),l(o,"get_account_analytics",{title:"Get social-account analytics",description:"Get the analytics time-series (followers, impressions, likes, \u2026) for a connected account on the given platform. Analytics are available on TIKTOK, YOUTUBE, INSTAGRAM, FACEBOOK, THREADS, REDDIT, PINTEREST, MASTODON, LINKEDIN, BLUESKY, GOOGLE_BUSINESS. Set `raw: true` for the unprocessed provider payload.",inputSchema:{platform:O.string().min(1).describe("Platform name/alias."),teamId:g,raw:O.boolean().optional().default(!1).describe("If true, return the raw provider analytics payload.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({platform:t,teamId:n,raw:a})=>{let i=await h(e,n),r=M(t),m=a?await e.client.analytics.analyticsGetSocialAccountAnalyticsRaw({teamId:i,platformType:r}):await e.client.analytics.analyticsGetSocialAccountAnalytics({teamId:i,platformType:r});return s(m)}),l(o,"get_bulk_post_analytics",{title:"Get analytics for multiple posts",description:"Get analytics for up to 60 posts in one request (paginated, 20 per page) for a single platform.",inputSchema:{postIds:O.array(O.string().min(1)).min(1).max(60).describe("Post ids (max 60)."),platform:O.string().min(1).describe("Platform name/alias the posts belong to."),page:O.number().int().positive().optional().describe("Page (1-based)."),limit:O.number().int().positive().max(20).optional().describe("Page size (max 20).")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({postIds:t,platform:n,page:a,limit:i})=>s(await e.client.analytics.analyticsGetBulkPostAnalytics({postIds:t,platformType:M(n),page:a,limit:i}))),l(o,"refresh_analytics",{title:"Force-refresh analytics",description:"Force an immediate analytics refresh. Pass `postId` to refresh that post's analytics; otherwise pass `platform` to refresh a connected account's analytics for the team.",inputSchema:{postId:O.string().optional().describe("Post id to refresh analytics for."),importedPostId:O.string().optional().describe("Imported-post id to refresh analytics for (alternative to postId)."),platform:O.string().optional().describe("Platform name/alias to refresh a social-account's analytics for (used when postId/importedPostId are omitted)."),teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({postId:t,importedPostId:n,platform:a,teamId:i})=>{if(t||n)return s(await e.client.analytics.analyticsForcePostAnalytics({requestBody:{postId:t??null,importedPostId:n??null,platformType:a?M(a):null}}));if(!a)throw new c("REFRESH_TARGET_REQUIRED","Pass either `postId`/`importedPostId` (to refresh a post) or `platform` (to refresh a social account).");let r=await h(e,i);return s(await e.client.analytics.analyticsForceSocialAccountAnalytics({requestBody:{teamId:r,platformType:M(a)}}))}),l(o,"get_analytics_summary",{title:"Get analytics summary",description:"Organization-level analytics summary: posts/comments/uploads usage quotas for the organization, plus the latest analytics snapshot (followers, impressions, likes, \u2026) for each connected integration on the team. Use `from`/`to` to select the snapshot from a date range.",inputSchema:{teamId:g,from:O.string().optional().describe("Start of the range used to select analytics snapshots (ISO 8601)."),to:O.string().optional().describe("End of the range used to select analytics snapshots (ISO 8601).")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({teamId:t,from:n,to:a})=>{let i=await h(e,t),[r,m,d,p,I]=await Promise.all([e.client.organization.organizationGetOrganization(),e.client.team.teamGetTeam({id:i}),e.client.organization.organizationGetPostsUsage().catch(()=>null),e.client.organization.organizationGetCommentsUsage().catch(()=>null),e.client.organization.organizationGetUploadsUsage().catch(()=>null)]),b=m.socialAccounts??[],y=[];for(let T of b){let P={id:T.id,type:T.type,username:T.username??null};if(!ee(T.type)){y.push({...P,analytics:null,note:"analytics not available for this platform"});continue}try{let E=((await e.client.analytics.analyticsGetSocialAccountAnalytics({teamId:i,platformType:T.type})).items??[]).filter(w=>Et(w.createdAt,n,a));y.push({...P,latest:E[E.length-1]??null,dataPoints:E.length})}catch(R){y.push({...P,analytics:null,error:v(R)})}}return s({organization:{id:r.id,name:r.name??null},team:{id:m.id,name:m.name},range:{from:n??null,to:a??null},usage:{posts:d,comments:p,uploads:I},integrations:y})})}import{z as q}from"zod";var V=[7,30,60,180,365];function Ne(o,e){let t=e.postId?String(e.postId):void 0,n=e.platformPostId?String(e.platformPostId):void 0;if(!!t==!!n)throw new c("INVALID_PARAMS",`Integration tool "${o}" needs exactly one of postId (bundle.social post id) or platformPostId (TikTok item_id).`,{method:o});return t?{postId:t}:{platformPostId:n}}function wt(o,e){if(e.authorizationDays===void 0||e.authorizationDays===null||e.authorizationDays==="")return{};let t=Number(e.authorizationDays);if(!V.includes(t))throw new c("INVALID_PARAMS",`Integration tool "${o}": authorizationDays must be one of ${V.join(", ")}.`,{method:o,authorizationDays:e.authorizationDays});return{authorizationDays:t}}var j=[{id:"reddit:flairs",platform:"REDDIT",description:"List the post flairs available in a subreddit (use the returned flair id when creating a Reddit post that requires a flair).",requiredParams:["subreddit"],run:(o,e,t)=>o.misc.miscRedditGetSubredditFlairs({teamId:e,subreddit:String(t.subreddit)})},{id:"reddit:requirements",platform:"REDDIT",description:"Get a subreddit's posting requirements (title length, flair requirement, allowed post types, etc.).",requiredParams:["subreddit"],run:(o,e,t)=>o.misc.miscRedditGetPostRequirements({teamId:e,subreddit:String(t.subreddit)})},{id:"youtube:categories",platform:"YOUTUBE",description:"List YouTube video categories for a region (use the returned category id as `categoryId` when posting a YouTube video).",optionalParams:["regionCode"],run:(o,e,t)=>o.misc.miscYoutubeGetVideoCategories({teamId:e,...t.regionCode?{regionCode:String(t.regionCode)}:{}})},{id:"youtube:playlists",platform:"YOUTUBE",description:"List the connected YouTube channel's playlists (use a playlist id to add the posted video to it).",optionalParams:["maxResults"],run:(o,e,t)=>o.misc.miscYoutubeGetChannelPlaylist({teamId:e,...t.maxResults!==void 0?{maxResults:Number(t.maxResults)}:{}})},{id:"youtube:regions",platform:"YOUTUBE",description:"List YouTube content regions (i18n region codes).",run:(o,e)=>o.misc.miscYoutubeGetRegions({teamId:e})},{id:"linkedin:mentions",platform:"LINKEDIN",description:"Search LinkedIn people/organizations to mention in a post (use the returned URN in the post text).",requiredParams:["q"],optionalParams:["scope"],run:(o,e,t)=>o.misc.miscLinkedinGetTags({teamId:e,q:String(t.q),...t.scope?{scope:String(t.scope)}:{}})},{id:"instagram:locations",platform:"INSTAGRAM",description:"Search Instagram locations (use the returned location id as `locationId` when posting).",requiredParams:["q"],optionalParams:["limit"],run:(o,e,t)=>o.misc.miscInstagramSearchLocations({teamId:e,q:String(t.q),...t.limit!==void 0?{limit:Number(t.limit)}:{}})},{id:"gbp:location",platform:"GOOGLE_BUSINESS",description:"Get the connected Google Business Profile location's details.",optionalParams:["fields"],run:(o,e,t)=>o.misc.miscGoogleBusinessGetLocation({teamId:e,...Array.isArray(t.fields)?{fields:t.fields}:{}})},{id:"gbp:categories",platform:"GOOGLE_BUSINESS",description:"List Google Business Profile categories for a region/language (use a category id when updating the location).",requiredParams:["languageCode","regionCode"],optionalParams:["filter","pageSize","pageToken","view"],run:(o,e,t)=>o.misc.miscGoogleBusinessListCategories({teamId:e,languageCode:String(t.languageCode),regionCode:String(t.regionCode),...t.filter?{filter:String(t.filter)}:{},...t.pageSize!==void 0?{pageSize:Number(t.pageSize)}:{},...t.pageToken?{pageToken:String(t.pageToken)}:{},...t.view?{view:String(t.view)}:{}})},{id:"instagram:audio",platform:"INSTAGRAM",description:"Search the Instagram audio catalogue (use the returned audio_id as `musicSoundInfo.musicSoundId` when posting a Reel).",requiredParams:["audioType"],optionalParams:["searchQuery"],run:(o,e,t)=>o.misc.miscInstagramSearchAudio({teamId:e,audioType:String(t.audioType),...t.searchQuery?{searchQuery:String(t.searchQuery)}:{}})},{id:"instagram:business-discovery",platform:"INSTAGRAM",description:"Look up a public Instagram Business/Creator profile by username (followers, media count, recent public media). Requires an account connected via Facebook Login.",requiredParams:["username"],run:(o,e,t)=>o.misc.miscInstagramBusinessDiscovery({teamId:e,username:String(t.username)})},{id:"tiktok:trending-music",platform:"TIKTOK",description:"List trending tracks from TikTok's commercial music library (use a track id in the TikTok post settings).",optionalParams:["dateRange","genre"],run:(o,e,t)=>o.misc.miscTiktokGetCommercialMusicTrendingList({teamId:e,...t.dateRange?{dateRange:String(t.dateRange)}:{},...t.genre?{genre:String(t.genre)}:{}})},{id:"tiktok:ad-authorization",platform:"TIKTOK",description:"Get the Spark Ads authorization code of a TikTok post with its validity window and status (NOT_USED, IN_USE, EXPIRED). Pass exactly one of postId (bundle.social post) or platformPostId (TikTok item_id). Fails if ad authorization was never enabled for the post; turn it on with manage_tiktok_ad_authorization.",optionalParams:["postId","platformPostId"],run:(o,e,t)=>o.misc.miscTiktokGetAdAuthorization({teamId:e,...Ne("tiktok:ad-authorization",t)})}];function Le(){return j.map(o=>({method:o.id,platform:o.platform,description:o.description,requiredParams:o.requiredParams??[],optionalParams:o.optionalParams??[]}))}function Ue(o,e,t,n){let a=`tiktok:${t}-ad-authorization`,i=Ne(a,n);if(t==="disable")return o.misc.miscTiktokDisableAdAuthorization({requestBody:{teamId:e,...i}});let r={teamId:e,...i,...wt(a,n)};return t==="enable"?o.misc.miscTiktokEnableAdAuthorization({requestBody:r}):o.misc.miscTiktokExtendAdAuthorization({requestBody:r})}async function Be(o,e,t,n){let a=j.find(r=>r.id===t.trim().toLowerCase());if(!a)throw new c("UNKNOWN_INTEGRATION_TOOL",`Unknown integration tool "${t}". Available: ${j.map(r=>r.id).join(", ")}.`,{available:j.map(r=>r.id)});let i=(a.requiredParams??[]).filter(r=>n[r]===void 0||n[r]===null||n[r]==="");if(i.length>0)throw new c("MISSING_PARAMS",`Integration tool "${a.id}" requires: ${i.join(", ")}. Provide them in the params object.`,{method:a.id,requiredParams:a.requiredParams});return a.run(o,e,n)}function qe(o,e){l(o,"list_integration_tools",{title:"List integration helper tools",description:"List the read-only platform helper tools callable via trigger_integration_tool \u2014 e.g. fetch subreddit flairs, YouTube categories/playlists/regions, LinkedIn mentions, Instagram locations, Google Business categories, TikTok trending music, the Spark Ads code of a TikTok post. Each entry has a `method` id and the params it accepts. Use these to discover values the API needs (flair ids, category ids, mention URNs, \u2026).",annotations:{readOnlyHint:!0,openWorldHint:!0}},async()=>s({tools:Le()})),l(o,"trigger_integration_tool",{title:"Call an integration helper tool",description:'Call one of the read-only platform helper tools (see list_integration_tools), e.g. method "reddit:flairs" with params {"subreddit":"r/test"}. Returns the raw result.',inputSchema:{method:q.string().min(1).describe('Tool method id, e.g. "reddit:flairs", "youtube:categories", "linkedin:mentions" (call list_integration_tools first).'),params:q.record(q.string(),q.unknown()).optional().describe('Parameters for the tool as a JSON object, e.g. {"subreddit":"r/test"}.'),teamId:g},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({method:t,params:n,teamId:a})=>{let i=await h(e,a);return s(await Be(e.client,i,t,n??{}))}),l(o,"manage_tiktok_ad_authorization",{title:"Manage TikTok Spark Ads authorization",description:`Turn ad authorization of a public TikTok post on ("enable", accepts TikTok's Advertising Content Terms for the post), add days to its code or issue a new one after it was turned off ("extend"), or turn it off ("disable"; TikTok refuses while the post runs in an active Spark Ad). enable and extend return the Spark Ads code to share with an advertiser. Address the post with exactly one of postId (bundle.social post) or platformPostId (TikTok item_id). Read the current code with trigger_integration_tool method "tiktok:ad-authorization".`,inputSchema:{action:q.enum(["enable","extend","disable"]).describe("enable, extend or disable."),postId:q.string().min(1).optional().describe("bundle.social post published to TikTok. Pass this or platformPostId."),platformPostId:q.string().min(1).optional().describe("TikTok post ID (item_id) of a public post on the team's TikTok account. Pass this or postId."),authorizationDays:q.number().int().optional().describe(`enable/extend only: code validity in days, one of ${V.join(", ")}. Default 30.`),teamId:g},annotations:{readOnlyHint:!1,destructiveHint:!0,idempotentHint:!1,openWorldHint:!0}},async({action:t,teamId:n,...a})=>{let i=await h(e,n);return s(await Ue(e.client,i,t,a))})}import{z as D}from"zod";function Ge(o,e){l(o,"list_teams",{title:"List teams",description:"List the teams in the organization (paginated). Use this to discover team ids for the optional `teamId` argument on other tools.",inputSchema:{limit:D.number().int().positive().max(100).optional().describe("Max number of teams to return."),offset:D.number().int().nonnegative().optional().describe("Number of teams to skip (for pagination)."),search:D.string().optional().describe("Free-text search over team names.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({limit:t,offset:n,search:a})=>s(await e.client.team.teamGetList({limit:t??null,offset:n??null,search:a??null}))),l(o,"get_team",{title:"Get a team by id",description:"Fetch a single team by id, including its connected social accounts/integrations.",inputSchema:{id:D.string().min(1).describe("Team id.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.team.teamGetTeam({id:t}))),l(o,"create_team",{title:"Create a team",description:"Create a new team in the organization.",inputSchema:{name:D.string().min(1).describe("Team name."),avatarUrl:D.string().optional().describe("Optional avatar image URL.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({name:t,avatarUrl:n})=>s(await e.client.team.teamCreateTeam({requestBody:{name:t,avatarUrl:n??null}}))),l(o,"update_team",{title:"Update a team",description:"Update a team's name and/or avatar. Only the fields you pass are changed.",inputSchema:{id:D.string().min(1).describe("Team id."),name:D.string().optional().describe("New team name."),avatarUrl:D.string().nullable().optional().describe("New avatar image URL, or null to clear it.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({id:t,name:n,avatarUrl:a})=>{let i={};if(n!==void 0&&(i.name=n),a!==void 0&&(i.avatarUrl=a),Object.keys(i).length===0)throw new c("NOTHING_TO_UPDATE","Nothing to update \u2014 pass at least one of name, avatarUrl.");return s(await e.client.team.teamUpdateTeam({id:t,requestBody:i}))}),l(o,"delete_team",{title:"Delete a team",description:"Delete a team by id. This is destructive and cannot be undone \u2014 it removes the team and its scheduled content.",inputSchema:{id:D.string().min(1).describe("Team id.")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({id:t})=>s(await e.client.team.teamDeleteTeam({id:t})))}import{z as F}from"zod";function He(o,e){l(o,"get_organization",{title:"Get the organization",description:"Fetch the current organization \u2014 its id, name, API-access flag and plan limits. Its `teams` array is deprecated (removed 2026-11-15); use `list_teams` to enumerate teams.",annotations:{readOnlyHint:!0,openWorldHint:!0}},async()=>s(await e.client.organization.organizationGetOrganization())),l(o,"get_usage",{title:"Get usage quotas",description:"Organization usage quotas: posts, comments and uploads (used/limit/remaining), plus a paginated per-social-account breakdown of post-history import usage. Use the pagination/filter args for the imports breakdown.",inputSchema:{teamId:g,platform:F.string().optional().describe("Filter the imports breakdown to one platform name/alias (e.g. instagram, tiktok)."),socialAccountId:F.string().optional().describe("Filter the imports breakdown to one social-account id."),page:F.number().int().positive().optional().describe("Page of the imports breakdown (1-based)."),pageSize:F.number().int().positive().max(100).optional().describe("Page size of the imports breakdown.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({teamId:t,platform:n,socialAccountId:a,page:i,pageSize:r})=>{let d=t??e.defaultTeamId??await h(e,t).catch(()=>{}),[p,I,b,y]=await Promise.all([e.client.organization.organizationGetPostsUsage().catch(T=>({error:v(T)})),e.client.organization.organizationGetCommentsUsage().catch(T=>({error:v(T)})),e.client.organization.organizationGetUploadsUsage().catch(T=>({error:v(T)})),e.client.organization.organizationGetImportsUsage({page:i,pageSize:r,teamId:d,socialAccountType:n?S(n):void 0,socialAccountId:a}).catch(T=>({error:v(T)}))]);return s({posts:p,comments:I,uploads:b,imports:y})}),l(o,"get_daily_limits_usage",{title:"Get a connected account's daily limits",description:"How much of one connected account's daily post and comment allowance has been used on a given day (defaults to today, UTC). Use it before bulk-scheduling to avoid hitting a per-account daily cap.",inputSchema:{socialAccountId:F.string().min(1).describe("Connected social account id (see list_integrations)."),date:F.string().optional().describe("Day to report on, YYYY-MM-DD. Defaults to today.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({socialAccountId:t,date:n})=>s(await e.client.organization.organizationGetDailyLimitsUsage({socialAccountId:t,...n?{date:n}:{}})))}import{z as C}from"zod";var Me=C.string().min(1).describe("Platform name/alias. Post-history import is available on FACEBOOK, INSTAGRAM, THREADS, TIKTOK, YOUTUBE, LINKEDIN, PINTEREST, REDDIT, MASTODON, BLUESKY.");function Fe(o,e){l(o,"create_post_import",{title:"Import post history",description:"Start an async import of a connected account's recent posts (optionally with analytics) for one platform. Poll list_post_imports / get_post_import for status and list_imported_posts for the imported posts.",inputSchema:{platform:Me,count:C.number().int().positive().describe("How many recent posts to import."),withAnalytics:C.boolean().optional().describe("Also fetch analytics for the imported posts."),importCarousels:C.boolean().optional().describe("Include carousel/album posts (Instagram)."),surface:C.enum(["PROFILE_GRID","NON_GRID","STORY","ALL"]).optional().describe("Which surface to import from (Instagram)."),mediaType:C.enum(["VIDEO","IMAGE"]).optional().describe("Restrict to one media type."),teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({platform:t,count:n,withAnalytics:a,importCarousels:i,surface:r,mediaType:m,teamId:d})=>{let p=await h(e,d);return s(await e.client.postImport.postImportCreate({requestBody:{teamId:p,socialAccountType:S(t),count:n,...a!==void 0?{withAnalytics:a}:{},...i!==void 0?{importCarousels:i}:{},...r?{surface:r}:{},...m?{mediaType:m}:{}}}))}),l(o,"list_post_imports",{title:"List post-history imports",description:"List post-history import jobs for a team, optionally filtered by platform.",inputSchema:{teamId:g,platform:C.string().optional().describe("Filter by platform name/alias.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({teamId:t,platform:n})=>{let a=await h(e,t);return s(await e.client.postImport.postImportGetStatus({teamId:a,socialAccountType:n?S(n):void 0}))}),l(o,"get_post_import",{title:"Get a post-history import by id",description:"Fetch a single post-history import job by its id, including its status and counts.",inputSchema:{importId:C.string().min(1).describe("Post import id.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({importId:t})=>s(await e.client.postImport.postImportGetById({importId:t}))),l(o,"list_imported_posts",{title:"List imported posts for a platform",description:"List the posts imported (with analytics, when available) for a connected account on the given platform.",inputSchema:{platform:Me,teamId:g,limit:C.number().int().positive().max(100).optional(),offset:C.number().int().nonnegative().optional()},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({platform:t,teamId:n,limit:a,offset:i})=>{let r=await h(e,n);return s(await e.client.postImport.postImportGetImportedPosts({teamId:r,socialAccountType:S(t),limit:a,offset:i??null}))}),l(o,"delete_imported_posts",{title:"Delete imported posts",description:"Bulk-delete imported posts (and their analytics) by id. Destructive.",inputSchema:{postIds:C.array(C.string().min(1)).min(1).describe("Imported-post ids to delete."),teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({postIds:t,teamId:n})=>{let a=await h(e,n);return s(await e.client.postImport.postImportDeleteImportedPosts({requestBody:{teamId:a,postIds:t}}))}),l(o,"retry_post_import",{title:"Retry a post-history import",description:"Retry a post-history import job that ended in FAILED / RATE_LIMITED.",inputSchema:{importId:C.string().min(1).describe("Post import id."),teamId:g},annotations:{destructiveHint:!0,openWorldHint:!0}},async({importId:t,teamId:n})=>{let a=await h(e,n);return s(await e.client.postImport.postImportRetryImport({importId:t,requestBody:{teamId:a}}))})}import Pt from"fs/promises";import $ from"path";import{z as N}from"zod";var Ot=50*1024*1024;function xe(o){return/^https?:\/\//i.test(o.trim())}async function Rt(o,e){if(xe(e)&&o.mode==="hosted"){let a=await Ee(e.trim(),{maxBytes:Ot}),i=$.basename(new URL(e).pathname)||"import.csv";return new File([new Uint8Array(a)],i,{type:"text/csv"})}if(xe(e)){let a=await fetch(e.trim());if(!a.ok)throw new c("CSV_FETCH_FAILED",`Could not download the CSV from "${e}" (HTTP ${a.status}).`,{status:a.status});let i=Buffer.from(await a.arrayBuffer()),r=$.basename(new URL(e).pathname)||"import.csv";return new File([i],r,{type:"text/csv"})}oe(o,e,"CSV");let t=$.resolve(e),n;try{n=await Pt.readFile(t)}catch{throw new c("CSV_NOT_FOUND",`Could not read CSV "${e}". Provide a public https:// URL, or a local file path that exists on the machine running this MCP server (stdio mode only).`,{path:t})}return new File([n],$.basename(t),{type:"text/csv"})}function Ke(o,e){l(o,"create_post_csv_import",{title:"Bulk-import posts from a CSV",description:"Upload a CSV for async bulk post import. Accepts a public https:// URL to the CSV, or a local file path when this server runs in stdio mode. Poll get_post_csv_import_status / get_post_csv_import_rows for progress and per-row results.",inputSchema:{source:N.string().min(1).describe("Public https:// URL of the CSV, or a local file path (stdio mode only).")},annotations:{destructiveHint:!0,openWorldHint:!0}},async({source:t})=>{let n=await Rt(e,t);return s(await e.client.postCsv.postCsvCreate({formData:{file:n}}))}),l(o,"list_post_csv_imports",{title:"List CSV imports",description:"List the post-CSV import history (paginated).",inputSchema:{limit:N.number().int().positive().max(100).optional(),offset:N.number().int().nonnegative().optional()},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({limit:t,offset:n})=>s(await e.client.postCsv.postCsvGetList({limit:t??null,offset:n??null}))),l(o,"get_post_csv_import",{title:"Get a CSV import by id",description:"Fetch a single post-CSV import by its id, including counts and status.",inputSchema:{importId:N.string().min(1).describe("CSV import id.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({importId:t})=>s(await e.client.postCsv.postCsvGetById({importId:t}))),l(o,"get_post_csv_import_status",{title:"Get a CSV import's processing status",description:"Fetch the processing status of a post-CSV import (rows processed/succeeded/failed).",inputSchema:{importId:N.string().min(1).describe("CSV import id.")},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({importId:t})=>s(await e.client.postCsv.postCsvGetStatus({importId:t}))),l(o,"get_post_csv_import_rows",{title:"Get a CSV import's row results",description:"List per-row results of a post-CSV import (the raw row, normalized payload, created post id or error), optionally filtered by SUCCESS/FAILED.",inputSchema:{importId:N.string().min(1).describe("CSV import id."),status:N.enum(["SUCCESS","FAILED"]).optional().describe("Filter rows by outcome."),limit:N.number().int().positive().max(100).optional(),offset:N.number().int().nonnegative().optional()},annotations:{readOnlyHint:!0,openWorldHint:!0}},async({importId:t,status:n,limit:a,offset:i})=>s(await e.client.postCsv.postCsvGetRows({importId:t,status:n,limit:a??null,offset:i??null})))}var vt=Y.version;function ze(o,e){l(o,"check_setup",{title:"Check the bundle.social setup",description:"Diagnose this MCP server's setup: API key present, API reachable, API key valid, organization API access, team resolution, connected integrations and posts quota. Always returns a structured diagnostic object ({ ok, checks: [...] }).",annotations:{readOnlyHint:!0,openWorldHint:!0}},async()=>{let t=[],n=(d,p,I,b={})=>t.push({name:d,status:p,message:I,...b}),a=()=>s({ok:t.every(d=>d.status!=="fail"),mcpVersion:vt,node:process.version,checks:t});n("api_key","ok","API key configured");try{let d=await e.client.app.appGetHealth();n("api_reachable","ok","API reachable",{health:d})}catch(d){return n("api_reachable","fail","Could not reach the bundle.social API",{error:v(d)}),a()}let i=[],r;try{let d=await e.client.organization.organizationGetOrganization();r=d.apiAccess,n("authentication","ok","API key is valid",{organizationId:d.id,organizationName:d.name??null})}catch(d){return n("authentication","fail","API key was rejected by the API",{error:v(d)}),a()}if(!e.defaultTeamId)try{i=(await G(e.client)).map(d=>({id:d.id,name:d.name}))}catch(d){return n("team","fail","Could not list the organization's teams",{error:v(d)}),a()}n("api_access",r?"ok":"fail",r?"Organization has API access enabled":"Organization does not have API access enabled \u2014 upgrade your plan or contact bundle.social support");let m;if(e.defaultTeamId?(m=e.defaultTeamId,n("team","ok","Using the configured default team",{teamId:m})):i.length===1?(m=i[0].id,n("team","ok","Using the organization's only team",{teamId:m,teamName:i[0].name})):i.length===0?n("team","fail","Organization has no teams \u2014 create one in the dashboard"):n("team","ok",`${i.length} teams, no default team. Name the team in each request; teamId accepts a team id or name.`,{teams:i}),m)try{let p=(await e.client.team.teamGetTeam({id:m})).socialAccounts??[];n("integrations",p.length>0?"ok":"warn",p.length>0?`${p.length} connected integration(s)`:"No integrations connected \u2014 connect one in the dashboard before posting",{count:p.length,platforms:p.map(I=>I.type),connectUrl:Ie})}catch(d){n("integrations","fail","Could not load the team's integrations",{teamId:m,error:v(d)})}try{let d=await e.client.organization.organizationGetPostsUsage();n("posts_quota",d.remaining>0?"ok":"warn",`Posts quota: ${d.used}/${d.limit} used, ${d.remaining} remaining`,{used:d.used,limit:d.limit,remaining:d.remaining})}catch(d){n("posts_quota","warn","Could not read posts quota",{error:v(d)})}return a()})}import{z as We}from"zod";var Ct=["FACEBOOK","INSTAGRAM","LINKEDIN","YOUTUBE","TIKTOK","REDDIT","THREADS","MASTODON","BLUESKY"],_t=["TIKTOK","YOUTUBE","INSTAGRAM","FACEBOOK","THREADS","REDDIT","PINTEREST","MASTODON","LINKEDIN","BLUESKY","GOOGLE_BUSINESS","SNAPCHAT"];function Dt(o){return{dataKey:`data.${o}`,summary:"Comment/reply on a post. The per-platform comment object only carries the comment body.",fields:[{name:"text",type:"string",required:!0,notes:"The comment body."}],example:{[o]:{text:"Great write-up \u2014 thanks for sharing!"}}}}var kt={TWITTER:{dataKey:"data.TWITTER",summary:"Post a tweet. For a thread, post the first tweet then add replies via create_comment.",fields:[{name:"text",type:"string",required:!1,notes:"Post text. ~280 chars (longer if the connected account is X Premium)."},{name:"uploadIds",type:"string[]",required:!1,notes:"Up to 4 images OR 1 video/GIF."},{name:"replySettings",type:"EVERYONE | FOLLOWING | MENTIONED_USERS | SUBSCRIBERS | VERIFIED",required:!1,notes:"Who can reply to the tweet."},{name:"isAiGenerated",type:"boolean",required:!1,notes:`Adds X's "made with AI" label to a post with AI-generated media.`}],example:{TWITTER:{text:"Shipping day \u{1F680}",replySettings:"EVERYONE"}}},BLUESKY:{dataKey:"data.BLUESKY",summary:"Post to Bluesky.",fields:[{name:"text",type:"string",required:!1,notes:"~300 chars."},{name:"uploadIds",type:"string[]",required:!1,notes:"Up to 4 images, or 1 video (set videoAlt)."},{name:"tags",type:"string[]",required:!1,notes:"Extra hashtags (without `#`), up to 8."},{name:"labels",type:"(!no-unauthenticated | porn | sexual | nudity | graphic-media)[]",required:!1,notes:"Self-labels / content warnings."},{name:"quoteUri",type:"string",required:!1,notes:"AT-URI of a post to quote (at://\u2026/app.bsky.feed.post/<rkey>)."},{name:"externalUrl",type:"string (URL)",required:!1,notes:"External link card URL."},{name:"externalTitle",type:"string",required:!1,notes:"External link card title."},{name:"externalDescription",type:"string",required:!1,notes:"External link card description."},{name:"thumbnail",type:"string (URL)",required:!1,notes:"Image for the external link card (a public bundle.social upload URL)."},{name:"videoAlt",type:"string",required:!1,notes:"Alt text for a video embed."}],example:{BLUESKY:{text:"New post",tags:["launch","indie"],externalUrl:"https://bundle.social"}}},MASTODON:{dataKey:"data.MASTODON",summary:"Post a status to Mastodon.",fields:[{name:"text",type:"string",required:!1,notes:"Length depends on the connected instance (commonly ~500)."},{name:"uploadIds",type:"string[]",required:!1,notes:"Up to 4 images OR 1 video."},{name:"privacy",type:"PUBLIC | UNLISTED | PRIVATE | DIRECT",required:!1,notes:"Visibility."},{name:"spoiler",type:"string",required:!1,notes:"Content-warning text (collapses the post behind it)."},{name:"thumbnail",type:"string (URL)",required:!1,notes:"Cover image for a video."}],example:{MASTODON:{text:"Hello fediverse",privacy:"PUBLIC",spoiler:"long read"}}},THREADS:{dataKey:"data.THREADS",summary:"Post to Threads (optionally a ghost post that Threads archives after 24 hours).",fields:[{name:"text",type:"string",required:!1,notes:"~500 chars."},{name:"isGhostPost",type:"boolean",required:!1,notes:"Publish a text-only ghost post that Threads archives after 24 hours. Rejects uploadIds/mediaItems, poll, gif, linkAttachment, topicTag, replyControl, allowlistedCountryCodes and crosspostToInstagramStory."},{name:"uploadIds",type:"string[]",required:!1,notes:"Up to ~10 images, or 1 video."},{name:"mediaItems",type:"{ uploadId: string, altText?: string }[]",required:!1,notes:"Per-image alt text (alternative to uploadIds)."},{name:"topicTag",type:"string",required:!1,notes:"One topic tag shown in the post header. 1\u201350 chars, no periods (.) or ampersands (&)."},{name:"replyControl",type:"everyone | accounts_you_follow | mentioned_only | parent_post_author_only | followers_only",required:!1,notes:"Who can reply. Threads defaults to everyone."},{name:"linkAttachment",type:"string (URL)",required:!1,notes:"Link preview card. Text-only posts (no uploadIds)."},{name:"poll",type:"{ optionA: string, optionB: string, optionC?: string, optionD?: string }",required:!1,notes:"2\u20134 options, 1\u201325 chars each. Text-only posts, and not together with `gif`."},{name:"gif",type:'{ gifId: string, provider?: "GIPHY" }',required:!1,notes:"GIF attachment (GIPHY is the only provider). Text-only posts, and not together with `poll`."},{name:"allowlistedCountryCodes",type:"string[]",required:!1,notes:"Restrict visibility to these ISO 3166-1 alpha-2 codes. Requires Meta account eligibility."},{name:"crosspostToInstagramStory",type:"boolean",required:!1,notes:"Also share the post to the linked Instagram account as a Story."},{name:"crosspostToInstagramStoryDarkMode",type:"boolean",required:!1,notes:"Cross-post the Instagram Story in dark mode."}],example:{THREADS:{text:"Quick thought",topicTag:"shipping",replyControl:"everyone"}}},LINKEDIN:{dataKey:"data.LINKEDIN",summary:"Post to a LinkedIn personal profile or company page (depends on the connected account).",fields:[{name:"text",type:"string",required:!0,notes:"Required. ~3000 chars."},{name:"uploadIds",type:"string[]",required:!1,notes:"Images, a single video, or a document/PDF."},{name:"link",type:"string (URL)",required:!1,notes:"For an article-preview post."},{name:"thumbnail",type:"string (URL)",required:!1,notes:"Cover image (a public bundle.social upload URL)."},{name:"mediaTitle",type:"string",required:!1,notes:"Title for a video or document post."},{name:"privacy",type:"CONNECTIONS | PUBLIC | LOGGED_IN | CONTAINER",required:!1,notes:"Visibility."},{name:"hideFromFeed",type:"boolean",required:!1,notes:"Don't show in the main feed."},{name:"disableReshare",type:"boolean",required:!1,notes:"Disallow resharing."}],example:{LINKEDIN:{text:"We just shipped X.",privacy:"PUBLIC",mediaTitle:"Demo"}}},FACEBOOK:{dataKey:"data.FACEBOOK",summary:"Post to a Facebook Page.",fields:[{name:"type",type:"POST | REEL | STORY",required:!1,notes:"Default POST."},{name:"text",type:"string",required:!1,notes:"Caption / message."},{name:"uploadIds",type:"string[]",required:!1,notes:"Images, or a single video."},{name:"mediaItems",type:"{ uploadId: string, altText?: string }[]",required:!1,notes:"Per-image alt text."},{name:"link",type:"string (URL)",required:!1,notes:"Link attachment \u2014 `type: POST` only."},{name:"mediaTitle",type:"string",required:!1,notes:"Video title \u2014 `type: POST` with a video only (not REEL/STORY)."},{name:"thumbnail",type:"string (URL)",required:!1,notes:"Video cover image."},{name:"nativeScheduleTime",type:"string (ISO 8601, local)",required:!1,notes:"Schedule directly in Meta's scheduler instead of publishing now; max 30 days ahead."}],example:{FACEBOOK:{type:"POST",text:"Look at this",link:"https://bundle.social"}}},INSTAGRAM:{dataKey:"data.INSTAGRAM",summary:"Post to Instagram (feed post, carousel, Reel or Story).",fields:[{name:"type",type:"POST | REEL | STORY",required:!1,notes:"POST = single image, carousel (carouselItems) or feed video; REEL = single video; STORY = image or short video."},{name:"text",type:"string",required:!1,notes:"Caption."},{name:"uploadIds",type:"string[]",required:!1,notes:"Single image/video for POST/REEL/STORY. Square \u22651080\xD71080 or portrait 4:5; Reels 9:16, up to 90s."},{name:"altText",type:"string",required:!1,notes:"Alt text for a single-image post."},{name:"carouselItems",type:"{ uploadId: string, altText?: string, tagged?: { username, x, y }[] }[]",required:!1,notes:"Carousel slides (for `type: POST`)."},{name:"thumbnailOffset",type:"number (ms)",required:!1,notes:"Frame to use as the published video's cover."},{name:"thumbnail",type:"string (URL)",required:!1,notes:"Cover image (alternative to thumbnailOffset)."},{name:"shareToFeed",type:"boolean",required:!1,notes:"Reels only \u2014 also show in the Feed tab."},{name:"collaborators",type:"string[]",required:!1,notes:"Usernames to invite as collaborators."},{name:"tagged",type:"{ username: string, x?: number, y?: number }[]",required:!1,notes:"People tags for a single-image post."},{name:"locationId",type:"string",required:!1,notes:'A location id \u2014 discover with trigger_integration_tool method "instagram:locations".'},{name:"autoFitImage",type:"boolean",required:!1,notes:"Let bundle.social fit the image to a valid aspect ratio."},{name:"autoCropImage",type:"boolean",required:!1,notes:"Let bundle.social crop the image to a valid aspect ratio."},{name:"trialParams",type:'{ graduationStrategy: "MANUAL" | "SS_PERFORMANCE" }',required:!1,notes:"Reels only \u2014 trial reels are shown to non-followers first."},{name:"isPaidPartnership",type:"boolean",required:!1,notes:'Adds the native "Paid partnership" label. Implied by brandedContentSponsors; use alone for a label without a named sponsor.'},{name:"brandedContentSponsors",type:"string[]",required:!1,notes:"Up to 2 Instagram usernames to tag as paid-partnership sponsors. Accounts connected via Facebook Login only."},{name:"musicSoundInfo",type:"{ musicSoundId, musicSoundVolume?, videoOriginalSoundVolume? }",required:!1,notes:'Reels only \u2014 get an audio_id from trigger_integration_tool method "instagram:audio". Volumes 0\u2013100.'},{name:"isAiGenerated",type:"boolean",required:!1,notes:"Adds Instagram's AI content label."}],example:{INSTAGRAM:{type:"REEL",text:"BTS",shareToFeed:!0,thumbnailOffset:1500}}},TIKTOK:{dataKey:"data.TIKTOK",summary:"Post a video or photo carousel to TikTok.",fields:[{name:"type",type:"VIDEO | IMAGE",required:!1,notes:"VIDEO = 1 video; IMAGE = photo carousel."},{name:"privacy",type:"PUBLIC_TO_EVERYONE | MUTUAL_FOLLOW_FRIENDS | FOLLOWER_OF_CREATOR | SELF_ONLY",required:!0,notes:"Effectively required by TikTok."},{name:"text",type:"string",required:!1,notes:"Caption."},{name:"uploadIds",type:"string[]",required:!1,notes:"The video, or the photos for `type: IMAGE`. Video: MP4/MOV/WEBM, \u2265540p, portrait 9:16 recommended, up to ~10 min."},{name:"photoCoverIndex",type:"number",required:!1,notes:"Which photo is the cover (for `type: IMAGE`)."},{name:"thumbnailOffset",type:"number (ms)",required:!1,notes:"Frame to use as the video cover."},{name:"thumbnail",type:"string (URL)",required:!1,notes:"Cover image (alternative to thumbnailOffset)."},{name:"isBrandContent",type:"boolean",required:!1,notes:"Disclosure: paid third-party partnership."},{name:"isOrganicBrandContent",type:"boolean",required:!1,notes:"Disclosure: promoting your own business."},{name:"disableComments",type:"boolean",required:!1,notes:"Interaction restriction."},{name:"disableDuet",type:"boolean",required:!1,notes:"Interaction restriction."},{name:"disableStitch",type:"boolean",required:!1,notes:"Interaction restriction."},{name:"isAiGenerated",type:"boolean",required:!1,notes:"Mark the video as AI-generated."},{name:"autoAddMusic",type:"boolean",required:!1,notes:"Let TikTok add music to photos."},{name:"autoScale",type:"boolean",required:!1,notes:"Auto-scale the video."},{name:"uploadToDraft",type:"boolean",required:!1,notes:"Upload as a TikTok draft instead of publishing."},{name:"musicSoundInfo",type:"{ musicSoundId, musicSoundVolume?, musicSoundStart?, musicSoundEnd?, videoOriginalSoundVolume? }",required:!1,notes:'Commercial music \u2014 get a song_clip_id from trigger_integration_tool method "tiktok:trending-music". Volumes 0\u2013100; start/end in ms.'}],example:{TIKTOK:{type:"VIDEO",text:"Launch BTS",privacy:"PUBLIC_TO_EVERYONE",disableStitch:!0}}},YOUTUBE:{dataKey:"data.YOUTUBE",summary:"Upload a video or Short to YouTube.",fields:[{name:"type",type:"VIDEO | SHORT",required:!1,notes:"SHORT = vertical \u226460s; VIDEO = full upload."},{name:"uploadIds",type:"string[]",required:!1,notes:"One video."},{name:"text",type:"string",required:!1,notes:"The video TITLE (the post `title` field also maps here)."},{name:"description",type:"string",required:!1,notes:"Video description."},{name:"thumbnail",type:"string (URL)",required:!1,notes:"Custom thumbnail (`type: VIDEO`). Set after YouTube finishes processing the video; track it via `thumbnailStatus` (PENDING / APPLIED / FAILED) in the post's external data."},{name:"privacy",type:"PUBLIC | UNLISTED | PRIVATE",required:!1,notes:"Visibility."},{name:"defaultLanguage",type:"string (BCP-47)",required:!1,notes:'Language of the title and description, e.g. "en" or "pl".'},{name:"defaultAudioLanguage",type:"string (BCP-47)",required:!1,notes:`Language of the video's default audio track, e.g. "en" or "pl".`},{name:"madeForKids",type:"boolean",required:!0,notes:"Required-ish \u2014 YouTube needs you to declare this."},{name:"containsSyntheticMedia",type:"boolean",required:!1,notes:"Mark AI-generated content."},{name:"hasPaidProductPlacement",type:"boolean",required:!1,notes:"Declare paid placements."}],example:{YOUTUBE:{type:"SHORT",text:"Launch BTS",description:"Behind the scenes\u2026",privacy:"PUBLIC",madeForKids:!1}}},REDDIT:{dataKey:"data.REDDIT",summary:"Submit a post to a subreddit (or your profile).",fields:[{name:"sr",type:"string",required:!0,notes:"Subreddit (`r/subredditName`) or `u/username`."},{name:"text",type:"string",required:!0,notes:`The post title for link/text posts (Reddit's "title").`},{name:"description",type:"string",required:!1,notes:"The body for a self post."},{name:"uploadIds",type:"string[]",required:!1,notes:"An image or video."},{name:"link",type:"string (URL)",required:!1,notes:"Link post target."},{name:"nsfw",type:"boolean",required:!1,notes:"Mark NSFW."},{name:"flairId",type:"string",required:!1,notes:'Required if the subreddit requires a flair \u2014 get options with trigger_integration_tool method "reddit:flairs".'}],example:{REDDIT:{sr:"r/dataisbeautiful",text:"Our 2026 growth, visualized",uploadIds:["<id>"],flairId:"<flair-id>"}}},DISCORD:{dataKey:"data.DISCORD",summary:"Post a message to a connected Discord channel.",fields:[{name:"channelId",type:"string",required:!0,notes:'The connected server channel (an integration "channel" id \u2014 see list_integrations).'},{name:"text",type:"string",required:!1,notes:"Message content. \u22642000 chars."},{name:"uploadIds",type:"string[]",required:!1,notes:"Attachments."},{name:"username",type:"string",required:!1,notes:"Override the author name shown (webhook)."},{name:"avatarUrl",type:"string (URL)",required:!1,notes:"Override the author avatar (webhook)."}],example:{DISCORD:{channelId:"<channel-id>",text:"New release \u{1F389}"}}},SLACK:{dataKey:"data.SLACK",summary:"Post a message to a connected Slack channel.",fields:[{name:"channelId",type:"string",required:!0,notes:'The connected workspace channel (an integration "channel" id \u2014 see list_integrations).'},{name:"text",type:"string",required:!1,notes:"Message text."},{name:"uploadIds",type:"string[]",required:!1,notes:"Attachments."},{name:"username",type:"string",required:!1,notes:"Override the author name shown."},{name:"avatarUrl",type:"string (URL)",required:!1,notes:"Override the author avatar."}],example:{SLACK:{channelId:"<channel-id>",text:"Standup notes\u2026"}}},GOOGLE_BUSINESS:{dataKey:"data.GOOGLE_BUSINESS",summary:"Publish an update to a Google Business Profile location.",fields:[{name:"text",type:"string",required:!1,notes:"The update body."},{name:"uploadIds",type:"string[]",required:!1,notes:"Images/videos."},{name:"topicType",type:"STANDARD | EVENT | OFFER | ALERT",required:!1,notes:"Post kind."},{name:"languageCode",type:"string",required:!1,notes:"Language tag like `en` / `en-US`."},{name:"callToActionType",type:"BOOK | ORDER | SHOP | LEARN_MORE | SIGN_UP | CALL",required:!1,notes:"CTA button."},{name:"callToActionUrl",type:"string (URL)",required:!1,notes:"CTA target."},{name:"eventTitle",type:"string",required:!1,notes:"For `topicType: EVENT`."},{name:"eventStartDate",type:"string",required:!1,notes:"For `topicType: EVENT`."},{name:"eventEndDate",type:"string",required:!1,notes:"For `topicType: EVENT`."},{name:"offerCouponCode",type:"string",required:!1,notes:"For `topicType: OFFER`."},{name:"offerRedeemOnlineUrl",type:"string",required:!1,notes:"For `topicType: OFFER`."},{name:"offerTermsConditions",type:"string",required:!1,notes:"For `topicType: OFFER`."},{name:"alertType",type:"COVID_19",required:!1,notes:"For `topicType: ALERT`."}],example:{GOOGLE_BUSINESS:{text:"Now open Saturdays!",topicType:"STANDARD",callToActionType:"LEARN_MORE",callToActionUrl:"https://example.com"}}},PINTEREST:{dataKey:"data.PINTEREST",summary:"Create a Pin (image, video or 2-5 image carousel) on a board.",fields:[{name:"boardName",type:"string",required:!0,notes:"The board to pin to."},{name:"uploadIds",type:"string[]",required:!1,notes:"One image or video, or 2-5 images (same aspect ratio, no video) for a carousel Pin. Order = slide order."},{name:"text",type:"string",required:!1,notes:"The Pin title."},{name:"description",type:"string",required:!1,notes:"Pin description."},{name:"link",type:"string (URL)",required:!1,notes:"Where the Pin links to."},{name:"carouselItems",type:"{ uploadId: string, title?: string, description?: string, link?: string }[]",required:!1,notes:"Per-slide overrides for a carousel Pin, matched by uploadId. Missing fields use the Pin values."},{name:"altText",type:"string",required:!1,notes:"Image alt text."},{name:"note",type:"string",required:!1,notes:"Private note (not public)."},{name:"thumbnail",type:"string (URL)",required:!1,notes:"Cover image."},{name:"dominantColor",type:"string",required:!1,notes:"Hex color used as a placeholder before the image loads."},{name:"isAiGenerated",type:"boolean",required:!1,notes:"Adds Pinterest's AI disclosure label."}],example:{PINTEREST:{boardName:"Inspiration",text:"New idea",uploadIds:["<id>"],link:"https://bundle.social"}}},SNAPCHAT:{dataKey:"data.SNAPCHAT",summary:"Post a Story or a Spotlight to a Snapchat Public Profile.",fields:[{name:"type",type:"STORY | SPOTLIGHT",required:!1,notes:"Default STORY."},{name:"uploadIds",type:"string[]",required:!1,notes:"One image or video. Video: 5\u2013180s, \u2265540\xD7960, up to 100 MB. Images are Story-only."},{name:"text",type:"string",required:!1,notes:"Alias for `description` (Spotlight). \u2264160 chars."},{name:"description",type:"string",required:!1,notes:"Spotlight description. \u2264160 chars."},{name:"locale",type:"string",required:!1,notes:"Spotlight locale in `en_US` form. Default en_US."},{name:"skipSaveToProfile",type:"boolean",required:!1,notes:"Spotlight only \u2014 don't save the post to the profile."}],example:{SNAPCHAT:{type:"SPOTLIGHT",description:"Launch day",locale:"en_US"}}}},Nt={TWITTER:["x","twitter"],BLUESKY:["bluesky","bsky"],MASTODON:["mastodon","masto"],THREADS:["threads"],LINKEDIN:["linkedin","li"],FACEBOOK:["facebook","fb"],INSTAGRAM:["instagram","ig","insta"],TIKTOK:["tiktok","tt"],YOUTUBE:["youtube","yt"],REDDIT:["reddit"],DISCORD:["discord"],SLACK:["slack"],GOOGLE_BUSINESS:["gbp","google-business","google_business","gmb"],PINTEREST:["pinterest","pin"],SNAPCHAT:["snapchat","snap"]},Lt={TWITTER:"X / Twitter",BLUESKY:"Bluesky",MASTODON:"Mastodon",THREADS:"Threads",LINKEDIN:"LinkedIn",FACEBOOK:"Facebook (Page)",INSTAGRAM:"Instagram",TIKTOK:"TikTok",YOUTUBE:"YouTube",REDDIT:"Reddit",DISCORD:"Discord",SLACK:"Slack",GOOGLE_BUSINESS:"Google Business Profile",PINTEREST:"Pinterest",SNAPCHAT:"Snapchat (Public Profile)"},Ut={TWITTER:["For an X thread, post the first tweet, then add the rest as replies \u2014 note the API does not expose comments for X, so chain them as separate posts.","No analytics surface for X."],LINKEDIN:['Discover mention URNs with trigger_integration_tool method "linkedin:mentions" and put them in `text`.'],REDDIT:['Before posting, run trigger_integration_tool method "reddit:requirements" to learn title length limits, allowed post types and whether a flair is required.'],YOUTUBE:['There is no `categoryId` in the post `data`; fetch categories with trigger_integration_tool method "youtube:categories".'],INSTAGRAM:["Account types are connected via Facebook or directly via Instagram (instagramConnectionMethod on the integration).","brandedContentSponsors and business discovery only work for accounts connected through Facebook Login."],GOOGLE_BUSINESS:["Set the location up in the dashboard first; details/categories/hours are managed via integration helper tools."],SNAPCHAT:["Requires a Snapchat Public Profile. Stories take an image or a video; Spotlights are video-only.",`connect_integration with options {"snapchatConnectionMethod":"BUSINESS"} lists the Public Profiles of the Snap Business organizations the login belongs to; pick one with set_integration_channel. PERSONAL (default) connects the login's own Public Profile.`,"No comments API surface for Snapchat."],THREADS:["Polls, GIFs and link attachments are mutually exclusive with media \u2014 Threads only allows them on text-only posts.","`isGhostPost: true` publishes a text-only post that Threads archives after 24 hours; media, poll, GIF, link attachment, topic tag, reply control, country restrictions and Instagram Story cross-sharing are rejected with it."],TIKTOK:['Spark Ads: once a post is public, manage_tiktok_ad_authorization with action "enable" returns its ad authorization code for an advertiser ("extend" / "disable" manage it); trigger_integration_tool method "tiktok:ad-authorization" reads its status.']},ge=["Images: JPG / PNG / WEBP / GIF. Video: MP4 / MOV / WEBM, up to 5 GB via the large-upload flow.","Upload media first (upload_media \u2192 id), or let create_post's `media` arg do it; then put ids in `uploadIds` (and carouselItems[].uploadId / mediaItems[].uploadId).","Large videos can take a while to process server-side after upload \u2014 a newly created post may sit in PROCESSING before going POSTED. Use get_post to check status; retry_post for a transient platform failure."],he=Object.fromEntries(k.map(o=>{let e=U.includes(o),t={platform:o,label:Lt[o],aliases:Nt[o],capabilities:{posting:!0,comments:e,analytics:_t.includes(o),commentImports:Ct.includes(o)},post:kt[o],...e?{comment:Dt(o)}:{},notes:Ut[o]??[]};return[o,t]}));function Ye(o,e){let t={platform:o.platform,label:o.label,aliases:o.aliases,capabilities:o.capabilities,notes:o.notes};return e==="post"?{...t,post:o.post}:e==="comment"?{...t,comment:o.comment??{supported:!1,message:`Comments are not available on ${o.label} via the bundle.social API.`}}:{...t,post:o.post,...o.comment?{comment:o.comment}:{}}}function je(o,e){l(o,"describe_platform",{title:"Describe a platform's field schema",description:'Look up the exact per-platform `data.<PLATFORM>` fields the bundle.social API accepts \u2014 for posting AND commenting \u2014 so you can build a correct `data` / `platformSettings` object instead of guessing. Pass `platform` (name or alias, e.g. "reddit", "x", "gbp") for one platform, or omit it to get every platform. Pass `operation` ("post" or "comment") to narrow the response. Each field lists its name, type, whether it is required, and notes; each platform also reports its capabilities (posting / comments / analytics / comment imports) and a ready-to-use example. Call this before create_post / schedule_post / update_post / create_comment / update_comment whenever you are unsure which fields a platform needs.',inputSchema:{platform:We.string().min(1).optional().describe('Platform name or alias (e.g. "reddit", "x", "tiktok", "gbp"). Omit to describe every platform.'),operation:We.enum(["post","comment"]).optional().describe('Which operation to describe. "post" = create/schedule/update a post; "comment" = create/update a comment. Omit for both.')},annotations:{readOnlyHint:!0}},async({platform:t,operation:n})=>{if(t){let a=x(t);return a?s({platform:Ye(he[a],n),mediaNotes:ge}):s({error:{code:"UNKNOWN_PLATFORM",message:`Unknown platform "${t}". Supported: ${k.join(", ")} (aliases like "x" and "gbp" are accepted too).`,supportedPlatforms:k}})}return s({platforms:k.map(a=>Ye(he[a],n)),mediaNotes:ge,hint:'Pass `platform` (e.g. "reddit") to focus on one platform, or `operation` ("post" | "comment") to narrow the response.'})})}function Ve(o,e){He(o,e),Ge(o,e),Pe(o,e),je(o,e),Ce(o,e),_e(o,e),De(o,e),ke(o,e),Fe(o,e),Ke(o,e),qe(o,e),ze(o,e)}var $e=Y.version;function qt(o){return new Proxy(o,{get(e,t,n){if(t==="registerTool"){let i=e.registerTool.bind(e);return(r,m,d)=>m?.annotations?.readOnlyHint?i(r,m,d):void 0}let a=Reflect.get(e,t,n);return typeof a=="function"?a.bind(e):a}})}var Xe="Tools for the bundle.social API: posting and scheduling to 14+ social platforms, comments, media uploads, analytics, team and integration management, and bulk/history imports (post history, comments, CSV). check_setup reports whether the credentials, organization access and team resolution work. list_integrations returns connected accounts and their ids. create_post / schedule_post target platforms by name (x, tiktok, instagram, youtube, facebook, threads, linkedin, pinterest, reddit, mastodon, discord, slack, gbp) or by integration id; platform-required fields (Reddit `sr`, Pinterest `boardName`, TikTok `privacy`, YouTube `madeForKids`/`privacyStatus`) go under `platformSettings` keyed by platform. describe_platform returns the exact per-platform `data.<PLATFORM>` field schema for posts and comments; the same fields are documented at https://docs.bundle.social/api-reference/platform-parameters. Team-scoped tools take an optional `teamId` (a team id or exact team name), resolved automatically when the organization has one team or a default team is configured; an organization may have many teams, one per client. Errors come back as { error: { code, message, details } } with isError: true.",Gt=" This server runs remotely and cannot read local file paths: media and CSV sources must be public https:// URLs. To send a file from the user's machine, a client with a shell can call init_large_upload, PUT the bytes to the returned url (for example with curl --upload-file), then call finalize_large_upload.";function Jn(o){let e=o.mode??"stdio",t=new Bt({name:"bundlesocial",version:$e},{capabilities:{tools:{}},instructions:e==="hosted"?Xe+Gt:Xe}),n=o.clientId??`${e==="hosted"?"mcp-hosted":"mcp"}/${$e}`,a={client:Ae(o.apiKey,o.apiUrl??Z,n),mode:e,defaultTeamId:o.defaultTeamId};return Ve(o.readOnly?qt(t):t,a),t}export{zt as a,Q as b,$e as c,Jn as d};
|
|
4
|
+
//# sourceMappingURL=chunk-UDAYUBLK.js.map
|