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
- Install dependencies:
- Build the server:
- 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
- Start in development mode:
- Run linter:
Improvements Over Original
- Modular Architecture
- Type Safety
- Error Handling
- Configuration
- Code Quality
- 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
- Install dependencies:
- Build the server:
- 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
- Start in development mode:
- Run linter:
Improvements Over Original
- Modular Architecture
- Type Safety
- Error Handling
- Configuration
- Code Quality
- Testing Support
License
MIT