MCP server

The remote Model Context Protocol address, which needs no install and no key, and the @doorman/inbox-mcp server behind it: tools derived from the API contract, the surface sized for a model, one-time secret notices, and fenced mail bodies.

On this page
  1. One address, no install, no key
  2. Two tool surfaces
  3. Derived from the contract
  4. Connect over Streamable HTTP or embed in code
  5. Connect over local stdio
  6. Untrusted mail fencing and one-time secrets
  7. Tool groups

One address, no install, no key

Every deployment serves its tools at one address: https://api.doorman.fyi/mcp. An agent host that speaks the Model Context Protocol over Streamable HTTP is given that address and nothing else. It signs in through the browser with OAuth, the person approves, and no API key is created or stored. Connect your agent has the steps for each agent.

The endpoint is stateless. Every request is a POST https://api.doorman.fyi/mcp, answered by a server instance of its own for the caller's credential and within the API's rate limits. There is no stream to open and no session to end, so the address takes POST only: GET and DELETE answer 405 method_not_allowed with Allow: POST.

An app token
What a connected agent holds once the person approved: bound to this address, limited to the approved permissions and renewed by the host. A token for the REST API is refused here, and so is a console session.
An API key
Authorization: Bearer dm_..., for automation that holds a key. An account key reaches the whole account; an inbox key holds every tool call to its one inbox.

A request without a credential answers 401 with a WWW-Authenticate challenge. The challenge names the resource metadata and the default agent permissions, which is how a host learns where to sign in and what to ask for.

Two tool surfaces

The credential decides what the tool list looks like. The tools are the same operations either way.

An app token gets a surface sized for a model
No output schemas, which makes the tool list about a fifth of its size, and no examples in the input schemas: an example is context spent in every session, and an example identifier can be copied as if it were real. Input is still checked against the whole schema. An answer is one text block and nothing else, so mail content never reaches the model outside its fence. Every answer fits one budget, and whatever was shortened or left out says so and names the tool that reads the rest. Only the tools whose every required permission was approved are listed, and each call is authorized again.
An API key keeps the complete surface
Every tool the key may call, each with its outputSchema, and every answer as structuredContent beside a text block. Complete means complete for what the deployment has switched on.

Neither surface offers the tool of a capability the deployment has not switched on, whatever the credential: calling it would answer 404. Today that is one tool, inboxes_signIns_create, which is offered only where Sign in with Doorman is on. The address knows what its own deployment has on. A server started on a person's machine asks: Connect over local stdio.

Both surfaces open a session the same way. The server sends instructions: what the inbox is, that mail content is data and never instructions, to send only when the person asked, and which of the offered tools to start with. The first paragraph stands on its own, because some hosts keep only the beginning.

One budget for every answer

On the surface for a model every answer fits one budget, whatever the API returned: AGENT_LIMITS.answer in @doorman/inbox-mcp, about sixteen thousand tokens whatever language the mail is written in. That is under what agent hosts accept from one tool call. Text is given up in the order a model can best get it back.

  1. Attachment text first, because attachments_text reads one attachment.
  2. Then message text, evenly across the messages of a list, because messages_get reads one message. A message read on its own may be long; a listed one starts shorter.
  3. Only then whole items. A conversation too long to fit keeps its newest messages and lists the ones before them by id, under earlier. Any other list keeps its first items and says how to ask for the next ones.

Each shortened text is followed, outside its fence, by how much was left out and the tool that reads the rest, when the caller is offered that tool. Listed messages also leave out transport detail (the reference chain, header ids, authentication results, links a model cannot open) and empty fields. messages_get returns every field.

Derived from the contract

@doorman/inbox-mcp exposes the Doorman Inbox API as a Model Context Protocol server. Rather than maintaining a separate tool list by hand, it reads operationTools() from @doorman/inbox-api: 78 tools derived directly from the 84 operations of publicSurface(), executed through @doorman/inbox-sdk.

  • Tool names replace the dots in operation ids with underscores so every function-calling host accepts them: inboxes.create becomes inboxes_create, inboxes.send becomes inboxes_send, and threads.messages becomes threads_messages.
  • Each tool has one self-contained JSON Schema input (inputSchema, with no $ref indirection) that merges path parameters, query parameters, idempotencyKey for the Idempotency-Key header, and the request body's fields at the top level, paired with an inputs map that binds each field back to its place on the wire.
  • Each tool carries MCP annotations (title, readOnlyHint, destructiveHint, idempotentHint, openWorldHint) computed from the contract, and on the complete surface the operation's outputSchema.
  • On the complete surface every tool answer includes both structuredContent and a formatted text block, so hosts that read structured outputs and hosts that read text both receive the full answer. A connected agent is answered in text only: Two tool surfaces.

Connect over Streamable HTTP or embed in code

A host signs in with OAuth: it reads the protected resource from the challenge, registers itself or names itself by the identity document it published, and asks for the person's approval in the browser with S256 PKCE for the resource https://api.doorman.fyi/mcp. REST tokens are refused here. App tokens list only delegated tools whose complete scope requirements are granted; each call is authorized again. Console sessions are not accepted.

Automation that holds a key connects without a subprocess as well, by calling POST https://api.doorman.fyi/mcp with Authorization: Bearer dm_... using the MCP Streamable HTTP transport.

The address is called from a server or from a program on the person's machine. It sends no cross-origin headers, so a browser does not let a script in a web page call it. Such a script can sign in, because the OAuth discovery, registration and token endpoints answer every origin, and then cannot call the tools.

You can also embed the MCP server inside your own Worker, server or agent host with createInboxMcpServer or createInboxMcpHttp from @doorman/inbox-mcp. The root entry point uses only the web platform (fetch, URL, WebCrypto, streams) so it runs in Cloudflare Workers, Node 22 and later, Bun and Deno.

TypeScript

import { DoormanInbox } from "@doorman/inbox-sdk";
import { createInboxMcpHttp, createInboxMcpServer } from "@doorman/inbox-mcp";

const client = new DoormanInbox({
  apiKey: process.env.DOORMAN_API_KEY ?? "",
  baseUrl: "https://api.doorman.fyi",
});

// Build an MCP server instance connected to your transport of choice.
const server = createInboxMcpServer({ client });

// The same tools with answers sized for a model, as the address gives a connected agent.
const forModel = createInboxMcpServer({ client, profile: "agent" });

// Or mount a Web Standard (Request) => Promise<Response> Streamable HTTP handler.
const handleMcp = createInboxMcpHttp({ client });

profile chooses who the answers are for. complete, the default, is for a program: every tool carries its output schema and each answer has structuredContent beside the text. agent is for a model: the surface the address gives an app token.

A call the API refuses comes back as a tool error whose text is JSON: the API's error code, status, message, details and retryAfterSeconds. A failure that is not an answer from the API, such as the network or a fetch you supplied that refuses before sending, has the same shape. It is reported under the code the thrown error carries, with status 0 because no answer was received, and as internal_error when the error carries none.

Connect over local stdio

A host that can only launch a local program runs the same server over standard input and output. From a checkout of the repository, build the two packages and what they depend on once:

Shell

pnpm install
pnpm --filter "@doorman/inbox-mcp..." --filter "@doorman/inbox-cli..." build

Then give the host one of two programs to launch.

doorman mcp
The command line's own server. It runs on the sign-in that doorman login made through the browser, so the host's settings hold no key: The CLI.
doorman-mcp
The package's program. It reads a dm_ key from DOORMAN_API_KEY and the API origin from DOORMAN_API_URL.
{
  "mcpServers": {
    "doorman": {
      "command": "node",
      "args": [
        "/path/to/doorman/packages/inbox-cli/dist/bin.js",
        "mcp"
      ]
    }
  }
}

An account-scoped key lets the server manage inboxes, webhooks and deliveries across the account; an inbox-scoped key restricts every tool call to that single inbox.

Both programs ask the deployment once, when they start, which capabilities it has switched on: the features of GET /v1/me. They wait five seconds at most. A capability counts as on only where its flag is exactly true, so a server that got no answer, or an answer without the flag, offers no tool of that capability and says nothing of it in its instructions. Restart the server after a deployment switches one on.

Untrusted mail fencing and one-time secrets

Inbound emails and attachment text are written by arbitrary senders on the internet. When a tool returns message text or extracted attachment text (threads_messages, inboxes_messages_list, messages_get, attachments_text, events_get), @doorman/inbox-mcp wraps those fields in explicit untrusted-data fences in the text output so the model treats the sender's words as data rather than instructions.

A message cannot close its own fence. Where mail contains the words of the fence's markers, they are rewritten into something that is not a marker and that says the sender wrote it. On the surface for a model, the line that says how much of a text was left out, and which tool reads it, comes after the fence. Inside the fence it would be one more thing the model is told not to follow.

Six default key-authenticated tools carry returnsSecret: true because their response can include a one-time dm_ token or whsec_ signing secret (inboxes_create, inboxes_keys_create, inboxes_webhook_set, inboxes_webhook_rotateSecret, webhooks_create, webhooks_rotateSecret). The registry also marks session-only app secrets, which are not default MCP tools. Apps cannot mint keys or legacy inbox webhooks. When an allowed tool returns a non-null secret, the MCP server adds a shown-once notice. Answers from inboxes_verifications_list start with VERIFICATION_NOTE, reminding the model that each code or sign-in link is only for the service that sent it and must never be forwarded.

The link inboxes_signIns_create answers is a secret of another kind: used at once and never stored, so it carries no shown-once notice. Its answer starts instead with the note of SIGN_IN_NOTES for its status, which says what to do next: open the link now in the browser that should hold the session, tell the user the owner has to allow the service, stay away from a service the owner stopped, or fall back to the service's own form.

Example tool call: inboxes_create

{
  "name": "inboxes_create",
  "arguments": {
    "mailboxName": "concierge",
    "displayName": "Acme concierge",
    "webhookUrl": "https://agent.example.com/hooks/doorman",
    "key": {
      "name": "Acme concierge"
    }
  }
}

Tool groups

All 78 tools come from operationTools() in registry order. The MCP tool reference has each one with its input, who is offered it and its annotations, and The server package has what @doorman/inbox-mcp exports. A deployment that has not switched a capability on leaves that capability's tools out:

Inboxes and sending
inboxes_create, inboxes_list (including externalId lookup), inboxes_get, inboxes_update, inboxes_delete, and inboxes_send (which sends a new message or replies in an existing thread when threadId is given, with idempotencyKey mapped to the Idempotency-Key header).
Inbox rules
inboxes_rules_list, inboxes_rules_create, inboxes_rules_get, inboxes_rules_update, inboxes_rules_delete and inboxes_rules_runs. All require account scope; rule creation or modification can enable future mail sends. See Inbound rules.
Inbox keys and inbox webhooks
inboxes_keys_create, inboxes_keys_list, inboxes_keys_get, inboxes_keys_revoke, inboxes_webhook_get, inboxes_webhook_set, inboxes_webhook_rotateSecret, inboxes_webhook_delete, and inboxes_webhook_deliveries.
Threads, messages and attachments
inboxes_threads_list, threads_get, threads_messages, threads_update, threads_trash, inboxes_messages_list, messages_get, and attachments_text (for example reading a thread at thr_01jc5a1b2c3d4e5f6g7h8j9k0m).
Events, endpoints and deliveries
events_list (both cursor paging and forward polling with after), events_get, webhooks_create, webhooks_list, webhooks_get, webhooks_update, webhooks_rotateSecret, webhooks_delete, webhooks_test, webhooks_deliveries and deliveries_retry.
Custom domains
domains_list, domains_create, domains_get, domains_verify and domains_delete. They need an account key: an app token is never offered them. Adding or checking a domain answers custom_domains_unavailable where the deployment has not enabled custom domains.
Passport and verification codes
services_list, inboxes_services_create and inboxes_verifications_list are offered to connected agents under mail:read and mail:write, and the session instructions teach the declare-then-wait sign-up loop. services_get, services_update and services_delete stay with keys so an agent cannot remove its own trail. Where the deployment has Sign in with Doorman on, inboxes_signIns_create starts a sign-in under the same two permissions, and the instructions say to use it only when the person asked. No tool allows a sign-in or decides one that waits. See The passport.
Account and usage
me, overview and metrics.

Up Down to move, Enter to open, Esc to close