Get the FREE Ultimate OpenClaw Setup Guide →

ig

A production-ready Model Context Protocol (MCP) server that enables AI applications to seamlessly interact with Instagram Business accounts.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio jlbadano-ig-mcp python -m ig_mcp_server \
  --env LOG_LEVEL="INFO" \
  --env CACHE_ENABLED="true" \
  --env FACEBOOK_APP_ID="Your Facebook App ID" \
  --env FACEBOOK_APP_SECRET="Your Facebook App Secret" \
  --env INSTAGRAM_API_VERSION="v19.0" \
  --env INSTAGRAM_ACCESS_TOKEN="Your long-lived Instagram Graph API access token" \
  --env RATE_LIMIT_REQUESTS_PER_HOUR="200" \
  --env INSTAGRAM_BUSINESS_ACCOUNT_ID="Your Instagram Business Account ID"

How to use

This MCP server exposes tools to interact with Instagram's Graph API on behalf of a connected Instagram Business account. You can retrieve profile details, fetch recent media posts, obtain engagement insights, publish media, and manage conversations or direct messages (the latter requiring Advanced Access). There are also application-controlled resources such as profile data, media feed, and insights data, plus user-controlled prompts for analyzing engagement, content strategy, and hashtag performance. To use the server, ensure your environment is configured with Instagram Graph API credentials and a valid long-lived access token. Start the MCP server, then direct your AI agent to invoke the available tools (e.g., Get Profile Info, Get Media Posts, Publish Media) to fetch data, publish content, or analyze performance. For DMs and some advanced features, you may need App Review approval from Meta.

How to install

Prerequisites:

  • Python 3.10+ installed on your machine
  • A Facebook App configured with Instagram Graph API products and necessary permissions
  • A long-lived Instagram access token with appropriate scopes
  • Access to a running MCP environment or server where you can deploy the ig MCP module

Step-by-step:

  1. Clone the MCP server repo (or navigate to the ig MCP module directory): git clone https://github.com/jlbadano-ig-mcp.git cd jlbadano-ig-mcp

  2. Create a Python virtual environment and activate it: python -m venv venv

    On Windows

    venv\Scripts\activate

    On macOS/Linux

    source venv/bin/activate

  3. Install dependencies (adjust requirements.txt path if needed): pip install -r requirements.txt

  4. Configure environment variables (example .env): touch .env

    Facebook/App credentials

    echo 'FACEBOOK_APP_ID=your_app_id_here' >> .env echo 'FACEBOOK_APP_SECRET=your_app_secret_here' >> .env

    Instagram credentials

    echo 'INSTAGRAM_ACCESS_TOKEN=your_long_lived_access_token_here' >> .env echo 'INSTAGRAM_BUSINESS_ACCOUNT_ID=your_instagram_business_account_id_here' >> .env echo 'INSTAGRAM_API_VERSION=v19.0' >> .env

    Optional config

    echo 'RATE_LIMIT_REQUESTS_PER_HOUR=200' >> .env echo 'CACHE_ENABLED=true' >> .env echo 'LOG_LEVEL=INFO' >> .env

  5. Run the MCP server (module-based entry point): python -m ig_mcp_server

  6. Verify the server is running by checking logs or hitting a health endpoint if provided by the ig_mcp_server module.

Notes:

  • If you store credentials in a .env file, ensure it is not committed to version control.
  • For deployment, consider packaging the app with a process manager (e.g., systemd, pm2) and using a dedicated environment management strategy.

Additional notes

Tips and common issues:

  • Ensure your Instagram Graph API permissions include the required scopes for the actions you intend to perform; some features (like DM) require Advanced Access and App Review from Meta.
  • Long-lived access tokens last ~60 days; implement a token refresh workflow and securely store updated tokens.
  • Use a secure method to load environment variables (e.g., dotenv, secret management) in production.
  • If rate limits are hit, increase the throttle in the config and implement exponential backoff in your client calls.
  • When publishing media, ensure the media format and endpoints comply with Instagram Graph API requirements and that your app is approved for content_publish permission.
  • Monitor logs for errors related to permissions, token expiration, or API quota, and refresh tokens accordingly.

Related MCP Servers

Sponsor this space

Reach thousands of developers