MCP SERVER

Instagram MCP

A self-hosted MCP server that lets an AI agent publish, schedule, triage comments and read insights on Instagram with Meta's official API only, and asks me to approve every write.

  • 42 MCP tools
  • 917 Code-blind tests in a separate repo, written from a behaviour contract
  • 2 Login paths run end to end against real Meta on a test account
  • v1.0.0 Release, 2026-11-02

instagram-mcp src, distinct tool names, 2026-11-26; instagram-mcp-contract-tests, vitest list, 2026-11-26; instagram-mcp README, Status, 2026-11-02; instagram-mcp release list, 2026-11-26

ROLE
Author
TIMELINE
2026-08 to 2026-11
STACK
TypeScript, Node.js, MCP, SQLite, Meta Graph API
STATUS
Public

Approve a post

Watch for: the hash in the preview, and what happens when the caption changes after approval.

Preview a fake post, see its hash and the 600-second expiry, and approve it. Then edit the caption and try to approve again: the hash no longer matches, so the write is refused. Fake data only.

Problem

I wanted an AI agent to help with an Instagram creator's content cycle: publish and schedule posts, triage comments and messages, and read insights. A wrong post, a deleted post or a reply to the wrong person is public and hard to take back. An agent can get a request slightly wrong.

So the problem was not how to call the Instagram API. It was how to give an agent write access and still use only Meta's official API, with no scraping, and still know what it will change before it changes it.

Constraints

  • Official Meta API only. No scraping, no private API, no password login and no browser automation (instagram-mcp README, 2026-11-26).
  • Self-hosted. It runs on my machine or my own server, and nothing goes through a third party.
  • Every write needs my approval first.
  • Tokens stay in the macOS keychain, an encrypted file or environment variables. They never appear in tool output, logs or the database (README, Security model).
  • The official API sets the limits. It cannot follow accounts, like posts, edit a caption after publishing or read other people's private content, so the server does not offer these either.
  • TypeScript on Node 22.13 or newer, MIT licensed.

Approach

The server has 42 tools (I counted 42 distinct tool names in src, 2026-11-26). Reading tools run when called. Every write goes through two steps. A instagram_preflight_* tool shows a preview of the exact action. Then instagram_approve runs it with a literal confirm: true.

The approval is bound to a hash of the exact previewed action. It expires (default 600 seconds), it is single use, and it re-checks the target (docs/SECURITY-MODEL.md). Operations are written to an audit log and an operation ledger. If an outcome is unclear, the server marks it unknown and does not retry (CHANGELOG 1.0.0-rc.1 and 1.0.0).

I wrote the behaviour contract first, in docs/CONTRACT.md, with a v1 design spec. A separate test repo, instagram-mcp-contract-tests, holds tests written from the contract by an agent that never saw the code.

Each account uses one of three login paths: Unified Login (for new apps), Facebook Login and legacy Instagram Login. The server probes a call that Meta refuses, remembers it for that account, and names the other path.

What shipped

  • 42 tools in seven areas: account and ops, media and archive, publishing and scheduling, comments and inbox, direct messages, insights and reports, and discovery and partnerships (README).
  • The preflight, approve and execute flow for every write, with an audit log.
  • A daemon with a scheduler, webhooks, daily insight snapshots and token refresh, and a CLI with a doctor check.
  • 917 tests in instagram-mcp-contract-tests, counted with vitest list on 2026-11-26. I did not read their logic.
  • Live end-to-end runs against Meta on a test account on 2026-11-01 and 2026-11-02, on two login paths. Facebook Login: publishing, scheduling, comments, DMs, insights, webhooks and cleanup. Unified Login: setup, token, reads, publishing, scheduling, delete, comment writes, DMs to an Instagram Tester and the messaging profile (README, Status).
  • v1.0.0, released 2026-11-02 (gh release list). It is also listed in the official MCP Registry as io.github.pratikgh0se/instagram-mcp 1.0.0 (registry API, checked 2026-11-26).
  • Source: pratikgh0se/instagram-mcp.

Outcome

It is released, public and MIT licensed. It has 0 stars and I have no usage numbers, such as downloads or users. I would rather leave them out than invent them.

The evidence I would point to is the design and the live runs. A write cannot run without a preview and a separate approval of that exact preview. The behaviour was checked against real Meta on a test account.

What is not confirmed, from the README: real webhook events on the Unified path (Meta's Test event arrives, live comments and DMs did not), the legacy Instagram Login path, collaboration invites and branded content. It is installed from source, because the package is not on npm yet.

What I learned

Real Meta behaved differently from its documentation, so a live run found things the offline tests could not. After the live runs I amended the contract many times, and each amendment says it was found in a live run (docs/CONTRACT.md). Two examples: Meta sent direct-message times in milliseconds and the server read them as seconds, and Meta answered a carousel delete with an error although the media was deleted. Now a failed delete is checked with one read before the server reports the result (CHANGELOG 1.0.0).

Fixing the contract first, then the code, kept the tests and the code from drifting apart. The behaviour changed in the contract, the test writer followed it, and the code followed the tests.

How AI built this

  • Spec first. The behaviour contract (docs/CONTRACT.md) and a v1 design spec were written before the v1 code (docs/superpowers/specs/2026-10-29-instagram-mcp-v1-design.md).
  • Code-blind tests. The tests live in a separate repo. An agent that did not see the code wrote them from the contract.
  • I have no repo record of which model built which part.