Do it like this:
1. Use this architecture
Instagram API / Graph API → your MCP server → Claude Code
Claude Code can connect to external tools and APIs through MCP. Anthropic supports adding MCP servers by CLI, JSON config, project-level .mcp.json, or remote HTTP MCP servers. (Claude API Docs)
2. Pick the right Instagram API path
There are two official paths:
A. Instagram API with Instagram Login
Use this if you want to access your own Instagram professional account and you do not want to depend on a Facebook Page link. Meta says this path is for Instagram Professionals — Business and Creator accounts, and it does not require the Instagram professional account to be linked to a Facebook Page. (Facebook Developers)
B. Instagram API with Facebook Login
Use this if your workflow already sits inside Meta Business / Facebook Page infrastructure. In this path, Meta says the Instagram professional account must be connected to a Facebook Page. (Facebook Developers)
Important: this is for professional accounts. Meta’s IG User / IG Media docs are for Business or Creator accounts, not normal personal accounts. (Facebook Developers)
3. What data you can expose to Claude Code through MCP
Meta’s official Instagram Platform supports pulling account/media insights and managing comments. The platform docs say it can get and publish media, manage and reply to comments, and access insights for professional accounts. The IG User object includes fields like followers_count and media_count; media insights include metrics such as likes, saves, comments, shares, reach, and views depending on media type. (Facebook Developers)
For analysis, the core MCP tools should be:
get_account_profile
get_account_insights
list_media
get_media_insights
list_comments
get_comment_threads
Meta’s permissions differ by auth path. For media insights, Meta lists instagram_basic, instagram_manage_insights, and related page permissions for the Facebook Login path; for comments, Meta lists instagram_manage_comments plus related page permissions. For Instagram Login, the corresponding business scopes are instagram_business_basic, instagram_business_manage_insights, and instagram_business_manage_comments. (Facebook Developers)
4. Best implementation for Claude Code
Build a small custom MCP server that wraps the Instagram endpoints you actually need. Use the official MCP TypeScript SDK package @modelcontextprotocol/server, or another official MCP SDK. The official TypeScript SDK is published by the MCP project and supports building MCP servers. (GitHub)
Minimal flow:
- Create a Meta app.
- Enable the Instagram API path you chose.
- Complete OAuth and store the access token securely.
- Build an MCP server with a few tools that call Meta endpoints.
- Add that MCP server to Claude Code.
- Ask Claude Code to analyze the returned data and write reports.
If you plan to use this only for your own account in dev/testing, setup is much lighter. If you want to use it for broader production users, Meta says advanced permissions/features require App Review. (Facebook Developers)
5. Claude Code connection methods
Claude Code officially supports:
claude mcp add --transport http <name> <url>
for remote HTTP MCP servers, and project-scoped MCP config in .mcp.json. It also supports adding MCP servers from JSON with claude mcp add-json. (Claude API Docs)
6. Recommended project layout
ig-mcp/
├─ server/
│ ├─ src/
│ │ ├─ auth.ts
│ │ ├─ meta-client.ts
│ │ ├─ tools/
│ │ │ ├─ get-account-insights.ts
│ │ │ ├─ list-media.ts
│ │ │ ├─ get-media-insights.ts
│ │ │ └─ list-comments.ts
│ │ └─ index.ts
│ ├─ package.json
│ └─ .env
└─ analysis/
└─ .mcp.json
7. Example .mcp.json for Claude Code
Use a project-scoped config so Claude Code can load the MCP server from the repo root. Anthropic says project-scope MCP servers are stored in .mcp.json in the project root. (Claude API Docs)
{
"mcpServers": {
"instagram-data": {
"command": "node",
"args": ["../server/dist/index.js"],
"env": {
"META_APP_ID": "${META_APP_ID}",
"META_APP_SECRET": "${META_APP_SECRET}",
"META_ACCESS_TOKEN": "${META_ACCESS_TOKEN}",
"IG_USER_ID": "${IG_USER_ID}"
}
}
}
}
Or add it by JSON:
claude mcp add-json instagram-data '{
"type":"stdio",
"command":"node",
"args":["../server/dist/index.js"],
"env":{
"META_ACCESS_TOKEN":"your-token",
"IG_USER_ID":"your-ig-user-id"
}
}'
That command format is directly supported by Claude Code. (Claude API Docs)
8. MCP tool design you should expose
Your MCP server should expose tools like this:
get_account_profile()
get_account_insights(metrics, period, since, until)
list_media(limit, since, until)
get_media_insights(media_id, metrics)
list_comments(media_id, limit)
Each tool should call the matching Meta endpoint and return clean JSON, not raw API dumps. That matters because Claude Code warns on large MCP outputs and has MCP output token limits. Anthropic documents a default MCP output cap and warns when output gets large. (Claude API Docs)
9. What to tell Claude Code
Once the MCP server is connected:
Use the instagram-data MCP tools to analyze my Instagram account.
Tasks:
1. Pull account-level insights for the last 90 days
2. Pull all media posted in the last 90 days
3. Compute engagement rate by post type
4. Compare reels vs feed posts vs carousels
5. Identify top 20 posts by reach, saves, shares, comments
6. Cluster top-performing content patterns
7. Find weak-performing themes and posting windows
8. Output:
- executive summary
- markdown report
- CSV tables
- content strategy recommendations
10. Critical limits you need to know
Meta documents several constraints for insights:
- media insights can return empty data instead of
0
- metrics can be delayed by up to 48 hours
- media metrics are stored for up to 2 years
- the API reports organic interaction metrics only
- Story metrics are only available for a limited window, and story handling has extra caveats (Facebook Developers)
11. Best practical route
For your use case, the cleanest route is:
Fastest
- use Instagram API with Instagram Login
- build a custom MCP server
- connect that server to Claude Code with
.mcp.json
- let Claude Code analyze via MCP tools
Only use Facebook Login path if
- your IG is already deeply tied to Meta Business / Page workflows
- you need page-backed permissions and business-manager style access (Facebook Developers)
12. Bottom line
You do not “send IG data to Claude Code” directly.
You:
- authenticate against Meta,
- expose the needed IG data through an MCP server,
- connect that MCP server to Claude Code,
- let Claude Code call tools and analyze the returned JSON. (Claude API Docs)