Instagram MCP Server
Allows controlling an Instagram Business or Creator account โ post photos, reels, carousels, read DMs, manage comments, and get account insights via the Instagram Graph API.
๐ธ Instagram MCP Server
Control your Instagram from Claude โ post, analyze, reply to DMs, manage comments. All by chatting.
๐ฌ Demo GIF coming soon โ Claude posting a reel, reading insights, replying to comments live on screen.
What You Can Do
Ask Claude in plain English. It handles the API.
"Show my last 10 posts and which got the most reach"
"Post this image with caption: Monday motivation ๐ช #AI #Health"
"Read my DMs from today and draft replies for the questions"
"Hide all spam comments on my latest reel"
"What are my account insights for this week?"
"Which of my reels got the best watch time?"Related MCP server: Instagram MCP Server
Use Cases
๐ Content Creator
Morning briefing: "Show yesterday's post performance โ reach, saves, shares"
Strategy: "Compare my last 5 reels by reach and tell me what worked"
Scheduling prep: "Draft 3 caption options for this fitness post"
๐ฅ Doctor / Professional
Engagement: "Reply to all comments on my last post professionally"
Growth tracking: "How many followers did I gain this week?"
Content audit: "List all posts from this month with their engagement rates"
๐๏ธ Small Business
Customer service: "Show DMs from the last 24 hours and reply to order questions"
Publishing: "Post this product photo with this caption and these hashtags"
Analytics: "Which post type (reel/carousel/photo) gets me the most reach?"
Tools (14 total)
Category | Tool | What it does |
Account |
| Followers, bio, post count |
| Update bio text and/or website URL | |
| Last N posts with engagement stats | |
| Reach, profile views, follower growth | |
Insights |
| Per-post reach, saves, views, interactions |
Publishing |
| Post a photo with caption + hashtags |
| Post a Reel (video) | |
| Post 2โ10 images as carousel | |
Comments |
| Read all comments on a post |
| Reply to a comment | |
| Hide spam/unwanted comments | |
| Permanently delete a comment | |
Engagement |
| Like a post or reel |
| Unlike a post or reel | |
| Like a comment | |
Content |
| Permanently delete a post |
Hashtags |
| Search public posts by hashtag |
Events |
| List upcoming events |
| Create a new event (health camps, workshops) | |
Ads |
| List linked ad accounts |
| Get ad spend, reach, CTR | |
DMs |
| List active DM threads |
| Read messages in a thread | |
| Reply to a DM (24h window) | |
| Reply within 7-day Human Agent window |
Quick Start
Option A โ Claude Web + Mobile (Recommended)
1. Deploy your server (free, 2 min):
Fill in META_ACCESS_TOKEN and IG_USER_ID when prompted. (How to get these โ)
2. Connect to Claude web:
claude.ai โ Settings โ Integrations โ Add Integration
Paste:
https://your-app-name.onrender.com/mcp
3. Done. Open a new chat and try: "Show my recent Instagram posts"
Option B โ Claude Desktop (Local)
git clone https://github.com/drashrafsaiyed-cyber/instagram-mcp
cd instagram-mcp
uv sync
cp .env.example .env
# Fill .env with your token and user ID
uv run server.pyAdd to claude_desktop_config.json:
{
"mcpServers": {
"instagram": {
"command": "uv",
"args": ["--directory", "/path/to/instagram-mcp", "run", "server.py"],
"env": {
"META_ACCESS_TOKEN": "your_token",
"IG_USER_ID": "your_ig_user_id",
"ACCOUNT_NAME": "My Instagram"
}
}
}
}Option C โ Multiple Instagram Accounts (Claude Desktop)
Run the same server folder multiple times with different env vars. Claude sees each as a separate named MCP and never confuses them.
{
"mcpServers": {
"instagram-personal": {
"command": "uv",
"args": ["--directory", "/path/to/instagram-mcp", "run", "server.py"],
"env": {
"META_ACCESS_TOKEN": "TOKEN_FOR_ACCOUNT_1",
"IG_USER_ID": "IG_USER_ID_1",
"ACCOUNT_NAME": "Personal"
}
},
"instagram-business": {
"command": "uv",
"args": ["--directory", "/path/to/instagram-mcp", "run", "server.py"],
"env": {
"META_ACCESS_TOKEN": "TOKEN_FOR_ACCOUNT_2",
"IG_USER_ID": "IG_USER_ID_2",
"ACCOUNT_NAME": "My Business"
}
}
}
}Claude will show separate tools per account โ "Post this to My Business" picks the right one automatically.
Each account must be a Business or Creator Instagram account, and must be added as a tester in your Meta app โ Use cases โ Step 2: Generate access tokens โ Add account.
Getting Your Token
This server uses the Instagram Login API (graph.instagram.com) โ the modern Meta approach for Instagram Business/Creator accounts.
Step 1 โ Create or open your Meta app
Go to developers.facebook.com โ My Apps
Create a new app or open an existing one
Add use case: "Manage messaging & content on Instagram"
Step 2 โ Generate your access token
Use cases โ Customize โ API Setup with Instagram Login
Step 2: Generate access tokens โ click Generate next to your account
Copy the token โ this is your
META_ACCESS_TOKENYour numeric IG User ID is shown below your username on the same page
Step 3 โ Refresh before expiry (60 days)
curl "https://graph.instagram.com/refresh_access_token?grant_type=ig_refresh_token&access_token=YOUR_TOKEN"Or just run this in your project folder:
uv run python -c "
import httpx, re
from pathlib import Path
env = Path('.env').read_text()
token = re.search(r'META_ACCESS_TOKEN=(.+)', env).group(1).strip()
r = httpx.get('https://graph.instagram.com/refresh_access_token', params={'grant_type':'ig_refresh_token','access_token':token})
new = r.json()['access_token']
Path('.env').write_text(env.replace(token, new))
print('Refreshed. Expires in:', r.json()['expires_in']//86400, 'days')
"Requirements
Instagram Business or Creator account
Meta Developer app with "Manage messaging & content on Instagram" use case
Python 3.11+
Publishing note: Images and videos must be at a public HTTPS URL โ Instagram fetches from your URL. Use Cloudinary (free), S3, or a public GitHub raw URL. Local file paths won't work.
Architecture
Claude (Web/Desktop)
โ MCP protocol
โผ
instagram-mcp server (FastMCP 3.x, streamable-http or stdio)
โ HTTPS REST
โผ
graph.instagram.com (Instagram Login API v21.0)
โ
โผ
Your Instagram accountWhy graph.instagram.com and not graph.facebook.com?
This server uses the newer Instagram Login API which issues IGAA... tokens and routes through graph.instagram.com. The older Facebook Graph API approach required a linked Facebook Page and EAA... tokens. The new flow is simpler โ just your Instagram account, no Facebook Page needed.
Troubleshooting
Error | Fix |
| Token expired or wrong type. Regenerate via the steps above. |
| Invalid metric name. Metrics differ between account vs media endpoints. |
| Token expired. Run the refresh command. |
Container processing failed | Video too long (>90s), wrong codec, or URL returns 404 after first fetch. |
Empty DM list | No active 24h messaging window. Someone needs to DM you first. |
Claude doesn't see tools | Restart Claude Desktop fully (tray icon โ Quit). Check logs at |
Contributing
PRs welcome. If you add a new tool or fix a metric name mismatch, please:
Test against a real Instagram account
Update the tool table in this README
Note which API permission the new tool requires
License
MIT โ free to use, fork, and deploy commercially.
Built with FastMCP ยท Powered by Instagram Graph API
Available Tools
25 toolscreate_eventA
Create an upcoming event on your Instagram profile.
THIS IS A WRITE OPERATION. Requires instagram_manage_upcoming_events permission. Great for hospital health camps, free checkup days, AI workshops, webinars.
Inputs: title (required), start_time (required), end_time (required), description, +1 more. Returns: object
delete_commentA
Permanently delete a comment.
THIS IS A WRITE/DESTRUCTIVE OPERATION. Cannot be undone. Prefer hide_comment unless the comment is clearly spam, abuse, or violating your community standards.
Inputs: comment_id (required). Returns: object
delete_postA
Permanently delete a post, reel, or carousel from your account.
THIS IS A WRITE/DESTRUCTIVE OPERATION. Cannot be undone. Double-check the media_id with list_recent_media before deleting. Requires instagram_manage_contents permission.
Inputs: media_id (required). Returns: object
get_account_infoA
Fetch basic info about the connected Instagram Business account.
Use this first to verify the token and IG user ID are valid. Returns username, follower count, media count, and account type.
Inputs: no named parameters. Returns: object
get_account_insightsA
Get account-level insights (reach, impressions, profile views, follower growth).
Use 'day' for last 24h, 'week' for 7 days, 'days_28' for monthly trends. Useful for content strategy decisions.
Inputs: period. Returns: object
get_ad_accountsA
List all ad accounts linked to your Meta account.
Returns account IDs and names. Use the account ID with create_ad. Requires ads_management permission.
Inputs: no named parameters. Returns: result
get_ad_insightsB
Get performance insights for your Instagram/Facebook ads.
Returns spend, impressions, reach, clicks, CPM, CTR. Requires ads_read permission.
Inputs: ad_account_id (required), date_preset. Returns: result
get_commentsA
List comments on a post.
Returns id, text, username, timestamp, like_count, and replies (if any). Use the comment IDs with reply_to_comment, hide_comment, or delete_comment.
Inputs: media_id (required), limit. Returns: result
get_media_insightsA
Get performance metrics for a single post/reel.
Returns reach, impressions, saved, video_views (if video), and engagement. Different media types return different metrics โ reels have plays, photos don't.
Inputs: media_id (required). Returns: object
get_messagesA
Read messages from a DM conversation.
Returns message id, text content, sender, and timestamp. Use the sender's IGSID with send_dm to reply.
Inputs: conversation_id (required), limit. Returns: result
hide_commentA
Hide or unhide a comment. Hidden comments are invisible to others but not deleted.
THIS IS A WRITE OPERATION. Useful for spam/troll comments you'd rather not fully delete.
Inputs: comment_id (required), hide. Returns: object
like_commentA
Like a comment on a post.
THIS IS A WRITE OPERATION. Requires instagram_manage_engagement permission.
Inputs: comment_id (required). Returns: object
like_mediaA
Like a post or reel on your account.
THIS IS A WRITE OPERATION. Requires instagram_manage_engagement permission.
Inputs: media_id (required). Returns: object
list_conversationsA
List recent DM conversations on the Instagram account.
Returns conversation IDs and participants. Use conversation IDs with get_messages. Only conversations from the last ~24h messaging window will be actionable for sending.
Inputs: limit. Returns: result
list_eventsA
List upcoming events on your Instagram account.
Requires instagram_manage_upcoming_events permission. Useful for hospital open days, health camps, webinars, AI workshops.
Inputs: no named parameters. Returns: result
list_recent_mediaA
List recent posts/reels from the account.
Returns id, caption, media_type, permalink, timestamp, like_count, comments_count. Use the returned IDs with get_media_insights or get_comments.
Inputs: limit. Returns: result
publish_carouselA
Publish a carousel (multi-image) post. Accepts 2-10 images.
THIS IS A WRITE OPERATION. Each image must be publicly accessible. Creates a child container per image, then a carousel container, then publishes. Slow โ expect 30-60s.
Inputs: image_urls (required), caption. Returns: object
publish_photoA
Publish a single photo to the Instagram feed.
THIS IS A WRITE OPERATION. The image URL must be publicly accessible โ Instagram fetches it from your URL. Local file paths won't work; upload to S3/Cloudinary/imgur first. Returns the published post ID and permalink.
Inputs: image_url (required), caption. Returns: object
publish_reelA
Publish a Reel to Instagram.
THIS IS A WRITE OPERATION. Video URL must be publicly accessible. Reel processing takes 30-60s on Instagram's side โ this tool waits. Returns post ID and permalink.
Inputs: video_url (required), caption, share_to_feed. Returns: object
reply_to_commentA
Reply to a comment on a post.
THIS IS A WRITE OPERATION. The reply will be threaded under the original comment and publicly visible. Returns the reply's comment ID.
Inputs: comment_id (required), message (required). Returns: object
search_hashtagA
Search public Instagram posts by hashtag.
Returns post IDs, captions, media type, and permalink. Useful for content research, competitor analysis, and finding trending topics in your niche. Requires Instagram Public Content Access permission.
Note: Instagram limits hashtag searches to 30 unique hashtags per 7 days per account.
Inputs: hashtag (required), media_type, limit. Returns: result
send_dmA
Send a DM reply to a user.
THIS IS A WRITE OPERATION. IMPORTANT: Instagram enforces a 24-hour messaging window โ you can only DM users who have messaged you within the last 24 hours, unless using a message tag (not supported in this tool). Cold DMs will fail and may trigger rate limits.
Inputs: recipient_igsid (required), message (required). Returns: object
send_human_agent_dmA
Send a DM reply within the 7-day Human Agent window (not just 24h).
THIS IS A WRITE OPERATION. Unlike send_dm (24h window), Human Agent tag allows responding up to 7 days after the user's last message. Use for thoughtful replies to patient queries, appointment questions, or follow-ups. Requires Human Agent feature enabled in your Meta app.
Inputs: recipient_igsid (required), message (required). Returns: object
unlike_mediaA
Unlike a post or reel.
THIS IS A WRITE OPERATION. Requires instagram_manage_engagement permission.
Inputs: media_id (required). Returns: object
update_profileA
Update your Instagram Business profile bio and/or website URL.
THIS IS A WRITE OPERATION. At least one of biography or website must be provided. Changes are live immediately on your public profile.
Required permission: instagram_business_manage_profile (Add this in your Meta app โ Use cases โ Permissions and features if missing.)
Inputs: biography, website. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogโฆ
TDQS
Scored across 25 tools
Each tool has a clearly distinct purpose. Overlapping areas like hide vs delete comment and send DM vs human agent DM are well-differentiated by descriptions.
All tool names follow a consistent verb_noun pattern with underscores, making them predictable and machine-readable.
With 25 tools, the server sits at the upper end of the borderline range (16-25). While the coverage is broad, the count feels slightly heavy for a single server.
Notable gaps exist: a 'create_ad' tool is referenced in descriptions but missing, and lifecycle operations for events (update/delete) are absent, which may cause agent failures.
Maintenance
Related MCP Connectors
Run Instagram automation on your own real phones from Claude, Cursor or any AI agent.
Hosted Instagram MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Run social media from Claude: draft, schedule and approve posts, answer comments, read results.
Create, schedule and publish Instagram and Facebook posts from Claude or ChatGPT.
Related MCP Servers
- AlicenseNot gradedqualityNot gradedmaintenanceEnables sending and receiving Instagram Direct Messages, managing conversations, downloading media, viewing user profiles and stories, and interacting with posts through natural language in Claude.MIT
- AlicenseAqualityCmaintenanceConnects Claude Desktop and other MCP clients to the Instagram Graph API for reading analytics, managing comments, and publishing photos, carousels, and reels.11129 npm1MIT
- AlicenseBqualityBmaintenanceEnables Claude to read and send Instagram DMs, manage threads and message requests, send media, and run autonomous conversations via the /dm skill.273MIT
- AlicenseNot gradedqualityCmaintenanceConnects Claude to Instagram through Meta's official API, enabling users to retrieve account insights, analyze professional profiles, publish photos/carousels/reels/stories, manage comments, read and respond to Direct messages, and call any Graph API endpoint.40 npmMIT