SocialAPIs — Facebook & Instagram Data

官方

面向AI代理的Facebook与Instagram数据——页面、帖子、群组、广告资料库、市场、个人资料和Reels。47个只读工具,结构化输出。免费层级:每月200次调用。

你可以用 SocialAPIs — Facebook & Instagram Data MCP 做什么?

  • Facebook 页面和群组数据 — 通过链接或 ID 获取页面或群组详情、帖子、视频、Reels 和相册。
  • Facebook 帖子和评论查询 — 通过帖子链接获取帖子详情、附件、评论和评论回复。
  • Meta Ads Library 搜索 — 按关键词或广告主搜索广告,获取广告主页详情,并列出支持的国家/地区。
  • Instagram 个人资料和帖子数据 — 通过用户名或 shortcode 获取个人资料详情、帖子、Reels、精选动态和完整帖子详情。
  • Instagram 搜索和地点 — 按关键词搜索用户、话题标签和地点,或列出标记了某个地点的帖子。
  • Facebook Marketplace 搜索 — 使用筛选条件搜索商品、车辆和租赁信息,并获取商品或卖家详情。

托管 MCP 服务器

npx add-mcp 'https://mcp.socialapis.io/mcp'

可安装到 Claude Code、Codex、Cursor 等客户端

文档

通过 SocialAPIs 模型上下文协议 (MCP) 服务器,让 AI 助手直接访问 Facebook 和 Instagram 的公开数据。

该服务器提供 12 个只读工具,涵盖 50 项操作:主页、帖子、评论、群组、Meta 广告资料库、Marketplace、Instagram 个人资料、帖子、Reels 和地点。每个工具对应一种资源,并接受一个 action 参数。每次调用都会返回结构化输出,包括扣除的积分和剩余积分。

1. 获取 API 密钥

在 socialapis.io 注册,并从控制面板复制密钥。免费套餐每月包含 200 积分,无需信用卡。

2. 连接客户端

有两种连接方式。

托管端点(推荐)

无需安装。将支持远程 MCP 服务器的任意客户端指向:

https://mcp.socialapis.io/mcp

在请求头中发送密钥:

Authorization: Bearer YOUR_API_KEY

x-api-token: YOUR_API_KEY 也可使用。切勿将密钥放入 URL。

本地服务器 (npx)

适用于仅运行本地服务器的客户端,例如 Claude Desktop。需要 Node.js 18 或更高版本。

{
  "mcpServers": {
    "socialapis": {
      "command": "npx",
      "args": ["-y", "@socialapis/mcp"],
      "env": {
        "SOCIALAPIS_API_KEY": "YOUR_API_KEY"
      }
    }
  }
}

客户端设置

Claude Code

claude mcp add --transport http socialapis https://mcp.socialapis.io/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"

VS Code

添加到 .vscode/mcp.json。服务器启动时,VS Code 会提示输入密钥,因此密钥不会存储在文件中:

{
  "servers": {
    "socialapis": {
      "type": "http",
      "url": "https://mcp.socialapis.io/mcp",
      "headers": {
        "Authorization": "Bearer ${input:socialapis-key}"
      }
    }
  },
  "inputs": [
    {
      "type": "promptString",
      "id": "socialapis-key",
      "description": "SocialAPIs API key",
      "password": true
    }
  ]
}

Cline

在 MCP Servers → Configure 中,添加到 cline_mcp_settings.json:

{
  "mcpServers": {
    "socialapis": {
      "type": "streamableHttp",
      "url": "https://mcp.socialapis.io/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

Windsurf

添加到 ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "socialapis": {
      "serverUrl": "https://mcp.socialapis.io/mcp",
      "headers": {
        "Authorization": "Bearer YOUR_API_KEY"
      }
    }
  }
}

可用工具

当前版本:2.0.2。服务器包含 12 个只读工具。每个工具对应一种资源,并接受一个 action 参数,以及该操作所需的输入:

工具操作
facebook_pagedetails, id, posts, videos, reels, albums, album_items
facebook_groupdetails, id, posts, videos, albums, album_items
facebook_postdetails, details_extended, id, attachments, video, comments, comment_replies
facebook_searchpages, people, posts, videos, locations
facebook_adssearch, keywords, page_details, archive_details, countries
facebook_marketplacesearch, vehicles, rentals, listing, seller, categories, city_coordinates
facebook_media_downloaddownload
instagram_profiledetails, id, posts, reels, highlights, highlight_details
instagram_postdetails, id
instagram_reelsfeed, by_audio
instagram_searchsearch
instagram_locationposts, nearby

调用示例:

{ "name": "facebook_post", "arguments": { "action": "comments", "link": "https://www.facebook.com/nike/posts/POST_ID", "limit": 20 } }

缺少 action 或必需输入时,会在扣除任何积分之前返回错误。客户端中每个工具的说明都列出了相同的输入项,并按操作区分。

从 1.x 升级? 直接调用时,旧版按端点划分的工具名称(例如 facebook_get_page_details)仍然有效,因此现有脚本可以继续运行。如果客户端会自动批准工具或按名称设置允许列表,请将上方的新名称添加进去。

各操作的输入

除非另有说明,积分按调用次数计算。分页:传入响应中的 end_cursor 以获取下一页。

facebook_page

Facebook 主页:个人资料详情、主页 ID、帖子、视频、Reels 和相册。

操作必需输入可选输入积分
detailslinkexact_followers_count1(使用 exact_followers_count=true 时为 5)
idlink—1
postslinklimit, end_cursor, after_time, before_time, timezone每返回 3 条帖子计 1 积分(至少 1)
videoslink 或 profile_idlimit, end_cursor1
reelslinkend_cursor1
albumsprofile_id(来自 id)limit(8-16)、end_cursor1
album_itemsalbum_id(来自 albums)end_cursor1

facebook_group

公开 Facebook 群组:详情、群组 ID、帖子、视频和相册。

操作必需输入可选输入积分
detailslink—1
idlink—1
postslinklimit, end_cursor, after_time, before_time, timezone每返回 3 条帖子计 1 积分(至少 1)
videoslinkend_cursor1
albumsgroup_id(来自 id)limit(8-16)1
album_itemsalbum_id(来自 albums)end_cursor1

facebook_post

Facebook 帖子、视频和评论:帖子详情、附件、评论和回复。

操作必需输入可选输入积分
detailslink—1
details_extendedlink—1
idlink—1
attachmentspost_id—5
videovideo_id—1
commentslinklimit, end_cursor, include_reply_info1
comment_repliescomment_feedback_id, expansion_token—1

facebook_search

按关键词搜索 Facebook:主页、用户、帖子、视频和地点。

操作必需输入可选输入积分
pagesquerylocation_uid, end_cursor1
peoplequerylocation_uid, end_cursor1
postsquerylocation_uid, start_time, end_time, recent_posts, end_cursor1
videosquerymost_recent, videos_live, fields, end_cursor1
locationsquery—1

facebook_ads

Meta 广告资料库:搜索广告、按关键词查找广告主、广告主页详情、单条广告详情和支持的国家/地区。

操作必需输入可选输入积分
search—query, ad_page_id, country, activeStatus, after_time, before_time, sort_data, end_cursor1
keywordsquerycountry1
page_detailspage_id—1
archive_detailsad_archive_idpage_id, country, is_ad_non_political, is_ad_not_aaa_eligible1
countries——1

facebook_marketplace

Facebook Marketplace:搜索商品、车辆和租赁信息,查看商品和卖家详情、类别及城市坐标。

操作必需输入可选输入积分
search—query, category_url, commerce_search_sort_by, commerce_search_and_rp_condition, filter_location_latitude, filter_location_longitude, filter_price_lower_bound, filter_price_upper_bound, filter_radius_km, posted_today, exact_match, limit, end_cursor1
vehicles—sort_by, filter_location_latitude, filter_location_longitude, filter_price_lower_bound, filter_price_upper_bound, filter_radius_km, is_c2c_listing_only, end_cursor1
rentals—sort_by, filter_location_latitude, filter_location_longitude, filter_price_lower_bound, filter_price_upper_bound, filter_radius_km, filter_bedrooms_min, filter_bedrooms_max, filter_bathrooms_min, filter_bathrooms_max, end_cursor1
listinglisting_id—1
sellerseller_id—1
categories——1
city_coordinatescitycountry, exactly_one1

facebook_media_download

从 URL 下载 Facebook 媒体(图片、视频、音频)。

操作必需输入可选输入积分
downloadurl—1

instagram_profile

Instagram 个人资料:详情、用户 ID、帖子、Reels、精选动态和精选动态快拍。

操作必需输入可选输入积分
detailsusernamelink1
id—link, username1
posts—username, user_id, end_cursor1
reelsuser_idend_cursor1
highlightsuser_id—1
highlight_detailshighlight_id—1

instagram_post

Instagram 帖子:完整帖子详情,或从帖子 URL 获取 shortcode。

操作必需输入可选输入积分
detailsshortcode—1
idlink—1

instagram_reels

Instagram Reels:热门动态,或使用指定音轨的 Reels。

操作必需输入可选输入积分
feed—clips_media_id1
by_audioaudio_idmax_id1

instagram_search

按关键词搜索 Instagram 上的热门用户、话题标签和地点。

操作必需输入可选输入积分
searchkeywordend_cursor1

instagram_location

Instagram 地点:标记在某个地点的帖子,以及附近地点。

操作必需输入可选输入积分
postslocation_idtab, end_cursor1
nearbylocation_id—1

示例提示词

“获取 Nike 的 Facebook 主页详情,并总结最近 10 条帖子。”

“比较 Adidas 和 Nike 在 Instagram 上的粉丝数。”

“查找 Meta 广告资料库中在美国投放且提及‘跑鞋’的活跃广告。”

故障排除

症状解决方法
Missing SocialAPIs API key添加 Authorization: Bearer <key> 请求头(托管方式)或 SOCIALAPIS_API_KEY(npx)。
结果中出现 HTTP 401 或 403从控制面板重新复制密钥。
Insufficient credits在 socialapis.io/pricing 升级套餐或充值。
未列出任何工具编辑配置后重启客户端,并检查 https://mcp.socialapis.io/health 是否有响应(在浏览器中打开)。

联系我们

该服务器已列入官方 MCP Registry,名称为 io.github.SocialAPIsHub/social-media-api,也收录于 Smithery、Glama、cursor.directory、LobeHub、mcp.so 和 mcpservers.org。请访问 socialapis.io/integrations 查看链接。

源代码:github.com/SocialAPIsHub/mcp-server。如有疑问,请联系:support@socialapis.io。