meta-mcp
The meta-mcp server enables AI assistants to manage Instagram and Threads accounts through the Meta Graph API, offering tools across publishing, engagement, analytics, messaging, and platform administration.
Publishing: Photos, videos, Reels, Stories, and carousels (2–10 items) with captions, alt text, location tags, and user tagging
Media Management: List, retrieve, delete posts; toggle comments; view media-level insights (views, reach, saves, shares)
Comments: Get, post, reply to, hide/unhide, and delete comments
Profile & Insights: Account profile info, account-level analytics, Business Discovery for other accounts, collaboration invite management
Hashtags: Search hashtags, browse recent and top media by hashtag
Mentions & Tags: Get comments/media where the account is @mentioned or tagged
DMs: List conversations, get/send messages, retrieve message details
Threads
Publishing: Text posts (with polls, GIFs, links, topic tags, quote posts, spoiler flags), images, videos, carousels (2–20 items); repost existing threads; check publishing quota (250/day)
Media & Search: List/retrieve published posts; search public posts by keyword or topic tag
Replies: Get replies (top-level or full tree), reply to posts, hide/unhide replies
Mentions: List posts where the user was @mentioned
Profile & Insights: Profile info (including verification status), post-level analytics (views, likes, replies, reposts, quotes, clicks), account-level analytics with follower demographics
Meta Platform Tools
Exchange short-lived tokens for long-lived ones (~60 days), refresh tokens, and debug token status
Retrieve Meta App information
Subscribe to and list webhook notifications (Instagram, page, user objects)
Resources & Prompts
Access Instagram and Threads profile data as resources
Built-in prompts for cross-platform content publishing and analytics reporting
Provides comprehensive Instagram Business/Creator account management via the Instagram Graph API, including publishing photos, videos, reels, stories and carousels with alt text; managing comments, replies, and DMs; viewing media and account insights; searching hashtags; handling collaboration invites; and managing tagged content and mentions.
Supports Meta platform token lifecycle management (exchange, refresh, and debug) and webhook subscription management for Meta Developer Apps.
Enables full Threads API integration for publishing text posts with polls and GIFs, images, videos, and carousels; managing replies (including hide/unhide); searching public posts; deleting content; and viewing post-level and account-level analytics.
meta-mcp
Enables AI assistants to manage Instagram and Threads accounts — publish content, handle comments, view insights, search hashtags, and manage DMs through the Meta Graph API.
Prerequisites
Node.js 22+ (LTS recommended)
Quick Start
Add to your MCP client config:
{
"mcpServers": {
"meta": {
"command": "npx",
"args": ["-y", "@exileum/meta-mcp"],
"env": {
"INSTAGRAM_ACCESS_TOKEN": "your_ig_token",
"INSTAGRAM_USER_ID": "your_ig_user_id",
"THREADS_ACCESS_TOKEN": "your_threads_token",
"THREADS_USER_ID": "your_threads_user_id"
}
}
}
}Only set the variables for the platforms you use.
Manual Installation
git clone https://github.com/exileum/meta-mcp.git
cd meta-mcp
npm install
npm run build{
"mcpServers": {
"meta": {
"command": "node",
"args": ["/path/to/meta-mcp/dist/index.js"],
"env": {
"INSTAGRAM_ACCESS_TOKEN": "your_ig_token",
"INSTAGRAM_USER_ID": "your_ig_user_id",
"THREADS_ACCESS_TOKEN": "your_threads_token",
"THREADS_USER_ID": "your_threads_user_id"
}
}
}
}Environment Variables
Variable | Required | Description |
| For Instagram | Instagram Graph API access token |
| For Instagram | Instagram Business/Creator account ID (numeric string, or |
| For Threads | Threads API access token |
| For Threads | Threads user ID (numeric string, or |
| For token/webhook tools | Meta App ID (numeric string) |
| For token/webhook tools | Meta App Secret |
| Optional | Meta Graph API version for Instagram and Facebook endpoints — defaults to |
| Optional | Threads API version — defaults to |
The server validates these at startup. Malformed values for INSTAGRAM_USER_ID, THREADS_USER_ID, or META_APP_ID cause the process to exit with Invalid meta-mcp configuration: …. Setting only one half of a credential pair (e.g., INSTAGRAM_ACCESS_TOKEN without INSTAGRAM_USER_ID) prints a stderr warning and continues; related tool invocations still fail at call time.
Account Requirements
Platform | Account Type | Notes |
Business or Creator | Personal accounts cannot use the Graph API. Free to switch in settings | |
Threads | Any account | Instagram link no longer required since Sep 2025 |
Meta (token/webhook) | Meta Developer App | Create at developers.facebook.com |
Features
58 tools across Instagram (33), Threads (19), and Meta platform (6)
Instagram: Publish photos/videos/reels/stories/carousels with alt text, manage comments, view insights, search hashtags, handle DMs, manage collaboration invites
Threads: Publish text/images/videos/carousels with polls, GIFs, topic tags, link attachments, alt text, spoiler flags; manage replies; search posts; delete posts; view insights
Meta: Token exchange/refresh/debug, webhook management
2 resources: Instagram profile, Threads profile
2 prompts: Cross-platform content publishing, analytics report
Rate limit tracking via
x-app-usageheaderStructured error responses with
error_type(auth,validation,rate_limit,server,network,internal), HTTP status, Meta API code/subcode/type, and aremediationhint where actionable — seeCHANGELOG.mdfor the JSON shape
Tools
Meta Platform (6)
Tool | Description |
| Exchange short-lived token for long-lived token (~60 days). Requires |
| Refresh a long-lived token before expiration. Requires |
| Inspect token validity, expiration, and scopes |
| Get Meta App information |
| Subscribe to webhook notifications |
| List current webhook subscriptions |
Instagram — Publishing (6)
Tool | Description |
| Publish a photo post (supports alt_text, collaborators) |
| [DEPRECATED] Use |
| Publish a carousel/album (2-10 items, supports alt_text per IMAGE item, collaborators) |
| Publish a Reel (supports collaborators) |
| Publish a Story (24hr) |
| Check media container processing status |
Instagram — Media (5)
Tool | Description |
| List published media |
| Get media details |
| Delete a media post (requires Facebook Login) |
| Get media analytics (default views, reach — override |
| Enable/disable comments on a post |
Instagram — Comments (7)
Tool | Description |
| Get comments on a post |
| Get comment details |
| Post a comment |
| Get replies to a comment |
| Reply to a comment |
| Hide/unhide a comment |
| Delete a comment |
Instagram — Profile & Insights (5)
Tool | Description |
| Get account profile info |
| Get account-level analytics (views, reach, follower_count). Optional |
| Look up another business account |
| Get pending collaboration invites |
| Accept/decline a collaboration invite by media_id |
Instagram — Hashtags (4)
Tool | Description |
| Search hashtag by name |
| Get hashtag info |
| Get recent media for a hashtag |
| Get top media for a hashtag |
Instagram — Mentions & Tags (2)
Tool | Description |
| Get details of a specific comment mentioning you (by comment_id from a mention webhook) |
| Get media you're tagged in |
Instagram — Messaging (4)
Tool | Description |
| List DM conversations |
| Get messages in a conversation |
| Send a DM |
| Get message details |
Threads — Publishing (8)
Tool | Description |
| Publish a text post in a single API call ( |
| Publish an image post (supports alt_text, topic tags, spoiler flag, cross-share to IG Stories, geo-gating via |
| Publish a video post (supports alt_text, topic tags, spoiler flag, cross-share to IG Stories, geo-gating via |
| Publish a carousel (2-20 items, supports alt_text per item, cross-share to IG Stories, geo-gating via |
| Delete a post (max 100/day) |
| Check container processing status (unpublished containers only) |
| Check remaining publishing quota (250 posts/day) |
| Repost an existing thread to your profile (requires |
Threads — Media & Search (3)
Tool | Description |
| List published posts (includes topic_tag, poll, GIF fields; optional |
| Get post details |
| Search public posts by keyword or tag (requires |
Threads — Replies (4)
Tool | Description |
| Get replies to a post ( |
| Reply to a post (supports image/video attachments) |
| Hide a reply |
| Unhide a reply |
Threads — Mentions (1)
Tool | Description |
| List posts where the user was @mentioned (requires |
Threads — Profile (1)
Tool | Description |
| Get Threads profile info (includes |
Threads — Insights (2)
Tool | Description |
| Get post analytics (views, likes, replies, reposts, quotes, shares) |
| Get account-level analytics (period: day/lifetime; |
Resources
Resource URI | Description |
| Instagram account profile data |
| Threads account profile data (includes is_verified) |
Prompts
Prompt | Description |
| Cross-post content to Instagram and Threads |
| Generate combined analytics report |
Setup Guide
Step 1: Create a Meta Developer App
Go to developers.facebook.com and log in
Click "My Apps" -> "Create App"
Select "Other" -> "Business" (or "None" for personal use)
Enter an app name and create
Your META_APP_ID and META_APP_SECRET are in App Settings -> Basic.
Step 2: Instagram Setup
Requires an Instagram Business or Creator account. Switch for free in Instagram app -> Settings -> Account type. No Facebook Page linking required — this uses the Instagram API with Instagram Login.
In your Meta App, go to "Instagram" -> "API setup with Instagram business login"
In the "Generate access tokens" section, click "Add account" -> log in to your Instagram account
The generated token is long-lived (~60 days) — no exchange step needed. Copy it as your
INSTAGRAM_ACCESS_TOKEN.To refresh before expiry, use the
meta_refresh_tokentool withplatform: "instagram", or:GET https://graph.instagram.com/refresh_access_token ?grant_type=ig_refresh_token &access_token=LONG_LIVED_TOKEN
Get your Instagram User ID:
GET https://graph.instagram.com/v25.0/me?fields=user_id,username&access_token=YOUR_TOKENThe
user_idis yourINSTAGRAM_USER_ID.Permissions are configured in your app's Instagram settings. Available scopes:
instagram_business_basic— required for all operationsinstagram_business_content_publish— publishing photos, reels, carouselsinstagram_business_manage_comments— reading and managing commentsinstagram_business_manage_messages— DM conversations and messaging
Step 3: Threads Setup
Works with any Threads account. Instagram link no longer required since Sep 2025.
In your Meta App, go to "Add Products" -> add "Threads API"
Go to "Threads API" -> "Settings":
Add your Threads account as a Threads Tester under "Roles"
Accept the invitation in the Threads app: Settings -> Account -> Website permissions -> Invites
Generate an authorization URL:
https://threads.net/oauth/authorize ?client_id=YOUR_APP_ID &redirect_uri=YOUR_REDIRECT_URI &scope=threads_basic,threads_content_publish,threads_manage_insights,threads_manage_replies,threads_read_replies,threads_share_to_instagram,threads_manage_mentions,threads_keyword_search &response_type=codeFor local testing, use
https://localhost/as redirect URI (configure in App Settings -> Threads API -> Redirect URIs).After authorization, exchange the code for an access token:
POST https://graph.threads.net/oauth/access_token Content-Type: application/x-www-form-urlencoded client_id=YOUR_APP_ID &client_secret=YOUR_APP_SECRET &grant_type=authorization_code &redirect_uri=YOUR_REDIRECT_URI &code=AUTHORIZATION_CODEExchange for a long-lived token (~60 days):
GET https://graph.threads.net/access_token ?grant_type=th_exchange_token &client_secret=YOUR_APP_SECRET &access_token=SHORT_LIVED_TOKENGet your Threads User ID:
GET https://graph.threads.net/v1.0/me?fields=id,username&access_token=YOUR_TOKENThe
idfield is yourTHREADS_USER_ID.
Token Renewal
Access tokens expire after ~60 days. Refresh before expiration (token must be at least 24h old):
Instagram: Use
meta_refresh_tokenwithplatform: "instagram", or call:GET https://graph.instagram.com/refresh_access_token ?grant_type=ig_refresh_token &access_token=CURRENT_LONG_LIVED_TOKENThreads: Use
meta_refresh_tokenwithplatform: "threads", or call:GET https://graph.threads.net/refresh_access_token ?grant_type=th_refresh_token &access_token=CURRENT_LONG_LIVED_TOKEN
Check token status anytime with meta_debug_token.
Troubleshooting
Tool failures return isError: true with a JSON body in content[0].text matching the envelope documented in CHANGELOG.md: { error: true, error_type, http_status, code, subcode, type, message, remediation, fbtrace_id, raw }. The fastest path to a fix is to read error_type and the Meta API code, then jump to the matching subsection below. The full code reference is the Meta Graph API error handling guide.
error_type: "auth" — expired, revoked, or under-scoped token
Triggered by Meta API codes 190, 10, 102, HTTP 401, or type: "OAuthException". Common messages:
Error validating access token: Session has expired— long-lived tokens expire ~60 days after issue.Application does not have permission for this action— the token is missing a scope, or the account is not eligible (e.g., a Personal Instagram account on Graph API endpoints).
What to do:
Run
meta_debug_tokento inspectexpires_at,is_valid, andscopes.If the token is not yet expired but at least 24h old, refresh in place with
meta_refresh_token(platform: "instagram"or"threads") — this extends the lifetime by another ~60 days. If the token is already expired, the refresh endpoint will reject it; regenerate a short-lived token from the Meta App dashboard and exchange it viameta_exchange_token(or run a full re-authorization for Threads).If scopes are missing, regenerate the token with the required permissions:
Instagram:
instagram_business_basic(always required) plusinstagram_business_content_publish,instagram_business_manage_comments,instagram_business_manage_messagesper feature.Threads:
threads_basic,threads_content_publish,threads_manage_insights,threads_manage_replies,threads_read_replies,threads_share_to_instagram,threads_manage_mentions,threads_keyword_searchper feature.
If your Instagram account is Personal, switch to Business or Creator for free in the Instagram app (Settings → Account type and tools → Switch to professional account). The Graph API rejects Personal accounts.
error_type: "rate_limit" — application or user quota exhausted
Triggered by Meta API codes 4, 17, 32, 341, 613, the business-use-case range 80001–80008, or HTTP 429. Includes any OAuthException with code 4 / 17 (these are surfaced as error_type: "rate_limit", not "auth", despite the type field).
What to do:
Inspect the
_rateLimitfield on prior successful tool responses.callCount,totalCpuTime, andtotalTimecome from Meta'sx-app-usageheader; whencallCountapproaches100you are near the per-app threshold.Back off with exponential delay; reduce request volume; cache profile metadata between calls.
Threads has hard daily quotas (250 publishes, 100 deletes) — query the remaining quota with
threads_get_publishing_limitbefore bulk operations.
error_type: "validation" — bad parameter, wrong ID, or unsupported field
Triggered by Meta API codes 100, 200, 803, or any unmapped 4xx HTTP status. Common pitfalls:
Wrong user ID format —
INSTAGRAM_USER_IDandTHREADS_USER_IDmust be the numeric ID returned byGET /me?fields=user_id(Instagram) orGET /me?fields=id(Threads), or the literal"me"for the authenticated user. The Instagram username is not accepted.(#100) Messaging is not supportedonig_send_message/ig_get_conversations/ig_get_messages— the account does not have the messaging API enabled. Grantinstagram_business_manage_messageson your token and ensure DMs are enabled in the Instagram app (Settings → Privacy → Messages).Deprecated publish endpoint —
ig_publish_videowas retired by Meta on Nov 9, 2023; useig_publish_reelfor video posts.ig_publish_storyis required for Stories.Mutually exclusive Threads attachments — a
threads_publish_textpost can carry only one oftext_attachment,poll_options,link_attachment, orgif_attachment; combining them is rejected at the schema level.Unsupported
metric/fieldsfor the resource — see the per-tool Meta docs (ig_get_media_insightslists per-media_typevalid metrics in its description).
Other categories
error_type: "server"(codes1,2, HTTP 5xx) — transient Meta outage; retry with exponential backoff. Check metastatus.com if it persists.error_type: "network"—fetchtimed out or failed before reaching Meta. Verify outbound connectivity and retry.error_type: "internal"— unexpected condition that did not map to a Meta error code. Therawfield carries the sanitized original message;access_token,client_secret, andinput_tokenvalues are scrubbed to***before reporting.
API Stability
meta-mcp is consumed as an MCP server runtime, not as a library. The supported entry points are:
npx @exileum/meta-mcp(recommended for end users)node dist/index.js(manual installation)
The single programmatic export from the package root, createSandboxServer(): McpServer, exists for the Smithery sandbox runner and is the only stable JavaScript/TypeScript API.
zod and other transitive runtime dependencies are internal and not part of meta-mcp's public API. No zod symbols, types, or schemas flow through dist/index.d.ts, so zod's version may change in any release — including major version bumps — without a corresponding meta-mcp major bump.
@modelcontextprotocol/sdk is the one exception: McpServer (the return type of createSandboxServer()) is imported from that package, so a breaking change to McpServer's public interface would also be a breaking change for meta-mcp's programmatic API. In practice the MCP SDK follows semver, so consumers can treat @modelcontextprotocol/sdk as an implicit peer dependency of the createSandboxServer export.
Only the package root (@exileum/meta-mcp) is a supported import target. Deep imports into the published dist/ tree (e.g. @exileum/meta-mcp/dist/schemas.js) are blocked by the package.json exports map for any spec-compliant resolver and are not part of the public API; they may be renamed, removed, or restructured in any release.
Glama
Contributing
Contributions are welcome. See CONTRIBUTING.md for the dev setup, project layout, the tool-registration recipe, testing, commit conventions, the CHANGELOG flow, and the CI gates. Bug reports and feature requests use the issue templates; pull requests use the PR template.
License
See CHANGELOG.md for release history.
Maintenance
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/exileum/meta-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server