instagram_dm_mcp
Instagram Direct messages MCP
claude mcp add --transport stdio trypeggy-instagram_dm_mcp uv run --directory PATH/TO/instagram_dm_mcp python src/mcp_server.py \ --env INSTAGRAM_PASSWORD="your_instagram_password" \ --env INSTAGRAM_USERNAME="your_instagram_username"
How to use
This MCP server enables programmatic control of your Instagram Direct Messages from within Claude (or other MCP-enabled clients). It exposes a suite of tools that let you send DMs, fetch threads and messages, download media from messages, manage read/status, and search or list conversations with your connected Instagram account. Tools like send_message, list_chats, list_messages, download_media_from_message, and get_user_info are designed to be called from within the MCP context to automate Instagram DM workflows or build chat-based automation.
To use it, connect the instagram_dms MCP server to your MCP client (Claude Desktop or Cursor) by configuring the mcpServers section as shown in the installation guidance. Provide your Instagram credentials (environment variables recommended) so the server can authenticate and access your DMs. Once configured and restarted, you’ll see instagram_dms as an available integration and can start issuing commands to perform actions such as sending messages, listing threads, or downloading media directly from DMs.
How to install
Prerequisites:
- Python 3.11+
- An Instagram account
- Pip (Python package manager)
- MCP client (Claude Desktop or Cursor) for integration
Steps:
- Clone the repository:
git clone https://github.com/trypeggy/instagram_dm_mcp.git
cd instagram_dm_mcp
- Create and activate a Python environment (optional but recommended):
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Configure credentials:
- Option A (recommended): Environment variables via .env or directly in mcp_config
- Option B: Provide credentials via command line arguments when launching (less secure)
- Run the MCP server locally using uv (recommended):
uv run --directory PATH/TO/instagram_dm_mcp python src/mcp_server.py
Alternatively, run with Python directly:
python src/mcp_server.py --username YOUR_INSTAGRAM_USERNAME --password YOUR_INSTAGRAM_PASSWORD
- Connect to Claude Desktop or Cursor and add the instagram_dms MCP server as described in the configuration steps. Restart the MCP client to enable the integration.
Additional notes
Tips and known considerations:
- Environment variables for credentials are preferred for security. Use INSTAGRAM_USERNAME and INSTAGRAM_PASSWORD in a .env file or via the mcp_config env section.
- If you run into authentication issues, ensure you’re using a valid Instagram account and that two-factor authentication is addressed by the login flow in the underlying Instagram client library used by the server.
- The provided tool set supports common DM operations: sending messages (send_message, send_photo_message, send_video_message), listing chats (list_chats, list_pending_chats, search_threads), retrieving thread details (get_thread_details, get_thread_by_participants), and media download capabilities (download_media_from_message, download_shared_post_from_message, list_media_messages).
- For Claude Desktop integration, place the configuration JSON in the specified path and restart the application to load the new MCP server. The same applies to Cursor via its mcp.json location.
- If you switch environments (uv vs direct Python), keep credentials consistent to avoid authentication drift between runs.
Related MCP Servers
edumcp
EDUMCP is a protocol that integrates the Model Context Protocol (MCP) with applications in the education field, dedicated to achieving seamless interconnection and interoperability among different AI models, educational applications, smart hardware, and teaching AGENTs.
lihil
2X faster ASGI web framework for python, offering high-level development, low-level performance.
facebook-ads-library
MCP Server for Facebook ADs Library - Get instant answers from FB's ad library
laravel-toon
TOON encoding for Laravel. Encode data for AI/LLMs with ~50% fewer tokens than JSON.
neurolink
Universal AI Development Platform with MCP server integration, multi-provider support, and professional CLI. Build, test, and deploy AI applications with multiple ai providers.
mcp-web-ui
MCP Web UI is a web-based user interface that serves as a Host within the Model Context Protocol (MCP) architecture. It provides a powerful and user-friendly interface for interacting with Large Language Models (LLMs) while managing context aggregation and coordination between clients and servers.