Skip to main content

MCP Server for full Instagram account control via AI agents — 68+ tools built with FastMCP + instagrapi

Project description

🤖 Instagram Control MCP Server

Let any AI agent fully control a real Instagram account — post, DM, follow, comment, search, and more.

Built with Python, instagrapi (private mobile API), and FastMCP.


✨ Features — 50+ Tools

🔐 Authentication

Tool Description
instagram_login_with_sessionid Login via browser cookie (recommended)
instagram_login_with_credentials Login via username + password
instagram_complete_2fa Submit 2FA authenticator code
instagram_complete_challenge Submit email/SMS challenge code
instagram_get_login_status Check active session
instagram_logout Logout and clear session

👤 Profile

Tool Description
instagram_get_profile Get profile info (any user)
instagram_edit_profile Edit bio, name, website
instagram_change_profile_picture Change profile picture

📸 Feed Posting

Tool Description
instagram_post_photo Post a photo with caption + location
instagram_post_album Post carousel (up to 10 items)
instagram_post_video Post a feed video
instagram_post_reel Post a Reel
instagram_delete_post Delete a post permanently
instagram_get_user_feed Get posts from any user
instagram_get_timeline_feed Get your home feed
instagram_get_media_info Get details of any post
instagram_download_post Download photo/video to disk

📖 Stories

Tool Description
instagram_post_photo_story Post a photo story
instagram_post_video_story Post a video story
instagram_get_user_stories Get active stories (any user)
instagram_delete_story Delete your story
instagram_get_story_viewers See who viewed your story

🌟 Highlights

Tool Description
instagram_get_highlights Get highlights of any account
instagram_create_highlight Create a new highlight
instagram_delete_highlight Delete a highlight

❤️ Engagement

Tool Description
instagram_like_post Like a post
instagram_unlike_post Unlike a post
instagram_save_post Save a post
instagram_unsave_post Unsave a post
instagram_get_post_likers See who liked a post
instagram_comment_on_post Post a comment
instagram_reply_to_comment Reply to a comment
instagram_delete_comment Delete a comment
instagram_like_comment Like a comment
instagram_get_post_comments Get all comments on a post

👥 Following & Relations

Tool Description
instagram_follow_user Follow a user
instagram_unfollow_user Unfollow a user
instagram_get_followers Get followers list
instagram_get_following Get following list
instagram_block_user Block a user
instagram_unblock_user Unblock a user
instagram_get_blocked_users See blocked accounts

💬 Direct Messages

Tool Description
instagram_get_direct_threads Get DM thread list
instagram_get_direct_messages Get messages in a thread
instagram_send_direct_message Send text DM
instagram_send_dm_photo Send photo DM
instagram_send_dm_video Send video DM
instagram_mark_thread_seen Mark thread as read

🔍 Search & Explore

Tool Description
instagram_search_users Search users by name/username
instagram_search_hashtag Get recent posts by hashtag
instagram_get_hashtag_top_posts Get top posts by hashtag
instagram_get_hashtag_info Get hashtag stats
instagram_get_similar_accounts Find similar accounts
instagram_get_location_posts Get posts from a location

🔔 Notifications & Activity

Tool Description
instagram_get_notifications Get likes, comments, follows, mentions
instagram_get_pending_follow_requests Get pending follow requests

🚀 Installation

1. Clone this repository

git clone https://github.com/YOUR_USERNAME/instagram-mcp.git
cd instagram-mcp

2. Create virtual environment & install dependencies

python -m venv venv

# Windows
venv\Scripts\pip install -r requirements.txt

# Mac/Linux
venv/bin/pip install -r requirements.txt

⚙️ Integration with AI Clients

Claude Desktop

Edit %APPDATA%\Claude\claude_desktop_config.json:

{
  "mcpServers": {
    "instagram-control": {
      "command": "C:\\path\\to\\instagram-mcp\\venv\\Scripts\\python.exe",
      "args": ["C:\\path\\to\\instagram-mcp\\mcp_server.py"]
    }
  }
}

Restart Claude Desktop. The Instagram tools will appear automatically.

Cursor IDE

  1. Open SettingsFeaturesMCP
  2. Click + Add New MCP Server
  3. Set:
    • Name: instagram-control
    • Type: command
    • Command: C:\path\to\instagram-mcp\venv\Scripts\python.exe C:\path\to\instagram-mcp\mcp_server.py

🔐 Logging In

Method 1: Session ID (Recommended — No 2FA, Most Stable)

  1. Log in to Instagram in your browser (Chrome/Firefox/Edge)
  2. Open DevTools (F12) → Application (Chrome) or Storage (Firefox)
  3. Navigate to Cookieshttps://www.instagram.com
  4. Find and copy the value of the sessionid cookie
  5. Tell your AI agent:

    instagram_login_with_sessionid(username="your_username", session_id="YOUR_COOKIE_VALUE")

Method 2: Username & Password

instagram_login_with_credentials(username="your_username", password="your_password")
  • If 2FA is required: call instagram_complete_2fa(code="123456")
  • If a challenge triggers: call instagram_complete_challenge(code="123456")

Session Persistence

After the first successful login, a instagram_session.json file is saved locally. On the next server start, the session is automatically restored — no re-authentication needed.


⚠️ Disclaimer

This project uses Instagram's unofficial private API (instagrapi). Usage violates Instagram's Terms of Service. Use responsibly — do not spam, harass, or automate high-frequency actions. The authors are not responsible for any account suspension or ban resulting from use of this software.


🛠️ Tech Stack


📄 License

MIT License — free to use, modify, and distribute.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

instagram_mcp_server-1.0.0.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

instagram_mcp_server-1.0.0-py3-none-any.whl (17.7 kB view details)

Uploaded Python 3

File details

Details for the file instagram_mcp_server-1.0.0.tar.gz.

File metadata

  • Download URL: instagram_mcp_server-1.0.0.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.13

File hashes

Hashes for instagram_mcp_server-1.0.0.tar.gz
Algorithm Hash digest
SHA256 7d0236852ebf527920eda99fb592efcb48b7eec6c53dccba1d223e52d24ad88c
MD5 ba1d5292a8f55bac86942e58ec0fc206
BLAKE2b-256 39fffa1b555ec40fac9af1389d991e664384c072ed22038c2514cf157d8cddea

See more details on using hashes here.

File details

Details for the file instagram_mcp_server-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for instagram_mcp_server-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8152db886026129c46d2f0a5dd758036176c18f9e946f138d1536ca53abe720d
MD5 f1b77a47f455069286df3b899dd7ab33
BLAKE2b-256 336c02d0c0a3df38535a83b7a6f027533b7f09440e249040aab4aad9af04db08

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page