All docs

CrewAI Setup

Connect CrewAI multi-agent crews to graph8 via MCPServerAdapter

Wire a CrewAI crew into graph8’s MCP server. CrewAI’s MCPServerAdapter exposes graph8 tools to every agent in the crew, so a prospector agent and an enricher agent can both pull from the same toolset.

CrewAI

Prerequisites

  • Python 3.10+
  • crewai, crewai-tools
pip install crewai 'crewai-tools[mcp]'

Hosted MCP (remote OAuth)

import os

from crewai import Agent, Crew, Task
from crewai_tools import MCPServerAdapter


server_params = {
    "url": "https://be.graph8.com/mcp/",
    "transport": "streamable-http",
}

with MCPServerAdapter(server_params) as mcp_tools:
    prospector = Agent(
        role="SaaS Prospector",
        goal="Find VP Engineering at Series B SaaS companies",
        backstory="You preview prospects but never save without approval.",
        tools=mcp_tools,
        verbose=True,
    )

    enricher = Agent(
        role="Data Enricher",
        goal="Verify emails and enrich firmographics on saved prospects",
        backstory="You only act on lists the user has approved.",
        tools=mcp_tools,
        verbose=True,
    )

    find_task = Task(
        description=(
            "Use g8_find_contacts to preview 25 VP Engineering at Series B SaaS "
            "in the US. Return name, company, title, and signal score."
        ),
        agent=prospector,
        expected_output="A table of 25 prospects.",
    )

    enrich_task = Task(
        description=(
            "After the user approves the list, use g8_enrich_contacts to fill "
            "missing emails and phones."
        ),
        agent=enricher,
        expected_output="An enriched contact list with verified emails.",
        context=[find_task],
    )

    crew = Crew(agents=[prospector, enricher], tasks=[find_task, enrich_task])
    print(crew.kickoff())

The first run prompts for OAuth. Both agents share the same authenticated MCP session via the adapter.

Self-hosted MCP (stdio)

import os

from crewai_tools import MCPServerAdapter
from mcp import StdioServerParameters


server_params = StdioServerParameters(
    command="uvx",
    args=["g8-mcp-server"],
    env={
        "G8_API_KEY": os.environ["G8_API_KEY"],
        "G8_MCP_MODE": "gtm",
    },
)

with MCPServerAdapter(server_params) as mcp_tools:
    # ... same crew as above
    pass

Worked example: prospector + enricher + sequence loader

sequence_loader = Agent(
    role="Sequence Loader",
    goal="Enroll approved contacts into the right sequence",
    backstory="You always confirm with the user before calling g8_add_to_sequence.",
    tools=mcp_tools,
    verbose=True,
)

load_task = Task(
    description=(
        "Find the 'New SaaS Outreach' sequence via g8_list_sequences. "
        "Use g8_get_sequence_preview to show the steps. Ask the user to confirm "
        "before calling g8_add_to_sequence for every contact on the enriched list."
    ),
    agent=sequence_loader,
    expected_output="Confirmation that contacts are enrolled, with a summary.",
    context=[enrich_task],
)

graph8’s MCP server flags g8_build_contact_list, g8_enrich_contacts, and g8_add_to_sequence as credit-charging or outreach-sending. Your CrewAI tasks should always include an explicit confirmation step.

Build with graph8