Skip to content
Pidgely Docs

SDKs & tools

MCP server

Let Claude, Cursor and other AI agents send email and manage all of Pidgely (domains with automatic DNS, templates with the visual builder and AI, brand import, contacts, broadcasts, webhooks and API keys) through the Model Context Protocol.

View as Markdown

The Model Context Protocol lets AI assistants call external tools. The Pidgely MCP server gives an assistant one tool per useful API operation: send email, add a domain and configure its DNS, design templates with the visual builder and AI, import your brand from your website, manage contacts, segments, broadcasts, suppressions, webhooks and API keys, and read usage. It runs locally over stdio with node (or as a Streamable HTTP server) and reads the key from PIDGELY_API_KEY.

Install

Build it from source (Node 20 or newer):

Shell
git clone https://github.com/pidgely/mcp.git
cd mcp
npm install && npm run build

In the configurations below, replace /path/to/mcp with the absolute path of the folder you just cloned.

Claude Desktop

Add the server to claude_desktop_config.json (Settings → Developer → Edit config) and restart Claude Desktop:

claude_desktop_config.json
{
  "mcpServers": {
    "pidgely": {
      "command": "node",
      "args": ["/path/to/mcp/dist/cli.js"],
      "env": {
        "PIDGELY_API_KEY": "pdg_your_key_here",
        "PIDGELY_MCP_DEFAULT_FROM": "Acme <hello@acme.com>"
      }
    }
  }
}

Claude Code

Shell
claude mcp add --transport stdio pidgely --env PIDGELY_API_KEY=pdg_your_key_here -- node /path/to/mcp/dist/cli.js

Cursor

Add it to .cursor/mcp.json in your project (or ~/.cursor/mcp.json for every project):

.cursor/mcp.json
{
  "mcpServers": {
    "pidgely": {
      "command": "node",
      "args": ["/path/to/mcp/dist/cli.js"],
      "env": { "PIDGELY_API_KEY": "pdg_your_key_here" }
    }
  }
}

What you can ask

  • "Claude, create a welcome template with my brand from acme.com and send me a test at me@acme.com." The assistant imports the brand (import_brand_from_website with apply), writes the e-mail (generate_template_with_ai), saves it (create_template with the builder document), checks it (render_template_html) and sends one test (send_email) after you confirm.
  • "Add the domain mail.acme.com and set up its DNS on Cloudflare." create_domain, detect_dns_provider, then setup_dns_cloudflare with a token you paste (used once, never stored or shown back), then verify_domain.
  • "Translate the welcome template to Portuguese and suggest five subject lines."
  • "Draft a broadcast to the 'Pro customers' segment announcing our new API, but don't send it."
  • "Which addresses bounced this week? Suppress bob@example.com."
  • "Create a sending-only API key for the billing service." The new key is shown once, in that answer only.

The builder and brand tools work on every plan; the AI tools need the Scale plan (the API answers 403 plan_required otherwise; get_template_builder_capabilities tells the assistant what is available). AI tools count against the organization's monthly AI quota.

Tools

Kinds: read tools only fetch data; write tools change your account; send tools e-mail people; destructive tools delete or revoke something, or send a broadcast, and cannot be undone. Every tool carries MCP annotations (readOnlyHint, destructiveHint, idempotentHint, openWorldHint) so clients can auto-approve reads and ask before the rest.

Group Tools
Emails send_email (send), send_batch (send), get_email, list_emails, list_email_attachments, get_email_attachment (read), reschedule_email, cancel_email (write)
Domains list_domains, get_domain, detect_dns_provider (read), create_domain, update_domain, verify_domain, setup_dns_cloudflare (write), delete_domain (destructive)
Templates list_templates, get_template, preview_template, render_template_html, convert_html_to_builder (read), create_template, update_template, publish_template, duplicate_template (write), delete_template (destructive)
AI assist get_template_builder_capabilities (read), generate_template_with_ai, rewrite_block, translate_template, suggest_subjects (write: they use the AI quota)
Brand get_theme (read), import_brand_from_website, update_theme (write)
Contacts list_contacts, get_contact, list_contact_segments (read), create_contact, batch_create_contacts, update_contact, add_contact_to_segment, remove_contact_from_segment (write), delete_contact (destructive)
Segments list_segments, get_segment, list_segment_contacts (read), create_segment, update_segment (write), delete_segment (destructive)
Broadcasts list_broadcasts, get_broadcast (read), create_broadcast, update_broadcast, duplicate_broadcast, cancel_broadcast (write), send_broadcast, delete_broadcast (destructive)
Suppressions list_suppressions, get_suppression (read), add_suppression, batch_add_suppressions, remove_suppression, batch_remove_suppressions (write)
Webhooks list_webhooks, get_webhook (read), create_webhook, update_webhook, rotate_webhook_secret (write), delete_webhook (destructive)
API keys list_api_keys (read), create_api_key, rename_api_key (write), revoke_api_key (destructive)
Usage get_usage (read)

Builder documents are JSON (blocks with a theme), the same format as builder in the Templates API: the assistant can generate one with AI, edit it, render it to e-mail HTML and save it as a template.

Safety

  • Explicit recipients. Sending tools need an explicit to; the server tells the model to e-mail only addresses you gave it.
  • Two-step broadcasts. create_broadcast makes a draft; send_broadcast also requires confirm: true.
  • Read only and dry run. PIDGELY_MCP_READ_ONLY=true lists only read tools. PIDGELY_MCP_DRY_RUN=true makes every other tool return the request it would make instead of calling the API.
  • Secrets stay out of the conversation. Output is scrubbed of your API key and of anything shaped like a Pidgely key, except the new key that create_api_key returns once. The Cloudflare token of setup_dns_cloudflare is write-only: it is never echoed, not even in dry-run previews.

Choosing a key for an agent

An agent acts with the permissions of its key. Start narrow:

  • For agents that only send, use a sending_access key restricted to one domain: it can't read contacts, change domains or create keys.
  • Use a full_access key only for agents you trust to manage the account, and revoke it when you're done.
  • Ask the assistant to confirm before sending to real recipients.

Docs for assistants

Assistants can also read these docs directly: /llms.txt lists every page, /llms-full.txt has all of them in one file, and every page is available as Markdown at <url>.md.