facebook-web-mcp
The facebook-web-mcp server enables safe, human-paced interaction with your Facebook account via a real Chrome browser, offering read-only research tools and staged write operations that require explicit confirmation. Key capabilities include:
Session & login management:
check_facebook_sessionverifies login state;open_facebook_loginopens a browser for manual login (no password storage). Human handles CAPTCHAs/2FA.Search & discovery:
search_facebook,search_groups,search_pagesfind posts, groups, pages, people.Reading content:
open_group,search_in_group,open_page,open_post,read_post,read_comments,get_post_details, andbrowse_feed(home or groups feed) fetch structured posts and comments.Lead research:
find_relevant_postsscans groups/feed for help requests, scoring relevance with explanations;draft_commentprovides post context to craft replies.Staged write (safety-gated):
post_comment,create_post,react_to_post,share_postonly stage actions, returning previews and confirmation tokens.confirm_actionis the sole executor, using single-use tokens, TTL, and a write budget. All writes are verified post-execution.list_pending_actionsandcancel_actionmanage staged items.Maintenance & diagnostics:
selector_healthcheckmonitors DOM selector health;debug_page_structureinspects live page markup for selector repair.
Provides tools to interact with Facebook through the website, including searching groups and pages, reading posts and comments, posting comments, creating posts, reacting, and sharing content using your own Facebook account.
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-web-mcpcheck my Facebook feed and summarize new posts"
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.
Facebook Web MCP
A local MCP server that lets Claude Code use your Facebook account through the normal Facebook website, in a real Chrome window you can watch.
Not a Graph API integration. There is no app id, no access token, and no password stored anywhere. Authentication is a persistent Chrome profile that you log into by hand, once.
Setup
Requirements: Node ≥ 20.11, Google Chrome, and an MCP client (Claude Code, Claude Desktop, or anything else that speaks MCP over stdio).
git clone https://github.com/Mrshahidali420/facebook-web-mcp.git
cd facebook-web-mcp
npm install
npm run build
claude mcp add facebook-web -- node "$PWD/dist/index.js"Or install straight from GitHub without cloning — it compiles itself on install:
npm install github:Mrshahidali420/facebook-web-mcp
claude mcp add facebook-web -- node "$PWD/node_modules/facebook-web-mcp/dist/index.js"Clone if you intend to fix a selector or send a pull request; the shorter form is enough if you only want to run it.
Installing this way, set FB_MCP_PROFILE_DIR to somewhere stable:
claude mcp add facebook-web \
--env FB_MCP_PROFILE_DIR="$HOME/.facebook-web-mcp/profile" \
-- node "$PWD/node_modules/facebook-web-mcp/dist/index.js"Without it the profile defaults to inside node_modules/, and reinstalling or
updating the package deletes your session and logs you out.
Install into a project directory, not globally.
npm install -gfails on a git install: npm builds the package in a temporary clone, and for global installs it skips devDependencies, sotscis missing and the build exits 1. A local install gets them and builds correctly.
Then just ask Claude to log you in — it calls open_facebook_login, which
raises a Chrome window at Facebook and watches while you sign in. It types
nothing and submits nothing; the polling exists only so it can confirm the
profile was saved. If you need longer than the wait window (a 2FA code, a
checkpoint), the call simply returns — the window stays open and your progress
is not lost, so calling it again picks up where you were.
There is also a standalone equivalent that does not need Claude running:
npm run loginIt opens a Chrome window at Facebook and then waits. You do the
typing. Complete any 2FA prompt or security check in that same window. When the
session goes live it confirms and exits, and the session is saved to .fb-profile/.
If Chrome is not where Playwright expects it:
npx playwright install chromeCheck the server registered:
claude mcp list # facebook-web should report ✔ ConnectedStart every session with check_facebook_session.
Related MCP server: Neo MCP
The safety model
Tools split cleanly in two.
Read-only — run immediately. check_facebook_session, open_facebook_login, search_facebook,
search_groups, search_pages, open_group, search_in_group, open_page,
open_post, read_post, read_comments, get_post_details, browse_feed,
find_relevant_posts, draft_comment, list_pending_actions, cancel_action,
selector_healthcheck.
Write — staged, never immediate. post_comment, create_post,
react_to_post, share_post.
A write tool does not write. It returns a preview and a token:
ACTION: Post a public comment on a Facebook post
TARGET: https://www.facebook.com/groups/…/posts/…
GROUP: UK WordPress & Web Development
AUTHOR: Jane Smith
POSTED: 3h
THE POST YOU ARE REPLYING TO:
Anyone know why my product pages dropped out of Google last week?
YOUR COMMENT, EXACTLY AS IT WILL BE PUBLISHED:
Sounds like an indexing issue rather than a ranking one — worth checking
Search Console's Pages report for "Crawled – currently not indexed".
This will be visible to everyone who can see the post, under your own name.confirm_action(token) is the only tool in the server that changes anything.
Four things enforce that, in code rather than in prose:
Guard | What it stops |
Single-use tokens | One approval can never execute twice. |
Payload binding | Editing the text supersedes the old token, so text you approved is the only text that can be sent. |
TTL (10 min default) | Yesterday's approval cannot fire today. |
Write budget (3 per process) | A loop cannot fan out into bulk posting. It hard-fails and needs a restart. |
require_confirmation: false is refused unless FB_MCP_ALLOW_UNCONFIRMED=1 is
set in the server's environment. The switch lives in your environment, not in a
parameter the model fills in.
It will not claim success it cannot prove
After every write, the server goes and looks:
Comment — polls the post's comment list for your comment.
Post — polls your feed for the published post.
Reaction — re-reads the reaction control's state.
Share — polls your feed for the shared post.
If it cannot confirm within the timeout, the result is status: "unverified"
with what was actually observed, never "ok". "I clicked submit" and "the
comment exists" are different facts and stay different all the way to Claude.
What it will not do
No CAPTCHA solving, no 2FA entry, no checkpoint clicking, no bot-detection
evasion, no stealth plugins, no user-agent spoofing. There is no code path that
types into a challenge — src/facebook/auth.ts only detects them and hands
the browser back to you.
When Facebook signals a rate limit, the server stops and backs off. It does not retry harder.
Lead research
find_relevant_posts({
group_urls: ["https://www.facebook.com/groups/wordpressuk"],
topics: ["wordpress", "seo", "indexing", "search console"],
posts_per_group: 30
})Scoring is deliberately strict: a post needs both a service topic and a request-for-help signal to score well. "We migrated to WordPress last year" is discussion, not a lead. Self-promotion and already-resolved threads are scored down hard, and recency is a multiplier rather than a bonus.
Every lead carries a plain-English relevance sentence explaining its score, so
the ranking can be audited rather than trusted:
{
"post_url": "https://www.facebook.com/groups/…/posts/…",
"group_name": "UK WordPress & Web Development",
"score": 0.78,
"relevance": "Asking for help (can anyone recommend); about wordpress, dropped out of google; posted in the last day; phrased as a question.",
"matched_keywords": ["wordpress", "dropped out of google"],
"matched_intent": ["can anyone recommend"],
"negative_signals": []
}Then draft_comment returns the post plus its existing comments and anti-spam
guidance, you write the reply, post_comment stages it, and nothing reaches
Facebook until you say so.
When Facebook changes its markup
It will. The design assumes it.
All DOM knowledge lives in exactly one file: src/facebook/selectors.ts.
Nothing else in the project contains a CSS selector.
Each element is an ordered candidate list rather than one selector:
tier 1 ARIA role + accessible name survives class churn and rewrites
tier 2 structural attributes internal contracts, fairly stable
tier 3 structural relationships shape of the tree
tier 4 visible text locale-dependent, last resortThe resolver records which tier actually matched. When a tier-1 candidate stops
matching and extraction quietly falls through to a text heuristic, everything
still works — and selector_healthcheck reports it as degraded. That is the
early warning, before the last candidate dies too and tools start returning
empty arrays.
A total miss throws SelectorMissError naming the strategy. It never returns
null, and never an empty array that looks like "no results".
{ "posts": [], "reason": "no_posts_visible" } is a real answer and is kept
distinct from a failure to read the page. Silent failure is the bug class this
design refuses.
Layout
src/
├── index.ts stdio server entry
├── login.ts one-time interactive login helper
├── config.ts env config — contains no credential fields, by design
├── logger.ts JSONL to logs/, human lines to stderr, never stdout
├── errors.ts typed failures carrying an instruction for the human
├── types.ts Zod schemas for Post, Comment, Group, Page
├── browser/ session lifecycle, pacing, navigation — knows nothing about Facebook
├── facebook/
│ ├── selectors.ts ← the only file with DOM knowledge
│ ├── resolve.ts strategy resolver + health tracking
│ ├── auth.ts login / challenge detection
│ ├── urls.ts search URLs, tracking-param stripping, id extraction
│ ├── extract/ post, comment, entity, parsing helpers
│ ├── pages/ search, group, page, post, feed, home
│ └── actions/ comment, createPost, engage — each verifies afterwards
├── approvals/ token store + preview rendering
├── leads/ keyword sets and pure scoring
└── tools/ MCP tool definitions — never import PlaywrightConfiguration
Everything is optional; defaults are used with no .env at all. See
.env.example for the full list. The ones worth knowing:
Variable | Default | Why you would change it |
|
| Raise only if you genuinely need more writes in one session. |
|
| How long a confirmation token stays valid. |
| unset | Leave it unset. |
|
| Where the logged-in session lives. |
|
| Keep it false — headed is how you handle challenges. |
|
| Pacing between navigations. |
.fb-profile/ is your Facebook session and is gitignored. Deleting it logs
you out. Never commit it, and never copy it anywhere.
Development
npm run typecheck
npm test # 107 unit tests, no browser required
npm run buildTests cover the parts where being wrong is expensive: lead scoring calibration,
the approval store's four guards, the require_confirmation gate, timestamp and
count parsing, and URL normalisation.
ARCHITECTURE.md covers the design in depth, and
docs/facebook-dom-notes.md records what has actually been observed in
Facebook's markup.
Contributing
Contributions are welcome — particularly selector fixes, which are the most common thing that breaks and the most useful thing to receive.
Read CONTRIBUTING.md first. It covers the three rules that are not negotiable (DOM knowledge lives in one file; writes stage rather than execute; never claim success you cannot prove) and the list of changes that will not be merged — CAPTCHA solving, bot-detection evasion, credential storage, and anything that weakens the confirmation gate.
By participating you agree to the Code of Conduct. Security issues go through SECURITY.md, never a public issue.
Disclaimer
This is an independent project. It is not affiliated with, endorsed by, or sponsored by Meta Platforms, Inc.
It automates a browser against a site whose terms of service restrict automated access. Using it may violate those terms and could result in your account being restricted or disabled. That risk is yours, and it is the reason the write budget, the confirmation gate, and the human-paced delays exist rather than being tunable away.
Use it on your own account. Do not use it to scrape, mass-message, harass, or impersonate anyone.
Provided without warranty of any kind — see sections 15 and 16 of the LICENSE.
Licence
Copyright (C) 2026 Shahid Ali
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see https://www.gnu.org/licenses/.
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
- Alicense-qualityAmaintenanceAn MCP server that lets Claude operate your real computer by moving the actual mouse, clicking, typing, and reading the actual screen, working with your own logged-in sessions in any application.Last updatedMIT
- Alicense-qualityDmaintenanceA comprehensive MCP server with 206+ tools across 16 integrations that gives Claude access to real accounts (LinkedIn, Twitter, Slack, Gmail, WhatsApp, etc.) by extracting auth tokens straight from your browser, no API keys or OAuth needed.Last updated213MIT
- FlicenseAqualityBmaintenanceA local MCP server that lets Claude post to social media via upload-post.com — text, photos, and videos across 13 platforms.Last updated17
- Flicense-qualityCmaintenanceA local MCP server that connects Claude Code to your work environment through auditable tools for file operations, API calls, and command execution, with safety gates and configuration.Last updated
Related MCP Connectors
Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer
Browser MCP for logged-in tasks. Uses your Chrome — credentials stay local. Zero-token replay.
Person-owned, portable AI memory as a remote MCP server, readable and writable by any MCP client.
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/Mrshahidali420/facebook-web-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server