instagram-mcp-server
服务介绍
Instagram MCP Server
An MCP (Model Context Protocol) server for interacting with Instagram and Facebook APIs. This server enables AI assistants to send messages, view posts, manage comments, and interact with your Instagram/Facebook accounts.
Features
Messaging
- Send text messages on Instagram and Facebook Messenger
- Send media (images, videos, audio)
- React to messages
- Human agent tag support for extended messaging windows
Inbox / Conversations
- List all conversations
- Get messages from specific conversations
- Find conversations by user ID
Profile
- Get your Instagram business profile
- Get your Facebook page info
- Look up user profiles
Posts
- View your Instagram posts and reels
- View your Facebook page posts
- Get detailed post information including carousel items
Comments
- View comments on posts
- Reply to comments
Content Creation
- Post images to Instagram
- Post videos/reels to Instagram
- Post to Facebook (text, links, photos)
Installation
cd instagram-mcp-server
npm install
npm run build
Configuration
Create a .env file based on .env.example:
cp .env.example .env
Required environment variables:
| Variable | Description |
|---|---|
FB_PAGE_ID |
Your Facebook Page ID |
FB_PAGE_ACCESS_TOKEN |
Page Access Token with required permissions |
IG_ACCOUNT_ID |
(Optional) Instagram Business Account ID |
FB_API_VERSION |
(Optional) Graph API version (default: v24.0) |
Getting Your Access Token
- Go to Facebook Developer Portal
- Create or select your app
- Generate a Page Access Token with these permissions:
pages_messagingpages_manage_metadatapages_read_engagementinstagram_basicinstagram_manage_messagesinstagram_manage_commentsinstagram_content_publish
Usage with Claude Code
Add to your Claude Code MCP settings (~/.claude/claude_desktop_config.json):
{
"mcpServers": {
"instagram": {
"command": "node",
"args": ["/path/to/instagram-mcp-server/dist/index.js"],
"env": {
"FB_PAGE_ID": "your_page_id",
"FB_PAGE_ACCESS_TOKEN": "your_access_token",
"IG_ACCOUNT_ID": "your_ig_account_id"
}
}
}
}
Or if using environment file:
{
"mcpServers": {
"instagram": {
"command": "node",
"args": ["/path/to/instagram-mcp-server/dist/index.js"],
"cwd": "/path/to/instagram-mcp-server"
}
}
}
Available Tools
Messaging
send_message- Send text/media message to Instagram or Facebooksend_reaction- React to a message
Conversations
get_conversations- List inbox conversationsget_conversation_by_user- Find conversation by user IDget_conversation_messages- Get messages from a conversation
Profiles
get_user_profile- Get a user's profileget_my_instagram_profile- Get your IG profileget_my_facebook_page- Get your FB page info
Posts
get_posts- List your postsget_instagram_post_details- Get detailed post info
Comments
get_post_comments- Get comments on a postreply_to_comment- Reply to a comment
Content Creation
post_to_instagram- Create Instagram post/reelpost_to_facebook- Create Facebook post
Available Resources
The server also exposes these resources for easy access:
instagram://profile- Your Instagram profilefacebook://page- Your Facebook pageinstagram://inbox- Instagram DM inboxfacebook://inbox- Facebook Messenger inboxinstagram://posts- Recent Instagram postsfacebook://posts- Recent Facebook posts
Development
# Run in development mode
npm run dev
# Build
npm run build
# Run built version
npm start
License
MIT