AI-driven management of Instagram Business accounts via Graph API
Instagram MCP Server
A Model Context Protocol (MCP) server that provides seamless integration with Instagram's Graph API, enabling AI applications to interact with Instagram Business accounts programmatically.
Features
🔧 Tools (Model-controlled)
- Get Profile Info: Retrieve Instagram business profile details
- Get Media Posts: Fetch recent posts from an Instagram account
- Get Media Insights: Retrieve engagement metrics for specific posts
- Publish Media: Upload and publish images/videos to Instagram
- Get Account Pages: List Facebook pages connected to the account
- Get Conversations: List Instagram DM conversations (requires Advanced Access)
- Get Conversation Messages: Read messages from specific conversations (requires Advanced Access)
- Send DM: Reply to Instagram direct messages (requires Advanced Access)
📊 Resources (Application-controlled)
- Profile Data: Access to profile information including follower counts, bio, etc.
- Media Feed: Recent posts with engagement metrics
- Insights Data: Detailed analytics for posts and account performance
💬 Prompts (User-controlled)
- Analyze Engagement: Pre-built prompt for analyzing post performance
- Content Strategy: Template for generating content recommendations
- Hashtag Analysis: Prompt for hashtag performance evaluation
Prerequisites
- Instagram Business Account: Must be connected to a Facebook Page
- Facebook Developer Account: Required for API access
- Access Token: Long-lived access token with appropriate permissions
- Python 3.10+: For running the MCP server (required by MCP dependencies)
Required Instagram API Permissions
Standard Access (available immediately):
instagram_basicinstagram_content_publishinstagram_manage_insightsinstagram_manage_commentspages_show_listpages_read_engagementpages_manage_metadatapages_read_user_contentbusiness_management
Advanced Access (requires Meta App Review):
instagram_manage_messages- Required for Direct Messaging features
⚠️ Instagram DM Features: Reading and sending Instagram direct messages requires Advanced Access approval from Meta. See INSTAGRAM_DM_SETUP.md for the App Review process.
🔑 How to Get Instagram API Credentials
📖 Quick Start: See AUTHENTICATION_GUIDE.md for a 5-minute setup guide!
This section provides a step-by-step guide to obtain the necessary credentials for the Instagram MCP server.
Step 1: Set Up Instagram Business Account
Convert to Business Account (if not already):
- Open Instagram app → Settings → Account → Switch to Professional Account
- Choose "Business" → Select a category → Complete setup
Connect to Facebook Page:
- Go to Instagram Settings → Account → Linked Accounts → Facebook
- Connect to an existing Facebook Page or create a new one
- Important: The Facebook Page must be owned by you
Step 2: Create Facebook App
Go to Facebook Developers:
- Visit developers.facebook.com
- Log in with your Facebook account
Create New App:
- Click "Create App" → Choose "Business" → Click "Next"
- Fill in app details:
- App Name: Choose a descriptive name (e.g., "My Instagram MCP Server")
- App Contact Email: Your email address
- Click "Create App"
Add Instagram Basic Display Product:
- In your app dashboard, click "Add Product"
- Find "Instagram Basic Display" → Click "Set Up"
Configure Instagram Basic Display:
- Go to Instagram Basic Display → Basic Display
- Click "Create New App" in the Instagram App section
- Accept the terms and create the app
Step 3: Get App Credentials
- Get App ID and Secret:
- In your Facebook app dashboard, go to Settings → Basic
- Copy your App ID and App Secret
- Important: Keep the App Secret secure and never share it publicly
Step 4: Set Up Instagram Business API Access
Add Instagram Graph API Product:
- In your app dashboard, click "Add Product"
- Find "Instagram Graph API" → Click "Set Up"
Configure Permissions:
- Go to Instagram Graph API → Permissions
- Request the following permissions:
instagram_basicinstagram_content_publishinstagram_manage_insightspages_show_listpages_read_engagement
Step 5: Generate Access Token
Option A: Using Facebook Graph API Explorer (Recommended for Testing)
- Go to Graph API Explorer:
Tools (8)
get_profile_infoRetrieve Instagram business profile details including follower counts and bio.get_media_postsFetch recent posts from an Instagram account.get_media_insightsRetrieve engagement metrics for specific posts.publish_mediaUpload and publish images or videos to Instagram.get_account_pagesList Facebook pages connected to the account.get_conversationsList Instagram DM conversations (requires Advanced Access).get_conversation_messagesRead messages from specific conversations (requires Advanced Access).send_dmReply to Instagram direct messages (requires Advanced Access).Environment Variables
INSTAGRAM_ACCESS_TOKENrequiredLong-lived access token with appropriate permissionsINSTAGRAM_BUSINESS_ACCOUNT_IDrequiredThe ID of the Instagram Business accountConfiguration
{"mcpServers":{"instagram":{"command":"python","args":["-m","ig_mcp"],"env":{"INSTAGRAM_ACCESS_TOKEN":"your_token_here","INSTAGRAM_BUSINESS_ACCOUNT_ID":"your_id_here"}}}}