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

# LangGraph

> Connect StackOne MCP to LangGraph for building stateful multi-agent workflows.

## Overview

LangGraph provides both client and server MCP support through `langchain-mcp-adapters`, enabling integration with StackOne's MCP server.

[Official Docs](https://langchain-ai.github.io/langgraph/agents/mcp/)

## Installation

```bash theme={null}
uv add langgraph langchain-mcp-adapters langchain-openai
```

## Quick Start

Connect to StackOne MCP and use tools in LangGraph:

```python theme={null}
import os
import asyncio
import base64
from langgraph.prebuilt import create_react_agent
from langchain_mcp_adapters.client import MultiServerMCPClient
from langchain_openai import ChatOpenAI

# Configure StackOne account
STACKONE_ACCOUNT_ID = "<account_id>"  # Your StackOne account ID

# Encode API key for Basic auth
auth_token = base64.b64encode(
    f"{os.getenv('STACKONE_API_KEY')}:".encode()
).decode()

async def main():
    # Connect to StackOne MCP server
    mcp_client = MultiServerMCPClient({
        "stackone": {
            "url": "https://api.stackone.com/mcp",
            "transport": "streamable_http",
            "headers": {
                "Authorization": f"Basic {auth_token}",
                "x-account-id": STACKONE_ACCOUNT_ID,
                "Content-Type": "application/json",
                "Accept": "application/json,text/event-stream",  # Required by MCP spec
                "MCP-Protocol-Version": "2025-06-18"
            }
        }
    })

    # Get StackOne tools
    tools = await mcp_client.get_tools()

    # Create LangGraph agent with StackOne tools
    agent = create_react_agent(
    ChatOpenAI(model="gpt-5"),
        tools=tools,
        state_modifier="You are a helpful assistant with access to data from connected platforms."
    )

    # Run agent
    for chunk in agent.stream({"messages": [("human", "Search recent calls in Gong")]}):
        print(chunk)

asyncio.run(main())
```

## Environment Variables

```bash theme={null}
STACKONE_API_KEY=<stackone_api_key>
OPENAI_API_KEY=your_openai_key
```

## Resources

* [LangGraph MCP Documentation](https://langchain-ai.github.io/langgraph/agents/mcp/)
* [LangGraph Concepts](https://langchain-ai.github.io/langgraph/concepts/mcp/)
* [LangChain MCP Adapters](https://changelog.langchain.com/announcements/mcp-adapters-for-langchain-and-langgraph)
* [StackOne Authentication](/mcp/auth-security)

## Next Steps

<CardGroup cols={2}>
  <Card title="LangChain" icon="link" href="/mcp/framework-guides/langchain">
    Use MCP with LangChain agents
  </Card>

  <Card title="CrewAI" icon="users" href="/mcp/framework-guides/crewai">
    Build multi-agent systems with CrewAI
  </Card>
</CardGroup>
