Load APIStack tools into a LangChain or LangGraph agent

langchain-mcp-adapters turns MCP tools into LangChain tools. Connect it to APIStack and pass the tools to create_agent or bind them in your own LangGraph graph.

Prefer video? · 1:34

Give your AI agent 100+ tools with one MCP URL

Connect APIStack to Claude Code, Cursor, VS Code or your own agent, with a real agent run.

Set it up

pip install langchain langchain-openai langchain-mcp-adapters

Create a free APIStack account and set your key as APISTACK_API_KEY.

import asyncio, os
from langchain.agents import create_agent
from langchain_mcp_adapters.client import MultiServerMCPClient


async def main():
    client = MultiServerMCPClient({
        "apistack": {
            "transport": "streamable_http",
            "url": "https://apistack.online/api/mcp/connect",
            "headers": {"x-api-key": os.environ["APISTACK_API_KEY"]},
        }
    })
    tools = await client.get_tools()
    agent = create_agent("openai:gpt-5-mini", tools)
    result = await agent.ainvoke({"messages": [{"role": "user", "content": "Is +44 20 7946 0958 a valid phone number? What type of line is it?"}]})
    print(result["messages"][-1].content)


asyncio.run(main())

Output from a real run (langchain 1.4, langchain-mcp-adapters 0.3, gpt-5-mini):

Yes.
- Validity: The number +44 20 7946 0958 is valid (E.164: +442079460958).
- Country/area: United Kingdom — London (area code 020).
- Line type: FIXED_LINE (landline).

Any model

The tools are model-agnostic. Swap "openai:gpt-5-mini" for any chat model LangChain supports that can call tools.

Specific tools only

Add ?apis=phone-number-validation,email-address-validator to the URL to load one tool per API instead of the search/call trio.

Related guides