---
title: "Post to social media from ChatGPT: your own MCP server for Instagram"
description: "Connect ChatGPT to Meta's official Instagram API through a private MCP server and a Secure MCP Tunnel. ChatGPT drafts, you confirm every publish."
url: https://rizamo.com/guides/post-to-social-media-from-chatgpt/
---

# Post to social media from ChatGPT: your own MCP server for Instagram

ChatGPT can post to social media, and schedule posts, once a plugin connects it to your accounts: a provider's plugin, which posts and schedules through that provider's app after you link your accounts to it, or your own MCP server on each network's API. On its own it can only write the post. This guide builds your own for Instagram, for posting now: an MCP server on Meta's official API, reached by ChatGPT through OpenAI's Secure MCP Tunnel, so your server never listens on the public internet.

The server is the one from our [Claude guide](/guides/post-to-instagram-from-claude/#the-server), and its API calls are the ones from our [Instagram API guide](/guides/how-to-post-to-instagram-via-api/). This page is about what changes for ChatGPT.

## The short version

1. Get an Instagram token and account id from a Meta app with Instagram Login.
2. Save the four-tool `server.mjs`, with the token in a `.env` file next to it.
3. Create a tunnel in OpenAI Platform and run `tunnel-client` on your computer, pointed at the server.
4. In ChatGPT, add a custom MCP server with **Connection: Tunnel**, create it as a plugin and install it.
5. Type `@` and pick the plugin in a chat. ChatGPT asks you to confirm before each tool that changes something.

## Three ways to connect ChatGPT to Instagram

ChatGPT adds MCP servers as plugins, from [ChatGPT Plugins](https://chatgpt.com/plugins), on the web. Under **Connection** it takes a server URL or a Secure MCP Tunnel, and for sign-in it offers **OAuth**, **No authentication**, or both ([Add custom MCP server](https://developers.openai.com/api/docs/guides/custom-mcp-server)).

| Route | What it takes | Covered |
| --- | --- | --- |
| Secure MCP Tunnel | Your server on your computer, `tunnel-client` running beside it, an OpenAI Platform organization | This guide |
| Public server URL | The server on the public internet over HTTPS, with its own OAuth | [Below](#a-public-url-needs-oauth) |
| A provider's plugin | Your Instagram account linked to the provider, its server URL, OAuth to the provider | [Instagram MCP servers](/guides/instagram-mcp-server/) |

Blotato ([llms.txt](https://www.blotato.com/llms.txt)), Metricool ([help](https://help.metricool.com/how-to-connect-metricools-mcp-with-chatgpt-0lrl3)) and Upload-Post ([MCP](https://docs.upload-post.com/guides/mcp-server-integration)) say they are in ChatGPT's plugin directory, and so is Rizamo ([ChatGPT on Rizamo](/agents/chatgpt/)); the directory cannot be read without signing in.

The tunnel is what makes a personal server practical. `tunnel-client` opens an outbound HTTPS connection to OpenAI, pulls the MCP requests waiting for your server and sends back the answers. Your server needs no public listener, and the docs list "a developer machine" among the places it can run ([Secure MCP Tunnel](https://developers.openai.com/api/docs/guides/secure-mcp-tunnels)).

## Before you start

- An Instagram professional account, business or creator. Meta's API [only serves professional accounts](https://developers.facebook.com/documentation/instagram-platform/overview).
- A Meta app with Instagram Login and a token with `instagram_business_basic` and `instagram_business_content_publish`. For your own account, **Generate token** in the App Dashboard gives a 60-day token, with no App Review ([get started](https://developers.facebook.com/documentation/instagram-platform/instagram-api-with-instagram-login/get-started)).
- The account's `user_id` from `GET /me?fields=user_id,username`, as in the [Instagram API guide](/guides/how-to-post-to-instagram-via-api/#post-an-image-with-curl).
- Node.js 20.6 or later, for its [`--env-file`](https://nodejs.org/api/cli.html#--env-filefile) option.
- An OpenAI Platform organization where you have Tunnels **Read**, **Manage** and **Use**, and a ChatGPT workspace that lets you add custom MCP servers. Both are permissions an admin can grant or withhold ([permissions](https://developers.openai.com/api/docs/guides/secure-mcp-tunnels#permissions-and-access)).
- The image or video at a public URL. Meta fetches the file itself, so it must be on a [publicly accessible server](https://developers.facebook.com/documentation/instagram-platform/content-publishing). A file attached in the chat will not work.

OpenAI's pages do not say which ChatGPT plans can add custom MCP servers, and third-party pages disagree. If **Add custom MCP server** is not in your Plugins page, that is the first thing to check with your workspace admin.

## The server

Follow [The server](/guides/post-to-instagram-from-claude/#the-server) in our Claude guide: the folder, the two npm packages and `server.mjs` are the same for ChatGPT. Its four tools are:

| Tool | What it does | Marked read-only |
| --- | --- | --- |
| `create_instagram_container` | Uploads an image or reel as an unpublished container | No |
| `get_instagram_container` | Reads the container's `status_code` | Yes |
| `publish_instagram_container` | Publishes a `FINISHED` container, never twice | No |
| `get_instagram_publishing_limit` | Reads Meta's count of API posts in the last 24 hours | Yes |

Why publishing is its own tool, and why the server never retries a publish: [Why four tools and not one](/guides/post-to-instagram-from-claude/#why-four-tools-and-not-one).

Claude Desktop passes the token through its config file. Here `tunnel-client` starts the server, so put the token in a `.env` file next to `server.mjs` and let Node load it:

```bash title="~/instagram-mcp/.env"
IG_TOKEN=<INSTAGRAM_USER_ACCESS_TOKEN>
IG_ID=<USER_ID>
```

```bash title="Keep the token readable by you only"
chmod 600 ~/instagram-mcp/.env
```

Check that the server starts: `node --env-file=$HOME/instagram-mcp/.env $HOME/instagram-mcp/server.mjs` should wait silently for input. If it exits with "Set IG_TOKEN and IG_ID", the file was not read. Stop it with Ctrl+C.

## Run the tunnel

Create a tunnel in [Platform tunnel settings](https://platform.openai.com/settings/organization/tunnels) and copy its `tunnel_id`. Then create a runtime API key for `tunnel-client` in the same organization's [API keys](https://platform.openai.com/settings/organization/api-keys) ([onboarding](https://github.com/openai/tunnel-client/blob/master/docs/onboarding.md)).

On macOS, Homebrew is the supported install. On other systems, use the download in Platform tunnel settings or the [latest release](https://github.com/openai/tunnel-client/releases/latest) ([tunnel-client](https://github.com/openai/tunnel-client)).

```bash title="1. Install tunnel-client (macOS)"
brew install openai/tools/tunnel-client
tunnel-client --version
```

Point a profile at the server. The command is the one you just checked, with absolute paths:

```bash title="2. Configure and check the profile"
export CONTROL_PLANE_API_KEY="<RUNTIME_API_KEY>"

tunnel-client init \
  --sample sample_mcp_stdio_local \
  --profile instagram \
  --tunnel-id <TUNNEL_ID> \
  --mcp-command "node --env-file=/Users/you/instagram-mcp/.env /Users/you/instagram-mcp/server.mjs"

tunnel-client doctor --profile instagram --explain
```

```bash title="3. Start it, and leave it running"
tunnel-client run --profile instagram
```

ChatGPT finds the tools and calls them only while `tunnel-client run` is up. Run one `tunnel-client` per tunnel id: with a stdio server, two at once (even briefly, during a restart) each start their own copy of the server, and requests can land on either ([tunnel-client](https://github.com/openai/tunnel-client#readme)).

## Add it to ChatGPT

In [ChatGPT Plugins](https://chatgpt.com/plugins), on the web:

1. Choose **+**, then **Add custom MCP server**, and name it `Instagram`.
2. Under **Connection**, choose **Tunnel** and select your tunnel. If it is not listed, the tunnel is not associated with this ChatGPT workspace, or you lack Tunnels **Use** ([connect from ChatGPT](https://developers.openai.com/api/docs/guides/secure-mcp-tunnels#connect-from-chatgpt)).
3. For authentication, choose **No authentication**. The server has no sign-in of its own: who can reach it is decided by who can use the tunnel in your Platform organization and workspace.
4. Read the risk warning, choose **I understand and want to continue**, then **Create as a plugin**.
5. Install the plugin from your plugins ([Add custom MCP server](https://developers.openai.com/api/docs/guides/custom-mcp-server)).

Create it in your personal plugins, not in a shared workspace: a plugin there could publish to your Instagram account for whoever else can use it.

When you change `server.mjs`, restart `tunnel-client` and refresh the app in its settings page to pull the new tools and descriptions (same page).

## Confirm every publish

ChatGPT asks you to confirm write actions by default, and it decides what a write is from one annotation: tools marked `readOnlyHint` run without asking, and "Tools without this hint are treated as write actions" ([Add custom MCP server](https://developers.openai.com/api/docs/guides/custom-mcp-server)). With this server:

- `get_instagram_container` and `get_instagram_publishing_limit` carry `readOnlyHint`, so ChatGPT runs them without a prompt.
- `create_instagram_container` asks. It publishes nothing, and a container never published expires after 24 hours ([IG User Media](https://developers.facebook.com/documentation/instagram-platform/instagram-graph-api/reference/ig-user/media#limitations)).
- `publish_instagram_container` asks, and it is the prompt that matters. Expand the tool call to read the exact input before you approve.

ChatGPT can remember an approval for one tool for the rest of a conversation. Never do that for the publish tool: every later post in that chat would go out without a prompt. A new conversation asks again (same page).

## Post something

Pick the plugin with `@` and name the tools. OpenAI's own advice for custom servers is to be explicit about the app and the tool, and to rule out other tools (same page):

```text title="In ChatGPT"
@Instagram Write an Instagram caption for https://example.com/photos/autumn-menu.jpg:
the new autumn menu, three drinks, warm tone, at most 5 hashtags.
Show me the caption first. Then use create_instagram_container,
and use publish_instagram_container only after I say yes.
Do not use any other tools.
```

What follows: ChatGPT shows the caption, you ask for changes or say yes, ChatGPT asks to run `create_instagram_container`, then asks to run `publish_instagram_container` once the container is `FINISHED`, and replies with the post id. For a reel, it checks `get_instagram_container` until the video is processed; Meta recommends checking at most once a minute, for no more than five minutes ([content publishing](https://developers.facebook.com/documentation/instagram-platform/content-publishing)).

Before a batch, ask how many posts you can still publish today: `get_instagram_publishing_limit` reads Meta's own count ([content publishing limit](https://developers.facebook.com/documentation/instagram-platform/instagram-graph-api/reference/ig-user/content_publishing_limit)).

## Tunnel limits that matter here

From the [limits](https://developers.openai.com/api/docs/guides/secure-mcp-tunnels#limits) table:

- **120 seconds per request,** from when it enters OpenAI's queue to the answer. Each tool call here is one short request: `create_instagram_container` waits 5 seconds and returns, and the long wait for a reel is spread over separate status checks.
- **10 MiB per request or response.** The server sends URLs and ids, never the media itself.
- **600 requests a minute per tunnel.** Far above what one person posting needs.

## A public URL needs OAuth

Without a tunnel, the server has to be on the public internet over HTTPS, using SSE or streaming HTTP ([Add custom MCP server](https://developers.openai.com/api/docs/guides/custom-mcp-server)). The SDK serves the same tools over HTTP ([serving](https://ts.sdk.modelcontextprotocol.io/v2/serving/http)). The catch is sign-in: the options ChatGPT lists are OAuth and no authentication, with no field for a fixed API key. A public server with no authentication lets anyone who finds its URL publish to your account, so on this route the server needs OAuth, which is a login service to build and keep safe.

For one account, the tunnel is less to run. A public URL is the route when other people's accounts are involved, and then each of them needs your Meta app to pass App Review ([App Review](https://developers.facebook.com/documentation/instagram-platform/app-review)).

## What it does not do

- **Files from the chat.** An image you attach in ChatGPT is not at a public URL, and Meta only takes media it can fetch ([content publishing](https://developers.facebook.com/documentation/instagram-platform/content-publishing)). Something has to host the file first.
- **Carousels and stories.** Both use the same container flow ([our guide](/guides/how-to-post-to-instagram-via-api/#post-a-carousel)). Add a tool for each when you need them.
- **Scheduling.** The server only acts when you ask in a chat, and only while your computer and `tunnel-client` are running. A post for later needs something that calls `media_publish` at that time.
- **Other networks.** Each one is another set of tools, another login and another app review.

## Where Rizamo fits

Rizamo is a social media API and MCP server built to take that layer off your hands: one call to publish to each network, with Rizamo hosting the server, handling the sign-in, creating and publishing the containers and refreshing the tokens. In ChatGPT it is listed in the plugins, with OAuth sign-in ([ChatGPT on Rizamo](/agents/chatgpt/)). Rizamo is open: [start free](https://app.rizamo.com/sign-up). Free for 2 social accounts, with unlimited posts, profiles, seats and agents, and the API and MCP included. No card.
