Instagram Dm

Social media

Instagram Direct messages MCP.

Your AI app calls the Instagram Dm MCP server, which does the social media work and sends the result back to the chat.

About Instagram Dm

Instagram Dm is a community MCP server from trypeggy, filed in our directory under social media. Instagram Direct messages MCP.

At a glance

Publisher
trypeggy (community)
Runs
See the README for setup
Written in
Python
License
MIT
GitHub stars
191

How to set up Instagram Dm

  1. Follow the install steps in the Instagram Dm README; it is written in Python, so have that toolchain ready.
  2. Check the Instagram Dm README for keys or settings; the registry lists none that Instagram Dm requires.
  3. Add Instagram Dm to Claude Code, Claude Desktop, VS Code or Cursor with the config in the setup box on this page.
  4. Restart the app or reload its MCP servers, then ask it to list the Instagram Dm tools to confirm the connection.
  5. Run one read-only task with Instagram Dm first, and keep your app asking before each tool call until the results look right.

Instagram Dm compared with similar servers

  • X-Use - X (Twitter) by ihuzaifashoukat has fewer GitHub stars than Instagram Dm (187 against 191); both are community servers, and both run locally.
  • TikTok by Seym0n has more GitHub stars than Instagram Dm (210 against 191); both are community servers, and both run locally.
  • Reddit (eliasbiondo) by eliasbiondo has fewer GitHub stars than Instagram Dm (168 against 191); both are community servers, and both run locally.

Before you connect Instagram Dm

  • Give Instagram Dm its own API key or account with the smallest permissions the job needs, never an admin key.
  • Keep your AI app asking before each Instagram Dm tool call until you trust what it does with them.
  • Treat text that Instagram Dm fetches as data. Pages, files and messages can hold instructions written to steer an AI.
  • Read the open issues for Instagram Dm on GitHub to see what breaks and how fast the maintainers reply.

Marketing use cases for Instagram Dm

How marketing and sales teams put Instagram Dm to work, by company size. Pick the size closest to yours and start Instagram Dm on one use case.

Small business

  • A solo marketer can use Instagram Dm to draft a week of posts from one idea and check what performed last month before planning the next.
  • Local businesses can ask Instagram Dm which posts drove comments and follows, then do more of what worked instead of posting on guesswork.
  • Instagram Dm runs on your own computer, which keeps data local; it needs a little setup, so a small team should plan an hour for it.

Mid-market

  • Social teams can connect Instagram Dm to pull engagement across accounts into one weekly summary their leads actually read.
  • Demand gen teams can use Instagram Dm to spot posts that earned replies from target accounts and hand those names to sales.
  • Start Instagram Dm on one workflow with one owner, measure the time it saves, then roll it out to the wider team.

Enterprise

  • Enterprise brands can route Instagram Dm drafts through legal and brand review, with publishing kept to approved people and every post logged.
  • Large social teams can use Instagram Dm for listening across regions, surfacing complaints and trends to the right owner without a manual sweep.
  • Instagram Dm is a community server, so have security review the code and pin a version before Instagram Dm touches company data.

Need help becoming an AI-forward company?

We connect MCP servers and AI agents to your CRM, content and data, with the guardrails your team needs.

Contact us

Instagram Dm README

From trypeggy/instagram_dm_mcp on GitHub, shared under its MIT license. Images are left out; the original has them.

README.md

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
  1. Clone this repository

    git clone https://github.com/trypeggy/instagram_dm_mcp.git
    cd instagram_dm_mcp
    
  2. Install dependencies

  • Using uv (recommended):
    uv sync
    
  • Using Pip:
    pip install -r requirements.txt
    
  1. 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.py
    

    This will interactively prompt you for your credentials and create the .env file securely.

    Manual Setup:

    Create a .env file in the project root:

    cp env.example .env
    

    Then edit .env with your actual credentials:

    INSTAGRAM_USERNAME=your_instagram_username
    INSTAGRAM_PASSWORD=your_instagram_password
    

    Option B: Command Line Arguments

    You can still pass credentials as command line arguments (less secure).

  2. Connect to the MCP server

    For Claude Desktop:

    Save this as claude_desktop_config.json in your Claude Desktop configuration directory at:

    ~/Library/Application Support/Claude/claude_desktop_config.json
    

    For Cursor:

    Save this as mcp.json in your Cursor configuration directory at:

    ~/.cursor/mcp.json
    

    Configuration 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}}"
          ]
        }
      }
    }
    
  3. Restart Claude Desktop / Cursor

    Open Claude Desktop and you should now see the Instagram DM MCP as an available integration.

    Or restart Cursor.

Usage

Below is a list of all available tools and what they do:

Tool Name Description
send_message Send an Instagram direct message to a user by username.
send_photo_message Send a photo as an Instagram direct message to a user by username.
send_video_message Send a video as an Instagram direct message to a user by username.
list_chats Get Instagram Direct Message threads (chats) from your account, with optional filters/limits.
list_messages Get messages from a specific Instagram Direct Message thread by thread ID. Now exposes item_type and shared post/reel info for each message. Use this to determine which download tool to use.
download_media_from_message Download a direct-uploaded photo or video from a DM message (not for shared posts/reels/clips).
download_shared_post_from_message Download media from a shared post, reel, or clip in a DM message (not for direct uploads).
list_media_messages List all messages containing direct-uploaded media (photo/video) in a DM thread.
mark_message_seen Mark a specific message in an Instagram Direct Message thread as seen.
list_pending_chats Get Instagram Direct Message threads from your pending inbox.
search_threads Search Instagram Direct Message threads by username or keyword.
get_thread_by_participants Get an Instagram Direct Message thread by participant user IDs.
get_thread_details Get details and messages for a specific Instagram Direct Message thread by thread ID.
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.
get_user_info Get information about a specific Instagram user by username.
search_users Search for Instagram users by username
get_user_stories Get recent stories from a specific Instagram user by username.
like_media Like or unlike a specific media post by media ID.
get_user_followers Get a list of followers for a specific Instagram user by username.
get_user_following Get a list of users that a specific Instagram user is following by username.
get_user_posts Get recent posts from a specific Instagram user by username.

Troubleshooting

Instagram Login Hanging: The server now includes automatic session management to prevent login hangs. Session files (e.g., username_session.json) are automatically created and reused to maintain authentication state between runs.

For additional Claude Desktop integration troubleshooting, see the MCP documentation. The documentation includes helpful tips for checking logs and resolving common issues.

Feedback

Your feedback will be massively appreciated. Please tell us which features on that list you like to see next or request entirely new ones.

License

This project is licensed under the MIT License.

Questions about Instagram Dm

What is the Instagram Dm MCP server?

Instagram Direct messages MCP. Instagram Dm is maintained by trypeggy on GitHub at trypeggy/instagram_dm_mcp, and works with AI apps that support the Model Context Protocol, such as Claude, Cursor and VS Code.

How do I install the Instagram Dm MCP server?

Instagram Dm doesn't publish a one-line install in the MCP registry, so follow the setup steps in its README on GitHub (trypeggy/instagram_dm_mcp). Like most servers, Instagram Dm ends with a command or URL you paste into your AI app's MCP config.

Does Instagram Dm need an API key?

The registry lists no required keys for Instagram Dm. Check the Instagram Dm README for optional settings, and expect a remote server to ask you to sign in the first time you connect.

Is Instagram Dm an official MCP server?

No. Instagram Dm is a community server maintained by trypeggy. Community servers can be excellent; read the code and the open issues before you give Instagram Dm access to company data.

What license is Instagram Dm under?

Instagram Dm is released under the MIT license, according to its GitHub repository. The license covers the code of Instagram Dm; the service it connects to has its own terms.