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.
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
| Flag | Description |
|---|---|
--client | Client to configure: claude-code, claude-desktop, cursor, vscode, windsurf. Repeatable. Defaults to every client detected |
--name | Name for the server entry. Defaults to levelfour |
--endpoint | MCP endpoint to point clients at. Defaults to the hosted server |
--key-source | inline (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.
| Client | Written to | Transport |
|---|---|---|
| Claude Code | claude mcp add --scope user | Remote HTTP |
| Claude Desktop | claude_desktop_config.json | Local stdio, running l4 mcp serve |
| Cursor | ~/.cursor/mcp.json | Remote HTTP |
| VS Code | user-profile mcp.json | Remote HTTP |
| Windsurf | ~/.codeium/windsurf/mcp_config.json | Remote 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:
| Client | Reference written |
|---|---|
| Claude Code, Windsurf | ${LEVELFOUR_TOKEN} |
| Cursor | ${env:LEVELFOUR_TOKEN} |
| VS Code | an 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_KEYA 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_KEYA second entry pointed somewhere other than production:
l4 mcp install --client cursor --name levelfour-staging --endpoint https://mcp.example.internal/mcpWhich 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 installOne 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 windsurfSeveral at once, without writing the key to disk:
l4 mcp install --client cursor --client vscode --client windsurf --key-source envMachine-readable, for a provisioning script:
l4 mcp install --client cursor --jsonErrors
| Exit | Symptom | Cause |
|---|---|---|
1 | no MCP client detected on this machine | Nothing confirmed. Install a client, or name one with --client |
1 | no client was configured | Every client attempted failed. The message names each failure |
1 | N of M clients failed | Some succeeded, some did not. The successful ones are configured |
1 | unknown client | --client was given a name outside the supported set |
1 | is not valid JSON, so it was left alone | The 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.
Related
l4 mcp status- what is wired up, and what is notl4 mcp uninstall- remove the entry, and the backups holding the old keyl4 mcp serve- the local server this points Claude Desktop at- Connecting a client - the configuration each client expects, by hand