How to do it
- Mint a key for the crew In https://app.socialhandoff.com, open Connections, add an agent for the crew, and grant draft on the target networks.
- Install CrewAI tools with MCP support Run pip install crewai 'crewai-tools[mcp]'.
- Describe the server Build server_params with the /mcp URL, transport streamable-http, and an Authorization header read from an environment variable.
- Open the adapter Use MCPServerAdapter as a context manager so the connection closes when the crew finishes. Give the tools only to the agent that writes.
- Kick off the crew Run crew.kickoff() and review the drafts in the SocialHandoff inbox.
import os
from crewai import Agent, Crew, Task
from crewai_tools import MCPServerAdapter
server_params = {
"url": "https://app.socialhandoff.com/mcp",
"transport": "streamable-http",
"headers": {"Authorization": "Bearer " + os.environ["SOCIAL_AGENT_KEY"]},
}
with MCPServerAdapter(server_params, connect_timeout=60) as tools:
writer = Agent(
role="Social writer",
goal="Draft on-brand posts and leave them for human approval",
backstory="You follow the brand memory exactly and never schedule.",
tools=tools,
)
task = Task(
description="Draft an X post and a Mastodon post about this week's release notes.",
expected_output="The ids of the pending drafts",
agent=writer,
)
Crew(agents=[writer], tasks=[task]).kickoff() A crew shape that suits approval
CrewAI is built around roles. A useful content crew splits the work:
- A researcher with no SocialHandoff tools reads your changelog, docs, or a URL and writes a brief.
- A writer with the SocialHandoff tools turns the brief into drafts, one per network, after reading brand memory.
- An optional editor with only
preview_postsandlist_postschecks the drafts and reports problems.
Only the writer needs draft_post. Giving tools to the agents that need them keeps a confused researcher from creating drafts, and it keeps prompts shorter.
Filtering tools
The adapter returns every tool the server lists. You can pick by name, for example tools["draft_post"], or pass only the ones you want to each agent. The server exposes planning, drafting, scheduling, preview, list, insights, and brand memory tools; an agent key gets 403 on approval and on update_brand_memory.
Example tasks
- "Turn the release brief into a 3-part X thread and a single LinkedIn post. Keep each part under the network limit."
- "Draft 5 Bluesky posts, one per tutorial in the brief, each with a link and alt text for any image."
- "List pending posts for Mastodon and write a short report of which ones duplicate each other."
Running on a schedule
Crews often run from cron or a queue. Each run should use the same agent key so the audit log groups its drafts, and a per-account daily limit guardrail keeps a misfiring schedule from flooding the inbox. If the kill switch is on, scheduling calls return 423 and the crew should stop.
Troubleshooting
- Adapter hangs on connect: raise
connect_timeoutand check the URL ends in/mcp. - SSE errors: set
"transport": "streamable-http"explicitly; otherwise the adapter may assume a different transport. - 401: the environment variable was empty when the adapter opened.
- Tools missing: upgrade
crewai-tools; MCP support needs themcpextra.
Guides by network: CrewAI for X, CrewAI for LinkedIn, CrewAI for Bluesky, CrewAI for Mastodon, and CrewAI for Threads.