Skip to content
unzoi docs
Search and navigation
Start here
REST API
MCP
Limits and plans
Agent clients
SDKs
Guides

LangChain

The MCP adapters, turning the Unzoi tools into LangChain tools.

Kind Framework
Transport langchain-mcp-adapters, streamable HTTP.
Config —

Setup

  1. pip install langchain-mcp-adapters langgraph
  2. Construct a MultiServerMCPClient pointing at the endpoint.
  3. Await get_tools() and hand them to an agent.
import os, asyncio
from langchain_mcp_adapters.client import MultiServerMCPClient
from langgraph.prebuilt import create_react_agent

async def main():
    client = MultiServerMCPClient({
        "unzoi": {
            "transport": "streamable_http",
            "url": "https://api.unzoi.com/mcp",
            "headers": {"x-api-key": os.environ["UNZOI_KEY"]},
        }
    })
    tools = await client.get_tools()
    agent = create_react_agent("anthropic:claude-sonnet-5", tools)
    result = await agent.ainvoke({
        "messages": [{"role": "user", "content": "What happened with port congestion this week?"}]
    })
    print(result["messages"][-1].content)

asyncio.run(main())

What differs here

  • get_tools() is one round trip and the result is static. Call it at startup, not per request.
  • The tools arrive with their MCP descriptions intact, which is most of why the model picks between them sensibly — do not overwrite them with shorter ones.
  • A ReAct agent will happily loop. Cap its steps and pass max_credits, or it will spend a month of credits exploring.

Next

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