> ## 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.

# LlamaIndex Workflows

> Use SAN's MCP tools inside a LlamaIndex Workflows FunctionAgent.

LlamaIndex connects to SAN with `BasicMCPClient` from `llama-index-tools-mcp`. Its tools drop straight into a Workflows-based `FunctionAgent`.

## 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 MCP tools">
    ```bash theme={null}
    pip install llama-index-tools-mcp
    ```
  </Step>

  <Step title="Connect SAN's MCP server">
    An `https://…/mcp` URL uses streamable HTTP automatically. Pass your key in `headers`.

    ```python theme={null}
    from llama_index.tools.mcp import BasicMCPClient, McpToolSpec

    mcp_client = BasicMCPClient(
        "https://gateway.sanfoundation.com/mcp",
        headers={"x-api-key": "sk_..."},
    )

    tools = await McpToolSpec(client=mcp_client).to_tool_list_async()
    ```
  </Step>

  <Step title="Give the tools to a FunctionAgent">
    ```python theme={null}
    import asyncio
    from llama_index.core.agent.workflow import FunctionAgent
    from llama_index.llms.openai import OpenAI
    from llama_index.tools.mcp import BasicMCPClient, McpToolSpec

    async def main() -> None:
        mcp_client = BasicMCPClient(
            "https://gateway.sanfoundation.com/mcp",
            headers={"x-api-key": "sk_..."},
        )
        tools = await McpToolSpec(client=mcp_client).to_tool_list_async()

        agent = FunctionAgent(
            tools=tools,
            llm=OpenAI(model="gpt-4o"),
            system_prompt="Use the SAN tools to answer the question.",
        )
        print(await agent.run("Which SAN agents are available?"))

    asyncio.run(main())
    ```
  </Step>
</Steps>
