{
  "markdown": "# facebook-pages-mcp\n\n[![npm version](https://img.shields.io/npm/v/facebook-pages-mcp.svg)](https://www.npmjs.com/package/facebook-pages-mcp)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\nMCP server for **Facebook Pages** organic analytics and management, powered by Meta Graph API **v25.0**.\n\nBuilt for [Claude Code](https://claude.ai/claude-code) and any MCP-compatible AI tool. Gives your AI assistant direct access to your Facebook Page data — posts, insights, comments, and more.\n\nPart of **[The SEO Engine](https://lanternrow.com/seo-engine/)** toolkit by [Rex Jones](https://rexjones.me) — AI-powered SEO and social media tooling for agencies and businesses.\n\n## Why this exists\n\n- **No good Facebook Pages MCP server existed.** Instagram has several. Facebook Pages had none that worked on a current API version.\n- **Meta deprecated legacy metrics on June 15, 2026.** `page_impressions`, `page_reach`, and `page_impressions_unique` no longer return data. This server uses the replacement metrics from day one.\n- **Business Manager support.** Most businesses manage Pages through Meta Business Manager, not personal accounts. This server works with both.\n\n## Quick start\n\n### Option 1: npx (no install)\n\n```json\n{\n  \"mcpServers\": {\n    \"facebook-pages\": {\n      \"command\": \"npx\",\n      \"args\": [\"-y\", \"facebook-pages-mcp\"],\n      \"env\": {\n        \"FB_PAGE_ACCESS_TOKEN\": \"your_page_access_token\",\n        \"FB_PAGE_ID\": \"your_page_id\"\n      }\n    }\n  }\n}\n```\n\n### Option 2: Clone and build\n\n```bash\ngit clone https://github.com/lanternrow/facebook-pages-mcp.git\ncd facebook-pages-mcp\nnpm install\nnpm run build\n```\n\nThen add to your Claude Code MCP settings:\n\n```json\n{\n  \"mcpServers\": {\n    \"facebook-pages\": {\n      \"command\": \"node\",\n      \"args\": [\"/path/to/facebook-pages-mcp/dist/index.js\"],\n      \"env\": {\n        \"FB_PAGE_ACCESS_TOKEN\": \"your_page_access_token\",\n        \"FB_PAGE_ID\": \"your_page_id\"\n      }\n    }\n  }\n}\n```\n\n## Getting your Page Access Token\n\n### Step 1: Create a Meta App\n\n1. Go to [Meta for Developers](https://developers.facebook.com/apps/) and click **Create App**\n2. Name your app and choose the **\"Manage everything on your Page\"** use case\n3. Connect it to your Business Portfolio\n\n### Step 2: Generate a token in the Graph API Explorer\n\n1. Open the [Graph API Explorer](https://developers.facebook.com/tools/explorer/)\n2. Select your app from the **Meta App** dropdown\n3. Add permissions: `pages_show_list`, `pages_read_engagement`, `business_management`\n4. Click **Generate Access Token** and complete the OAuth flow\n5. When asked about Pages, select **\"Opt in to all current and future Pages\"**\n\n### Step 3: Get your Page Access Token\n\n**If your Pages are managed through Business Manager** (most businesses):\n\n```\n# First, find your business ID\nGET /me/businesses?fields=id,name\n\n# Then get Page tokens for that business\nGET /{business-id}/owned_pages?fields=id,name,access_token\n```\n\n**If your Pages are on your personal account:**\n\n```\nGET /me/accounts?fields=id,name,access_token\n```\n\nCopy the `access_token` and `id` for the Page you want.\n\n### Step 4: Exchange for a long-lived token (recommended)\n\nShort-lived tokens expire in ~1 hour. Exchange for a long-lived token (~60 days):\n\n```\nGET /oauth/access_token\n  ?grant_type=fb_exchange_token\n  &client_id={your-app-id}\n  &client_secret={your-app-secret}\n  &fb_exchange_token={short-lived-token}\n```\n\n> **Tip:** For Pages you admin, Page tokens derived from a long-lived User Token never expire.\n\n## Tools\n\n### Read tools\n\n| Tool | Description |\n|------|-------------|\n| `get_page_info` | Page metadata: name, category, follower count, contact info, cover photo |\n| `get_page_insights` | Page-level analytics with date ranges and period aggregation (day/week/28-day) |\n| `get_published_posts` | Paginated list of posts authored by the Page |\n| `get_post_insights` | Per-post engagement: impressions, clicks, reactions by type |\n| `get_post_comments` | Paginated comments with author info and like/reply counts |\n| `get_video_insights` | Video performance: views, watch time, reactions |\n| `get_page_feed` | Full feed including visitor posts |\n\n### Write tools\n\n| Tool | Description |\n|------|-------------|\n| `create_post` | Publish text, link, or photo posts to the Page |\n\n### Utility tools\n\n| Tool | Description |\n|------|-------------|\n| `refresh_token_info` | Check token validity, expiration, and granted scopes |\n\n## Metrics and the June 2026 deprecation\n\nMeta deprecated these page-level metrics on June 15, 2026:\n\n| Deprecated | Replacement |\n|-----------|-------------|\n| `page_impressions` | `page_views_total` |\n| `page_reach` | Page Viewer metric (rolling out) |\n| `page_impressions_unique` | Media Viewers metric (rolling out) |\n\nThis server uses only non-deprecated metrics: `page_views_total`, `page_fans`, `page_fan_adds`, `page_fan_removes`, `page_actions_post_reactions_total`.\n\n## Architecture\n\n```\nsrc/\n  index.ts          # MCP server entry point, tool registration\n  client.ts         # Graph API HTTP client (native fetch, no dependencies)\n  types.ts          # TypeScript interfaces for API responses\n  tools/\n    pages.ts        # get_page_info, get_page_feed\n    insights.ts     # get_page_insights, get_video_insights\n    posts.ts        # get_published_posts, get_post_insights, get_post_comments, create_post\n    utils.ts        # refresh_token_info\n```\n\n- **Zero external HTTP dependencies** — uses Node 18+ native `fetch`\n- **Rate limit tracking** — captures `x-app-usage` and `x-page-usage` headers\n- **Cursor-based pagination** — all list endpoints support `after` cursor and configurable limits\n- **Zod validation** — all tool inputs validated with descriptive error messages\n\n## Environment variables\n\n| Variable | Required | Description |\n|----------|----------|-------------|\n| `FB_PAGE_ACCESS_TOKEN` | Yes | Long-lived Page Access Token |\n| `FB_PAGE_ID` | Yes | Default Facebook Page ID (numeric) |\n\n## Development\n\n```bash\nnpm run dev    # Watch mode — recompiles on save\nnpm run build  # Production build\nnpm start      # Run the server\n```\n\n## Contributing\n\nIssues and PRs welcome. If Meta changes the API (they will), please open an issue.\n\n## License\n\nMIT — see [LICENSE](LICENSE).\n\n---\n\nBuilt as part of **The SEO Engine** by [Rex Jones](https://rexjones.me).\n",
  "bytes": 6363,
  "sha": "cfb6e06332414da71968a79b9cdb8f5a468a6d02c634d7b2b4164dfbbb35887a",
  "repo_slug": "lanternrow/facebook-pages-mcp",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_lanternrow_facebook_pages_mcp_1c7f1e47/readme"
}