Skip to main content
Glama
instagram-mcp

instagram-mcp

instagram-mcp

A streamable-HTTP MCP server (endpoint /mcp, port 8000) that gives any MCP-compatible AI agent full control over an Instagram account — post photos/albums/reels, stories, DMs, comments, likes, follows, search, highlights, profile edits, and more (68+ tools).

Built on instagrapi (curl_cffi anti-detection) and the official Model Context Protocol Python SDK.

Owner: Aidan Cohen.


What it does

Area

Tools (examples)

Auth

instagram_login_with_credentials, instagram_login_with_sessionid, instagram_complete_2fa, instagram_complete_challenge, instagram_get_login_status, instagram_logout

Posts

instagram_post_photo, instagram_post_album, instagram_edit_caption, instagram_disable_comments, instagram_archive_media, instagram_pin_media

Stories / Reels

instagram_upload_story_photo, instagram_upload_story_video, instagram_upload_reel, instagram_upload_video

Engagement

instagram_like_media, instagram_unlike_media, instagram_comment, instagram_delete_comment, instagram_follow, instagram_unfollow

DMs

instagram_send_direct_message, instagram_get_direct_threads, instagram_get_direct_messages

Discovery

instagram_search_users, instagram_search_hashtags, instagram_get_profile, instagram_get_user_media, instagram_get_hashtag_media

Ask the server for tools/list to see the full surface.

Related MCP server: Instagram Control MCP Server

Architecture

  • Transport: streamable-HTTP MCP, stateless (stateless_http=True), served at http://<host>:8000/mcp. A /healthz GET returns {"ok": true, ...}.

  • Logging: every except in the codebase logs (level + message + traceback) to a log file and stdout — there are no silent except: pass paths. Logs are written to /var/log/instagram-mcp/{app,errors,access}.log and a sidecar container tails them, so kubectl logs <pod> -c logs streams live output.

  • Credentials: read only from the environment IG_USERNAME / IG_PASSWORD (injected from a Kubernetes Secret). Never hardcoded, never committed.

  • Session persistence: the instagrapi session file lives on a PVC mounted at /data/instagram_session.json, so a login survives pod restarts.

  • Safe startup: login (from env creds, if present) runs in a background thread. A login failure / 2FA / challenge never stops the MCP endpoint from serving — the failure is logged and the server stays up.

Run it (Docker)

docker build -t instagram-mcp:latest .
docker run --rm -p 8000:8000 \
  -e IG_USERNAME=your_handle \
  -e IG_PASSWORD=your_password \
  instagram-mcp:latest

Then hit http://localhost:8000/mcp with an MCP client, or check http://localhost:8000/healthz.

Deploy on Kubernetes (k3s)

The manifest (deploy.yaml) creates, in the default namespace:

  1. A Secret (instagram-mcp-secret) — placeholder, empty values; create the real one out-of-band:

    kubectl create secret generic instagram-mcp-secret \
      --from-literal=IG_USERNAME=<handle> --from-literal=IG_PASSWORD=<password>
  2. A PVC (instagram-mcp-session) for session persistence.

  3. A Deployment (instagram-mcp) — main container + logging sidecar, sharing an emptyDir at /var/log/instagram-mcp.

  4. A ClusterIP Service (instagram-mcp) mapping 8000 -> 8000.

Build + import + apply (the image is local, not pushed to a registry):

docker build -t instagram-mcp:latest .
docker save instagram-mcp:latest | sudo k3s ctr images import -
sudo k3s ctr images label docker.io/library/instagram-mcp:latest io.cri-containerd.pinned=pinned

kubectl create secret generic instagram-mcp-secret \
  --from-literal=IG_USERNAME=<handle> --from-literal=IG_PASSWORD=<password>

kubectl apply -f deploy.yaml
kubectl rollout status deploy/instagram-mcp --timeout=120s

The image is arm64. The pod is pinned to kubernetes.io/arch: arm64; the liqo virtual nodes are amd64, so build on an arm64 node (the lima-ubuntu control-plane in this fleet).

Verify

kubectl get pods,svc
kubectl logs deploy/instagram-mcp -c instagram-mcp   # main container stdout
kubectl logs deploy/instagram-mcp -c logs            # live tail of app/errors/access logs

Run the smoke test (from any host that can reach the cluster, via port-forward):

kubectl port-forward svc/instagram-mcp 8000:8000 &
python3 smoke.py http://127.0.0.1:8000/mcp

smoke.py performs a real MCP initialize → notifications/initialized → tools/list handshake over streamable HTTP.

Rebuild from scratch (what a cold clone does)

git clone https://github.com/salmonhealer772/instagram-mcp.git
cd instagram-mcp
# (the steps under "Deploy on Kubernetes" above)

License

MIT — see LICENSE. Forked from official-Arvind/instagram-mcp.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      An MCP server that wraps instagrapi to read, engage, and send DMs from a personal Instagram account, supporting 24 tools for auth, profile, engagement, and messages.
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Enables AI assistants to operate an Instagram account through standard MCP tools — searching hashtags, reading posts and comment threads, posting comments and replies, reading and sending direct messages, fetching the timeline feed, and liking media — while managing Python FastMCP subprocess lifecycle, persistent login sessions, and two-factor authentication.
      106 npm
      1
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Wraps the unofficial Instagram private API into 34 ready-to-use tools, enabling AI agents to log in, search users and hashtags, browse, like, comment on, upload and download media, send DMs, and view stories through any MCP client. It provides agent-readable errors, flexible username/URL references, and automatic session relogin.
      1
      MIT