Instagram DM
The Instagram DM MCP Server connects your Instagram account to Claude Desktop or Cursor AI, and allows direct message functionality through natural language.
Features
- 📤 Send Direct Messages: Send Instagram DMs to any user by username
- 💬 List Conversations: Retrieve all DM threads with filtering and pagination options
- 📋 Message History: Access complete message histories from specific threads
- 🔍 Search Functionality: Search through DM threads by username or keywords
- 📨 Pending Messages: Access and manage pending message requests
- 👤 User Management: Convert between usernames and user IDs
- 🔗 Thread Management: Get detailed thread information and participant data
- 🎯 Thread Targeting: Find specific conversations by participant user IDs
Use Cases
- Social Media Management: Agencies managing multiple Instagram accounts can automate client communications and response workflows
- Customer Support: Businesses can integrate Instagram DM responses into their existing support systems and track conversation metrics
- Content Creator Tools: Influencers and creators can build automated systems to handle fan interactions, collaboration requests, and partnership discussions
- E-commerce Integration: Online stores can connect Instagram DMs to their order management systems for customer inquiries and support
How To Use It
1. Clone the repository from GitHub and navigate into the directory.
git clone https://github.com/trypeggy/instagram_dm_mcp.git
cd instagram_dm_mcp2. Install Dependencies with pip.
pip install -r requirements.txt3. You need to give the server your Instagram username and password. The recommended way is to use the provided setup script, which creates a secure .env file for you.
python setup_env.pyThe script will ask for your username and password and handle the rest.
4. Tell your AI assistants where to find the MCP server. You create a JSON configuration file for this.
- For Claude Desktop: Create a file at
~/Library/Application Support/Claude/claude_desktop_config.json - For Cursor: Create a file at
~/.cursor/mcp.json
Copy this JSON into your new file. You must replace {{PATH_TO_SRC}} with the full absolute path to the instagram_dm_mcp folder you cloned. For example: /Users/yourname/Code/instagram_dm_mcp.
{
"mcpServers": {
"instagram_dms": {
"command": "python",
"args": [
"{{PATH_TO_SRC}}/src/mcp_server.py"
]
}
}
}5. Close and reopen Claude or Cursor. The Instagram DM tool should now appear as an available integration.
Available Tools
| Tool Name | Description |
|---|---|
send_message | Send an Instagram direct message to a user by username. |
list_chats | Get Instagram Direct Message threads (chats). |
list_messages | Get messages from a specific Instagram DM thread. |
list_pending_chats | Get DM threads from your pending inbox. |
search_threads | Search DM threads by username or keyword. |
get_thread_by_participants | Get a DM thread by participant user IDs. |
get_thread_details | Get details and messages for a specific DM thread. |
get_user_id_from_username | Get the Instagram user ID for a given username. |
get_username_from_user_id | Get the Instagram username for a given user ID. |
FAQs
Q: Can I use this with multiple Instagram accounts?
A: Currently, the server supports one Instagram account per configuration. You’ll need separate installations for multiple accounts.
Q: Is there a rate limit for sending messages?
A: Instagram has internal rate limits to prevent spam. The server respects these limits, but excessive usage might trigger Instagram’s anti-spam measures.
Q: Can I retrieve messages from archived conversations?
A: The server accesses your standard inbox and pending messages. Archived conversations might not be accessible through the current implementation.
Q: What authentication method does the server use?
A: The server uses your Instagram username and password for authentication. Environment variables are recommended for security.
Q: Does this work with Instagram Business accounts?
A: Yes, the server works with personal, creator, and business Instagram accounts that have direct messaging enabled.
Q: What data does the server store locally?
A: The server doesn’t store message data locally. It acts as a bridge between Claude and Instagram’s live data.
Q: The server isn’t showing up in Claude after I restarted. What’s wrong?
A: The most common mistake is the path in the claude_desktop_config.json file. Double-check that you’ve replaced {{PATH_TO_SRC}} with the complete, absolute path to the project folder. Another issue could be your Python environment. Make sure you are running the correct version and that the dependencies installed correctly.
Latest MCP Servers
Notion
Log Mcp
Apple
Featured MCP Servers
Notion
Claude Peers
Excalidraw
FAQs
Q: What exactly is the Model Context Protocol (MCP)?
A: MCP is an open standard, like a common language, that lets AI applications (clients) and external data sources or tools (servers) talk to each other. It helps AI models get the context (data, instructions, tools) they need from outside systems to give more accurate and relevant responses. Think of it as a universal adapter for AI connections.
Q: How is MCP different from OpenAI's function calling or plugins?
A: While OpenAI's tools allow models to use specific external functions, MCP is a broader, open standard. It covers not just tool use, but also providing structured data (Resources) and instruction templates (Prompts) as context. Being an open standard means it's not tied to one company's models or platform. OpenAI has even started adopting MCP in its Agents SDK.
Q: Can I use MCP with frameworks like LangChain?
A: Yes, MCP is designed to complement frameworks like LangChain or LlamaIndex. Instead of relying solely on custom connectors within these frameworks, you can use MCP as a standardized bridge to connect to various tools and data sources. There's potential for interoperability, like converting MCP tools into LangChain tools.
Q: Why was MCP created? What problem does it solve?
A: It was created because large language models often lack real-time information and connecting them to external data/tools required custom, complex integrations for each pair. MCP solves this by providing a standard way to connect, reducing development time, complexity, and cost, and enabling better interoperability between different AI models and tools.
Q: Is MCP secure? What are the main risks?
A: Security is a major consideration. While MCP includes principles like user consent and control, risks exist. These include potential server compromises leading to token theft, indirect prompt injection attacks, excessive permissions, context data leakage, session hijacking, and vulnerabilities in server implementations. Implementing robust security measures like OAuth 2.1, TLS, strict permissions, and monitoring is crucial.
Q: Who is behind MCP?
A: MCP was initially developed and open-sourced by Anthropic. However, it's an open standard with active contributions from the community, including companies like Microsoft and VMware Tanzu who maintain official SDKs.



