Just Facebook MCP Server
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 "Deploy 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 Server post 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.
Related MCP server: Facebook MCP Server
📦 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:
curl -LsSf https://astral.sh/uv/install.sh | sh2. Clone the Repository
3. 🛠️ Install Dependencies
Use the uv tool with pyproject.toml:
# Install all dependencies and create a virtual environment
uv sync
# For development (includes testing and linting tools)
uv sync --dev4. Set Up Environment
Create a .env file in the root directory and add your Facebook Page credentials:
FACEBOOK_ACCESS_TOKEN=your_facebook_page_access_token
FACEBOOK_PAGE_ID=your_page_idGetting 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):
uv run python scripts/refresh_facebook_token.pyThis 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:
# Check if your token is expired
uv run python -c "
from just_facebook_mcp.manager import Manager
manager = Manager()
try:
result = manager.get_page_fan_count()
print('✅ Token is working')
except Exception as e:
print(f'❌ Token error: {e}')
"5. 🏃♂️ Running the Server
# Option 1: Using the script entry point (recommended)
uv run just_facebook_mcp
# Option 2: Run the Python module directly
uv run python -m just_facebook_mcp.server
# Option 3: Activate virtual environment first
source .venv/bin/activate
python -m just_facebook_mcp.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:
{
"mcpServers": {
"just_facebook_mcp": {
"command": "uvx",
"args": [
"just_facebook_mcp"
],
"env": {
"FACEBOOK_ACCESS_TOKEN": "<put_your_FB_token_here>",
"FACEBOOK_PAGE_ID": "<put_your_page_id_here>"
}
}
}
}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)
{
"mcpServers": {
"just_facebook_mcp": {
"command": "uv",
"args": [
"run",
"--directory",
"/absolute/path/to/just_facebook_mcp-server",
"just_facebook_mcp"
]
}
}
}Option 2: Using Python module
{
"mcpServers": {
"just_facebook_mcp": {
"command": "uv",
"args": [
"run",
"--directory",
"/absolute/path/to/just_facebook_mcp-server",
"python",
"-m",
"just_facebook_mcp.server"
]
}
}
}Option 3: If installed via pip
{
"mcpServers": {
"just_facebook_mcp": {
"command": "just_facebook_mcp"
}
}
}Replace /absolute/path/to/just_facebook_mcp-server with your actual project path.
🔧 Development
Running Tests
uv run pytestCode Formatting
uv run black .Type Checking
uv run mypy .Install Development Dependencies
uv sync --dev✅ 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.
Available Tools
30 toolsdelete_commentC
Delete a specific comment from the Page. Input: comment_id (str) Output: dict with deletion result
Inputs: comment_id (required).
delete_comment_from_postC
Alias to delete a comment on a post. Input: post_id (str), comment_id (str) Output: dict with deletion result
Inputs: post_id (required), comment_id (required).
delete_postB
Delete a specific post from the Facebook Page. Input: post_id (str) Output: dict with deletion result
Inputs: post_id (required).
filter_negative_commentsC
Filter comments for basic negative sentiment. Input: comments (dict) Output: list of flagged negative comments
Inputs: comments (required).
get_number_of_commentsB
Count the number of comments on a given post. Input: post_id (str) Output: integer count of comments
Inputs: post_id (required).
get_number_of_likesB
Return the number of likes on a post. Input: post_id (str) Output: integer count of likes
Inputs: post_id (required).
get_page_fan_countB
Get the Page's total fan/like count. Input: None Output: integer fan count
Inputs: no named parameters.
get_page_postsB
Fetch the most recent posts on the Page. Input: None Output: dict with list of post objects and metadata
Inputs: no named parameters.
get_post_clicksC
Fetch number of post clicks. Input: post_id (str) Output: dict with click count
Inputs: post_id (required).
get_post_commentsC
Retrieve all comments for a given post. Input: post_id (str) Output: dict with comment objects
Inputs: post_id (required).
get_post_engaged_usersC
Fetch number of engaged users. Input: post_id (str) Output: dict with engagement count
Inputs: post_id (required).
get_post_impressionsB
Fetch total impressions of a post. Input: post_id (str) Output: dict with total impression count
Inputs: post_id (required).
get_post_impressions_organicB
Fetch organic impressions of a post. Input: post_id (str) Output: dict with organic impression count
Inputs: post_id (required).
get_post_impressions_paidC
Fetch paid impressions of a post. Input: post_id (str) Output: dict with paid impression count
Inputs: post_id (required).
get_post_impressions_uniqueC
Fetch unique impressions of a post. Input: post_id (str) Output: dict with unique impression count
Inputs: post_id (required).
get_post_insightsB
Fetch all insights metrics (impressions, reactions, clicks, etc). Input: post_id (str) Output: dict with multiple metrics and their values
Inputs: post_id (required).
get_post_reactions_anger_totalB
Fetch number of 'Anger' reactions. Input: post_id (str) Output: dict with anger count
Inputs: post_id (required).
get_post_reactions_haha_totalB
Fetch number of 'Haha' reactions. Input: post_id (str) Output: dict with haha count
Inputs: post_id (required).
get_post_reactions_like_totalB
Fetch number of 'Like' reactions. Input: post_id (str) Output: dict with like count
Inputs: post_id (required).
get_post_reactions_love_totalC
Fetch number of 'Love' reactions. Input: post_id (str) Output: dict with love count
Inputs: post_id (required).
get_post_reactions_sorry_totalC
Fetch number of 'Sorry' reactions. Input: post_id (str) Output: dict with sorry count
Inputs: post_id (required).
get_post_reactions_wow_totalC
Fetch number of 'Wow' reactions. Input: post_id (str) Output: dict with wow count
Inputs: post_id (required).
get_post_top_commentersB
Get the top commenters on a post. Input: post_id (str) Output: list of user IDs with comment counts
Inputs: post_id (required).
post_image_to_facebookC
Post an image with a caption to the Facebook page. Input: image_url (str), caption (str) Output: dict of post result
Inputs: image_url (required), caption (required).
post_to_facebookA
Create a new Facebook Page post with a text message. Input: message (str) Output: dict with post ID and creation status
Inputs: message (required).
reply_to_commentC
Reply to a specific comment on a Facebook post. Input: post_id (str), comment_id (str), message (str) Output: dict with reply creation status
Inputs: post_id (required), comment_id (required), message (required).
schedule_postB
Schedule a new post for future publishing. Input: message (str), publish_time (Unix timestamp) Output: dict with scheduled post info
Inputs: message (required), publish_time (required).
send_dm_to_userC
Send a direct message to a user. Input: user_id (str), message (str) Output: dict of result from Messenger API
Inputs: user_id (required), message (required).
update_postC
Updates an existing post's message. Input: post_id (str), new_message (str) Output: dict of update result
Inputs: post_id (required), new_message (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 30 tools
Most tools have distinct purposes, but there is notable overlap between delete_comment and delete_comment_from_post, which could cause confusion. Additionally, many get_post_* tools for reactions and impressions have similar structures but target different metrics, which might lead to misselection if the agent doesn't carefully read descriptions.
The naming follows a consistent verb_noun pattern (e.g., delete_comment, get_post_comments, post_to_facebook) with only minor deviations like filter_negative_comments (which uses a verb-adjective-noun structure) and send_dm_to_user (which includes an abbreviation). Overall, it's highly readable and predictable.
With 30 tools, the count feels heavy for a Facebook Page management server, especially given the redundancy in some areas (e.g., multiple reaction-specific tools). While it covers many features, it could be streamlined without losing functionality, making it borderline excessive for typical agent use.
The tool set provides comprehensive coverage for Facebook Page management, including CRUD operations for posts and comments, engagement metrics (likes, reactions, impressions), scheduling, messaging, and sentiment analysis. There are no obvious gaps, and agents can handle full workflows from posting to analytics.
Related MCP Connectors
Publish and schedule Facebook Page posts from your AI assistant.
Instagram and Facebook Pages for AI agents: publish, comments, DM by keyword, inbox, insights.
Read the Facebook Content radar and schedule posts to your Pages from your AI assistant.
Social media API for AI agents: publish, DMs, comments, Meta ads and leads.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAutomates Facebook Page management via Graph API, enabling posting, comment moderation, and analytics through AI agents.1MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to automate Facebook Page management including posting, commenting, and analytics via the Facebook Graph API.MIT
- AlicenseNot gradedqualityDmaintenanceEnables managing Facebook Pages via the Graph API, including posting, comment moderation, and post insights through natural language.MIT
- AlicenseNot gradedqualityDmaintenanceEnables automating and managing Facebook Page interactions through the Graph API, including posting, comment moderation, engagement analytics, scheduling, and direct messaging from natural language.MIT