mcp-instagram-dm
Allows AI assistants to read, send, search, and manage Instagram Direct Messages. Provides tools for inbox management, thread operations, message sending, user searches, and conversation monitoring including pending requests and message reactions.
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
π¨ MCP Instagram DM
Control your Instagram DMs with AI
Read, send, search, and manage Instagram Direct Messages through natural language with any MCP-compatible AI assistant.
A Model Context Protocol server that bridges Instagram Direct Messages with AI assistants like Claude, Cursor, and any MCP-compatible client.
Cookie-based authentication β no API keys, no OAuth, just works.
Getting Started Β· Features Β· Configuration Β· Tools Reference Β· Contributing
π‘ If you find this useful, please consider giving it a β β it helps others discover the project!
β‘ Getting Started
Get up and running in under 60 seconds:
1. Add to your MCP config (Claude Desktop, Claude Code, or Cursor):
{
"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"
}
}
}
}2. Talk to your AI assistant:
"Read my Instagram DMs"
That's it β you're ready. π
Need help getting your cookies? See Configuration below.
Related MCP server: Instagram DM MCP server
π¬ What It Looks Like
You: "Show me my unread Instagram DMs"
Claude: Fetching your inbox...
π¬ Inbox (3 conversations)
[UNREAD] john_doe (thread_id: 340282366841710300...)
Last: [2026-03-29 14:23:01] john_doe: Hey, are you free tonight?
[UNREAD] [GROUP] project_team (thread_id: 340282366841710301...)
Last: [2026-03-29 13:45:22] alice: Meeting moved to 3pm
jane_smith (thread_id: 340282366841710302...)
Last: [2026-03-29 10:12:45] You: Thanks! See you then
You: "Reply to john_doe: Yeah, let's meet at 7!"
Claude: β
Message sent: "Yeah, let's meet at 7!"β¨ Features
15 tools across three categories β everything you need to manage your Instagram DMs:
π₯ Read & Monitor
Tool | Description |
| List recent DM conversations with unread/group/muted indicators |
| Get messages from a conversation (auto-paginates β fetch 500+ messages at once) |
| List pending DM requests waiting for your approval |
| Get any user's profile: bio, followers, posts, verification |
| Thread metadata: participants, group info, mute/archive status |
βοΈ Send & Manage
Tool | Description |
| Send a text message in any thread |
| Share a URL with optional caption |
| Start a new DM with one or multiple users |
| React to any message with any emoji |
| Unsend your own messages |
| Mark a conversation as read |
| Approve a pending DM request |
π Search & Discover
Tool | Description |
| Search conversations by username or name (scans all pages) |
| Find messages containing specific text within a thread |
| Search Instagram users to start new conversations |
π¦ Installation
npx (recommended β zero install)
npx mcp-instagram-dmnpm global
npm install -g mcp-instagram-dm
mcp-instagram-dmFrom 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.com in Chrome and log in
Press
F12β Application tab β Cookies βhttps://www.instagram.comCopy these three values:
Cookie Name | Environment Variable | Description |
|
| Your session token |
|
| CSRF protection token |
|
| Your numeric user ID |
π‘ Tip: You can also run
node get-cookies.jsfor a guided walkthrough.
Environment Variables
Variable | Required | Default | Description |
| β | β | Your Instagram session cookie |
| β | β | CSRF token from cookies |
| β | β | Your numeric user ID |
| β |
| Delay between paginated API requests (ms) |
Client Setup
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"
}
}
}
}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"
}
}
}
}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"
}
}
}
}π¬ Usage Examples
Just talk naturally to your AI assistant:
What you say | What happens |
"Read my unread Instagram DMs" | Fetches inbox with unread indicators |
"Send 'Hey!' to @username" | Finds the thread and sends the message |
"Search my DMs for messages about 'meeting'" | Scans thread messages for the keyword |
"Start a new conversation with @johndoe" | Creates a new thread and sends your message |
"Show me pending DM requests and approve them" | Lists and approves pending requests |
"What's @user's profile info?" | Fetches full profile details |
"Get the last 200 messages with @friend" | Auto-paginates to fetch all messages |
"React with π₯ to the last message" | Sends emoji reaction to any message |
π Tools Reference
Tool | Description | Parameters |
| List DM conversations |
|
| Get thread messages (auto-paginates) |
|
| List pending requests |
|
| Get user profile |
|
| Get thread details |
|
| Send text message |
|
| Share a URL |
|
| Start new DM |
|
| React with emoji |
|
| Unsend a message |
|
| Mark as read |
|
| Approve request |
|
| Search conversations |
|
| Search within thread |
|
| Find users |
|
ποΈ Architecture
βββββββββββββββββββββββ MCP (stdio) ββββββββββββββββββββββββ
β AI Assistant βββββββββββββββββββββΊβ MCP Server β
β (Claude, Cursor) β β src/index.ts β
βββββββββββββββββββββββ β 15 tools β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββΌββββββββββββ
β Instagram Client β
β src/instagram.ts β
β Cookie auth + HTTP β
ββββββββββββ¬ββββββββββββ
β
ββββββββββββΌββββββββββββ
β Instagram Web API β
β (Private endpoints) β
ββββββββββββββββββββββββDesign principles:
Single dependency β only
@modelcontextprotocol/sdk. No axios, no puppeteer, no bloat.TypeScript strict β zero
anytypes, fully typed interfaces insrc/types.tsAuto-pagination β request 500 messages and the server handles the rest with rate limiting
14+ message types β text, media, voice, reels, links, clips, GIFs, posts, stories, and more
π Security
Session cookies are never logged or stored beyond runtime
All credentials are read from environment variables only
No data is sent to any third-party service
See SECURITY.md for reporting vulnerabilities
β οΈ 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 or commit them
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 development setup and guidelines.
If you'd like to support the project financially, consider sponsoring on GitHub.
π License
MIT β Made with β€οΈ by Kynux
If this project helped you, consider giving it a β
This server cannot be deployed
Maintenance
Related MCP Connectors
Instagram MCP for DM and comment automation, AI Agent and content publishing via Meta's official API
Hosted MCP server for DataLikers β Instagram & TikTok data API. 51 tools: Instagram user search by demographics (gender/age/race/country/city), profiles, bulk lookup, engagement, posts & reels, comments, hashtags, locations, stories, highlights, music, business accounts, top users; TikTok users, videos, comments, hashtags, playlists and top charts. Streamable HTTP, Bearer API key. Free tier: 100 requests on signup at https://datalikers.com/p/1by27bwg
Unified messaging MCP server: WhatsApp, Instagram, Telegram, SMS, Messenger & email support inbox
Hosted Instagram MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Related MCP Servers
- FlicenseNot gradedqualityAmaintenanceEnables sending text, photo, and video Instagram Direct Messages and managing chats, messages, media downloads, users, stories, followers, following, posts, and likes through MCP tools.-
- FlicenseNot gradedqualityAmaintenanceEnables users to send, retrieve, search, and manage Instagram Direct Messages and related media, threads, users, stories, likes, followers, following, and posts from their Instagram account through MCP tools.-
- FlicenseNot gradedqualityAmaintenanceEnables sending and managing Instagram Direct Messages, including text, photo, and video messages, listing and searching chats, downloading media from messages, and retrieving user, follower, story, and post information through MCP-connected clients.-
- FlicenseNot gradedqualityAmaintenanceEnables sending Instagram Direct Messages from your account and managing chats, messages, media, users, stories, followers, and related interactions through MCP tools.-