Skip to main content
Glama
pedroantonnio

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 Download MCP Server

架构

MCP Client
    |
    v
Vercel /api/mcp
    |
    v
Patched Instaloader (PR #2722)
    |
    v
Instagram mobile feed endpoint

MCP 工具

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 --reload

MCP 端点:

http://127.0.0.1:8000/api/mcp

Cursor

.cursor/mcp.json

{
  "mcpServers": {
    "instagram-public": {
      "url": "https://YOUR-PROJECT.vercel.app/api/mcp"
    }
  }
}

安全性

此仓库不包含任何 Instagram 账户凭据。

它不包含也不需要:

  • Instagram 用户名/密码凭据

  • sessionid

  • csrftoken

  • fb_dtsg

  • 经过身份验证的账户 ID

  • 保存的 Instaloader 会话

  • Instagram Cookie

限制

服务器仅查询公开数据,不尝试绕过私人个人资料。

Instagram 仍可能根据部署 IP 对匿名流量进行速率限制或阻止。移动端信息流补丁修复了已知的匿名 web_profile_info/时间线路径问题,但无法保证 Instagram 会接受来自每个托管提供商或 IP 范围的流量。

v2.1.1 个人资料兼容性修复

匿名移动端信息流回退可能会省略通常存在于 web_profile_info 中的可选个人资料字段。

版本 2.1.1 防御性地读取个人资料属性。缺失的值(如 biographyexternal_url 或企业账户元数据)将返回为 null,而不是导致 get_instagram_profile 失败。

帖子获取路径与 v2.1.0 保持不变。

F
license - not found
Not graded
quality - not tested
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables Instagram engagement analysis using the unofficial Instagram Private API, including comment sentiment analysis, account comparison, demographic extraction, lead identification, and engagement reporting.
    80
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables fetching public Instagram profiles, posts, and images without an API key via Instagram's mobile API.
    2
    MIT

View all related MCP servers

Related MCP Connectors

  • Public Instagram profiles and post feeds by handle, with hashtags and mentions parsed.

  • Scrape and analyze public LinkedIn posts as structured JSON via the Apify LinkedIn Posts API.

  • Unified social-media data across 10 networks: profiles, posts, search, comments, cross-search.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/pedroantonnio/Instagram-Analytics-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server