Skip to content
couryo

Developer guideAI

MCP and AI agents

Couryo's remote MCP server at mcp.couryo.com, with OAuth or an API key, the sending, analytics, domains, templates, sequences, campaigns and AI tools, resources and ready-made prompts, and how to connect from Claude Code, Codex, Cursor, Claude and ChatGPT.

View as Markdown

Couryo runs a remote MCP server at https://mcp.couryo.com. With it, your AI agent runs Couryo by chatting: it sends email, analyzes delivery by period and by mailbox provider, explains why an email bounced, adds and verifies domains, creates templates, sequences and campaigns, and checks your plan usage.

  • Transport: Streamable HTTP, stateless.
  • Sign-in without a key (OAuth 2.1): Claude Code, Codex, Claude and ChatGPT open Couryo's screen, you sign in as usual (Google or email link), pick the project and the access (read only, read and send, or everything) and that is it. No key is copied. Disconnect at any time under Settings > Security > Connected apps.
  • Sign-in with a key: the same API key as the REST API, in the Authorization: Bearer ck_... header, with the same scopes and the key's project. Good for Claude Code, Codex, Cursor, the OpenAI API and scripts.

Tools#

Each tool needs a scope: read (look things up), send (send and record contacts and events) or admin (configure). Responses and error messages follow the Accept-Language header (Portuguese by default; send Accept-Language: en for English). Errors use the same shape and codes as the API.

Sending and diagnosis#

Tool Scope What it does
send_email send sends an email from a verified domain: from, to (string or list), subject, html and/or text, stream, on_daily_limit (queue keeps it for the next day when the account reached its daily limit, reject refuses) and an optional idempotency_key (24 hours, like the Idempotency-Key header)
get_email read returns an email (id, msg_...) and its timeline, with SMTP code, raw response and a plain-language explanation, the content (cut when long) and the headers; in test mode, also the review_url (review link)
reschedule_email send moves a scheduled email to a new time (id, scheduled_at in ISO 8601, up to 30 days ahead) while it has not started sending
cancel_email send cancels a scheduled email, or one kept by the daily limit, that has not started sending (id); nothing is sent and the quota goes back; needs confirm: true
get_daily_limit read what a send does at the daily limit (refuse or keep for the next day, per stream) and the emails kept now
set_daily_limit admin changes what a send does at the daily limit: transactional and marketing, reject or queue
domain_health read the deliverability diagnosis of a project domain (domain): SPF, DKIM, DMARC and return path checked live, domain block lists, bounces and complaints by mailbox provider over 30 days, reputation tips and the next safe DMARC step
why_bounced read explains why an email (email_id) bounced, was deferred or got a complaint, and what to do

Analytics#

Tool Scope What it does
list_emails read lists emails with filters by status, stream, period, recipient domain, tag, template and sequence; cursor pagination and a lean response
email_stats read the numbers for a period (24h, 7d, 30d, 90d or dates), grouped by day, week, mailbox provider, template, sequence or stream: sent, delivered, hard and soft bounces, complaints, opens (estimated), clicks, unsubscribes and rates, compared with the previous period
top_bounces read the most common bounce reasons, with the explanation in English or Portuguese and the recommended action
deliverability_report read the diagnosis of every project domain, the rates by mailbox provider and the recommendations, in a single report

Inbound#

Tool Scope What it does
list_inbound read the received emails (replies, support, complaints), with the AI triage when on; category, status and q filters. Pro plans and above
get_inbound read one received email: text, headers, attachments (metadata only), checks, the email it answers, the triage and the actions
inbox_test send inbox placement test: sends one copy to the test mailboxes (Gmail, Outlook/Hotmail, Yahoo, UOL, BOL, Terra, iCloud) and answers the id. Paid plans
get_inbox_test read result per provider (inbox, spam, Promotions or missing), the SPF, DKIM and DMARC read and tips on what to improve

Domains#

Tool Scope What it does
list_domains read the project domains and the status of each record
add_domain admin adds a domain and returns the DNS records to publish
verify_domain admin checks the domain's DNS right now

Templates#

Tool Scope What it does
list_templates read the project templates
get_template read one template, with its content and variables
create_template admin creates a template
update_template admin updates a template; new content creates a new version
render_template read previews a template with the variables filled in; nothing is sent

Suppressions#

Tool Scope What it does
list_suppressions read the suppression list, with reason and stream
remove_suppression admin removes manual entries and hard bounces from the suppression list (complaints and unsubscribes stay); requires confirm: true

Webhooks#

Tool Scope What it does
list_webhooks read the project webhooks
create_webhook admin creates a webhook; the signing secret appears only in this response
test_webhook admin sends a signed test event and shows your server's response

Contacts and sequences#

Tool Scope What it does
track_event send records a contact event (email, name, attributes, properties, idempotency_key): starts the sequences with that trigger and ends the ones waiting for it as conversion
upsert_contact send creates or updates a contact by email, merging the attributes
list_contacts read searches and lists contacts
get_contact read one contact, with recent events and the sequences it is in
list_sequences read the project sequences, with trigger, status, steps and counts
get_sequence read one sequence, with its steps and the metrics of each step
create_sequence admin creates a sequence as a draft, with trigger, conversion event, sender and steps
update_sequence admin changes a sequence; requires confirm: true
pause_sequence admin pauses a sequence; requires confirm: true
resume_sequence admin resumes a paused sequence; requires confirm: true
list_enrollments read the enrollments of a sequence and each contact's step

Campaigns#

Tool Scope What it does
create_campaign send creates a campaign as a draft: name, from, audience, subject with html/text or template_id, variables
list_campaigns read the project's campaigns, with status, recipients and progress
get_campaign_stats read deliveries, bounces, opens (estimated), clicks, unsubscribes, rates and the most clicked links
send_campaign send sends it. Only with confirm: true: without it, nothing is sent and it returns the checks (real count, never emailed, AI review) to show the person first
pause_campaign send pauses a sending or scheduled campaign

AI#

Tool Scope What it does
ai_write send writes an email or template from a brief (brief, kind, language, tone): subject, simple responsive HTML and text. Uses 10 AI credits
ai_review send reviews an email before sending (subject, html, text, stream): spam, links, alt text, text part, unsubscribe and tone. No credits; AI reading 3 per day on Free and 200 on paid plans (then rules only)
ai_credits read AI credit balance (monthly and purchased), next expirations and usage this cycle by feature

Account#

Tool Scope What it does
get_usage read plan, monthly quota, usage, projected overage, AI credits and the trust level limits

Free tools#

They work with any scope and on every plan, Free included, with a daily limit per account (the same as the API's free tools). None of them sends email.

Tool Scope What it does
verify_email any checks an address: format, typos (gmial.com, hotmail.con), domains that receive no email, disposable and shared inboxes; the mailbox itself is never probed
check_domain_dns any checks any domain's SPF (with the 10 lookup limit), DKIM, DMARC, MX, MTA-STS, TLS-RPT and BIMI, with a score and records ready to copy
explain_smtp_error any explains an SMTP error or bounce in plain words, with the next step
generate_spf any builds an SPF record
generate_dmarc any builds a DMARC record

Public server, no login#

The five free tools are also at https://mcp.couryo.com/tools, with no account and no key, and a daily limit per IP. Any agent can check a domain or an email before you have a Couryo account.

Terminal
claude mcp add --transport http couryo-tools https://mcp.couryo.com/tools
.cursor/mcp.json
{ "mcpServers": { "couryo-tools": { "url": "https://mcp.couryo.com/tools" } } }

Which access to use#

  • With OAuth: Read only unlocks the read tools; Read and send unlocks the read and send tools; Everything also unlocks the admin tools (domains, templates, suppressions, webhooks, sequences and campaigns).
  • With a key: a read key uses the read tools; a send key uses send_email, track_event, upsert_contact, ai_write and ai_review. For all of them, use an admin key.
  • For analytics and reports, Read only or a read key is enough: the agent sees everything and changes nothing.
  • To test, use a ck_test_ key: nothing is delivered, and the simulated addresses (bounced@, complained@, deferred@) let the agent try why_bounced for real. OAuth always uses the live mode of the chosen project.
  • The key lives in the MCP client's configuration on your machine. Do not paste it into the chat.

Confirmation and privacy#

  • Confirmation: tools that change something in a destructive or costly way, such as remove_suppression, cancel_email, update_sequence, pause_sequence and resume_sequence, refuse the request without confirm: true, with the missing_field error and param: "confirm". The agent should ask you before repeating the request with the confirmation.
  • Privacy: the tools show full recipient addresses only to the customer they belong to, since the data is theirs: the token or key sees only its own project.
  • Long responses: large content, such as the HTML of an email or template, comes back cut, with a note saying it was cut.

Resources and ready-made prompts#

Resources#

Texts the agent can read to work better with Couryo:

Resource What it has
couryo://guide/quickstart quick guide: how to send, check and analyze
couryo://guide/errors the error codes and what to do about each one
couryo://guide/tiers the trust levels and the limits of each one

Prompts#

Ready-made requests the MCP client offers as shortcuts:

Prompt What for
weekly_deliverability analyze your deliverability this week
spam_diagnosis find out why your emails land in spam
onboarding_sequence create an onboarding sequence
review_template review a template

In Claude Code they show up as /mcp__couryo__<name> commands, such as /mcp__couryo__weekly_deliverability. In other clients, where prompts appear depends on the client.

Example requests#

  • "How many emails failed yesterday, and why?"
  • "Create a 3-step welcome sequence."
  • "How is my deliverability to Hotmail this week?"
  • "Remove someone@example.com from the suppression list." (the agent asks for your confirmation first)
  • "Is example.com healthy?"

Claude Code#

Without a key (OAuth):

Terminal
claude mcp add --transport http couryo https://mcp.couryo.com

Then run /mcp inside Claude Code and sign in through the browser.

With a key:

Terminal
claude mcp add --transport http couryo https://mcp.couryo.com \
  --header "Authorization: Bearer $COURYO_API_KEY"

Skills for Claude Code#

Skills are ready-made instructions that Claude Code loads when a task calls for them. Couryo's skills use the MCP tools above, so connect the server first.

Skill When Claude uses it
couryo-first-email send the first email (from your domain or from teste@sandbox.couryo.com) and check on the timeline that it was delivered
couryo-verify-domain add a domain, show its DNS records (DKIM, return path and DMARC), verify it and check its health
couryo-create-template create a template with {{variables}}, preview it with sample values and review it before sending
couryo-debug-bounce find out why an email bounced, was deferred or got a complaint, and what to fix

To install them in a project (or in ~/.claude/skills for every project):

Terminal
for s in couryo-first-email couryo-verify-domain couryo-create-template couryo-debug-bounce; do
  mkdir -p .claude/skills/$s
  curl -fsSL https://couryo.com/skills/$s/SKILL.md -o .claude/skills/$s/SKILL.md
done

Then just ask in plain words, for example "verify the domain shop.com on Couryo" or "why did msg_... bounce?". The skills follow the same rules as the MCP: anything that changes something needs the right scope, and removing a suppression asks for your confirmation.

Codex CLI#

Codex keeps MCP servers in ~/.codex/config.toml (or in a trusted project's .codex/config.toml), and the Codex IDE extension uses the same configuration.

Without a key (OAuth):

Terminal
codex mcp add couryo --url https://mcp.couryo.com
codex mcp login couryo

codex mcp login opens Couryo's consent screen in the browser.

With a key, read from the COURYO_API_KEY environment variable and sent in the Authorization header:

Terminal
codex mcp add couryo --url https://mcp.couryo.com --bearer-token-env-var COURYO_API_KEY

Or straight in the configuration file:

~/.codex/config.toml
[mcp_servers.couryo]
url = "https://mcp.couryo.com"
bearer_token_env_var = "COURYO_API_KEY"

To check: codex mcp list in the terminal, or /mcp inside Codex.

Cursor#

Under Settings > MCP, or in the project's .cursor/mcp.json file (~/.cursor/mcp.json for every project):

.cursor/mcp.json
{
  "mcpServers": {
    "couryo": {
      "url": "https://mcp.couryo.com",
      "headers": { "Authorization": "Bearer ${env:COURYO_API_KEY}" }
    }
  }
}

Do not commit the key: use the environment variable, as above.

Claude (claude.ai and Claude Desktop), no key#

  1. Under Settings > Connectors, click Add custom connector.
  2. Name: Couryo. URL: https://mcp.couryo.com.
  3. Click Connect. Couryo's screen opens: sign in with Google or an email link (and your two-step verification code, if it is on), pick the project and the access and click Allow.

Done: ask in plain language, such as "is example.com healthy?" or "why did email msg_... bounce?". The connector works on claude.ai and on Claude Desktop for the same account.

ChatGPT, no key#

On ChatGPT plans that accept custom MCP connectors, turn on developer mode under Settings > Apps & Connectors > Advanced and create a connector with the URL https://mcp.couryo.com and OAuth authentication. ChatGPT registers itself and opens the same Couryo consent screen.

With the OpenAI API, use the remote MCP tool with the key in a header:

Python (OpenAI API)
import os
from openai import OpenAI

client = OpenAI()
resp = client.responses.create(
    model="gpt-4.1",
    tools=[{
        "type": "mcp",
        "server_label": "couryo",
        "server_url": "https://mcp.couryo.com",
        "headers": {"Authorization": f"Bearer {os.environ['COURYO_API_KEY']}"},
        "require_approval": "always",
    }],
    input="Why did email msg_9w2k7c1x0d4e5f6g bounce?",
)
print(resp.output_text)

How OAuth works (for MCP client builders)#

It follows the MCP authorization specification:

Step Address
Without a token, /mcp answers 401 with WWW-Authenticate: Bearer resource_metadata="..." https://mcp.couryo.com
Protected resource metadata (RFC 9728) https://mcp.couryo.com/.well-known/oauth-protected-resource
Authorization server metadata (RFC 8414) https://mcp.couryo.com/.well-known/oauth-authorization-server
Dynamic client registration (RFC 7591) POST https://mcp.couryo.com/oauth/register
Consent (code + PKCE S256, required) https://app.couryo.com/oauth/authorize
Token (authorization_code and refresh_token) POST https://mcp.couryo.com/oauth/token
Revocation (RFC 7009) POST https://mcp.couryo.com/oauth/revoke
  • Scopes: read, send and admin (space-separated). Without scope, the request counts as read send, and the person can grant less than requested, never more.
  • The access token lasts 1 hour and is bound to the resource https://mcp.couryo.com and to one project. The refresh token lasts 90 days and changes on every use.
  • Redirect addresses: https://, http://localhost (or 127.0.0.1) for desktop apps, or a private scheme (com.example.app:/callback).

Try it by hand#

The server answers JSON-RPC over POST. To list the tools:

cURL
curl https://mcp.couryo.com \
  -H "Authorization: Bearer $COURYO_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Accept: application/json, text/event-stream" \
  -d '{ "jsonrpc": "2.0", "id": 1, "method": "tools/list", "params": {} }'

Swap tools/list for resources/list or prompts/list to see the resources and prompts. Without a key, or with an invalid one, the answer is 401 with the missing_api_key or invalid_api_key error.

Coming soon#

  • Automatic DNS setup driven by the agent.
  • Listing the connector in the Claude and ChatGPT directories.

Docs for agents#

To have your coding agent write the integration, point it at llms-full.txt:

Prompt
Read https://couryo.com/en/llms-full.txt and integrate order confirmation emails
with the Couryo API, using Idempotency-Key and verifying webhook signatures.