facebook-post-inbox-fetch-mcp
v1.0.0
Published
Dependency-free MCP server that reads Facebook for AI agents — fetch a post with its comments and images via a logged-in browser relay (Tampermonkey), and the Page Messenger inbox (conversations, messages, attachments) via the Graph API.
Maintainers
Readme
facebook-post-inbox-fetch-mcp
One dependency-free MCP server to read Facebook — both public/group posts and a Page's Messenger inbox — in a single server. Two engines:
- Browser relay (a Tampermonkey userscript ⇄
localhost:8765): uses your real logged-in session, so it bypasses login walls. Reads a post structured (author, content, images + every comment with author/content/images) or screenshots any page. - Graph API (a Page access token): reads the inbox — list/resolve conversations and read a thread's full messages + image attachments. No browser needed.
Node 18+ / bun. No npm dependencies.
Tools
| Tool | Engine | What it does |
|------|--------|--------------|
| fb_read_post(url) | relay | Structured { post:{author,content,images[]}, comments:[{author,content,images[]}], commentCount }. Expands "view more comments/replies" first. Images are URLs. |
| fb_screenshot(url) | relay | PNG of the page as rendered in your browser (good for any tricky page). |
| fb_relay_status() | relay | Is the userscript connected (last poll)? |
| fb_list_conversations(limit) | graph | Recent inbox threads: id, link, threadId, snippet, participants. |
| fb_resolve_conversation(query) | graph | Find a thread by name / link / threadId / PSID / id (paginates). |
| fb_get_conversation(id) | graph | A thread's full messages, oldest-first, + attachment URLs. |
| fb_page_info() | graph | The Page the token belongs to. |
| fb_find_conversation_by_user(psid) | graph | Thread by PSID. |
Setup
Add to your MCP config — no install step, npx fetches it on first run:
{
"mcpServers": {
"facebook": {
"command": "npx",
"args": ["-y", "facebook-post-inbox-fetch-mcp"],
"env": {
"FB_PAGE_TOKEN": "EAA... (Page token, pages_messaging)",
"FB_GRAPH_VERSION": "v21.0",
"FB_RELAY_PORT": "8765"
}
}
}
}For the relay (posts/screenshots): install Tampermonkey, add facebook.user.js, and keep one Facebook tab open. The inbox (Graph) needs only the token — no browser.
Only reading the inbox?
FB_PAGE_TOKENis enough — skip Tampermonkey. Only reading posts/screenshots? The relay is enough —FB_PAGE_TOKENis optional.
Reading workflow
- Post →
fb_read_post(url), then download + view each image URL (post + every comment). - Inbox →
fb_resolve_conversation("<name>")→fb_get_conversation(<id>)(whole thread) → download + view any image attachments.
Notes & limits
- ⚠️ Relay needs the FB tab VISIBLE/foreground for the ~15s of the call (background tabs throttle their timers → timeout).
fb_screenshotis the reliable fallback;fb_read_post's structured scrape is best-effort (FB's DOM is obfuscated). - A Business-Suite inbox URL's
selected_item_idis a real UID that the Graph API can't map to a thread — resolve by participant name instead. - Token: regenerating it invalidates older ones; for stability use a System User token (never expires).
License
MIT © Vorakorn Kosidphokin
