Production-ready MCP server exposing Instagram DMs to AI agents via Smithery, deployed on Vercel, monetized via Stripe
Instagram MCP Server
A production-ready Model Context Protocol (MCP) server that exposes Instagram Direct Messages to AI agents. Deploy once on Vercel, connect any Instagram Business account via Smithery, and let AI agents read and reply to DMs.
Monetized via Stripe: list_all_messages costs $2.50/call (auto-charged at $5.00 threshold). send_message is free.
Live Deployment
Base URL: https://instagram-mcp-server-gilt.vercel.app
| Endpoint | Purpose |
|---|---|
| GET / | Health check |
| POST /api/mcp | MCP tool calls (JSON-RPC 2.0) |
| GET /webhook | Meta webhook verification |
| POST /webhook | Real-time Instagram DM events |
| GET /auth/callback | OAuth callback after Instagram login |
| POST /auth/deauthorize | Meta deauthorization callback |
| GET /auth/data-deletion | Data deletion request page |
| POST /auth/data-deletion | Meta data deletion callback |
Tools
list_all_messages — $2.50/call
Returns all Instagram DM conversations for the connected Page, including message text, sender username, and timestamps.
{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "list_all_messages",
"arguments": {}
},
"_smitheryConfig": {
"instagramAccessToken": "YOUR_PAGE_ACCESS_TOKEN",
"instagramPageId": "YOUR_PAGE_ID",
"stripeCustomerId": "cus_xxxx"
}
}
send_message — Free
Sends an Instagram DM reply to a specific conversation.
{
"jsonrpc": "2.0",
"id": 2,
"method": "tools/call",
"params": {
"name": "send_message",
"arguments": {
"recipientId": "INSTAGRAM_SCOPED_USER_ID",
"message": "Thanks for reaching out!"
}
},
"_smitheryConfig": {
"instagramAccessToken": "YOUR_PAGE_ACCESS_TOKEN",
"instagramPageId": "YOUR_PAGE_ID",
"stripeCustomerId": "cus_xxxx"
}
}
Architecture
AI Agent (Claude, GPT, etc.)
│
▼ JSON-RPC 2.0 over HTTP
Smithery (MCP gateway)
│ _smitheryConfig: { instagramAccessToken, instagramPageId, stripeCustomerId }
▼
Vercel Serverless Function (api/mcp.ts)
│
├─▶ Instagram Graph API (read/send DMs)
└─▶ Stripe Billing API (meter events @ $2.50 per list_all_messages)
Multi-tenant: Each caller supplies their own Instagram credentials in _smitheryConfig. The server is stateless — no tokens or messages are stored.
Setup
Prerequisites
- Meta Developer App with
instagram_manage_messages+pages_messaging(Advanced Access via App Review) - Stripe account with a metered billing price
- Vercel account
Environment Variables
Set these in Vercel:
| Variable | Description |
|---|---|
| STRIPE_SECRET_KEY | Stripe secret key (sk_live_...) |
| STRIPE_METER_ID | Stripe meter ID (mtr_...) |
| INSTAGRAM_APP_SECRET | Meta App Secret (for webhook signature verification) |
| WEBHOOK_VERIFY_TOKEN | Random string used to verify Meta webhook |
Deploy to Vercel
npm install -g vercel
vercel login
cd artifacts/instagram-mcp-server
vercel deploy --prod
Configure Meta App
- Webhook URL:
https://YOUR_VERCEL_URL/webhook - Verify Token: your
WEBHOOK_VERIFY_TOKENvalue - Subscribe to fields:
messages,messaging_postbacks,message_reactions - OAuth Redirect URI:
https://YOUR_VERCEL_URL/auth/callback - Deauthorize URL:
https://YOUR_VERCEL_URL/auth/deauthorize - Data Deletion URL:
https://YOUR_VERCEL_URL/auth/data-deletion
Register on Smithery
smithery deploy
Billing
Billing is handled per-call using Stripe Metered Usage:
| Tool | Cost |
|---|---|
| list_all_messages | $2.50 per call |
| send_message | Free |
Stripe auto-charges the customer when their balance reaches the $5.00 threshold. Each caller must supply their own stripeCustomerId in _smitheryConfig.
Meta App Review
This app requires Advanced Access for instagram_manage_messages and pages_messaging. See app-review/SUBMISSION_CHECKLIST.md for the full submission guide.
Privacy Policy: https://instagram-mcp-server-gilt.vercel.app/privacy-policy.html
Project Structure
api/
mcp.ts # Main MCP handler (JSON-RPC 2.0)
webhook.ts # Meta webhook receiver
auth-callback.ts # OAuth callback → displays Page access token
auth-deauthorize.ts # Meta deauthorization handler
auth-data-deletion.ts # Meta data deletion handler
src/
server.ts # MCP server definition + tool implementations
instagram.ts # Instagram Graph API client
app-review/
SUBMISSION_CHECKLIST.md
FORM_CONTENT.md
REVIEWER_INSTRUCTIONS.md
SCREEN_RECORDING_SCRIPT.md
public/
privacy-policy.html
smithery.yaml
vercel.json
License
MIT