Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Latest commit

 

History

History
263 lines (200 loc) · 6.03 KB

File metadata and controls

263 lines (200 loc) · 6.03 KB
title Coding Agents
description Give Cursor, Claude Code, Windsurf, and Codex email capabilities via the Commune MCP server.

Why give coding agents email?

AI coding agents like Cursor, Claude Code, Windsurf, and OpenAI Codex can use email to:

  • Send deployment notifications and CI/CD status updates
  • Receive webhook payloads and error reports via email
  • Send code review summaries to team members
  • Handle verification emails during automated setups
  • Manage customer support threads programmatically

MCP Server (recommended)

The Commune MCP server gives your coding agent direct access to email tools. Works with any agent that supports the Model Context Protocol.

# Install globally
pip install commune-mcp

# Or run directly with uvx (no install needed)
uvx commune-mcp

Add to .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "commune": {
      "command": "uvx",
      "args": ["commune-mcp"],
      "env": {
        "COMMUNE_API_KEY": "comm_your_api_key"
      }
    }
  }
}

After adding this config, restart Cursor. The agent will have access to email tools like send_email, list_threads, search_threads.

You can also configure MCP servers via **Cursor Settings → MCP → Add Server**.

Run in your terminal:

claude mcp add commune -- uvx commune-mcp

Then set the environment variable:

export COMMUNE_API_KEY="comm_your_api_key"

Or add to ~/.claude/claude_desktop_config.json:

{
  "mcpServers": {
    "commune": {
      "command": "uvx",
      "args": ["commune-mcp"],
      "env": {
        "COMMUNE_API_KEY": "comm_your_api_key"
      }
    }
  }
}

Claude Code will discover the MCP tools automatically and can send/receive emails during coding sessions.

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "commune": {
      "command": "uvx",
      "args": ["commune-mcp"],
      "env": {
        "COMMUNE_API_KEY": "comm_your_api_key"
      }
    }
  }
}

Add to your Codex config (~/.codex/config.json or project .codex/config.json):

{
  "mcpServers": {
    "commune": {
      "command": "uvx",
      "args": ["commune-mcp"],
      "env": {
        "COMMUNE_API_KEY": "comm_your_api_key"
      }
    }
  }
}

Direct SDK usage

If your agent doesn't support MCP, use the SDK directly:

import { CommuneClient } from 'commune-ai';

const commune = new CommuneClient({
  apiKey: process.env.COMMUNE_API_KEY!,
});

// Send a deployment notification
await commune.messages.send({
  inbox_id: 'your_inbox_id',
  to: ['[email protected]'],
  subject: 'Deployment Complete',
  text: 'v2.1.0 deployed successfully to production.',
});

// List recent threads
const threads = await commune.threads.list({
  inbox_id: 'your_inbox_id',
  limit: 10,
});
from commune import CommuneClient

client = CommuneClient(api_key="comm_your_api_key")

# Send a deployment notification
client.messages.send(
    inbox_id="your_inbox_id",
    to="[email protected]",
    subject="Deployment Complete",
    text="v2.1.0 deployed successfully to production.",
)

# List recent threads
threads = client.threads.list(inbox_id="your_inbox_id", limit=10)
# Send a deployment notification
curl -X POST https://api.commune.email/v1/messages/send \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "inbox_id": "your_inbox_id",
    "to": ["[email protected]"],
    "subject": "Deployment Complete",
    "text": "v2.1.0 deployed successfully to production."
  }'

# List recent threads
curl https://api.commune.email/v1/inboxes/your_inbox_id/threads \
  -H "Authorization: Bearer YOUR_API_KEY"

MCP tools available

Once the MCP server is connected, your coding agent has access to these tools:

Tool Description
send_email Send an email from your inbox
list_threads List conversation threads
get_thread_messages Get all messages in a thread
search_threads Search threads by content (vector + regex)
create_inbox Create a new email inbox
list_inboxes List all your inboxes
list_domains List your verified domains
create_domain Register a custom domain
verify_domain Verify DNS records for a domain
get_thread_metadata Get thread tags, status, and assignment
set_thread_status Update thread status (open, waiting, closed)
tag_thread Add tags to a thread
untag_thread Remove tags from a thread
assign_thread Assign a thread to an agent or person
upload_attachment Upload a file attachment
get_attachment_url Get a download URL for an attachment
get_deliverability_stats Check bounce rates, complaints, delivery health
get_suppressions List suppressed email addresses
get_delivery_events View delivery event timeline

Example conversations

Once configured, you can ask your coding agent things like:

"Create an inbox called deploy-bot and send a test email to [email protected]"

"Check my inbox for any emails about the production outage"

"Reply to that thread saying the fix has been deployed"

"Search my threads for anything mentioning 'invoice' in the last week"

"What's my current email deliverability rate?"

The agent will use the appropriate MCP tools to handle each request.


Resources

Full MCP server documentation and all available tools TypeScript SDK reference Python SDK reference Sending and listing messages