facebook-lyr
Provides tools for interacting with Facebook and Messenger through the authenticated browser session, enabling profile and page reads, post and comment search, groups, Messenger conversations, notifications, events, and multi-account + Page switching. Supports writing operations like creating posts, commenting, sending/deleting Messenger messages, and managing posting limits per identity.
This server is modeled directly on the instagram-lyr architecture and conventions, sharing the same browser-cookie authentication flow, but Instagram itself is not a target of this Facebook-specific MCP server.
Provides tools for full Messenger operations through the authenticated session, including sending and deleting/unsending messages, typing indicators, and marking conversations as seen, using the legacy Mercury ajax endpoints.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@facebook-lyrShow me my most recent Facebook messages from Messenger"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
What it does
Read & discover — profiles, Pages, timeline posts, post details & comments, groups (+ members), people/page/group/post search, Messenger conversations & messages, notifications, and upcoming events.
Write & engage — text / photo / video / carousel posts, delete your own posts, save & unsave posts, comment on posts, and full Messenger operations (send, delete/unsend, typing indicator, mark-seen).
Multi-account — store multiple identities (your user, Pages you administer, linked profiles), each with its own cookie set; switch the active identity any time, discover switchable accounts, import cookies per identity, and enforce per-identity posting limits + cooldowns + attempt history.
Agent-first CLI — AXI-compliant, TOON output, session hooks for Claude Code / Codex, and a self-installing agent skill.
Modeled directly on instagram-lyr — the same architecture, CLI conventions, and browser-cookie authentication flow. Threads lives in a separate project (threads-lyr).
Related MCP server: FBEM
Why cookie scraping?
The official Graph API requires a Meta developer app, app review, and page-scoped tokens — and it cannot see anything your app wasn't granted. Cookie scraping reuses the exact session your browser has, so the agent reads and acts on Facebook the way you would: full timelines, groups, Messenger inboxes, notifications, and events.
curl_cffiwith Chrome TLS impersonation defeats JA3 fingerprint detection.The
fb_dtsgCSRF token is extracted from the logged-in homepage and auto-refreshed on rotation.Messenger uses the legacy Mercury ajax endpoints (
threadlist_info.php,thread_info.php,send_messages.php,delete_messages.php) where they still exist.Feeds, profiles, notifications, events, and search are parsed from Facebook's embedded JSON with a resilient recursive deep-scan — no fragile selectors.
Account discovery reads the relay data on
/accounts/to list every Page / profile the session can switch to.
Quick install
One-line installation (clones to ~/projects/facebook-lyr):
curl -fsSL https://raw.githubusercontent.com/ishan-parihar/facebook-lyr/main/install.sh | bashOr install from PyPI with uv (no clone):
uv tool install facebook-lyrOr in any MCP client — just point it at the package:
{
"mcpServers": {
"facebook": {
"command": "uvx",
"args": ["facebook-lyr"]
}
}
}Quick start
uv sync # install dependencies (repo install)
facebook-lyr --login # import cookies from your browser (Brave, Chrome, Edge, Firefox, Zen, ...)
facebook-lyr --status # "status: valid" when the session works
facebook-lyr # start the MCP server (stdio)Headless agents (no interactive step): export the session directly —
export FACEBOOK_COOKIES='{"c_user":"12345","xs":"abc...","fr":"...","datr":"..."}'
facebook-lyr --statusCookies are stored at
~/.facebook-lyr/profile/cookies.json(mode0600) and never leave your machine.
Tool surface (41 tools)
Read & discover
Tool | What it gives you |
| Authenticated identity + session validity |
| Recent timeline posts for a user or Page |
| Profile / Page summary (bio, follower counts) |
| Single post + its comments |
| Keyword discovery across Facebook |
| Group metadata, feed, and member list |
| Messenger inbox + thread bodies |
| New alerts (messages, tags, follows, page activity) |
| Upcoming events for the identity |
| Posting limits + attempt history for an identity |
Write & engage
Every write tool is confirm-gated (confirm=true), respects the identity's daily cap + cooldown, and records the attempt in the identity's posting history.
Tool | Notes |
| Text post (≤ 5000 chars) |
| Image (file/URL), normalized to feed spec |
| Video (file/URL) — best-effort |
| 2–10 image carousel |
| Delete one of your own posts ( |
| Bookmark / un-bookmark a post |
| Comment on a post |
| Send, or delete/unsend, a Messenger message |
| Presence writes (no quota) |
Accounts & identity
Tool | What it gives you |
| Stored identities + which is active |
| Every Page/profile the session can switch to |
| Manage per-identity cookie stores |
| Import an identity's cookies from a browser |
| Change the identity every tool acts as |
| Release active clients |
Authentication
Interactive:
facebook-lyr --login— importsc_user,xs,fr,datr, … from your browser's cookie store (Brave, Chrome, Edge, Firefox, Zen, Chromium, Opera, Arc, Vivaldi, LibreWolf, Waterfox, Floorp, and more).Headless:
FACEBOOK_COOKIESenv var (JSON object with at leastc_userandxs).If the session expires (login wall / 403), tools auto-trigger re-login and tell you to run
--login.
Multi-account (users + Pages)
Store multiple identities — your user account, Pages you administer, linked profiles — each with its own cookie set under ~/.facebook-lyr/accounts/<id>/:
facebook-lyr import_account_from_browser --account_id 100064606727322 --name "My Page" --browser zen
facebook-lyr switch_active_account --account_id 100064606727322
facebook-lyr get_active_account_infoCookie rotations (xs/fr refreshes) are written back to the owning identity's store automatically, so stored jars stay in sync with the live session. Posting limits, cooldowns, and attempt history are tracked per identity.
Honest limitations
Facebook has been decommissioning its cookie-era write endpoints. Where an endpoint is dead, the tool fails loudly and honestly instead of faking success:
Capability | Status |
Timeline publishing (text/photo/video/carousel), commenting | 🔴 decommissioned for migrated accounts — returns a clear "official API required" error |
React to post/comment, edit post, follow, friend requests | 🔴 endpoint removed (404) — not possible with cookies |
Messenger media upload, message reactions | 🔴 endpoint removed (404) |
Delete own post, save/unsave, notifications, events, group members | 🟢 working (legacy endpoints still alive) |
Messenger text send / delete / typing / seen | 🟢 working (Mercury ajax) |
Read tools are unaffected. For the decommissioned cluster, the official Graph API (Page/App tokens) is the required path — the same constraint that killed cookie-based posting libraries.
CLI reference
facebook-lyr --help # usage
facebook-lyr --list-tools # all 41 tools
facebook-lyr --tool-info <tool> # params for one tool
facebook-lyr <tool> --param value # call a tool directly (TOON output)
facebook-lyr --login | --status | --logout
facebook-lyr --install-hook # session hooks for Claude Code / Codex
facebook-lyr --install-skill # agent skill for auto-discoveryDevelopment
uv sync --extra dev
uv run pytest # 259 tests: parsers, write surface, limits, Tier-1 tools
uv run ruff check .License
MIT — see LICENSE.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- FlicenseAqualityDmaintenanceA Model Context Protocol (MCP) server implementation that provides Facebook Page interaction and management capabilities. This server enables automated posting, comment moderation, and content retrieval.Last updated775
- AlicenseAqualityBmaintenanceAn MCP server that enables AI agents to post Reels and Photos to Facebook by capturing and replaying the native web API through a Chrome extension.Last updated69MIT
- Alicense-qualityBmaintenanceA TypeScript MCP server for the Meta Graph API focused on Facebook Pages, enabling publishing, reading, insights, and moderation tasks.Last updatedMIT
- FlicenseAqualityCmaintenanceMCP server that wraps Meta's Messenger Platform, Instagram Messaging, and comment moderation APIs as semantic tools for LLM agents to read inbox, reply, and moderate comments.Last updated16
Related MCP Connectors
Managed LinkedIn MCP server for AI agents: search, connect, message and enrich on accounts you own.
Remote MCP server for The Colony — a social network for AI agents (posts, DMs, search, marketplace).
Connect any AI agent to 11+ social platforms: schedule, publish & track posts via hosted MCP.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/ishan-parihar/facebook-lyr'
If you have feedback or need assistance with the MCP directory API, please join our Discord server