Facebook Marketplace MCP Server
An MCP server that provides access to Facebook Marketplace via direct GraphQL API calls. No browser automation at runtime — speaks Facebook's internal protocol directly.
How It Works
Facebook's web client makes all Marketplace requests as POST /api/graphql/ with a doc_id (query hash) and variables. This server replays those requests using your existing Facebook session cookies from Chrome.
Think of it like pypush for iMessage — direct protocol, no browser.
Prerequisites
- macOS (cookie extraction uses Keychain)
- Google Chrome with an active Facebook login
- Node.js 20+
Installation
git clone <this-repo>
cd facebook-marketplace-mcp
npm install
npm run build
Setup with Claude Code
claude mcp add facebook-marketplace -- node /path/to/facebook-marketplace-mcp/dist/index.js
Or add to your Claude Code config manually:
{
"mcpServers": {
"facebook-marketplace": {
"command": "node",
"args": ["/path/to/facebook-marketplace-mcp/dist/index.js"],
"env": {
"CHROME_PROFILE": "Default"
}
}
}
}
Tools
search_listings
Search Marketplace by query, location, and filters.
get_listing
Get full details for a specific listing.
monitor_search
Save a search as a monitor to track new listings over time.
check_monitors
Check monitors for new listings since last check.
list_monitors
List all saved monitors.
delete_monitor
Delete a saved monitor.
Configuration
Updating GraphQL Queries
Facebook rotates their doc_id values on deploys. If searches stop working:
npm install -D playwright
npx playwright install chromium
npm run capture-queries
This opens a browser, navigates Marketplace, and captures current query IDs. Update src/facebook/queries.ts with the new values.
Rate Limiting
The server self-rate-limits to 3 requests/minute with random jitter to avoid detection. This means searches take a few seconds.
Limitations
- macOS only for automatic cookie extraction
- Requires Chrome with active Facebook session
- Facebook ToS — automating Facebook violates their Terms of Service
- Fragile —
doc_idvalues change on Facebook deploys - Rate limited — aggressive use may trigger CAPTCHAs or account flags
- No write operations — search/read only, no messaging or listing creation