Skip to content
unzoi docs

Claude Agent SDK

Give an agent you are building the news index, in TypeScript or Python.

Kind Framework
Transport Declared in the SDK options; the SDK owns the connection.
Config

Setup

  1. Install the SDK for your language.
  2. Declare the server in the options you pass to the query/agent call.
  3. Let the model choose the tools, or restrict it with an allow-list if you want a narrower agent.
import { query } from "@anthropic-ai/claude-agent-sdk";

const result = query({
  prompt: "What happened with semiconductor export controls this week? Cite outlets.",
  options: {
    mcpServers: {
      unzoi: {
        type: "http",
        url: "https://api.unzoi.com/mcp",
        headers: { "x-api-key": process.env.UNZOI_KEY! },
      },
    },
    // Optional: a research agent rarely needs to check its own billing.
    allowedTools: [
      "mcp__unzoi__search_news",
      "mcp__unzoi__list_stories",
      "mcp__unzoi__get_article",
      "mcp__unzoi__find_related",
    ],
  },
});

for await (const message of result) console.log(message);

Python

          import os, anyio
from claude_agent_sdk import query, ClaudeAgentOptions

async def main():
    options = ClaudeAgentOptions(
        mcp_servers={
            "unzoi": {
                "type": "http",
                "url": "https://api.unzoi.com/mcp",
                "headers": {"x-api-key": os.environ["UNZOI_KEY"]},
            }
        },
    )
    async for message in query(
        prompt="Summarise this week's coverage of port congestion, by region.",
        options=options,
    ):
        print(message)

anyio.run(main)
        

What differs here

  • Tool names are namespaced by the SDK as mcp__<server>__<tool>, which is what an allow-list has to match — the bare tool name will not.
  • An allow-list is worth setting. account_status and top_headlines are rarely what a research agent needs, and every tool you leave in is a tool the model can spend quota on.
  • The server instructions string is surfaced to the model automatically, so it already knows what this corpus is without you restating it in the prompt.

Next

Endpoint, for copying: https://api.unzoi.com/mcp