Skip to main content
Glama
instagram-mcp

instagram-mcp

instagram-mcp

An MCP server for the official Instagram Graph API. Read, publish, comment, and pull analytics across one or many Instagram Business/Creator accounts from Claude (or any MCP client) — ToS-safe, no private/reverse-engineered API.

29 tools across accounts, media, publishing, insights, comments, discovery, and (review-gated) direct messages.

Ships with an optional local publishing panel — a self-hosted web UI to drag in an image/video, write a caption, and publish (feed / carousel / reel / video / story), with collaborator invites and a scheduled-post queue.

npx-style stdio MCP · Python · FastMCP · MIT

Fork of adelaidasofia/instagram-mcp with the local panel added.

Why this one

Most "Instagram automation" tools either (a) wrap the unofficial private API (username + password) — which violates Instagram's Terms and risks a ban — or (b) only post, with no way to read insights, comments, or mentions back. This server is built entirely on the official Graph API, is multi-account from day one, and covers the full read + write surface. The only thing it cannot do without Meta's approval is DMs (see Direct messages).

Related MCP server: Social Broadcast MCP

Requirements

  • An Instagram Professional account (Business or Creator). Personal accounts cannot use the Graph API. Converting is free and reversible (Instagram app → Settings → Account type).

  • The Instagram account connected to a Facebook Page.

  • 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. See SETUP.md for the exact token + id steps.

  • Python 3.10+.

Install

From PyPI:

pip install adelaidasofia-instagram-mcp

Or from source:

git clone https://github.com/adelaidasofia/instagram-mcp
cd instagram-mcp
python3 -m venv .venv && .venv/bin/pip install -e .

Register it with your MCP client (Claude Desktop / Claude Code) — single-account zero-config path:

{
  "mcpServers": {
    "instagram": {
      "command": "instagram-mcp",
      "env": {
        "INSTAGRAM_MCP_ACCESS_TOKEN": "EAA...your-long-lived-token...",
        "INSTAGRAM_MCP_IG_USER_ID": "17841400000000000"
      }
    }
  }
}

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.

Or skip the env vars and call add_account at runtime (token goes to your OS keychain). See Multiple accounts.

Local panel

A self-hosted web UI for publishing without an MCP client. Runs entirely on your machine; a cloudflared quick tunnel (no Cloudflare account) briefly exposes only the upload folder so Instagram can fetch the media.

pip install -e . && pip install -r panel/requirements.txt
cp .mcp.json.example .mcp.json            # then fill in token + IG user id
python -m panel.run                       # opens http://127.0.0.1:8787

(cloudflared auto-downloads into panel/bin/ on first run.)

Drag in an image/video → caption → publish (feed image, carousel 2–10, reel, video, story). Collaborator invites, a scheduled-post queue, live quota, recent-post insights, comment management, and optional AI caption/reply drafts. Tabbed UI, dark theme.

Runs as a native window (python -m panel.desktop) or a single installed app — python installer/build.py → Instagram-Panel-Setup.exe (per-user, no admin; paste the token in the app's Ayarlar tab on first run). Full details in panel/README.md and installer/README.md.

Tools

Accounts & health — healthcheck, list_accounts, add_account, set_default_account, remove_account, account_info

Profile & 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 demographics: age, gender, country, city)

Publishing — publish_image, publish_video, publish_reel, publish_carousel (2–10 images), publish_story, publishing_limit (remaining 24h quota). Video/reel containers process asynchronously; the server polls to completion before publishing.

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 (see below)

Publishing takes public https media URLs — Instagram fetches the bytes itself, so the image/video must be reachable on the open web (an S3/Cloudflare/any-CDN URL works).

Multiple accounts

Run one server for all your accounts (yours, a brand's, a client's). Each account authorizes its own token:

add_account(label="brand-a", access_token="EAA...", ig_user_id="178414...", make_default=True)
add_account(label="brand-b", access_token="EAA...", ig_user_id="178414...")
list_media(account="brand-b")
get_account_insights(account="brand-a")

Tokens are stored in the macOS keychain (or a chmod 600 file on other platforms), never in the metadata file and never returned by any tool. Omit account on any tool to use the default.

Direct messages

The DM tools require the instagram_manage_messages permission, which Meta grants only through App Review (typically weeks, and stricter in 2025–2026). Until then, the DM tools fail loud with that instruction rather than silently no-op. Once your app is approved and the token carries the scope, set INSTAGRAM_MCP_DM_ENABLED=1. Note Instagram's 24-hour standard-messaging window applies.

Full App Review walkthrough (screencast shot list, reviewer test-instructions template, privacy-policy + business-verification requirements, post-approval flip, message-tag caveat): docs/APP_REVIEW.md.

Safety

  • Egress is pinned to the Meta host allow-list (graph.facebook.com / graph.instagram.com). A general SSRF guard (RFC1918 / loopback / link-local / CGNAT / cloud-metadata, fail-closed DNS) backs any URL handling.

  • Credentials never leak: every result and error passes a scrubber that strips access tokens (incl. Meta EAA… / IGQV…), bearer headers, app secrets, and API keys before it reaches the model.

  • Observability: every call appends a 4-field JSONL audit line (execution_time_ms, io, token_usage, error_class) under ~/.claude/instagram-mcp/audit.log.jsonl.

  • Input validation runs before every Graph call (ids, caption length, hashtag/username charset, https media URLs).

License

MIT — see LICENSE.

Built by Adelaida Diaz-Roa. Full install or team version at diazroa.com.

Available Tools

29 tools
account_infoB

Live profile snapshot for one account: username, name, followers, media count, etc.

Inputs: account. Returns: object

add_accountA

Store an Instagram Business/Creator account for use by every tool.

label a short key you choose (e.g. "onde", "mycelium", "client-acme") access_token a long-lived Instagram Graph API token (stored in the OS keychain) ig_user_id the Instagram Business Account id (numeric) app_secret optional Meta app secret — enables appsecret_proof call hardening make_default set true to make this the account used when account is omitted

The token is written to the macOS keychain (or a chmod-600 file fallback) and is NEVER echoed back or logged.

Inputs: label (required), ig_user_id (required), access_token (required), app_secret, +1 more. Returns: object

business_discoveryA

Public profile + (optionally) recent media for ANY business/creator account by username.

Read-only competitor/prospect research via the business_discovery edge. Only works for Professional accounts (not personal). with_media pulls up to media_limit recent posts.

Inputs: username (required), account, with_media, media_limit. Returns: object

delete_commentA

Permanently delete a comment you own (or a comment on your media). Irreversible.

Inputs: comment_id (required), account. Returns: object

get_account_insightsB

Account-level analytics (reach, impressions, profile views, follower count).

metrics: comma-separated Graph metric names (default reach,impressions,profile_views, follower_count). period: day|week|days_28|lifetime. Exact available metrics vary by Graph API version; on a mismatch the Meta error names the correct metric.

Inputs: period, account, metrics. Returns: object

get_audience_insightsA

Follower demographics (age, gender, country, city).

Requires the account to have >=100 followers (Meta privacy floor) — below that the Graph returns an error, surfaced cleanly. Newer Graph versions use metric= follower_demographics with metric_type=total_value + breakdown=age|gender|country|city and a timeframe (last_14_days|last_30_days|last_90_days|prev_month) for engaged-audience metrics. All are override-able.

Inputs: metric, period, account, breakdown, +2 more. Returns: object

get_commentsB

List comments on a media object (text, username, timestamp, like_count, hidden).

Inputs: media_id (required), limit, account. Returns: object

get_hashtag_mediaA

Recent or top media for a hashtag id. edge=top_media|recent_media. limit 1-100.

Get the hashtag_id from search_hashtag first. Subject to Meta's 30-unique-hashtags per-7-days query limit per account.

Inputs: hashtag_id (required), edge, limit, account. Returns: object

get_mediaB

Return full fields for one media object by id (caption, type, permalink, like/comment counts).

Inputs: media_id (required), account. Returns: object

get_media_insightsA

Per-post analytics (reach, saves, likes, comments, shares, total interactions).

metrics override is comma-separated; defaults suit feed posts. Reels/stories expose different metrics (e.g. plays, navigation) — pass them explicitly if needed.

Inputs: media_id (required), account, metrics. Returns: object

get_mentionsB

List recent media where the account is @-mentioned (tags edge).

Inputs: limit, account. Returns: object

get_messagesC

Read messages in a DM conversation. REQUIRES Meta App Review (instagram_manage_messages).

Inputs: conversation_id (required), limit, account. Returns: object

get_profileC

Return the account's public profile fields (followers, follows, media count, bio, website).

Inputs: account. Returns: object

healthcheckA

Verify the MCP is configured + ready: accounts present, token backend, Graph reachability.

Does a live GET on the default account's profile if one is configured. Safe to call anytime; never mutates. Returns ok=false with a hint when no account is set.

Inputs: no named parameters. Returns: object

hide_commentB

Hide (or unhide) a comment from public view. hide=false unhides.

Inputs: comment_id (required), hide, account. Returns: object

list_accountsA

List configured Instagram accounts (labels + ig_user_id + default flag). Never returns tokens.

Inputs: no named parameters. Returns: object

list_conversationsB

List Instagram DM conversations. REQUIRES Meta App Review (instagram_manage_messages).

Inputs: limit, account. Returns: object

list_mediaA

List recent media (posts/reels) for the account, newest first. limit 1-100 (default 25).

Inputs: limit, account. Returns: object

publish_imageA

Publish a single image to the feed.

image_url must be a PUBLIC https URL (Instagram fetches the bytes itself). caption <= 2200 chars. Two-step Graph flow (create container -> publish) handled internally.

Inputs: image_url (required), account, caption. Returns: object

publishing_limitB

Remaining posts in the rolling 24h publishing quota (Instagram caps API posts/day).

Inputs: account. Returns: object

publish_reelA

Publish a Reel. video_url must be a PUBLIC https URL.

share_to_feed also surfaces the reel in the main grid. cover_url (optional) sets the thumbnail. Reel containers process asynchronously (polled up to 90s).

Inputs: video_url (required), account, caption, cover_url, +1 more. Returns: object

publish_storyB

Publish a Story (image OR video). Exactly one of image_url / video_url, PUBLIC https.

Inputs: account, image_url, video_url. Returns: object

publish_videoB

Publish a video to the feed. video_url must be a PUBLIC https URL.

Video containers process asynchronously; this polls status up to 90s before publishing.

Inputs: video_url (required), account, caption. Returns: object

remove_accountB

Remove a configured account + delete its stored token from the keychain.

Inputs: label (required). Returns: object

reply_to_commentA

Reply to a comment. message <= 2200 chars. Returns the new comment id.

Inputs: message (required), comment_id (required), account. Returns: object

search_hashtagA

Resolve a hashtag name to its Graph id (needed before get_hashtag_media).

Inputs: hashtag (required), account. Returns: object

send_messageA

Send a DM. REQUIRES Meta App Review + the 24-hour standard-messaging window.

recipient_id is the IGSID (Instagram-scoped user id) of the recipient. Outside the 24h customer-service window a paid message tag is required (not handled here).

Inputs: text (required), recipient_id (required), account. Returns: object

set_default_accountA

Set which configured account is used when a tool's account arg is omitted.

Inputs: label (required). Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.3/5.0

    Scored across 29 tools

    Disambiguation4/5

    Most tools target a distinct resource+action pair, and the publishing, comment, hashtag, insights, and DM clusters are clearly separable. The main ambiguity is account_info vs get_profile, which both read account profile data, and healthcheck also fetches a profile as a side effect.

    Naming Consistency4/5

    The set largely follows a verb_noun snake_case pattern, with consistent clusters like publish_image/publish_video and add_account/remove_account/list_accounts. A few noun-style names—healthcheck, publishing_limit, account_info, business_discovery—break the pattern but are still readable and not chaotic.

    Tool Count2/5

    At 29 tools, this exceeds the 25+ threshold and feels heavy for a single MCP surface, even though each feature area is distinct. The set would be easier for an agent to navigate if split into themed servers or if near-duplicate profile readers were consolidated.

    Completeness4/5

    The surface covers account management, publishing in all major formats, comment moderation, hashtag search, insights, business discovery, and DMs. Minor gaps exist—no media update/delete lifecycle, and limited DM conversation handling—but core workflows are covered.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • F
      license
      A
      quality
      C
      maintenance
      Enables posting and managing Instagram content (photos, reels, stories, carousels) and interacting with media and comments via Instagram Graph API.
      10
      7 npm
      -
    • A
      license
      A
      quality
      C
      maintenance
      Enables publishing photos, reels, and stories to Instagram, reading and moderating comments, fetching performance insights, drafting captions via MCP sampling, and scheduling reels for later.
      13
      28 npm
      MIT
    • F
      license
      Not graded
      quality
      A
      maintenance
      Enables AI applications to interact with Instagram Business accounts via Instagram's Graph API, including profile/media insights, publishing, and direct messaging.
      -