Facebook Messenger MCP Bridge

Facebook Messenger MCP Bridge

Enables AI clients to read and send Facebook Messenger messages by using a Chrome extension to bypass anti-bot protections, providing tools like fb_list_conversations, fb_read_messages, and fb_send_message.

Category
Visit Server

README

Facebook Messenger MCP Bridge (Python)

A complete, battle-tested AI client bridge that reads and replies to Facebook Messenger using the Model Context Protocol (MCP) and a Chrome Extension.

This system bypasses Facebook's robust anti-bot protections (like the Lexical editor) to allow seamless AI interactions on your personal Messenger account.

Architecture Overview

┌─────────────────┐     MQTT (TCP/WS)    ┌──────────────────┐     stdio      ┌─────────────┐
│  Chrome Ext     │ ◄──────────────────► │  Python MCP      │ ◄─────────────► │  AI Client  │
│  (Manifest V3)  │   Broker (HiveMQ)    │  Server          │                 │  (Claude,   │
│                 │                      │                  │                 │   Cursor,   │
│  - content.js   │                      │  - fb_read       │                 │   v.v)      │
│  - background   │                      │  - fb_send       │                 │             │
└─────────────────┘                      └──────────────────┘                 └─────────────┘

Features & Breakthroughs

  1. Robust Message Reading: Bypasses obfuscated DOM classes by parsing Facebook's hidden accessibility labels (aria-labels). This correctly identifies the sender, timestamp, and message text regardless of UI updates.
  2. Lexical Editor Bypass: Facebook Messenger uses the Lexical framework which ignores standard DOM value injections (input.value). This extension bypasses it by:
    • Simulating a native ClipboardEvent (Paste) to inject text into the editor.
    • Using Javascript to find and trigger a physical MouseEvent on the Send button.
  3. Stable Connection: Uses a persistent MQTT connection via WebSockets from a Chrome Extension Service Worker, relayed to a Python MCP server.

Installation & Setup

1. Install Python Dependencies

uv sync

2. Configure Environment

Create a .env file in the root directory with your MQTT broker details (e.g. HiveMQ):

HIVE_MQTT_HOST=your-cluster.s2.eu.hivemq.cloud
HIVE_MQTT_PORT=8883
HIVE_MQTT_USERNAME=mcp-user
HIVE_MQTT_PASSWORD=your-password
HIVE_MQTT_CLIENT_ID=mcp-server-001

3. Load Chrome Extension

  1. Open Chrome and navigate to chrome://extensions/
  2. Enable Developer mode (top right toggle)
  3. Click Load unpacked
  4. Select the chrome-extension folder in this project.
  5. Make sure you are logged into https://www.messenger.com.

4. Start the MCP Server

You can run the standalone server script to initialize both the WS-MQTT bridge and the MCP server:

uv run python start.py

5. Using with an AI Client (Cursor / Claude Desktop)

Add the following to your MCP client configuration:

{
  "mcpServers": {
    "facebook-messenger": {
      "command": "uv",
      "args": ["run", "python", "-m", "mcp_server.server"],
      "env": {}
    }
  }
}

Available MCP Tools

Tool Description
fb_list_conversations List recent Messenger conversations to get thread_ids.
fb_read_messages Read message history from a specific thread_id.
fb_send_message Send a text message to a thread_id (uses Paste + Click simulation).
fb_search_contacts Search your Messenger contacts by name.
fb_get_thread_info Get metadata about a conversation.

Security & Disclaimer

⚠️ Important: This tool uses DOM scraping and simulated user input.

  • It operates using your actual logged-in session.
  • Facebook may change their UI or anti-bot measures at any time.
  • Use responsibly to avoid rate limits or account blocks.
  • This project is not affiliated with or endorsed by Meta/Facebook.

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