---
name: instagram-graph-api-mcp
description: Use when you say "see what my next reel should be" or want Instagram insights in Claude Code; it installs the official Instagram Graph API MCP server so Claude can read your post reach, saves, shares, audience demographics, comments and mentions, and publish posts.
---
# Instagram insights and posting in Claude
## What it does
`instagram-mcp` is an MCP server for the **official Instagram Graph API**. It lets Claude read, publish, comment and pull analytics across one or many Instagram **Business/Creator** accounts. It uses the official Graph API only — no private or reverse-engineered API, no username/password.
It exposes 29 tools:
- **Accounts and health**: `healthcheck`, `list_accounts`, `add_account`, `set_default_account`, `remove_account`, `account_info`
- **Profile and media**: `get_profile`, `list_media`, `get_media`
- **Insights**: `get_account_insights` (reach, impressions, profile views, follower count), `get_media_insights` (per-post reach, saves, shares, interactions), `get_audience_insights` (follower age, gender, country, city)
- **Publishing**: `publish_image`, `publish_video`, `publish_reel`, `publish_carousel` (2–10 images), `publish_story`, `publishing_limit` (remaining 24h quota)
- **Comments**: `get_comments`, `reply_to_comment`, `hide_comment`, `delete_comment`
- **Discovery**: `search_hashtag`, `get_hashtag_media`, `get_mentions`, `business_discovery` (read any public Professional account by username)
- **Direct messages**: `list_conversations`, `get_messages`, `send_message` — these need Meta App Review (see below)
Safety features in the server: outbound calls are pinned to Meta's hosts, access tokens are scrubbed out of every result and error, inputs are validated before each Graph call, and every call appends an audit line to `~/.claude/instagram-mcp/audit.log.jsonl`.
Publishing is a real, public action, and the comment tools can hide or delete comments. Use it only on your own accounts and data, and within Instagram's terms. Check `publishing_limit` before a batch, and ask Claude to show you the caption and media URL before it publishes.
## What you need
- An Instagram **Professional** account (Business or Creator). Personal accounts cannot use the Graph API. Converting is free and reversible (Instagram app → Settings → Account type and tools).
- The Instagram account connected to a Facebook Page.
- A Meta app (developers.facebook.com → My Apps → Create App → Business type → add the Instagram product).
- A long-lived **access token** with `instagram_basic`, `instagram_content_publish`, `instagram_manage_comments`, `instagram_manage_insights`, and the account's numeric **Instagram Business Account id**.
- Python 3.10+.
- `get_audience_insights` needs the account to have at least 100 followers (Meta privacy floor).
- DM tools need the `instagram_manage_messages` permission, which Meta grants only through App Review; until then they fail with that instruction.
## Setup
Install from PyPI:
```bash
pip install adelaidasofia-instagram-mcp
```
Or from source:
```bash
git clone https://github.com/adelaidasofia/instagram-mcp
cd instagram-mcp
python3 -m venv .venv && .venv/bin/pip install -e .
```
Get your token by following SETUP.md (Graph API Explorer → Generate Access Token with the permissions above), then exchange the short-lived token for a long-lived one:
```bash
curl -s "https://graph.facebook.com/v21.0/oauth/access_token?grant_type=fb_exchange_token&client_id=APP_ID&client_secret=APP_SECRET&fb_exchange_token=SHORT_LIVED_TOKEN"
```
Find your Instagram Business Account id:
```bash
curl -s "https://graph.facebook.com/v21.0/me/accounts?access_token=LONG_LIVED_TOKEN"
curl -s "https://graph.facebook.com/v21.0/PAGE_ID?fields=instagram_business_account&access_token=LONG_LIVED_TOKEN"
```
Configure the server with env vars (single-account, zero-config path):
```bash
export INSTAGRAM_MCP_ACCESS_TOKEN="EAA...long-lived..."
export INSTAGRAM_MCP_IG_USER_ID="17841400000000000"
# optional: enables appsecret_proof call signing
export INSTAGRAM_MCP_APP_SECRET="your-app-secret"
```
Then register it with Claude Code in that same shell:
```bash
claude mcp add instagram -- instagram-mcp
```
`instagram-mcp` is the console script the package installs. From a source checkout it lives at `.venv/bin/instagram-mcp`, or run the module directly with `python -m instagram_mcp.server`.
For Claude Desktop, the source's config is:
```json
{
"mcpServers": {
"instagram": {
"command": "instagram-mcp",
"env": {
"INSTAGRAM_MCP_ACCESS_TOKEN": "EAA...your-long-lived-token...",
"INSTAGRAM_MCP_IG_USER_ID": "17841400000000000"
}
}
}
}
```
You can skip the env vars and call `add_account` from Claude instead; the token then goes to your system's secure credential store (or a `chmod 600` file on other platforms), never into the metadata file and never back out of any tool:
```
add_account(label="main", access_token="EAA...", ig_user_id="17841400000000000", make_default=True)
```
Then verify with `healthcheck` — it does a live profile read and reports your username on success.
Note: publishing takes public https media URLs. Instagram fetches the bytes itself, so the image or video must be reachable on the open web.
Token refresh, multi-account setup and the full App Review walkthrough for DMs are in the project's SETUP.md and docs/APP_REVIEW.md: https://github.com/adelaidasofia/instagram-mcp
## How to use it with Claude
- "Run healthcheck on my Instagram account and show my profile."
- "Pull insights for my last 20 posts — reach, saves, shares, interactions — and tell me which ones performed best."
- "Show my account insights: reach, impressions, profile views and follower count."
- "Get my audience demographics (age, gender, country, city) and suggest what to post next for that audience."
- "List my recent comments and mentions, and draft replies for me to approve."
- "Check my remaining publishing quota, then publish this reel from this public https URL with this caption."
## Credits
Made by adelaidasofia (instagram-mcp), packaged by Orbit. Source: https://github.com/adelaidasofia/instagram-mcp — license: MIT.