Get the FREE Ultimate OpenClaw Setup Guide →

instagram-analytics

A Model Context Protocol (MCP) server that provides access to Instagram analytics and insights using the Instagram Graph API. This server allows you to retrieve account-level insights, media insights, and profile information programmatically.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio bilaltariq01-instagram-analytics-mcp node /absolute/path/to/instagram-analytics-mcp/dist/index.js \
  --env FACEBOOK_ACCESS_TOKEN="your_facebook_token_here" \
  --env INSTAGRAM_ACCESS_TOKEN="your_instagram_token_here"

How to use

This MCP server provides unified access to Instagram and Facebook analytics via the Meta Graph API. It exposes a set of tools for discovering accounts/pages, retrieving profile and page details, and pulling a variety of insights and media data. You can use the available Instagram tools (such as instagram_list_accounts, instagram_get_profile, instagram_get_account_insights, instagram_list_media, instagram_get_media_details, instagram_get_media_insights, instagram_get_stories, instagram_get_hashtag_search, instagram_get_hashtag_media, instagram_get_content_publishing_limit, instagram_get_mentioned_media) as well as Facebook tools (facebook_list_pages, facebook_get_page_details, facebook_get_page_insights, facebook_get_post_insights, facebook_list_posts_with_insights, facebook_get_page_feed, facebook_list_known_metrics, facebook_validate_token). Most tools accept optional account_id or page_id parameters and will auto-detect when possible using the configured environment variables or discovery features. To run the server, configure your access tokens in the environment, start the MCP server, and then call the tools through your MCP client. You can also leverage the programmatic usage example to instantiate InstagramClient and FacebookClient or to create the MCP server instance for integration into your workflow.

How to install

Prerequisites:

  • Node.js (14.x or newer) and npm installed
  • Access tokens for Instagram and Facebook with the required permissions

Installation steps:

  1. Clone the repository: git clone <repository-url>
  2. Navigate to the project directory: cd instagram-analytics-mcp
  3. Install dependencies: npm install
  4. Build the project (if a build step is provided): npm run build
  5. Run the MCP server (adjust PATH to your environment): npm start
  6. Set up credentials (environment variables) for runtime:
    • INSTAGRAM_ACCESS_TOKEN: Your Instagram User/Business token
    • FACEBOOK_ACCESS_TOKEN: Your Facebook User/Page token

Usage example (from MCP client):

  • In your MCP client configuration, reference the server as: { "mcpServers": { "instagram-analytics": { "command": "node", "args": ["/absolute/path/to/instagram-analytics-mcp/dist/index.js"], "env": { "INSTAGRAM_ACCESS_TOKEN": "your_instagram_token_here", "FACEBOOK_ACCESS_TOKEN": "your_facebook_token_here" } } } }

Additional notes

Tips and caveats:

  • Tokens can expire; consider using long-lived tokens where possible and handle re-authentication in your client.
  • The server supports exponential backoff on 429 and 5xx errors to help with rate limits.
  • Debug logging can be enabled by setting DEBUG=social-analytics-mcp in the environment for verbose output.
  • Some metrics may be limited by the API type or media type; consult facebook_list_known_metrics for supported options.
  • Account/Page auto-detection relies on environment variables (INSTAGRAM_ACCOUNT_ID, FACEBOOK_PAGE_ID) or discovery tools; provide explicit IDs if needed to avoid ambiguity.

Related MCP Servers

Sponsor this space

Reach thousands of developers