Instagram MCP Server
Instagram MCP Server
一个可用于生产的 Model Context Protocol(MCP)服务器,用于与 Instagram/Meta API 交互。使 AI 代理能够通过结构化的 MCP 工具管理内容、分析表现、研究竞争对手,并处理发布工作流。
功能特性
账户管理:个人资料获取、账户洞察、媒体列表
内容分析:帖子、Reel 和 Story 的洞察及互动指标
内容生成:Reel 创意、文案、话题标签、内容日历
竞争对手研究:个人资料分析、内容对比、竞争对手报告
评论管理:分类、审核、自动回复工作流
发布工作流:容器创建、媒体发布、状态跟踪
潜在客户评分:带评分分层的商业潜在客户分析
审计日志:包含执行指标的全量请求/响应日志
Related MCP server: Instagram Control MCP Server
前提条件
Python 3.10+
具有 Instagram Graph API 访问权限的 Meta 开发者应用
已连接到 Meta 应用的 Instagram 商业账户
快速开始
1. 克隆并安装
git clone <repository-url>
cd instagram-mcp
pip install -r requirements.txt2. 配置环境
cp .env.example .env使用你的凭据编辑 .env:
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. 运行服务器
python server.pyDocker
docker-compose up --buildMCP 客户端配置
添加到你的 MCP 客户端配置中(例如 Claude Desktop、Cursor):
{
"mcpServers": {
"instagram": {
"command": "python",
"args": ["server.py"],
"cwd": "/path/to/instagram-mcp"
}
}
}可用工具
账户工具
工具 | 描述 |
| 获取个人资料信息 |
| 获取账户级分析数据 |
| 列出媒体帖子 |
| 获取帖子详细信息 |
分析工具
工具 | 描述 |
| 帖子表现指标 |
| Reel 表现指标 |
| Story 表现指标 |
| 表现最佳的内容 |
| 周期对比分析 |
内容工具
工具 | 描述 |
| 分析帖子结构 |
| 生成 Reel 创意 |
| 生成带话题标签的文案 |
| 生成相关话题标签 |
| 创建多日内容日历 |
| 识别内容模式 |
竞争对手工具
工具 | 描述 |
| 分析竞争对手资料 |
| 对比多个账户 |
| 查找竞争对手的顶级内容 |
| 完整的竞争对手报告 |
评论工具
工具 | 描述 |
| 获取并分类评论 |
| 回复评论 |
| 带分类的评论审核 |
发布工具
工具 | 描述 |
| 创建发布容器 |
| 发布到 Instagram |
| 检查发布状态 |
潜在客户工具
工具 | 描述 |
| 对潜在客户进行评分和分析 |
自然语言命令示例
"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 决策层
服务器实现了一个内部决策流水线:
用户请求 — 自然语言输入
意图检测 — 确定所需操作
权限检查 — 验证 API 访问权限
工具选择 — 映射到相应的 MCP 工具
Instagram API — 执行已授权的 API 调用
数据验证 — 验证响应数据
分析与推理 — 处理和分析结果
结构化响应 — 返回格式化 JSON
评论分类
分类 | 描述 |
| 赞美、好评、积极反馈 |
| 投诉、批评、负面情绪 |
| 问题、咨询 |
| 购买意向、商业咨询 |
| 促销垃圾信息、诈骗内容 |
| 支持请求、问题报告 |
| 未分类的评论 |
潜在客户评分
分数区间 | 等级 |
81-100 | 非常高 |
61-80 | 高 |
31-60 | 中等 |
0-30 | 低 |
评分因素:粉丝数量、发布频率、业务类别、需求识别、网站存在情况。
错误处理
所有工具均返回结构化的错误响应:
{
"success": false,
"error": {
"code": "RATE_LIMIT",
"message": "Instagram API rate limit reached.",
"retryable": true
}
}错误代码:UNAUTHORIZED、FORBIDDEN、NOT_FOUND、RATE_LIMIT、SERVER_ERROR、NETWORK_ERROR、INVALID_MEDIA、PERMISSION_MISSING
项目结构
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.py运行测试
pytest tests/ -v安全性
使用 OAuth 2.0 认证
访问令牌存储在环境变量中
不使用硬编码凭据
操作前进行权限验证
处理速率限制并带重试逻辑
对所有工具执行进行审计日志记录
绝不暴露令牌或密钥
许可证
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