Skip to main content
Glama
abdulsammad-lgtm

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.txt

2. 環境設定

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_id

3. サーバーの起動

python server.py

Docker

docker-compose up --build

MCPクライアント設定

MCPクライアント設定(例: Claude Desktop、Cursor)に追加します:

{
  "mcpServers": {
    "instagram": {
      "command": "python",
      "args": ["server.py"],
      "cwd": "/path/to/instagram-mcp"
    }
  }
}

利用可能なツール

アカウントツール

ツール

説明

instagram_get_profile

プロフィール情報を取得

instagram_get_account_insights

アカウントレベルの分析を取得

instagram_get_media

メディア投稿を一覧表示

instagram_get_media_details

投稿の詳細情報を取得

分析ツール

ツール

説明

instagram_get_post_insights

投稿のパフォーマンス指標

instagram_get_reel_insights

リールのパフォーマンス指標

instagram_get_story_insights

ストーリーのパフォーマンス指標

instagram_get_top_content

上位のコンテンツ

instagram_compare_content

期間比較

コンテンツツール

ツール

説明

instagram_analyze_content

投稿構造の分析

instagram_generate_reel_ideas

リールのコンセプト生成

instagram_generate_caption

ハッシュタグ付きキャプション生成

instagram_generate_hashtags

関連ハッシュタグの生成

instagram_generate_content_calendar

複数日カレンダーの作成

instagram_find_content_patterns

コンテンツパターンの特定

競合ツール

ツール

説明

instagram_analyze_competitor

競合プロフィールの分析

instagram_compare_accounts

複数アカウントの比較

instagram_find_competitor_content

競合の上位コンテンツを検索

instagram_competitor_report

完全な競合レポート

コメントツール

ツール

説明

instagram_get_comments

コメントの取得と分類

instagram_reply_comment

コメントへの返信

instagram_moderate_comments

分類によるモデレーション

公開ツール

ツール

説明

instagram_create_media_container

公開コンテナの作成

instagram_publish_media

Instagramに公開

instagram_get_publish_status

公開ステータスの確認

リードツール

ツール

説明

instagram_analyze_leads

リードのスコアリングと分析

自然言語コマンドの例

"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_accounts

AI決定レイヤー

サーバーは内部の決定パイプラインを実装しています:

  1. ユーザーリクエスト - 自然言語入力

  2. 意図検出 - 必要な操作を決定

  3. 権限チェック - APIアクセスを検証

  4. ツール選択 - 適切なMCPツールにマッピング

  5. Instagram API - 承認されたAPI呼び出しを実行

  6. データ検証 - レスポンスデータを検証

  7. 分析/推論 - 結果を処理して分析

  8. 構造化レスポンス - フォーマットされたJSONを返す

コメント分類

コメントは自動的に以下のカテゴリに分類されます:

カテゴリ

説明

positive

賞賛、称賛、肯定的なフィードバック

negative

苦情、批判、否定的な感情

question

質問、問い合わせ

lead

購入意図、ビジネス問い合わせ

spam

プロモーションスパム、詐欺コンテンツ

support

サポートリクエスト、問題報告

other

未分類のコメント

リードスコアリング

スコア範囲

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

F
license - not found
Not graded
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    Not graded
    quality
    F
    maintenance
    An 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.
    173
    MIT
  • A
    license
    Not graded
    quality
    C
    maintenance
    Social media API and MCP server for AI agents that enables publishing to X, Instagram, LinkedIn, Reddit, Bluesky, and Threads from a single endpoint.
    1
    MIT

View all related MCP servers

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).

View all MCP Connectors

Latest Blog Posts

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