PagePilot MCP
Enables AI agents to manage a Facebook Fanpage via the official Graph API, supporting posting, scheduling, comment moderation, and analytics, without scraping or accessing private messages.
README
π PagePilot MCP
π Language / NgΓ΄n ngα»―: English Β· TiαΊΏng Viα»t
An MCP server that lets AI agents manage a Facebook Fanpage through the official Graph API β safe, no scraping, and never touching private messages.
π Table of Contents
- Introduction
- Key Features
- Why Is It Safe?
- Requirements
- Getting a Facebook Token
- Installation & Running
- MCP Client Configuration
- The 29 Tools
- Project Structure
- Environment Variables
- Disclaimer
- License
- Author
π Introduction
PagePilot MCP is an MCP (Model Context Protocol) server written in Python that lets AI agents such as Claude Desktop, Cursor, or any MCP client directly manage a Facebook Fanpage through the official Facebook Graph API.
Instead of opening a browser and doing everything by hand, you simply give your AI agent instructions in natural language β and PagePilot takes care of the rest: publishing posts, scheduling, moderating comments, and analyzing performance.
π‘ Every action goes through a legitimate Page Access Token that you yourself grant. No cookies, no scraping, no hacks.
β¨ Key Features
- π Versatile posting β text, photos, links; create / edit / delete posts and schedule posts for future publishing.
- π¬ Smart comment moderation β reply, hide / unhide, delete, bulk operations, and automatic negative comment filtering.
- π In-depth analytics β fan count, post insights, reactions, and like / share / comment counts.
- π Token management β check Page status, debug tokens, and swap to a long-lived token (~60 days) with a single command.
- π‘οΈ Robust Graph client β automatically handles network / Graph API errors, with a configurable timeout.
- π§© 29 MCP tools, neatly organized into 4 clear groups.
π Why Is It Safe?
PagePilot is built on a "safety first" principle:
-
It uses only the official Facebook Graph API. No cookies, no HTML scraping, no browser automation. That means it does not violate Facebook's security mechanisms and carries no risk of getting banned for abnormal behavior.
-
It uses only a legitimate Page Access Token β a token that you (the Page admin) grant through Facebook's standard OAuth flow.
-
π« It DELIBERATELY excludes all messaging / Messenger / DM functionality. PagePilot does NOT read, send, or touch anyone's private messages. This tool does exactly one thing: manage a Page's public content β publishing posts, moderating comments, and analytics. User privacy is fully respected.
In short: PagePilot is a Page administration assistant, not a tool for spamming messages or tracking users.
π Requirements
- Python 3.10+ (Python 3.12 recommended)
- A Facebook Fanpage for which you are an admin
- A Facebook App of type Business (to obtain a token and grant permissions)
- Any MCP client (Claude Desktop, Cursor, etc.)
π Getting a Facebook Token
Follow these steps to obtain a Page Access Token and Page ID:
- Go to developers.facebook.com β Create App β choose the Business type.
- Open the Graph API Explorer (Tools β Graph API Explorer).
- In the dropdown, select your Page (instead of User).
- Grant the following permissions (scopes):
pages_manage_postsβ create / edit / delete postspages_read_engagementβ read engagement (likes, comments, shares)pages_manage_engagementβ moderate comments (hide, delete, reply)pages_read_user_contentβ read user-generated content on the Pageread_insightsβ read analytics (insights)
- Click Generate Access Token β copy the Page Access Token.
- Get your Page ID: go to the Page β About β Page transparency, or use the
page_statustool itself once configured.
β³ Recommended: The default token from the Explorer only lasts a few hours. Swap it for a long-lived token (~60 days) using the
exchange_long_lived_tokentool (requiresFB_APP_IDandFB_APP_SECRET).
βοΈ Installation & Running
# 1. Clone the project
git clone https://github.com/Thangterter-Pipo/pagepilot-mcp.git
cd pagepilot-mcp
# 2. Create a virtual environment (pick one)
python -m venv .venv # the standard way
# or
uv venv # if you use uv (faster)
# Activate the venv
source .venv/bin/activate # Linux / macOS
.venv\Scripts\activate # Windows
# 3. Install dependencies
pip install -r requirements.txt
# 4. Create a .env file from the template and fill in your token
cp .env.example .env
# Open .env and fill in FB_PAGE_ACCESS_TOKEN, FB_PAGE_ID...
# 5. Run the MCP server
python -m pagepilot.server
π§© MCP Client Configuration
Example configuration for Claude Desktop (the claude_desktop_config.json file):
{
"mcpServers": {
"pagepilot": {
"command": "python",
"args": ["-m", "pagepilot.server"],
"cwd": "/path/to/pagepilot-mcp",
"env": {
"FB_PAGE_ACCESS_TOKEN": "EAAB...your-token",
"FB_PAGE_ID": "1234567890",
"FB_APP_ID": "optional",
"FB_APP_SECRET": "optional",
"FB_GRAPH_VERSION": "v22.0",
"FB_REQUEST_TIMEOUT": "30"
}
}
}
}
π‘ If you use a virtualenv, point
commandto the Python inside the venv (e.g./path/to/pagepilot-mcp/.venv/bin/pythonor...\.venv\Scripts\python.exe) to make sure dependencies are loaded correctly.
After saving the config, restart your MCP client β you'll see PagePilot's 29 tools ready for your AI agent to call.
π οΈ The 29 Tools
PagePilot provides 29 MCP tools, organized into 4 groups:
1οΈβ£ Status & Token
page_statusβ Check the connection status and current Page information.debug_tokenβ Inspect token details: expiry, scopes, app ID (requiresFB_APP_ID/FB_APP_SECRET).exchange_long_lived_tokenβ Swap a short-lived token for a long-lived one (~60 days).
2οΈβ£ Posting
create_postβ Publish a text post to the Page.create_photo_postβ Publish a post with a photo.create_link_postβ Publish a post with a link (includes a preview).update_postβ Update the content of an existing post.delete_postβ Delete a post.schedule_postβ Schedule a post for a future time.get_scheduled_postsβ List posts that are pending scheduled publishing.
3οΈβ£ Reading Posts & Comments / Moderation
list_postsβ List the posts on the Page.get_postβ Get the details of a single post.get_post_permalinkβ Get the public link (permalink) of a post.list_commentsβ List the comments on a post.get_comment_repliesβ Get the replies to a comment.reply_to_commentβ Reply to a comment.delete_commentβ Delete a comment.hide_commentβ Hide a comment.unhide_commentβ Unhide a comment.bulk_delete_commentsβ Delete multiple comments at once.bulk_hide_commentsβ Hide multiple comments at once.filter_negative_commentsβ Filter / detect negative comments.
4οΈβ£ Analytics
get_page_infoβ Get an overview of the Page.get_fan_countβ The number of fans (followers) of the Page.get_post_insightsβ Detailed insights for a single post.get_post_reactionsβ Reaction statistics for a post.get_comment_countβ Count the comments on a post.get_like_countβ Count the likes on a post.get_share_countβ Count the shares of a post.
π Project Structure
pagepilot-mcp/
βββ pagepilot/
β βββ __init__.py
β βββ config.py # Read & validate environment variables (.env)
β βββ graph_client.py # Robust Graph API client: auto-handles network/Graph errors,
β β # supports debug_token + long-lived token exchange
β βββ manager.py # Business logic for all the tools
β βββ server.py # FastMCP entry point (run: python -m pagepilot.server)
βββ requirements.txt
βββ .env.example
βββ LICENSE
βββ README.md
π§ Environment Variables
Set these in your .env file (copy from .env.example):
FB_PAGE_ACCESS_TOKENβ (required) Page Access Token.FB_PAGE_IDβ (required) The Fanpage's ID.FB_APP_IDβ (optional) App ID β only needed fordebug_tokenor long-lived token exchange.FB_APP_SECRETβ (optional) App Secret β only needed fordebug_tokenor long-lived token exchange.FB_GRAPH_VERSIONβ (optional) Graph API version, defaults tov22.0.FB_REQUEST_TIMEOUTβ (optional) Per-request timeout (seconds), defaults to30.
Example .env:
FB_PAGE_ACCESS_TOKEN=EAAB...your-token-here
FB_PAGE_ID=1234567890
FB_APP_ID=
FB_APP_SECRET=
FB_GRAPH_VERSION=v22.0
FB_REQUEST_TIMEOUT=30
β οΈ Disclaimer
- PagePilot is intended only for managing Fanpages that you own or have administrative rights to.
- You are responsible for complying with Facebook / Meta's Terms of Service (ToS) and Platform Policies when using this tool.
- This tool does not support and does not encourage spam, engagement manipulation, or any policy-violating behavior.
- The author is not responsible for misuse. Please use it responsibly. π
π License
This project is released under the MIT License. You are free to use, modify, and distribute it.
π€ Author
Thangterter-Pipo π GitHub: github.com/Thangterter-Pipo
If PagePilot is useful to you, please β star the repo to show your support! All issues and pull requests are welcome. π
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.