Connect AI agent frameworks to the OmniSocials MCP server
Agents you build in code can use the hosted OmniSocials MCP server, the same server that claude.ai and ChatGPT connect to. The agent gets tools like list_accounts, create_post, upload_media, get_best_times, and the inbox and analytics tools. See MCP server for the full list.
This page has a minimal working sample for each framework:
- OpenAI Agents SDK (Python)
- Vercel AI SDK (TypeScript)
- LangChain and LangGraph (Python)
- Mastra (TypeScript)
- CrewAI (Python)
Connection details
| Setting | Value |
|---|---|
| URL | https://mcp.omnisocials.com |
| Transport | Streamable HTTP. There is no SSE endpoint. |
| Authentication | Authorization: Bearer omsk_live_<YOUR_KEY> |
Use the URL as it is. Do not add /mcp or /sse to it.
How the key works. The server reads any bearer token that starts with omsk_ as an OmniSocials API key. That makes the Authorization header the right choice for server-side code. The ?API_KEY= query form on the MCP server page also works, but a header keeps the key out of URLs and request logs. OAuth is meant for apps where a person signs in, see OAuth for your users.
Protocol version. The server uses the MCP initialize handshake. Clients built for the newer 2026-07-28 revision, such as current FastMCP, Mastra, and the AI SDK, probe for it first and fall back to the handshake on their own. Leave their protocol setting on its default. A client pinned to 2026-07-28 only will not connect.
Before you start
- Create an API key in Settings → API. For an agent that drafts and schedules posts, give it
posts:write,media:write, andaccounts:read. Addanalytics:readif it should read results. See Authentication. - Store the key in an environment variable or your secrets manager. Never commit it.
Terminal
The samples below read OMNISOCIALS_API_KEY and also need your model provider's key, as each framework documents.
OpenAI Agents SDK (Python)
The Agents SDK connects to remote servers with MCPServerStreamableHttp.
Terminal
Python
client_session_timeout_seconds defaults to 5 seconds. Raise it as above, because uploading media from a URL can take longer.
Vercel AI SDK (TypeScript)
The AI SDK's MCP client is createMCPClient from @ai-sdk/mcp.
Terminal
TypeScript
generateText runs one step by default. stopWhen: isStepCount(5) lets the model call a tool, read the result, and continue. With streamText, close the client in onEnd instead.
LangChain and LangGraph (Python)
LangChain 1.4 ships MCP support in langchain.mcp (beta). It replaces the standalone langchain-mcp-adapters package, which is no longer actively maintained. Both work with OmniSocials. Use the first tab for new projects.
In langchain.mcp, the key goes on the FastMCP Client as auth. A plain string there is sent as a bearer token. create_agent returns a LangGraph graph. In a graph you build yourself, give the same tools list to your tool node.
Mastra (TypeScript)
Mastra connects with MCPClient from @mastra/mcp. Version 2 of @mastra/mcp needs @mastra/core 1.76 or a later 1.x release.
Terminal
TypeScript
listTools() prefixes every tool with the server key, so the agent sees omnisocials_list_accounts and omnisocials_create_post.
If each of your users has their own OmniSocials key, build an MCPClient per request and pass await client.listToolsets() as toolsets to generate() instead of setting tools on the agent. Call disconnect() on that client when the request is done.
CrewAI (Python)
CrewAI agents take MCP servers in their mcps field. MCPServerHTTP from crewai.mcp speaks Streamable HTTP.
Terminal
Python
Keep agents in bounds
An agent with posts:write can publish to your real accounts. There is no test mode.
- Give each agent its own key with only the scopes it needs. A missing scope makes the tool return
403. - Ask the agent to create drafts, which a person reviews and schedules in the dashboard. Or have it pass an
approval_workflow_idtocreate_post, so the post waits for an approver.list_approval_workflowslists the workflows. - Gate the tools that publish or delete, such as
publish_post,create_and_publish_post, anddelete_post. The frameworks have hooks for this:tool_filterandrequire_approvalin the OpenAI Agents SDK,toolApprovalin the AI SDK,requireToolApprovalin Mastra, and@wrap_tool_callmiddleware in LangChain.
OAuth for your users
If people sign in to your app with their own OmniSocials account, use OAuth instead of a shared key. The server supports OAuth with dynamic client registration, and the user picks which workspaces your app may use. Each framework has its own OAuth hook: auth="oauth" on the FastMCP Client, authProvider on the AI SDK transport, and authProvider with MCPOAuthClientProvider in Mastra. Follow the framework's OAuth guide with https://mcp.omnisocials.com as the server URL.
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
401 on connect | The key is wrong or revoked, or the header lacks Bearer . | Check the Authorization header value. |
402 on connect | The organisation has no active plan. | Check billing in Settings → Organisation. |
404 with "Session expired" | The server dropped the session, for example after a restart. | Reconnect. Most clients send a new initialize on their own. |
A tool call returns 403 | The key misses that tool's scope. | Create a new key with the scope. Scopes cannot be edited. |
| The client cannot connect at all | It uses the old SSE transport, or /mcp or /sse was added to the URL. | Use the Streamable HTTP class shown above and the bare URL. |