# Instagram MCP Server — Profiles, Posts, Reels, Comments (`khadinakbar/instagram-mcp-server`) Actor

One MCP-ready Instagram Actor for public profiles, posts, Reels, and comments. Cookieless ScrapeCreators + SociaVault providers, no login. Returns structured JSON with provenance. $0.004 per result.

- **URL**: https://apify.com/khadinakbar/instagram-mcp-server.md
- **Developed by:** [Khadin Akbar](https://apify.com/khadinakbar) (community)
- **Categories:** Social media, Automation, MCP servers
- **Stats:** 1 total users, 0 monthly users, 0.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $4.00 / 1,000 instagram results

This Actor is paid per event and usage. You are charged both the fixed price for specific events and for Apify platform usage.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Instagram MCP Server — profiles, posts, Reels, comments

Call **one Apify Actor** as an MCP tool and pick `tool`: `profile`, `posts`, `reels`, or `comments`. You get public Instagram JSON (handle, URL, caption, counts, comment text) with provider provenance. No Instagram login or cookies. Charged **$0.004 per saved row**.

Built for creator researchers, social-listening agents, and lead-gen workflows that already know a handle or a post URL and need structured public data—not a follower graph or a native hashtag feed.

### Best fit for this Actor

- Strongest starting condition: a public handle (`natgeo`) or a public `/p/` or `/reel/` URL.
- Useful output: one billed row per profile, media item, or comment, plus `OUTPUT.outcome` so an agent can tell complete vs empty vs invalid.
- Adjacent jobs: use [Instagram Hashtag Scraper](https://apify.com/khadinakbar/instagram-hashtag-scraper) for hashtag posts, or [Instagram Highlights Scraper](https://apify.com/khadinakbar/instagram-highlights-scraper) for story highlights.

### When to use this Actor

- You want **one MCP tool** covering four public Instagram jobs instead of wiring four Actors.
- You need cookieless, login-free public data with a named outcome (`COMPLETE`, `VALID_EMPTY`, `INVALID_INPUT`, `UPSTREAM_FAILED`).
- When you need hashtag feeds, follower identities, likes, or private accounts, this Actor is the wrong tool — hashtag search is not returned by the current public-data providers, and follower graphs are login-gated.

### Workflow story: from a creator handle to outreach notes

A freelance brand strategist pastes `natgeo` into `tool=profile` with `maxResults=1`. The run returns one row: username, follower count, biography, verification, and `profileUrl`. She then runs `tool=posts` on the same handle with `maxResults=5` to grab recent captions and like counts for a moodboard brief. Event cost is a few cents; she never logs into Instagram. If she later needs comments on a specific Reel, she switches `tool=comments` and passes that Reel URL.

### Quick start input

```json
{
  "tool": "profile",
  "usernames": ["natgeo"],
  "maxResults": 1
}
```

That input is the quality-test prefill: one public profile, one billed row, well under five minutes.

### Input reference

| Field | Type | What it controls |
|---|---|---|
| `tool` | enum | `profile`, `posts`, `reels`, or `comments`. Default `profile`. |
| `usernames` | array | Handles or profile URLs for profile/posts/reels. Example: `natgeo`. |
| `postUrls` | array | Post/Reel URLs for comments. Example: `https://www.instagram.com/reel/DOq6eV6iIgD/`. |
| `maxResults` | integer | Run-wide billed-row cap, 1–200, default 12, prefill 1. |
| `maxResultsPerTarget` | integer | Per-target cap, 1–50, default 12. |
| `providerOrder` | enum | `scrapecreators-first` (default) or pin one provider. |
| `includeRawData` | boolean | Adds bulky `raw` payloads. Default false. |

`mode` is accepted as an alias of `tool` for older agent prompts.

### What data you receive

One dataset item is one public Instagram entity. Profile rows carry identity and counts; media rows carry URL, caption, and metrics; comment rows carry text and commenter handle.

```json
{
  "tool": "profile",
  "status": "OK",
  "username": "natgeo",
  "fullName": "National Geographic",
  "followersCount": 280000000,
  "isVerified": true,
  "profileUrl": "https://www.instagram.com/natgeo/",
  "provider": "scrapecreators",
  "scrapedAt": "2026-08-18T11:24:00.000Z"
}
```

Every terminal run also writes `OUTPUT` and `RUN_SUMMARY` with `outcome`, `itemsPushed`, provider attempts, and `chargedEventCounts`.

### Use through the API

```bash
curl -X POST "https://api.apify.com/v2/acts/khadinakbar~instagram-mcp-server/runs?token=$APIFY_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"tool":"profile","usernames":["natgeo"],"maxResults":1}'
```

Read items from the run's default dataset. Check `OUTPUT.outcome` before treating an empty dataset as a failure.

### Use with AI agents through Apify MCP

> Scrape the public Instagram profile for natgeo. Use khadinakbar/instagram-mcp-server with tool=profile, usernames=\["natgeo"], maxResults=1. Return username, followersCount, biography, profileUrl, and the OUTPUT.outcome. Do not request hashtags, followers, or private data.

Point the agent at [Apify MCP](https://mcp.apify.com). Inspect `OUTPUT.outcome` (`COMPLETE` vs `VALID_EMPTY` vs `INVALID_INPUT`) before chaining another tool. Bound `maxResults` so spend stays predictable at $0.004 per row.

### Connect the workflow

- Profile URL out → [Instagram Profile Scraper](https://apify.com/khadinakbar/instagram-profile-scraper) if you only need profile enrichment going forward.
- Handle out → [Instagram Posts Scraper](https://apify.com/khadinakbar/instagram-posts-scraper) or [Instagram Reels Scraper](https://apify.com/khadinakbar/instagram-reels-scraper) for dedicated media Actors.
- Hashtag job → [Instagram Hashtag Scraper](https://apify.com/khadinakbar/instagram-hashtag-scraper) (not this Actor).
- Story highlights → [Instagram Highlights Scraper](https://apify.com/khadinakbar/instagram-highlights-scraper).

### Pricing

Pay per event + platform usage. Open the live Pricing tab for current event details. `apify-actor-start` is $0.00005. Each saved row charges `ig-result` at **$0.004**. Platform usage is paid by the user (`isPPEPlatformUsagePaidByUser: true`). Empty matches and invalid input are not billed as results. `maxResults` is the spend guard.

| Saved rows | Event cost (start + `ig-result`) |
|---|---|
| 1 (prefill / MCP probe) | $0.00005 + $0.004 = **$0.00405** plus compute |
| 12 (default cap) | $0.00005 + $0.048 = **$0.04805** plus compute |
| 50 | $0.00005 + $0.200 = **$0.20005** plus compute |

### Best results

- Prefer official public handles over unofficial fan pages.
- Cap `maxResults` at 1–12 for MCP probes.
- Use `providerOrder=sociavault-first` only when debugging a ScrapeCreators outage.
- A 404 handle is `VALID_EMPTY`, not a platform failure.
- For hashtags, call [Instagram Hashtag Scraper](https://apify.com/khadinakbar/instagram-hashtag-scraper) instead of `tool=hashtag` here.

### Builder's note

Instagram's public web endpoints block datacenter scrapers. This Actor does not wrap other Store Actors (that would double-bill the owner). It calls ScrapeCreators first and SociaVault as fallback, the same provider pair used on the portfolio's other Instagram tools. Hashtag search was probed live and dropped from the public contract: ScrapeCreators `/v1/instagram/search/hashtag` currently returns `not_found` / "No posts found" for common tags, and SociaVault has no Instagram hashtag route. Follower lists are omitted for the same reason: neither provider exposes a public follower graph in the current snapshot.

### FAQ and legal

Public data only. Respect [Instagram's Terms of Use](https://help.instagram.com/581066165581870) and applicable law. This is not an official Instagram API and not a substitute for Meta's Graph API. Private accounts return limited public metadata or nothing. Open an Issue on the Actor page for support.

### Changelog

- 0.1.2 — Removed the advertised hashtag tool after live provider probes returned empty (`not_found`) on ScrapeCreators and no matching SociaVault route. Public contract is now profile, posts, reels, comments.
- 0.1 — Initial private release. Dual providers, PPE `ig-result` $0.004, `OUTPUT`/`RUN_SUMMARY` outcome contract.

# Actor input Schema

## `tool` (type: `string`):

Which Instagram data tool to run for this call. Accepts profile, posts, reels, or comments. Defaults to profile. Do not use this Actor for hashtags, follower graphs, likes, or private accounts — hashtag search is not returned by the current public-data providers, and follower graphs are login-gated.

## `usernames` (type: `array`):

Public Instagram handles for profile, posts, or reels tools. Accepts natgeo, @nasa, or https://www.instagram.com/nike/. Prefill is one public profile so the quality test stays under five minutes. Not a post or Reel URL.

## `postUrls` (type: `array`):

Public post or Reel URLs for the comments tool. Accepts https://www.instagram.com/p/SHORTCODE/ , /reel/SHORTCODE/ , or a bare shortcode. Leave empty for profile/posts/reels. Not a profile URL.

## `maxResults` (type: `integer`):

Hard cap on billed dataset rows for the whole run. Accepts 1-200; defaults to 12 so a Console or MCP probe stays cheap. Stops the run at the cap with PARTIAL when more public items exist. Not a per-target cap — use maxResultsPerTarget for that.

## `maxResultsPerTarget` (type: `integer`):

Per-username or per-post cap before the global maxResults stop. Accepts 1-50; defaults to 12. Profile tool always writes one row per handle. Not the run-wide spend guard.

## `providerOrder` (type: `string`):

Order of owner-configured public-data providers. Defaults to scrapecreators-first with automatic SociaVault fallback. Use a -only value to pin one provider. You never paste an API key; keys are owner secrets.

## `includeRawData` (type: `boolean`):

When true, each row also stores the unmodified provider item under raw. Defaults to false because raw payloads roughly triple token size for agents. Not required for normal MCP use.

## Actor input object example

```json
{
  "tool": "profile",
  "usernames": [
    "natgeo",
    "https://www.instagram.com/nasa/"
  ],
  "postUrls": [
    "https://www.instagram.com/reel/DOq6eV6iIgD/"
  ],
  "maxResults": 1,
  "maxResultsPerTarget": 12,
  "providerOrder": "scrapecreators-first",
  "includeRawData": false
}
```

# Actor output Schema

## `dataset` (type: `string`):

One row per profile, post, Reel, or comment.

## `output` (type: `string`):

Compact outcome, item counts, and charged events.

## `runSummary` (type: `string`):

Provider diagnostics, stop reason, and estimated PPE cost.

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "tool": "profile",
    "usernames": [
        "natgeo"
    ],
    "maxResults": 1
};

// Run the Actor and wait for it to finish
const run = await client.actor("khadinakbar/instagram-mcp-server").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "tool": "profile",
    "usernames": ["natgeo"],
    "maxResults": 1,
}

# Run the Actor and wait for it to finish
run = client.actor("khadinakbar/instagram-mcp-server").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
for item in client.dataset(run.default_dataset_id).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "tool": "profile",
  "usernames": [
    "natgeo"
  ],
  "maxResults": 1
}' |
apify call khadinakbar/instagram-mcp-server --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "type": "http",
            "url": "https://mcp.apify.com/?tools=fetch-actor-details,khadinakbar/instagram-mcp-server"
        }
    }
}

```

The hosted server signs you in with OAuth on first connect, so no API token belongs in this config. Clients without OAuth support can send an `Authorization: Bearer <APIFY_API_TOKEN>` header instead, using a token from API & Integrations in Apify Console (https://console.apify.com/settings/integrations).

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/actors/L9KkvjQ0Arhr0Z8oi/builds/SLvI8BJdeYkn4owDe/openapi.json
