Instagram MCP Server
Instagram MCP Server
A production-ready Model Context Protocol (MCP) server for interacting with Instagram/Meta APIs. Enables AI agents to manage content, analyze performance, research competitors, and handle publishing workflows through structured MCP tools.
Features
Account Management: Profile retrieval, account insights, media listing
Content Analytics: Post, Reel, and Story insights with engagement metrics
Content Generation: Reel ideas, captions, hashtags, content calendars
Competitor Research: Profile analysis, content comparison, competitor reports
Comment Management: Classification, moderation, auto-reply workflows
Publishing Workflow: Container creation, media publishing, status tracking
Lead Scoring: Business lead analysis with scoring tiers
Audit Logging: Full request/response logging with execution metrics
Related MCP server: Instagram Control MCP Server
Prerequisites
Python 3.10+
Meta Developer App with Instagram Graph API access
Instagram Business Account connected to your Meta App
Quick Start
1. Clone and Install
git clone <repository-url>
cd instagram-mcp
pip install -r requirements.txt2. Configure Environment
cp .env.example .envEdit .env with your credentials:
META_APP_ID=your_meta_app_id
META_APP_SECRET=your_meta_app_secret
INSTAGRAM_ACCESS_TOKEN=your_instagram_access_token
INSTAGRAM_BUSINESS_ACCOUNT_ID=your_instagram_business_account_id3. Run the Server
python server.pyDocker
docker-compose up --buildMCP Client Configuration
Add to your MCP client configuration (e.g., Claude Desktop, Cursor):
{
"mcpServers": {
"instagram": {
"command": "python",
"args": ["server.py"],
"cwd": "/path/to/instagram-mcp"
}
}
}Available Tools
Account Tools
Tool | Description |
| Get profile information |
| Get account-level analytics |
| List media posts |
| Get detailed post info |
Analytics Tools
Tool | Description |
| Post performance metrics |
| Reel performance metrics |
| Story performance metrics |
| Top-performing content |
| Period-over-period comparison |
Content Tools
Tool | Description |
| Analyze post structure |
| Generate Reel concepts |
| Generate captions with hashtags |
| Generate relevant hashtags |
| Create multi-day calendars |
| Identify content patterns |
Competitor Tools
Tool | Description |
| Analyze competitor profile |
| Compare multiple accounts |
| Find top competitor content |
| Full competitor report |
Comment Tools
Tool | Description |
| Get and classify comments |
| Reply to a comment |
| Moderate with classification |
Publishing Tools
Tool | Description |
| Create publish container |
| Publish to Instagram |
| Check publish status |
Lead Tools
Tool | Description |
| Score and analyze leads |
Example Natural Language Commands
"What were my best performing Reels last month?"
→ instagram_get_reel_insights (multiple calls) → sort → analyze → top results
"Generate a 30-day content calendar for an AI automation agency"
→ instagram_generate_content_calendar
"Analyze my competitor @examplebrand"
→ instagram_analyze_competitor → instagram_find_competitor_content
"What comments need moderation on my latest post?"
→ instagram_get_comments → classify → filter
"Compare my engagement with @competitor1 and @competitor2"
→ instagram_compare_accountsAI Decision Layer
The server implements an internal decision pipeline:
User Request - Natural language input
Intent Detection - Determine required operation
Permission Check - Validate API access
Tool Selection - Map to appropriate MCP tool
Instagram API - Execute authorized API call
Data Validation - Validate response data
Analytics/Reasoning - Process and analyze results
Structured Response - Return formatted JSON
Comment Classification
Comments are automatically classified into:
Category | Description |
| Praise, compliments, positive feedback |
| Complaints, criticism, negative sentiment |
| Questions, inquiries |
| Purchase intent, business inquiries |
| Promotional spam, scam content |
| Support requests, issue reports |
| Unclassified comments |
Lead Scoring
Score Range | Tier |
81-100 | Very High |
61-80 | High |
31-60 | Medium |
0-30 | Low |
Scoring factors: follower count, posting frequency, business category, identified needs, website presence.
Error Handling
All tools return structured error responses:
{
"success": false,
"error": {
"code": "RATE_LIMIT",
"message": "Instagram API rate limit reached.",
"retryable": true
}
}Error codes: UNAUTHORIZED, FORBIDDEN, NOT_FOUND, RATE_LIMIT, SERVER_ERROR, NETWORK_ERROR, INVALID_MEDIA, PERMISSION_MISSING
Project Structure
instagram-mcp/
├── server.py # Main MCP server with tool definitions
├── config.py # Configuration management
├── requirements.txt # Python dependencies
├── .env.example # Environment template
├── Dockerfile # Container configuration
├── docker-compose.yml # Docker Compose setup
├── mcp/
│ ├── tools/ # MCP tool implementations
│ │ ├── account.py # Account tools
│ │ ├── analytics.py # Analytics tools
│ │ ├── content.py # Content generation tools
│ │ ├── comments.py # Comment management tools
│ │ ├── publishing.py # Publishing workflow tools
│ │ └── competitors.py # Competitor research tools
│ └── schemas/ # Pydantic data models
│ ├── account.py
│ ├── content.py
│ └── analytics.py
├── services/ # Business logic layer
│ ├── instagram_api.py # Instagram Graph API client
│ ├── analytics.py # Analytics calculations
│ ├── content_ai.py # Content generation engine
│ └── lead_scoring.py # Lead analysis and scoring
├── database/ # Data persistence
│ ├── models.py # SQLAlchemy models
│ └── repository.py # Database operations
└── tests/ # Unit tests
├── test_account.py
├── test_analytics.py
├── test_publishing.py
└── test_errors.pyRunning Tests
pytest tests/ -vSecurity
OAuth 2.0 authentication via Meta Graph API
Access tokens stored in environment variables
No credential scraping or session extraction
Permission validation before operations
Rate-limit handling with retry logic
Audit logging for all tool executions
Never exposes tokens or secrets in responses
License
MIT
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityFmaintenanceAn MCP server that integrates with Instagram's Graph API to enable AI-driven management of Instagram Business accounts. It provides tools for fetching profile data, publishing media, analyzing engagement metrics, and managing direct messages.173MIT
- AlicenseBqualityAmaintenanceA professional, full-fidelity MCP server enabling AI agents to fully control and manage an Instagram account exactly like a human user.684MIT
- AlicenseNot gradedqualityCmaintenanceSocial media API and MCP server for AI agents that enables publishing to X, Instagram, LinkedIn, Reddit, Bluesky, and Threads from a single endpoint.1MIT
- AlicenseBqualityCmaintenanceMCP server that connects AI agents to Instagram for reading statistics, insights, and comments via the official Meta Graph API.16MIT
Related MCP Connectors
Connect any AI agent to 11+ social platforms: schedule, publish & track posts via hosted MCP.
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
Remote MCP server for The Colony — a social network for AI agents (posts, DMs, search, marketplace).
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/abdulsammad-lgtm/instamgram_mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server