Skip to main content
Glama
engrdeveloper

Facebook MCP Server

Facebook MCP Server

A simple Model Context Protocol (MCP) server for connecting to Facebook business pages and posting text messages.

Features

  • Connect Facebook Page: Connect your Facebook business page using an access token

  • Post to Facebook: Post simple text messages to your connected Facebook page

  • Check Connection: Verify your Facebook page connection status

  • User Data Storage: Automatically saves user connection data to JSON file

Setup

  1. Install dependencies:

npm install
  1. Configure Facebook App:

    • Copy env.example to .env

    • Fill in your Facebook App ID and App Secret

    • Set the redirect URI to http://localhost:3000/auth/facebook/callback

  2. Build the project:

npm run build
  1. Run the server:

# For stdio mode
npm start

# For HTTP mode
npm run start:http

Usage

  1. Get Login URL: Use the get_facebook_login_url tool with your userId

  2. Click the URL: Open the provided URL in your browser

  3. Authorize: Complete Facebook authorization in the browser

  4. Return to Chat: Come back to Mistral Le Chat and use other tools

Method 2: Manual Connection

Use the connect_facebook_page tool with:

  • userId: A unique identifier for the user

  • accessToken: Your Facebook page access token

  • pageId: Your Facebook page ID

  • pageName: Your Facebook page name

3. Post to Facebook

Use the post_to_facebook tool with:

  • userId: The same user ID used during connection

  • message: The text message you want to post

4. Check Connection

Use the check_facebook_connection tool with:

  • userId: The user ID to check connection for

Getting Facebook App Credentials

  1. Go to Facebook Developers

  2. Create a new app or use an existing one

  3. Add the "Facebook Login" product

  4. In App Settings, note down:

    • App ID: Your Facebook App ID

    • App Secret: Your Facebook App Secret

  5. Add these to your .env file

  6. Set the redirect URI to: http://localhost:3000/auth/facebook/callback

User Data Storage

User connection data is automatically saved to user_data.json in the project root. This includes:

  • User ID

  • Facebook access token

  • Page ID and name

  • Connection timestamp

Tools Available

  1. get_facebook_login_url: Get OAuth login URL (recommended for Mistral Le Chat)

  2. connect_facebook_page: Manually connect a Facebook business page

  3. post_to_facebook: Post a text message to Facebook

  4. check_facebook_connection: Check connection status

Example Usage

// Step 1: Get login URL
get_facebook_login_url({
  userId: "user123"
});

// Step 2: Click the URL in browser, complete Facebook auth
// Step 3: Use other tools
post_to_facebook({
  userId: "user123",
  message: "Hello from MCP server!"
});

Manual Connection

// Connect to Facebook page manually
connect_facebook_page({
  userId: "user123",
  accessToken: "your_page_access_token",
  pageId: "your_page_id",
  pageName: "Your Page Name"
});

// Post a message
post_to_facebook({
  userId: "user123",
  message: "Hello from MCP server!"
});

// Check connection
check_facebook_connection({
  userId: "user123"
});
-
security - not tested
-
license - not tested
-
quality - not tested

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/engrdeveloper/MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server