Skip to main content

Overview

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

Installation

pip install crewai
Or with uv:
uv add crewai

Quick Start

Connect to StackOne MCP using structured configuration:
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

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