instagram analytics.com
instagram analytics.com logo

Instagram Analytics

Integrates with Instagram's API and web scraping tools to enable social media analytics, account management, and content...

Created byApr 22, 2025

Instagram MCP Server

A Model Context Protocol (MCP) server for fetching Instagram posts using Chrome's existing login session.

Features

  • Modular architecture with clear separation of concerns
  • Type-safe implementation using TypeScript
  • Improved error handling and logging
  • Configurable through environment variables
  • JSON-RPC 2.0 compliant communication
  • Automatic media downloading and metadata generation
  • SEO-friendly description generation

Architecture

The server follows a modular architecture with the following structure:

Configuration

The server requires the following environment variables:
  • CHROME_USER_DATA_DIR: Path to Chrome user data directory containing login session
Additional configuration options are available through the config manager:
  • Browser settings (viewport, timeouts)
  • Instagram settings (delays, batch sizes)
  • Save directory and file paths

Usage

  1. Install dependencies:
  1. Build the server:
  1. Run the server:

Available Tools

get_instagram_posts

Fetches recent posts from an Instagram profile.
Parameters:
  • username (required): Instagram username to fetch posts from
  • limit (optional): Number of posts to fetch (1-50) or "all"
  • saveDir (optional): Directory to save media files and metadata
  • delayBetweenPosts (optional): Milliseconds to wait between processing posts
Example:

Error Handling

The server uses standardized error codes and messages:
  • INVALID_REQUEST: Invalid request format or parameters
  • INVALID_PARAMS: Missing or invalid parameters
  • METHOD_NOT_FOUND: Unknown method or tool
  • INTERNAL_ERROR: Server-side errors

Development

  1. Start in development mode:
  1. Run linter:

Improvements Over Original

  1. Modular Architecture
  1. Type Safety
  1. Error Handling
  1. Configuration
  1. Code Quality
  1. Testing Support

License

MIT

Instagram MCP Server

A Model Context Protocol (MCP) server for fetching Instagram posts using Chrome's existing login session.

Features

  • Modular architecture with clear separation of concerns
  • Type-safe implementation using TypeScript
  • Improved error handling and logging
  • Configurable through environment variables
  • JSON-RPC 2.0 compliant communication
  • Automatic media downloading and metadata generation
  • SEO-friendly description generation

Architecture

The server follows a modular architecture with the following structure:

Configuration

The server requires the following environment variables:
  • CHROME_USER_DATA_DIR: Path to Chrome user data directory containing login session
Additional configuration options are available through the config manager:
  • Browser settings (viewport, timeouts)
  • Instagram settings (delays, batch sizes)
  • Save directory and file paths

Usage

  1. Install dependencies:
  1. Build the server:
  1. Run the server:

Available Tools

get_instagram_posts

Fetches recent posts from an Instagram profile.
Parameters:
  • username (required): Instagram username to fetch posts from
  • limit (optional): Number of posts to fetch (1-50) or "all"
  • saveDir (optional): Directory to save media files and metadata
  • delayBetweenPosts (optional): Milliseconds to wait between processing posts
Example:

Error Handling

The server uses standardized error codes and messages:
  • INVALID_REQUEST: Invalid request format or parameters
  • INVALID_PARAMS: Missing or invalid parameters
  • METHOD_NOT_FOUND: Unknown method or tool
  • INTERNAL_ERROR: Server-side errors

Development

  1. Start in development mode:
  1. Run linter:

Improvements Over Original

  1. Modular Architecture
  1. Type Safety
  1. Error Handling
  1. Configuration
  1. Code Quality
  1. Testing Support

License

MIT