MCP (streamable HTTP) via MCPServerStreamableHttp · Facebook

Draft Facebook Page posts with the OpenAI Agents SDK

The OpenAI Agents SDK can run a small agent on a schedule that writes Page posts from your own data: new listings, class timetables, weekly reports. SocialHandoff gives it MCP tools to draft and preview, and holds every Facebook post for approval. The agent never sees Page tokens. It calls attach_media only if a post needs pictures; a text and link post needs none.

Prompt

Instructions: You post new rental listings to our Facebook Page. For each listing in the input, write a post with neighborhood, rooms, rent, move-in date, and the listing link, under 80 words. Draft each one for Facebook.

How to do it

  1. Connect Facebook and mint a key In https://app.socialhandoff.com, open Connections, sign in with Facebook and pick the Pages to connect; each Page becomes its own channel. Then create an agent key named OpenAI Agents SDK scoped to Facebook with draft and schedule permission.
  2. Load the tools Connect with MCPServerStreamableHttp inside an async with block, pointing at https://app.socialhandoff.com/mcp and sending the key as a bearer header. The agent gets attach_media, draft_post, schedule_post, and preview_posts.
  3. Add photos only if you need them A Page post can be text and a link. For photos, the agent calls attach_media through the adapter (or you POST https://app.socialhandoff.com/v1/media/import with url and alt) and passes the ids to draft_post in mediaIds.
  4. Run the agent Run the agent with Runner.run and the day's listings. It creates one draft per listing.

Example draft

New listing in Riverside: bright 2-bedroom apartment with a balcony, 5 minutes from the tram.

Rent: $1,650 per month
Available: December 1

Photos and viewing times: https://example.com/listings/riverside-2br

Gotchas

  • A Page post can carry up to 10 photos or one video, not both. Each photo should have alt text, or the missing-alt-text guardrail flags it.
  • The SDK caches nothing about approvals. If a run retries, send the same idempotencyKey so you get the same draft back.
  • Facebook Page tokens do not expire, but removing the app's access in Facebook disconnects the Page. Reconnect it in Connections.
Facebook
  • Where you can post: Facebook Pages only. The API does not allow posting to personal profiles or to Groups through SocialHandoff.
  • Page access: You need a role on the Page that allows creating content.
  • Photos: One photo with alt text, or up to 10 photos in one post.
  • Video: One video per post.
Facebook post scheduler for Pages, with approval built in

Frequently asked questions

Can one agent post to several Pages?
Yes. Every Page granted at sign-in connects as its own channel, and a key scoped to Facebook can draft for them. Each post names its Page on the approval card.
Do I need the hosted MCP tool?
No. MCPServerStreamableHttp connects from your own process, so the key stays in your environment.
Why can only testers post at first?
Meta requires App Review and Business Verification before your own developer app can post for people outside its tester list. Until then, add people under App Roles.

Let your agents post. Keep the final say.

Connect your first agent in minutes. Every draft waits in your inbox until you approve it.

14 days free. No card required.

The hosted version is opening soon

Leave your email and we will send one message when hosted accounts open, with your 14-day trial ready. Want it today? Self-host it free from the repo.

Start free trial