Instagram DM MCP server
This is a Model Context Protocol (MCP) server for sending instagram Direct Messages.
With this you can send Instagram Direct Messages from your account (more capabilities coming soon).
Here's an example of what you can do when it's connected to Claude.
https://github.com/user-attachments/assets/9c945f25-4484-4223-8d6b-5bf31243464c
To get updates on this and other projects we work on enter your email here
Installation
Prerequisites
- Python 3.11+
- Anthropic Claude Desktop app (or Cursor)
- Pip (Python package manager), install with
python -m pip install - An instagram account
Steps
Clone this repository
git clone https://github.com/trypeggy/instagram_dm_mcp.git cd instagram_dm_mcpInstall dependencies
- Using uv (recommended):
uv sync - Using Pip:
pip install -r requirements.txt
Configure Instagram credentials
You have two options for providing your Instagram credentials:
Option A: Environment Variables (Recommended)
Quick Setup (Recommended):
Run the helper script:
python setup_env.pyThis will interactively prompt you for your credentials and create the
.envfile securely.Manual Setup:
Create a
.envfile in the project root:cp env.example .envThen edit
.envwith your actual credentials:INSTAGRAM_USERNAME=your_instagram_username INSTAGRAM_PASSWORD=your_instagram_passwordOption B: Command Line Arguments
You can still pass credentials as command line arguments (less secure).
Connect to the MCP server
For Claude Desktop:
Save this as
claude_desktop_config.jsonin your Claude Desktop configuration directory at:~/Library/Application Support/Claude/claude_desktop_config.jsonFor Cursor:
Save this as
mcp.jsonin your Cursor configuration directory at:~/.cursor/mcp.jsonConfiguration with Environment Variables (Recommended):
- Using uv
{ "mcpServers": { "instagram_dms": { "command": "uv", "args": [ "run", "--directory", "PATH/TO/instagram_dm_mcp", "python", "src/mcp_server.py" ] } } }- Using Python
{ "mcpServers": { "instagram_dms": { "command": "python", "args": [ "{{PATH_TO_SRC}}/instagram_dm_mcp/src/ mcp_server.py" ] } } }Configuration with Command Line Arguments:
{ "mcpServers": { "instagram_dms": { "command": "python", "args": [ "{{PATH_TO_SRC}}/instagram_dm_mcp/src/mcp_server.py", "--username", "{{YOUR_INSTAGRAM_USERNAME}}", "--password", "{{YOUR_INSTAGRAM_PASSWORD}}" ] } } }Restart Claude Desktop / Cursor
Open Claude Desktop and you should now see the Instagram DM MCP as an available integration.
Or restart Cursor.






