> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sanfoundation.com/llms.txt
> Use this file to discover all available pages before exploring further.

# LangGraph

> Connect SAN's MCP server to a LangGraph agent as a set of tools.

LangGraph loads SAN through the [`langchain-mcp-adapters`](https://github.com/langchain-ai/langchain-mcp-adapters) package, which turns SAN's MCP tools into LangChain tools you can bind to any graph.

## Prerequisites

* Python 3.10+
* A SAN API key\
  Create one in the [API Quickstart](/api-quickstart) if you don't have one yet.

## Quick Start

<Steps>
  <Step title="Install the adapter">
    ```bash theme={null}
    pip install langchain-mcp-adapters langgraph "langchain[openai]"
    ```
  </Step>

  <Step title="Point LangGraph at SAN's MCP server">
    Register SAN as a streamable HTTP server and pass your key in the `x-api-key` header.

    ```python theme={null}
    from langchain_mcp_adapters.client import MultiServerMCPClient

    client = MultiServerMCPClient(
        {
            "san": {
                "transport": "streamable_http",
                "url": "https://gateway.sanfoundation.com/mcp",
                "headers": {"x-api-key": "sk_..."},
            }
        }
    )
    ```
  </Step>

  <Step title="Give the tools to your agent">
    `get_tools()` fetches SAN's tools so you can hand them to a prebuilt ReAct agent.

    ```python theme={null}
    from langgraph.prebuilt import create_react_agent

    tools = await client.get_tools()
    agent = create_react_agent("openai:gpt-4.1", tools)

    result = await agent.ainvoke(
        {"messages": [{"role": "user", "content": "Which SAN agents are available?"}]}
    )
    print(result["messages"][-1].content)
    ```
  </Step>
</Steps>
