How to integrate Facebook MCP with Codex

Connect Codex to Facebook MCP. Post new product launch on our page, upload latest event photos to album, and more using natural language, with authentication handled for you.

Facebook logoFacebook
Oauth2

Facebook is a social media and advertising platform for businesses and creators. It helps you connect, share, and manage content across your public Facebook Pages.

60 Tools

Introduction

Codex is one of the most popular coding harnesses out there. And MCP makes the experience even better. With the Facebook MCP integration, Codex can create and schedule Page posts, reply to comments, send Messenger messages, review Page and post insights, and list ad campaigns, all without leaving the terminal or the app, whichever you prefer.

Also integrate Facebook with

Why use Composio?

Apart from a managed and hosted MCP server, you will get:

  • CodeAct: A dedicated workbench that allows GPT to write its code to handle complex tool chaining. Reduces to-and-fro with LLMs for frequent tool calling.
  • Large tool responses: Handle them to minimise context rot.
  • Dynamic just-in-time access to 20,000 tools across 1500+ other Apps for cross-app workflows. It loads the tools you need, so GPTs aren't overwhelmed by tools you don't need.

How to install Facebook MCP in Codex

Run the setup command

Run this command in your terminal to add the Composio MCP server to Codex.

Terminal

It will initiate the authentication in a browser window, authorize Codex to access your Composio account.

Composio authentication page

(Optional) Authenticate with OAuth

To authenticate manually, run the login command to open a browser window and authorize Codex to access your Composio account.

bash
codex mcp login composio

Verify the connection

Run codex mcp list to confirm Composio appears as a registered MCP server.

bash
codex mcp list

Codex App

Codex App follows the same approach as VS Code.

  1. Click ⚙️ on the bottom left → MCP Servers → + Add servers → Streamable HTTP:
  2. Fill the header and Key fields with { "x-consumer-api-key" = "ck_*******" }.
  3. The Key is the Composio API key, that you can find on dashboard.composio.dev
  4. Click on Authenticate and authorize Codex to your Composio account and you're all set.
Codex App MCP setup
  1. Restart and verify if it's there in .codex/config.toml
bash
[mcp_servers.composio]
url = "https://connect.composio.dev/mcp"
http_headers = { "x-consumer-api-key" = "ck_*******" }

Try it

Ask Codex for a Facebook task. The first time, Composio asks you to connect your Facebook account.

For example, ask it to:

  • "Post new product launch on our page"
  • "Upload latest event photos to album"
  • "Reply to comments on latest post"

What is the Facebook MCP server, and what's possible with it?

The Facebook MCP server is an implementation of the Model Context Protocol that connects your AI agent and assistants like Claude, Cursor, etc directly to your Facebook Page account. It provides structured and secure access to your Facebook Pages, so your agent can perform actions like publishing posts, managing comments, uploading media, and handling page roles on your behalf.

  • Automated content publishing: Have your agent create new posts, photo posts, or video posts directly to your Facebook Page, keeping your audience engaged without manual effort.
  • Media management: Effortlessly upload photos to existing albums or create new albums for organized visual storytelling on your Page.
  • Interactive engagement: Let your agent add reactions, post comments, or reply to comments, fostering genuine interaction with your followers.
  • Page moderation and cleanup: Ask your agent to delete unwanted comments or posts, helping you keep your Facebook Page professional and on-brand.
  • Page team management: Assign tasks or roles to users for your Facebook Page, streamlining collaboration and access control.

Conclusion

You've successfully integrated Facebook with Codex using Composio's MCP server. Now you can interact with Facebook directly from your terminal, VS Code, or the Codex App using natural language commands.

Key benefits of this setup:

  • Seamless integration across CLI, VS Code, and standalone app
  • Natural language commands for Facebook operations
  • Managed authentication through Composio
  • Access to 20,000+ tools across 1500+ apps for cross-app workflows
  • CodeAct workbench for complex tool chaining

Next steps:

  • Try asking Codex to perform various Facebook operations
  • Explore cross-app workflows by connecting more toolkits
  • Build automation scripts that leverage Codex's AI capabilities
TOOLS

Supported Tools

Every Facebook action and event your agent gets out of the box.

Assign Page Task

Assigns tasks/roles to a business-scoped user or system user for a specific Facebook Page.

Create Comment

Creates a comment on a Facebook post or replies to an existing comment.

Create Multi-Photo Post

Publish one Facebook Page feed post containing one or more photos from public URLs.

Create Photo Post

Creates a photo post on a Facebook Page using an image URL or uploaded image, with an optional caption.

Create Post

Creates a text or link post on a Facebook Page, with a required message field and optional link, scheduling, and targeting.

Create Video Post

Creates a video post on a Facebook Page.

Delete Comment

Deletes a Facebook comment.

Delete Post

Permanently deletes a Facebook Page post.

Get Ad Insights

Read Marketing API performance insights for an advertising object.

Get Comment

Retrieves details of a specific Facebook comment.

Get Comments

Retrieves comments from a Facebook post or comment (for replies).

Get Conversation Messages

Retrieves messages from a specific conversation.

Get Current User

Validates the access token and retrieves the authenticated user's own profile via /me.

Get Graph Object

Read caller-selected fields from an identified Facebook Graph node using permissions already granted to the connection.

Get Graph Objects

Read caller-selected fields from multiple Facebook Graph nodes in one batch request and return successes and failures keyed by requested object ID.

Get Message Details

Retrieves details of a specific message sent or received by the Page.

Get Page Conversations

Retrieves a list of conversations between users and the Page.

Get Page Details

Fetches details about a specific Facebook Page.

Get Page Insights

Retrieves analytics and insights for a Facebook Page, including follower, media view and engagement metrics.

Get Page Photos

Retrieves photos from a Facebook Page.

Get Page Posts

Retrieves posts from a Facebook Page's feed using Graph API v26.

Get Page Roles

Retrieves a list of people and their tasks/roles on a Facebook Page.

Get Page Tagged Posts

Retrieves posts where a Facebook Page is tagged or mentioned.

Get Page Videos

Retrieves videos from a Facebook Page.

Get Post

Retrieves details of a specific Facebook post using a full numeric Page ID and post ID separated by an underscore.

Get Post Insights

Retrieves media-view and unique media-viewer insights for a Facebook post.

Get Post Reactions

Retrieves reactions (like, love, wow, etc.

Get Scheduled Posts

Retrieves one page of scheduled and unpublished posts for a Facebook Page, with pagination information when returned.

Add Reaction

Adds a LIKE reaction to a Facebook post or comment.

List Ad Account Campaigns

List campaigns belonging to a Facebook ad account.

List Ad Accounts

List ad accounts available to the authenticated Facebook user.

List Ads

List ads associated with a Facebook advertising parent.

List Assigned Ad Accounts

Lists ad accounts assigned to a business-scoped user.

List Business Ad Accounts

Lists client ad accounts a Facebook Business can access.

List Businesses

List Business Manager businesses accessible to the connected Facebook user, including selected business details and permitted roles.

List Client Pages

List client-owned Pages accessible to a Business Manager business.

List Managed Pages

Retrieves Facebook Pages managed by a user, with page details, access tokens and tasks when returned.

List Object Attachments

List one page of attachments belonging to a Facebook Graph object.

List Owned Ad Accounts

List ad accounts owned by a Business Manager business, with optional Meta account filtering and cursor pagination.

List Owned Pages

List Facebook Pages owned by a Business Manager business.

List Page Stories

Lists photo and video stories for a Facebook Page managed by the connected account.

List Permissions

List granted, declined, or expired Facebook permissions for the connected user and app.

List Published Page Posts

List posts published by a Facebook Page, excluding unpublished posts.

List Video Tags

Return one page of people or Pages tagged on a Facebook video.

List Video Thumbnails

List available thumbnail images for a Facebook video.

Mark Message Seen

Marks a user's message as seen by the Page, visibly updating the read status in the user's conversation.

Publish Scheduled Post

Publishes a previously scheduled or unpublished Facebook post immediately.

Refresh URL Scrape

Ask Facebook to rescrape a public HTTP or HTTPS URL, optionally returning requested URL metadata fields.

Remove Page Task

Removes a user's tasks/access from a specific Facebook Page.

Reschedule Post

Changes the scheduled publish time of an unpublished Facebook post.

Search Ad Targeting Options

Searches query-driven Meta ad targeting option families, including geographic areas, interests, locales, schools, majors, employers, and job titles.

Search Geographic Targeting Locations

Find current geographic keys accepted by Meta ad targeting.

Send Media Message

Sends a media message (image, video, audio, or file) from the Page to a user.

Send Message

Sends a text message from a Facebook Page (not personal profiles) to a user via Messenger.

Toggle Typing Indicator

Shows or hides the typing indicator for a user in Messenger.

Unlike Post or Comment

Removes a like from a Facebook post or comment.

Update Comment

Updates an existing Facebook comment.

Update Page Settings

Updates settings for a specific Facebook Page.

Update Post

Updates an existing Facebook Page post.

Upload Photos Batch

Uploads independent photos to a Facebook Page or Album using the Graph batch API, accepting up to 50 local files and up to 50 photo URLs.

FAQ

Frequently asked questions

With a standalone Facebook MCP server, the agents and LLMs can only access a fixed set of Facebook tools tied to that server. However, with the Composio Tool Router, agents can dynamically load tools from Facebook and many other apps based on the task at hand, all through a single MCP endpoint.

Yes, you can. Codex fully supports MCP integration. You get structured tool calling, message history handling, and model orchestration while Tool Router takes care of discovering and serving the right Facebook tools.

Yes, absolutely. You can configure which Facebook scopes and actions are allowed when connecting your account to Composio. You can also bring your own OAuth credentials or API configuration so you keep full control over what the agent can do.

All sensitive data such as tokens, keys, and configuration is fully encrypted at rest and in transit. Composio is SOC 2 Type 2 compliant and follows strict security practices so your Facebook data and credentials are handled as safely as possible.

Start with Facebook.It takes 30 seconds.

Managed auth, hosted MCP servers, and every Facebook tool your agent needs.Free to start.

Start building