Skip to main content

Model Context Protocol server for personal Instagram accounts (unofficial private API via instagrapi).

Project description

instagram-personal-mcp

Demo

A Model Context Protocol server that wraps instagrapi so Claude (or any MCP client) can read, engage, and DM from a personal Instagram account — no Business/Creator switch, no Meta app review.

⚠️ Unofficial private API. This server uses Instagram's reverse-engineered mobile API (via instagrapi). It is not affiliated with or endorsed by Meta. Accounts driving private-API traffic can be rate-limited, challenged, or permanently disabled. Use a burner account until you trust your setup, keep activity natural, and don't connect over VPNs / datacenter IPs.

24 tools across auth, profile/read, engagement, and DMs.

Quick start

git clone https://github.com/AleemHaider/instagram-personal-mcp
cd instagram-personal-mcp
python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"

Drop your creds in a .env:

cp .env.example .env
# edit: IG_USERNAME, IG_PASSWORD

Then run it:

instagram-personal-mcp

The first call (e.g. instagram_session_status or instagram_login) will authenticate and save a session file to ~/.config/instagram-personal-mcp/session.json. Subsequent runs reuse it.

Connect to Claude Desktop

Edit ~/.config/Claude/claude_desktop_config.json (Linux) / ~/Library/Application Support/Claude/claude_desktop_config.json (macOS):

{
  "mcpServers": {
    "instagram-personal": {
      "command": "instagram-personal-mcp",
      "env": {
        "IG_USERNAME": "your_username",
        "IG_PASSWORD": "your_password"
      }
    }
  }
}

Restart Claude Desktop.

Tools

Auth

Tool What it does
instagram_login Log in. Pass verification_code if 2FA is on.
instagram_logout Log out and delete the saved session.
instagram_session_status Report whether a usable session is loaded.

Profile & read

Tool What it does
instagram_get_my_profile Profile of the logged-in account.
instagram_get_user_profile Public profile of another user.
instagram_search_users Search users by keyword.
instagram_get_user_posts Recent posts by a user.
instagram_get_post Details of a single post (URL or media pk).
instagram_get_post_comments Comments on a post.
instagram_get_post_likers Users who liked a post.
instagram_get_followers List a user's followers.
instagram_get_following List who a user follows.
instagram_get_timeline Home feed.
instagram_get_user_stories Active stories from a user.

Engagement

Tool What it does
instagram_like_post Like a post.
instagram_unlike_post Unlike a post.
instagram_comment_on_post Comment on a post.
instagram_follow_user Follow a user.
instagram_unfollow_user Unfollow a user.
instagram_save_post Save a post to your collection.
instagram_unsave_post Remove a post from your saved collection.

Direct messages

Tool What it does
instagram_list_dm_threads List DM threads.
instagram_get_dm_thread Messages in a thread.
instagram_send_dm Send a DM (comma-separated usernames for group).

2FA flow

  1. Call instagram_login (no code) — if 2FA is required you'll get {"error": true, "code": "2FA_REQUIRED", ...}.
  2. Get the code from your authenticator / SMS.
  3. Call instagram_login again with verification_code="123456".

Errors

Tools return structured errors instead of raising. Look for error: true and a machine-readable code:

  • NOT_LOGGED_IN — call instagram_login first.
  • LOGIN_REQUIRED — saved session was rejected; log in again.
  • 2FA_REQUIRED — call instagram_login again with verification_code.
  • CHALLENGE_REQUIRED — Instagram wants a security challenge solved; log in from the IG app / web once to clear it.
  • RATE_LIMITEDPleaseWaitFewMinutes from upstream; back off.
  • USER_NOT_FOUND / MEDIA_NOT_FOUND — bad input or removed content.

Development

pip install -e ".[dev]"
pytest

Why a separate project from instagram-mcp?

The sibling instagram-mcp wraps the official Instagram Graph API — Business/Creator accounts only, requires a Meta app and tokens, fully ToS-compliant. This project wraps the unofficial private API for personal accounts and carries the risks above. They're kept separate so the official one stays clean and reviewable.

License

MIT — see LICENSE.

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_personal_mcp-0.1.0.tar.gz (150.1 kB view details)

Uploaded Source

Built Distribution

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

instagram_personal_mcp-0.1.0-py3-none-any.whl (9.2 kB view details)

Uploaded Python 3

File details

Details for the file instagram_personal_mcp-0.1.0.tar.gz.

File metadata

  • Download URL: instagram_personal_mcp-0.1.0.tar.gz
  • Upload date:
  • Size: 150.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for instagram_personal_mcp-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9e9304a23468192d3d4c4314cada683c7aeddd8a863c7ee193db1655213c9d8b
MD5 043c036847a8d8527ec12d31813dfd3b
BLAKE2b-256 f0c64da36c045f9c1312ff6306a7cd887b0e11548b747aac4308137dafb7672c

See more details on using hashes here.

File details

Details for the file instagram_personal_mcp-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for instagram_personal_mcp-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 de438b5640f4a5a9e147697e7f9934d43c6c64a78a82089ce109f1f6c6acd836
MD5 c422785ea4ec2f4b30ba7bfdb5e8d284
BLAKE2b-256 2838937d98b4a974e2bcf3c3cd95ec8bc3421b017c5cdde44f14cf3eb1ff5be6

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