ig_publish_story
Publish Instagram Stories with images or videos that automatically disappear after 24 hours using the Meta MCP server.
Instructions
Publish a Story (image or video). Stories disappear after 24 hours.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| media_type | Yes | Story media type | |
| media_url | Yes | Public HTTPS URL of the media |
Implementation Reference
- The ig_publish_story tool handler, which publishes a story (image or video) to Instagram. It includes media type validation, container creation, and video processing wait logic.
server.tool( "ig_publish_story", "Publish a Story (image or video). Stories disappear after 24 hours.", { media_type: z.enum(["IMAGE", "VIDEO"]).describe("Story media type"), media_url: z.string().url().describe("Public HTTPS URL of the media"), }, async ({ media_type, media_url }) => { try { const params: Record<string, unknown> = {}; if (media_type === "IMAGE") { params.image_url = media_url; } else { params.video_url = media_url; params.media_type = "VIDEO"; } const { data: container } = await client.ig("POST", `/${client.igUserId}/media`, params); const containerId = (container as { id: string }).id; if (media_type === "VIDEO") { await waitForContainer(client, containerId); } const { data, rateLimit } = await client.ig("POST", `/${client.igUserId}/media_publish`, { creation_id: containerId, }); return { content: [{ type: "text", text: JSON.stringify({ ...data as object, _rateLimit: rateLimit }, null, 2) }] }; } catch (error) { return { content: [{ type: "text", text: `Publish story failed: ${error instanceof Error ? error.message : String(error)}` }], isError: true }; } } );