Instagram MCP Server
Instagram MCP Server
Instagram/Meta APIと連携するための本番環境対応のModel Context Protocol(MCP)サーバーです。AIエージェントが、構造化されたMCPツールを通じて、コンテンツ管理、パフォーマンス分析、競合調査、公開ワークフローの処理を実行できるようにします。
特徴
アカウント管理: プロフィール取得、アカウントインサイト、メディア一覧
コンテンツ分析: 投稿、リール、ストーリーのインサイトとエンゲージメント指標
コンテンツ生成: リールのアイデア、キャプション、ハッシュタグ、コンテンツカレンダー
競合調査: プロフィール分析、コンテンツ比較、競合レポート
コメント管理: 分類、モデレーション、自動返信ワークフロー
公開ワークフロー: コンテナ作成、メディア公開、ステータス追跡
リードスコアリング: ビジネスリードの分析とスコアリング層
監査ログ: 実行メトリクスを含む全リクエスト/レスポンスのログ記録
Related MCP server: Instagram Control MCP Server
前提条件
Python 3.10以上
Instagram Graph APIアクセス権を持つMeta Developerアプリ
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"
}
}
}利用可能なツール
アカウントツール
ツール | 説明 |
| プロフィール情報を取得 |
| アカウントレベルの分析を取得 |
| メディア投稿を一覧表示 |
| 投稿の詳細情報を取得 |
分析ツール
ツール | 説明 |
| 投稿のパフォーマンス指標 |
| リールのパフォーマンス指標 |
| ストーリーのパフォーマンス指標 |
| 上位のコンテンツ |
| 期間比較 |
コンテンツツール
ツール | 説明 |
| 投稿構造の分析 |
| リールのコンセプト生成 |
| ハッシュタグ付きキャプション生成 |
| 関連ハッシュタグの生成 |
| 複数日カレンダーの作成 |
| コンテンツパターンの特定 |
競合ツール
ツール | 説明 |
| 競合プロフィールの分析 |
| 複数アカウントの比較 |
| 競合の上位コンテンツを検索 |
| 完全な競合レポート |
コメントツール
ツール | 説明 |
| コメントの取得と分類 |
| コメントへの返信 |
| 分類によるモデレーション |
公開ツール
ツール | 説明 |
| 公開コンテナの作成 |
| 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セキュリティ
Meta Graph APIによるOAuth 2.0認証
アクセストークンは環境変数に保存
資格情報のスクレイピングやセッション抽出は行いません
操作前の権限検証
リトライロジックによるレート制限処理
すべてのツール実行の監査ログ
レスポンスでトークンやシークレットを公開しない
ライセンス
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server for QPost — lets AI agents publish video and image posts to YouTube, TikTok, Instagram.
Agent-first social media publishing, scheduling, analytics, and unified inbox API + 16-tool MCP server across 18 social platforms (X, LinkedIn, Instagram, YouTube, TikTok, Threads, Bluesky, Reddit, Telegram, Discord, Mastodon, Facebook, Pinterest).
Instagram for AI agents: publish, read comments and DMs, insights, and engage from your account.
Hosted Instagram MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn 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.203MIT
- AlicenseBqualityCmaintenanceA professional, full-fidelity MCP server enabling AI agents to fully control and manage an Instagram account exactly like a human user.6821 PyPI5MIT
- AlicenseBqualityFmaintenanceMCP server that connects AI agents to Instagram for reading statistics, insights, and comments via the official Meta Graph API.162MIT
- AlicenseNot gradedqualityDmaintenanceA production-ready Remote MCP Server that gives Claude direct, tool-based access to your Instagram Business account through the Meta Graph API — profile data, posts, comments, publishing, insights, analytics, hashtags, messaging, and real-time webhooks.11 npmMIT