Confirm and security
A write tool never changes anything on the model’s say-so. It shows you a preview in your client’s confirm form (MCP elicitation) and makes exactly one admin call only if you accept.
How a change is confirmed
Section titled “How a change is confirmed”- The server checks local rules first (for example the env file for
create_key), then checks that the admin key has the scopes the tool needs. A missing scope fails here, with no preview and nothing changed. - It builds a preview from the current state (names, the intended change, and any warnings, such as a duplicate customer or a cap that is already used up).
- If you passed
dry_run: true, you get that preview back as a tool result. Nothing is asked, and nothing changes. - Otherwise the client shows you the preview. The form has one tick box, “Apply this change”, off by default. There is no
confirmargument on the tool: a value the model can set is not a confirmation. The signed state that comes back with your answer is a protocol field, not a tool input. - Only if you accept does the server send exactly one admin request, with an
Idempotency-Keyderived from that confirmation. That write is never retried, even on a timeout or a server error. - You get the result. For
create_keyandrotate_key, the secret has already been written to a local env file; the result contains the path, the masked key, and the key id, never the secret.
The confirmation is bound to this admin key, this tool, these arguments, this preview, a single-use nonce, and a 15-minute expiry. Both MCP protocol revisions this server supports (2025-11-25 and 2026-07-28) use the same flow.
What happens if you do not accept
Section titled “What happens if you do not accept”| What you do, or what happens | Result | What changed |
|---|---|---|
| You decline, leave the box unticked, or close the form | confirm_declined |
Nothing |
| The form sits for more than 15 minutes | confirm_expired |
Nothing |
| The same confirmation is submitted again | confirm_used |
Nothing |
| The preview no longer matches current state | stale_preview (the new preview is included) |
Nothing |
| The signed state is missing or does not match | confirm_invalid |
Nothing |
| The client cannot show a confirm form | confirm_unsupported |
Nothing. The write tools are still listed. There is no weaker “type this code” fallback. Use the console or a client that supports MCP elicitation. |
If the one admin call does not get a clear answer (a timeout, a network error, or a 5xx), the tool returns write_outcome_unknown. The confirmation is already consumed, and the server will not retry the write. Call list_changes before trying again — the change may or may not have applied.
Why it is built this way
Section titled “Why it is built this way”The model can call a write tool, but it cannot tick the box or forge a valid confirmation. One accepted form is one admin call, with an idempotency key that belongs to that form, so a retry in the client cannot apply a second, different change under the same confirmation. If the API ever reports that the key clashed with an earlier, different change, the tool returns internal_idempotency and tells you to start from a new preview.
Read-only mode
Section titled “Read-only mode”There are two separate switches. You can use both.
Hide the write tools. Set ORDAINER_MCP_READ_ONLY to true (also 1, yes, or on) in the server’s environment and restart. Write tools are not registered at all, so your client lists only the six read tools, and if something asks for a write tool anyway, the client reports that the tool is not available or was not found. Reads still work.
Give the agent a watch-only admin key. In Console → Keys, under Admin keys at the bottom, create a key with only usage:read. The write tools still appear (unless the flag above is on), but each write fails with missing_scope before a preview, and nothing changes. list_customers still works with usage:read. Switching a plan to enforce needs plans:mode; plans:write is not enough. Rotating a key needs keys:write and keys:revoke.
A good default for an agent you want only to watch is both: a usage:read key, and ORDAINER_MCP_READ_ONLY=true.
Where secrets live
Section titled “Where secrets live”| Secret | Where it lives | Who sees it |
|---|---|---|
The admin key (ord_admin_…) |
The MCP client’s environment (ORDAINER_ADMIN_KEY) |
You, and the server process. Never a tool argument, never a result, never a log line (it is masked). Do not put it in a file the agent reads, a committed mcp.json, or a Cursor install link. |
A new test key (ord_test_…) |
A local env file (mode 0600), as ORDAINER_KEY or ORDAINER_KEY_<LABEL> |
You, on disk. The agent gets the file path, ord_test_…last4, and the key id. |
| The confirm token | Memory in this server process, HMAC-signed, single use, 15 minutes | The MCP client, as protocol state, not as a tool argument. |
Rules for the env file:
- Default file is
.env, inside the folder the server was started in. The name must be.env,.env.*, or*.env. It cannot be an absolute path or a path outside that folder. The target file cannot be a symlink. A directory symlink to a safe name inside the working folder is allowed; the write goes to the real path. - A file that already has the variable is never overwritten by
create_key(env_key_exists). Name another variable (env_label) or another file (env_file). rotate_keyreplaces a line only if it holds the key being rotated; otherwiseenv_key_mismatch.- The file is checked before any admin call. A problem there creates nothing.
- A name that contains a control or invisible character is refused as
env_file_invalidbefore any key is created. The same check runs on the real path resolved through a symlink. - If the write still fails after the admin call, the key exists:
env_write_failedincludes the key id and the secret is discarded, never shown. Revoke that key in the console or runrotate_keyon it. Onrotate_key, the old key is already revoked and the new secret is lost, so rotate the new key id again. - An existing env file keeps its other lines, quotes, and comments, but its line endings are normalised to LF and its mode is forced to 0600.
- The result warns if
.gitignoredoes not cover the file. - The server will not write an agent key into a file that already holds
ORDAINER_ADMIN_KEY. - Anything that looks like a full key is masked in every result and log.
Security model
Section titled “Security model”- Test keys and test data only. Live keys are never listed, created, rotated, or changed. A plan that has a live key cannot be changed here (
live_key_refused). - Least privilege. Create the admin key with only the scopes the agent needs. Revoke it in the console to cut the agent off at once; the next call answers
auth_failed. - No delete tool. Soft-deleting a customer, or revoking a key without rotating it, is done in the console.
- Fail closed on a bad API URL. A typo in
ORDAINER_BASE_URLdoes not fall back to production. A value that contains a query string (?), a#fragment, or a control character is refused, including a trailing bare?or#. Percent-encoded%3Fand%23in the path are allowed. Every tool answersconfig_invalidand no request is made, so the admin key is not sent to a host you did not mean. - Fail closed on a bad console URL. If you set
ORDAINER_CONSOLE_URL, it must be a validhttps://address (orhttp://only forlocalhost,127.0.0.1, or[::1]). User names, passwords, a query string (?), a#fragment, spaces, backslashes, control or invisible characters, and values longer than 2,048 characters are refused. Trailing slashes are removed, and the link uses the address as parsed (case and a default:443are normalised). Any other value is a configuration error: it is logged at start, every tool answersconfig_invalid, and no request is made. It never falls back to the default. Unset or blank uses the derived default. - The admin key is only sent to the configured origin. Redirects are never followed.
- Writes are not retried. Reads retry once on a network error, a timeout, or a 5xx, and never return empty data that looks like success. Reads are also throttled locally (5 per second, burst 10); a write is never delayed by that throttle.
- Names, labels, and env file paths are data, not instructions. Results say so. Values shown to you in a preview (and in results) are quoted, with line breaks, control characters, and invisible characters escaped, including Unicode Tags, format characters, Default_Ignorable characters, and blank fillers. A hostile name cannot fake a new line in the preview (for example a line that looks like “Preview approved”) or hide text.
- Do not run this server against a host you do not trust, and be careful when this client also has other MCP servers: tool results from one server can influence the model when it calls another.
Limits you should know
Section titled “Limits you should know”- Lists return at most 100 rows per call, with a
next_cursor. - Usage counts are for the current period and can lag a moment behind the most recent call.
- Pre-release: the packages
@modelcontextprotocol/serverandzodare pinned to the versions tested with this server. Node 20 or later is required.