CLICommandsl4 mcp

l4 mcp install

l4 mcp install writes the LevelFour MCP server into the configuration of the agent clients it finds on this machine, using a LevelFour API key.

l4 mcp install [flags]

With no --client, every client it can confirm is configured. Restart the client afterwards, then ask it what you are spending this month.

A key is not the only way in, and it is not the recommended one for a person at a keyboard. A client pointed at https://mcp.levelfour.ai/mcp with no header sends you to the browser to sign in, and receives a token that expires in an hour and is revocable per connection. Reach for install when you want one command to configure every client on the machine, or when the client runs unattended. Connecting a client compares them.

Flags

FlagDescription
--clientClient to configure: claude-code, claude-desktop, cursor, vscode, windsurf. Repeatable. Defaults to every client detected
--nameName for the server entry. Defaults to levelfour
--endpointMCP endpoint to point clients at. Defaults to the hosted server
--key-sourceinline (default) writes the credential into the config. env writes a reference to $LEVELFOUR_TOKEN instead

Global flags (--json, --jq, --template, --quiet, --token, --api) apply. See CLI overview.

What it writes

Each vendor expects the same three facts in a different file under a different key, so the shape differs per client.

ClientWritten toTransport
Claude Codeclaude mcp add --scope userRemote HTTP
Claude Desktopclaude_desktop_config.jsonLocal stdio, running l4 mcp serve
Cursor~/.cursor/mcp.jsonRemote HTTP
VS Codeuser-profile mcp.jsonRemote HTTP
Windsurf~/.codeium/windsurf/mcp_config.jsonRemote HTTP

Existing configuration is parsed and merged rather than replaced. Only the entry under --name is touched, everything else in the file is preserved, and a dated .l4-backup-<timestamp> copy is taken first. A file that is not valid JSON stops the install for that client rather than being overwritten.

Claude Code is configured by running its own CLI, because its configuration file also holds per-project state that the vendor tool owns.

Where the credential goes

By default the key is written into the configuration file. Files the CLI creates itself are written 0600 on macOS and Linux.

--key-source env writes a reference instead, so no key is stored on disk. The spelling differs per vendor:

ClientReference written
Claude Code, Windsurf${LEVELFOUR_TOKEN}
Cursor${env:LEVELFOUR_TOKEN}
VS Codean inputs prompt, stored in the editor's own secret storage

Export LEVELFOUR_TOKEN in the environment the client starts from. VS Code needs no environment variable: it prompts once and keeps the value itself. LEVELFOUR_TOKEN is the variable l4 itself reads, so one export serves the CLI and every client.

Claude Desktop never receives a key either way, because it runs the local server and that reads your keychain.

More than one entry

An API key belongs to exactly one organization, and to one scope. --name is how you keep several entries side by side, because each install only touches the entry under that name.

Two organizations, one client:

l4 mcp install --client cursor --token $ORG_A_KEY
l4 mcp install --client cursor --name levelfour-org-b --token $ORG_B_KEY

A read-write key alongside the default read-only one, which is what the two decision-recording tools need:

l4 mcp install --client cursor --name levelfour-rw --token $READ_WRITE_KEY

A second entry pointed somewhere other than production:

l4 mcp install --client cursor --name levelfour-staging --endpoint https://mcp.example.internal/mcp

Which clients it touches

The command distinguishes proof that a client is installed from a hint of it. An executable on PATH, an application bundle, or an existing MCP configuration file counts as proof. A directory the client created once is only a hint, because those outlive an uninstall, and writing a credential into a fresh configuration for software that is no longer there would be a leak rather than a convenience.

Clients it only has a hint of are named and skipped:

Detected Claude Code, Cursor. Configuring all of them; use --client to narrow.
Skipping VS Code: configuration was found but the application was not. Add --client to configure it anyway.

Pass --client to configure one anyway.

Examples

Configure everything it can confirm:

l4 mcp install

One client at a time, covering all five:

l4 mcp install --client claude-code
l4 mcp install --client claude-desktop
l4 mcp install --client cursor
l4 mcp install --client vscode
l4 mcp install --client windsurf

Several at once, without writing the key to disk:

l4 mcp install --client cursor --client vscode --client windsurf --key-source env

Machine-readable, for a provisioning script:

l4 mcp install --client cursor --json

Errors

ExitSymptomCause
1no MCP client detected on this machineNothing confirmed. Install a client, or name one with --client
1no client was configuredEvery client attempted failed. The message names each failure
1N of M clients failedSome succeeded, some did not. The successful ones are configured
1unknown client--client was given a name outside the supported set
1is not valid JSON, so it was left aloneThe client's configuration file is malformed. Fix or move it, then re-run

A partial failure exits non-zero in both human and --json mode, because a client that failed has no LevelFour tools.

Configuring a client yourself

l4 mcp install is a convenience, not the only route. Every client here can be configured directly, and Claude Code has its own command for it:

claude mcp add --transport http --scope user levelfour https://mcp.levelfour.ai/mcp \
  --header "Authorization: Bearer $LEVELFOUR_TOKEN"

Two details that bite. --scope defaults to local, which registers the server under the current directory only, so pass --scope user for every project. And --header is variadic, so it has to come after the name and the URL: put it first and it swallows both, and the command exits without doing anything.

Any client that speaks MCP over streamable HTTP works the same way. Point it at https://mcp.levelfour.ai/mcp, and either let it sign you in or send Authorization: Bearer <key>. Connecting a client has the exact configuration each client expects.