agentbox
Inbound email integration using Cloudflare Email Workers to receive messages into AgentBox inboxes.
Inbound email integration with Mailgun to receive messages into AgentBox inboxes.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agentboxCreate an inbox for my scheduling agent and check for new messages"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
AgentBox
Open-source email infrastructure for AI agents, provisioned in your AWS account.
AgentBox is a hosted, multi-tenant control plane that gives every software agent a real email identity, inbox, safety policy, and scoped API key. People create an AgentBox account and private workspace, then connect their AWS account from the dashboard. AgentBox configures Amazon SES, S3, and SNS without replacing an existing receipt-rule set, receives raw MIME, threads conversations, sends replies, and exposes the result through REST, realtime events, SDKs, MCP, and an operator console.
Your AWS account remains the mail server. AgentBox is the control plane.
What is included
AWS onboarding: enter an AWS Access Key ID and Secret Access Key in AgentBox; credentials are encrypted at rest, checked with STS, and validated against every required permission before provisioning. Default credentials and cross-account
AssumeRoleremain available for advanced deployments.Safe provisioning: Easy DKIM or BYODKIM, custom MAIL FROM, live DNS checks, destructive-MX warnings, S3/SNS/configuration-set creation or adoption, and safe receipt-rule insertion.
Agent lifecycle: readable generated addresses, bulk creation, sub-addressing, reserved system agents, optional catch-all routing, pause/resume replay, and archive tombstones.
Safe outbound: SES raw MIME, SMTP/local fallback, correct reply headers, reply-all self-address removal, suppressions, allow/block lists, daily limits, approval queues, thread depth limits, and auto-reply loop prevention.
Inbound processing: verified SNS notifications, S3 MIME fetch, generic signed JSON and Postmark adapters, durable idempotency, replayable failures, bounce-as-mail handling, attachment extraction, content sniffing, and content-addressed storage.
Events: durable cursor log, polling, SSE, WebSocket resume, long polling, filtered waits, HMAC webhooks, exponential retry, and dead-letter replay.
Intelligence, optional: hybrid lexical/semantic search, quote stripping, chunked embeddings, JSON-schema extraction, validation, confidence, spend caps, and backfill.
Operator surfaces: responsive web console, OpenAPI/Swagger, TypeScript and Python SDKs, MCP tools, YAML config import/export/diff/apply, audit logs, and health views.
Related MCP server: mcp-server-lobstermail
Hosted account model
Human users do not log in with an organization API key. They create an account with their name, email, workspace name, and password. AgentBox creates an isolated organization and issues an expiring HTTP-only session cookie. Passwords are hashed with scrypt, and session tokens are stored only as SHA-256 hashes.
After signing in, the workspace owner adds AWS credentials and completes provisioning. Scoped AgentBox API keys are created later for agents, SDKs, MCP, and external integrations; they are not dashboard passwords.
Architecture
Customer AWS account AgentBox
┌──────────────────────────────┐ ┌────────────────────────────┐
│ SES receipt rule │ │ Operator console │
│ └─ S3 raw MIME ── SNS ─────┼── HTTPS ──▶│ Ingest + threading │
│ SES sending + config set ◀───┼── AWS SDK ─│ Provisioner + sender │
│ Bounce/complaint SNS ─────────┼── HTTPS ──▶│ Events + suppressions │
│ S3 attachment objects │◀────────────│ REST · SDKs · MCP │
└──────────────────────────────┘ │ SQLite reference store │
└────────────────────────────┘The included deployment is a single-process, single-node reference deployment backed by SQLite/WAL. Organization boundaries are enforced throughout the API, but horizontal multi-replica operation requires a shared database/event notifier that is not included in this release.
Quick start
Requirements: Node.js 20+ and npm.
git clone https://github.com/sagnik11/agentbox.git
cd agentbox
cp .env.example .env
npm install
npm run devSet at least these values in .env before exposing the service:
AGENTBOX_API_KEY=<a-long-random-emergency-bootstrap-key>
INBOUND_WEBHOOK_SECRET=<a-different-random-secret>
ENCRYPTION_KEY=<at-least-32-random-characters>
PUBLIC_URL=https://agentbox.example.comOpen http://localhost:3000 for the AgentBox product website, then create a hosted-style account at http://localhost:3000/signup. Returning users sign in at /login; the authenticated dashboard is /console. The dashboard walks through AWS credentials, region, domain, DNS, and receiving setup. Interactive API documentation is at http://localhost:3000/docs.
AGENTBOX_API_KEY is an operator-controlled bootstrap/recovery credential for direct API access. It is not shown to hosted users and is not used by the browser dashboard.
For local development without AWS, create a domain and an agent. Sends are recorded as simulated and no recipient is contacted:
curl -X POST http://localhost:3000/v1/domains \
-H 'Authorization: Bearer local-secret' \
-H 'Content-Type: application/json' \
-d '{"name":"mail.agents.test"}'
curl -X POST http://localhost:3000/v1/agents \
-H 'Authorization: Bearer local-secret' \
-H 'Content-Type: application/json' \
-d '{"domain_id":"<domain-id>","username":"researcher","name":"Research agent"}'Docker
Copy .env.example to .env, replace the required secrets, then run:
docker compose up --buildThe data volume contains the SQLite database and locally stored attachments. Back it up as one unit. See deployment guidance before connecting a production AWS account.
AWS onboarding
The default onboarding path asks for an AWS Access Key ID and Secret Access Key. AgentBox encrypts both values with ENCRYPTION_KEY; plaintext is accepted only on the create request and is never returned. Self-hosted operators can alternatively use the default AWS credential chain or a cross-account role with a unique External ID. The included IAM policy documents the required actions, and the CloudFormation role supports the advanced AssumeRole path.
The console then performs this sequence:
Accepts the AWS Access Key ID and Secret Access Key through the encrypted AgentBox console.
Calls STS to establish the AWS account and principal, then simulates every required IAM action and reports missing permissions.
Reads per-region SES production access and quota.
Creates or adopts an S3 bucket, SNS topic, and SES configuration set.
Creates the domain identity and renders DKIM, SPF, DMARC, MAIL FROM, and inbound MX records.
Checks DNS record-by-record and warns before a root MX change could replace human mail.
Appends AgentBox's rule to the active SES receipt-rule set. If no active set exists, it creates and activates one.
Provisioning is idempotent and records ownership. Teardown disables and removes AgentBox's domain rule and identity while preserving messages and adopted/shared resources.
Core API
# Create a scoped key for an agent
curl -X POST http://localhost:3000/v1/agents/<agent-id>/api-keys \
-H 'Authorization: Bearer <root-key>' \
-H 'Content-Type: application/json' \
-d '{"name":"runtime"}'
# Send exactly once across client retries
curl -X POST http://localhost:3000/v1/agents/<agent-id>/messages \
-H 'Authorization: Bearer <agent-key>' \
-H 'Idempotency-Key: task-4021-email-1' \
-H 'Content-Type: application/json' \
-d '{"to":["person@example.com"],"subject":"Update","text":"The task is complete."}'
# Wait for matching inbound mail
curl 'http://localhost:3000/v1/agents/<agent-id>/wait?type=message.received&subject_contains=verification&timeout_ms=60000' \
-H 'Authorization: Bearer <agent-key>'Important endpoint groups:
Area | Endpoints |
AWS |
|
Domains |
|
Agents |
|
Threads |
|
Attachments |
|
Operations |
|
Realtime |
|
Intelligence |
|
Configuration |
|
All errors use a stable error code plus message, docs_url, and request_id. Agent-scoped keys can access only their agent. Organization keys are required for provisioning, global settings, approvals, and key management.
Inbound and attachments
SES receiving uses S3 followed by SNS. AgentBox validates the SNS certificate origin and signature, requires an exact registered Topic ARN, fetches raw MIME from the customer bucket, and stores parsed attachments in that same S3 account when the connection has been provisioned.
Generic integrations POST normalized JSON to /v1/inbound with X-AgentBox-Signature, the hex HMAC-SHA256 of the exact request bytes using INBOUND_WEBHOOK_SECRET. Native Postmark payloads can use configured HTTP Basic authentication.
Attachment objects are keyed by SHA-256 and reference-counted. Downloads always use Content-Disposition: attachment, application/octet-stream, and nosniff. Authenticated callers can mint an anonymous signed URL valid for at most one hour.
Realtime delivery
Poll
/v1/events?cursor=<n>for durable cursor pagination.Request
Accept: text/event-streamon the same endpoint for SSE.Connect to
/v1/ws?token=<key>&cursor=<n>for WebSocket resume. Slow consumers are closed with code1013and a resume cursor.Use
/v1/agents/:id/waitor MCPwait_for_messagefor filtered blocking waits.Webhooks receive a stable event ID and
X-AgentBox-Signature: t=<unix>,v1=<hmac>. Deliveries retry with exponential backoff and enter a replayable dead-letter state after ten attempts.
Events are at-least-once. Consumers must deduplicate by event ID and persist their cursor.
Optional intelligence
No model call is made unless OPENAI_API_KEY is set. The default embedding model is text-embedding-3-small; extraction uses a configurable structured-output model. AgentBox stores vectors locally in the reference deployment, fuses lexical and semantic ranks using reciprocal rank fusion, and validates every extraction against its JSON schema.
OPENAI_API_KEY=...
OPENAI_EXTRACTION_MODEL=gpt-5.6
OPENAI_EMBEDDING_MODEL=text-embedding-3-small
OPENAI_ESTIMATED_CENTS_PER_1K_TOKENS=0Extractors run after durable ingest, never block receipt, and record a failure with null data when provider output does not validate. Attachment OCR/PDF extraction is not part of this release.
SDKs and MCP
TypeScript:
sdk/typescriptPython:
sdk/pythonMCP server:
src/mcp.ts
Configure an MCP client to run:
{
"mcpServers": {
"agentbox": {
"command": "npx",
"args": ["tsx", "/absolute/path/to/agentbox/src/mcp.ts"],
"env": {
"AGENTBOX_URL": "http://localhost:3000",
"AGENTBOX_API_KEY": "<agent-scoped-key>"
}
}
}
}Tools include list_agents, create_agent, list_messages, send_message, read_thread, reply_to_thread, wait_for_message, and search.
Config as code
Export the live hierarchy as YAML, review a dry-run diff including projected AWS calls, then apply it:
curl http://localhost:3000/v1/config/export -H 'Authorization: Bearer <root-key>' > agentbox.yaml
curl -X POST http://localhost:3000/v1/config/diff -H 'Authorization: Bearer <root-key>' -H 'Content-Type: text/yaml' --data-binary @agentbox.yaml
curl -X POST http://localhost:3000/v1/config/apply -H 'Authorization: Bearer <root-key>' -H 'Content-Type: text/yaml' --data-binary @agentbox.yamlSee configuration reference. Secret access keys are intentionally never exported.
Development
npm run checkThis type-checks the server and TypeScript SDK, compiles the Python SDK, runs the full test suite, and builds production JavaScript. The suite covers receipt-rule preservation, signed SNS rejection, idempotent ingest/send, threading, loop prevention, lifecycle replay, tenant isolation, attachments, guardrails, webhook signing/retry, config apply, and structured extraction validation.
Security
Read SECURITY.md before production use. Put AgentBox behind TLS, protect signup and login with edge rate limits, use agent-scoped runtime keys, restrict autonomous recipients, rotate bootstrap secrets, and keep the data volume encrypted and backed up. Browser sessions use HTTP-only, SameSite cookies; AWS credentials are separately encrypted with ENCRYPTION_KEY. Email is attacker-controlled model input; AgentBox guardrails limit effects but cannot make prompt injection disappear.
License
MIT © Sagnik Ghosh. Sponsored by Autter.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceEmail infrastructure for AI agents — create inboxes, send/receive email, search messages, and manage threads via MCP tools.Last updated10182MIT
- AlicenseAqualityCmaintenanceMCP server for LobsterMail — gives AI agents email tools. Create inboxes, send and receive email, search messages, and manage webhooks.Last updated1131MIT
- Alicense-qualityBmaintenanceAn MCP server that receives emails on your domain and allows AI assistants to search, read, and manage them via natural language queries.Last updated1,110MIT
- Alicense-qualityAmaintenanceA self-hosted MCP server that gives AI agents full email superpowers.Last updated1MIT
Related MCP Connectors
Hosted email MCP for AI agents with inboxes, send/receive, memory, recovery, and credits.
Shipmail MCP server for AI agent custom-domain email inboxes with REST API and webhooks.
AI email inbox and sending tools with attachments, search, live events, and webhooks.
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/sagnik11/agentbox'
If you have feedback or need assistance with the MCP directory API, please join our Discord server