Instagram MCP Server

Instagram MCP Server

A professional MCP server for managing and posting Instagram content, including PDF-to-image conversion, carousel batches, auto-posting, and Cloudinary hosting.

Category
Visit Server

README

Instagram MCP Server

A professional, well-structured MCP (Model Context Protocol) server for managing and posting Instagram content — PDF to images, carousel batches, auto-posting, and Cloudinary hosting.

Features

  • šŸ“ø Content management — list, view, delete, archive local images
  • āœļø Metadata — captions & hashtags per content item
  • šŸ“± Post to Instagram — single image or carousel posts via Graph API
  • šŸ–¼ļø PDF → Images — convert PDF pages to PNGs (poppler)
  • šŸŽ  Carousel batches — group images into 2-10 image carousels
  • ā˜ļø Cloudinary — temporary image hosting + auto-cleanup
  • šŸ”‘ Token diagnostics — debug token expiry, scopes, and meta error codes

Project Structure

instagram-mcp/
ā”œā”€ā”€ src/instagram_mcp/          # Main package
│   ā”œā”€ā”€ config.py               # Env, constants, paths
│   ā”œā”€ā”€ logging_setup.py        # Console + file logging
│   ā”œā”€ā”€ errors.py               # Meta error parsing + guidance
│   ā”œā”€ā”€ server.py               # FastMCP registration (thin)
│   ā”œā”€ā”€ __main__.py             # python -m instagram_mcp
│   ā”œā”€ā”€ services/               # External integrations
│   │   ā”œā”€ā”€ instagram.py        #   Graph API client
│   │   ā”œā”€ā”€ cloudinary.py       #   Upload/delete/verify
│   │   └── pdf.py              #   PDF → images
│   ā”œā”€ā”€ storage/                # Local data access
│   │   ā”œā”€ā”€ content.py          #   File resolution
│   │   └── metadata.py         #   JSON load/save
│   └── tools/                  # MCP tool implementations
│       ā”œā”€ā”€ content_tools.py
│       ā”œā”€ā”€ metadata_tools.py
│       ā”œā”€ā”€ instagram_tools.py
│       ā”œā”€ā”€ cloudinary_tools.py
│       └── carousel_tools.py
ā”œā”€ā”€ scripts/                    # CLI utilities
│   ā”œā”€ā”€ check_token.py          #   Validate token + scopes
│   └── refresh_token.py        #   Extend long-lived token
ā”œā”€ā”€ tests/                      # pytest suite (mocked HTTP)
ā”œā”€ā”€ content/                    # Your media files (unchanged)
ā”œā”€ā”€ archive/                    # Archived content
ā”œā”€ā”€ logs/                       # Log files
ā”œā”€ā”€ server.py                   # Backward-compatible entry point
└── pyproject.toml              # Package config

Installation

# Create & activate venv (Windows)
python -m venv .venv
.\.venv\Scripts\Activate.ps1

# Install package (editable)
pip install -e .

Configuration

Copy .env.example → .env and fill in:

# Instagram (required for posting)
INSTAGRAM_ACCESS_TOKEN=your_token_here
INSTAGRAM_BUSINESS_ACCOUNT_ID=your_account_id_here

# Cloudinary (required for publish_image / carousels)
CLOUDINARY_CLOUD_NAME=...
CLOUDINARY_API_KEY=...
CLOUDINARY_API_SECRET=...

# Optional
INSTAGRAM_API_VERSION=v23.0
LOG_LEVEL=INFO
DELETE_LOCAL_AFTER_PUBLISH=false

Running the Server

# Option 1: Backward-compatible (Claude Desktop config)
python server.py

# Option 2: As a package
python -m instagram_mcp

# Option 3: Console script (after pip install -e .)
instagram-mcp

CLI Utilities

# Check your token's validity, expiry, and scopes
python scripts/check_token.py

# Info on refreshing a long-lived token (60 days)
python scripts/refresh_token.py

Testing

pip install -e ".[dev]"
pytest

MCP Tools

Tool Purpose
list_content List local images in content dir
get_content Get file metadata (mime, size)
manage_content list / delete / archive content
manage_metadata Update / view / clear captions & hashtags
test_instagram_connection Test Graph API connection
debug_instagram_token Debug token expiry + scopes
post_to_instagram Post single image (direct upload)
test_cloudinary_upload Upload to Cloudinary, verify URL
cleanup_cloudinary_asset Delete a Cloudinary asset
publish_image Publish via Cloudinary HTTPS URL
convert_pdf_to_images PDF → PNG images
create_carousel_batch Group images into carousels
post_carousel_to_instagram Post a carousel + auto-cleanup
list_carousel_batches List carousels + status

Resource

  • instagram://content/{filename} — access images as base64 blobs for visual analysis.

Troubleshooting: Daily "API access blocked (code 200)"

Run test_instagram_connection and debug_instagram_token to diagnose.

Common causes & fixes:

  1. App in Development Mode → switch to Live in Meta Developer dashboard.
  2. Missing approved permissions → submit App Review for instagram_basic + instagram_content_publish.
  3. Token expired/revoked (60 days) → generate a fresh long-lived token.
  4. App flagged by Meta → check the app review status / appeal.

Logs are written to logs/instagram_mcp.log for diagnosis.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured