PagePilot MCP

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.

Category
Visit Server

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.

Python License: MIT MCP Facebook Graph API


πŸ“‘ Table of Contents


🌟 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:

  1. 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.

  2. It uses only a legitimate Page Access Token β€” a token that you (the Page admin) grant through Facebook's standard OAuth flow.

  3. 🚫 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:

  1. Go to developers.facebook.com β†’ Create App β†’ choose the Business type.
  2. Open the Graph API Explorer (Tools β†’ Graph API Explorer).
  3. In the dropdown, select your Page (instead of User).
  4. Grant the following permissions (scopes):
    • pages_manage_posts β€” create / edit / delete posts
    • pages_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 Page
    • read_insights β€” read analytics (insights)
  5. Click Generate Access Token β†’ copy the Page Access Token.
  6. Get your Page ID: go to the Page β†’ About β†’ Page transparency, or use the page_status tool 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_token tool (requires FB_APP_ID and FB_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 command to the Python inside the venv (e.g. /path/to/pagepilot-mcp/.venv/bin/python or ...\.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 (requires FB_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 for debug_token or long-lived token exchange.
  • FB_APP_SECRET β€” (optional) App Secret β€” only needed for debug_token or long-lived token exchange.
  • FB_GRAPH_VERSION β€” (optional) Graph API version, defaults to v22.0.
  • FB_REQUEST_TIMEOUT β€” (optional) Per-request timeout (seconds), defaults to 30.

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

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

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.

Official
Featured