Instagram Public MCP
用于 Vercel 的 Instagram 公共 MCP
一个用 Python 编写的远程 MCP 服务器,仅查询公开的 Instagram 数据,无需 Instagram 登录、Cookie、密码或保存的账户会话。
重要:移动端信息流 Instaloader 补丁
此构建不使用标准的 Instaloader 4.15.3 包。
它固定了来自 Instaloader 拉取请求 #2722 的匿名个人资料/帖子修复,位于:
3f72b47466cc505b92c6e9b0ca2f5689e93a6a89依赖:
instaloader @ https://github.com/alimony/instaloader/archive/3f72b47466cc505b92c6e9b0ca2f5689e93a6a89.zip该补丁改变了匿名行为,使得:
个人资料解析可以从
api/v1/users/web_profile_info/回退到api/v1/feed/user/{username}/username/;匿名帖子分页使用
api/v1/feed/user/{id}/;帖子页面使用
max_id分页;项目通过 Instaloader 的 iPhone/移动端响应模型进行转换;
来自
web_profile_info的失败可以立即到达信息流回退,而不是等待长时间的重试/退避循环。
不使用任何经过身份验证的 Instagram 账户。
Related MCP server: instagram
架构
MCP Client
|
v
Vercel /api/mcp
|
v
Patched Instaloader (PR #2722)
|
v
Instagram mobile feed endpointMCP 工具
get_instagram_profile
返回 Instagram 个人资料的公开元数据。
{
"username": "instagram"
}get_instagram_posts
返回最近的公开帖子。
{
"username": "instagram",
"count": 3
}debug_instagram_connection
检查原始的旧版 web_profile_info HTTP 响应。此工具仍可用于诊断,但补丁后的 Instaloader 可以在该端点被拒绝时回退到移动端信息流端点。
{
"username": "instagram"
}MCP 资源
instagram://profile/{username}
instagram://profile/{username}/posts缓存
默认内存缓存:
CACHE_TTL_SECONDS=600
DEFAULT_POST_COUNT=12
MAX_POST_COUNT=30设置 CACHE_TTL_SECONDS=0 以禁用它。
Vercel 实例是临时的,因此此缓存是针对每个热函数实例的,而不是全局共享缓存。
部署到 Vercel
npm install -g vercel
vercel --prod包含的 vercel.json 将函数部署到圣保罗:
{
"$schema": "https://openapi.vercel.sh/vercel.json",
"regions": ["gru1"]
}MCP 端点:
https://YOUR-PROJECT.vercel.app/api/mcp健康检查端点:
https://YOUR-PROJECT.vercel.app/api/health本地开发
python -m venv .venv
pip install -r requirements.txt
uvicorn api.index:app --reloadMCP 端点:
http://127.0.0.1:8000/api/mcpCursor
.cursor/mcp.json:
{
"mcpServers": {
"instagram-public": {
"url": "https://YOUR-PROJECT.vercel.app/api/mcp"
}
}
}安全性
此仓库不包含任何 Instagram 账户凭据。
它不包含也不需要:
Instagram 用户名/密码凭据
sessionidcsrftokenfb_dtsg经过身份验证的账户 ID
保存的 Instaloader 会话
Instagram Cookie
限制
服务器仅查询公开数据,不尝试绕过私人个人资料。
Instagram 仍可能根据部署 IP 对匿名流量进行速率限制或阻止。移动端信息流补丁修复了已知的匿名 web_profile_info/时间线路径问题,但无法保证 Instagram 会接受来自每个托管提供商或 IP 范围的流量。
v2.1.1 个人资料兼容性修复
匿名移动端信息流回退可能会省略通常存在于 web_profile_info 中的可选个人资料字段。
版本 2.1.1 防御性地读取个人资料属性。缺失的值(如 biography、external_url 或企业账户元数据)将返回为 null,而不是导致 get_instagram_profile 失败。
帖子获取路径与 v2.1.0 保持不变。
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only public Instagram data: profiles, posts, reels, stories, comments, top-accounts ranking.
Public Instagram profiles and post feeds by handle, with hashtags and mentions parsed.
Instagram: Instagram public data scraper API for search, users, posts, hashtags, locations and more.
Instagram Scraper: 🔥 Get a lot of information from Instagram consistently and quickly!.
Related MCP Servers
- AlicenseAqualityCmaintenanceEnables AI assistants to download Instagram content including posts, videos, reels, stories, highlights, and profile pictures using Instaloader, with optional metadata and caption extraction.5MIT
- AlicenseNot gradedqualityDmaintenanceEnables fetching public Instagram profiles, posts, and images without an API key via Instagram's mobile API.2MIT
- AlicenseNot gradedqualityBmaintenanceA local Instagram exporter for MCP clients that exports profile metadata, posts, reels, captions, and comments via a manually authenticated browser session.MIT
- AlicenseAqualityBmaintenanceProvides read-only access to public Threads.net profiles and threads via anonymous scraping, with tools for profile info, user threads, and session management.3MIT