AgentPost
Integrations

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-server

2. 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 inboxes

Claude 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:

  1. Call list_messages to get recent inbound messages
  2. Filter for messages with the needs-response label
  3. Call create_draft for each message with a contextual reply
  4. Show you the drafts for review
  5. Call send_draft for 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 ops-team@acmeco.com 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

VariableRequiredDescription
AGENTPOST_API_KEYYesYour AgentPost API key (ap_sk_...)
AGENTPOST_BASE_URLNoCustom 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

On this page