# Adding the Sandscale MCP server to Codex: config.toml, OAuth login and approval modes

> Configure the remote or local Sandscale MCP server in OpenAI Codex, sign in with codex mcp login, and use enabled_tools, approval modes and tool timeouts to match what each tool does.

Configure the remote or local Sandscale MCP server in OpenAI Codex, sign in with codex mcp login, and use enabled_tools, approval modes and tool timeouts to match what each tool does.

November 27, 2026 · 4 min read · The Sandscale team

Codex runs commands in your working copy. Pointing it at the Sandscale MCP server gives it a separate place to run the commands you would rather keep off your machine: each sandbox is its own Firecracker microVM, with the network your plan and your organization’s policy allow, and every call lands in your organization’s audit log.

This guide uses Sandscale’s [Quickstart](https://sandscale.dev/docs/quickstart), [Connect Claude or ChatGPT guide](https://sandscale.dev/docs/guides/connect-claude-chatgpt) and [MCP tools reference](https://sandscale.dev/docs/reference/mcp) for the Sandscale side, and OpenAI’s [Codex MCP documentation](https://developers.openai.com/codex/mcp) for the Codex side, as of November 2026. The Sandscale Quickstart says Codex connects by adding a remote MCP server with the same address as other clients; the exact Codex syntax below is from the Codex docs.

## The remote server in config.toml

Codex keeps MCP configuration in `~/.codex/config.toml`, or in a project’s `.codex/config.toml` for trusted projects. Each server is a `[mcp_servers.<name>]` table. For the remote Sandscale server:

```toml
[mcp_servers.sandscale]
url = "https://mcp.sandscale.dev/mcp"
```

No token goes in the file. Sandscale’s remote server uses OAuth, and Codex’s default `auth` for HTTP servers is stored MCP OAuth credentials. Sign in once:

```bash
codex mcp login sandscale
```

Codex opens the authorization URL. Sandscale’s sign-in page asks you to approve the app; the approval page names it and says it is not made by Sandscale. After that, each tool call runs as you, with a short-lived credential that never leaves Sandscale’s server.

On a machine without a browser, such as a remote dev box, use `codex mcp login sandscale --no-browser`. Codex prints the URL; open it anywhere, sign in, then paste the full redirect URL back into the terminal, even if the browser could not load the callback page.

`codex mcp list` shows configured servers, and `/mcp` inside the Codex TUI shows the active ones. In the IDE extension, the MCP servers screen marks servers that need OAuth and has an Authenticate button.

## Restrict and gate the tools

The remote server has 15 tools. Codex lets you shape them per server with `enabled_tools`, `disabled_tools` and approval modes, which is a good fit because the Sandscale reference marks which tools change things.

A configuration for a coding agent that should run commands in throwaway sandboxes but leave workspaces and storage alone:

```toml
[mcp_servers.sandscale]
url = "https://mcp.sandscale.dev/mcp"
enabled_tools = [
  "sandbox_list",
  "sandbox_create",
  "sandbox_run",
  "sandbox_upload_file",
  "sandbox_download_file",
  "sandbox_snapshot",
  "sandbox_stop",
]
default_tools_approval_mode = "writes"

[mcp_servers.sandscale.tools.sandbox_stop]
approval_mode = "prompt"
```

What each piece does, per the Codex docs:

- `enabled_tools` is an allow list. Tools not on it are not offered to the model. Here that removes `workspace_start`, `workspace_stop`, the storage tools, `vault_list_secrets` and pause and resume.
- `default_tools_approval_mode = "writes"` prompts for any tool not marked read-only. The other values are `auto`, `prompt` and `approve`.
- The per-tool table sets `sandbox_stop` to always prompt. On the remote server, stopping a sandbox deletes its disk, and the reference marks that as not undoable. A prompt is a cheap check that the agent is stopping the sandbox it made.

If you trust the task more, move `sandbox_run` and `sandbox_upload_file` to `auto` with their own `tools.<name>` tables and keep the prompt on stop.

## Mind the tool timeout

Codex gives each MCP tool call a time limit, `tool_timeout_sec`, whose default value is 60 (it is in seconds). A sandbox command such as a full test suite or a dependency install can run longer than that, and if the client gives up first the agent sees a timeout even though the command may still be running in the sandbox.

Raise it for this server by adding a line to the same table:

```toml
[mcp_servers.sandscale]
url = "https://mcp.sandscale.dev/mcp"
tool_timeout_sec = 600
```

Keep the sandbox’s own limits in mind too. A sandbox stops by itself when its time limit runs out, so the agent should not assume a box it started an hour ago is still there; `sandbox_list` will tell it.

## The local server instead

The Sandscale [CLI](https://sandscale.dev/cli) includes `sandscale mcp`, a stdio server that uses your CLI sign-in. After `sandscale login`, add it with the Codex CLI:

```bash
codex mcp add sandscale-local -- sandscale mcp
```

or in `config.toml`:

```toml
[mcp_servers.sandscale-local]
command = "sandscale"
args = ["mcp"]
```

The local server has 13 tools with different names: `sandbox_start`, `sandbox_exec`, `sandbox_stop`, `sandbox_show`, the workspace tools, and read-only build host and lab host tools. Its reference says signing in, the vault and deleting anything are not offered as tools, `sandbox_start` gives a sandbox no network unless asked, and `sandbox_exec` takes an optional `timeout_seconds`. `sandscale mcp connect` prints the recommended setup for each client. The [remote vs local post](https://sandscale.dev/blog/remote-vs-local-sandscale-mcp-server) compares the two servers.

## What Sandscale enforces on its side

Codex settings decide what the model may call without asking. They do not decide what is allowed. Sandscale applies its own checks to every call, from any client:

- The same API, roles, plan limits and policy as the console and SDK. A refusal comes back with the API’s error code, which the model can read and report.
- An audit log entry for every remote MCP call with the tool, region, outcome and app, never the arguments.
- Up to 120 calls a minute per app and 60 per person.
- The United States region only for now on the remote server; another region is refused with `region_unavailable`.
- No Vault values to the model. `vault_list_secrets` returns names only, and no Sandscale MCP tool returns values.

## Revoking access

To disconnect, remove the server from `config.toml` and revoke the connector on the Sandscale side with `DELETE /api/v1/me/mcp-connectors/{id}`, which ends the app’s sessions at once. Removing the config alone stops Codex from using the server but does not revoke what was issued.

## A first task

“Create a sandbox from the Go template, upload `go.mod`, `go.sum` and the files under `internal/` one by one, run `go vet ./... && go test ./...`, download any failing test’s output, then stop the sandbox.” It touches create, upload, run, download and the prompt on stop, and none of it runs on your machine.

**On this page**

1. The remote server in config.toml
2. Restrict and gate the tools
3. Mind the tool timeout
4. The local server instead
5. What Sandscale enforces on its side
6. Revoking access
7. A first task

**Run your agents in a box of their own**

Each sandbox is a Firecracker microVM. Free includes 100 awake vCPU-hours a month.

[Start free](https://cloud.sandscale.dev/auth/signup)

## Keep reading

- [November 27, 2026 · **A LlamaIndex.TS data agent that runs its Python in a Sandscale sandbox** · Use LlamaIndex.TS's agent workflow with tools that write and run Python in a Firecracker sandbox, built per sandbox so a run can only reach its own box. Upload data files, answer with the numbers, clean up. Type-checked.](https://sandscale.dev/blog/llamaindex-ts-agent-with-sandscale)
- [November 27, 2026 · **Claude tool use with a Sandscale sandbox: the whole loop in one file** · A complete tool-use loop with the Anthropic TypeScript SDK where Claude's run_command and write_file calls execute in a Firecracker sandbox. Tool schemas, tool_result blocks with is_error, a turn limit and cleanup. Type-checked.](https://sandscale.dev/blog/claude-api-tool-use-with-sandscale)

---
Source: https://sandscale.dev/blog/sandscale-mcp-server-in-codex
