bazilion 0.57.1 → 0.58.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +392 -92
- package/dist/cli.js.map +1 -1
- package/dist/daemon.js +674 -259
- package/dist/daemon.js.map +1 -1
- package/dist/web/client/assets/AddProviderDialog-DIxB5CRz.js +1 -0
- package/dist/web/client/assets/AgentTemplateParts-B9JD9mno.js +1 -0
- package/dist/web/client/assets/ConfirmDialog-D-Qk9p6V.js +1 -0
- package/dist/web/client/assets/ConnectionsView-Dfbn7vfB.js +1 -0
- package/dist/web/client/assets/SkillsParts-DN_JvpRU.js +1 -0
- package/dist/web/client/assets/SpawnTeamModal-Btj3My2v.js +1 -0
- package/dist/web/client/assets/TeamForm-BX_68QZQ.js +1 -0
- package/dist/web/client/assets/TeamThread-CJXudrt6.js +1 -0
- package/dist/web/client/assets/{UnsavedChangesGuard-CYz0AopL.js → UnsavedChangesGuard-B_e5_ck_.js} +1 -1
- package/dist/web/client/assets/_id-BJt13p-G.js +1 -0
- package/dist/web/client/assets/_id-DoP6Mlct.js +1 -0
- package/dist/web/client/assets/{access-BGtASxet.js → access-DnkUj0iM.js} +1 -1
- package/dist/web/client/assets/{agents-BAODfMcm.js → agents-CrfF2ZOS.js} +1 -1
- package/dist/web/client/assets/agents-Cv07gKT0.js +1 -0
- package/dist/web/client/assets/{attention-BIC0TL8d.js → attention-TQpP915m.js} +1 -1
- package/dist/web/client/assets/config-CKPln0Ng.js +1 -0
- package/dist/web/client/assets/index-Bwz8tnmS.js +14 -0
- package/dist/web/client/assets/{login-q9O7dqRe.js → login-C-FCzcQU.js} +1 -1
- package/dist/web/client/assets/manage-BSGsiEPw.js +1 -0
- package/dist/web/client/assets/mcp-DDw8SGMV.js +1 -0
- package/dist/web/client/assets/routes-C5KzZ73E.js +85 -0
- package/dist/web/client/assets/shield-alert-CO7P-cbq.js +1 -0
- package/dist/web/client/assets/{skills-VEtq-MQJ.js → skills-H_AVE6G7.js} +1 -1
- package/dist/web/client/assets/style-HG30duye.js +7 -0
- package/dist/web/client/assets/styles-DyFDuWBI.css +2 -0
- package/dist/web/client/assets/system-C7vZKVdU.js +1 -0
- package/dist/web/client/assets/teams-DcxoMrsV.js +1 -0
- package/dist/web/client/assets/teams-Dcy3Wb4u.js +1 -0
- package/dist/web/client/assets/telegram-CUw1r_J5.js +1 -0
- package/dist/web/client/assets/{tools-C0FIeAL1.js → tools-BNZxmJJk.js} +1 -1
- package/dist/web/client/assets/usage-BhqvXWtk.js +1 -0
- package/dist/web/client/assets/welcome-4H9Gvu-u.js +1 -0
- package/dist/web/server/assets/{AddProviderDialog-CpLDHOcA.js → AddProviderDialog-Bqsz5NaL.js} +1 -1
- package/dist/web/server/assets/{AgentTemplateParts-Dh9F_-T_.js → AgentTemplateParts-D97gKNdN.js} +2 -2
- package/dist/web/server/assets/{ConfirmDialog-C89B8qKM.js → ConfirmDialog-CuD5HXTw.js} +1 -1
- package/dist/web/server/assets/{ConnectionsView-DslcKQmA.js → ConnectionsView-CSf83J-v.js} +32 -10
- package/dist/web/server/assets/{Dialog-_Gt_Nt86.js → Dialog-CwAfaXpM.js} +5 -0
- package/dist/web/server/assets/{SkillsParts-CqS2B45v.js → SkillsParts-hjS9a_Ht.js} +2 -2
- package/dist/web/server/assets/{SpawnDialog-BNKj2Lup.js → SpawnDialog-BjVZl7xK.js} +19 -6
- package/dist/web/server/assets/{SpawnTeamModal-zcLxtFOO.js → SpawnTeamModal-BmBXqfFi.js} +7 -7
- package/dist/web/server/assets/{TeamForm-XFP0l2TB.js → TeamForm-B4702hBg.js} +2 -2
- package/dist/web/server/assets/{TeamThread-gYV_ToRM.js → TeamThread-BGl5z8_I.js} +40 -2
- package/dist/web/server/assets/{UnsavedChangesGuard-CB_TugFF.js → UnsavedChangesGuard-Be8EqfV_.js} +1 -1
- package/dist/web/server/assets/{_id-D4RFNqaJ.js → _id-BWtcQovD.js} +1 -1
- package/dist/web/server/assets/{_id-josYXBx3.js → _id-CKBQM7LH.js} +1 -1
- package/dist/web/server/assets/{_id-BTyd2i5U.js → _id-Cf1461pN.js} +1 -1
- package/dist/web/server/assets/{_id-517adSuB.js → _id-DBhvSxVl.js} +1 -1
- package/dist/web/server/assets/{_id-CyinHJam.js → _id-TT_ZsaSc.js} +6 -6
- package/dist/web/server/assets/{_id-BsQnL9LV.js → _id-VqiN2zRR.js} +35 -12
- package/dist/web/server/assets/{_tanstack-start-manifest_v-DIMayzEa.js → _tanstack-start-manifest_v-Df5LTm5g.js} +60 -58
- package/dist/web/server/assets/{access-BdQmjMJV.js → access-Bog7dbtP.js} +1 -1
- package/dist/web/server/assets/{access-Cc7fMMod.js → access-C5lXP5JS.js} +2 -2
- package/dist/web/server/assets/{access-B97-94Wt.js → access-bTlESGXh.js} +1 -1
- package/dist/web/server/assets/{agents-CjrkaEz8.js → agents-8XZAjHh0.js} +5 -5
- package/dist/web/server/assets/{agents-Tg3zkmQv.js → agents-BepbikC0.js} +1 -1
- package/dist/web/server/assets/{agents-BL918wVc.js → agents-CKkMouJX.js} +1 -1
- package/dist/web/server/assets/{agents-BzJFjA2i.js → agents-Co6S2Ml9.js} +1 -1
- package/dist/web/server/assets/{agents-BlUZqqJn.js → agents-DDUHE3eY.js} +17 -9
- package/dist/web/server/assets/{agents-uw32jPWx.js → agents-DnUK-7qJ.js} +1 -1
- package/dist/web/server/assets/{attention-C94WWwQe.js → attention--1dBWt0c.js} +1 -1
- package/dist/web/server/assets/{attention-2unmuO-q.js → attention-ColV2zMz.js} +1 -1
- package/dist/web/server/assets/{attention-a_OmC6L3.js → attention-n8edCJBL.js} +2 -2
- package/dist/web/server/assets/{auth-DuIqEAed.js → auth-Q5eVKoKR.js} +1 -1
- package/dist/web/server/assets/{config-BG1KOtwA.js → config-BpwsF11b.js} +1 -1
- package/dist/web/server/assets/{config-D1Li_7Yt2.js → config-Cfn1TU8w.js} +1 -1
- package/dist/web/server/assets/{config-Bhem9XER.js → config-UHRqSrh4.js} +4 -4
- package/dist/web/server/assets/{daemon-client-D-NWKQto.js → daemon-client-Dw3ut4pU.js} +1 -1
- package/dist/web/server/assets/{manage-C7ReF2ZZ.js → manage-C7ss0xG5.js} +147 -1
- package/dist/web/server/assets/{mcp-BFixpBQk.js → mcp-COn047tO.js} +1 -1
- package/dist/web/server/assets/mcp-CUoF4jIO.js +753 -0
- package/dist/web/server/assets/{mcp-Ceg9gzKE.js → mcp-DVjTaRq3.js} +1 -1
- package/dist/web/server/assets/{open-groups-C89TEK85.js → open-groups-lUX_YX9X.js} +1 -1
- package/dist/web/server/assets/{router-DizFxqh-.js → router-q3PwQgDH.js} +22 -22
- package/dist/web/server/assets/{routes-DsuaDPTO.js → routes-BgjikzXy.js} +2 -2
- package/dist/web/server/assets/{routes-CVrH9qgo.js → routes-DRtxA9c1.js} +1 -1
- package/dist/web/server/assets/{routes-D9Mw1_VV.js → routes-Do8a2liK.js} +261 -71
- package/dist/web/server/assets/{skills-BNbZ75am.js → skills-B--hjk-0.js} +1 -1
- package/dist/web/server/assets/{skills-D5rnOmKJ.js → skills-D5oN5ehC.js} +4 -4
- package/dist/web/server/assets/{skills-BWwEFc4a.js → skills-DouMCq_2.js} +1 -1
- package/dist/web/server/assets/src-ErO6nYmi.js +226 -0
- package/dist/web/server/assets/{start-2MvkBRdC.js → start-D4sx5Ovq.js} +1 -1
- package/dist/web/server/assets/style-BgFXDhAR.js +64 -0
- package/dist/web/server/assets/{system-Cr4C-YRw.js → system-4WV2pOS4.js} +1 -1
- package/dist/web/server/assets/{system-DsmXkgqn.js → system-A2Aib6JE.js} +2 -1
- package/dist/web/server/assets/{system-DT7AU0e6.js → system-DtGHi7X7.js} +31 -11
- package/dist/web/server/assets/{teams-u6m6JzuU.js → teams-BJNZ7ZsS.js} +1 -1
- package/dist/web/server/assets/{teams-Dix5XVIx.js → teams-Blfyu8ej.js} +1 -1
- package/dist/web/server/assets/{teams-DjE0swAZ.js → teams-BnsbH4YW.js} +9 -9
- package/dist/web/server/assets/{teams-Rk_RED7X.js → teams-GDzT7Tv0.js} +1 -1
- package/dist/web/server/assets/{teams-BeStcDvQ.js → teams-QVxXJfo7.js} +1 -1
- package/dist/web/server/assets/{teams-CsEBLW8-.js → teams-gzY3tOtu.js} +7 -7
- package/dist/web/server/assets/{telegram-CQpF3EHA.js → telegram-BSp9aCz6.js} +1 -1
- package/dist/web/server/assets/{telegram-DhzHgDfg.js → telegram-CIbuQ5-U.js} +1 -1
- package/dist/web/server/assets/{telegram-BjqABrl-.js → telegram-Ctj5dqvs.js} +2 -2
- package/dist/web/server/assets/{tools-DC69leH7.js → tools-BPhol5jb.js} +1 -1
- package/dist/web/server/assets/{usage-mvQegG4l.js → usage-CeiyPffw.js} +1 -1
- package/dist/web/server/assets/{usage-4zMG0sab.js → usage-Dsi2V9Wh.js} +2 -2
- package/dist/web/server/assets/{welcome-DrYbWGd_.js → welcome-A2Koo4HI.js} +3 -3
- package/dist/web/server/assets/{welcome-BuE9FRf4.js → welcome-C71pZOQ9.js} +1 -1
- package/dist/web/server/assets/{welcome-DYw35wl5.js → welcome-PxSZeoU6.js} +1 -1
- package/dist/web/server/server.js +20 -20
- package/dist/worker.js +15 -5
- package/dist/worker.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/client/assets/AddProviderDialog-D8VvDmbM.js +0 -1
- package/dist/web/client/assets/AgentTemplateParts-BWorU6-F.js +0 -1
- package/dist/web/client/assets/ConfirmDialog-DrN26lN_.js +0 -1
- package/dist/web/client/assets/ConnectionsView-DcO7RJZ7.js +0 -1
- package/dist/web/client/assets/SkillsParts-BueR3HoP.js +0 -1
- package/dist/web/client/assets/SpawnTeamModal-B65eQyzu.js +0 -1
- package/dist/web/client/assets/TeamForm-BhI9FbjV.js +0 -1
- package/dist/web/client/assets/TeamThread-FPpHlVFc.js +0 -1
- package/dist/web/client/assets/_id-5mTcKU2j.js +0 -1
- package/dist/web/client/assets/_id-DKgyyyeX.js +0 -1
- package/dist/web/client/assets/agents-Bfwz3dl5.js +0 -1
- package/dist/web/client/assets/config-kMzM8kdp.js +0 -1
- package/dist/web/client/assets/index-DuLpyCSP.js +0 -14
- package/dist/web/client/assets/manage-DdCiSgG9.js +0 -1
- package/dist/web/client/assets/mcp-B3LzNtrr.js +0 -1
- package/dist/web/client/assets/routes-BDdLZEGO.js +0 -85
- package/dist/web/client/assets/style-J8ypSsCb.js +0 -7
- package/dist/web/client/assets/styles-C7NsCHeU.css +0 -2
- package/dist/web/client/assets/system-DtBBeAjO.js +0 -1
- package/dist/web/client/assets/teams-D4X9oNx8.js +0 -1
- package/dist/web/client/assets/teams-QlaY2Sxd.js +0 -1
- package/dist/web/client/assets/telegram-B7vlTQbt.js +0 -1
- package/dist/web/client/assets/usage-3mYfS5C-.js +0 -1
- package/dist/web/client/assets/welcome-CkmanVa_.js +0 -1
- package/dist/web/server/assets/mcp-BTZkDvdc.js +0 -379
- package/dist/web/server/assets/src-BeMh8Fze.js +0 -113
- package/dist/web/server/assets/style-B3l0Wtlf.js +0 -178
|
@@ -0,0 +1,753 @@
|
|
|
1
|
+
import { i as api, o as errorMessage } from "./live-DbJeq6KP.js";
|
|
2
|
+
import { c as presetServer, s as MCP_PRESETS } from "./src-ErO6nYmi.js";
|
|
3
|
+
import { t as Button } from "./Button-Dsnw22OF.js";
|
|
4
|
+
import { n as DialogActions, t as Dialog } from "./Dialog-CwAfaXpM.js";
|
|
5
|
+
import { t as ConfirmDialog } from "./ConfirmDialog-CuD5HXTw.js";
|
|
6
|
+
import { a as CardForm, d as Chip, g as Notice, h as ListRow, o as CardList, r as CardBody, s as CardRow, x as Waiting, y as SetupCard } from "./parts-B0wbj_yK.js";
|
|
7
|
+
import { d as TextField, o as SecretField, s as SelectField, t as CheckboxRow } from "./form-Bwsyt9OY.js";
|
|
8
|
+
import { t as Route } from "./mcp-COn047tO.js";
|
|
9
|
+
import { t as ConfigPage } from "./ConfigPage-CrxctbtN.js";
|
|
10
|
+
import { useState } from "react";
|
|
11
|
+
import { useRouter } from "@tanstack/react-router";
|
|
12
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
13
|
+
import { ExternalLink, PlugZap, Plus, Server } from "lucide-react";
|
|
14
|
+
//#region src/lib/mcp-form.ts
|
|
15
|
+
var EMPTY_MCP_DRAFT = {
|
|
16
|
+
name: "",
|
|
17
|
+
transport: "stdio",
|
|
18
|
+
command: "",
|
|
19
|
+
args: "",
|
|
20
|
+
url: "",
|
|
21
|
+
token: ""
|
|
22
|
+
};
|
|
23
|
+
/** The daemon's own rule for an endpoint: http(s), no credentials in it, no fragment. */
|
|
24
|
+
function endpointProblem(value) {
|
|
25
|
+
try {
|
|
26
|
+
const url = new URL(value);
|
|
27
|
+
if (!["http:", "https:"].includes(url.protocol)) return "An http:// or https:// address.";
|
|
28
|
+
if (url.username || url.password) return "No user name or password in the address: a token goes in the field beside it.";
|
|
29
|
+
if (url.hash) return "An address without a # part.";
|
|
30
|
+
return;
|
|
31
|
+
} catch {
|
|
32
|
+
return "An http:// or https:// address.";
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
function mcpServerForm(draft) {
|
|
36
|
+
const name = draft.name.trim();
|
|
37
|
+
const command = draft.command.trim();
|
|
38
|
+
const url = draft.url.trim();
|
|
39
|
+
const problems = {};
|
|
40
|
+
if (name && !/^[a-zA-Z0-9_]+$/.test(name)) problems.name = "Letters, digits and underscores only: its tools are named after it.";
|
|
41
|
+
const stdio = draft.transport === "stdio";
|
|
42
|
+
if (!stdio && url) {
|
|
43
|
+
const problem = endpointProblem(url);
|
|
44
|
+
if (problem) problems.url = problem;
|
|
45
|
+
}
|
|
46
|
+
const complete = name !== "" && (stdio ? command !== "" : url !== "");
|
|
47
|
+
const missing = [
|
|
48
|
+
name,
|
|
49
|
+
command,
|
|
50
|
+
draft.args.trim(),
|
|
51
|
+
url,
|
|
52
|
+
draft.token
|
|
53
|
+
].some((value) => value !== "") && !complete ? stdio ? "A stdio server needs a name and a command." : "An http server needs a name and a URL." : null;
|
|
54
|
+
if (!complete || problems.name || problems.url) return {
|
|
55
|
+
problems,
|
|
56
|
+
missing,
|
|
57
|
+
body: null
|
|
58
|
+
};
|
|
59
|
+
return {
|
|
60
|
+
problems,
|
|
61
|
+
missing,
|
|
62
|
+
body: {
|
|
63
|
+
name,
|
|
64
|
+
transport: draft.transport,
|
|
65
|
+
command: stdio ? command : null,
|
|
66
|
+
args: stdio ? draft.args.split(" ").filter(Boolean) : [],
|
|
67
|
+
url: stdio ? null : url,
|
|
68
|
+
authToken: !stdio && draft.token ? draft.token : void 0
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
/** How many servers Agents are offered, as a card's state. */
|
|
73
|
+
function serversState(servers) {
|
|
74
|
+
if (servers.length === 0) return null;
|
|
75
|
+
const on = servers.filter((server) => server.enabled).length;
|
|
76
|
+
if (on === 0) return {
|
|
77
|
+
label: "None on",
|
|
78
|
+
tone: "neutral"
|
|
79
|
+
};
|
|
80
|
+
if (on === servers.length) return {
|
|
81
|
+
label: on === 1 ? "1 server on" : `${on} servers on`,
|
|
82
|
+
tone: "success"
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
label: `${on} of ${servers.length} on`,
|
|
86
|
+
tone: "success"
|
|
87
|
+
};
|
|
88
|
+
}
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/components/setup/McpCards.tsx
|
|
91
|
+
var serverPath = (id) => `/api/mcp-servers/${encodeURIComponent(id)}`;
|
|
92
|
+
var TRANSPORTS = [{
|
|
93
|
+
value: "stdio",
|
|
94
|
+
label: "stdio"
|
|
95
|
+
}, {
|
|
96
|
+
value: "http",
|
|
97
|
+
label: "http"
|
|
98
|
+
}];
|
|
99
|
+
/** A command Bazilion starts, or an address it calls. */
|
|
100
|
+
function AddServerCard({ onAdded }) {
|
|
101
|
+
const [draft, setDraft] = useState(EMPTY_MCP_DRAFT);
|
|
102
|
+
const [busy, setBusy] = useState(false);
|
|
103
|
+
const [error, setError] = useState(null);
|
|
104
|
+
const form = mcpServerForm(draft);
|
|
105
|
+
const edit = (change) => {
|
|
106
|
+
setError(null);
|
|
107
|
+
setDraft((current) => ({
|
|
108
|
+
...current,
|
|
109
|
+
...change
|
|
110
|
+
}));
|
|
111
|
+
};
|
|
112
|
+
async function add(event) {
|
|
113
|
+
event.preventDefault();
|
|
114
|
+
if (!form.body || busy) return;
|
|
115
|
+
setBusy(true);
|
|
116
|
+
setError(null);
|
|
117
|
+
try {
|
|
118
|
+
await api("/api/mcp-servers", { body: form.body });
|
|
119
|
+
setDraft({
|
|
120
|
+
...EMPTY_MCP_DRAFT,
|
|
121
|
+
transport: draft.transport
|
|
122
|
+
});
|
|
123
|
+
await onAdded();
|
|
124
|
+
} catch (cause) {
|
|
125
|
+
setError(errorMessage(cause));
|
|
126
|
+
} finally {
|
|
127
|
+
setBusy(false);
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return /* @__PURE__ */ jsx(SetupCard, {
|
|
131
|
+
labelledBy: "mcp-add",
|
|
132
|
+
icon: /* @__PURE__ */ jsx(Plus, { className: "size-5" }),
|
|
133
|
+
title: "Add a server",
|
|
134
|
+
description: "A stdio server is a command Bazilion starts; an http server is an address it calls.",
|
|
135
|
+
children: /* @__PURE__ */ jsxs(CardForm, {
|
|
136
|
+
onSubmit: add,
|
|
137
|
+
children: [
|
|
138
|
+
/* @__PURE__ */ jsxs("div", {
|
|
139
|
+
className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[minmax(0,1fr)_12rem]",
|
|
140
|
+
children: [/* @__PURE__ */ jsx(TextField, {
|
|
141
|
+
label: "Name",
|
|
142
|
+
value: draft.name,
|
|
143
|
+
disabled: busy,
|
|
144
|
+
placeholder: "playwright",
|
|
145
|
+
mono: true,
|
|
146
|
+
className: "max-w-none",
|
|
147
|
+
problem: form.problems.name,
|
|
148
|
+
onChange: (name) => edit({ name })
|
|
149
|
+
}), /* @__PURE__ */ jsx(SelectField, {
|
|
150
|
+
label: "Transport",
|
|
151
|
+
value: draft.transport,
|
|
152
|
+
options: TRANSPORTS,
|
|
153
|
+
disabled: busy,
|
|
154
|
+
className: "max-w-none",
|
|
155
|
+
onChange: (transport) => edit({ transport })
|
|
156
|
+
})]
|
|
157
|
+
}),
|
|
158
|
+
draft.transport === "stdio" ? /* @__PURE__ */ jsxs("div", {
|
|
159
|
+
className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[12rem_minmax(0,1fr)]",
|
|
160
|
+
children: [/* @__PURE__ */ jsx(TextField, {
|
|
161
|
+
label: "Command",
|
|
162
|
+
value: draft.command,
|
|
163
|
+
disabled: busy,
|
|
164
|
+
placeholder: "npx",
|
|
165
|
+
mono: true,
|
|
166
|
+
className: "max-w-none",
|
|
167
|
+
onChange: (command) => edit({ command })
|
|
168
|
+
}), /* @__PURE__ */ jsx(TextField, {
|
|
169
|
+
label: "Args (space-separated)",
|
|
170
|
+
value: draft.args,
|
|
171
|
+
disabled: busy,
|
|
172
|
+
placeholder: "-y @modelcontextprotocol/server-filesystem /srv/data",
|
|
173
|
+
mono: true,
|
|
174
|
+
className: "max-w-none",
|
|
175
|
+
onChange: (args) => edit({ args })
|
|
176
|
+
})]
|
|
177
|
+
}) : /* @__PURE__ */ jsxs("div", {
|
|
178
|
+
className: "grid items-start gap-x-3 gap-y-4 sm:grid-cols-[minmax(0,1fr)_16rem]",
|
|
179
|
+
children: [/* @__PURE__ */ jsx(TextField, {
|
|
180
|
+
label: "URL",
|
|
181
|
+
value: draft.url,
|
|
182
|
+
disabled: busy,
|
|
183
|
+
placeholder: "https://mcp.example.com/mcp",
|
|
184
|
+
mono: true,
|
|
185
|
+
inputMode: "url",
|
|
186
|
+
className: "max-w-none",
|
|
187
|
+
problem: form.problems.url,
|
|
188
|
+
onChange: (url) => edit({ url })
|
|
189
|
+
}), /* @__PURE__ */ jsx(SecretField, {
|
|
190
|
+
label: "Bearer token (optional)",
|
|
191
|
+
saved: false,
|
|
192
|
+
value: draft.token,
|
|
193
|
+
disabled: busy,
|
|
194
|
+
onChange: (token) => edit({ token })
|
|
195
|
+
})]
|
|
196
|
+
}),
|
|
197
|
+
/* @__PURE__ */ jsxs("div", {
|
|
198
|
+
className: "flex flex-wrap items-center gap-x-4 gap-y-2",
|
|
199
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
200
|
+
variant: "primary",
|
|
201
|
+
type: "submit",
|
|
202
|
+
disabled: busy || !form.body,
|
|
203
|
+
children: busy ? "Adding…" : "Add server"
|
|
204
|
+
}), error ? /* @__PURE__ */ jsxs("p", {
|
|
205
|
+
role: "alert",
|
|
206
|
+
className: "m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning",
|
|
207
|
+
children: ["Nothing was added: ", error]
|
|
208
|
+
}) : form.missing && /* @__PURE__ */ jsx("p", {
|
|
209
|
+
role: "status",
|
|
210
|
+
className: "m-0 min-w-0 flex-1 basis-56 text-sm font-medium text-warning",
|
|
211
|
+
children: form.missing
|
|
212
|
+
})]
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
})
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
/** Which of a server's tools ask the operator before each call, as a line. */
|
|
219
|
+
function asksLine(server) {
|
|
220
|
+
const choices = Object.entries(server.ask ?? {});
|
|
221
|
+
const rule = "asks you before tools that send or change something";
|
|
222
|
+
if (choices.length === 0) return rule;
|
|
223
|
+
return `${rule}, except ${choices.map(([tool, asks]) => `${tool} (${asks ? "asks" : "never asks"})`).join(", ")}`;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* After a test: tick the tools that ask the operator before each call. What differs from the
|
|
227
|
+
* default rule is saved as a choice; every other tool, one the server adds later too, keeps
|
|
228
|
+
* following the rule.
|
|
229
|
+
*/
|
|
230
|
+
function AskEditor({ server, tools, onSaved }) {
|
|
231
|
+
const byDefault = (tool) => tool.asksByDefault ?? false;
|
|
232
|
+
const [asking, setAsking] = useState(() => Object.fromEntries(tools.map((tool) => [tool.name, server.ask?.[tool.name] ?? byDefault(tool)])));
|
|
233
|
+
const [busy, setBusy] = useState(false);
|
|
234
|
+
const [error, setError] = useState(null);
|
|
235
|
+
async function save(ask) {
|
|
236
|
+
setBusy(true);
|
|
237
|
+
setError(null);
|
|
238
|
+
try {
|
|
239
|
+
await api(serverPath(server.id), {
|
|
240
|
+
method: "PATCH",
|
|
241
|
+
body: { ask }
|
|
242
|
+
});
|
|
243
|
+
await onSaved();
|
|
244
|
+
} catch (cause) {
|
|
245
|
+
setError(errorMessage(cause));
|
|
246
|
+
} finally {
|
|
247
|
+
setBusy(false);
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
if (tools.length === 0) return null;
|
|
251
|
+
const choices = Object.fromEntries(tools.flatMap((tool) => {
|
|
252
|
+
const asks = asking[tool.name] ?? byDefault(tool);
|
|
253
|
+
return asks === byDefault(tool) ? [] : [[tool.name, asks]];
|
|
254
|
+
}));
|
|
255
|
+
const unchanged = JSON.stringify(choices) === JSON.stringify(server.ask ?? {});
|
|
256
|
+
return /* @__PURE__ */ jsxs("fieldset", {
|
|
257
|
+
className: "m-0 mt-2 grid gap-2 border-0 p-0",
|
|
258
|
+
children: [
|
|
259
|
+
/* @__PURE__ */ jsx("legend", {
|
|
260
|
+
className: "mb-1 text-sm font-semibold text-foreground",
|
|
261
|
+
children: "Ask me before each call of"
|
|
262
|
+
}),
|
|
263
|
+
tools.map((tool) => /* @__PURE__ */ jsx(CheckboxRow, {
|
|
264
|
+
label: /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx("code", { children: tool.name }), (asking[tool.name] ?? byDefault(tool)) !== byDefault(tool) && /* @__PURE__ */ jsx("span", {
|
|
265
|
+
className: "text-xs text-muted-foreground",
|
|
266
|
+
children: "your choice"
|
|
267
|
+
})] }),
|
|
268
|
+
checked: asking[tool.name] ?? byDefault(tool),
|
|
269
|
+
disabled: busy,
|
|
270
|
+
onChange: (checked) => setAsking((current) => ({
|
|
271
|
+
...current,
|
|
272
|
+
[tool.name]: checked
|
|
273
|
+
}))
|
|
274
|
+
}, tool.name)),
|
|
275
|
+
/* @__PURE__ */ jsxs("div", {
|
|
276
|
+
className: "flex flex-wrap gap-2",
|
|
277
|
+
children: [/* @__PURE__ */ jsx(Button, {
|
|
278
|
+
variant: "primary",
|
|
279
|
+
disabled: busy || unchanged,
|
|
280
|
+
onClick: () => void save(choices),
|
|
281
|
+
children: "Save"
|
|
282
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
283
|
+
variant: "ghost",
|
|
284
|
+
disabled: busy || Object.keys(server.ask ?? {}).length === 0,
|
|
285
|
+
onClick: () => void save(null),
|
|
286
|
+
children: "Back to the default"
|
|
287
|
+
})]
|
|
288
|
+
}),
|
|
289
|
+
error && /* @__PURE__ */ jsx(Notice, {
|
|
290
|
+
tone: "warning",
|
|
291
|
+
role: "alert",
|
|
292
|
+
children: error
|
|
293
|
+
})
|
|
294
|
+
]
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
/**
|
|
298
|
+
* A stdio server's own variables (a token, a client id): shown by name, replaced or removed, never
|
|
299
|
+
* read back. Saving one restarts the server on its next use.
|
|
300
|
+
*/
|
|
301
|
+
function VariablesEditor({ server, onSaved }) {
|
|
302
|
+
const [name, setName] = useState("");
|
|
303
|
+
const [value, setValue] = useState("");
|
|
304
|
+
const [busy, setBusy] = useState(false);
|
|
305
|
+
const [error, setError] = useState(null);
|
|
306
|
+
const names = server.envNames ?? [];
|
|
307
|
+
const nameProblem = name.trim() && !/^[A-Za-z_][A-Za-z0-9_]*$/.test(name.trim()) ? "Letters, digits and underscores, not starting with a digit." : void 0;
|
|
308
|
+
async function change(env) {
|
|
309
|
+
setBusy(true);
|
|
310
|
+
setError(null);
|
|
311
|
+
try {
|
|
312
|
+
await api(serverPath(server.id), {
|
|
313
|
+
method: "PATCH",
|
|
314
|
+
body: { env }
|
|
315
|
+
});
|
|
316
|
+
setName("");
|
|
317
|
+
setValue("");
|
|
318
|
+
await onSaved();
|
|
319
|
+
} catch (cause) {
|
|
320
|
+
setError(errorMessage(cause));
|
|
321
|
+
} finally {
|
|
322
|
+
setBusy(false);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
326
|
+
className: "mt-2 grid gap-3",
|
|
327
|
+
children: [
|
|
328
|
+
names.length > 0 ? /* @__PURE__ */ jsx("ul", {
|
|
329
|
+
className: "m-0 grid list-none gap-1.5 p-0",
|
|
330
|
+
children: names.map((envName) => /* @__PURE__ */ jsxs("li", {
|
|
331
|
+
className: "flex items-center justify-between gap-3 text-sm",
|
|
332
|
+
children: [/* @__PURE__ */ jsx("code", { children: envName }), /* @__PURE__ */ jsx(Button, {
|
|
333
|
+
variant: "ghost",
|
|
334
|
+
disabled: busy,
|
|
335
|
+
"aria-label": `Remove ${envName} from ${server.name}`,
|
|
336
|
+
onClick: () => void change({ [envName]: null }),
|
|
337
|
+
children: "Remove"
|
|
338
|
+
})]
|
|
339
|
+
}, envName))
|
|
340
|
+
}) : /* @__PURE__ */ jsx("p", {
|
|
341
|
+
className: "m-0 text-sm text-muted-foreground",
|
|
342
|
+
children: "No variables of its own."
|
|
343
|
+
}),
|
|
344
|
+
/* @__PURE__ */ jsxs("form", {
|
|
345
|
+
className: "grid gap-3",
|
|
346
|
+
onSubmit: (event) => {
|
|
347
|
+
event.preventDefault();
|
|
348
|
+
if (name.trim() && value && !nameProblem) change({ [name.trim()]: value });
|
|
349
|
+
},
|
|
350
|
+
children: [
|
|
351
|
+
/* @__PURE__ */ jsx(TextField, {
|
|
352
|
+
label: "Variable",
|
|
353
|
+
value: name,
|
|
354
|
+
mono: true,
|
|
355
|
+
disabled: busy,
|
|
356
|
+
placeholder: "NOTION_TOKEN",
|
|
357
|
+
hint: "A name it already has gets the new value.",
|
|
358
|
+
problem: nameProblem,
|
|
359
|
+
className: "max-w-none",
|
|
360
|
+
onChange: setName
|
|
361
|
+
}),
|
|
362
|
+
/* @__PURE__ */ jsx(SecretField, {
|
|
363
|
+
label: "Value",
|
|
364
|
+
saved: false,
|
|
365
|
+
value,
|
|
366
|
+
disabled: busy,
|
|
367
|
+
hint: "Stored encrypted and given to this server only.",
|
|
368
|
+
onChange: setValue
|
|
369
|
+
}),
|
|
370
|
+
/* @__PURE__ */ jsx("div", { children: /* @__PURE__ */ jsx(Button, {
|
|
371
|
+
variant: "primary",
|
|
372
|
+
type: "submit",
|
|
373
|
+
disabled: busy || !name.trim() || !value || nameProblem !== void 0,
|
|
374
|
+
children: busy ? "Saving…" : "Save the variable"
|
|
375
|
+
}) })
|
|
376
|
+
]
|
|
377
|
+
}),
|
|
378
|
+
error && /* @__PURE__ */ jsx(Notice, {
|
|
379
|
+
tone: "warning",
|
|
380
|
+
role: "alert",
|
|
381
|
+
children: error
|
|
382
|
+
})
|
|
383
|
+
]
|
|
384
|
+
});
|
|
385
|
+
}
|
|
386
|
+
/** The servers whose tools are offered to every Agent turn while they are switched on. */
|
|
387
|
+
function ServersCard({ servers, onChanged }) {
|
|
388
|
+
const [tests, setTests] = useState({});
|
|
389
|
+
const [busyId, setBusyId] = useState(null);
|
|
390
|
+
const [variablesOf, setVariablesOf] = useState(null);
|
|
391
|
+
const [error, setError] = useState(null);
|
|
392
|
+
const [deleting, setDeleting] = useState(null);
|
|
393
|
+
const state = serversState(servers);
|
|
394
|
+
async function toggle(server) {
|
|
395
|
+
setBusyId(server.id);
|
|
396
|
+
setError(null);
|
|
397
|
+
try {
|
|
398
|
+
await api(serverPath(server.id), {
|
|
399
|
+
method: "PATCH",
|
|
400
|
+
body: { enabled: !server.enabled }
|
|
401
|
+
});
|
|
402
|
+
await onChanged();
|
|
403
|
+
} catch (cause) {
|
|
404
|
+
setError(errorMessage(cause));
|
|
405
|
+
} finally {
|
|
406
|
+
setBusyId(null);
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
async function test(id) {
|
|
410
|
+
setTests((current) => ({
|
|
411
|
+
...current,
|
|
412
|
+
[id]: { kind: "pending" }
|
|
413
|
+
}));
|
|
414
|
+
let result;
|
|
415
|
+
try {
|
|
416
|
+
const body = await api(`${serverPath(id)}/test`, { method: "POST" });
|
|
417
|
+
const tools = body.tools ?? [];
|
|
418
|
+
result = body.ok ? {
|
|
419
|
+
kind: "success",
|
|
420
|
+
message: `${tools.length === 1 ? "1 tool" : `${tools.length} tools`}: ${tools.map((tool) => tool.name).join(", ")}`,
|
|
421
|
+
tools
|
|
422
|
+
} : {
|
|
423
|
+
kind: "error",
|
|
424
|
+
message: body.error ?? "Test failed"
|
|
425
|
+
};
|
|
426
|
+
} catch (cause) {
|
|
427
|
+
result = {
|
|
428
|
+
kind: "error",
|
|
429
|
+
message: errorMessage(cause)
|
|
430
|
+
};
|
|
431
|
+
}
|
|
432
|
+
setTests((current) => ({
|
|
433
|
+
...current,
|
|
434
|
+
[id]: result
|
|
435
|
+
}));
|
|
436
|
+
}
|
|
437
|
+
return /* @__PURE__ */ jsxs(SetupCard, {
|
|
438
|
+
labelledBy: "mcp-servers",
|
|
439
|
+
icon: /* @__PURE__ */ jsx(Server, { className: "size-5" }),
|
|
440
|
+
title: "Servers",
|
|
441
|
+
description: "Their tools are offered to every Agent turn while they are switched on.",
|
|
442
|
+
action: state && /* @__PURE__ */ jsx(Chip, {
|
|
443
|
+
tone: state.tone,
|
|
444
|
+
children: state.label
|
|
445
|
+
}),
|
|
446
|
+
children: [
|
|
447
|
+
servers.length === 0 ? /* @__PURE__ */ jsx(CardRow, {
|
|
448
|
+
className: "py-4 text-sm text-muted-foreground",
|
|
449
|
+
children: "No MCP servers yet; add one above."
|
|
450
|
+
}) : /* @__PURE__ */ jsx(CardList, { children: servers.map((server) => {
|
|
451
|
+
const result = tests[server.id];
|
|
452
|
+
const busy = busyId === server.id;
|
|
453
|
+
return /* @__PURE__ */ jsxs(ListRow, {
|
|
454
|
+
title: server.name,
|
|
455
|
+
chip: /* @__PURE__ */ jsx(Chip, {
|
|
456
|
+
tone: server.enabled ? "success" : "neutral",
|
|
457
|
+
children: server.enabled ? "Enabled" : "Disabled"
|
|
458
|
+
}),
|
|
459
|
+
meta: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
460
|
+
/* @__PURE__ */ jsx("span", { children: server.transport }),
|
|
461
|
+
server.hasAuthToken && /* @__PURE__ */ jsx("span", { children: "bearer token" }),
|
|
462
|
+
server.envNames && server.envNames.length > 0 && /* @__PURE__ */ jsxs("span", { children: ["variables: ", server.envNames.join(", ")] }),
|
|
463
|
+
/* @__PURE__ */ jsx("span", { children: asksLine(server) }),
|
|
464
|
+
/* @__PURE__ */ jsx("code", {
|
|
465
|
+
className: "break-all",
|
|
466
|
+
children: server.transport === "stdio" ? `${server.command ?? ""} ${server.args.join(" ")}`.trim() : server.url
|
|
467
|
+
})
|
|
468
|
+
] }),
|
|
469
|
+
actions: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
470
|
+
/* @__PURE__ */ jsx(Button, {
|
|
471
|
+
variant: "ghost",
|
|
472
|
+
disabled: result?.kind === "pending",
|
|
473
|
+
"aria-label": `Test ${server.name}`,
|
|
474
|
+
onClick: () => void test(server.id),
|
|
475
|
+
children: "Test"
|
|
476
|
+
}),
|
|
477
|
+
server.transport === "stdio" && /* @__PURE__ */ jsx(Button, {
|
|
478
|
+
variant: "ghost",
|
|
479
|
+
"aria-expanded": variablesOf === server.id,
|
|
480
|
+
"aria-label": `Variables of ${server.name}`,
|
|
481
|
+
onClick: () => setVariablesOf((current) => current === server.id ? null : server.id),
|
|
482
|
+
children: "Variables"
|
|
483
|
+
}),
|
|
484
|
+
/* @__PURE__ */ jsx(Button, {
|
|
485
|
+
variant: "ghost",
|
|
486
|
+
disabled: busy,
|
|
487
|
+
"aria-label": `${server.enabled ? "Disable" : "Enable"} ${server.name}`,
|
|
488
|
+
onClick: () => void toggle(server),
|
|
489
|
+
children: busy ? "Working…" : server.enabled ? "Disable" : "Enable"
|
|
490
|
+
}),
|
|
491
|
+
/* @__PURE__ */ jsx(Button, {
|
|
492
|
+
variant: "danger",
|
|
493
|
+
disabled: busy,
|
|
494
|
+
"aria-label": `Delete ${server.name}`,
|
|
495
|
+
onClick: () => setDeleting(server),
|
|
496
|
+
children: "Delete"
|
|
497
|
+
})
|
|
498
|
+
] }),
|
|
499
|
+
children: [
|
|
500
|
+
variablesOf === server.id && /* @__PURE__ */ jsx(VariablesEditor, {
|
|
501
|
+
server,
|
|
502
|
+
onSaved: onChanged
|
|
503
|
+
}),
|
|
504
|
+
result?.kind === "pending" && /* @__PURE__ */ jsx(Waiting, { children: "Connecting…" }),
|
|
505
|
+
result?.kind === "success" && /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Notice, {
|
|
506
|
+
tone: "success",
|
|
507
|
+
children: result.message
|
|
508
|
+
}), /* @__PURE__ */ jsx(AskEditor, {
|
|
509
|
+
server,
|
|
510
|
+
tools: result.tools,
|
|
511
|
+
onSaved: onChanged
|
|
512
|
+
}, JSON.stringify(server.ask ?? {}))] }),
|
|
513
|
+
result?.kind === "error" && /* @__PURE__ */ jsx(Notice, {
|
|
514
|
+
tone: "warning",
|
|
515
|
+
role: "alert",
|
|
516
|
+
children: result.message
|
|
517
|
+
})
|
|
518
|
+
]
|
|
519
|
+
}, server.id);
|
|
520
|
+
}) }),
|
|
521
|
+
error && /* @__PURE__ */ jsx(CardBody, { children: /* @__PURE__ */ jsx(Notice, {
|
|
522
|
+
tone: "warning",
|
|
523
|
+
role: "alert",
|
|
524
|
+
title: "That did not work.",
|
|
525
|
+
children: error
|
|
526
|
+
}) }),
|
|
527
|
+
/* @__PURE__ */ jsx(ConfirmDialog, {
|
|
528
|
+
open: deleting !== null,
|
|
529
|
+
onOpenChange: (open) => {
|
|
530
|
+
if (!open) setDeleting(null);
|
|
531
|
+
},
|
|
532
|
+
title: `Delete MCP server ${deleting?.name ?? ""}?`,
|
|
533
|
+
description: /* @__PURE__ */ jsx("p", {
|
|
534
|
+
className: "m-0",
|
|
535
|
+
children: "This removes the server with its stored bearer token and variables, closes its connection and removes its tools from later Agent turns."
|
|
536
|
+
}),
|
|
537
|
+
confirmLabel: "Delete MCP server",
|
|
538
|
+
onConfirm: async () => {
|
|
539
|
+
if (!deleting) return;
|
|
540
|
+
await api(serverPath(deleting.id), { method: "DELETE" });
|
|
541
|
+
await onChanged();
|
|
542
|
+
}
|
|
543
|
+
})
|
|
544
|
+
]
|
|
545
|
+
});
|
|
546
|
+
}
|
|
547
|
+
//#endregion
|
|
548
|
+
//#region src/components/setup/McpPresets.tsx
|
|
549
|
+
/** A server made from this preset: the same command and package. */
|
|
550
|
+
function madeFrom(preset, server) {
|
|
551
|
+
const pkg = preset.args.find((arg) => !arg.startsWith("-"));
|
|
552
|
+
return server.command === preset.command && pkg !== void 0 && server.args.includes(pkg);
|
|
553
|
+
}
|
|
554
|
+
function CommonConnectionsCard({ servers, onAdded }) {
|
|
555
|
+
const [open, setOpen] = useState(null);
|
|
556
|
+
return /* @__PURE__ */ jsxs(SetupCard, {
|
|
557
|
+
labelledBy: "mcp-common",
|
|
558
|
+
icon: /* @__PURE__ */ jsx(PlugZap, { className: "size-5" }),
|
|
559
|
+
title: "Common connections",
|
|
560
|
+
description: "Mail, calendars, chat and notes your Agents can work in. Each is a third-party MCP server that runs on this computer; its tools that send or change something ask you first.",
|
|
561
|
+
children: [/* @__PURE__ */ jsx(CardList, { children: MCP_PRESETS.map((preset) => {
|
|
562
|
+
const added = servers.find((server) => madeFrom(preset, server));
|
|
563
|
+
return /* @__PURE__ */ jsx(ListRow, {
|
|
564
|
+
title: preset.title,
|
|
565
|
+
chip: added && /* @__PURE__ */ jsxs(Chip, {
|
|
566
|
+
tone: "success",
|
|
567
|
+
children: ["Added as ", added.name]
|
|
568
|
+
}),
|
|
569
|
+
meta: /* @__PURE__ */ jsx("span", { children: preset.does }),
|
|
570
|
+
actions: /* @__PURE__ */ jsx(Button, {
|
|
571
|
+
variant: added ? "ghost" : "primary",
|
|
572
|
+
"aria-label": `Connect ${preset.title}`,
|
|
573
|
+
onClick: () => setOpen(preset),
|
|
574
|
+
children: added ? "Add another" : "Connect"
|
|
575
|
+
})
|
|
576
|
+
}, preset.id);
|
|
577
|
+
}) }), open && /* @__PURE__ */ jsx(PresetDialog, {
|
|
578
|
+
preset: open,
|
|
579
|
+
taken: servers.map((server) => server.name),
|
|
580
|
+
onClose: () => setOpen(null),
|
|
581
|
+
onAdded: async () => {
|
|
582
|
+
setOpen(null);
|
|
583
|
+
await onAdded();
|
|
584
|
+
}
|
|
585
|
+
})]
|
|
586
|
+
});
|
|
587
|
+
}
|
|
588
|
+
function PresetDialog({ preset, taken, onClose, onAdded }) {
|
|
589
|
+
const [name, setName] = useState(taken.includes(preset.id) ? `${preset.id}_2` : preset.id);
|
|
590
|
+
const [values, setValues] = useState({});
|
|
591
|
+
const [chosen, setChosen] = useState([]);
|
|
592
|
+
const [busy, setBusy] = useState(false);
|
|
593
|
+
const [error, setError] = useState(null);
|
|
594
|
+
const made = presetServer(preset, {
|
|
595
|
+
name,
|
|
596
|
+
chosen,
|
|
597
|
+
values
|
|
598
|
+
});
|
|
599
|
+
const nameProblem = !/^[a-zA-Z0-9_]+$/.test(name.trim()) ? "Letters, digits and underscores only: its tools are named after it." : taken.includes(name.trim()) ? "A server already has this name." : void 0;
|
|
600
|
+
const missing = preset.fields.filter((field) => !values[field.name]?.trim());
|
|
601
|
+
async function add(event) {
|
|
602
|
+
event.preventDefault();
|
|
603
|
+
if (nameProblem || missing.length > 0) return;
|
|
604
|
+
setBusy(true);
|
|
605
|
+
setError(null);
|
|
606
|
+
try {
|
|
607
|
+
await api("/api/mcp-servers", { body: {
|
|
608
|
+
name: made.name,
|
|
609
|
+
transport: "stdio",
|
|
610
|
+
command: made.command,
|
|
611
|
+
args: made.args,
|
|
612
|
+
env: made.env
|
|
613
|
+
} });
|
|
614
|
+
await onAdded();
|
|
615
|
+
} catch (cause) {
|
|
616
|
+
setError(errorMessage(cause));
|
|
617
|
+
setBusy(false);
|
|
618
|
+
}
|
|
619
|
+
}
|
|
620
|
+
return /* @__PURE__ */ jsx(Dialog, {
|
|
621
|
+
title: `Connect ${preset.title}`,
|
|
622
|
+
description: preset.does,
|
|
623
|
+
busy,
|
|
624
|
+
onClose,
|
|
625
|
+
children: /* @__PURE__ */ jsxs("form", {
|
|
626
|
+
onSubmit: (event) => void add(event),
|
|
627
|
+
className: "grid gap-4",
|
|
628
|
+
children: [
|
|
629
|
+
/* @__PURE__ */ jsx("p", {
|
|
630
|
+
className: "m-0 text-sm text-mocha",
|
|
631
|
+
children: preset.signIn
|
|
632
|
+
}),
|
|
633
|
+
preset.needs && /* @__PURE__ */ jsxs("p", {
|
|
634
|
+
className: "m-0 text-sm text-mocha",
|
|
635
|
+
children: ["Needs on this computer: ", /* @__PURE__ */ jsx("strong", {
|
|
636
|
+
className: "text-foreground",
|
|
637
|
+
children: preset.needs
|
|
638
|
+
})]
|
|
639
|
+
}),
|
|
640
|
+
preset.caveat && /* @__PURE__ */ jsx(Notice, {
|
|
641
|
+
tone: "warning",
|
|
642
|
+
children: preset.caveat
|
|
643
|
+
}),
|
|
644
|
+
preset.fields.map((field) => field.secret ? /* @__PURE__ */ jsx(SecretField, {
|
|
645
|
+
label: field.label,
|
|
646
|
+
saved: false,
|
|
647
|
+
value: values[field.name] ?? "",
|
|
648
|
+
hint: field.hint,
|
|
649
|
+
disabled: busy,
|
|
650
|
+
onChange: (value) => setValues((current) => ({
|
|
651
|
+
...current,
|
|
652
|
+
[field.name]: value
|
|
653
|
+
}))
|
|
654
|
+
}, field.name) : /* @__PURE__ */ jsx(TextField, {
|
|
655
|
+
label: field.label,
|
|
656
|
+
value: values[field.name] ?? "",
|
|
657
|
+
hint: field.hint,
|
|
658
|
+
mono: true,
|
|
659
|
+
disabled: busy,
|
|
660
|
+
className: "max-w-none",
|
|
661
|
+
onChange: (value) => setValues((current) => ({
|
|
662
|
+
...current,
|
|
663
|
+
[field.name]: value
|
|
664
|
+
}))
|
|
665
|
+
}, field.name)),
|
|
666
|
+
preset.options.map((option) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(CheckboxRow, {
|
|
667
|
+
label: option.label,
|
|
668
|
+
checked: chosen.includes(option.id),
|
|
669
|
+
disabled: busy,
|
|
670
|
+
onChange: (checked) => setChosen((current) => checked ? [...current, option.id] : current.filter((id) => id !== option.id))
|
|
671
|
+
}), /* @__PURE__ */ jsx("p", {
|
|
672
|
+
className: "m-0 mt-1 pl-7 text-xs text-muted-foreground",
|
|
673
|
+
children: option.hint
|
|
674
|
+
})] }, option.id)),
|
|
675
|
+
/* @__PURE__ */ jsx(TextField, {
|
|
676
|
+
label: "Name",
|
|
677
|
+
value: name,
|
|
678
|
+
mono: true,
|
|
679
|
+
disabled: busy,
|
|
680
|
+
hint: "Its tools are named mcp__<name>__<tool>.",
|
|
681
|
+
problem: nameProblem,
|
|
682
|
+
className: "max-w-none",
|
|
683
|
+
onChange: setName
|
|
684
|
+
}),
|
|
685
|
+
/* @__PURE__ */ jsxs("p", {
|
|
686
|
+
className: "m-0 text-xs text-muted-foreground",
|
|
687
|
+
children: [
|
|
688
|
+
"It runs ",
|
|
689
|
+
/* @__PURE__ */ jsx("code", { children: [made.command, ...made.args].join(" ") }),
|
|
690
|
+
".",
|
|
691
|
+
" ",
|
|
692
|
+
/* @__PURE__ */ jsxs("a", {
|
|
693
|
+
href: preset.guide,
|
|
694
|
+
target: "_blank",
|
|
695
|
+
rel: "noreferrer",
|
|
696
|
+
className: "inline-flex items-center gap-0.5",
|
|
697
|
+
children: ["Its guide", /* @__PURE__ */ jsx(ExternalLink, {
|
|
698
|
+
className: "size-3",
|
|
699
|
+
"aria-hidden": "true"
|
|
700
|
+
})]
|
|
701
|
+
})
|
|
702
|
+
]
|
|
703
|
+
}),
|
|
704
|
+
error && /* @__PURE__ */ jsx(Notice, {
|
|
705
|
+
tone: "warning",
|
|
706
|
+
role: "alert",
|
|
707
|
+
title: "It was not added.",
|
|
708
|
+
children: error
|
|
709
|
+
}),
|
|
710
|
+
/* @__PURE__ */ jsxs(DialogActions, { children: [/* @__PURE__ */ jsx(Button, {
|
|
711
|
+
variant: "ghost",
|
|
712
|
+
disabled: busy,
|
|
713
|
+
onClick: onClose,
|
|
714
|
+
children: "Cancel"
|
|
715
|
+
}), /* @__PURE__ */ jsx(Button, {
|
|
716
|
+
variant: "primary",
|
|
717
|
+
type: "submit",
|
|
718
|
+
disabled: busy || nameProblem !== void 0 || missing.length > 0,
|
|
719
|
+
children: busy ? "Adding…" : `Add ${preset.title}`
|
|
720
|
+
})] })
|
|
721
|
+
]
|
|
722
|
+
})
|
|
723
|
+
});
|
|
724
|
+
}
|
|
725
|
+
//#endregion
|
|
726
|
+
//#region src/routes/config/mcp.tsx?tsr-split=component
|
|
727
|
+
function McpPage() {
|
|
728
|
+
const { servers } = Route.useLoaderData();
|
|
729
|
+
const router = useRouter();
|
|
730
|
+
const reload = () => router.invalidate({ sync: true });
|
|
731
|
+
return /* @__PURE__ */ jsxs(ConfigPage, {
|
|
732
|
+
title: "MCP servers",
|
|
733
|
+
description: /* @__PURE__ */ jsxs(Fragment$1, { children: [
|
|
734
|
+
"Tools from these Model Context Protocol servers are offered to every Agent turn as",
|
|
735
|
+
" ",
|
|
736
|
+
/* @__PURE__ */ jsx("code", { children: "mcp__<server>__<tool>" }),
|
|
737
|
+
". A stdio server runs as a daemon child process with the configured provider keys and secrets, never Bazilion's own credentials; a Streamable HTTP server can use a bearer token."
|
|
738
|
+
] }),
|
|
739
|
+
children: [
|
|
740
|
+
/* @__PURE__ */ jsx(CommonConnectionsCard, {
|
|
741
|
+
servers,
|
|
742
|
+
onAdded: reload
|
|
743
|
+
}),
|
|
744
|
+
/* @__PURE__ */ jsx(AddServerCard, { onAdded: reload }),
|
|
745
|
+
/* @__PURE__ */ jsx(ServersCard, {
|
|
746
|
+
servers,
|
|
747
|
+
onChanged: reload
|
|
748
|
+
})
|
|
749
|
+
]
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
//#endregion
|
|
753
|
+
export { McpPage as component };
|