home / mcp / facebook mcp server

Facebook MCP Server

Facebook MCP server for automating posts, comment moderation, insights, and sentiment filtering.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "hagaihen-facebook-mcp-server": {
      "command": "uv",
      "args": [
        "run",
        "--with",
        "mcp[cli]",
        "--with",
        "requests",
        "mcp",
        "run",
        "/path/to/facebook-mcp-server/server.py"
      ],
      "env": {
        "FACEBOOK_PAGE_ID": "YOUR_FACEBOOK_PAGE_ID",
        "FACEBOOK_ACCESS_TOKEN": "YOUR_FACEBOOK_PAGE_ACCESS_TOKEN"
      }
    }
  }
}

You can automate Facebook Page interactions by running an MCP server that exposes AI-callable tools to create posts, moderate comments, fetch analytics, and filter negative feedback. It integrates withClaude Desktop or other agent clients, letting you control your Facebook presence through natural language prompts.

How to use

You run the MCP server locally and connect your MCP client (such as Claude Desktop or any compatible agent) to access a suite of Facebook-focused tools. Use the client to issue natural-language requests like creating posts, replying to comments, retrieving post statistics, or filtering negative feedback. The MCP maps your prompts to concrete Facebook Graph API operations under the hood, so you don’t have to manage API calls directly.

How to install

git clone https://github.com/your-org/facebook-mcp-server.git
cd facebook-mcp-server
```

```
curl -Ls https://astral.sh/uv/install.sh | bash
```

```
uv pip install -r requirements.txt
```

```
FACEBOOK_ACCESS_TOKEN=your_facebook_page_access_token
FACEBOOK_PAGE_ID=your_page_id
```

You should store these in a .env file at the project root with the following keys:
- FACEBOOK_ACCESS_TOKEN
- FACEBOOK_PAGE_ID
```json
{
  "FACEBOOK_ACCESS_TOKEN": "your_facebook_page_access_token",
  "FACEBOOK_PAGE_ID": "your_page_id"
}

Additional sections

Configuration and running the MCP server relies on a local runtime. You’ll install the runtime if needed, set environment variables for your Facebook credentials, and start the server using the provided CLI integration.

Environment variables that you need to configure: - FACEBOOK_ACCESS_TOKEN: your Facebook Page access token - FACEBOOK_PAGE_ID: your Facebook Page ID These values enable the MCP to perform actions on your Page through the Graph API.

Integrating with Claude Desktop involves feeding the MCP’s run command into the client configuration. A sample integration entry is shown here to start the MCP via uv with the necessary modules and the server script.

"FacebookMCP": {
  "command": "uv",
  "args": [
    "run",
    "--with",
    "mcp[cli]",
    "--with",
    "requests",
    "mcp",
    "run",
    "/path/to/facebook-mcp-server/server.py"
  ]
}

Available tools

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

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

Facebook MCP Server - hagaihen/facebook-mcp-server