Reference

SDKs, CLI and MCP

Two SDKs do the same things: @zurchin/sdk for TypeScript and JavaScript (Node 20 or later, and any runtime with Web Crypto and fetch) and zurchin for Python 3.10 or later. Both are Apache-2.0. On top of them, zurchin the command line and zurchin-mcp the MCP server. This page lists every function, command and tool.

Install

npm install @zurchin/sdk

Source: zurchin/pidgeon-js (the SDK, the CLI and the MCP server) and zurchin/pidgeon-python. The Python SDK depends on cryptography and httpx; the TypeScript one on web-bot-auth and jose.

Note

Version 2 (SDKs and CLI) and MCP 1.0 are for this API. Code written for 1.x spoke the old email API at /api/v1, which stops seven days after the move; it keeps working on 1.68.0 until then (Moving from the old API).

The API client

TypeScriptPythonDoes
new Zurchin({ apiKey | getToken, baseUrl?, fetch? })Zurchin(api_key, base_url=…, client=None, timeout=10.0)The API client: an API key or an OAuth access token. Keep it on a server. Its groups are below.
verifyWebhook(secret, rawBody, header)verify_webhook(secret, raw_body, header)Check a webhook.

Errors: PidgeonError with status, code and message in both.

The API, by group

The client’s calls are grouped by what they act on. TypeScript takes an object of camelCase options, Python keyword arguments. Email’s groups are on the client in TypeScript (zurchin.threads) and under email in Python (zurchin.email.threads; the 2.0 groups stay on the client too). Lists that page answer { data, has_more, next_cursor }.

GroupCallsEndpoints
inboxeslist, get, create, remove/v1/email/inboxes
messagessend(inboxId, message) (with attachmentIds), list, get (body: clean), markSeen / update(seen=), await / wait (wait for mail), search(q, { inboxId }) or search({ q, inboxId }) / email.searchSend mail, Reading mail
threadslist, get, update (file, star, hand to a person), remove, addLabel, removeLabelConversations
labelslist, create, update, removeLabels
attachmentsupload (straight to storage over 4 MB; Python upload_large), get (a five-minute link)Attachments
contactslist, get, update, removeContacts
calendarlist, get, create, update, remove (Python email.calendar.events)The calendar
domainslist, get, enableMail, disableMail, checkYour own domain
appPasswords / email.app_passwordslist, create, revokeMail apps
Alsostorage(), testInbound() / email.test_inbound(), inboxes.holdSuspicious / inboxes.update(hold_suspicious=True)Storage, Test keys
draftscreate, get, update, remove, send (now or at a time), requestApproval / request_approvalSend mail
ruleslist, create, remove/v1/email/rules
suppressionslist, add, remove/v1/email/suppressions
eventslist/v1/events
podslist, create, remove/v1/pods
webhookslist, create, removeWebhooks

Anything else: request(method, path, …), the call every group is made of.

const inbox = await zurchin.inboxes.create({ name: 'bookings' });
await zurchin.messages.send(inbox.id, {
  to: ['ana@example.com'],
  subject: 'Table for two',
  text: 'Friday at 8?',
});

On your machine (TypeScript)

@zurchin/sdk/node, for Node only, is what the CLI and the MCP server share. Files live in ZURCHIN_CONFIG_DIR, else ~/.config/pidgeon, readable by you only.

FunctionDoes
signIn({ scope?, baseUrl? })Sign in with the browser through Zurchin’s OAuth server (PKCE, a loopback redirect) and keep the session, refreshed from then on.
signOut(baseUrl)End the session at Zurchin and forget it.
clientFromEnvironment()The API client: ZURCHIN_API_KEY if set, else the session.

The CLI

zurchin (npm install -g @zurchin/cli). --json prints the API’s own answer; ZURCHIN_API_KEY wins over a session.

CLI
zurchin login [--scope admin|send|draft|read]
zurchin inboxes list | create <name> [--domain <domain>] [--pod <pod-id>] | remove <inbox-id>
zurchin send <inbox-id> --to ana@example.com --subject "Hi" --text "…"
zurchin drafts create <inbox-id> … | show | send [--at <time>] | approval | remove <draft-id>
zurchin mail list <inbox-id> | read <message-id> [--original] | wait <inbox-id> [--since …]
zurchin search <words> [--inbox <inbox-id>]
zurchin threads list [--folder archive] | show <id> | file <id> --folder <f> | hand-over <id>
zurchin app-passwords create <inbox-id> <name> | list <inbox-id> | revoke <id>
zurchin webhooks list | create <url> --event message.received | remove <id>
zurchin events [--type <type>]
zurchin pods list | create <name> | remove <pod-id>
zurchin api GET /v1/email/rules

# A list prints a page; when there is more, its last line is the next page's --cursor.
zurchin inboxes list --limit 20 --cursor <cursor>

Claude Agent SDK

Connect the hosted MCP server in query()’s options, with an API key in the header.

import { query } from '@anthropic-ai/claude-agent-sdk';

for await (const message of query({
  prompt: 'Make an inbox called bookings and email ops@example.com from it.',
  options: {
    mcpServers: {
      zurchin: {
        type: 'http',
        url: 'https://zurchin.com/mcp',
        headers: { Authorization: `Bearer ${process.env.ZURCHIN_API_KEY}` },
      },
    },
    allowedTools: ['mcp__zurchin__*'],
  },
})) {
  if (message.type === 'result' && message.subtype === 'success') console.log(message.result);
}

OpenAI Agents SDK

Connect the hosted MCP server over Streamable HTTP, with an API key in the header.

Python
import asyncio, os
from agents import Agent, Runner
from agents.mcp import MCPServerStreamableHttp

async def main():
    async with MCPServerStreamableHttp(
        name="zurchin",
        params={
            "url": "https://zurchin.com/mcp",
            "headers": {"Authorization": f"Bearer {os.environ['ZURCHIN_API_KEY']}"},
        },
    ) as zurchin:
        agent = Agent(name="Scout", mcp_servers=[zurchin])
        result = await Runner.run(agent, "Any new mail? Answer what needs an answer.")
        print(result.final_output)

asyncio.run(main())

Vercel AI SDK

@zurchin/ai-sdk gives a model Zurchin’s tools: inboxes, sending, waiting for mail, drafts and approval. Actions that can’t be undone wait for a person.

npm install @zurchin/ai-sdk ai

LangChain

langchain-zurchin gives LangChain and LangGraph agents Zurchin’s tools: their own inbox, sending, replying, reading conversations and waiting for mail. Python 3.11 or later.

pip install langchain-zurchin

LlamaIndex

llama-index-tools-zurchin is a tool spec for LlamaIndex agents, with the same tools as LangChain’s. Python 3.11 or later.

pip install llama-index-tools-zurchin

n8n

Two nodes. Zurchin Trigger starts a workflow when mail arrives, or when a message is held or a draft waits for a person. Zurchin sends, replies, waits for mail, makes drafts and inboxes, and works as a tool for n8n’s AI Agent node.

On n8n Cloud, search for Zurchin in the nodes panel. Self-hosted, an owner or admin installs @zurchin/n8n-nodes-zurchin under Settings → Community Nodes → Install. Then add the credential under Credentials → New → Zurchin API, with a key from zurchin.com/keys.

The MCP server

Two ways, the same tools. Hosted, at https://zurchin.com/mcp: nothing to install; your MCP client signs you in with Zurchin’s OAuth server the first time (it finds it from the server’s 401), or send an API key as Authorization: Bearer pgn_…. Local, @zurchin/mcp over stdio.

claude mcp add --transport http zurchin https://zurchin.com/mcp
ForHostedLocal
Emaillist_inboxes, get_inbox, hold_suspicious_mail, create_inbox, remove_inbox, list_messages, get_message, await_message, search_messages, update_message, send_message, reply_to_message, list_threads, get_thread, update_thread, list_labels, create_label, update_label, delete_label, apply_label, remove_label, read_attachment, find_contact, get_contact, update_contact, delete_contact, get_agenda, get_calendar_event, create_calendar_event, update_calendar_event, delete_calendar_event, create_draft, get_draft, update_draft, delete_draft, send_draft, request_approval, list_rules, add_rule, remove_rule, list_suppressions, add_suppression, remove_suppression, get_storage, list_domains, get_domain, enable_domain_mail, check_domainThe same
The accountlist_events, list_pods, create_pod, rename_pod, move_to_pod, remove_pod, list_webhooks, add_webhook, remove_webhooksign_in, sign_out, status, list_events, list_pods, create_pod, rename_pod, move_to_pod, remove_pod, list_webhooks, add_webhook, remove_webhook

Each tool is one API call (a few, such as reply_to_message, are two) made with your token, so it needs the same access: a read key or sign-in reads, and setting inboxes up takes admin. Mail tools read the Firewall’s cleaned text unless passed body: "original"; tool names kept from the old MCP server (await_message, list_threads, …) mean what they meant. forward_message is gone: passing on text a key read to someone outside its conversation is what canary tokens refuse. send_message, reply_to_message, create_draft and update_draft take attachment_ids: files uploaded with an SDK or the API, since no tool uploads.