MCP (streamable HTTP) via langchain-mcp-adapters · Bluesky

Post to Bluesky from LangChain, with approval

LangChain pipelines often end with content: a summary, a digest, an answer. With SocialHandoff's MCP server loaded through the LangChain MCP adapters, that last step can be a Bluesky draft. The model sees draft_post as a tool, writes within 300 graphemes, and the post waits in the approval inbox, keeping a person between a pipeline and a public account. Each draft is held in the approval inbox until a person says yes.

Prompt

Pipeline: retrieve this week's three most-starred issues from our GitHub repo, summarize the common theme, and call draft_post to write one Bluesky post asking the community for input on the theme. Network bluesky only.

How to do it

  1. Mint a Bluesky agent key In https://app.socialhandoff.com, open Connections, connect your Bluesky account, then create an agent key scoped to Bluesky with draft permission only. Copy the key when it is shown; only its hash is stored.
  2. Install the MCP adapter Add langchain-mcp-adapters and create a MultiServerMCPClient with a streamable_http connection to https://app.socialhandoff.com/mcp and a bearer header.
  3. Load tools into the agent Call get_tools() and pass them to your agent. Keep the key scoped to Bluesky and draft so the model only sees what it needs.
  4. Run the pipeline Feed the chain its source material, let it call draft_post for Bluesky, and read the returned post id. Or skip MCP and POST to /v1/posts from a plain tool.

Example draft

Three of this week's most upvoted issues ask for the same thing in different words: a way to run migrations without downtime. Before we design it, we want to hear how you handle this today. Reply or join the discussion: github.com/acme/orm/discussions/210

Gotchas

  • The 300 limit counts graphemes, so an emoji or accented letter counts as one. Anything longer should become a reply-chain thread, not a clipped post.
  • Bluesky refuses images over 1 MB and allows at most 4 per post. Resize screenshots before the agent attaches them, and add alt text to each.
  • Links, @handles, and #tags become clickable facets when the post publishes. Have the agent write the plain URL and handle, not markdown links.
  • The adapter loads every tool the key allows. Scope the key to Bluesky and draft permission so the model cannot reach analytics or scheduling tools you did not plan for.
Bluesky
  • Character limit: 300 graphemes per post. An emoji or an accented letter counts as 1 grapheme even if it uses several bytes.
  • Media per post: Up to 4 images, or 1 video. Images and video cannot be mixed in one post.
  • Image size: The AT Protocol image embed accepts blobs of about 1 MB each; the official app compresses larger photos. SocialHandoff checks for 1 MB per image.
  • Video: Up to 3 minutes and 100 MB, MP4. SocialHandoff does not publish video to Bluesky.
Bluesky scheduler for agent-drafted posts and threads

Frequently asked questions

Do I have to use MCP with LangChain?
No. You can wrap POST /v1/posts in a plain LangChain tool, or use the TypeScript SDK. MCP saves you writing tool schemas.
How does a LangChain pipeline attach images to a Bluesky post?
Upload each image to /v1/media with its alt text, then pass the returned ids as mediaIds. Keep each file under 1 MB and use at most 4.
Is there a character counter for Bluesky?
Yes. The free Bluesky character counter on this site counts graphemes the way Bluesky does, and the length guardrail applies the same rule to every draft.

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