Provides comprehensive tools for managing Facebook Pages through the Graph API, including creating and scheduling posts, moderating comments, sending direct messages, retrieving analytics and insights (impressions, engagement, reactions), and managing page content.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Just Facebook MCP Serverpost a new update about our summer sale starting tomorrow"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Just_Facebook MCP Server
This project is a Model Context Protocol (MCP) server for automating and managing interactions on a Facebook Page using the Facebook Graph API. It provides tools to create posts, moderate comments, fetch post insights, and filter negative feedback β ready to plug into Claude or any other LLM-based agent.
Originally developed from
@HagaiHen/facebook-mcp-server, this version is intended for packaging and distribution via PyPI.
π€ 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 any Agent client.
Enables fine-grained control over Facebook content from natural language.
π¦ Features
Tool | Description |
| Create a new Facebook post with a message. |
| Reply to a specific comment on a post. |
| Retrieve recent posts from the Page. |
| Fetch comments on a given post. |
| Delete a specific post by ID. |
| Delete a specific comment by ID. |
| Alias for deleting a comment from a specific post. |
| Filter out comments with negative sentiment keywords. |
| Count the number of comments on a post. |
| Count the number of likes on a post. |
| Get total impressions on a post. |
| Get number of unique users who saw the post. |
| Get number of paid impressions on the post. |
| Get number of organic impressions on the post. |
| Get number of users who engaged with the post. |
| Get number of clicks on the post. |
| Get total number of 'Like' reactions. |
| Get the top commenters on a post. |
| Post an image with a caption to the Facebook page. |
| Send a direct message to a user. |
| Updates an existing post's message. |
| Schedule a post for future publication. |
| Retrieve the total number of Page fans. |
| Get the number of shares on a post. |
π Setup & Installation
1. Prerequisites
This project requires Python 3.10+ and uv (a fast Python package manager).
To install uv, run:
2. Clone the Repository
3. π οΈ Install Dependencies
Use the uv tool with pyproject.toml:
4. Set Up Environment
Create a .env file in the root directory and add your Facebook Page credentials:
Getting Your Facebook Credentials
Log into Facebook for Developers
Choose Developer as your use case.
Create a new app.
In the app dashboard, go to Customize Use Case and select all options.
Navigate to Tools β Graph API Explorer.
First create a User Access Token β make sure to:
*Select all required permissions
*Associate it with your app
Then generate a Page Access Token (this will inherit the permissions).
Save the Page Access Token and use it in the .env file.
To find your Page ID:
Go to your Facebook Page β About β Scroll down to view the ID
β° Important: Facebook API Token Limitations
Facebook access tokens have limited lifespans and will expire, causing API calls to fail. Understanding these limitations is crucial for maintaining your MCP server.
Token Types & Lifespans:
Token Type | Lifespan | Use Case |
Short-lived User Token | 1-2 hours | Testing only |
Long-lived User Token | 60 days | Development |
Short-lived Page Token | 1-2 hours | Testing only |
Long-lived Page Token | 60 days | Recommended for MCP |
System User Token | No expiration* | Production apps |
When Tokens Expire:
β All MCP tools will return
OAuthExceptionerrorsβ Error message: "Session has expired"
β Error codes: 190 (expired token) or 463 (session expired)
Automatic Token Refresh:
We provide a script to easily generate long-lived tokens (60 days):
This script will:
β Guide you through token generation
β Exchange short-lived for long-lived tokens
β Update your
.envfile automaticallyβ Validate the new token
Best Practices:
π Refresh tokens every 50 days to avoid expiration
π Set calendar reminders for token renewal
π€ Use long-lived Page tokens for development
π’ Consider System User tokens for production
Troubleshooting Token Issues:
5. πββοΈ Running the Server
π§© Using with Claude Desktop
To integrate with Claude Desktop:
Open Claude Desktop
Go to Settings β Developer β Edit Config
Fast setup with uvx
You can use the MCP server without local installing with uvx:
Add the following to your MCP configuration:
Development local setup:
If you already git-cloned the MCP server you can configure it locally.
Add the following to your MCP configuration:
Option 1: Using the package entry point (recommended)
Option 2: Using Python module
Option 3: If installed via pip
Replace /absolute/path/to/just_facebook_mcp-server with your actual project path.
π§ Development
Running Tests
Code Formatting
Type Checking
Install Development Dependencies
β You're Ready to Go!
Your Facebook MCP server is now configured and ready to power Claude Desktop! You can:
β¨ Create posts through natural language
π Get analytics and insights
π¬ Moderate comments automatically
π― Schedule content
π Track engagement metrics
π€ Contributing
Contributions, issues, and feature requests are welcome!
π License This project is licensed under the MIT License. See the LICENSE file for details.