Facebook MCP Server

Facebook MCP Server

Enables AI agents to automate Facebook Page management including posting, commenting, and analytics via the Facebook Graph API.

Category
访问服务器

README

Facebook MCP Server

This project is a MCP server for automating and managing interactions on a Facebook Page using the Facebook Graph API. It exposes tools to create posts, moderate comments, fetch post insights, and filter negative feedback — ready to plug into Claude, or other LLM-based agents.

Trust Score <a href="https://glama.ai/mcp/servers/@HagaiHen/facebook-mcp-server"> <img width="380" height="200" src="https://glama.ai/mcp/servers/@HagaiHen/facebook-mcp-server/badge" /> </a>


🤖 What Is This?

This MCP provides a suite of AI-callable tools that connect directly to a Facebook Page, abstracting common API operations as LLM-friendly functions.

✅ Benefits

  • Empowers social media managers to automate moderation and analytics.
  • Seamlessly integrates with Claude Desktop or any Agent client.
  • Enables fine-grained control over Facebook content from natural language.

📦 Features

Tool Description
post_to_facebook Create a new Facebook post with a message.
reply_to_comment Reply to a specific comment on a post.
get_page_posts Retrieve recent posts from the Page.
get_post_comments Fetch comments on a given post.
delete_post Delete a specific post by ID.
delete_comment Delete a specific comment by ID.
hide_comment Hide a comment from public view.
unhide_comment Unhide a previously hidden comment.
delete_comment_from_post Alias for deleting a comment from a specific post.
filter_negative_comments Filter out comments with negative sentiment keywords.
get_number_of_comments Count the number of comments on a post.
get_number_of_likes Count the number of likes on a post.
get_post_impressions Get total impressions on a post.
get_post_impressions_unique Get number of unique users who saw the post.
get_post_impressions_paid Get number of paid impressions on the post.
get_post_impressions_organic Get number of organic impressions on the post.
get_post_engaged_users Get number of users who engaged with the post.
get_post_clicks Get number of clicks on the post.
get_post_reactions_like_total Get total number of 'Like' reactions.
get_post_top_commenters Get the top commenters on a post.
post_image_to_facebook Post an image with a caption to the Facebook page.
send_dm_to_user Send a direct message to a user.
update_post Updates an existing post's message.
schedule_post Schedule a post for future publication.
get_page_fan_count Retrieve the total number of Page fans.
get_post_share_count Get the number of shares on a post.
get_post_reactions_breakdown Get all reaction counts for a post in one call.
bulk_delete_comments Delete multiple comments by ID.
bulk_hide_comments Hide multiple comments by ID.
bulk_unhide_comments Unhide multiple comments by ID.
get_comment_replies Get all replies to a specific comment.
get_post_permalink Get the permalink URL of a post.
get_scheduled_posts List all scheduled (unpublished) posts on the Page.
get_page_info Get extended Page details (name, about, category, website).

This fork runs the server over HTTP (streamable-http) in Docker, designed for LAN/Tailscale access. Unlike upstream, the server holds no credentials — each client sends its Facebook access token + page id per request via HTTP headers. Original stdio project: hagaihen/facebook-mcp-server.

🚀 Deploy with Docker Compose

git clone git@github.com:hoangvantuan/fb_page_mcp.git
cd fb_page_mcp
docker compose up -d --build

Service fb-mcp listens on the endpoint http://<host>:9000/mcp (container 0.0.0.0:8000, published as 9000:8000, stateless, restart: unless-stopped, healthcheck included).

docker compose logs -f      # xem log
docker compose ps           # trạng thái (Up healthy)
docker compose down         # dừng

Architecture — credentials from the client

The server keeps no secret. facebook_api.py reads credentials from the current request's headers (via the MCP SDK request_ctx), so every client uses its own Page:

Header Meaning
X-Facebook-Access-Token Facebook Page access token
X-Facebook-Page-Id Facebook Page ID

Missing either header → the tool returns a clear Missing credentials error (no empty API call). run_http.py disables the SDK's DNS-rebinding protection so non-localhost Hosts (LAN/Tailscale IP) are accepted.

🧩 Connect from Claude Code

# host has exported FACEBOOK_ACCESS_TOKEN + FACEBOOK_PAGE_ID; single quotes keep
# the secret out of the config file (Claude Code resolves ${VAR} at runtime)
claude mcp add --transport http fb-mcp http://<HOST-OR-TAILSCALE-IP>:9000/mcp \
  --header 'X-Facebook-Access-Token: ${FACEBOOK_ACCESS_TOKEN}' \
  --header 'X-Facebook-Page-Id: ${FACEBOOK_PAGE_ID}'

Verify: claude mcp list shows fb-mcp connected → call get_page_info.

Getting the credentials

Get a Page Access Token (not a User token) + Page ID from https://developers.facebook.com/tools/explorer (choose Get Page Access Token), granting pages_show_list, pages_read_engagement, pages_manage_posts, pages_manage_engagement, read_insights, and pages_messaging. GET /me?fields=id with the Page token returns the Page ID.

⚠️ Security note

No application-level auth. Anyone who can reach port 9000 and holds a valid token can call every tool. Use only on a trusted LAN/tailnet. To tighten: bind ports to a single host IP ("192.168.x.x:9000:8000"), firewall the port, or add a reverse proxy checking a bearer token.


🤝 Contributing

Contributions, issues, and feature requests are welcome!
Feel free to fork the repo and submit a pull request.

  • Create a branch: git checkout -b feature/YourFeature
  • Commit your changes: git commit -m 'feat: add new feature'
  • Push to the branch: git push origin feature/YourFeature
  • Open a pull request 🎉

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选