---
url: https://ws.kloudkit.com/ai/mcp.md
description: >-
  Serve Kloud Workspace's own tools to an AI agent over the Model Context
  Protocol with ws-cli serve mcp, read-only by default.
---

# MCP Server

`ws-cli serve mcp` serves the workspace's own tools to an AI agent: editor diagnostics, settings, logs,
features and templates.

It is a Model Context Protocol *(MCP)* server over stdio: the agent starts it and talks to it over
stdin and stdout.
No port is opened, so the server is not reachable over the network.

## Register the Server

Registration is manual.
Run the command for your agent once, in a workspace terminal:

::: code-group

```sh [Claude Code]
claude mcp add ws -- ws-cli serve mcp
```

```sh [Codex]
codex mcp add ws -- ws-cli serve mcp
```

:::

Any other MCP client that can start a stdio command can use the same command, `ws-cli serve mcp`.

::: tip
Register `ws-cli`, not the `ws` shortcut.
`ws` exists only in interactive terminals, so an agent cannot start it.
:::

## Tools

Each tool runs one `ws-cli` command and returns its output.
A tool is named after its command path, joined with `_`: `ws-cli show env` is the tool `show_env`.

By default the server lists only tools that read:

| Group | Tool | Description |
| --- | --- | --- |
| `editor` | `editor_diagnostics` | Pull language-server diagnostics (errors, warnings) from the editor, across the whole workspace or a single file with --uri |
| `editor` | `editor_list` | List the editor's open tabs, with each tab's path, language, and active or dirty state |
| `editor` | `editor_selection` | Report the active editor's current selection: file, range, and selected text |
| `feature` | `feature_info` | Show a feature's description and the variables it accepts when it is installed |
| `feature` | `feature_list` | List the features you can install, marking where each comes from: the shipped set, a workspace override, or your own ~/.ws/features.d |
| `feature` | `feature_store` | List the artifacts published to the feature store (WS\_FEATURES\_STORE\_URL), the offline mirror that features install from when the network is locked down *(only with `WS_FEATURES_STORE_URL` set)* |
| `info` | `info_extensions` | List the installed VS Code extensions with their versions |
| `info` | `info_metrics` | Show live resource usage: CPU, memory, disk, and file descriptors, plus GPU with --gpu |
| `info` | `info_uptime` | Show when the workspace session started and how long it has been running |
| `info` | `info_version` | Print the workspace version |
| `logs` | `logs` | Read a workspace daemon's log: the main log by default, or --target metrics|docker|cloudflared |
| `port` | `port_list` | List the TCP ports listening in the workspace, whether each one is public or private, its public URLs, and its state in the editor's Ports tab |
| `seed` | `seed_ls` | List what apply would write, without touching the filesystem: each destination with its operation and whether it carries a secret or a template |
| `show` | `show_env` | Resolve a setting by its dotted key (server.port) and print it with its source and description |
| `show` | `show_ip_internal` | Print the workspace container's internal IP address |
| `show` | `show_ip_node` | Print the IP address of the node hosting the workspace |
| `show` | `show_path_home` | Print the workspace home (server root) path |
| `show` | `show_path_vscode_settings` | Print the path to the VS Code settings file: the user file by default, or the folder's with --workspace |
| `template` | `template_list` | List the templates you can apply, with their source paths and whether one is already applied here |
| `template` | `template_show` | Display the contents of a configuration template |

`show_env` never returns the value of a secret setting: it shows `<redacted>` in its place.

## Allow Tools That Act on the Workspace

These tools change the workspace instead of reading it:

| Tool | Description |
| --- | --- |
| `editor_open` | Open a file in the running editor window: a tab in the current window by default, a preview tab with --preview, jumping to a range with --selection |
| `editor_reveal` | Show and select a workspace file or folder in the editor's Explorer sidebar without opening it, like the Reveal in Explorer View action |
| `template_apply` | Copy a template, a shared config like ruff or markdownlint, into the project at --path (the current directory by default) |

The server lists them only when this variable is `true`:

* **`WS_AI_MCP_ALLOW_WRITE`:** Enables the MCP tools that act on the workspace.

```sh{2}
docker run \
  -e WS_AI_MCP_ALLOW_WRITE=true \
  ghcr.io/kloudkit/workspace:v0.6.0
```

## Narrow the Tool List

To serve fewer tools, name the ones to keep in this variable:

* **`WS_AI_MCP_TOOLS`:** Comma-separated list of MCP tools to serve.

Each entry is a group or a tool name from the tables above.
The default, `*`, serves every tool.

To serve the `info` and `editor` groups and the single tool `show_env`:

```sh{2}
docker run \
  -e WS_AI_MCP_TOOLS="info,show_env,editor" \
  ghcr.io/kloudkit/workspace:v0.6.0
```

An entry that names no group or tool is ignored with a warning.
Naming a tool that acts on the workspace does not allow it: `editor_open` is still listed only with
`WS_AI_MCP_ALLOW_WRITE`.

::: warning Not a Security Boundary
These two variables shape the list of tools an agent sees.
They do not restrict the agent: one with a terminal can already run `ws-cli` itself.
:::

## Server Output

The server writes a start banner and one line per tool call to stderr.
The banner reports how many tools are served and any filter in effect, and each line names the tool,
its outcome and how long it took.
