Skip to content

Commit 74880cb

Browse files
authored
feat(ui): manage MCP servers directly from Settings → MCP (#110654)
* feat(ui): manage MCP servers directly on the Settings MCP page * refactor(ui): mcp config section owned by the MCP settings page only * chore(ui): drop test-only McpServersCard export for knip
1 parent f6de912 commit 74880cb

20 files changed

Lines changed: 1025 additions & 425 deletions

‎docs/web/control-ui.md‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -135,9 +135,10 @@ The **Installed** tab shows the full local inventory grouped by category, with
135135
overview counts. Each row opens a detail view; its overflow (`…`) menu enables
136136
or disables the plugin and offers **Remove** for externally installed plugins.
137137
It also lists configured [MCP servers](/cli/mcp) and supports adding, disabling,
138-
and removing them inline. The **Discover** tab is the store: featured plugins
139-
included with OpenClaw, official external plugins, and one-click MCP connectors
140-
for popular services. Typing in the search box queries
138+
and removing them inline. The same server controls live on **Settings → MCP**.
139+
The **Discover** tab is the store: featured plugins included with OpenClaw,
140+
official external plugins, and one-click MCP connectors for popular services.
141+
Typing in the search box queries
141142
[ClawHub](https://clawhub.ai/plugins) inline and appends a **From ClawHub**
142143
section with download counts and source-verification badges. Deep links can
143144
target the store directly with `/settings/plugins?tab=discover`.
@@ -240,7 +241,7 @@ A **Search** field at the top of the sidebar opens the command palette (⌘K). C
240241
- Model Setup (`/settings/model-setup`) is a subpage of Model Providers, launched from its header.
241242
- Agents: a settings page (**Settings → Agents**, `/settings/agents`) with per-agent tabs (Overview, Files, Tools, Skills, Channels, Automations, Memory). The Overview tab edits the agent's identity — display name, emoji, and an avatar image that is downscaled and size-bounded in the browser before `agents.update`. Saving stores configured identity fields and mirrors them to the workspace `IDENTITY.md`; configured values take precedence over manual edits to the same file fields.
242243
- Profile: a settings page showing the default agent's identity with all-time usage stats — lifetime tokens, peak day, longest session, activity streaks, a year-long token heatmap, top tools, and channel highlights (`usage.cost`, `sessions.usage`).
243-
- MCP has a dedicated settings page with read-only server rows (transport, enablement, OAuth/filter/parallel summaries), common operator commands, and the scoped `mcp` config editor; adding, enabling/disabling, and removing servers happens on the Plugins page.
244+
- MCP has a dedicated settings page with server rows (transport, enablement, OAuth/filter/parallel summaries), direct add/enable/disable/remove controls, common operator commands, and the scoped `mcp` config editor. The Plugins page remains the home for one-click connectors and discovery.
244245
- Model Providers: a settings page listing every configured model provider with its brand icon, auth state (`models.authStatus`), model availability (`models.list`), live plan/quota/billing data where the provider reports it (`usage.status`), and local session spend for the last 30 days (`sessions.usage`). A Refresh action re-reads credential state and provider usage.
245246
- Connection: a settings page (under **Connections**) owning the dashboard's own gateway link — WebSocket URL, gateway token, password, and default session key — plus the latest handshake snapshot (status, uptime, tick interval, last channels refresh). The offline login gate handles the disconnected case; this page edits the connection while connected.
246247
- Apply and restart with validation (`config.apply`), then wake the last active session.
@@ -317,7 +318,7 @@ Typical workflow:
317318
1. Open **MCP** from the sidebar.
318319
2. Check the summary cards for total, enabled, OAuth, and filtered server counts.
319320
3. Review each server row for transport, enablement, auth, filters, timeouts, and command hints.
320-
4. Manage servers (add, enable/disable, remove) on the **Plugins** page, which is the single interactive writer of `mcp.servers`; the row list here links to it.
321+
4. Add, enable, disable, or remove servers directly on the MCP page. Use the **Plugins** page for one-click connectors and discovery.
321322
5. Edit the scoped `mcp` config section for server definitions, headers, TLS/mTLS paths, OAuth metadata, tool filters, and Codex projection metadata.
322323
6. Use **Save** for a config write, or **Save & Publish** when the running Gateway should apply the changed config.
323324
7. Run `openclaw mcp status --verbose`, `openclaw mcp doctor --probe`, or `openclaw mcp reload` from a terminal for static diagnostics, live proof, or cached-runtime disposal.

‎scripts/control-ui-mock-dev.ts‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,17 @@ function buildConfigMocks() {
550550
gateway: { port: 18789, bind: "127.0.0.1" },
551551
agents: { defaults: { thinkingDefault: "medium" } },
552552
models: { mode: "merge" },
553+
mcp: {
554+
servers: {
555+
context7: { url: "https://mcp.context7.com/mcp", transport: "streamable-http" },
556+
github: {
557+
url: "https://api.githubcopilot.com/mcp/",
558+
transport: "streamable-http",
559+
auth: "oauth",
560+
},
561+
"local-tools": { command: "npx", args: ["some-mcp-server", "--stdio"], enabled: false },
562+
},
563+
},
553564
};
554565
const schema = {
555566
type: "object",
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
import { html, type TemplateResult } from "lit";
2+
import { t } from "../i18n/index.ts";
3+
4+
export type McpServerForm = {
5+
name: string;
6+
target: string;
7+
};
8+
9+
export function renderMcpServerForm(props: {
10+
busy: boolean;
11+
disabled?: boolean;
12+
blockedReason?: string | null;
13+
onSubmit: (form: McpServerForm) => void;
14+
onCancel: () => void;
15+
}): TemplateResult {
16+
const disabled = props.busy || props.disabled === true;
17+
const submit = (event: Event) => {
18+
event.preventDefault();
19+
const form = event.currentTarget as HTMLFormElement;
20+
const data = new FormData(form);
21+
const name = data.get("mcp-name");
22+
const target = data.get("mcp-target");
23+
props.onSubmit({
24+
name: typeof name === "string" ? name.trim() : "",
25+
target: typeof target === "string" ? target.trim() : "",
26+
});
27+
};
28+
return html`
29+
<form class="mcp-server-form" @submit=${submit}>
30+
<label>
31+
<span>${t("mcpServers.nameLabel")}</span>
32+
<input
33+
name="mcp-name"
34+
class="settings-input"
35+
type="text"
36+
required
37+
placeholder="context7"
38+
autocomplete="off"
39+
title=${props.blockedReason ?? ""}
40+
?disabled=${disabled}
41+
/>
42+
</label>
43+
<label class="mcp-server-form__target">
44+
<span>${t("mcpServers.targetLabel")}</span>
45+
<input
46+
name="mcp-target"
47+
class="settings-input"
48+
type="text"
49+
required
50+
placeholder="https://mcp.example.com/mcp · npx some-mcp-server"
51+
autocomplete="off"
52+
title=${props.blockedReason ?? ""}
53+
?disabled=${disabled}
54+
/>
55+
</label>
56+
<div class="mcp-server-form__actions">
57+
<button
58+
type="submit"
59+
class="btn btn--sm"
60+
title=${props.blockedReason ?? ""}
61+
?disabled=${disabled}
62+
>
63+
${props.busy ? t("mcpServers.adding") : t("mcpServers.add")}
64+
</button>
65+
<button type="button" class="btn btn--sm" ?disabled=${props.busy} @click=${props.onCancel}>
66+
${t("common.cancel")}
67+
</button>
68+
</div>
69+
</form>
70+
`;
71+
}

0 commit comments

Comments
 (0)