Skip to main content
Glama
facebook-automata-mcp

facebook-automata-mcp

by ICWR-TEAM

facebook-automata-mcp

MCP(Model Context Protocol)服务器,面向 官方 Facebook Graph API。它提供了覆盖主页、帖子、评论、点赞/反应、照片/视频、活动及数据洞察(Insights)的完整工具集,另外还有专门用于保存和验证 Facebook 凭据的工具。

安装与运行

如果你已安装 uv,则无需安装:

uvx facebook-automata-mcp

或者通过 pip 安装:

pip install facebook-automata-mcp
facebook-automata-mcp

在 MCP 客户端中使用(例如 Claude Desktop / Claude Code)

{
  "mcpServers": {
    "facebook": {
      "command": "uvx",
      "args": ["facebook-automata-mcp"]
    }
  }
}

Related MCP server: facebook-mcp-video-reels

凭据

你无需手动编辑任何配置文件。一旦服务器连接到你的 MCP 客户端,只需用自己的话让它配置 Facebook,它会调用 set_facebook_credentials 工具,例如:

“将我的 Facebook 访问令牌设置为 EAAB...”

这一过程将:

  1. 通过 GET /me 验证该令牌。

  2. 将其保存到 ~/.facebook-automata-mcp/credentials.json(以 0700/0600 权限创建,仅所有者可访问)。

  3. 返回验证后的身份信息(id/name)。

可提供的字段:

字段

必填

用途

access_token

是

用户、主页或应用的访问令牌

app_id

否

启用 /debug_token 内省(作用域、过期时间)

app_secret

否

与 app_id 一同用于 /debug_token

page_id

否

当某个工具的 page_id 参数被省略时使用的默认主页 ID

api_version

否

Graph API 版本,默认为 v21.0

你可以随时通过 check_facebook_credentials(实时验证调用)或 get_credentials_status(离线,仅检查文件是否存在)来查看当前凭据,并用 clear_facebook_credentials 删除它们。

你还可以通过环境变量提供凭据,而不是(或同时配合)已保存的文件——环境变量始终优先:

FACEBOOK_AUTOMATA_MCP_ACCESS_TOKEN=...
FACEBOOK_AUTOMATA_MCP_APP_ID=...
FACEBOOK_AUTOMATA_MCP_APP_SECRET=...
FACEBOOK_AUTOMATA_MCP_PAGE_ID=...
FACEBOOK_AUTOMATA_MCP_API_VERSION=v21.0
FACEBOOK_AUTOMATA_MCP_HOME=/custom/path   # overrides ~/.facebook-automata-mcp

获取一个令牌

对于主页来说,最快的方式是使用 Meta 的 Graph API Explorer:选择你的应用,生成一个带 pages_show_list、pages_read_engagement、pages_read_user_content、pages_manage_posts 和 pages_manage_engagement 权限的用户访问令牌,然后在这里调用 get_my_accounts 获取你主页自己的(page-scoped)访问令牌,再把它作为 access_token 用于主页级工具。

工具

凭据

  • set_facebook_credentials — 保存并验证令牌

  • check_facebook_credentials — 实时验证 + /debug_token 信息

  • get_credentials_status — 离线检查

  • clear_facebook_credentials — 删除已保存的凭据

身份

  • get_my_profile、get_user_profile、get_my_accounts

主页

  • search_pages, get_page_info, get_page_posts, get_page_feed, get_page_tagged_posts, get_page_events, get_page_photos, get_page_videos, get_page_albums, get_page_insights

帖子

  • get_post、publish_page_post、delete_post

评论

  • get_post_comments(包含评论者)、get_comment、 get_comment_replies、publish_comment、reply_to_comment、 delete_comment、hide_comment

点赞 / 反应

  • get_post_likes、get_post_reactions(谁 + 哪种反应)、 get_comment_likes、get_comment_reactions、like_object、 unlike_object

媒体

  • upload_page_photo、upload_page_video

逃生通道

  • graph_api_get、graph_api_post、graph_api_delete — 调用上面未涵盖的任何 Graph API 边(edge)

所有列表式工具都接受 limit 和 after(即上一次调用返回的 next_cursor 作为分页游标),并返回 {ok, data, paging, next_cursor}。

Facebook API 限制说明

  • 由于隐私政策,较新的 Graph API 版本对普通用户的大多数个人资料字段以及经典的“谁点赞 / 好友列表”数据进行了限制——由主页拥有的(主页帖子、及其评论和反应)内容是主要受支持的使用场景。

  • 某些操作(发帖、删除、隐藏评论、数据洞察等)需要带有相应权限(pages_manage_posts、pages_manage_engagement、read_insights 等)的 主页访问令牌;对于公开应用,还需要通过 Meta App Review。

开发

python -m venv .venv && source .venv/bin/activate
pip install -e .
facebook-automata-mcp

发布到 PyPI

pip install build twine
python -m build
twine upload dist/*

发布后,任何人都可以用 uvx facebook-automata-mcp 运行它,而无需永久安装任何东西。

许可证

MIT

Available Tools

38 tools
check_facebook_credentialsA

Check whether Facebook credentials are configured and still valid.

Loads credentials from ~/.facebook-automata-mcp/credentials.json (or FACEBOOK_MCP_* environment variables), calls GET /me to confirm the access token still works, and — if app_id/app_secret are also configured — calls /debug_token to report scopes, expiry, and whether the token is still valid according to Facebook.

Inputs: no named parameters. Returns: object

clear_facebook_credentialsA

Delete the stored credentials file (~/.facebook-automata-mcp/credentials.json).

Inputs: no named parameters. Returns: object

delete_commentB

Delete a comment by ID (DELETE /{comment-id}).

Inputs: comment_id (required). Returns: object

delete_postA

Delete a post by ID (DELETE /{post-id}). Requires ownership permissions.

Inputs: post_id (required). Returns: object

get_commentC

Get details of a single comment by ID (GET /{comment-id}).

Inputs: comment_id (required), fields. Returns: object

get_comment_likesA

List people who liked a comment (GET /{comment-id}/likes).

Inputs: comment_id (required), after, limit. Returns: object

get_comment_reactionsB

List reactions on a comment with who reacted and how (GET /{comment-id}/reactions).

Inputs: comment_id (required), after, limit, reaction_type. Returns: object

get_comment_repliesB

List replies to a comment (GET /{comment-id}/comments).

Inputs: comment_id (required), after, limit, fields. Returns: object

get_credentials_statusA

Quickly report whether credentials exist on disk, without any network call.

Inputs: no named parameters. Returns: object

get_my_accountsA

List the Facebook Pages managed by the current user token (GET /me/accounts).

Useful to discover page_id values and their page-scoped access tokens (returned in the 'access_token' field of each item).

Inputs: after, limit. Returns: object

get_my_profileA

Get the profile of the identity behind the configured access token (GET /me).

Note: Facebook heavily restricts which fields are available for personal user tokens without app review (usually just id, name, picture). Page tokens will return the Page's own info.

Inputs: fields. Returns: object

get_page_albumsA

List photo albums on the Page (GET /{page-id}/albums).

Inputs: after, limit, page_id. Returns: object

get_page_eventsC

List events hosted by the Page (GET /{page-id}/events).

Inputs: after, limit, page_id. Returns: object

get_page_feedA

List the Page's feed: own posts + posts/links from others on the Page (GET /{page-id}/feed).

Inputs: after, limit, fields, page_id. Returns: object

get_page_infoC

Get details about a Facebook Page (name, about, category, fan_count, etc.).

If page_id is omitted, uses the default page_id stored via 'set_facebook_credentials'.

Inputs: fields, page_id. Returns: object

get_page_insightsA

Get Page analytics/insights (GET /{page-id}/insights).

Requires the Page access token to have the read_insights permission. metric is a comma-separated list, e.g. "page_impressions,page_engaged_users,page_fans,page_views_total". period is one of: day, week, days_28, month, lifetime.

Inputs: since, until, metric, period, +1 more. Returns: object

get_page_photosA

List photos posted by the Page (GET /{page-id}/photos?type=uploaded).

Inputs: after, limit, page_id. Returns: object

get_page_postsB

List posts published BY a Page (GET /{page-id}/posts).

since/until accept Unix timestamps or strtotime-compatible strings (e.g. "2026-01-01").

Inputs: after, limit, since, until, +2 more. Returns: object

get_page_tagged_postsC

List posts the Page has been tagged in (GET /{page-id}/tagged).

Inputs: after, limit, fields, page_id. Returns: object

get_page_videosC

List videos posted by the Page (GET /{page-id}/videos).

Inputs: after, limit, page_id. Returns: object

get_postB

Get full details of a single post by its ID (GET /{post-id}).

Inputs: post_id (required), fields. Returns: object

get_post_commentsB

List comments on a post, including who commented (GET /{post-id}/comments).

order: "chronological" or "reverse_chronological". filter: "toplevel" (top-level comments only) or "stream" (include replies inline). Each comment item includes 'from' with the commenter's id/name.

Inputs: post_id (required), after, limit, order, +2 more. Returns: object

get_post_likesB

List people who liked a post, including their id/name (GET /{post-id}/likes).

Inputs: post_id (required), after, limit. Returns: object

get_post_reactionsA

List reactions on a post with who reacted and how (GET /{post-id}/reactions).

reaction_type filters to one of: LIKE, LOVE, WOW, HAHA, SAD, ANGRY, THANKFUL, CARE. Omit to get all reaction types (each item includes a 'type' field showing which reaction the person used).

Inputs: post_id (required), after, limit, reaction_type. Returns: object

get_user_profileB

Get public profile info for a given Facebook user or page ID.

Note: Modern Graph API restricts most personal fields for non-consenting users; only public fields (id, name, picture, etc.) are typically returned unless you have specific permissions/roles.

Inputs: user_id (required), fields. Returns: object

graph_api_deleteC

Generic DELETE against any Graph API edge, e.g. edge="{post-id}".

Inputs: edge (required), params. Returns: object

graph_api_getA

Generic GET against any Graph API edge, e.g. edge="{id}/comments".

Use this for any endpoint not covered by a dedicated tool. params is passed through as query parameters (do not include access_token).

Inputs: edge (required), params. Returns: object

graph_api_postB

Generic POST against any Graph API edge, e.g. edge="{id}/feed".

Inputs: edge (required), data. Returns: object

hide_commentA

Hide or unhide a comment on your Page's post (POST /{comment-id}?is_hidden=...).

Inputs: comment_id (required), hide. Returns: object

like_objectA

Like a post/comment/object as the current identity (POST /{object-id}/likes).

Inputs: object_id (required). Returns: object

publish_commentA

Post a new top-level comment on a post (POST /{post-id}/comments).

Inputs: message (required), post_id (required). Returns: object

publish_page_postA

Publish a new post on a Page (POST /{page-id}/feed).

Set published=False and provide scheduled_publish_time (a future Unix timestamp) to schedule the post instead of publishing immediately.

Inputs: message (required), link, page_id, published, +1 more. Returns: object

reply_to_commentC

Reply to an existing comment (POST /{comment-id}/comments).

Inputs: message (required), comment_id (required). Returns: object

search_pagesA

Search public Facebook Pages by name/keyword (GET /search?type=page).

Inputs: query (required), after, limit. Returns: object

set_facebook_credentialsA

Store Facebook Graph API credentials and validate them immediately.

Saves the given values to ~/.facebook-automata-mcp/credentials.json (merged with any previously stored fields) and validates the access_token by calling GET /me. Use this once before using any other tool.

Args: access_token: A Facebook User, Page, or App access token (long-lived tokens recommended). Required. app_id: Your Facebook App ID (optional, enables token introspection via /debug_token). app_secret: Your Facebook App Secret (optional, used together with app_id for /debug_token introspection; never sent anywhere except graph.facebook.com). page_id: A default Facebook Page ID to use for tools where page_id is not explicitly supplied. api_version: Graph API version to target, e.g. "v21.0" (defaults to v21.0 if omitted).

Inputs: access_token (required), app_id, page_id, app_secret, +1 more. Returns: object

unlike_objectB

Remove a previously placed like (DELETE /{object-id}/likes).

Inputs: object_id (required). Returns: object

upload_page_photoA

Upload a photo to a Page from a public image URL (POST /{page-id}/photos).

Inputs: image_url (required), caption, page_id, published. Returns: object

upload_page_videoA

Upload a video to a Page from a public video URL (POST /{page-id}/videos).

Inputs: video_url (required), title, page_id, description. Returns: object

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 38 tools

    Disambiguation5/5

    Each tool targets a distinct Graph API resource and action, with clear boundaries even for similar pairs like get_my_profile vs get_user_profile or get_page_posts vs get_page_feed. The descriptions precisely define the scope of each tool.

    Naming Consistency5/5

    All tools follow a consistent snake_case verb_noun pattern (set_, get_, publish_, delete_, etc.) with uniform resource naming. There are no mixed conventions or vague names.

    Tool Count2/5

    At 38 tools, the server is overly large for its purpose. Many specific tools (e.g., get_post_comments, get_post_likes) duplicate functionality already covered by the generic graph_api_get/post/delete tools, exceeding the reasonable size for a focused toolset.

    Completeness4/5

    The toolset covers core Facebook automation workflows: credentials, profile, pages, posts, comments, likes, and media upload. Minor gaps like explicit update operations (edit post/comment) and event creation exist, but generic Graph API tools provide fallbacks.

    Maintenance

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables analytics and management of Facebook Pages through the Meta Graph API, including posts, insights, audience, and publishing.
      GPL 3.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables authentication with Facebook and provides tools to list pages, post text/images, upload videos, and create Reels on Facebook Pages.
      5 npm
      ISC
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables automating and managing Facebook Page interactions through the Graph API, including posting, comment moderation, engagement analytics, scheduling, and direct messaging from natural language.
      MIT
    • A
      license
      B
      quality
      C
      maintenance
      Enables MCP-based interaction with the Meta Graph API for Facebook Pages and linked Instagram Business accounts, including posting, commenting, and reading page details.
      6
      7 npm
      MIT