Facebook MCP Server

Facebook MCP Server

Enables AI agents to manage Facebook profiles, pages, posts, and engagement via the Graph API with OAuth authentication.

Category
Visit Server

README

Facebook MCP Server

A comprehensive Model Context Protocol (MCP) server for managing Facebook features, including Profiles, Pages, Posts, and Engagement. This server integrates with the Facebook Graph API and provides a seamless way for AI agents (like Claude Desktop) to interact with Facebook.

Features

  • OAuth 2.0 Authentication: No need to hardcode long-lived access tokens. The server includes a built-in OAuth flow to authenticate directly with Facebook.
  • Profile Management: Fetch profile details for the authenticated user or specific user IDs.
  • Page Management: List managed pages and fetch page insights.
  • Content Publishing: Publish posts to feeds or pages, and delete objects.
  • Engagement: Read feeds, fetch comments, and reply to comments.
  • Docker Support: Easily containerized and run with Docker Compose.

Prerequisites

Before running the server, you need to create a Facebook App on the Meta for Developers portal.

  1. Go to Meta for Developers.
  2. Create a new App (choose "Other" -> "Consumer" or "Business" depending on your needs).
  3. Add the Facebook Login product to your app.
  4. In the Facebook Login settings, add your redirect URI to the "Valid OAuth Redirect URIs" list. By default, it should be: http://localhost:3000/auth/facebook/callback.
  5. Get your App ID and App Secret from the App Dashboard -> Settings -> Basic.

Installation

Local Setup

  1. Clone or copy the project files to your desired directory.
  2. Install dependencies:
    npm install
    
  3. Copy .env.example to .env and fill in your credentials:
    cp .env.example .env
    
    Edit .env:
    FACEBOOK_APP_ID=your_actual_app_id
    FACEBOOK_APP_SECRET=your_actual_app_secret
    PORT=3000
    REDIRECT_URI=http://localhost:3000/auth/facebook/callback
    

Running the Server

Option 1: Local Node.js

  1. Build the project:
    npm run build
    
  2. Start the server:
    npm start
    

Option 2: Docker

  1. Make sure your .env file is filled out.
  2. Run with Docker Compose:
    docker-compose up --build
    
    This will build the image and start the server, exposing the port specified in your .env file (default 3000) for the authentication callback.

Connecting to Claude Desktop

Add the server to your Claude Desktop configuration file (usually located at %APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS).

For Local Execution:

{
  "mcpServers": {
    "facebook": {
      "command": "node",
      "args": ["f:/MCP_Server/Facebook_MCP_server/dist/index.js"],
      "env": {
        "FACEBOOK_APP_ID": "your_app_id",
        "FACEBOOK_APP_SECRET": "your_app_secret",
        "REDIRECT_URI": "http://localhost:3000/auth/facebook/callback",
        "PORT": "3000"
      }
    }
  }
}

(Adjust the path to index.js as necessary)

For Docker Execution:

If running via Docker, the server reads the .env file from the directory. You can use the docker command in Claude config if you have Claude configured to run docker commands, or simply run the container in the background and connect via network if supported (though stdio is the standard for Claude Desktop).

Authentication Flow

Once the server is connected to Claude Desktop:

  1. Ask Claude to "Authenticate with Facebook" or use the fb_authenticate tool.
  2. Claude will provide a login URL.
  3. Open the URL in your browser, log in to Facebook, and authorize the application.
  4. You will be redirected to a page that says "Authentication Successful!".
  5. The server automatically saves the access token in a local .fb_token.json file.
  6. You can now start using all other tools!

Available Tools

Auth

  • fb_authenticate: Returns the URL to start the OAuth login process.

Profile

  • fb_get_profile: Get profile details (ID, Name, etc.). Can accept userId and fields.

Pages

  • fb_get_pages: List Facebook Pages managed by the authenticated user.
  • fb_get_page_insights: Get metrics (like impressions) for a specific page.

Publishing

  • fb_publish_post: Publish a message or link to a feed/page.
  • fb_delete_object: Delete a post or comment by ID.

Engagement

  • fb_get_feed: Get posts from a feed.
  • fb_get_comments: Get comments on an object.
  • fb_reply_comment: Post a reply to a comment.

License

ISC

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
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
Qdrant Server

Qdrant Server

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

Official
Featured