# The MCP endpoint

> One endpoint gives an agent every app you have configured, without putting a credential in the agent. Codemode, sign-in and elicitation modes explained.

Source: https://docs.onedoor.team/mcp/
All docs in one file: https://docs.onedoor.team/llms-full.txt

OneDoor serves one MCP endpoint. Every app you have configured is
reachable through it. You do not add one MCP server per service, and you do not
paste a credential into the agent.

- Hosted: `https://app.onedoor.team/mcp`. It is the same for every company: signing in
  decides which company you reach. If you belong to more than one company, pick it on the consent page.
  Only a [personal access token](/api-keys#connect-an-mcp-client) uses
  `https://app.onedoor.team/org/<company>/mcp`; clients that sign in refuse that form.
- Self-host: `<your origin>/mcp`

Below, "the MCP address" means this endpoint, and a query string such as
`?elicitation_mode=browser` is added to the end of it.

The transport is streamable HTTP. See
[Add an MCP client](/mcp-clients) for the exact setup commands. For a client
that starts a command instead, `executor mcp` serves the same endpoint over
stdio; see [From a shell](#from-a-shell).

## The tools

The endpoint does not expose one MCP tool per app tool. However many apps you
add, the tool list stays the same size. When a client connects, the server's
MCP instructions introduce OneDoor to the agent. They are the built-in `executor` app's
`executor` skill, which points to its `code-mode` and `app-authoring` skills.

- **`skills`** reads the instructions an app ships. Call `skills({})` for a list
  of what is visible, `skills({ app: "support-inbox" })` for one app's skills,
  and `skills({ app: "support-inbox", name: "triage" })` to read one. It
  connects no account and runs no code.
- **`search`** finds app tools by words in their paths, descriptions and
  labels, and returns each tool's exact path and input type.
- **`describe`** returns the whole description and signature of tools at exact
  paths from `search`.
- **`call`** calls tools directly by path. Pass one `{ path, input }` as
  `calls`, or an array of independent calls, which run concurrently.
- **`execute`** runs a JavaScript program over your apps.
- **`resume`** continues a call or program that paused for an approval or for
  input. It is not present in native mode, where the client answers in place.

## Direct calls

For one or a few calls, an agent needs no program:

```json
{ "calls": [{ "path": "tools.vercel.listProjects", "input": {} }] }
```

`call` returns each call's outcome in order, with `ok` and its `value` or
`error`. One failed call does not stop the others. An unknown path comes back
with the closest paths. Results come back whole, however large; `execute` can
return only the fields you need. Approvals and input pause `call` exactly as they pause `execute`,
except in [native mode](#elicitation-modes): there `call` is marked destructive
and open-world, so your MCP client confirms each call before it runs, and that
confirmation answers the apps' approval policies. Tool input still opens the
client's prompt.

## Codemode

`execute` is for work where one result feeds another call, or a large result
should be reduced before it reaches the agent. The agent writes a short
JavaScript program; OneDoor runs it in a sandboxed interpreter and returns what
the program returns.

Inside the program, app tools are ordinary async functions:

```js
return await tools.search({ query: "vercel projects" });
```

Search returns a page of tools: each one's exact callable path, the first line
of its description and its input type. Each app and its linked accounts are listed once.
`tools.search(next)`, with the returned `next` as the whole input, reads the
following page, and
`tools.search.describe({ paths })` returns a tool's whole signature, including
its output type. Every app is called by its slug, `tools.<app>.<tool>`. A call
uses the accounts you linked to the app: one for each single-account
requirement, and every linked account for a `.many()` requirement. An app's own
accounts, linked for everyone by people who can edit it, fill its app account
requirements for every caller; search and `$accounts` describe only the accounts you link. Calls never
choose accounts; an input with `$accounts` fails with `AccountChoiceUnsupported`.
To use another account, link it on the app's **Accounts** tab.

```js
const projects = await tools.vercel.listProjects({});
return projects.projects.map((project) => project.name);
```

The agent can call several tools, join the results and return only the part it
needs. That is the point: the whole result set never has to pass through the
model's context.

A remote MCP tool returns its whole MCP result: `content`, `structuredContent`
and `isError`. A server that returns `structuredContent` usually repeats it as
JSON text in `content`; OneDoor drops that copy, so read `structuredContent`.
Other content stays as the server sent it. `isError: true` is the tool saying it failed. The call returns
that result instead of throwing, so programs that read `isError` keep working,
and the result's `toolCalls` lists the call with outcome `failure`. The server
may still have made changes. `call` lists it the same way. An outcome of
`success` only means no tool error was reported; check the result before
treating its action as done.

Images and audio reach the agent as media. Wherever the value `execute`, `call`
or `resume` returns holds `{ type: "image", mimeType, data }` or
`{ type: "audio", mimeType, data }`, with `data` in standard or URL-safe base64,
the response carries that block as its own MCP content after the JSON text, once
even if the value repeats it. The JSON keeps `{ type, mimeType, contentIndex }`
in its place, the block's index in the response's `content`. MCP image and audio
results, such as screenshots, already have that shape. A program can show bytes
a tool returns another way, such as an email attachment's base64, by returning
them in it. Inside a program the block is whole, so its data can be passed on to
another tool.

The interpreter has no `fetch`, no `process`, no filesystem, no timers and no
imports. Its only way out is a tool call, which enters the trusted runtime where your
credentials live. Limits are cooperative, not process isolation. Discovery is
not cached across changes, so run `tools.search` again in a new `execute` after
you add or reconfigure an app.

Some limits are fixed by the server and a client cannot raise them: 65,536
characters of program source, 100 tool calls and 5 minutes. OneDoor does not
limit the size of a result. The runtime limits one value crossing between an app
and OneDoor, such as a tool's result, to 32 MiB, and on hosted a result of a few
tens of megabytes can pass the MCP session's 128 MB memory. Failures OneDoor
recognizes at these limits return an error naming the likely limit, never a cut
value. A failure that loses the response first, such as a 64 MiB value on hosted,
can end with no answer before the client's timeout. Time spent waiting for your approval or input does not count toward the
5 minutes. Execute returns the result when the program ends, or sooner with a
request for approval or input when the program pauses. An MCP client with a
shorter tool-call timeout, often 60 seconds, may give up and cancel the program.

## Signing in from the browser

Hosted and self-host use OAuth. Your client registers itself, opens your browser
at `/mcp/authorize`, and you sign in there. You then choose a company and
approve the connection. The client receives a token; it never receives your
password or your accounts.

The grant that comes back is bound to one
[company](/concepts/organizations-and-access). Switching company in
the dashboard later does not retarget an existing connection, including after
the token refreshes. To use a second company, connect again and approve it
separately.

Every request revalidates the token, the approval and your current membership. A
revoked grant returns 401. Losing membership returns 403.

On the same screen you choose what the agent reaches, every app available to you
or one of your [scoped connections](#scoped-connections), and its
[mode](#elicitation-modes). The URL the client was given only preselects these
choices. The grant keeps what you chose: every request reads it from the grant,
whatever URL the client later uses, so changing the URL never widens access or
weakens approvals. To check what a token reaches, send it to `GET /mcp/whoami`.

## Scoped connections

A **scoped connection** is a named MCP URL that reaches only what you turned on.
Create one under **Scoped connections** on the dashboard's Connect page. For
each app, choose which of the accounts you linked to it the connection runs as,
or none for an app without accounts, and which tools it exposes: all tools, read-only tools, or the tools
you pick. All and read-only include tools the app adds later. Approval rules
still come from each app's code. A connection never lists the accounts linked to
an app for everyone: access to the app authorizes them.

Each connection has its own URL, the MCP address with `?connection=<id>` added: a
client that signs in there finds the connection already chosen. You can also
choose the connection when signing in at the plain MCP address. Either way the
grant follows the connection: edits apply to connected agents at once, and
revoking the connection revokes every grant issued through it. Personal access
tokens are not limited by a connection; they keep full
access at the plain URL and are refused at a connection's URL.

**Connected agents** on the same page lists each
client you approved, with the apps it can reach, and revokes its grant.

## Agent passes

An **agent pass** lets an agent that runs without a browser, such as one on a
sandbox computer, use a scoped connection. The connection's owner marks it as an
agent (`agent: true` when saving it); its ID is then the agent's identity, the
owner is who the agent acts for, and its apps, accounts and tools are all the
agent can reach.

A company owner or admin, using their own API key, or a **minting credential**
an admin created for the company, mints a pass:

```http
POST /api/organizations/<organization>/agents/<agent>/passes
Authorization: Bearer <admin API key or minting credential>
Content-Type: application/json

{ "expiresIn": 3600 }
```

The response holds `token`, `expiresAt`, `owner` and `mcpUrl`. Each call issues
a new pass, which expires within the hour (`expiresIn` is at most 3600 seconds,
the default). The token is returned once and stored only as a hash. The pass
works at the agent's own MCP URL, the MCP address with `?connection=<agent>`
added, and on the API, in
that company only. On every request it is checked against the connection
and the owner as they are now: editing the connection, narrowing the owner's
access, or removing the owner applies to the next request. Un-marking the agent,
or removing an app, tool or account from its connection, deletes its passes, so
restoring the connection does not bring them back. A tool marked as needing
approval fails for a pass, over MCP as on the API, because no person stands
behind it. Requests are recorded as the owner (`executor.user.id`) with the
agent named in `auth.agent.id`.

An agent holds at most five live passes, and one credential makes at most 60
mint requests a minute. Over either limit the response is a 429; try again
shortly. An agent connection cannot include the built-in `executor` app, a copy of it, or
any app that takes its account: those run with the owner's full
authority, so saving or minting answers 400, and a pass stops working if one of
its apps comes to need that account.

Admins create a minting credential from a browser session with
`POST /api/organizations/<organization>/agent-minters` and `{ "name": "…" }`.
An API key, an AI app's OAuth grant or a pass is refused (403): the credential
would outlive it. It
expires after 90 days, or after `expiresIn` seconds, at most a year. It mints and
revokes that company's passes and authorizes nothing else. It is deleted
for good when its creator stops being an owner or admin there. Any owner or admin
can list the company's credentials with
`GET /api/organizations/<organization>/agent-minters`, which shows who created
each and when it was last used, never its secret, and from a browser session
delete one with `DELETE …/agent-minters/<id>`. However a credential is deleted,
including when it expires and is cleared away, every pass it issued ends with
it. To revoke:

- one pass: delete it like any API key (it is listed under the owner's tokens);
- every pass of one agent: `POST …/agents/<agent>/passes/revoke`;
- every pass a minting credential issued: `POST …/agent-minters/<id>/passes/revoke`.

Revoking the connection also ends its passes.

Passes and minting credentials start with `exa_`; ordinary API keys start with
`exp_`.

Keep in mind:

- An app in an agent connection must never hold a OneDoor API key or minting
  credential as an account or secret. A full-access key pasted into an app's
  account gives the agent that key's authority, and OneDoor cannot see it. A
  pass alone cannot set this up.
- A mint racing the deletion of its minting credential, or its agent's
  un-marking or narrowing, can leave one pass alive for up to an hour.
- The account health check still answers a pass for an account linked to an app
  in its scope, even one outside its connection's runs-as list.
- The caps multiply: five live passes for each agent connection, and 60 mints a
  minute for each minting credential.

## Elicitation modes

When a tool needs an approval, or needs input, OneDoor has to ask you. Where
that question appears depends on the mode, which you choose when signing in and
which the grant then keeps. The sign-in page preselects `automatic` for the plain
MCP address, and the named mode for a URL with `elicitation_mode`.

| Mode | Added to the MCP address | Where you answer |
| --- | --- | --- |
| `automatic` | `?elicitation_mode=automatic` | Nowhere. OneDoor approves tool calls at once; your agent's own permission prompt for `call` or `execute` is the check. A question a running tool asks still reaches the agent, as in `model` mode. |
| `model` | nothing | The agent shows you the request and calls `resume` with your answer. |
| `native` | `?elicitation_mode=native` | Your MCP client's own prompt. The `call` or `execute` request stays open and continues. There is no `resume`. `call` approvals are the client's confirmation of the call itself. |
| `browser` | `?elicitation_mode=browser` | A signed-in page in your browser. The result carries an `approvalUrl`; the agent calls `resume({ requestId })` to collect your answer. |

Native mode needs a client that implements form elicitation. Browser mode is the
one to use when you do not want the agent to be the one holding the question.

The mode is part of the grant, not the URL. Changing the query string after
signing in does not change the mode. A personal access token has no grant, so it
takes its mode from the URL on each request: `model` at the plain MCP address.

## From a shell

The [`executor` command](/run/cli#use-your-tools-from-a-shell) calls the same
tools from a shell: `executor search`, `describe`, `call`, `execute`, `resume`
and `skills` each call the tool of the same name and print its result as JSON.
`executor login --host https://app.onedoor.team` signs it in through the browser,
where you choose which apps the sign-in reaches and its approval mode, as on the
consent screen. Always pass `--host`: without it the command signs in to a
different service. See [Command line](/run/cli).

`executor mcp` is a stdio MCP server that passes every message to the endpoint
of the host you signed in to, approvals and questions included, and renews the
sign-in as it runs:

```sh
claude mcp add onedoor -- executor mcp
```

Its instructions add that the `executor` command is available in the agent's
shell. A large result can then go to a file, with
`executor execute --file program.js > result.json`, instead of into the
agent's context.

## A lost session

A program cannot be resumed after the server restarts. A lost session cannot be
continued, and the program must not be run again automatically, because
earlier tool calls may already have taken effect.
