Requirements
- Python 3.10 or newer.
- 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
The adapter launches the server and passes your key through the subprocess environment. Values written as${VAR} are expanded from the current environment, so the key never appears in source.
client.py
sendmux-mcp entry point and naming the surfaces:
Connect over private HTTP
Use this when your graph runs somewhere it cannot spawn a process. Start the server yourself:client.py
Build the agent
get_tools() returns LangChain tools you can hand to a prebuilt agent or bind to a model inside your own graph.
agent.py
Set
tool_name_prefix=True on MultiServerMCPClient when you connect Sendmux
alongside other MCP servers. It prefixes tool names with the server name and
prevents collisions.Give each user their own mailbox
Mailbox-scoped keys are the isolation boundary. Build a client per tenant rather than sharing one across the graph, so the agent 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
get_tools returns an empty list
get_tools returns an empty list
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_.Tool errors stop the graph
Tool errors stop the graph
Set
handle_tool_errors=True on MultiServerMCPClient to return errors as
tool messages the model can react to instead of raising.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
Use search and batch operations efficiently.
Python SDK
Call Sendmux directly when you want full endpoint coverage.