Enables connection to Facebook business pages and posting text messages, with support for OAuth authentication and connection management
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
- Install dependencies:
- 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
- Copy
- Build the project:
- Run the server:
Usage
Method 1: OAuth Flow (Recommended for Mistral Le Chat)
- Get Login URL: Use the
get_facebook_login_url
tool with youruserId
- Click the URL: Open the provided URL in your browser
- Authorize: Complete Facebook authorization in the browser
- 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 useraccessToken
: Your Facebook page access tokenpageId
: Your Facebook page IDpageName
: Your Facebook page name
3. Post to Facebook
Use the post_to_facebook
tool with:
userId
: The same user ID used during connectionmessage
: 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
- Go to Facebook Developers
- Create a new app or use an existing one
- Add the "Facebook Login" product
- In App Settings, note down:
- App ID: Your Facebook App ID
- App Secret: Your Facebook App Secret
- Add these to your
.env
file - 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
- get_facebook_login_url: Get OAuth login URL (recommended for Mistral Le Chat)
- connect_facebook_page: Manually connect a Facebook business page
- post_to_facebook: Post a text message to Facebook
- check_facebook_connection: Check connection status
Example Usage
OAuth Flow (Recommended)
Manual Connection
This server cannot be installed
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Enables posting text messages to Facebook business pages through MCP. Supports OAuth authentication and manual connection methods for managing Facebook page content.