AI

aleemhaider/instagram-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

9 stars 6 forks 质量 76 趋势 21MIT

MCP server for the Instagram Graph API — 24 tools for posting, comments, DMs, and insights.

概览

A Model Context Protocol server that wraps the so Claude (or any MCP client) can read, publish, comment, DM, and pull insights from an Instagram or account. 24 tools across five capability areas — profile/media, publishing, comments, DMs, and insights — built on FastMCP + httpx. 1. Go to https://developers.facebook.com/apps → → use case → type . 2. In the app dashboard, add the product (Add Product → Instagram → Set up). You need an Instagram account switched to or , linked to a Facebook . In the app dashboard, walk through and link your account. Generate a token with these scopes (in Graph API Explorer or the Instagram API setup page): - instagram_basic - instagram_content_publish - instagram_manage_comments - instagram_manage_messages - instagram_manage_insights - pages_show_list - pages_read_engagement - business_management While your app is in , only accounts in your app's Roles list (admins/developers/testers) can authenticate. That's fine for personal use.

README

以下为原文 README 节选,完整内容请查看原文。

instagram-mcp

A Model Context Protocol server that wraps the Instagram Graph API so Claude (or any MCP client) can read, publish, comment, DM, and pull insights from an Instagram Business or Creator account.

24 tools across five capability areas — profile/media, publishing, comments, DMs, and insights — built on FastMCP + httpx.

Quick install

pip install instagram-mcp

Or with uv:

uv tool install instagram-mcp

Setup

1. Create a Meta App

  1. Go to https://developers.facebook.com/apps → Create app → use case Other → type Business.
  2. In the app dashboard, add the Instagram product (Add Product → Instagram → Set up).

You need an Instagram account switched to Business or Creator, linked to a Facebook Page. In the app dashboard, walk through Instagram → API setup with Facebook login → Step 1: Generate access tokens and link your account.

3. Get the required permissions

Generate a token with these scopes (in Graph API Explorer or the Instagram API setup page):

  • instagram_basic
  • instagram_content_publish
  • instagram_manage_comments
  • instagram_manage_messages
  • instagram_manage_insights
  • pages_show_list
  • pages_read_engagement
  • business_management

While your app is in Development mode, only accounts in your app’s Roles list (admins/developers/testers) can authenticate. That’s fine for personal use. For other users, you need App Review with Advanced Access.

4. Mint a long-lived Page token

The fastest way: run the bundled helper.

instagram-mcp-get-token

It will ask for your short-lived user token + app ID/secret, exchange it for a long-lived user token, list your linked IG accounts, and write .env for you.

Manual alternative:

# Exchange short-lived user token → long-lived (~60 days)
curl -G "https://graph.facebook.com/v21.0/oauth/access_token" \
  --data-urlencode "grant_type=fb_exchange_token" \
  --data-urlencode "client_id=YOUR_APP_ID" \
  --data-urlencode "client_secret=YOUR_APP_SECRET" \
  --data-urlencode "fb_exchange_token=SHORT_LIVED_TOKEN"

# Find your Pages and their IG accounts
curl -G "https://graph.facebook.com/v21.0/me/accounts" \
  --data-urlencode "fields=name,instagram_business_account,access_token" \
  --data-urlencode "access_token=LONG_LIVED_USER_TOKEN"

Use the Page’s access_token (never expires) and the instagram_business_account.id of the linked IG account.

5. Configure .env

IG_USER_ID=17841446575432302
在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "instagram": { "command": "instagram-mcp", "env": { "IG_USER_ID": "17841446575432302", "IG_ACCESS_TOKEN": "EAAxxxxxxxxxxxxxxxxxxx" } } } }