🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

mcp-instagram-dm

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mcp-instagram-dm

MCP server for Instagram Direct Messages — read inbox, send messages, search conversations, and manage DMs through AI assistants

latest
Source
npmnpm
Version
2.1.1
Version published
Weekly downloads
44
-21.43%
Maintainers
1
Weekly downloads
 
Created
Source

mcp-instagram-dm

npm version License: MIT Node.js

Read, send, and manage Instagram Direct Messages through AI assistants via the Model Context Protocol.

Works with personal Instagram accounts using cookie-based authentication. Supports reading conversations, sending messages, reacting, searching, and more — all through natural language with your AI assistant.

Quick Start

Claude Desktop / Claude Code

Add to your MCP config:

{
  "mcpServers": {
    "instagram": {
      "command": "npx",
      "args": ["-y", "mcp-instagram-dm"],
      "env": {
        "INSTAGRAM_SESSION_ID": "your_session_id",
        "INSTAGRAM_CSRF_TOKEN": "your_csrf_token",
        "INSTAGRAM_DS_USER_ID": "your_user_id"
      }
    }
  }
}

That's it. Ask Claude: "Read my Instagram DMs" and it works.

Features

Read

  • instagram_get_inbox — List recent DM conversations with unread indicators
  • instagram_get_thread — Get messages from a conversation (auto-paginates, e.g. fetch 500 messages at once)
  • instagram_get_pending — List pending DM requests
  • instagram_user_info — Get a user's profile details (bio, followers, posts)
  • instagram_thread_info — Get conversation metadata (participants, group info, mute status)

Write

  • instagram_send_message — Send a text message
  • instagram_send_link — Share a URL in a conversation
  • instagram_create_thread — Start a new DM with any user
  • instagram_like_message — React to a message with any emoji
  • instagram_unsend_message — Unsend your own messages
  • instagram_mark_seen — Mark a conversation as read
  • instagram_approve_pending — Approve a pending DM request
  • instagram_search_inbox — Search conversations by username or name
  • instagram_search_messages — Find messages containing specific text within a thread
  • instagram_search_users — Search Instagram users (to start new conversations)

Installation

npx mcp-instagram-dm

npm global

npm install -g mcp-instagram-dm
mcp-instagram-dm

From source

git clone https://github.com/Kynuxdev/mcp-instagram-dm.git
cd mcp-instagram-dm
npm install
npm run build
node dist/index.js

Configuration

Getting Your Cookies

  • Open Instagram in Chrome and log in
  • Press F12 to open DevTools
  • Go to Application tab > Cookies > https://www.instagram.com
  • Copy these values:
Cookie NameEnvironment Variable
sessionidINSTAGRAM_SESSION_ID
csrftokenINSTAGRAM_CSRF_TOKEN
ds_user_idINSTAGRAM_DS_USER_ID

Environment Variables

VariableRequiredDescription
INSTAGRAM_SESSION_IDYesYour Instagram session cookie
INSTAGRAM_CSRF_TOKENYesCSRF token from cookies
INSTAGRAM_DS_USER_IDYesYour numeric user ID
INSTAGRAM_RATE_LIMIT_MSNoDelay between paginated requests (default: 300ms)

Client Configuration

Claude Desktop

Edit ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows):

{
  "mcpServers": {
    "instagram": {
      "command": "npx",
      "args": ["-y", "mcp-instagram-dm"],
      "env": {
        "INSTAGRAM_SESSION_ID": "your_session_id",
        "INSTAGRAM_CSRF_TOKEN": "your_csrf_token",
        "INSTAGRAM_DS_USER_ID": "your_user_id"
      }
    }
  }
}
Claude Code

Add to your project's .mcp.json:

{
  "mcpServers": {
    "instagram": {
      "command": "npx",
      "args": ["-y", "mcp-instagram-dm"],
      "env": {
        "INSTAGRAM_SESSION_ID": "your_session_id",
        "INSTAGRAM_CSRF_TOKEN": "your_csrf_token",
        "INSTAGRAM_DS_USER_ID": "your_user_id"
      }
    }
  }
}
Cursor

Add to .cursor/mcp.json in your project:

{
  "mcpServers": {
    "instagram": {
      "command": "npx",
      "args": ["-y", "mcp-instagram-dm"],
      "env": {
        "INSTAGRAM_SESSION_ID": "your_session_id",
        "INSTAGRAM_CSRF_TOKEN": "your_csrf_token",
        "INSTAGRAM_DS_USER_ID": "your_user_id"
      }
    }
  }
}

Examples

Just talk to your AI assistant naturally:

  • "Read my unread Instagram DMs"
  • "Send 'Hey, are you free tonight?' to my conversation with @username"
  • "Search my DMs for messages about 'meeting'"
  • "Start a new conversation with @johndoe and say hello"
  • "Show me my pending DM requests and approve them"
  • "Get the profile info for user 12345678"

Tools Reference

ToolDescriptionKey Parameters
instagram_get_inboxList DM conversationslimit, cursor
instagram_get_threadGet thread messagesthread_id, limit (auto-paginates)
instagram_get_pendingList pending requestslimit, cursor
instagram_user_infoGet user profileuser_id (PK)
instagram_thread_infoGet thread detailsthread_id
instagram_send_messageSend text messagethread_id, text
instagram_send_linkShare a URLthread_id, url, text
instagram_create_threadStart new DMrecipient_ids, text
instagram_like_messageReact with emojithread_id, item_id, emoji
instagram_unsend_messageUnsend a messagethread_id, item_id
instagram_mark_seenMark as readthread_id, item_id
instagram_approve_pendingApprove requestthread_id
instagram_search_inboxSearch conversationsquery, max_pages
instagram_search_messagesSearch within threadthread_id, query, max_messages
instagram_search_usersFind usersquery

How It Works

This server uses Instagram's private web API (the same API the instagram.com website uses) with cookie-based authentication. It communicates with AI assistants through the Model Context Protocol (MCP) via stdio transport.

Architecture:

  • src/index.ts — MCP server with 15 tools
  • src/instagram.ts — Instagram API client
  • src/types.ts — TypeScript interfaces

Single dependency: Only @modelcontextprotocol/sdk. No axios, no puppeteer, no bloat.

Disclaimer

  • This project uses Instagram's unofficial web API, which may change without notice
  • Personal use only — do not use for spam, mass messaging, or automation that violates Instagram's Terms of Service
  • Your session cookies are sensitive credentials — never share them or commit them to version control
  • This project is not affiliated with, endorsed by, or connected to Meta or Instagram
  • Use at your own risk. The authors are not responsible for any account restrictions

Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

License

MIT

Keywords

mcp

FAQs

Package last updated on 04 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts