Skip to main content
Glama

FBEM — Facebook Extension Crawler + MCP

Crawl/snapshot Facebook's native composer web API and publish Reels / Photos through a Chrome extension — exposed to any agent as an MCP server.

FBEM drives the same internal web API a logged-in human uses on facebook.com (NOT the Graph API, which suppresses reach on API-published posts). It learns the exact upload shape by passively snapshotting the requests you make by hand, then replays that template with fresh media + fresh volatile tokens — so it is self-healing and needs no reverse-engineering when Facebook rotates its payload.

Any MCP-capable agent (Claude Code / Claude Desktop / Cursor / …) can plug in and call post_reel, post_photos, switch_profile, get_identity, health, and capture_status. Adding a new tool is one file — see CONTRIBUTING.md.

⚠️ Local tool, loopback-only. The bridge binds 127.0.0.1 and is unauthenticated by design. It runs on your machine against your logged-in browser session. Never expose it to a network. Use it only on accounts you own and in line with Facebook's terms.


Architecture

FBEM pipeline: AI Agent → MCP Server → Local Bridge → Chrome Extension → Facebook, with capture-once (manual post) → replay-many (automated)

  any MCP agent  (Claude Code / Desktop / Cursor / …)
       │  stdio  (MCP protocol)
       ▼
  fbem-mcp ──HTTP(loopback :47102)──► fbem-bridge ──WS(:9224)──► Chrome extension
  (FastMCP;                           (FastAPI +                  (crawler + replay,
   tools/ = one file per tool)         WS server)                  injected in-page)
                                                                       │ runs inside
                                                                       ▼
                                                                 facebook.com tab
                                                                 (your live session)
  • fbem-bridge (persistent) holds the WebSocket to the extension, serves media over loopback, and stores captured templates. Run it once; leave it up.

  • fbem-mcp (spawned by the agent) is a thin stdio layer that calls the bridge over HTTP. Because it's separate, every agent can spawn its own MCP process without fighting over the extension's WebSocket port.

  • Chrome extension has three jobs, all inside the page's own context:

    1. Crawler — monkeypatches fetch/XHR to passively snapshot the genuine native upload requests when you post by hand. Never blocks or mutates them.

    2. Tokens — scrapes fresh volatile tokens (fb_dtsg, lsd, jazoest, …).

    3. Replay — reproduces a captured template with new media + fresh tokens.

Related MCP server: social0-mcp

How it works: capture-then-replay

Replay is template-driven and only activates after one real capture per kind.

  1. Start the bridge and load the extension; open a logged-in facebook.com tab.

  2. Post one item by hand (a Reel, a photo/album, a page switch).

  3. The crawler snapshots the real requests (the rupload/photo upload + the ComposerStoryCreateMutation publish) and POSTs them to the bridge, which folds them into template.json.

  4. From then on, the matching MCP tool replays automatically — fresh video/photo, fresh tokens, same proven shape.

When Facebook rotates its payload and replay starts failing, just re-capture (repeat steps 2–3). No code change is ever required.

Quickstart

1. Install

git clone https://github.com/crisng95/fbem.git FBEM && cd FBEM
python3.11 -m venv .venv
.venv/bin/pip install -e .

2. Run the bridge (leave it running)

.venv/bin/fbem-bridge          # HTTP :47102 + WS :9224, loopback only

3. Load the Chrome extension

chrome://extensions → enable Developer modeLoad unpacked → select the extension/ directory. See extension/README.md. Keep a logged-in www.facebook.com tab open — replay runs inside it.

4. Seed a template (one manual post)

With everything running, post one Reel (and one photo/album) by hand. Confirm:

curl -s http://127.0.0.1:47102/api/health | python3 -m json.tool
# look for: extension_connected: true, has_template: true, has_photo_template: true

Already have captured templates elsewhere? Point the bridge at that captures directory and skip re-snapshotting entirely:

FBEM_CAPTURES_DIR=/path/to/existing/captures fbem-bridge

5. Plug the MCP into your agent

Claude Code:

claude mcp add fbem -- /abs/path/to/FBEM/.venv/bin/fbem-mcp

Claude Desktop (claude_desktop_config.json):

{
  "mcpServers": {
    "fbem": { "command": "/abs/path/to/FBEM/.venv/bin/fbem-mcp" }
  }
}

Any MCP client: run the command fbem-mcp, transport stdio.

The agent can now call the tools below. (The bridge from step 2 must stay running.)

MCP tools

Tool

What it does

post_reel

Publish a Reel from a local .mp4. Args: video_path, caption, page_id?, scheduled_publish_time?.

post_photos

Publish a photo (1 file) or album (N files) from local .jpg/.png. Args: image_paths[], caption, page_id?, scheduled_publish_time?.

switch_profile

Switch the acting page/profile so later posts go out AS that page. Args: target_id.

get_identity

Read which page/profile the tab currently posts AS (read-only).

health

Bridge + extension health (connection, templates, tab TTL).

capture_status

Crawler/snapshot status: what's captured, what's ready to post, and exactly what to (re)snapshot if not.

When do I need to (re)snapshot?

  • First run / a kind never captured → yes: post that kind once by hand.

  • Reel vs Photo vs Switch are separate templates → capturing a Reel does not enable photo posting; capture each kind once.

  • Already captured and working → no. Templates persist in FBEM_CAPTURES_DIR.

  • Facebook rotated its payload (replay errors like story_create=null, no_template_captured, repeated 502s) → re-capture that one kind by hand.

Ask the agent to call capture_status any time — it reports exactly what's ready and what to do.

Configuration

All optional; sensible loopback defaults. See .env.example.

Env

Default

Purpose

FBEM_HTTP_PORT

47102

Bridge HTTP API port

FBEM_WS_PORT

9224

Extension WebSocket port

FBEM_WS_HOST

127.0.0.1

WS bind host (must be loopback)

FBEM_HOME

~/.fbem

Base dir for state

FBEM_CAPTURES_DIR

$FBEM_HOME/captures

Captured templates (contain live tokens)

FBEM_MEDIA_DIR

$FBEM_HOME/media

Media served to the extension

FBEM_BRIDGE_URL

http://127.0.0.1:47102

Where the MCP reaches the bridge

FBEM_TAB_TTL_S

7200

Advanced: tab auto-reload window (seconds) that keeps tokens fresh

FBEM_TAB_ACTIVE_WINDOW_S

90

Advanced: how recently a capture must arrive to count the tab as "active" (seconds)

FBEM_PUBLISH_OP_RE

(built-in regex)

Advanced: override the regex matching the Reel publish mutation (set only if FB renames the op)

Security

  • Loopback-only & unauthenticated by design. Startup refuses a non-loopback FBEM_WS_HOST. Never port-forward or proxy it.

  • Captures contain live FB tokens (fb_dtsg, lsd, cookies). captures/ is git-ignored — never commit it. Treat FBEM_CAPTURES_DIR as a secret.

  • No tokens in code. The callback secret is random per process; volatile FB tokens are scraped live from the page at replay time.

Project layout

fbem/
  bridge/        persistent backend (FastAPI :47102 + extension WS :9224)
    server.py · ws_server.py · bridge_client.py · capture_store.py · config.py · run.py
  mcp/           the MCP server (any-agent pluggable)
    server.py · registry.py · bridge_api.py
    tools/       ONE FILE PER TOOL  ← the contribution surface
      _template.py · post_reel.py · post_photos.py · switch_profile.py
      get_identity.py · health.py · capture_status.py
extension/       Chrome MV3 (crawler snapshot + replay)
docs/PROTOCOL.md the decoded native upload protocol

Contributing

Adding a tool is one file. Copy fbem/mcp/tools/_template.py, write a typed async function, done — it's auto-discovered. See CONTRIBUTING.md.

License

MIT.

Available Tools

6 tools
capture_statusA

Crawler/snapshot status: which native templates are captured (reel / photo / profile-switch), whether you're ready to post, and exactly what to do if a (re)snapshot is needed. The crawler captures passively when you post by hand on facebook.com — re-snapshot only when Facebook rotates its payload and replay starts failing.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden. It explains that the crawler captures passively during manual posting on facebook.com and that resnapshot is only needed when Facebook rotates payloads. This gives valuable behavioral context beyond a simple status read.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, front-loads key information (status of templates, readiness, actions), and contains no filler. Every sentence earns its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no parameters and no output schema, the description adequately explains what the tool provides (templates captured, readiness, instructions). It could optionally mention return format or error states, but the description is sufficient for a simple status tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters, and schema coverage is 100%. The description adds meaning by explaining what the tool returns and the underlying mechanism, which is more than the empty schema provides. This is appropriate for a parameterless tool.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states that the tool provides crawler/snapshot status, listing specific details like which templates are captured, readiness to post, and instructions for resnapshot. It distinguishes from sibling tools (which are action-oriented like post_photos or switch_profile) by focusing on status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies when to use this tool (e.g., before posting to check readiness) but does not explicitly state when to use it vs alternatives or when not to use it. No comparative guidance is given.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_identityA

Read which Facebook page/profile the browser tab currently posts AS (read-only, no switch). Useful to confirm identity before posting.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A4.2/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so description carries full burden. It states read-only and no switch, but lacks details on return format, error behavior, or what happens if no identity is set. Adequate but could be more comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

A single concise sentence that front-loads the action and purpose. No wasted words, earning its place.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a zero-parameter read-only tool with no output schema, the description is largely complete. It explains what it does and why useful. Could mention output format but not critical.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

No parameters (100% coverage), baseline 4. The description adds value by explaining the purpose and read-only nature, going beyond just the schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool reads which Facebook page/profile the browser tab currently posts as, using specific verb 'Read' and resource 'identity'. It distinguishes from sibling tools like switch_profile by noting 'no switch'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides a clear use case: 'Useful to confirm identity before posting.' It implies when to use but does not explicitly mention when not to use or alternative tools, though sibling switch_profile contrasts implicitly.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

healthA

Bridge + extension health: is the bridge up, is the Chrome extension connected, are the reel/photo templates captured, and tab freshness/TTL.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It lists what is checked but does not disclose behavioral traits such as idempotency, side effects, or authentication requirements. It is likely a safe read operation but not explicitly stated.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single concise sentence that front-loads the purpose. However, the list of checks is run-on and could be more structured for readability. No fluff.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The tool has no output schema, yet the description does not describe the return format (e.g., boolean fields or status object). This omission leaves the agent uncertain about what to expect from the tool's output.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

There are zero parameters in the input schema, so the description does not need to add parameter semantics. The baseline for 0 parameters is 4, and the description adds no unnecessary parameter information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: checking the health of the bridge and Chrome extension, including specific aspects like template capture status and tab freshness. This distinguishes it from sibling tools like capture_status which focus on individual template status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines3/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description implies usage for health checks but does not explicitly state when to use this tool versus alternatives like capture_status or get_identity. No when-not guidance is provided.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

post_photosA

Publish a Facebook photo (1 image) or album (N images) from local files via the browser extension (native web API, NOT the Graph API). Requires the bridge running, a logged-in facebook.com tab, and a captured photo template (see capture_status).

ParametersJSON Schema
NameRequiredDescriptionDefault
captionYes
page_idNo
image_pathsYes
scheduled_publish_timeNo

TDQS

A4/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden. It discloses the browser extension mechanism, prerequisites, and single vs. album behavior. No mention of side effects or rate limits, but core behavioral context is provided.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, no filler. First sentence states action and method, second lists requirements. Efficient and front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Lacks return value explanation (no output schema) and per-parameter detail. Prerequisites are covered, but the agent lacks information on what happens after posting.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The description adds minimal parameter meaning: image_paths can be 1 or N images. Other parameters (caption, page_id, scheduled_publish_time) are not explained. With 0% schema coverage, the description fails to compensate.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool publishes a Facebook photo or album using the browser extension, distinct from the Graph API. It differentiates from sibling tools like post_reel by specifying 'photo' vs 'reel'.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description lists prerequisites: bridge running, logged-in tab, captured template. It implicitly suggests using capture_status first. However, it does not explicitly state when not to use it or compare to alternatives beyond the name.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

post_reelA

Publish a Facebook Reel from a local .mp4 via the browser extension (native web API, NOT the Graph API — avoids reach suppression). Requires the bridge running, a logged-in facebook.com tab, and a captured reel template (see capture_status).

ParametersJSON Schema
NameRequiredDescriptionDefault
captionYes
page_idNo
video_pathYes
scheduled_publish_timeNo

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations exist, so description carries full burden. It discloses the use of native web API to avoid reach suppression, but omits details on failure modes, idempotency, or state changes. Adequate but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Two sentences, front-loaded with purpose and method, followed by requirements. No unnecessary words or redundancy. Highly efficient.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given 4 parameters, no output schema, and no annotations, the description covers the core action and prerequisites but leaves parameter specifics and return values unexplained. Adequate for basic understanding but incomplete.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters2/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, yet the description only indirectly references video_path and caption via 'local .mp4' and 'caption'. It provides no details on page_id or scheduled_publish_time. Does not compensate for the lacking schema descriptions.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool publishes a Facebook Reel from a local .mp4 via the browser extension, specifying the mechanism (native web API) and differentiating from siblings like post_photos or capture_status.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explicitly lists prerequisites: bridge running, logged-in facebook.com tab, and a captured reel template (referencing capture_status). It implicitly suggests when to use but does not name alternatives or specify when not to use.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

switch_profileA

Switch the browser session to a target Facebook page/profile id so subsequent post_reel / post_photos go out AS that page (one account, many Pages). Requires a captured CometProfileSwitchMutation template.

ParametersJSON Schema
NameRequiredDescriptionDefault
target_idYes

TDQS

A4.1/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses the effect on subsequent posts and the requirement of a mutation template, but does not explain what happens if the template is missing or if switching back is possible. For a simple state-changing tool, this is adequate but not comprehensive.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is two sentences, both front-loaded with the core purpose and effect. The second sentence adds a key prerequisite. No wasted verbiage, but it could be slightly more structured (e.g., separating the requirement).

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with one parameter, no output schema, and no nested objects, the description covers the essential aspects: what it does, the effect on sibling tools, and a prerequisite. It is nearly complete for its simplicity, though it could clarify the exact behavior of switching (e.g., whether it's reversible).

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has one parameter (target_id) with 0% description coverage. The tool description adds meaning by specifying it is a 'Facebook page/profile id', which clarifies the parameter's purpose beyond the schema's generic title 'Target Id'. However, it does not describe the format or how to obtain the id, leaving some ambiguity.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the action ('Switch the browser session'), the target ('Facebook page/profile id'), and the effect ('subsequent post_reel / post_photos go out AS that page'). It distinguishes from sibling tools like post_photos and post_reel by indicating this tool is used to set the identity for those operations.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description explains when to use the tool (before posting as a page) and explicitly mentions a prerequisite ('Requires a captured CometProfileSwitchMutation template'). However, it does not provide exclusions or alternative tools for switching profiles, though the sibling context makes the usage fairly clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 6 tool updatesv0.1.0
    • First observedcapture_status
    • First observedget_identity
    • First observedhealth
    • First observedpost_photos
    • First observedpost_reel
    • First observedswitch_profile

TDQS

A4.2/5.0
Disambiguation5/5

Each tool has a clearly distinct purpose: capture_status checks template readiness, get_identity reads current identity, health checks system status, post_photos and post_reel handle different content types, and switch_profile changes posting identity. No ambiguity.

Naming Consistency4/5

Most tools follow verb_noun pattern (capture_status, get_identity, post_photos, post_reel, switch_profile). The 'health' tool is a noun but acceptable as a status check. Overall consistent.

Tool Count5/5

Six tools is well-scoped for a browser extension MCP focused on posting to Facebook. Not overloaded nor insufficient.

Completeness5/5

The tool set covers the core workflow: checking status, posting photos and reels, switching profiles, and monitoring health. No obvious gaps for its intended purpose of multi-platform posting via browser automation.

Maintenance

ActivityStale
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    A
    quality
    B
    maintenance
    MCP server to manage social media accounts from AI assistants, enabling post creation, scheduling, publishing, and media uploads across multiple platforms.
    13
    193
    1
    MIT
  • A
    license
    A
    quality
    C
    maintenance
    MCP server for QPost that lets AI agents schedule and publish video/image posts to YouTube, TikTok, and Instagram via QPost's REST API.
    7
    69
    MIT

Latest Blog Posts

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/crisng95/fbem'

If you have feedback or need assistance with the MCP directory API, please join our Discord server