facebook-mcp
by Maz1n0-zzz
README.md
# Facebook Page MCP Server
MCP đăng & quản lý nội dung trên Facebook Page qua Meta Graph API v21.0. Chạy được STDIO (npx từ GitHub, dùng local) hoặc HTTP (deploy remote cho Evose). Ai cũng dùng được — chỉ điền biến môi trường, không sửa code.
**10 tools:** get_page_info, post_status, post_link, post_photo, post_video, list_posts, get_post, delete_post, get_post_comments, reply_comment.
Mọi tool nhận thêm hai tham số tuỳ chọn `page_id` và `access_token`, nên một bản chạy phục vụ được nhiều tài khoản. Không truyền thì server dùng biến môi trường làm giá trị mặc định.
Truyền `page_id` thì phải truyền cả `access_token`, và ngược lại. Truyền nửa cặp thì server báo thiếu cấu hình chứ **không** lặng lẽ dùng credential mặc định. Một ô để trống từng làm bài của tài khoản này đăng lên tài khoản khác mà vẫn báo thành công.
Mọi tham số id chỉ nhận chữ số, chữ cái và dấu gạch dưới, tối đa 64 ký tự. Id chứa `/`, `?` hay `&` bị từ chối, vì nó đổi được endpoint Graph API.
## Biến môi trường
| Biến | Bắt buộc | Mô tả |
|------|:--:|------|
| FB_PAGE_ID | ✅ | ID Facebook Page |
| FB_PAGE_ACCESS_TOKEN | ✅ | Page Access Token (nên dùng long-lived) |
| FB_GRAPH_VERSION | ❌ | Mặc định v21.0 |
| MCP_TRANSPORT | ❌ | `stdio` (mặc định) hoặc `http` (bắt buộc để dùng remote qua Evose) |
| MCP_AUTH_TOKEN | Bắt buộc khi `MCP_TRANSPORT=http` | Secret dùng cho header `Authorization: Bearer <token>` |
| HOST | ❌ | Địa chỉ bind khi chạy HTTP, mặc định `127.0.0.1` |
| PORT | ❌ | Cổng lắng nghe khi chạy HTTP, mặc định `8788` |
| MCP_PUBLIC_HOST | ❌ | Hostname công khai (qua reverse proxy) để chặn DNS rebinding |
## Lấy token
1. developers.facebook.com → tạo App (Business).
2. Graph API Explorer → chọn app + page → cấp quyền: `pages_manage_posts`, `pages_read_engagement`, `pages_show_list`.
3. Generate token → đổi sang long-lived token.
4. Lấy Page ID trong phần About của page.
## Import vào Evose (STDIO / npx)
```json
{
"mcpServers": {
"facebook": {
"command": "npx",
"args": ["-y", "github:<user>/facebook-mcp"],
"env": {
"FB_PAGE_ID": "...",
"FB_PAGE_ACCESS_TOKEN": "..."
}
}
}
}
```
Thay `<user>` bằng GitHub username sau khi push. Execution Timeout để 120s.
## Import vào Evose (HTTP remote)
Deploy server ở chế độ `MCP_TRANSPORT=http` (VPS/Railway/Render), sau đó khai báo trong Evose dạng Streamable HTTP:
```json
{
"mcpServers": {
"facebook": {
"url": "https://<domain-cua-server>/mcp",
"type": "streamable-http",
"headers": { "Authorization": "Bearer <MCP_AUTH_TOKEN>" }
}
}
}
```
## Ghi chú
- Ảnh/video đăng từ URL công khai. Server tự báo lỗi nếu thiếu biến môi trường (không crash).
- License MIT.TDQS
B3.3/5.0
Scored across 10 tools
Disambiguation5/5
Each tool targets a distinct action: four posting types (status, link, photo, video), three post CRUD operations (list, get, delete), two comment operations (get, reply), and page info. No overlap.
Naming Consistency5/5
All tool names follow a consistent verb_noun pattern (e.g., post_status, list_posts, delete_post). English verbs are used throughout, making the set predictable.
Tool Count5/5
10 tools cover core Facebook page management: posting, reading, deleting, commenting, and page info. This count is well-scoped for the purpose.
Completeness4/5
Covers essential create, read, delete for posts, plus comments and page info. Missing update_post and engagement actions like likes, but the core workflow is complete for basic management.
Maintenance
ActivityMaintained
ResponsivenessNo issues