๐จ 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.
๐ฌ 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
โ๏ธ Send & Manage
๐ Search & Discover
๐ฆ Installation
npx (recommended โ zero install)
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.com in Chrome and log in
- Press
F12โ Application tab โ Cookies โhttps://www.instagram.com - Copy these three values:
๐ก Tip: You can also run
node get-cookies.jsfor a guided walkthrough.
Environment Variables
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:
๐ Tools Reference
๐๏ธ 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.ts - Auto-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 โญ