Facebook MCP Server

Facebook MCP Server

Enables AI agents to manage Facebook profiles, pages, posts, and engagement via the Graph API with OAuth authentication.

Category
访问服务器

README

Facebook MCP Server

A comprehensive Model Context Protocol (MCP) server for managing Facebook features, including Profiles, Pages, Posts, and Engagement. This server integrates with the Facebook Graph API and provides a seamless way for AI agents (like Claude Desktop) to interact with Facebook.

Features

  • OAuth 2.0 Authentication: No need to hardcode long-lived access tokens. The server includes a built-in OAuth flow to authenticate directly with Facebook.
  • Profile Management: Fetch profile details for the authenticated user or specific user IDs.
  • Page Management: List managed pages and fetch page insights.
  • Content Publishing: Publish posts to feeds or pages, and delete objects.
  • Engagement: Read feeds, fetch comments, and reply to comments.
  • Docker Support: Easily containerized and run with Docker Compose.

Prerequisites

Before running the server, you need to create a Facebook App on the Meta for Developers portal.

  1. Go to Meta for Developers.
  2. Create a new App (choose "Other" -> "Consumer" or "Business" depending on your needs).
  3. Add the Facebook Login product to your app.
  4. In the Facebook Login settings, add your redirect URI to the "Valid OAuth Redirect URIs" list. By default, it should be: http://localhost:3000/auth/facebook/callback.
  5. Get your App ID and App Secret from the App Dashboard -> Settings -> Basic.

Installation

Local Setup

  1. Clone or copy the project files to your desired directory.
  2. Install dependencies:
    npm install
    
  3. Copy .env.example to .env and fill in your credentials:
    cp .env.example .env
    
    Edit .env:
    FACEBOOK_APP_ID=your_actual_app_id
    FACEBOOK_APP_SECRET=your_actual_app_secret
    PORT=3000
    REDIRECT_URI=http://localhost:3000/auth/facebook/callback
    

Running the Server

Option 1: Local Node.js

  1. Build the project:
    npm run build
    
  2. Start the server:
    npm start
    

Option 2: Docker

  1. Make sure your .env file is filled out.
  2. Run with Docker Compose:
    docker-compose up --build
    
    This will build the image and start the server, exposing the port specified in your .env file (default 3000) for the authentication callback.

Connecting to Claude Desktop

Add the server to your Claude Desktop configuration file (usually located at %APPDATA%\Claude\claude_desktop_config.json on Windows or ~/Library/Application Support/Claude/claude_desktop_config.json on macOS).

For Local Execution:

{
  "mcpServers": {
    "facebook": {
      "command": "node",
      "args": ["f:/MCP_Server/Facebook_MCP_server/dist/index.js"],
      "env": {
        "FACEBOOK_APP_ID": "your_app_id",
        "FACEBOOK_APP_SECRET": "your_app_secret",
        "REDIRECT_URI": "http://localhost:3000/auth/facebook/callback",
        "PORT": "3000"
      }
    }
  }
}

(Adjust the path to index.js as necessary)

For Docker Execution:

If running via Docker, the server reads the .env file from the directory. You can use the docker command in Claude config if you have Claude configured to run docker commands, or simply run the container in the background and connect via network if supported (though stdio is the standard for Claude Desktop).

Authentication Flow

Once the server is connected to Claude Desktop:

  1. Ask Claude to "Authenticate with Facebook" or use the fb_authenticate tool.
  2. Claude will provide a login URL.
  3. Open the URL in your browser, log in to Facebook, and authorize the application.
  4. You will be redirected to a page that says "Authentication Successful!".
  5. The server automatically saves the access token in a local .fb_token.json file.
  6. You can now start using all other tools!

Available Tools

Auth

  • fb_authenticate: Returns the URL to start the OAuth login process.

Profile

  • fb_get_profile: Get profile details (ID, Name, etc.). Can accept userId and fields.

Pages

  • fb_get_pages: List Facebook Pages managed by the authenticated user.
  • fb_get_page_insights: Get metrics (like impressions) for a specific page.

Publishing

  • fb_publish_post: Publish a message or link to a feed/page.
  • fb_delete_object: Delete a post or comment by ID.

Engagement

  • fb_get_feed: Get posts from a feed.
  • fb_get_comments: Get comments on an object.
  • fb_reply_comment: Post a reply to a comment.

License

ISC

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选