Claude Code
Manage email directly from Claude Code using the AgentPost MCP server
Claude Code is Anthropic's CLI tool for working with Claude in your terminal. By connecting the AgentPost MCP server, Claude Code can manage inboxes, send email, read messages, and automate email workflows -- all from your development environment.
Setup
1. Install the MCP server
npm install -g @agentpost/mcp-server2. Configure Claude Code
Add the AgentPost MCP server to your Claude Code configuration. Open your settings and add:
{
"mcpServers": {
"agentpost": {
"command": "npx",
"args": ["@agentpost/mcp-server"],
"env": {
"AGENTPOST_API_KEY": "ap_sk_your_api_key_here"
}
}
}
}You can add this configuration at the project level (.claude/settings.json) or globally.
3. Verify the connection
Start Claude Code and ask it to list your inboxes:
> List my AgentPost inboxesClaude will use the list_inboxes MCP tool to retrieve and display your inboxes.
Example workflows
Support ticket agent
Build a Claude Code workflow that monitors a support inbox and helps you respond:
> Check the support inbox for unread messages from today.
> For each message labeled "needs-response", draft a helpful reply
based on the customer's question. Show me the drafts before sending.Claude Code will:
- Call
list_messagesto get recent inbound messages - Filter for messages with the
needs-responselabel - Call
create_draftfor each message with a contextual reply - Show you the drafts for review
- Call
send_draftfor the ones you approve
Deploy notification bot
Set up automated deployment notifications:
> Create an inbox called "deploy-notifications" for our CI/CD pipeline.
> Send a message to [email protected] with the subject
"Deploy completed: api-server v2.4.1" and include the recent
changelog as the body.Email triage
Quickly triage and categorize incoming email:
> Show me all messages in the support inbox from the last 24 hours.
> Classify each message as "billing", "technical", or "general" and
add the appropriate label. Flag any messages mentioning "urgent"
or "outage" as "priority-high".Thread summarization
Get quick summaries of long email conversations:
> Get thread thr_abc123 and summarize the conversation.
> What are the key action items mentioned in this thread?
> Draft a follow-up email summarizing next steps.Environment variables
| Variable | Required | Description |
|---|---|---|
AGENTPOST_API_KEY | Yes | Your AgentPost API key (ap_sk_...) |
AGENTPOST_BASE_URL | No | Custom API base URL for self-hosted instances |
Available operations
All MCP server tools are available in Claude Code, including:
- Inbox management (create, list, update, delete)
- Message operations (send, reply, forward, list, get)
- Thread management (list, get, label)
- Draft workflow (create, edit, send, delete)
- Label management (add, remove, list, batch)
- Attachment handling (get, download)
- Domain management (list, add, verify)
Tips
- Claude Code automatically discovers MCP tools -- you do not need to explicitly invoke them
- Use project-level configuration (
.claude/settings.json) to share AgentPost access with your team - Combine AgentPost operations with file system access for workflows like "save all attachments from thread X to ./downloads/"
- Claude Code can chain multiple operations together (read message, classify, label, reply) in a single conversation turn
- For security, use API keys with minimal scopes for Claude Code access