# The flockvm MCP server

> flockvm's remote MCP server lets Claude Code, Cursor, Codex and other agents create and manage VMs and environments with your API key, over HTTP.

- URL: https://flockvm.com/docs/mcp/overview
- Section: MCP server
- Last updated: 2026-11-01

The flockvm MCP server lets an AI agent manage your flockvm VMs: list them, create one for a task, give it the SSH command, pause it when the work waits, delete it when it is done. It also reads and changes [environments](https://flockvm.com/docs/vms/environments). It is a remote server, hosted by flockvm: there is nothing to install or run.

|                |                                                                                                                       |
| -------------- | --------------------------------------------------------------------------------------------------------------------- |
| URL            | `https://flockvm.com/api/mcp`                                                                                         |
| Transport      | Streamable HTTP, stateless: one `POST` per message, no session                                                        |
| Authentication | `Authorization: Bearer flk_…`, an API key from [Settings → API keys](https://flockvm.com/dashboard/settings/api-keys) |
| Tools          | 20: VMs, the catalog, SSH keys, environments. See [Tools](https://flockvm.com/docs/mcp/tools).                        |

The quickest way to add it to a client is the [CLI](https://flockvm.com/docs/cli):

```bash
npm install -g flockvm
flockvm login
flockvm mcp add claude
```

Cursor, Codex, other clients and the configuration by hand are in [Connect a client](https://flockvm.com/docs/mcp/clients).

## What an agent can do with it

The tools act as the API key's user, with that user's current role in the organization, within the key's [scope](https://flockvm.com/docs/api/api-keys), and follow the dashboard's rules: billing, sizes and regions, environments open to members, runner VMs left to flockvm. Each tool needs the action of the API route it matches (`create_vm` needs `vm.create`); the client only sees the tools its key can use, and a tool called anyway answers with the `insufficient_scope` error.

- **VMs**: list, read one with its SSH command, create, start, stop, pause, resume, delete, and read the console log.
- **Catalog**: the regions, sizes and images the organization can use, and the sizes the region has room for now.
- **SSH keys**: list the keys saved in the user's account, to create a VM with one.
- **Environments**: list and read them (variable names and the last 4 characters of values, file paths and sizes), create one, set and delete variables and secret files, delete one. Changing environments takes an owner's or an admin's key.

A typical session: the agent calls `whoami` and `get_catalog`, creates a VM with `create_vm`, polls `get_vm` until it is `running`, then connects with the `ssh.command` it got, using an SSH key it holds. When the task waits for review, it calls `pause_vm`; when it is merged, `delete_vm`.

## What it never does

- **It never returns a secret.** There is no tool to reveal an environment's values: tools show variable names with their last 4 characters, and file paths with their size. Values are written, never read back. Owners and admins reveal values in the dashboard, the [API](https://flockvm.com/docs/api) or `flockvm env reveal`.
- **It does not run commands inside a VM.** The tools manage VMs. To work inside one, the agent connects over SSH like you do.
- **It does not touch billing, members, organization settings, CI or API keys.** Those stay in the dashboard.
- **It does not delete without saying so.** `delete_vm`, `delete_environment`, `delete_env_var` and `delete_env_file` carry the MCP `destructiveHint` annotation, so clients that ask before destructive actions ask before these. Read-only tools carry `readOnlyHint`.

## Security

> **Warning: The key is the agent's power.** Whatever the key's scope and its user's role both allow, an agent with the key may do. A full-access key can create VMs that are billed to the organization and delete any VM of the organization, yours and your teammates'; with an owner's or an admin's key, it can also change and delete environments. Give an agent a scoped key instead.

- **Use a dedicated key.** Create one key per agent or per client, named after it (`claude-code-laptop`), so you can revoke it alone. Owners and admins see every key in **Settings → API keys**, with when it was last used, and revoke any of them there.
- **Scope it.** **Create and use VMs** creates VMs and deletes only the ones it created. Restrict it to one environment or to its own VMs, and to your IP address if the client always runs from the same place. See [API keys and scopes](https://flockvm.com/docs/api/api-keys).
- **Give it an expiry.** Pick 7, 30 or 90 days rather than never. An expired key is refused, and the client shows an error until you give it a new one. Its user gets a mail 7 to 8 days and 24 to 48 hours before (a little later if the daily send is delayed).
- **Use the lowest role that works.** A member's key creates and drives VMs but cannot change environments. To keep an environment's values away from it, turn that environment's **Members can use it** switch off: then a member's key cannot create VMs with it.
- **Secrets can still reach a VM.** No tool reveals a value, but a VM created with an environment gets its variables and files, and an agent that can SSH into that VM can read them there. Give an agent's VMs an environment you would hand to that agent, or `"none"`.
- **Keep the key out of repositories.** A client config with the key in it is a secret. `flockvm mcp add` can write a config that reads the key from the `FLOCKVM_API_KEY` variable instead: see [Keep the key out of the file](https://flockvm.com/docs/mcp/clients#keep-the-key-out-of-the-file).
- **Check what it did.** Every change an agent makes is in **Settings → Audit log**, with its user as the actor and "via MCP with the API key …" naming the key. See [Audit log](https://flockvm.com/docs/team/audit-log).

The server refuses a request sent by a web page of another site (an `Origin` header that is not flockvm's): MCP clients send none, so this only stops browsers.

## No OAuth sign-in

The server takes an API key in the `Authorization` header and nothing else. Without one it answers `401 Unauthorized`, and some clients then offer to "sign in" or "authenticate" in a browser: that sign-in cannot work. Add the header instead, with `flockvm mcp add` or by hand.

## Next steps

- [Connect a client](https://flockvm.com/docs/mcp/clients): Claude Code, Cursor, Codex and any MCP client.
- [Tools](https://flockvm.com/docs/mcp/tools): The 20 tools, their inputs and annotations.
