# MCP

> Connect Claude, ChatGPT, Claude Code, Cursor or another MCP client to MDRN, choose the workspace and what it may change, including databases, and revoke it.
> Source: https://mdrn.io/docs/mcp/

After this page an assistant you already use reads your workspaces, projects, products, deployments, builds, logs, databases, stored files, sent mail, sign-in settings, usage and bill, and makes the twenty-two changes below for you, as far as you allowed it and nothing more. You can revoke it at any time. MDRN's MCP server runs in two ways: hosted at `https://mcp.mdrn.io/mcp`, where the assistant signs in with MDRN, or on your own machine, where it uses the CLI's sign-in. To deploy, the assistant uses the [CLI](/docs/cli/) (`npx @mdrnio/cli deploy`): the server tells it so when it connects.

## What an assistant can do

Every read is a tool annotated `readOnlyHint`. The twenty-two changes below are the only writes. **None deletes a deployment, a product or a domain.** Five can take away something that cannot be brought back, and are annotated `destructiveHint`: deleting a stored file (it can be restored until it is purged); shortening or turning off Postgres restore history drops the history beyond the new window; SQL can change or delete data; a restore replaces the database it names (MDRN keeps a copy of what it replaces: for SQLite a snapshot kept 7 days, for Postgres until your next restore, which you get back by [contacting support](mailto:support@mdrn.io)); and turning the connection string off, stopping the previous one or rotating without a redeploy cuts off a deployment still running with the old string until it is deployed again. The assistant is told to ask you before calling one, and a restore needs `confirmOverwrite: true`. MDRN's own tables (`_mdrn_*`) are never queried or listed. Adding a custom domain, opening checkout, and writing records are not offered, and the server never reads a secret's value: `mdrn_list_variables` answers a plain variable's value, as the console and the CLI do, and a secret's never. If MDRN refuses something because of a limit or a feature that comes with going live, the assistant tells you instead of working around it.

| Change | Tool | Scope it needs |
| --- | --- | --- |
| Create a project in a workspace, with its sandbox and production environments and every product on. | `mdrn_create_project` | `project:write` |
| Turn a product back on for a project, in sandbox and production at once (each keeps its own data). | `mdrn_enable_product` | the product's write scope |
| Turn a product off for a project, in sandbox and production at once. | `mdrn_disable_product` | the product's write scope |
| Create an empty deployment in a project environment. | `mdrn_create_deployment` | `deploy:write` |
| Give a deployment another name, such as app to shop; its address stays. | `mdrn_rename_deployment` | `deploy:write` |
| Build and put live what a deployment's connected GitHub branch holds now, as a push would. | `mdrn_deploy_from_github` | `deploy:write` |
| Deploy one of MDRN's example apps into a deployment, built as an upload. | `mdrn_deploy_example` | `deploy:write` |
| Put an earlier build of a deployment back live, by its artifactId from mdrn_list_builds. | `mdrn_roll_back` | `deploy:write` |
| Set an environment variable on a deployment. | `mdrn_set_variable` | `deploy:write` |
| Remove an environment variable from a deployment; the serving build is put live again without it. | `mdrn_unset_variable` | `deploy:write` |
| Delete a deployment's build cache: its next build downloads and compiles everything again. | `mdrn_clear_build_cache` | `deploy:write` |
| Turn a deployment's auto cache on or off: pages without their own caching headers are reused for 10 seconds for visitors who aren't signed in. | `mdrn_set_auto_cache` | `deploy:write` |
| Set how far back Postgres can be restored: 0 turns it off, or 1, 7 or 30 days. | `mdrn_set_database_restore_history` | `database:write` |
| Run one SQL statement on the environment's SQLite or Postgres database, in its dialect, and answer the rows. | `mdrn_run_sql` | `database:write` |
| Change the Postgres connection string: on turns it on and rotate makes a new one (both answer it once), off stops it for good, stop_previous stops the string a rotation replaced. | `mdrn_database_connection` | `database:write` |
| Restore the environment's SQLite or Postgres database to an earlier state: timestamp (an ISO 8601 moment in the restore window) or, for SQLite, backupId (from mdrn_list_database_backups). | `mdrn_restore_database` | `database:write` |
| Store a file in an environment's Objects: text, or base64 for anything else, at most 4 MiB. | `mdrn_upload_object` | `objects:write` |
| Delete a stored file. | `mdrn_delete_object` | `objects:write` |
| Send one plain test email through the environment's Mail, as the app would, to see that mail works. It counts like any email the app sends: metered, and toward the hourly, daily and build-mode limits. | `mdrn_send_test_email` | `mail:send` |
| Choose the address an environment's mail leaves from on one of its mail domains, such as orders@example.com (noreply@ until chosen). | `mdrn_set_mail_address` | `mail:write` |
| Set who must sign in to one deployment: everyone (everyone must sign in, except on publicPaths such as / or /pricing, each matched exactly, with no wildcards or prefixes), app_decides (the app asks MDRN who is signed in and decides), or off. | `mdrn_set_sign_in` | `auth:write` |
| Change how the hosted sign-in page, account page and notices look: name, logo, browser tab icon, colours, layouts, wording and links. | `mdrn_set_auth_branding` | `auth:write` |

Every change carries an idempotency key, so a retried change is applied once. A change the connection may not make is refused before anything is sent to MDRN, with `insufficient_scope` and what is missing. The connection reaches only the environments you ticked under **Where?** (`sandbox:access`, `production:access`): one left unticked is neither read nor changed. A change in Production also needs `production:write`, which the approval page gives when Production is ticked and the assistant may write. A product switched on or off changes both environments, so it needs both ticked and `production:write`. Whatever the assistant can read, it can repeat to you or keep in its conversation: allow only what it needs.

## Connect the hosted server

Add `https://mcp.mdrn.io/mcp` to the assistant as a custom connector. The assistant opens MDRN's sign-in, then the approval page, headed with the assistant's name ("Claude Code wants to connect to MDRN"): pick **one** workspace and answer two questions. **What can it do?** Read, or Read and write (the default); **Choose per product** sets each product to Nothing, Read or Read and write instead. **Where?** Sandbox (ticked at first), Production, or both: it reaches nothing in an environment left unticked, not even to read. A sentence above the questions, and the Approve button, say what it gets ("Allow read and write in Sandbox"). Below the questions the page names the host the answer is sent to (for Claude, `claude.ai`): the name in the heading is the app's own, so approve only if you expect that address. Approve, and it is connected; Deny, and it gets nothing (`access_denied`).

| Client | How |
| --- | --- |
| Claude.ai and Claude Desktop | **Settings, Connectors, Add custom connector**, with the address below |
| ChatGPT | **Settings, Connectors** (developer mode), **Create**, with the address below and OAuth as the authentication |
| Claude Code | The command below, then `/mcp` to sign in |

```text
https://mcp.mdrn.io/mcp
```

```sh
claude mcp add --transport http mdrn https://mcp.mdrn.io/mcp
```

A connection never gets `billing:write`, `team:write`, `workspace:write` or `project:delete`, and never more than your own role allows. Every call is checked against your current role again, so a connection does no more than you could in the console. The hosted server takes only a key approved for it, or a [management token](/docs/tokens/); a key another app was given, such as the CLI's from `mdrn login`, is refused there. Disconnect it under **Workspace, Tokens, Connected apps**.

## Deploying goes through the CLI

The MCP tools read your workspace and make the changes below; they do not upload your code. The server's instructions tell the agent to install the CLI, sign in and deploy with it, and to read the CLI's own help and these docs for the details:

```sh
npm install -g @mdrnio/cli
```

The agent then runs `mdrn login`, `mdrn link` and `mdrn deploy` in your app's directory, as the [Quickstart](/docs/quickstart/) does. When it meets a build mode limit or something that comes with going live, it tells you instead of working around it: going live, a custom domain and anything else that changes what you pay are yours to decide.

## Run the server on your own machine

The same tools run locally, over standard input and output, with the sign-in you made with the [CLI](/docs/cli/#sign-in). The server needs Node.js 20 or later; `npx -y @mdrnio/mcp-server` fetches it on first use and runs it, so there is nothing else to install. Sign in once with `mdrn login`, or set `MDRN_API_TOKEN` to a [management token](/docs/tokens/), which wins when both are present.

```sh
npm install -g @mdrnio/cli && mdrn login
```

Claude Desktop (`claude_desktop_config.json`, under **Settings, Developer, Edit Config**) and Cursor (`.cursor/mcp.json` in the project, or `~/.cursor/mcp.json` for every project) take the same entry:

```json
{
  "mcpServers": {
    "mdrn": {
      "command": "npx",
      "args": ["-y", "@mdrnio/mcp-server"]
    }
  }
}
```

On Windows, a client that starts the command itself rather than through a shell needs `npx` run through `cmd`:

```json
{
  "mcpServers": {
    "mdrn": {
      "command": "cmd",
      "args": ["/c", "npx", "-y", "@mdrnio/mcp-server"]
    }
  }
}
```

Claude Code takes one command:

```sh
claude mcp add mdrn -- npx -y @mdrnio/mcp-server
```

With `mdrn login`, the server uses the CLI profile (`MDRN_PROFILE`, or `default`) and renews the sign-in as the CLI does, so `mdrn logout` ends this server's access too, and a server started before `mdrn login` picks the sign-in up on its next call. With a management token, add `"env": { "MDRN_API_TOKEN": "<mdrn_mgmt_token>" }` to the entry, or for Claude Code `claude mcp add mdrn -e MDRN_API_TOKEN=<mdrn_mgmt_token> -- npx -y @mdrnio/mcp-server`. The local server has no approval page: a management token's own scopes, or with `mdrn login` your full access as your role allows, are what it has.

## The tools

`environmentId` is `sandbox` or `production`; `product` is `objects`, `sqlite`, `postgres`, `mail`, `logs` or `auth`; `database` is `sqlite` or `postgres`; `deploymentId` is a deployment from `mdrn_list_deployments`. Products belong to the project: a new project starts with every product on, the product tools take no `environmentId` (one given is refused), and a change applies in Sandbox and Production at once. A tool refuses an argument it does not know. Every write takes an optional `idempotencyKey`: repeat it to retry safely, or leave it out for a fresh one per call.

| Tool | Arguments | What it does | Scope |
| --- | --- | --- | --- |
| `mdrn_list_workspaces` | optional `cursor` | List the workspaces you can reach, with your role in each. | `workspace:read` |
| `mdrn_list_projects` | `workspaceId` | List the projects of a workspace. | `project:read` |
| `mdrn_create_project` | `workspaceId`, `name`, optional `idempotencyKey` | **Write**: Create a project in a workspace, with its sandbox and production environments and every product on. | `project:write` |
| `mdrn_list_products` | `projectId` | Show which products a project has on (sqlite, postgres, objects, mail, logs, auth) and each one's state in sandbox and production. | `project:read` |
| `mdrn_enable_product` | `projectId`, `product`, optional `idempotencyKey` | **Write**: Turn a product back on for a project, in sandbox and production at once (each keeps its own data). | the product's write scope |
| `mdrn_disable_product` | `projectId`, `product`, optional `idempotencyKey` | **Write**: Turn a product off for a project, in sandbox and production at once. | the product's write scope |
| `mdrn_get_operation` | `operationId` | Check a change that takes a while (a product turned on or off): its state is accepted or running until it is succeeded or failed. | `operation:read` |
| `mdrn_get_billing` | `workspaceId` | Read the workspace's plan, whether it is in build mode, its credit and invoices. | `billing:read` |
| `mdrn_get_usage` | `workspaceId`, optional `periodId` | Read what the workspace used this period (or periodId), per meter. | `usage:read` |
| `mdrn_list_deployments` | `projectId`, `environmentId` | List the deployments of a project environment: each serves one app at its own address (hostname). | `deploy:read` |
| `mdrn_create_deployment` | `projectId`, `environmentId`, `name`, optional `idempotencyKey` | **Write**: Create an empty deployment in a project environment. | `deploy:write` |
| `mdrn_rename_deployment` | `projectId`, `environmentId`, `deploymentId`, `name`, optional `idempotencyKey` | **Write**: Give a deployment another name, such as app to shop. | `deploy:write` |
| `mdrn_list_builds` | `projectId`, `environmentId`, `deploymentId`, optional `cursor` | List a deployment's builds, newest first: its history. | `deploy:read` |
| `mdrn_get_build` | `projectId`, `environmentId`, `buildId` | Read one build: its steps, state and artifact. | `deploy:read` |
| `mdrn_get_build_logs` | `projectId`, `environmentId`, `buildId`, optional `cursor` | Read a build's output, while it runs or after. | `deploy:read` |
| `mdrn_get_rollout` | `projectId`, `environmentId`, `rolloutId` | Follow a build being put live (the rolloutId a build or mdrn_roll_back answers): accepted, publishing or verifying until it is ready or failed. | `deploy:read` |
| `mdrn_deploy_from_github` | `projectId`, `environmentId`, `deploymentId`, optional `idempotencyKey` | **Write**: Build and put live what a deployment's connected GitHub branch holds now, as a push would. | `deploy:write` |
| `mdrn_deploy_example` | `projectId`, `environmentId`, `deploymentId`, `example`, optional `idempotencyKey` | **Write**: Deploy one of MDRN's example apps into a deployment, built as an upload. | `deploy:write` |
| `mdrn_roll_back` | `projectId`, `environmentId`, `deploymentId`, `artifactId`, optional `idempotencyKey` | **Write**: Put an earlier build of a deployment back live, by its artifactId from mdrn_list_builds. | `deploy:write` |
| `mdrn_list_variables` | `projectId`, `environmentId`, `deploymentId` | List a deployment's environment variables: name, whether it is secret, whether its builds get it too, and when it was last set; a plain variable's value comes with it, a secret's never does. | `deploy:read` |
| `mdrn_set_variable` | `projectId`, `environmentId`, `deploymentId`, `name`, `value`, optional `secret`, `build`, `idempotencyKey` | **Write**: Set an environment variable on a deployment. | `deploy:write` |
| `mdrn_unset_variable` | `projectId`, `environmentId`, `deploymentId`, `name`, optional `idempotencyKey` | **Write**: Remove an environment variable from a deployment; the serving build is put live again without it. | `deploy:write` |
| `mdrn_clear_build_cache` | `projectId`, `environmentId`, `deploymentId`, optional `idempotencyKey` | **Write**: Delete a deployment's build cache: its next build downloads and compiles everything again. Refused while a build of the deployment is running. | `deploy:write` |
| `mdrn_set_auto_cache` | `projectId`, `environmentId`, `deploymentId`, `enabled`, optional `idempotencyKey` | **Write**: Turn a deployment's auto cache on or off: pages without their own caching headers are reused for 10 seconds for visitors who aren't signed in. | `deploy:write` |
| `mdrn_list_domains` | `projectId`, `environmentId` | List an environment's custom domains with their DNS records and state; a host's error is in MDRN's words. | `deploy:read` |
| `mdrn_list_owned_domains` | `projectId`, `environmentId` | List the environment's own domains (such as example.com) and what answers under each: the hosts serving a deployment or the downloads, and the mail senders, each with its state; mail is read with `mail:read` when the connection has it. | `deploy:read` |
| `mdrn_set_mail_address` | `projectId`, `environmentId`, `address`, optional `idempotencyKey` | **Write**: Choose the address an environment's mail leaves from on one of its mail domains, such as orders@example.com (noreply@ until chosen). | `mail:write` |
| `mdrn_open_app` | `projectId`, `environmentId`, `deploymentId` | Get a link that opens a deployment's app at its own address, signed in as the person. | `deploy:read` |
| `mdrn_search_logs` | `projectId`, `environmentId`, optional `q`, `level`, `from`, `to`, `deploymentId`, `cursor` | Search an environment's application logs (requests, console lines, errors), newest first. | `deploy:read` |
| `mdrn_get_request_logs` | `projectId`, `environmentId`, `traceId`, optional `from`, `to` | Read everything one request logged, across the environment's deployments, by its trace id (a search result's traceId); from and to are Unix milliseconds, the last hour when left out. | `deploy:read` |
| `mdrn_get_database_config` | `projectId`, `environmentId`, `database` | Read one environment's SQLite or Postgres database: state, created (false for a Postgres database not made yet), revision, restore window and history, and the Postgres connection string's role and host (the host only for an Admin or Developer; never its password). | `database:read` |
| `mdrn_list_collections` | `projectId`, `environmentId`, `database` | List the database's collections (what the app stores through the SDK's records API) by name, each with its record count up to 1000. | `database:read` |
| `mdrn_list_records` | `projectId`, `environmentId`, `database`, `collection`, optional `limit`, `cursor` | List one page of a collection's records, by id, each with its data and version. | `database:read` |
| `mdrn_get_record` | `projectId`, `environmentId`, `database`, `collection`, `recordId` | Read one record of a collection, with its data and version. | `database:read` |
| `mdrn_list_database_backups` | `projectId`, `environmentId`, `database` | List the snapshots the SQLite database can be restored to (taken before every restore and deletion, kept 7 days). | `database:read` |
| `mdrn_get_database_operation` | `projectId`, `environmentId`, `database`, `operationId` | Check a database restore or deletion: accepted or running until it is succeeded or failed. | `database:read` |
| `mdrn_set_database_restore_history` | `projectId`, `environmentId`, `database`, `restoreHistoryDays`, optional `idempotencyKey` | **Write**, destructive: Set how far back Postgres can be restored: 0 turns it off, or 1, 7 or 30 days. | `database:write` |
| `mdrn_run_sql` | `projectId`, `environmentId`, `database`, `sql`, optional `params`, `idempotencyKey` | **Write**, destructive: Run one SQL statement on the environment's SQLite or Postgres database, in its dialect, and answer the rows. | `database:write` |
| `mdrn_database_connection` | `projectId`, `environmentId`, `database`, `action`, optional `redeploy`, `idempotencyKey` | **Write**, destructive: Change the Postgres connection string: on turns it on and rotate makes a new one (both answer it once), off stops it for good, stop_previous stops the string a rotation replaced. | `database:write` |
| `mdrn_restore_database` | `projectId`, `environmentId`, `database`, `confirmOverwrite`, optional `timestamp`, `backupId`, `idempotencyKey` | **Write**, destructive: Restore the environment's SQLite or Postgres database to an earlier state: timestamp (an ISO 8601 moment in the restore window) or, for SQLite, backupId (from mdrn_list_database_backups). | `database:write` |
| `mdrn_list_objects` | `projectId`, `environmentId`, optional `limit`, `cursor` | List an environment's stored files (Objects), newest first: id, filename, size, content type and state. | `objects:read` |
| `mdrn_get_object_link` | `projectId`, `environmentId`, `objectId` | Get a download link for one stored file. | `objects:read` |
| `mdrn_upload_object` | `projectId`, `environmentId`, `filename`, optional `contentType`, `text`, `base64`, `idempotencyKey` | **Write**: Store a file in an environment's Objects: text, or base64 for anything else, at most 4 MiB. | `objects:write` |
| `mdrn_delete_object` | `projectId`, `environmentId`, `objectId`, optional `idempotencyKey` | **Write**, destructive: Delete a stored file. | `objects:write` |
| `mdrn_list_mail_messages` | `projectId`, `environmentId`, optional `status`, `cursor` | List the emails an environment's app sent, newest first: id, status (queued, sending, accepted, delivered, bounced, complained, failed), recipient, subject and when. | `mail:read` |
| `mdrn_get_mail_message` | `projectId`, `environmentId`, `messageId` | Read one sent email whole: status, why it failed or bounced, its timeline, and the body while it is still kept. | `mail:read` |
| `mdrn_send_test_email` | `projectId`, `environmentId`, `to`, optional `idempotencyKey` | **Write**: Send one plain test email through the environment's Mail, as the app would, to see that mail works. It counts like any email the app sends: metered, and toward the hourly, daily and build-mode limits. | `mail:send` |
| `mdrn_get_auth_settings` | `projectId`, `environmentId` | Read who must sign in to each deployment of an environment (signIn: everyone must sign in except on its publicPaths, the app decides, or off), the account page your users manage themselves on, and the sign-in session limits. | `auth:read` |
| `mdrn_set_sign_in` | `projectId`, `environmentId`, `deploymentId`, `mode`, optional `publicPaths`, `idempotencyKey` | **Write**: Set who must sign in to one deployment: everyone (everyone must sign in, except on publicPaths such as / or /pricing, each matched exactly, with no wildcards or prefixes), app_decides (the app asks MDRN who is signed in and decides), or off. | `auth:write` |
| `mdrn_get_auth_branding` | `projectId`, `environmentId` | Read how an environment's hosted sign-in page, account page and notices look: name, logo, icon, colors, layout and accountLayout, copy and links. An uploaded picture is described by its type and size. | `auth:read` |
| `mdrn_set_auth_branding` | `projectId`, `environmentId`, optional `name`, `logo`, `icon`, `primaryColor`, `backgroundColor`, `textColor`, `surfaceColor`, `layout`, `accountLayout`, `copy`, `terms`, `privacy`, `remove`, `idempotencyKey` | **Write**: Change how an environment's hosted sign-in page, account page and notices look; only the fields given change. `logo` and `icon` take an https address or a `data:image/…;base64,` picture (at most 512 KB); `icon` also a path on your app such as `/favicon.svg`. The assistant asks you before changing what visitors see. | `auth:write` |
| `mdrn_list_auth_users` | `projectId`, `environmentId`, optional `email`, `cursor` | List the app's users (the people who signed in to it), newest first: id, email, name, whether disabled, when created and last signed in. | `auth:read` |
| `mdrn_export_auth_users` | `projectId`, `environmentId`, optional `cursor`, `limit` | Export the app's users a page at a time in id order, with every sign-in method and the subject ID its provider knows each by, to move them to another system. | `auth:read` |
| `mdrn_read_api` | `path`, optional `projectId`, `environmentId` | Read an MDRN API page no other tool covers, by its path: the workspaces, projects, usage, an operation, the products, billing, the deployments, domains, a rollout or a request's logs. | the route's |

### What to call next

The answers of the main flows carry `nextSteps`: what the assistant can do now, each with a `step` saying what and why, and either a `tool` to call with the `arguments` known so far, or a `url` to open. For example, after `mdrn_enable_product` while the change still runs:

```json
"nextSteps": [
  { "step": "sandbox is still changing: read its operation again shortly", "tool": "mdrn_get_operation", "arguments": { "operationId": "<operation_id>" } },
  { "step": "See the product states", "tool": "mdrn_list_products", "arguments": { "projectId": "<project_id>" } }
]
```

A refused call ends with `Next:` lines instead: the section of [Errors](/docs/errors/) for its code, and, when the workspace has no plan (`402 PAYMENT_REQUIRED` or `402 PRODUCT_ENTITLEMENT_REQUIRED`), that it needs the $25 plan, which an Admin goes live on from the console's go-live screen, with its link (`https://console.mdrn.io/go-live`); in [build mode](/docs/billing/#build-mode), at one of its limits (`402 BUILD_LIMIT_REACHED`), asking for what it does not include (`402 BUILD_MODE_GO_LIVE_REQUIRED`, Postgres among it) or calling an app only the workspace's members can open (`NOT_LIVE_YET`, which also names `mdrn_open_app`), that an Admin goes live there; and for build-mode mail to an address that is not a workspace member's (`403 BUILD_MAIL_RECIPIENT`), to send to a member or go live. The assistant tells you rather than working around it.

## What a connection may do

The approval page offers Read or Read and write, for every product or per product (Nothing, Read, Read and write), in Sandbox, Production or both; your role caps them (a Viewer gives Read only). Under it they are these scopes. The four a connection never gets are `billing:write`, `team:write`, `workspace:write` and `project:delete`.

| Scope | Lets the assistant |
| --- | --- |
| `workspace:read` | List your workspaces |
| `project:read` | List projects and read product state |
| `project:write` | Create a project |
| `operation:read` | Follow a long-running operation |
| `usage:read` | Read metered usage |
| `billing:read` | Read the plan, credit and invoices |
| `deploy:read` | Read deployments, builds, build output, variables (a plain one's value, never a secret's), domains and application logs |
| `deploy:write` | Deploy from GitHub, roll back, set or remove a variable, create a deployment |
| `database:read` | Read the configuration, collections, records, snapshots and operations of the SQLite and the Postgres database |
| `database:write` | Changes to your data: run SQL, restore, set restore history, change the connection string, switch SQLite or Postgres on or off |
| `objects:read` | List stored files and get a download link |
| `objects:write` | Store or delete a file, switch Objects on or off |
| `mail:read` | Read the mail the app sent |
| `mail:send` | Send a test email |
| `auth:read` | Read who must sign in to each deployment, and the app's users |
| `auth:write` | Set who must sign in, switch Auth on or off |
| `mail:write`, `logs:write` | Switch that product on or off |
| `sandbox:access` | Reach Sandbox at all, to read or change |
| `production:access` | Reach Production at all, to read or change |
| `production:write` | Make any of the changes above in Production, and switch a product on or off |

A connection made before the approval page asked where holds neither `sandbox:access` nor `production:access`, and reaches both environments as it always did.

### What reaches the assistant's conversation

Every tool's answer goes into the assistant's conversation, and so into whatever the assistant keeps or shares. Some answers carry secrets or personal data:

| Tool | What its answer holds |
| --- | --- |
| `mdrn_open_app` | A link that signs a browser in to your app for 8 hours (it works for 15 minutes) |
| `mdrn_get_object_link` | A download link for a stored file, which works for anyone who has it while it lasts |
| `mdrn_database_connection` | The Postgres connection string with its password, once |
| `mdrn_export_auth_users`, `mdrn_list_auth_users` | Your app users' email addresses, names and sign-in subjects |
| `mdrn_get_mail_message` | A sent email's recipient and body |
| `mdrn_set_variable` | The value you set goes in as the tool's argument |

Data your app stores (records, log lines, emails) can also hold text written to steer an assistant. Connect with Read unless the assistant needs to change something, give it Production only when it must work there, and keep its transcript out of public places.

## How long a connection lasts, and revoking it

| Rule | Value |
| --- | --- |
| The key the assistant holds | 1 hour, renewed by the assistant on its own |
| A connection without use | Ends after 30 days |
| Where it is listed | The console, **Workspace, Tokens, Connected apps**, with its workspace, what it may do and last use |
| **Revoke** | Ends it at once: the assistant's next call is answered `401 invalid_token` and it asks you to sign in again |

Removing you from the workspace, deleting your account or closing the workspace ends your connections too. A local server ends with `mdrn logout`, or when the management token is revoked under **Workspace, Tokens**.

## Errors

The hosted server takes 300 requests a minute from one IP address; past that it answers HTTP `429` with `Retry-After: 60` ([Limits](/docs/limits/#rate-limits)).

Every refusal from MDRN reaches the assistant with its code from [Errors](/docs/errors/#tools); `access_denied`, `invalid_token`, `invalid_grant` and `insufficient_scope` are the four of the connection itself. A request to MDRN times out after 10 seconds and a redirect is never followed.
