Instagram MCP Server
This Instagram MCP Server enables AI assistants to interact with Instagram and Facebook accounts through a REST API with remote HTTPS access.
Capabilities:
Messaging: Send text/media messages (images, videos, audio), react to messages with emoji reactions (love, like, haha, wow, sad, angry), and use human agent tags for extended messaging windows
Conversation Management: List conversations, retrieve messages from specific threads, and find conversations by user ID
Profile Management: Access your Instagram business profile and Facebook page information, and look up other user profiles
Content Viewing: Browse posts/reels with pagination, get detailed post information including carousel items, and view comments
Engagement: Reply to comments and respond to messages on both platforms
Content Creation: Post images/videos to Instagram (including Reels) and create Facebook posts with text, links, or photos, all with captions and optional metadata
Remote Deployment: Deploy to cloud platforms (Vercel, Railway, Render, etc.) with API key authentication for secure team access and monitoring via health check endpoints
Provides tools for sending Messenger messages, creating posts with text/links/photos, viewing page posts, managing comments, accessing inbox conversations, and retrieving page information through Facebook's Graph API.
Enables sending messages, viewing and creating posts and reels, managing comments and replies, accessing inbox conversations, and retrieving profile information through Instagram's Business API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Instagram MCP Server send a message to @john_doe saying 'Hey, check out this new post!'"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Instagram MCP Server
An HTTP MCP (Model Context Protocol) server for interacting with Instagram and Facebook APIs. Deploy this server to any cloud platform and access it remotely via HTTPS from any MCP client.
This server enables AI assistants to send messages, view posts, manage comments, and interact with your Instagram/Facebook accounts through a REST API.
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)
Architecture
This is an HTTP-based MCP server using Express.js:
Transport: HTTP/HTTPS (not stdio)
Deployment: Cloud platforms (Vercel, Railway, Render, DigitalOcean, etc.)
Access: Remote access from anywhere via HTTPS
Authentication: API key-based (MCP_API_KEY)
Protocol: RESTful HTTP endpoints following MCP specification
Why HTTP?
✅ Remote Access - Access from any machine, not just locally ✅ Team Sharing - Multiple team members can use the same server ✅ Scalable - Deploy to cloud platforms with auto-scaling ✅ Secure - HTTPS encryption + API key authentication ✅ Simple - Just like any REST API you're used to
Endpoints
POST /mcp- MCP protocol endpoint (handles all tool calls)GET /health- Health check endpoint
Installation
cd instagram-mcp-server
npm install
npm run buildConfiguration
Create a .env file based on .env.example:
cp .env.example .envRequired environment variables:
Variable | Description |
| Your Facebook Page ID |
| Page Access Token with required permissions |
| (Optional) Instagram Business Account ID |
| (Optional) Graph API version (default: v24.0) |
Getting Your Access Token
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
Running the Server
This is an HTTP MCP server that can be deployed anywhere and accessed remotely.
Local Development
# Development mode with auto-reload
npm run dev
# Production mode
npm run build
npm startThe server will start on http://localhost:3000 (or custom PORT from .env)
Endpoints:
POST /mcp- MCP protocol endpointGET /health- Health check endpoint
Test the Server
# Health check
curl http://localhost:3000/health
# List available tools
curl -X POST http://localhost:3000/mcp \
-H "Authorization: Bearer my-secret-api-key-12345" \
-H "Content-Type: application/json" \
-d '{"method": "tools/list"}'Connecting MCP Clients
Claude Code
Add the server to Claude Code using the CLI:
# For production (deployed server)
claude mcp add-json --scope user instagram '{
"type": "http",
"url": "https://your-domain.com/mcp",
"headers": {
"Authorization": "Bearer your-mcp-api-key"
}
}'
# For local testing
claude mcp add-json --scope user instagram '{
"type": "http",
"url": "http://localhost:3000/mcp",
"headers": {
"Authorization": "Bearer my-secret-api-key-12345"
}
}'Other MCP Clients
Any MCP-compatible client can connect via HTTP:
const response = await fetch('https://your-domain.com/mcp', {
method: 'POST',
headers: {
'Authorization': 'Bearer your-mcp-api-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
method: 'tools/call',
params: {
name: 'send_message',
arguments: {
platform: 'instagram',
recipientId: '123456',
text: 'Hello!'
}
}
})
});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 (auto-reload)
npm run dev
# Build for production
npm run build
# Run production build
npm startNote: A stdio version is also available for local-only use. Run with
npm run dev:stdioornpm run start:stdio
Deployment
Deploy to Vercel
Install Vercel CLI:
npm i -g vercelCreate
vercel.json:
{
"version": 2,
"builds": [{
"src": "dist/index.js",
"use": "@vercel/node"
}],
"routes": [{
"src": "/(.*)",
"dest": "/dist/index.js"
}],
"env": {
"FB_PAGE_ID": "@fb_page_id",
"IG_ACCOUNT_ID": "@ig_account_id",
"FB_PAGE_ACCESS_TOKEN": "@fb_page_access_token",
"FB_API_VERSION": "v24.0",
"MCP_API_KEY": "@mcp_api_key"
}
}Deploy:
npm run build
vercel --prodSet environment variables in Vercel dashboard
Deploy to Railway
Create
railway.toml:
[build]
builder = "NIXPACKS"
buildCommand = "npm install && npm run build"
[deploy]
startCommand = "npm start"
restartPolicyType = "ON_FAILURE"
restartPolicyMaxRetries = 10Deploy:
# Install Railway CLI
npm i -g @railway/cli
# Login and deploy
railway login
railway init
railway upSet environment variables in Railway dashboard
Deploy to Render
Create account at https://render.com
Create new Web Service
Configure:
Build Command:
npm install && npm run buildStart Command:
npm startAdd environment variables
Deploy to DigitalOcean/VPS
# SSH into your server
ssh user@your-server
# Clone repo
git clone https://github.com/yourusername/instagram-mcp-server.git
cd instagram-mcp-server
# Install dependencies and build
npm install
npm run build
# Create .env file with your credentials
nano .env
# Run with PM2 for process management
npm install -g pm2
pm2 start npm --name "instagram-mcp" -- start
pm2 save
pm2 startupEnvironment Variables for Production
Required:
FB_PAGE_ID- Your Facebook Page IDFB_PAGE_ACCESS_TOKEN- Page Access TokenIG_ACCOUNT_ID- Instagram Business Account IDFB_API_VERSION- Graph API version (default: v24.0)MCP_API_KEY- Secret key for MCP endpoint authenticationPORT- Server port (default: 3000)
Security Notes
⚠️ IMPORTANT: When deploying publicly:
Always set
MCP_API_KEY- Never deploy without authenticationUse HTTPS only - Encrypt all traffic
Rotate tokens regularly - Update access tokens periodically
Use environment variables - Never commit secrets to git
Rate limiting - Consider adding rate limiting for production
License
MIT
Available Tools
14 toolsget_conversation_by_userC
Get conversation ID for a specific user
Inputs: platform (required), userId (required).
get_conversation_messagesC
Get messages from a specific conversation
Inputs: conversationId (required), limit.
get_conversationsC
Get list of conversations/inbox for Instagram or Facebook. Returns conversation IDs and participant info.
Inputs: platform (required), folder.
get_instagram_post_detailsB
Get detailed information about a specific Instagram post including carousel children
Inputs: postId (required).
get_my_facebook_pageB
Get your Facebook page information
Inputs: no named parameters.
get_my_instagram_profileB
Get your own Instagram business account profile
Inputs: no named parameters.
get_post_commentsC
Get comments on a post
Inputs: platform (required), postId (required), limit.
get_postsC
Get posts from your Instagram account or Facebook page
Inputs: platform (required), limit.
get_user_profileC
Get profile information for a user on Instagram or Facebook
Inputs: platform (required), userId (required).
post_to_facebookC
Create a new post on your Facebook page
Inputs: message, link, photoUrl.
post_to_instagramC
Create a new post on Instagram (image or video/reel)
Inputs: caption, imageUrl, videoUrl, locationId.
reply_to_commentC
Reply to a comment on a post
Inputs: platform (required), commentId (required), message (required).
send_messageC
Send a message to a user on Instagram or Facebook Messenger. Can send text or media (image, video, audio).
Inputs: platform (required), recipientId (required), text, mediaUrl, +2 more.
send_reactionC
Send a reaction to a message on Instagram
Inputs: recipientId (required), messageId (required), reaction (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 14 tools
Most tools have distinct purposes targeting specific resources like conversations, posts, profiles, or actions like posting and messaging. However, get_conversations and get_conversation_by_user could cause confusion as both relate to conversations, though their descriptions clarify one lists conversations and the other gets a specific conversation ID.
Tools follow a consistent verb_noun pattern (e.g., get_conversations, post_to_instagram) with clear actions like get, post, reply, and send. Minor deviations exist, such as get_conversation_by_user using 'by_user' instead of a more uniform structure like get_conversation_for_user, but overall naming is predictable and readable.
With 14 tools, the count is well-scoped for managing Instagram and Facebook interactions, covering key areas like messaging, posting, and profile management. Each tool appears to serve a specific function without redundancy, making the set comprehensive yet manageable.
The toolset provides strong coverage for core social media operations, including CRUD-like actions for posts, messages, and profiles. Minor gaps exist, such as no tools for deleting posts or managing comments beyond replying, but agents can likely work around these with the available tools for basic workflows.
Related MCP Connectors
Instagram and Facebook Pages for AI agents: publish, comments, DM by keyword, inbox, insights.
Instagram for AI agents: publish, read comments and DMs, insights, and engage from your account.
Social media API for AI agents: publish, DMs, comments, Meta ads and leads.
Publish and schedule Instagram posts, Reels and carousels from your AI assistant.