# ig-download-mcp
[English](README.md) | 繁體中文
使用 [Instaloader](https://github.com/instaloader/instaloader) 實作的 Instagram MCP(Model Context Protocol)Server,讓 Claude / Claude Code / Codex 等 AI 助理可以下載 Instagram 內容。
## 功能
- 下載貼文(圖片 / 影片 / Carousel)
- 下載影片(Reels / IGTV / 影片貼文)
- 下載 Stories(需要登入)
- 下載 Highlights(需要登入)
- 下載大頭貼
- 可選擇儲存 metadata(JSON)與 caption(文字檔)
- 支援 `.env` / 環境變數設定帳密(避免在 tool 參數內傳遞)
## 需求
- Python >= 3.13
- [uv](https://github.com/astral-sh/uv)
## 快速開始
### 1) 下載專案
```bash
git clone https://github.com/<YOUR_ORG_OR_USER>/ig-download-mcp.git
cd ig-download-mcp
```
### 2) 安裝依賴
```bash
uv venv
uv sync
```
### 3) 設定帳密(推薦)
```bash
cp .env.example .env
# Edit .env and fill in your Instagram credentials
```
### 4) 啟動 MCP Server
```bash
uv run ig-download-mcp
```
## MCP 設定
請將 `/path/to/ig-download-mcp` 替換成你實際的安裝路徑。
### Claude Desktop
編輯 `~/Library/Application Support/Claude/claude_desktop_config.json`(macOS;其他平台請使用對應的設定檔):
```json
{
"mcpServers": {
"ig-download-mcp": {
"command": "uv",
"args": ["--directory", "/path/to/ig-download-mcp", "run", "ig-download-mcp"]
}
}
}
```
### Claude Code
編輯 `~/.claude.json`:
```json
{
"mcpServers": {
"ig-download-mcp": {
"command": "uv",
"args": ["--directory", "/path/to/ig-download-mcp", "run", "ig-download-mcp"]
}
}
}
```
### Codex(OpenAI)
編輯 `~/.codex/config.toml`:
```toml
[mcp_servers.ig_download_mcp]
command = "uv"
args = ["--directory", "/path/to/ig-download-mcp", "run", "ig-download-mcp"]
```
## 可用工具
| Tool | 說明 | 需要登入 |
|------|------|----------|
| `download_instagram_post` | 下載貼文(圖片/影片/Carousel) | 選填 |
| `download_instagram_video` | 僅下載影片 | 選填 |
| `download_instagram_stories` | 下載 Stories | 必填 |
| `download_instagram_highlights` | 下載 Highlights | 必填 |
| `download_instagram_profile_pic` | 下載大頭貼 | 選填 |
## 憑證設定
推薦使用 `.env`:
```bash
cp .env.example .env
# Edit .env and fill in your Instagram credentials
```
或在 shell 設定環境變數:
```bash
export IG_USERNAME="your_username"
export IG_PASSWORD="your_password"
```
## 重要提醒
- 本專案與 Instagram / Meta 無關聯;請遵守相關服務條款與法律規範,並自行承擔使用風險。
- Stories / Highlights 需要登入;未提供帳密會回傳錯誤。
- 若觸發 2FA 或 challenge 流程,Instaloader 可能會失敗並回傳錯誤。
- Instaloader 有內建速率限制;請避免高頻率大量下載。
## License
MIT
- [Instaloader](https://github.com/instaloader/instaloader) - Instagram download engine
- [MCP](https://modelcontextprotocol.io/) - Model Context Protocol
- [uv](https://github.com/astral-sh/uv) - Python package manager