# MCP server

> Use the built-in MCP server so Claude Code, Codex, Cursor and other agents can create resources, customize the UI and staff teams.

Kernuq has a built-in MCP server with two transports:

- **stdio** — `kernuq mcp-serve`
- **Streamable HTTP** — the daemon's `/mcp/v1`

## Connect

Claude Code:

```bash
claude mcp add kernuq -- kernuq mcp-serve --profile builder
```

Codex (`~/.codex/config.toml`):

```toml
[mcp_servers.kernuq]
command = "kernuq"
args = ["mcp-serve", "--profile", "builder"]
```

Cursor (`.cursor/mcp.json`) or any client that reads `mcpServers`:

```json
{
  "mcpServers": {
    "kernuq": { "command": "kernuq", "args": ["mcp-serve", "--profile", "builder"] }
  }
}
```

## Profiles

| profile | Capability |
| --- | --- |
| `observer` | Read-only introspection |
| `ui_co_designer` | UI co-design: evolve views, publish widgets |
| `builder` | Build resources, rotors and topologies |
| `operator` | Runtime control: sessions, rollback |

No profile can read `vault://` plaintext.

## Tools

Twelve cohesive domain tools: `kernuq_inspect`, `kernuq_org_admin`, `kernuq_resource_admin`, `kernuq_compute_admin`, `kernuq_harness_upsert`, `kernuq_formation_deploy`, `kernuq_ui_widget_publish`, `kernuq_sdui_view_evolve`, `kernuq_ui_reset_to_rom`, `kernuq_session_control`, `kernuq_audit_rollback_batch`, `kernuq_cortex_delegate`.

## Batches and rollback

All writes in one `mcp-serve` process share a `batch_session_id` (set it with `--batch-id`). Every change lands in `kernel_mutation_logs` with redacted before/after diffs; a human can review it in the console or roll the whole batch back atomically with `kernuq_audit_rollback_batch`.
