Agent SDKs and frameworks
Connect Thirdfy MCP from the Claude Agent SDK, OpenAI Agents SDK, Vercel AI SDK and LangChain with an agent key header.
Build your own agent on Thirdfy. Each SDK below connects to https://mcp.thirdfy.com/mcp over streamable HTTP and sends your agent key in the Authorization header.
| Framework | Language |
|---|---|
| Claude Agent SDK | TypeScript, Python |
| OpenAI Agents SDK | Python |
| Vercel AI SDK | TypeScript |
| LangChain | Python |
Before you start
Open thirdfy.com/connect, go to Agent key, pick the agent and click Create a key. The key (agent-...) is shown once, so store it right away. Then export it:
Every snippet reads the key from AGENT_API_KEY and sends it as a connection header. Never put the key in a prompt or a tool argument. If the model passes a different key in arguments, Thirdfy answers AGENT_IDENTITY_MISMATCH and uses the header key. Without a key, /mcp answers 401.
Keep writes under control
Your code decides which tools the model can call. In every framework:
- Load only the tools the task needs. A research agent needs
getProviderActions,getVenueReadinessandagentRun. AddpreviewOrderandwalletExecuteonly for an agent that trades. - Ask a person before a write. Each section shows how to pause on
walletExecuteuntil someone approves it. - Set limits in Thirdfy. The agent's action allowlist and daily limit apply to every call, whatever the model asks for. See Delegation & protection.
Thirdfy refuses any write that fails its checks (allowlist, daily limit, venue readiness, credits).
Claude Agent SDK
Pass Thirdfy in mcpServers with type: "http". Tool names take the form mcp__thirdfy__<tool>. Tools in allowedTools run without asking. Any other tool goes to your canUseTool callback, so leave walletExecute out of allowedTools and approve it there. See Anthropic's Agent SDK MCP docs.
Install with npm install @anthropic-ai/claude-agent-sdk or pip install claude-agent-sdk. The SDK doesn't run a browser sign-in, so use the agent key header. If the server shows needs-auth in the system init message, the header is missing.
OpenAI Agents SDK
Open Thirdfy with MCPServerStreamableHttp and give it to the agent in mcp_servers. tool_filter limits the tools the model sees. require_approval pauses the run on the tools you name. See OpenAI's Agents SDK MCP docs.
Install with pip install openai-agents. When you add walletExecute to allowed_tool_names, a call to it stops the run and shows up in result.interruptions. Approve it with state = result.to_state(), state.approve(...), then Runner.run(agent, state). See Human-in-the-loop.
Vercel AI SDK
Create a client with createMCPClient from @ai-sdk/mcp and an http transport. mcpClient.tools() returns every Thirdfy tool, so pick the ones you need before you pass them to the model. See the AI SDK's MCP tools docs.
Install with npm install ai @ai-sdk/mcp @ai-sdk/anthropic, or use any other AI SDK provider. For an agent that trades, add walletExecute to tools and set toolApproval: { walletExecute: "user-approval" }. The call then comes back as an approval request instead of running. See Tool approvals.
LangChain
LangChain 1.4 and later ships MCP support in langchain.mcp, which replaces the langchain-mcp-adapters package. Pass a fastmcp client with your key as auth, and MCPAdapter turns Thirdfy's tools into LangChain tools for create_agent. See LangChain's MCP docs.
Install with pip install "langchain[mcp]" langchain-anthropic. A string auth is sent as Authorization: Bearer <key>. create_agent builds a LangGraph agent. For writes, pass middleware=[HumanInTheLoopMiddleware(interrupt_on={"walletExecute": True})] and a checkpointer. The run pauses on walletExecute until you resume it with an approve decision. See Human-in-the-loop. Still on langchain-mcp-adapters? Follow LangChain's migration guide.
Try it
Use these as the prompt in any of the snippets above:
For the venue check, give the agent getVenueReadiness. It takes { "venue": "hyperliquid", "agentKey": "0x…" }.
Troubleshooting
| Issue | Fix |
|---|---|
401 Authentication required | AGENT_API_KEY is not set, or the header is missing. Check Authorization: Bearer agent-... |
| Tool not found | Match names exactly to GET https://mcp.thirdfy.com/tools, and include them in your tool list or filter |
| Model calls a tool you didn't expect | Narrow the tool list, and the key's action allowlist in Thirdfy |
Run stops on walletExecute | That is the approval step. Approve or reject it, then resume |
AGENT_IDENTITY_MISMATCH | The model passed a different key in arguments. The header key is used |