Skip to main content
Glama
Facebook MCP

Facebook MCP

by NabuxAi
README.md
> **Community source release (MIT).** Self-host using your own credentials. No NabuxAI production accounts or hosted-service access are included.

# Facebook MCP by Nabux

Multi-user, multi-Page MCP gateway powered by Meta's official Facebook Graph API and Messenger Platform.

Production target: `https://fb.nabuxai.com`  
MCP endpoint: `https://fb.nabuxai.com/mcp`  
Meta webhook: `https://fb.nabuxai.com/webhook`

## Architecture

```text
Facebook Login -> managed Pages discovery -> encrypted Page tokens
                                      |
                                      +-> /mcp -> ChatGPT / Claude / Cursor
                                      +-> /webhook -> Messenger events -> SQLite
                                      +-> /internal/v1 -> trusted Nabux services
```

No Facebook password automation, cookie/session scraping or browser bots are used.

## MCP tools

- `facebook_pages`
- `facebook_page_profile`
- `facebook_list_posts`
- `facebook_publish_post`
- `facebook_publish_link`
- `facebook_publish_photo`
- `facebook_list_comments`
- `facebook_reply_comment`
- `facebook_hide_comment`
- `facebook_delete_object`
- `facebook_page_insights`
- `facebook_list_conversations`
- `facebook_recent_messages`
- `facebook_get_conversation`
- `facebook_search_messages`
- `facebook_send_message`

Messenger webhook events are stored only for Pages connected to a Nabux owner. MCP account resolution is owner-scoped.

## Meta setup

Configure Facebook Login and request only permissions your product actually needs. Default gateway scopes:

```text
pages_show_list
pages_read_engagement
pages_manage_posts
pages_manage_engagement
pages_manage_metadata
pages_messaging
read_insights
```

OAuth redirect URI:

```text
https://fb.nabuxai.com/facebook/callback
```

Webhook callback:

```text
https://fb.nabuxai.com/webhook
```

Subscribe the app/Page to fields used by the gateway, currently `messages`, `messaging_postbacks`, and `feed`, and use the same verify token configured as `FB_WEBHOOK_VERIFY_TOKEN`.

## Coolify

Deploy `docker-compose.coolify.yml` from branch `feature/facebook-mcp-gateway` and route `fb.nabuxai.com` to port 8000.

Required secrets/config:

```text
PUBLIC_BASE_URL=https://fb.nabuxai.com
APP_SECRET_KEY=<32+ random chars>
FB_APP_ID=<Meta app id>
FB_APP_SECRET=<Meta app secret>
FB_REDIRECT_URI=https://fb.nabuxai.com/facebook/callback
FB_WEBHOOK_VERIFY_TOKEN=<random verify token>
INTERNAL_SERVICE_TOKEN=<random service token>
```

Meta/Page access tokens are encrypted at rest with a key derived from `APP_SECRET_KEY`; MCP bearer tokens are stored hashed.

## Data collection

The gateway stores Messenger events delivered after the Page webhook is active. It is not an archive scraper for arbitrary personal Facebook history. Search tools operate on the connected Page's webhook-backed data plus live Graph API data.

## Status

Code is deployment-shaped. Real E2E requires a Meta app, approved/available Page permissions, HTTPS/DNS, at least one Page managed by the authorizing user, and webhook configuration in the Meta dashboard.