Facebook API MCP
This server does not currently have a deployable release on Glama. Follow the repository's setup instructions to install and configure it for your MCP client, including any required credentials and local dependencies.
Facebook API MCP
Facebook and Messenger APIs for Node.js bots, plus a typed Model Context Protocol server for AI agents.
3.5.0-rc.2 · MIT · Node.js 22+ recommended (minimum 20.18.1)
This unofficial client uses cookie-authenticated web protocols. Core messaging, selected publishing and discovery flows have selected-account live checks; experimental features are identified in the API reference.
Installation
From npm
Install a published stable release:
npm install facebook-api-mcpFor published release candidates:
npm install facebook-api-mcp@nextRegistry commands require a successful publication to the corresponding dist-tag. If no release is available yet, install directly from GitHub.
Directly from GitHub
npm install github:tas33n/facebook-api-mcpThis installs the default branch of
tas33n/facebook-api-mcp.
For reproducible deployments, pin a published Git tag or full commit SHA using
github:tas33n/facebook-api-mcp#<tag-or-commit>.
Both options use the same import: require("facebook-api-mcp").
See setup for cookies, environment settings and lifecycle guidance.
Related MCP server: PagePilot MCP
Simple bot
const login = require("facebook-api-mcp");
const { disposeApi } = require("facebook-api-mcp/lib/mcp");
async function main() {
const api = await login({ appStatePath: process.env.FACEBOOK_APP_STATE_PATH }, {
listenEvents: true, selfListen: false, autoMarkRead: false,
autoMarkDelivery: false, online: false
});
api.listenMqtt((error, event) => {
if (error) return console.error("Listener error:", error.code || "FAILED");
if (["message", "message_reply"].includes(event.type) && event.body === "/ping") {
api.sendMessage("Pong!", event.threadID, undefined, event.messageID)
.catch(error => console.error("Send failed:", error.code || "FAILED"));
}
});
process.once("SIGINT", () => void disposeApi(api));
process.once("SIGTERM", () => void disposeApi(api));
}
main().catch(error => { console.error(error.code || "LOGIN_FAILED"); process.exitCode = 1; });Use with an MCP client
Install the package locally and configure any stdio-capable MCP host:
{
"mcpServers": {
"facebook": {
"command": "node",
"args": ["/absolute/path/node_modules/facebook-api-mcp/bin/facebook-api-mcp.js", "--listen", "--notifications"],
"env": { "FACEBOOK_APP_STATE_PATH": "/private/facebook-appstate.json" }
}
}
}Tools execute under the cookie account. The server exposes curated schemas, sanitized results and bounded event polling. See MCP setup, tool reference and agent integration.
Documentation
Guide | Contents |
Documentation entry point | |
Method index, signatures, arguments, returns and examples | |
Install, cookies, lifecycle and troubleshooting | |
Client configuration and complete tool catalog | |
Host contracts, command examples and prompts | |
Executable Node.js examples |
Current boundaries
Message editing is acknowledged but independent legacy-history readback remains unresolved. Admin/removal, pinning and contact sharing have incomplete live verification. Native E2EE support is not implemented. Cookie sessions may expire. Mutations with unknown outcomes must not be blindly replayed. Remove-for-me is different from unsend-for-everyone. See capability limits.
Contribute and credits
Offline regression tests live in test/; live research artifacts are outside the
source tree and npm package. See development and release.
Derived from Nexus-FCA (Al Amin / Nexus-016) and the facebook-chat-api lineage, with contributions from ntkhang03 and the FCA community. Full provenance and preserved licenses: ATTRIBUTION.md, LICENSE.
This server cannot be deployed
Maintenance
Related MCP Connectors
Facebook & Instagram data for AI agents: pages, posts, groups, ads, Marketplace, profiles, reels.
Social media API for AI agents: publish, DMs, comments, Meta ads and leads.
Publish and schedule Facebook Page posts from your AI assistant.
Instagram for AI agents: publish, read comments and DMs, insights, and engage from your account.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceEnables AI agents to manage Facebook profiles, pages, posts, and engagement via the Graph API with OAuth authentication.2-
- AlicenseNot gradedqualityCmaintenanceEnables AI agents to manage a Facebook Fanpage via the official Graph API, supporting posting, scheduling, comment moderation, and analytics, without scraping or accessing private messages.MIT
- AlicenseNot gradedqualityDmaintenanceEnables AI agents to automate Facebook Page management including posting, commenting, and analytics via the Facebook Graph API.MIT
- AlicenseAqualityBmaintenanceA Facebook/Messenger MCP server that lets AI agents read and engage with profiles, pages, posts, comments, groups, Messenger conversations, notifications, and events using the user's existing browser session cookies — no Graph API app, tokens, or browser automation required. It supports multi-account and Page switching, write operations (posting, commenting, messaging) with per-identity limits and cooldowns, and honest error reporting where Meta has decommissioned cookie-era endpoints.411MIT