# apifare for LangChain One prepaid, capped key for every API your agent needs, under hard caps and a kill switch. 1. Get a token: https://apifare.com/start?origin=page:integrations-langchain (shown once). 2. LangChain connects to MCP servers with MCPAdapter (beta, LangChain 1.4 or later) over a FastMCP Client. Pass your token as auth without the word "Bearer": FastMCP adds it. ``` pip install "langchain[mcp]" ``` ``` import asyncio, os from fastmcp.client import Client from langchain.agents import create_agent from langchain.mcp import MCPAdapter async def main(): client = Client("https://apifare.com/mcp", auth=os.environ["APIPAY_TOKEN"]) async with MCPAdapter(client) as adapter: tools = await adapter.list_tools() agent = create_agent("claude-sonnet-5", tools) result = await agent.ainvoke( {"messages": [{"role": "user", "content": "What's the weather in London?"}]} ) print(result["messages"][-1].content) asyncio.run(main()) ``` Set APIPAY_TOKEN and your model provider's key, then run it. On an older LangChain, MultiServerMCPClient from langchain-mcp-adapters takes the same URL with "transport": "http" and a headers entry. 3. Try it: "search the web for X", then "fetch a URL", then "what's the weather in London". 4. Caps and the kill switch are checked before dispatch. An empty balance returns HTTP 402 with a top-up link (see /errors.md). Prices: https://apifare.com/capabilities. Config checked against https://docs.langchain.com/oss/python/langchain/mcp on 2026-09-13.