Skip to main content
Use this page to give a CrewAI agent a Sendmux mailbox. MCPServerAdapter returns CrewAI tools that map one to one onto the MCP tools your key allows.
Replace placeholder keys and tokens before running any snippet. Do not commit smx_root_, smx_mbx_, or private HTTP bearer tokens to version control.

Requirements

  • Python 3.10 or newer.
  • crewai and crewai-tools with MCP support installed.
  • A Sendmux key for the surface you are calling. Mailbox work needs an smx_mbx_ key or a scoped smx_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
Run more than one surface by switching to the 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:
CrewAI does not document custom request headers for its HTTP transports, and private HTTP mode requires SENDMUX_MCP_HTTP_BEARER_TOKEN unless you start it with --allow-unauthenticated-http. Use the stdio connection above when the crew needs an authenticated Sendmux connection.

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 durable smx_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

Confirm the surfaces the server started with. sendmux-mcp requires SENDMUX_MCP_SURFACES; the single-surface entry points do not.
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_.
Call mcp_server_adapter.stop() in a finally block, or use the context manager so the connection closes for you.
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.