MCPServerAdapter returns CrewAI tools that map one to one onto the MCP tools your key allows.
Requirements
- Python 3.10 or newer.
crewaiandcrewai-toolswith MCP support installed.- A Sendmux key for the surface you are calling. Mailbox work needs an
smx_mbx_key or a scopedsmx_agent_token.
Install
Connect over local stdio
Stdio is the recommended connection for CrewAI, because the adapter passes your key through the subprocess environment.crew.py
sendmux-mcp entry point:
Limit which tools the crew gets
Pass tool names to the adapter when an agent should only reach part of a surface. A triage agent that never sends is safer than one that could.Open your MCP tool listing after connecting to confirm the exact names your
key exposes. Tool names are generated from the current public API surfaces.
Manage the connection yourself
Use manual management when the crew outlives a single block. Always stop the adapter.Remote servers
MCPServerAdapter also accepts a streamable HTTP server:
Give each user their own mailbox
Mailbox-scoped keys are the isolation boundary. Build the server parameters per tenant so the crew working one tenant structurally cannot read another tenant’s mail.Sending stays gated
A durablesmx_agent_ token includes mailbox.read and email.receive, not email.send. After a named human owner accepts the invite and approves sending, exchange the durable token for a one-hour Sending-resource token and pass that as SENDMUX_SENDING_API_KEY.
Troubleshooting
The adapter returns no tools
The adapter returns no tools
Confirm the surfaces the server started with.
sendmux-mcp requires
SENDMUX_MCP_SURFACES; the single-surface entry points do not.The subprocess exits immediately
The subprocess exits immediately
Check the key prefix. Mailbox accepts
smx_mbx_ or a scoped smx_agent_,
Sending accepts a send-capable smx_mbx_ or an owner-approved
Sending-resource smx_agent_, and Management requires smx_root_.The process hangs after kickoff
The process hangs after kickoff
Call
mcp_server_adapter.stop() in a finally block, or use the context
manager so the connection closes for you.You granted more than one mailbox
You granted more than one mailbox
Start the workflow with
mailbox_list_granted_mailboxes and pass the
returned mailbox_id to tools that act on one mailbox.Next steps
Agent frameworks
Compare connections across frameworks.
MCP
Review environment variables and tool discovery.
Mailbox API guides
Understand mailbox operations and usage limits.
Python SDK
Call Sendmux directly when you want full endpoint coverage.