Social Analytics MCP Server
Provides tools for Facebook Page discovery, detailed page info, page-level and post-level insights, feed with engagement data, and access token validation via the Meta Graph API.
Provides tools for Instagram account discovery, profile insights, media engagement, stories, hashtag search, and content publishing limits via the Meta Graph API.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Social Analytics MCP Server get my Instagram account insights for last 7 days"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Social Analytics MCP Server
A Model Context Protocol (MCP) server for Instagram and Facebook analytics via the Meta Graph API.
Features
Account discovery and profile information
Account-level insights with demographic breakdowns
Media listing with engagement data
Per-post insights (images, videos, reels, carousels)
Stories retrieval
Hashtag search and media discovery
Content publishing rate limits
Mentioned/tagged media
Page discovery and detailed page info
Page-level insights (impressions, engagement, fans, views)
Post-level insights
Posts with inline metrics
Page feed with reactions/comments/shares
Known metrics reference
Access token validation
Shared
Pre-built analysis prompts for common workflows
Retry with exponential backoff on 429/5xx errors
Structured error handling across both platforms
Debug logging via
DEBUG=social-analytics-mcp
Related MCP server: facebook-mcp
Quick Start
Install and build
git clone <repository-url> cd social-analytics-mcp npm install npm run buildGet an access token from the Graph API Explorer with permissions:
Instagram:
instagram_basic,instagram_manage_insights,pages_read_engagementFacebook:
read_insights,pages_read_engagement
Add to your MCP client (see configuration below)
Configuration
Variable | Required | Default | Description |
| For Instagram | — | Facebook User Access Token with Instagram permissions |
| No | Auto-detected | Instagram Business Account ID |
| No |
| Instagram Graph API version |
| For Facebook | — | Facebook User/Page Access Token |
| No | Use discovery tool | Facebook Page ID |
| No |
| Facebook Graph API version |
| No | — | Set to |
You only need to configure access tokens for the platforms you want to use. Account and page IDs can be discovered using the built-in tools.
MCP Client Setup
Claude Desktop
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"social-analytics": {
"command": "node",
"args": ["/absolute/path/to/social-analytics-mcp/dist/index.js"],
"env": {
"INSTAGRAM_ACCESS_TOKEN": "your_token_here",
"FACEBOOK_ACCESS_TOKEN": "your_token_here"
}
}
}
}Claude Code
claude mcp add social-analytics node /absolute/path/to/social-analytics-mcp/dist/index.js \
-e INSTAGRAM_ACCESS_TOKEN=your_token_here \
-e FACEBOOK_ACCESS_TOKEN=your_token_hereAvailable Tools
Instagram Tools
Tool | Description | Required Params |
| List available Instagram Business accounts | — |
| Get account profile info | — |
| Get account-level analytics |
|
| List recent media posts | — |
| Get details for a specific post |
|
| Get insights for a specific post |
|
| Get recent stories | — |
| Search for a hashtag ID |
|
| Get media for a hashtag |
|
| Check publishing rate limits | — |
| Get media where account is tagged | — |
Facebook Tools
Tool | Description | Required Params |
| List accessible Facebook Pages | — |
| Get page profile information | — |
| Get page-level insights |
|
| Get insights for a specific post |
|
| List posts with inline metrics |
|
| Get page feed with engagement data | — |
| List supported metrics reference | — |
| Validate an access token |
|
Common Parameters
Most Instagram tools accept an optional account_id parameter. If not provided, the account is auto-detected from the INSTAGRAM_ACCOUNT_ID environment variable or discovered automatically if only one account exists.
Most Facebook tools accept an optional page_id parameter with similar auto-detection behavior via FACEBOOK_PAGE_ID.
Available Prompts
Prompt | Description |
| Comprehensive Instagram account analysis |
| Comprehensive Facebook Page analysis |
| Compare recent posts on either platform |
| Audience demographic breakdown |
| Interactive setup guide |
Programmatic Usage
import { InstagramClient, FacebookClient, createServer } from 'social-analytics-mcp';
// Use clients directly
const instagram = new InstagramClient({
accessToken: 'your_token',
accountId: 'optional_account_id',
});
const profile = await instagram.getUserProfile();
// Or create an MCP server programmatically
const server = createServer();Troubleshooting
"Access token is invalid"
Ensure your token has the required permissions
Short-lived tokens expire in 1 hour — generate a long-lived token
"No Instagram Business account found"
Your Instagram account must be a Business or Creator account
It must be connected to a Facebook Page
"Unsupported metric"
Some metrics are media-type specific (e.g.,
avg_time_watchedonly works for videos/reels)Use
facebook_list_known_metricsto see supported Facebook metrics
Rate limits
Instagram: 200 calls/hour per user token
The server automatically retries on 429/5xx with exponential backoff
Contributing
See CONTRIBUTING.md for development setup and guidelines.
License
MIT
Note: This is an unofficial tool and is not affiliated with Meta, Facebook, or Instagram.
Available Tools
19 toolsfacebook_get_page_detailsA
Get detailed information about a Facebook Page including name, category, follower count, about section, contact info, and more.
Inputs: page_id.
facebook_get_page_feedA
Get the Facebook Page feed with full post details including reactions, comments, and shares counts.
Inputs: limit, page_id.
facebook_get_page_insightsB
Fetch page-level insights for a Facebook Page. Common metrics: page_impressions, page_impressions_unique, page_engaged_users, page_post_engagements, page_views_total, page_fans.
Inputs: metrics (required), limit, since, until, +2 more.
facebook_get_post_insightsB
Fetch insights for a specific Facebook Page post. Common metrics: post_impressions, post_impressions_unique, post_engaged_users.
Inputs: metrics (required), post_id (required), period.
facebook_list_known_metricsA
List all known/supported Facebook Page and Post metrics with their valid periods. Useful for discovering what metrics are available.
Inputs: no named parameters.
facebook_list_pagesA
List all Facebook Pages accessible with the current access token. Use this first to discover page IDs.
Inputs: no named parameters.
facebook_list_posts_with_insightsA
List Facebook Page posts including inline insight metrics. Combines post data with metrics in a single request.
Inputs: post_metrics (required), limit, page_id.
facebook_validate_tokenA
Validate a Facebook access token by checking it against the /me endpoint. Returns token validity, user ID, and name.
Inputs: access_token (required), fields.
instagram_get_account_insightsA
Get account-level insights and analytics for Instagram. Supports demographic breakdowns and time series data.
Inputs: period (required), metrics (required), metric_type (required), since, +4 more.
instagram_get_content_publishing_limitA
Check the content publishing rate limit status for the Instagram account. Shows current quota usage and limits.
Inputs: account_id.
instagram_get_hashtag_mediaA
Get top or recent media for a hashtag. Use instagram_get_hashtag_search first to get the hashtag ID.
Inputs: hashtag_id (required), type, limit, account_id.
instagram_get_hashtag_searchA
Search for an Instagram hashtag ID by name. The returned ID can be used with instagram_get_hashtag_media to fetch top/recent media. Limited to 30 unique hashtag searches per 7-day rolling window per account.
Inputs: hashtag (required), account_id.
instagram_get_media_detailsA
Get detailed information about a specific Instagram media post including caption, type, URL, and engagement counts.
Inputs: media_id (required).
instagram_get_media_insightsA
Get insights for a specific Instagram media post. Note: Available metrics depend on media type. For Reels/Videos: use views, likes, comments, shares, reach, saved, total_interactions, replies, avg_time_watched, total_time_watched. For Images/Carousels: use likes, comments, reach, saved, shares, total_interactions. Story-specific metrics (replies, navigation) only work on story media.
Inputs: metrics (required), media_id (required), period.
instagram_get_mentioned_mediaA
Get media where the Instagram account is mentioned or tagged by other users.
Inputs: limit, account_id.
instagram_get_profileA
Get Instagram business account profile information (username, followers, media count, etc.). If account_id is not provided, it will be auto-detected from the environment or discovered automatically.
Inputs: account_id.
instagram_get_storiesA
Get recent Instagram Stories for the account. Stories are only available for 24 hours after posting. Returns story media items with basic fields.
Inputs: account_id.
instagram_list_accountsA
List all available Instagram Business accounts. Use this first to discover account IDs.
Inputs: no named parameters.
instagram_list_mediaB
Get a list of recent media posts from Instagram account. Returns posts with basic engagement data.
Inputs: limit, account_id.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 19 tools
Most tools are clearly distinct by platform and resource type, but a few pairs like facebook_list_posts_with_insights and facebook_get_page_feed could be confused since both list posts with engagement data. Descriptions help differentiate by emphasizing inline insights vs. full post details.
Tools follow a consistent platform_verb_noun pattern using snake_case, with 'list' for collections and 'get' for individual items. Minor deviations like 'list_posts_with_insights' and 'validate_token' break the simple pattern but remain readable and predictable.
With 19 tools covering two distinct platforms (Instagram and Facebook) and multiple analytics levels, the count is slightly heavy but justifiable. Each tool serves a specific purpose, and the two-platform scope naturally expands the surface area.
The server covers the core analytics lifecycle: account/page discovery, profile details, insights at account/page/post/media levels, media/posts listing, stories, hashtags, publishing limits, and token validation. Minor gaps exist, such as no dedicated Facebook post detail-by-ID tool, but list endpoints provide the necessary IDs.
Maintenance
Related MCP Connectors
Instagram, X, TikTok, YouTube, Facebook and Reddit data. Approved OAuth or API-key access required.
Instagram and Facebook Pages for AI agents: publish, comments, DM by keyword, inbox, insights.
Schedule Instagram reels, manage comment-to-DM automations, and read analytics
Social media analytics, post insights, and competitor benchmarking for AI agents.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables Instagram engagement analysis using the unofficial Instagram Private API, including comment sentiment analysis, account comparison, demographic extraction, lead identification, and engagement reporting.67 npmMIT
- AlicenseNot gradedqualityDmaintenanceEnables analytics and management of Facebook Pages through the Meta Graph API, including posts, insights, audience, and publishing.GPL 3.0
- FlicenseNot gradedqualityBmaintenanceEnables publishing and managing organic Facebook Page and Instagram content directly through Meta's Graph API without paid third-party services.-
- AlicenseCqualityCmaintenanceEnables reading analytics and publishing content to Facebook Pages, Instagram, and Threads via Meta's Graph API, with a safety toggle for write operations.56MIT