facebook-marketplace-mcp
Provides tools for searching Facebook Marketplace listings, retrieving listing details, browsing nearby listings, exploring categories, and parsing listing URLs.
Click on "Deploy 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-marketplace-mcpsearch for used bicycles in Portland under $300"
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 Marketplace MCP Server
Production-grade Model Context Protocol (MCP) server and REST API service for Facebook Marketplace.
Designed to support stdio, SSE (Server-Sent Events), and Streamable HTTP (JSON-RPC 2.0), ready for local desktop assistants (Claude Desktop, Cursor, Antigravity) and multi-service cloud deployments behind Nginx and Docker Compose on https://mcp.cuang.dev/facebook alongside Shopee and Tokopedia.
π Features
Triple Transport Architecture:
π₯οΈ Stdio: Zero-configuration desktop MCP execution (
npx facebook-marketplace-mcp --stdio).β‘ SSE (Server-Sent Events): Long-lived streaming endpoint at
/ssewith prefix-aware/messagesdispatch.π Streamable HTTP: Stateless JSON-RPC 2.0 POST endpoint at
/mcp.π REST API: Direct HTTP routes (
/api/marketplace/...) and health checks.
Reverse Proxy & Prefix Awareness:
Automatically honors
X-Forwarded-PrefixandBASE_PATH(e.g./facebookundermcp.cuang.dev/facebook).
Unified Multi-Platform Gateway:
Includes Nginx and Docker Compose configurations ready to run alongside
shopee-indonesia-mcpandtokopedia-mcp.
5 High-Level MCP Tools:
search_marketplace: Full query, location, price min/max, condition, category, and sorting filters.get_listing_details: Deep listing inspection, price, seller info, location, attributes, and photos.get_nearby_listings: Browse local/trending items in any city without keywords.get_marketplace_categories: Category taxonomy navigation.parse_listing_url: Extract IDs, location slugs, and canonical links.
Enterprise Security & Isolation:
API Key protection (
x-api-key,Authorization: Bearer, or query parameter?apiKey=).Ephemeral user session cookies (
x-facebook-cookieheader orcookieparameter) processed strictly in-memory without persistent logging.Cache keys salted by hash of session cookies to prevent cross-tenant data leakage.
Built-in simulation fallback mode (
MOCK_ON_BLOCKED=true) ensuring zero downtime during testing or anti-bot blocks.
Related MCP server: Facebook Marketplace MCP
π¦ Quickstart via NPM (Local Desktop MCP)
You can run the server directly without cloning:
# Stdio mode (recommended for Claude Desktop, Cursor, Antigravity)
npx facebook-marketplace-mcp --stdio
# Or start as a local HTTP / SSE server on port 3000
npx facebook-marketplace-mcp --port 3000Claude Desktop Configuration
Add the following to your claude_desktop_config.json:
{
"mcpServers": {
"facebook-marketplace": {
"command": "npx",
"args": ["-y", "facebook-marketplace-mcp", "--stdio"],
"env": {
"DEFAULT_LOCATION": "jakarta",
"FB_COOKIE": ""
}
}
}
}Cursor & Antigravity Configuration
In Cursor (Settings -> Features -> MCP Servers) or Antigravity:
Name:
facebook-marketplaceType:
command(stdio)Command:
npx -y facebook-marketplace-mcp --stdio
π οΈ MCP Tools Overview
1. search_marketplace
Search listings with query keywords, city location, price filters, category, condition, and sorting.
{
"query": "MacBook Pro M3",
"location": "jakarta",
"minPrice": 15000000,
"maxPrice": 30000000,
"category": "electronics",
"condition": "used_like_new",
"sortBy": "price_asc",
"limit": 10
}2. get_listing_details
Retrieve item attributes, seller details, formatted prices, and high-resolution photo URLs.
{
"listingIdOrUrl": "729481902830192"
}(Accepts either numeric listing IDs or full Facebook Marketplace URLs).
3. get_nearby_listings
Browse trending or recent marketplace listings in a specific city.
{
"location": "jakarta",
"limit": 20
}4. get_marketplace_categories
Get taxonomy of categories and subcategories.
{
"filter": "vehicles"
}5. parse_listing_url
Parses and validates Facebook Marketplace URLs into canonical formats.
{
"url": "https://www.facebook.com/marketplace/item/729481902830192/"
}π HTTP & SSE Transports
When running as an HTTP server (PORT=3000, BASE_PATH=/facebook):
Protocol | Endpoint | Description |
MCP SSE Stream |
| MCP Server-Sent Events handshake |
MCP SSE Messages |
| Client JSON-RPC dispatch endpoint |
MCP Streamable HTTP |
| Direct JSON-RPC 2.0 request/response |
REST Search |
| REST endpoint for search queries |
REST Item Details |
| REST endpoint for item details |
Health Check |
| Container and cache health check |
Service Root |
| Interactive JSON discovery & docs |
π³ Docker & Multi-Service Deployment (mcp.cuang.dev)
This server is designed to be deployed alongside Shopee and Tokopedia behind an Nginx reverse proxy under https://mcp.cuang.dev/<mcp-name>.
Standalone Docker
docker build -t facebook-marketplace-mcp .
docker run -d -p 3002:3000 --name facebook-mcp facebook-marketplace-mcpUnified Multi-Service Stack
To launch Nginx, Facebook Marketplace, Shopee, and Tokopedia together:
docker compose -f deploy/docker-compose.unified.yml up -d --buildNginx routes traffic as follows:
https://mcp.cuang.dev/facebook/βfacebook-marketplace-mcp:3000/https://mcp.cuang.dev/shopee/βshopee-indonesia-mcp:3000/https://mcp.cuang.dev/tokopedia/βtokopedia-mcp:3000/https://mcp.cuang.dev/healthβ Aggregated Gateway Health
βοΈ Environment Configuration
Variable | Default | Description |
|
| HTTP port to listen on |
|
| Network binding interface |
|
| Base route prefix (e.g. |
|
| Optional API key protecting public endpoints |
|
| Optional Facebook session cookies ( |
|
| Default city for unlocalized searches |
|
| HTTP proxy URL |
|
| HTTPS proxy URL |
|
| Minimum delay between live scraper requests |
|
| Fallback to simulation mode if blocked or unauthenticated |
|
| Logging verbosity ( |
π§ͺ Development & Testing
# Install dependencies
npm install
# Run test suite
npm test
# Build TypeScript to dist/
npm run build
# Verify npm package tarball
npm pack --dry-runπ License
MIT Β© William Axel
This server cannot be deployed
Maintenance
Related MCP Connectors
Pay-per-use tool marketplace for AI agents. Search, price-check, and call APIs via MCP.
Agent-native marketplace. Bootstrap, list inventory, search, negotiate, and trade via MCP.
MCP server for IT hardware parts research: normalize PNs, search listings, get subs/comps.
Hosted MCP with 91 agent tools: X, domains, SEO, Maps, Trends, Search, YouTube, TikTok, and more.
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables access to the Facebook Scraper3 API to extract data from Facebook profiles, pages, groups, and the marketplace. It provides comprehensive tools for searching posts, people, and events, as well as retrieving detailed metadata for comments, reactions, and media.401MIT
- FlicenseAqualityBmaintenanceEnables searching Facebook Marketplace listings from Claude using your existing Facebook session without a browser.71-
- AlicenseAqualityCmaintenanceA focused Model Context Protocol server that enables AI agents to search Facebook Marketplace and retrieve listing details using public GraphQL endpoints, without browser automation or login.31MIT
- AlicenseNot gradedqualityBmaintenanceMCP server that searches Facebook Marketplace and Craigslist for items for sale, returning structured JSON listings with filtering, deduplication, and optional deep description checks.1MIT