MCP server
Connect an MCP client
Add the flockvm MCP server to Claude Code, Cursor, Codex or any MCP client, with flockvm mcp add or by hand, and keep the API key out of config files.
Every client needs two things: the URL https://flockvm.com/api/mcp and the header Authorization: Bearer flk_… with an API key. Create a key for the client in Settings → API keys, with an expiry: see Security.
With flockvm mcp add
The CLI writes the configuration for you:
claude puts the key you are logged in with (flockvm login, or FLOCKVM_API_KEY) into Claude Code's private config. The snippets for cursor, codex and json hold no key: they read it from FLOCKVM_API_KEY in the client's environment, so the file can be shared.
| Option | What it does |
|---|---|
--key-from-env |
claude: the header is the literal text Bearer ${FLOCKVM_API_KEY}, which Claude Code expands when it starts, instead of your key. Already the default for the snippets. |
--embed-key |
cursor, codex and json: write your key into the snippet, for a private file only. |
--scope local|project|user |
claude only: passed to claude mcp add. local by default. project requires --key-from-env. |
--print |
claude only: print the claude mcp add command instead of running it. |
--name <name> |
The server's name in the client, flockvm by default. |
To connect Claude Code with its own key rather than yours, put that key in the environment first, without it landing in your shell history: read -rs FLOCKVM_API_KEY && export FLOCKVM_API_KEY, paste the key, then flockvm mcp add claude.
Claude Code
By hand, the same command:
Add --scope user to have it in every project. claude mcp list shows it, and /mcp inside Claude Code shows its tools.
--scope project needs --key-from-env
--scope project writes the server, header included, into .mcp.json at the root of the repository, which is usually committed. flockvm mcp add claude --scope project therefore refuses to write your key there. Add --key-from-env:
The file then holds "Authorization": "Bearer ${FLOCKVM_API_KEY}", and each person sets FLOCKVM_API_KEY to their own key before starting Claude Code. Claude Code expands ${VAR} in a server's headers: see its docs.
Cursor
Merge what it prints into ~/.cursor/mcp.json (every project) or .cursor/mcp.json (this project), next to any mcpServers already there. Cursor reads the key from FLOCKVM_API_KEY (its ${env:…} syntax):
{
"mcpServers": {
"flockvm": {
"url": "https://flockvm.com/api/mcp",
"headers": {
"Authorization": "Bearer ${env:FLOCKVM_API_KEY}"
}
}
}
}With --embed-key, the header holds your key instead: "Authorization": "Bearer flk_…".
Codex
Add what it prints to ~/.codex/config.toml, or to .codex/config.toml in a trusted project. Codex sends the value of FLOCKVM_API_KEY as the bearer token:
[mcp_servers.flockvm]
url = "https://flockvm.com/api/mcp"
bearer_token_env_var = "FLOCKVM_API_KEY"With --embed-key, it prints http_headers = { "Authorization" = "Bearer flk_…" } instead.
Other clients
Any client that speaks MCP over Streamable HTTP and can send a header works. flockvm mcp add json prints the mcpServers shape that Claude Code's .mcp.json and many other clients read:
{
"mcpServers": {
"flockvm": {
"type": "http",
"url": "https://flockvm.com/api/mcp",
"headers": {
"Authorization": "Bearer ${FLOCKVM_API_KEY}"
}
}
}
}A client that does not expand ${FLOCKVM_API_KEY} needs the key itself: flockvm mcp add json --embed-key, into a file you do not commit.
The server is stateless: it answers POST only, with no session id, and refuses GET with 405. It speaks the 2026-07-28 revision of the protocol and the 2025 ones.
Keep the key out of the file
The snippets of flockvm mcp add cursor, codex and json, and flockvm mcp add claude --key-from-env, name the FLOCKVM_API_KEY variable instead of holding the key. The client must then see that variable in its environment when it starts. Only --embed-key, and claude at the local and user scopes, write the key itself.
{
"mcpServers": {
"flockvm": {
"url": "https://flockvm.com/api/mcp",
"headers": {
"Authorization": "Bearer ${env:FLOCKVM_API_KEY}"
}
}
}
}[mcp_servers.flockvm]
url = "https://flockvm.com/api/mcp"
bearer_token_env_var = "FLOCKVM_API_KEY"{
"mcpServers": {
"flockvm": {
"type": "http",
"url": "https://flockvm.com/api/mcp",
"headers": {
"Authorization": "Bearer ${FLOCKVM_API_KEY}"
}
}
}
}Check that it works
Ask the agent "Which flockvm VMs do I have?". It should call list_vms and answer with your VMs. Asking "Who am I on flockvm?" calls whoami, which names the organization and the role the key acts with.
The client offers to sign in or authenticate in a browser
It got 401 Unauthorized: the request had no key, or a key the server refused. The server has no OAuth sign-in. Add the Authorization: Bearer flk_… header, or run flockvm mcp add again.
401 with a key in the config
The key is mistyped, expired or revoked, or its user left the organization. Check it with FLOCKVM_API_KEY=flk_… flockvm whoami, and create a new one in Settings → API keys if needed.
A tool answers forbidden
The key's role or the organization's state does not allow it: a member changing an environment, billing not in order for creating or starting a VM, a free trial not started yet or one of its limits (trial_vm_limit, trial_size_not_allowed…). The error says which, and the trial's codes are in Free trial. See Members and roles.
403 This Origin may not call the flockvm MCP server
The request came from a web page on another site. Call the server from an MCP client, which sends no Origin header.