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

# CrewAI

> Connect StackOne MCP to CrewAI with built-in MCP server support.

## Overview

CrewAI includes native MCP integration via the `mcps` parameter on agents, enabling direct connection to StackOne's MCP server using either simple URL strings or structured configuration objects.

[Official Docs](https://docs.crewai.com/en/mcp/overview)

## Installation

```bash theme={null}
pip install crewai
```

Or with uv:

```bash theme={null}
uv add crewai
```

## Quick Start

Connect to StackOne MCP using structured configuration:

```python theme={null}
import os
import base64
from crewai import Agent, Crew, Task
from crewai.mcp import MCPServerHTTP

# 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()

# Create agent with StackOne MCP server
data_agent = Agent(
    role="Platform Data Analyst",
    goal="Analyze data from connected platforms and provide insights",
    backstory="Expert in cross-platform data integration and analysis",
    mcps=[
        MCPServerHTTP(
            url="https://api.stackone.com/mcp",
            headers={
                "Authorization": f"Basic {auth_token}",
                "x-account-id": STACKONE_ACCOUNT_ID
            }
        )
    ]
)

# Create task
analysis_task = Task(
    description="Search recent calls in Gong and summarize key insights",
    agent=data_agent,
    expected_output="A summary of recent call activities and insights"
)

# Create and run crew
crew = Crew(
    agents=[data_agent],
    tasks=[analysis_task]
)

result = crew.kickoff()
print(result)
```

## Environment Variables

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

## Configuration Options

When using `MCPServerHTTP`, you can configure:

* `url`: The MCP server endpoint
* `headers`: Custom headers for authentication
* `tool_filter`: Optional filter to restrict which tools are available
* `cache_tools_list`: Whether to cache the tool list (default: True)

## Next Steps

<CardGroup cols={2}>
  <Card title="CrewAI MCP Docs" icon="book" href="https://docs.crewai.com/en/mcp/overview">
    Official CrewAI MCP documentation
  </Card>

  <Card title="StackOne API" icon="grid" href="/platform/introduction">
    Learn about StackOne's Platform API
  </Card>
</CardGroup>
