# Security checklist for an MCP server that executes code

> What to check before you give an AI agent an MCP tool that runs code: where the code runs, who it runs as, tool annotations, network, secrets, limits and records. With how Sandscale's MCP servers answer each item.

What to check before you give an AI agent an MCP tool that runs code: where the code runs, who it runs as, tool annotations, network, secrets, limits and records. With how Sandscale's MCP servers answer each item.

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

**Short answer:** an MCP tool that runs code turns any text the model reads into possible commands, so judge the server by where the code lands, who it acts as, and what it records, not by the tool description. The checklist below covers the ten questions we would ask of any code-execution MCP server, ours included, with the facts from the MCP specification and from Sandscale’s docs.

## 1. Where does the code run?

A local stdio server runs with your user’s permissions on your machine unless it starts something isolated. A remote server runs code wherever its operator runs it. Ask for the boundary in plain terms: a process, a container sharing a kernel, or a virtual machine with its own kernel.

Sandscale: both servers start sandboxes, and each sandbox is a Firecracker microVM with its own kernel. The server process itself does not run your code.

## 2. Who does each call act as?

A server holding one shared admin token turns every connected agent into that admin. Prefer a server that acts as the signed-in person, with that person’s permissions.

Sandscale: the remote server at `https://mcp.sandscale.dev/mcp` uses OAuth sign-in and each call runs as you, with a short-lived credential that never leaves the server. The local `sandscale mcp` server uses your own CLI sign-in. Agents connected this way act with the person’s own access, never more.

## 3. Are tool annotations honest, and does your client use them?

The [MCP specification](https://modelcontextprotocol.io/specification/2025-06-18/server/tools) defines tool annotations, with fields such as `readOnlyHint` and `destructiveHint` in its [schema](https://modelcontextprotocol.io/specification/2025-06-18/schema), and says clients must treat annotations as untrusted unless they come from a trusted server. Treat them as a hint for your client’s approval prompts, not as enforcement.

Sandscale: the generated tool references mark which tools change things. On the remote server `sandbox_stop` is marked as not undoable, because stopping deletes the sandbox’s disk.

## 4. What is not offered as a tool?

The safest tool is the one the model never sees. Look for what the server leaves out on purpose.

Sandscale: the local server does not offer signing in, the vault or deleting anything as tools. No Sandscale MCP tool returns a Vault value; the remote server’s `vault_list_secrets` lists names only.

## 5. What network does a new sandbox get?

Code execution plus open egress is how a prompt injection becomes data leaving. See [prompt injection to code execution](https://sandscale.dev/blog/prompt-injection-to-code-execution).

Sandscale: on the local server, `sandbox_start` gives a sandbox no network unless asked. In general, network access follows your plan and your organization’s policy, and a sandbox can reach only what the organization’s egress allowlist allows.

## 6. Can the server’s limits stop a runaway agent?

An agent in a loop can call a tool thousands of times. Ask for per-app and per-person rate limits, and for plan or policy limits on how many sandboxes and how large.

Sandscale: the remote server allows up to 120 calls a minute per app and 60 per person, and every call goes through the same plan limits and policy as the API. A refused call returns the API’s own error code to the assistant.

## 7. Is every call recorded somewhere you can read?

You need to answer “what did the agent do” after the fact.

Sandscale: every remote MCP call is in your organization’s audit log with the tool, the region, the outcome and the app, never the arguments. The log is hash-chained, so a change or gap shows. See [what an audit log for coding agents should record](https://sandscale.dev/blog/audit-log-for-ai-coding-agents).

## 8. Does a command have a time limit?

Long commands and client timeouts interact badly: the client gives up, the command keeps running. Check both the server’s command timeout and the sandbox’s own lifetime.

Sandscale: the local `sandbox_exec` tool takes an optional `timeout_seconds`, and a sandbox stops by itself when its time limit runs out.

## 9. Can you revoke access at once?

Removing a server from a client config does not revoke tokens already issued.

Sandscale: revoke a remote connector with `DELETE /api/v1/me/mcp-connectors/{id}`, which ends the app’s sessions at once. Every organization also has a kill switch that stops its agents.

## 10. What does your client ask before a call?

The server enforces what is allowed; the client decides what runs without a prompt. Configure approvals per tool: reads automatic, writes prompted, irreversible calls always prompted. Our [Claude Code](https://sandscale.dev/blog/sandscale-mcp-server-in-claude-code), [Codex](https://sandscale.dev/blog/sandscale-mcp-server-in-codex) and [Cursor](https://sandscale.dev/blog/sandscale-mcp-server-in-cursor) guides show this for each client.

## Applying it

Run this list against any MCP server that runs code before you add it to an agent. If you want one that answers each item from its docs, the [Sandscale MCP server](https://sandscale.dev/sandboxes/mcp) is one option, with a remote server for any MCP client and a local stdio server that comes with the CLI.

## FAQ

### Is it safe to give an AI agent an MCP tool that runs code?

It can be, if the code runs in an isolated environment, the server acts as you rather than as a shared admin, the network is limited, secrets never reach the model, calls are rate limited and recorded, and your client prompts before irreversible calls.

### Are MCP tool annotations a security control?

No. The MCP specification says clients must treat annotations as untrusted unless the server is trusted. Use them to drive approval prompts, and rely on the server’s own permissions for enforcement.

### What does Sandscale record for an MCP call?

Each remote MCP call is in the organization’s audit log with the tool, the region, the outcome and the app. The arguments are not recorded.

### Does the Sandscale MCP server give the model secrets?

No. No Sandscale MCP tool returns a Vault value. The remote server lists secret names only, and the local server does not offer the vault as a tool.

## Related

- [Remote vs local Sandscale MCP server](https://sandscale.dev/blog/remote-vs-local-sandscale-mcp-server)
- [Designing a run-code tool schema](https://sandscale.dev/blog/designing-a-run-code-tool-schema)
- [Running code from Claude or ChatGPT in a microVM](https://sandscale.dev/blog/run-code-from-claude-or-chatgpt-in-a-microvm)

## Sources

- MCP specification, tools: [https://modelcontextprotocol.io/specification/2025-06-18/server/tools](https://modelcontextprotocol.io/specification/2025-06-18/server/tools), schema: [https://modelcontextprotocol.io/specification/2025-06-18/schema](https://modelcontextprotocol.io/specification/2025-06-18/schema)
- Sandscale: [Connect Claude or ChatGPT](https://sandscale.dev/docs/guides/connect-claude-chatgpt), [MCP tools](https://sandscale.dev/docs/reference/mcp), [Teams and SSO](https://sandscale.dev/docs/concepts/teams-and-sso), [Audit log](https://sandscale.dev/docs/concepts/audit)

**On this page**

1. 1. Where does the code run?
2. 2. Who does each call act as?
3. 3. Are tool annotations honest, and does your client use them?
4. 4. What is not offered as a tool?
5. 5. What network does a new sandbox get?
6. 6. Can the server’s limits stop a runaway agent?
7. 7. Is every call recorded somewhere you can read?
8. 8. Does a command have a time limit?
9. 9. Can you revoke access at once?
10. 10. What does your client ask before a call?
11. Applying it
12. FAQ
13. Related

**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 · **A sandbox for Claude Code: running it headless in a cloud workspace** · Run Claude Code with claude -p inside a Sandscale workspace, a persistent Firecracker microVM, so its Bash tool works on a cloud disk instead of your laptop. Setup, permission flags and what stays where.](https://sandscale.dev/blog/claude-code-headless-in-a-cloud-workspace)

---
Source: https://sandscale.dev/blog/mcp-code-execution-server-security-checklist
