Connect Instagram to Claude: Manage Comments and User Interactions
Learn how to securely connect Instagram to Claude using a managed MCP server. Automate comments, manage tags, and orchestrate content publishing workflows.
If you need to connect Instagram to Claude to automate social listening, manage user comments, or orchestrate high-volume content publishing pipelines, you need a Model Context Protocol (MCP) server. This server acts as the translation layer between Claude's tool calls and the Instagram Graph API. You can either build and maintain this infrastructure yourself, or use a managed integration platform like Truto to dynamically generate a secure, authenticated MCP server URL. If your team uses ChatGPT, check out our guide on connecting Instagram to ChatGPT or explore our broader architectural overview on connecting Instagram to AI Agents.
Giving a Large Language Model (LLM) read and write access to the Instagram Graph API is an engineering headache. You are dealing with highly specific authorization flows, complex multi-step media upload processes, and some of the most punitive rate limits in the social media ecosystem. Every time Meta updates an endpoint or changes a permission scope, you have to update your server code, redeploy, and test the integration. This guide breaks down exactly how to use Truto to generate a secure, managed MCP server for Instagram, connect it natively to Claude, and execute complex social workflows using natural language.
The Engineering Reality of the Instagram API
A custom MCP server is a self-hosted integration layer. While the open MCP standard provides a predictable way for models to discover tools, the reality of implementing it against the Instagram Graph API is painful.
If you decide to build a custom MCP server for Instagram, you own the entire API lifecycle. Here are the specific challenges you will face:
The Token Exchange Maze Instagram does not issue permanent tokens. Standard OAuth grants yield a short-lived user access token that expires in exactly one hour. To maintain persistent access for your AI agents, your infrastructure must proactively exchange this short-lived token for a long-lived token (valid for 60 days) via server-side code including the app secret. Then, you must build a chron-based worker to periodically refresh that long-lived token before the 60-day window closes. A managed MCP server abstracts this completely—Truto handles the token exchange and refresh lifecycle natively, ensuring Claude never loses access mid-workflow.
Two-Step Media Publishing
You cannot simply POST an image and a caption to an endpoint to publish a post. Instagram enforces an asynchronous two-step containerization process. First, you create an IG Container for your media (image, reel, story, or carousel). This container must be processed by Instagram's servers. You must wait for its status to reach FINISHED. Only then can you call the media publish endpoint using the container's creation ID. Containers expire in 24 hours. Building the state logic to track this asynchronous workflow inside a custom MCP server is complex.
Punitive and Complex Rate Limits Instagram enforces multiple layers of rate limits that do not follow standard REST patterns. For example, the hashtag search API strictly limits you to 30 unique hashtag queries within a rolling 7-day period. Media publishing restricts you to 400 container creations per rolling 24-hour window per account.
Note on Rate Limit Handling: Truto does not automatically retry, throttle, or apply backoff logic on rate limit errors. When the Instagram API returns an HTTP 429 Too Many Requests, Truto passes that error directly to the caller. However, Truto normalizes the upstream rate limit information into standardized IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). The caller (your agent framework) is responsible for reading these headers and implementing the appropriate retry and backoff logic.
Media-Specific Interaction Restrictions Not all media objects behave the same way. You cannot delete a single child image from a carousel post (you must delete the entire carousel). You cannot post or fetch comments on Live Video media. An LLM interacting with raw Instagram APIs will frequently encounter these exceptions and crash. Truto's dynamic tool schemas explicitly map out these constraints so Claude understands what is—and isn't—possible before executing a tool call.
How to Generate an Instagram MCP Server with Truto
Truto dynamically generates MCP tools based on an integration's available resources and documentation. You can generate an MCP server for Instagram in two ways: via the Truto UI or programmatically via the API.
Method 1: Via the Truto UI
This is the fastest method for internal teams and prompt engineers who need immediate access to an authenticated Instagram account.
- Navigate to the integrated account page for your connected Instagram instance in the Truto dashboard.
- Click the MCP Servers tab.
- Click Create MCP Server.
- Configure the server (give it a name, restrict it to specific tags or HTTP methods, and optionally set an expiration date).
- Copy the generated MCP server URL (e.g.,
https://api.truto.one/mcp/a1b2c3d4e5f6...).
Method 2: Via the API
For production workflows, you should generate MCP servers programmatically. Truto validates the integration, generates a secure, hashed token, stores it in distributed state, and returns a ready-to-use URL.
Execute a POST request to the /integrated-account/:id/mcp endpoint:
const response = await fetch('https://api.truto.one/integrated-account/<INTEGRATED_ACCOUNT_ID>/mcp', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_TRUTO_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
name: "Instagram Social Listening Server",
config: {
methods: ["read", "write"], // Allow reading comments and posting replies
tags: ["social", "comments"]
},
expires_at: "2026-12-31T23:59:59Z"
})
});
const mcpServer = await response.json();
console.log(mcpServer.url); // The URL your AI agent will connect toHow to Connect the MCP Server to Claude
Once you have your Truto MCP URL, you can plug it directly into your AI environment. Because the URL contains a cryptographic token that securely identifies the exact Instagram account, no additional authentication is required by default.
Method 1: Via the UI (Claude Desktop, Web, or ChatGPT)
For Claude:
- Go to Settings → Integrations → Add MCP Server (or Custom Connectors).
- Paste your Truto MCP URL.
- Click Add. Claude will instantly handshake with the server and list the available Instagram tools.
For ChatGPT (Requires Developer Mode):
- Go to Settings → Apps → Advanced settings.
- Enable Developer mode.
- Under MCP servers / Custom connectors, add a new server.
- Name it (e.g., "Instagram Automation"), paste the Truto URL, and save.
Method 2: Via Manual Configuration File
If you are using Claude Desktop locally or deploying a custom agent framework via Docker, you can configure the MCP connection using a JSON config file. Because Truto acts as an SSE (Server-Sent Events) transport, you use the official MCP SSE client wrapper to proxy the connection.
Update your claude_desktop_config.json:
{
"mcpServers": {
"instagram_mcp": {
"command": "npx",
"args": [
"-y",
"@modelcontextprotocol/server-sse",
"https://api.truto.one/mcp/<YOUR_TRUTO_TOKEN>"
]
}
}
}Restart Claude Desktop, and the model will have immediate read/write access to your Instagram APIs.
Instagram Hero Tools
Truto exposes the Instagram Graph API as a flat, predictable namespace of snake_case tools. Here are the core tools you need to build advanced social automation.
list_all_instagram_instagram_media_comments
Fetches up to 50 top-level comments on a specific Instagram media object. Replies to comments are not included in this list and must be fetched separately.
"Fetch the latest comments on media ID 1798345123490. Identify any comments asking about pricing or shipping times."
create_a_instagram_instagram_media_comment
Posts a top-level comment on an Instagram media object. Note that this tool will fail if you attempt to use it on an Instagram Live video.
"Post a comment on media ID 1798345123490 saying 'Our new summer collection drops next week! Check the link in our bio for details.'"
create_a_instagram_instagram_mention
Creates a direct reply when your IG User is @mentioned in another user's caption or comment. If you are replying to a comment rather than a caption, you must provide the comment_id in addition to the media_id.
"I was mentioned in media ID 180029348. Post a reply saying 'Thanks for the shoutout! We love seeing how you style our gear.'"
instagram_instagram_hashtags_search
Searches for an Instagram hashtag by name to retrieve its static, global IG Hashtag ID. Be cautious: this is limited to 30 unique hashtag queries within a rolling 7-day period.
"Search for the hashtag '#EnterpriseSaaS' and return its global Hashtag ID so we can monitor related media."
list_all_instagram_instagram_user_insights
Retrieves insight metrics for an Instagram business or creator account (e.g., follower counts, reach, profile views). Some demographic metrics require a timeframe and a minimum of 100 followers to return data.
"Pull my Instagram user insights for the last 28 days. Show me total reach and profile views."
create_a_instagram_instagram_media
Step one of the publishing process. Creates an Instagram media container (image, carousel, story, or reel) on the backend. This returns an id that must be used in the publish step.
"Create an Instagram media container for a new image post. Here is the URL of the image and the caption I want to use."
instagram_instagram_media_publish
Step two of the publishing process. Takes the container ID generated from the previous step and publishes it live to the Instagram Business account. The container must have reached FINISHED status.
"Publish the Instagram media container with creation ID 17992039485. Confirm when the post is live."
Workflows in Action
Connecting Instagram to Claude allows you to chain multiple endpoints together into autonomous routines. Here is how an AI agent executes real-world social media operations.
Workflow 1: Automated Mention Response & Crisis Mitigation
When managing a brand, speed is critical. You can task Claude with monitoring mentions, analyzing sentiment, and responding immediately.
"Check the latest media where our account was mentioned. If the user is reporting an issue or complaining, reply acknowledging the problem and asking them to DM us. If it is positive, thank them for their support."
Execution Steps:
list_all_instagram_instagram_tagged_media: Claude fetches the list of IG Media objects where the brand was tagged.list_all_instagram_instagram_media_comments: For the relevant media, Claude reads the comments to understand context and sentiment.create_a_instagram_instagram_mention: Based on the analysis, Claude crafts a context-aware reply (either a support redirection or a positive acknowledgment) and posts it referencing the specificmedia_id.
What the user gets: A fully automated social triage system that handles Tier-1 interactions natively on Instagram, escalating only complex issues to human agents.
Workflow 2: The Two-Step Content Publishing Pipeline
Because Instagram restricts direct single-call publishing, your AI agent must handle the asynchronous state required to push content live.
"I need to publish our weekly update post. Create the media container using this image URL and the draft caption. Wait until the container is ready, then publish it."
sequenceDiagram
participant Claude as Claude Desktop
participant Truto as Truto MCP Server
participant IG as Instagram Graph API
Claude->>Truto: Call create_a_instagram_instagram_media
Truto->>IG: POST /ig_user_id/media (Container)
IG-->>Truto: Returns Container ID (status: IN_PROGRESS)
Truto-->>Claude: Container ID
Note over Claude,IG: Claude waits, optionally polls status
Claude->>Truto: Call instagram_instagram_media_publish (Container ID)
Truto->>IG: POST /ig_user_id/media_publish
IG-->>Truto: Returns Published Post ID
Truto-->>Claude: Success ConfirmationExecution Steps:
create_a_instagram_instagram_media: Claude initiates the upload, passing the image URL and caption. The API returns a container ID.- State Management: Claude retains the container ID in its context window.
instagram_instagram_media_publish: Once instructed (or after a logical pause), Claude calls the publish endpoint using the container ID to push the post live.
What the user gets: A reliable, natural-language interface for scheduling and publishing Instagram content without having to navigate Meta's complex Business Manager.
Security and Access Control
When granting LLMs read/write access to production social media accounts, security is paramount. Truto's MCP architecture provides multiple layers of defense to prevent catastrophic prompt injections (like an agent accidentally deleting all posts).
- Method Filtering: Restrict an MCP server to read-only operations by setting
methods: ["read"]. The agent can fetch insights and read comments, but the server physically drops anycreate,update, ordeletetools during generation. - Tag Filtering: Group resources by function. You can restrict an MCP server to only interact with resources tagged
comments, keeping it entirely isolated from yoursettingsorpublishingresources. - Time-to-Live (TTL): Create temporary access by passing an
expires_atISO string. The underlying token storage and distributed scheduling infrastructure automatically destroy the server credentials when the TTL hits. - Secondary Authentication (
require_api_token_auth): For maximum security, enable this flag. The caller must not only possess the secret MCP URL but must also pass a valid Truto API token via aBearerheader, ensuring only authorized internal systems can trigger tool executions.
The Agentic Future of Social Media Management
Building a custom MCP server for the Instagram Graph API is an exercise in managing technical debt. You are forced to deal with short-lived tokens, undocumented error schemas, 24-hour container expirations, and rolling 7-day rate limits.
By using Truto to generate your MCP server, you offload the authentication lifecycle, rate-limit header normalization, and schema generation to a managed infrastructure layer. You get a production-ready, highly secure JSON-RPC 2.0 endpoint that connects natively to Claude, allowing your engineering team to focus on building intelligent agent behavior rather than reading Meta's API documentation.
Stop writing boilerplate API wrappers. Connect Instagram to Claude today using Truto.
FAQ
- How does Truto handle Instagram API rate limits?
- Truto passes HTTP 429 errors directly to the caller but normalizes the upstream rate limit information into standard IETF headers (ratelimit-limit, ratelimit-remaining, ratelimit-reset). The caller is responsible for implementing retry and backoff logic.
- Can I restrict my Instagram MCP server to read-only operations?
- Yes. When generating the MCP server via the Truto API or UI, you can apply method filtering (e.g., methods: ["read"]) to ensure the AI agent can only read comments and insights, completely blocking write or delete actions.
- Does Truto handle Instagram's short-lived tokens automatically?
- Yes. Truto natively handles the complex token exchange process, automatically converting short-lived tokens into 60-day long-lived tokens and refreshing them before they expire, ensuring your AI agents never lose access.
- How do I connect the Truto MCP server to Claude Desktop?
- You can add the MCP server URL directly via Claude's Integrations settings UI, or configure it manually using the claude_desktop_config.json file and the @modelcontextprotocol/server-sse transport.