Facebook Pages Mcp

io.github.lanternrow由 GitHub 账号 lanternrow 发布v1.0.3更新于 Oct 24, 2026

Facebook Pages organic analytics, post management, and insights via Meta Graph API v25.0.

概览

AI 生成的概览

让助手通过 Meta Graph API 读取 Facebook 主页的 analytics、帖子、评论和视频数据,并发布新帖子。

可以做什么
通过 Meta Graph API v25.0 将兼容 MCP 的助手连接到 Facebook 主页。读取类工具涵盖主页元数据、可按日期范围和按日/周/28 天聚合的主页级 analytics、已发布帖子、单帖互动数据、帖子评论、视频表现以及完整主页动态。一个写入工具 create_post 可发布文字、链接或图片帖子,另有一个工具用于检查令牌有效性、过期时间和已授权范围。
适用场景
适合管理 Facebook 主页、希望助手在不离开对话的情况下获取自然流量 analytics、查看帖子和视频表现、阅读评论或起草并发布帖子的场景。它使用当前未弃用的主页指标,并同时支持通过 Business Manager 管理的主页和个人账号主页。
运行要求
以 stdio 方式在本地运行,通常通过 npx 或已构建的 Node.js 项目(Node 18+ 以使用原生 fetch)。需要一个 Meta 应用,并在 FB_PAGE_ACCESS_TOKEN 中提供长期主页访问令牌,在 FB_PAGE_ID 中提供数字主页 ID。需要访问 Meta Graph API 的网络连接。
安装前请注意
FB_PAGE_ACCESS_TOKEN 是长期凭证,可访问该主页;持有者可读取主页数据并发布帖子,应妥善保管,泄露后立即撤销。create_post 工具会向主页写入公开可见的内容。主页数据会发送至 Meta 的 Graph API,令牌配置涉及 pages_show_list、pages_read_engagement 和 business_management 等 Meta 应用权限。

安装

在 SourceWeft 中

  1. 打开 控制台中的 Facebook Pages Mcp,将其添加到工作区。
  2. 为需要使用其工具的对话启用该服务。

Desktop only,通过 STDIO。 STDIO 服务会启动本地进程,因此需要 SourceWeft 桌面宿主。

其他 MCP 客户端

参照 仓库 中的启动说明。

README

facebook-pages-mcp

[npm version] [License: MIT]

MCP server for Facebook Pages organic analytics and management, powered by Meta Graph API v25.0.

Built for Claude Code and any MCP-compatible AI tool. Gives your AI assistant direct access to your Facebook Page data — posts, insights, comments, and more.

Part of The SEO Engine toolkit by Rex Jones — AI-powered SEO and social media tooling for agencies and businesses.

Why this exists

  • No good Facebook Pages MCP server existed. Instagram has several. Facebook Pages had none that worked on a current API version.
  • Meta deprecated legacy metrics on June 15, 2026. page_impressions, page_reach, and page_impressions_unique no longer return data. This server uses the replacement metrics from day one.
  • Business Manager support. Most businesses manage Pages through Meta Business Manager, not personal accounts. This server works with both.

Quick start

Option 1: npx (no install)

json
{  "mcpServers": {    "facebook-pages": {      "command": "npx",      "args": ["-y", "facebook-pages-mcp"],      "env": {        "FB_PAGE_ACCESS_TOKEN": "your_page_access_token",        "FB_PAGE_ID": "your_page_id"      }    }  }}

Option 2: Clone and build

bash
git clone https://github.com/lanternrow/facebook-pages-mcp.gitcd facebook-pages-mcpnpm installnpm run build

Then add to your Claude Code MCP settings:

json
{  "mcpServers": {    "facebook-pages": {      "command": "node",      "args": ["/path/to/facebook-pages-mcp/dist/index.js"],      "env": {        "FB_PAGE_ACCESS_TOKEN": "your_page_access_token",        "FB_PAGE_ID": "your_page_id"      }    }  }}

Getting your Page Access Token

Step 1: Create a Meta App

  1. Go to Meta for Developers and click Create App
  2. Name your app and choose the "Manage everything on your Page" use case
  3. Connect it to your Business Portfolio

Step 2: Generate a token in the Graph API Explorer

  1. Open the Graph API Explorer
  2. Select your app from the Meta App dropdown
  3. Add permissions: pages_show_list, pages_read_engagement, business_management
  4. Click Generate Access Token and complete the OAuth flow
  5. When asked about Pages, select "Opt in to all current and future Pages"

Step 3: Get your Page Access Token

If your Pages are managed through Business Manager (most businesses):

# First, find your business IDGET /me/businesses?fields=id,name
# Then get Page tokens for that businessGET /{business-id}/owned_pages?fields=id,name,access_token

If your Pages are on your personal account:

GET /me/accounts?fields=id,name,access_token

Copy the access_token and id for the Page you want.

Step 4: Exchange for a long-lived token (recommended)

Short-lived tokens expire in ~1 hour. Exchange for a long-lived token (~60 days):

GET /oauth/access_token  ?grant_type=fb_exchange_token  &client_id={your-app-id}  &client_secret={your-app-secret}  &fb_exchange_token={short-lived-token}

Tip: For Pages you admin, Page tokens derived from a long-lived User Token never expire.

Tools

Read tools

ToolDescription
get_page_infoPage metadata: name, category, follower count, contact info, cover photo
get_page_insightsPage-level analytics with date ranges and period aggregation (day/week/28-day)
get_published_postsPaginated list of posts authored by the Page
get_post_insightsPer-post engagement: impressions, clicks, reactions by type
get_post_commentsPaginated comments with author info and like/reply counts
get_video_insightsVideo performance: views, watch time, reactions
get_page_feedFull feed including visitor posts

Write tools

ToolDescription
create_postPublish text, link, or photo posts to the Page

Utility tools

ToolDescription
refresh_token_infoCheck token validity, expiration, and granted scopes

Metrics and the June 2026 deprecation

Meta deprecated these page-level metrics on June 15, 2026:

DeprecatedReplacement
page_impressionspage_views_total
page_reachPage Viewer metric (rolling out)
page_impressions_uniqueMedia Viewers metric (rolling out)

This server uses only non-deprecated metrics: page_views_total, page_fans, page_fan_adds, page_fan_removes, page_actions_post_reactions_total.

Architecture

src/  index.ts          # MCP server entry point, tool registration  client.ts         # Graph API HTTP client (native fetch, no dependencies)  types.ts          # TypeScript interfaces for API responses  tools/    pages.ts        # get_page_info, get_page_feed    insights.ts     # get_page_insights, get_video_insights    posts.ts        # get_published_posts, get_post_insights, get_post_comments, create_post    utils.ts        # refresh_token_info
  • Zero external HTTP dependencies — uses Node 18+ native fetch
  • Rate limit tracking — captures x-app-usage and x-page-usage headers
  • Cursor-based pagination — all list endpoints support after cursor and configurable limits
  • Zod validation — all tool inputs validated with descriptive error messages

Environment variables

VariableRequiredDescription
FB_PAGE_ACCESS_TOKENYesLong-lived Page Access Token
FB_PAGE_IDYesDefault Facebook Page ID (numeric)

Development

bash
npm run dev    # Watch mode — recompiles on savenpm run build  # Production buildnpm start      # Run the server

Contributing

Issues and PRs welcome. If Meta changes the API (they will), please open an issue.

License

MIT — see LICENSE.


Built as part of The SEO Engine by Rex Jones.

来源:README.md,提交 ef120c0

工具

0
SourceWeft 尚未在沙箱中启动过该软件包,因此其工具未知。

版本历史

1
  1. v1.0.3最新Sep 16, 2026

评分

已满足适用检查项的 50%

该评分衡量此收录条目的完整程度,依据注册中心条目、端点与公开来源计算得出。它不是对服务器本身的评价,也不表示服务器安全或当前可用:可连通性是带日期的检查结果,评分也不包含安装量或用户评价。

  • 近 30 天内可连通25 分

    请保持端点能够响应 MCP 握手;SourceWeft 每 30 天探测一次。

  • 已声明认证方式10 分

    请在注册中心条目中声明凭据请求头,或保持端点能够响应探测,以便判定其认证方式。

  • 已列出工具15 分

    请让服务器在无凭据时响应 tools/list,或发布可在沙箱中无凭据启动的软件包。

  • 描述必需15 分
  • 图标10 分
  • 文档15 分
  • 许可证10 分