Sandbox
@Sendmux/sendmux-sdk

Sendmux email SDKs, CLI, and MCP servers

This repository packages Sendmux’s email APIs for several languages, plus a `sendmux` command-line client and MCP servers for agent tools. The clients and tools are generated from the same OpenAPI definitions, so the SDKs, CLI, and MCP surface stay aligned.

73 stars0 forksPHPUpdated 7d ago
Who it's for

Builders who want to connect their agent or app to Sendmux mail, inbox, and management APIs.

What it delivers

You can send email, watch inbox activity, and manage Sendmux access from your agent or app without hand-building each integration.

What it does

Language SDKs

Provides generated clients and helper packages for TypeScript, Python, Go, PHP, Rust, and Ruby.

Sendmux CLI

Includes the `sendmux` command for login, registration, sending, mailbox checks, and event streaming.

MCP servers

Ships local and hosted MCP access for mailbox, sending, and management operations.

Attachment workflows

Supports file uploads, `--attach`, presigned uploads, and SDK file helpers for outbound mail.

Connection checks

Includes commands and client calls for verifying mailbox, sending, and management connections.

Release and verification tooling

Contains scripts for code generation, coverage checks, live E2E tests, and package publishing.

How to get it

  1. 1Install only the package for the surface you need.
    npm install @sendmux/sending
    pip install sendmux-sending
    go get sendmux.ai/go@v1.5.0
    cargo add sendmux
    composer require sendmux/sending:^2.0
    gem install sendmux-sending

README

Sendmux SDKs

npm version PyPI version Go Reference crates.io version CI npm downloads Licence: MIT

Official SDK, CLI, and MCP workspace for Sendmux.

Packages

EcosystemPackageSurfaceAPI-key / hosted authInstallSource
npm@sendmux/coreShared TypeScript helpersn/anpm install @sendmux/corepackages/ts/core
npm@sendmux/sendingSending APIsmx_mbx_* or owner-approved smx_agent_*npm install @sendmux/sendingpackages/ts/sending
npm@sendmux/mailboxMailbox APIsmx_mbx_* or smx_agent_*npm install @sendmux/mailboxpackages/ts/mailbox
npm@sendmux/managementManagement APIsmx_root_*npm install @sendmux/managementpackages/ts/management
npm@sendmux/sdkTypeScript umbrella packagesurface-specificnpm install @sendmux/sdkpackages/ts/sdk
npm@sendmux/clisendmux CLIcommand/profile-specificnpm install -g @sendmux/clipackages/ts/cli
npm@sendmux/ai-sdkVercel AI SDK tools (agent inbox + sending)send + receive smx_mbx_* or smx_agent_*npm install @sendmux/ai-sdkpackages/ts/ai-sdk
Homebrewsendmuxsendmux CLIcommand/profile-specificbrew install sendmux/tap/sendmuxSendmux/homebrew-tap
PyPIsendmux-coreShared Python helpersn/apip install sendmux-corepackages/python/core
PyPIsendmux-sendingSending APIsmx_mbx_* or owner-approved smx_agent_*pip install sendmux-sendingpackages/python/sending
PyPIsendmux-mailboxMailbox APIsmx_mbx_* or smx_agent_*pip install sendmux-mailboxpackages/python/mailbox
PyPIsendmux-managementManagement APIsmx_root_*pip install sendmux-managementpackages/python/management
PyPIsendmux-sdkPython umbrella packagesurface-specificpip install sendmux-sdkpackages/python/sdk
PyPIsendmux-mcpLocal MCP plus hosted MCP and A2A serversOAuth for hosted; surface-specific keys for localpip install sendmux-mcppackages/python/mcp
PyPIlangchain-sendmuxLangChain toolkit (agent inbox + sending)REST OAuth or send + receive smx_mbx_* / smx_agent_*pip install langchain-sendmuxpackages/python/langchain
Gosendmux.ai/go/coreShared Go helpersn/ago get sendmux.ai/go@v1.5.0go/core
Gosendmux.ai/go/sendingSending APIsmx_mbx_* or owner-approved smx_agent_*go get sendmux.ai/go@v1.5.0go/sending
Gosendmux.ai/go/mailboxMailbox APIsmx_mbx_* or smx_agent_*go get sendmux.ai/go@v1.5.0go/mailbox
Gosendmux.ai/go/managementManagement APIsmx_root_*go get sendmux.ai/go@v1.5.0go/management
Gosendmux.ai/go/sdkGo umbrella packagesurface-specificgo get sendmux.ai/go@v1.5.0go/sdk
crates.iosendmuxRust umbrella cratesurface-specificcargo add sendmuxrust
Packagistsendmux/coreShared PHP helpersn/acomposer require sendmux/core:^2.0packages/php/core
Packagistsendmux/sendingSending APIsmx_mbx_* or owner-approved smx_agent_*composer require sendmux/sending:^2.0packages/php/sending
Packagistsendmux/mailboxMailbox APIsmx_mbx_* or smx_agent_*composer require sendmux/mailbox:^2.0packages/php/mailbox
Packagistsendmux/managementManagement APIsmx_root_*composer require sendmux/management:^2.0packages/php/management
Packagistsendmux/sdkPHP umbrella packagesurface-specificcomposer require sendmux/sdk:^2.0packages/php/sdk
RubyGemssendmux-coreShared Ruby helpersn/agem install sendmux-corepackages/ruby/core
RubyGemssendmux-sendingSending APIsmx_mbx_* or owner-approved smx_agent_*gem install sendmux-sendingpackages/ruby/sending
RubyGemssendmux-mailboxMailbox APIsmx_mbx_* or smx_agent_*gem install sendmux-mailboxpackages/ruby/mailbox
RubyGemssendmux-managementManagement APIsmx_root_*gem install sendmux-managementpackages/ruby/management
RubyGemssendmux-sdkRuby umbrella packagesurface-specificgem install sendmux-sdkpackages/ruby/sdk

Quick start

Install only the package for the surface you need.

npm install @sendmux/sending
pip install sendmux-sending
go get sendmux.ai/go@v1.5.0
cargo add sendmux
composer require sendmux/sending:^2.0
gem install sendmux-sending

Use send-capable smx_mbx_* keys or owner-approved Sending-resource smx_agent_* tokens for Sending clients. Use smx_mbx_* keys or scoped smx_agent_* tokens for Mailbox clients. Use root smx_root_* keys for Management clients. Agent tokens remain limited by server-side scopes; pre-claim self-registered agent tokens do not include email.send.

OAuth authentication

TypeScript, Python, Go, PHP, Ruby, and Rust surface clients accept a bare REST OAuth access token or a provider that resolves one before each request. Use the explicit token API below; API-key configuration continues to validate key prefixes.

ClientAccess-token configuration
TypeScriptaccessToken: token or accessToken: () => token; async providers are supported.
Vercel AI SDKsendmux({ accessToken: token }) or an async token provider; grant mailbox.read and email.send for one mailbox.
Pythonaccess_token=token or a callable.
LangChainSendmuxToolkit(access_token=token) or a callable; grant mailbox.read and email.send for one mailbox.
GoNewWithAccessToken(token) or NewWithTokenProvider(provider); providers receive the request context.
PHPClientFactory::createMetaApiWithAccessToken($token) or a callable; each API factory has a WithAccessToken variant.
Rubyaccess_token: token or a callable.
Rustnew_with_access_token(token) or new_with_token_provider(provider); providers return a future.

Choose one credential source. Your application owns secure storage and refresh coordination. Request resource=https://sendmux.ai/api; each API still checks its required scopes and granted surface. The CLI manages browser login and token refresh with sendmux auth:login; use sendmux auth:logout to revoke its connection.

OAuth setup and lifecycle.

Command-line access

For command-line access, install the CLI:

brew install sendmux/tap/sendmux
npm install -g @sendmux/cli
sendmux agent:register my-agent --mailbox-local-part my-agent --default --json

Agent registration does not require an existing account or API key. It creates a local profile with a durable, revocable credential for reading and receiving mail. To send, invite the owner with sendmux agent:invite-owner owner@example.com --profile my-agent; after the owner accepts and approves sending, Sending API commands exchange and cache a one-hour delegated token automatically.

For MCP clients, install sendmux-mcp or connect to the hosted MCP endpoint:

pip install sendmux-mcp
sendmux-mcp-mailbox --help

The hosted MCP endpoint is https://mcp.sendmux.ai/mcp. Local MCP commands support stdio and HTTP transports; hosted MCP uses OAuth and does not require manual API keys or custom OAuth endpoints.

For A2A 1.0 clients, discover the hosted HTTP+JSON service from https://a2a.sendmux.ai/.well-known/agent-card.json. It exposes the same curated mailbox, management, and sending operations with an OAuth grant bound specifically to https://a2a.sendmux.ai/a2a/v1.

For AI-agent frameworks, first-party tool wrappers are available:

npm install @sendmux/ai-sdk ai zod   # Vercel AI SDK: sendmux({ apiKey }) returns a ToolSet
pip install langchain-sendmux        # LangChain: SendmuxToolkit(api_key=...).get_tools()

Both wrap the generated Sending and Mailbox clients, so the OpenAPI spec stays the single source of truth.

Connection checks

Authenticated connection checks for all three API surfaces return the current team, credential identity, connection label, permissions and authorised mailboxes. Mailbox checks need no mailbox selector or provisioned storage; Sending checks require email.send without sending an email or checking delivery readiness. Existing mailboxGetMe behaviour is unchanged.

Use TypeScript Sending 1.4.0, Mailbox 1.5.0 and Management 1.3.0 (or umbrella SDK 1.4.2), CLI 1.5.0, MCP 1.7.0, Ruby SDK 1.2.0, Rust 0.3.0, Go 1.5.0, PHP 2.0.0, or Python Sending 1.4.0, Mailbox 1.4.0 and Management 1.3.0 (or umbrella SDK 1.1.1).

SurfaceTypeScript operationCLI commandMCP tool
ManagementmanagementGetConnectionmanagement:get-connectionmanagement_get_connection
MailboxmailboxGetConnectionmailbox:get-connectionmailbox_get_connection
SendingsendingGetConnectionsending:get-connectionsending_get_connection

Use the corresponding client factory and credential. For example, with SENDMUX_API_KEY set to a Management key:

import { createManagementClient, managementGetConnection } from "@sendmux/sdk";

const client = createManagementClient({ apiKey: process.env.SENDMUX_API_KEY! });
const response = await managementGetConnection({ client });
console.log(response.data?.data.label);
sendmux management:get-connection --json

Each Rust client exposes get_connection(), returning Response<Connection>. Generated Go, Python, PHP and Ruby references include the corresponding GetConnection operation for each surface. Use the released package versions listed above; source code for pending releases is not yet available through package registries.

Attachments And Live Mailbox Events

Mailbox attachment metadata now includes a short-lived download_url. Fetch that URL promptly with a plain HTTP client; it does not require an Authorization header, but it expires after a short TTL. If a download URL expires, re-fetch the message or attachment metadata to receive a fresh URL.

For outbound files, avoid manually placing base64 in prompts or source strings. Use the zero-context path for your lane:

  • CLI: sendmux mailbox:send-message --attach ./report.pdf or sendmux sending:send --attach ./report.pdf.
  • TypeScript: use @sendmux/mailbox/node sendMailboxMessageWithFiles(...) or @sendmux/sending/node sendEmailWithFiles(...).
  • Python: use sendmux_mailbox.send_mailbox_message_with_files(...) or sendmux_sending.send_email_with_files(...).
  • MCP: local stdio can use mailbox_upload_attachment with file_path; hosted and shell-capable agents can mint a presigned upload URL, PUT bytes to it without an API key, then send with the returned blob_id.

Mailbox direct uploads, presigned uploads, CLI --attach, and mailbox SDK file helpers share the mailbox attachment cap: currently 7,500,000 bytes per attachment. Sending API attachment helpers encode files into the send request body; the generated Sending API limit is max 10 attachments and a 25 MB request body.

Small generated attachments can still use inline base64 where the API schema supports them. MCP inline base64 is capped at 32 KiB decoded; the cheaper alternatives are file_path, presigned upload, CLI --attach, and SDK file helpers.

Live mailbox events are available through idiomatic lanes:

  • TypeScript: streamMailboxEvents(...) returns an async iterator over typed mailbox realtime events.
  • Python: iter_mailbox_events(...) yields typed MailboxRealtimeEvent models from the generated mailbox client.
  • CLI: sendmux mailbox:stream-events --follow prints one JSON event per line until the stream closes or the process is interrupted.
  • MCP: use mailbox_wait_for_message for bounded waits inside agent tool calls, then mailbox_get_attachment to renew attachment metadata and fetch download_url.

Repository structure

PathPurpose
packages/tsTypeScript SDK packages and the sendmux CLI.
packages/pythonPython SDK packages and the sendmux-mcp package.
goGo module sendmux.ai/go and subpackages.
rustRust crate published as sendmux on crates.io.
packages/phpPHP package sources used for Packagist packages and public split repositories.
packages/rubyRubyGem package sources.
codegenGenerator configuration and templates.
scriptsGeneration, verification, publishing, and release helper scripts.
docsSurface-coverage and live E2E audit artefacts.
.github/workflowsCI, canary, live E2E, and release workflows.

Versioning and support

SDK packages track the Sendmux public API contracts. Patch versions can differ between packages when a fix only affects one ecosystem or runtime.

Generated clients are built from committed OpenAPI snapshots. Any API contract change must update the snapshots and generated output in the same change.

For help, open a GitHub issue with the package name, version, command or import path, and the request ID from any API error response.

Contributing

Open pull requests against this repository. Keep generated output, source snapshots, and verification artefacts together in the same change.

Security issues should be reported through GitHub Security Advisories.

Licence

This repository is available under the MIT licence.

Files in the repo

Repository payload36 top-level entries
  • .githooks
  • .github
  • codegen
  • docs
  • go
  • packages
  • packaging
  • patches
  • rust
  • scripts
  • snap
  • test
  • .gitignore
  • .release-please-manifest.json
  • .rubocop.yml
  • .ruby-version
  • composer.json
  • composer.lock
  • DECISION-LOG.md
  • Gemfile
  • Gemfile.lock
  • glama.json
  • LICENSE
  • openapi-ts.config.ts
  • openapitools.json
  • package.json
  • phpcs.xml
  • phpstan.neon
  • phpunit.xml.dist
  • pnpm-lock.yaml
  • pnpm-workspace.yaml
  • pyproject.toml
  • README.md
  • release-please-config.json
  • requirements-dev.txt
  • tsconfig.base.json

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More connectors

High-performance code intelligence MCP server. Indexes codebases into a persistent knowledge graph — average repo in milliseconds. 158 languages, sub-ms queries, 99% fewer tokens. Single static binary, zero dependencies.

43k

Universal provider proxy for OpenAI Codex & Claude Code — use any LLM (Claude, Gemini, Grok, DeepSeek, Ollama…) with Codex CLI, App, SDK, and Claude Code

14k
okf-memory/
okf-agent-memory

Git-native persistent memory for AI coding agents. Implements Google OKF v0.2 with sub-300µs in-memory BM25 search, embedded MCP server, and progressive disclosure. Slashes token bloat by 80% with zero external databases or dependencies. Built in pure Go.

547
tirth8205/
code-review-graph

Local-first code intelligence graph for MCP and CLI. Builds a persistent map of your codebase so AI coding tools read only what matters, with benchmarked context reductions on reviews and large-repo workflows.

31k
2akouwu/
reverify

Stop your AI from making things up — it proposes, deterministic tools decide, every claim checked against ground truth with evidence. Grounded facts and context survive resets. Reverse engineering is the proving ground. MCP server + CLI.

1.1k
t8y2/dbxConnectors

20 MB lightweight cross-platform database client for 90+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 90+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP Server。

19k