@agent-native/core 0.104.0 → 0.106.0
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/corpus/README.md +1 -1
- package/corpus/core/CHANGELOG.md +64 -0
- package/corpus/core/package.json +1 -1
- package/corpus/core/src/client/AgentPanel.tsx +1 -1
- package/corpus/core/src/client/AssistantChat.tsx +4 -0
- package/corpus/core/src/client/MultiTabAssistantChat.tsx +5 -1
- package/corpus/core/src/client/composer/PromptComposer.tsx +8 -0
- package/corpus/core/src/client/composer/TiptapComposer.tsx +38 -1
- package/corpus/core/src/client/resources/McpIntegrationDialog.tsx +107 -32
- package/corpus/core/src/client/resources/mcp-integration-catalog.ts +33 -0
- package/corpus/core/src/client/resources/use-mcp-servers.ts +1 -0
- package/corpus/core/src/client/use-chat-models.ts +10 -2
- package/corpus/core/src/connections/catalog.ts +107 -6
- package/corpus/core/src/deploy/build.ts +23 -0
- package/corpus/core/src/localization/default-messages.ts +2 -0
- package/corpus/core/src/mcp/actions/call-mcp-tool.ts +18 -0
- package/corpus/core/src/mcp/actions/list-mcp-tools.ts +18 -0
- package/corpus/core/src/mcp-client/app-api.ts +136 -0
- package/corpus/core/src/mcp-client/index.ts +21 -0
- package/corpus/core/src/mcp-client/oauth-client.ts +462 -0
- package/corpus/core/src/mcp-client/oauth-routes.ts +307 -0
- package/corpus/core/src/mcp-client/remote-store.ts +93 -118
- package/corpus/core/src/mcp-client/remote-url.ts +97 -0
- package/corpus/core/src/mcp-client/routes.ts +11 -0
- package/corpus/core/src/oauth-tokens/store.ts +10 -4
- package/corpus/core/src/provider-api/index.ts +690 -55
- package/corpus/core/src/secrets/register-framework-secrets.ts +30 -0
- package/corpus/core/src/server/action-discovery.ts +2 -0
- package/corpus/core/src/server/core-routes-plugin.ts +9 -1
- package/corpus/core/src/server/workspace-provider-oauth.ts +448 -61
- package/corpus/core/src/templates/default/AGENTS.md +9 -7
- package/corpus/core/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +46 -0
- package/corpus/templates/analytics/app/lib/data-source-status.ts +2 -0
- package/corpus/templates/analytics/app/pages/DataSources.tsx +61 -0
- package/corpus/templates/analytics/server/handlers/jira.ts +7 -0
- package/corpus/templates/analytics/server/lib/jira.ts +14 -42
- package/corpus/templates/analytics/server/routes/api/test-connection.post.ts +11 -0
- package/corpus/templates/clips/app/routes.ts +3 -1
- package/corpus/templates/dispatch/app/routes/integrations.tsx +57 -4
- package/dist/client/AgentPanel.js +1 -1
- package/dist/client/AgentPanel.js.map +1 -1
- package/dist/client/AssistantChat.d.ts +2 -0
- package/dist/client/AssistantChat.d.ts.map +1 -1
- package/dist/client/AssistantChat.js +2 -2
- package/dist/client/AssistantChat.js.map +1 -1
- package/dist/client/MultiTabAssistantChat.d.ts.map +1 -1
- package/dist/client/MultiTabAssistantChat.js +5 -2
- package/dist/client/MultiTabAssistantChat.js.map +1 -1
- package/dist/client/composer/PromptComposer.d.ts +2 -0
- package/dist/client/composer/PromptComposer.d.ts.map +1 -1
- package/dist/client/composer/PromptComposer.js +5 -2
- package/dist/client/composer/PromptComposer.js.map +1 -1
- package/dist/client/composer/TiptapComposer.d.ts +4 -1
- package/dist/client/composer/TiptapComposer.d.ts.map +1 -1
- package/dist/client/composer/TiptapComposer.js +13 -5
- package/dist/client/composer/TiptapComposer.js.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.d.ts.map +1 -1
- package/dist/client/resources/McpIntegrationDialog.js +58 -14
- package/dist/client/resources/McpIntegrationDialog.js.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.d.ts +9 -0
- package/dist/client/resources/mcp-integration-catalog.d.ts.map +1 -1
- package/dist/client/resources/mcp-integration-catalog.js +13 -0
- package/dist/client/resources/mcp-integration-catalog.js.map +1 -1
- package/dist/client/resources/use-mcp-servers.d.ts +1 -0
- package/dist/client/resources/use-mcp-servers.d.ts.map +1 -1
- package/dist/client/resources/use-mcp-servers.js.map +1 -1
- package/dist/client/use-chat-models.d.ts +1 -0
- package/dist/client/use-chat-models.d.ts.map +1 -1
- package/dist/client/use-chat-models.js +8 -2
- package/dist/client/use-chat-models.js.map +1 -1
- package/dist/collab/awareness.d.ts +2 -2
- package/dist/collab/awareness.d.ts.map +1 -1
- package/dist/collab/routes.d.ts +1 -1
- package/dist/connections/catalog.d.ts +78 -7
- package/dist/connections/catalog.d.ts.map +1 -1
- package/dist/connections/catalog.js +97 -6
- package/dist/connections/catalog.js.map +1 -1
- package/dist/deploy/build.d.ts.map +1 -1
- package/dist/deploy/build.js +17 -0
- package/dist/deploy/build.js.map +1 -1
- package/dist/file-upload/actions/upload-image.d.ts +1 -1
- package/dist/localization/default-messages.d.ts +2 -0
- package/dist/localization/default-messages.d.ts.map +1 -1
- package/dist/localization/default-messages.js +2 -0
- package/dist/localization/default-messages.js.map +1 -1
- package/dist/mcp/actions/call-mcp-tool.d.ts +7 -0
- package/dist/mcp/actions/call-mcp-tool.d.ts.map +1 -0
- package/dist/mcp/actions/call-mcp-tool.js +15 -0
- package/dist/mcp/actions/call-mcp-tool.js.map +1 -0
- package/dist/mcp/actions/list-mcp-tools.d.ts +5 -0
- package/dist/mcp/actions/list-mcp-tools.d.ts.map +1 -0
- package/dist/mcp/actions/list-mcp-tools.js +16 -0
- package/dist/mcp/actions/list-mcp-tools.js.map +1 -0
- package/dist/mcp-client/app-api.d.ts +34 -0
- package/dist/mcp-client/app-api.d.ts.map +1 -0
- package/dist/mcp-client/app-api.js +94 -0
- package/dist/mcp-client/app-api.js.map +1 -0
- package/dist/mcp-client/index.d.ts +3 -1
- package/dist/mcp-client/index.d.ts.map +1 -1
- package/dist/mcp-client/index.js +3 -1
- package/dist/mcp-client/index.js.map +1 -1
- package/dist/mcp-client/oauth-client.d.ts +113 -0
- package/dist/mcp-client/oauth-client.d.ts.map +1 -0
- package/dist/mcp-client/oauth-client.js +316 -0
- package/dist/mcp-client/oauth-client.js.map +1 -0
- package/dist/mcp-client/oauth-routes.d.ts +25 -0
- package/dist/mcp-client/oauth-routes.d.ts.map +1 -0
- package/dist/mcp-client/oauth-routes.js +218 -0
- package/dist/mcp-client/oauth-routes.js.map +1 -0
- package/dist/mcp-client/remote-store.d.ts +21 -6
- package/dist/mcp-client/remote-store.d.ts.map +1 -1
- package/dist/mcp-client/remote-store.js +72 -124
- package/dist/mcp-client/remote-store.js.map +1 -1
- package/dist/mcp-client/remote-url.d.ts +8 -0
- package/dist/mcp-client/remote-url.d.ts.map +1 -0
- package/dist/mcp-client/remote-url.js +103 -0
- package/dist/mcp-client/remote-url.js.map +1 -0
- package/dist/mcp-client/routes.d.ts +1 -0
- package/dist/mcp-client/routes.d.ts.map +1 -1
- package/dist/mcp-client/routes.js +9 -0
- package/dist/mcp-client/routes.js.map +1 -1
- package/dist/notifications/routes.d.ts +3 -3
- package/dist/oauth-tokens/store.d.ts +2 -2
- package/dist/oauth-tokens/store.d.ts.map +1 -1
- package/dist/oauth-tokens/store.js +10 -6
- package/dist/oauth-tokens/store.js.map +1 -1
- package/dist/observability/routes.d.ts +5 -5
- package/dist/progress/routes.d.ts +1 -1
- package/dist/provider-api/index.d.ts +14 -0
- package/dist/provider-api/index.d.ts.map +1 -1
- package/dist/provider-api/index.js +499 -61
- package/dist/provider-api/index.js.map +1 -1
- package/dist/resources/handlers.d.ts +1 -1
- package/dist/secrets/register-framework-secrets.d.ts.map +1 -1
- package/dist/secrets/register-framework-secrets.js +28 -0
- package/dist/secrets/register-framework-secrets.js.map +1 -1
- package/dist/secrets/routes.d.ts +9 -9
- package/dist/server/action-discovery.d.ts.map +1 -1
- package/dist/server/action-discovery.js +2 -0
- package/dist/server/action-discovery.js.map +1 -1
- package/dist/server/core-routes-plugin.d.ts.map +1 -1
- package/dist/server/core-routes-plugin.js +9 -1
- package/dist/server/core-routes-plugin.js.map +1 -1
- package/dist/server/workspace-provider-oauth.d.ts +10 -3
- package/dist/server/workspace-provider-oauth.d.ts.map +1 -1
- package/dist/server/workspace-provider-oauth.js +325 -43
- package/dist/server/workspace-provider-oauth.js.map +1 -1
- package/dist/templates/default/AGENTS.md +9 -7
- package/dist/templates/workspace-core/.agents/skills/external-agents/SKILL.md +46 -0
- package/package.json +2 -2
- package/src/templates/default/AGENTS.md +9 -7
- package/src/templates/workspace-core/.agents/skills/external-agents/SKILL.md +46 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpIntegrationDialog.d.ts","sourceRoot":"","sources":["../../../src/client/resources/McpIntegrationDialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"McpIntegrationDialog.d.ts","sourceRoot":"","sources":["../../../src/client/resources/McpIntegrationDialog.tsx"],"names":[],"mappings":"AAiCA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACpB,MAAM,sBAAsB,CAAC;AAI9B,UAAU,yBAAyB;IACjC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,YAAY,EAAE,cAAc,CAAC;IAC7B,eAAe,EAAE,OAAO,CAAC;IACzB,MAAM,EAAE,OAAO,CAAC;IAChB,iBAAiB,EAAE,CAAC,IAAI,EAAE,mBAAmB,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACnE,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAgCD,wBAAgB,oBAAoB,CAAC,EACnC,IAAI,EACJ,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,MAAM,EACN,iBAAiB,EACjB,SAAS,GACV,EAAE,yBAAyB,sCA6jB3B"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { IconArrowLeft, IconCheck, IconExternalLink, IconLoader2, IconSearch, } from "@tabler/icons-react";
|
|
3
3
|
import { useEffect, useMemo, useRef, useState } from "react";
|
|
4
|
+
import { agentNativePath } from "../api-path.js";
|
|
4
5
|
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle, } from "../components/ui/dialog.js";
|
|
5
6
|
import { Tooltip, TooltipContent, TooltipTrigger, } from "../components/ui/tooltip.js";
|
|
6
7
|
import { useT } from "../i18n.js";
|
|
7
8
|
import { cn } from "../utils.js";
|
|
8
|
-
import { createMcpIntegrationFormDefaults, filterMcpIntegrations, getDefaultMcpIntegrations, isCustomMcpIntegrationEnabled, } from "./mcp-integration-catalog.js";
|
|
9
|
+
import { buildMcpOAuthStartUrl, createMcpIntegrationFormDefaults, filterMcpIntegrations, getDefaultMcpIntegrations, isCustomMcpIntegrationEnabled, resolveMcpIntegrationScope, } from "./mcp-integration-catalog.js";
|
|
9
10
|
import { formatMcpServerError, getMcpUrlValidationError, testMcpServerUrl, useMcpServers, } from "./use-mcp-servers.js";
|
|
10
11
|
function parseHeaderLines(text) {
|
|
11
12
|
const out = {};
|
|
@@ -39,7 +40,8 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
|
|
|
39
40
|
const [mode, setMode] = useState("catalog");
|
|
40
41
|
const [query, setQuery] = useState("");
|
|
41
42
|
const [selected, setSelected] = useState(null);
|
|
42
|
-
const
|
|
43
|
+
const safeDefaultScope = resolveMcpIntegrationScope(defaultScope, hasOrg, canCreateOrgMcp);
|
|
44
|
+
const [scope, setScope] = useState(safeDefaultScope);
|
|
43
45
|
const [name, setName] = useState("");
|
|
44
46
|
const [url, setUrl] = useState("");
|
|
45
47
|
const [description, setDescription] = useState("");
|
|
@@ -72,7 +74,7 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
|
|
|
72
74
|
setMode(showCatalog ? "catalog" : "form");
|
|
73
75
|
setQuery("");
|
|
74
76
|
setSelected(null);
|
|
75
|
-
setScope(
|
|
77
|
+
setScope(safeDefaultScope);
|
|
76
78
|
setName("");
|
|
77
79
|
setUrl("");
|
|
78
80
|
setDescription("");
|
|
@@ -81,7 +83,7 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
|
|
|
81
83
|
setQuickBusyId(null);
|
|
82
84
|
setError(null);
|
|
83
85
|
setTestResult(null);
|
|
84
|
-
}, [
|
|
86
|
+
}, [open, safeDefaultScope, showCatalog]);
|
|
85
87
|
useEffect(() => {
|
|
86
88
|
if (open && mode === "form") {
|
|
87
89
|
const timer = window.setTimeout(() => inputRef.current?.focus(), 60);
|
|
@@ -95,7 +97,7 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
|
|
|
95
97
|
const openForm = (integration) => {
|
|
96
98
|
const defaults = createMcpIntegrationFormDefaults(integration);
|
|
97
99
|
setSelected(integration ?? null);
|
|
98
|
-
setScope(
|
|
100
|
+
setScope(safeDefaultScope);
|
|
99
101
|
setName(defaults.name);
|
|
100
102
|
setUrl(defaults.url);
|
|
101
103
|
setDescription(defaults.description);
|
|
@@ -104,6 +106,42 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
|
|
|
104
106
|
setTestResult(null);
|
|
105
107
|
setMode("form");
|
|
106
108
|
};
|
|
109
|
+
const beginOAuth = (args) => {
|
|
110
|
+
const validationError = getMcpUrlValidationError(args.url);
|
|
111
|
+
if (validationError) {
|
|
112
|
+
setError(validationError);
|
|
113
|
+
setTestResult(null);
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
const returnUrl = typeof window === "undefined"
|
|
117
|
+
? "/"
|
|
118
|
+
: window.location.pathname +
|
|
119
|
+
window.location.search +
|
|
120
|
+
window.location.hash;
|
|
121
|
+
window.location.assign(agentNativePath(buildMcpOAuthStartUrl({
|
|
122
|
+
name: args.name,
|
|
123
|
+
url: args.url,
|
|
124
|
+
description: args.description,
|
|
125
|
+
scope: safeDefaultScope,
|
|
126
|
+
returnUrl,
|
|
127
|
+
})));
|
|
128
|
+
};
|
|
129
|
+
const connectWithOAuth = (integration) => beginOAuth({
|
|
130
|
+
name: integration.name,
|
|
131
|
+
url: integration.url,
|
|
132
|
+
description: integration.description,
|
|
133
|
+
});
|
|
134
|
+
const connectCustomWithOAuth = () => {
|
|
135
|
+
if (!name.trim()) {
|
|
136
|
+
setError(t("mcpIntegrations.serverNameRequired"));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
beginOAuth({
|
|
140
|
+
name: name.trim(),
|
|
141
|
+
url: url.trim(),
|
|
142
|
+
description: description.trim(),
|
|
143
|
+
});
|
|
144
|
+
};
|
|
107
145
|
const createServer = async (args, options) => {
|
|
108
146
|
const validationError = getMcpUrlValidationError(args.url);
|
|
109
147
|
if (validationError) {
|
|
@@ -142,12 +180,16 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
|
|
|
142
180
|
});
|
|
143
181
|
};
|
|
144
182
|
const quickConnect = (integration) => {
|
|
145
|
-
if (integration.authMode
|
|
183
|
+
if (integration.authMode === "oauth") {
|
|
184
|
+
connectWithOAuth(integration);
|
|
185
|
+
return;
|
|
186
|
+
}
|
|
187
|
+
if (integration.authMode === "headers") {
|
|
146
188
|
openForm(integration);
|
|
147
189
|
return;
|
|
148
190
|
}
|
|
149
191
|
void createServer({
|
|
150
|
-
scope:
|
|
192
|
+
scope: safeDefaultScope,
|
|
151
193
|
name: integration.name,
|
|
152
194
|
url: integration.url,
|
|
153
195
|
description: integration.description,
|
|
@@ -201,15 +243,17 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
|
|
|
201
243
|
return null;
|
|
202
244
|
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsx(DialogContent, { className: "flex max-h-[min(820px,calc(100vh-32px))] w-[calc(100vw-24px)] max-w-[760px] flex-col gap-0 p-0 sm:w-[min(760px,calc(100vw-48px))]", children: mode === "catalog" ? (_jsxs(_Fragment, { children: [_jsxs(DialogHeader, { className: "shrink-0 px-7 pb-5 pe-14 pt-6", children: [_jsx(DialogTitle, { children: t("mcpIntegrations.title") }), _jsx(DialogDescription, { children: t("mcpIntegrations.description") })] }), _jsxs("div", { className: "flex shrink-0 flex-col gap-3 px-7 pb-5 sm:flex-row", children: [_jsxs("label", { className: "relative min-w-0 flex-1", children: [_jsx(IconSearch, { className: "pointer-events-none absolute start-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }), _jsx("input", { value: query, onChange: (event) => setQuery(event.target.value), className: "h-9 w-full rounded-md border border-border bg-background pe-3 ps-8 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring", placeholder: t("mcpIntegrations.searchPlaceholder") })] }), _jsx("button", { type: "button", onClick: () => openForm(null), className: cn("inline-flex h-9 items-center justify-center gap-1.5 rounded-md border border-border bg-background px-3 text-[12px] font-medium text-foreground hover:bg-accent", !customIntegrationEnabled && "hidden"), children: t("mcpIntegrations.addYourOwn") })] }), _jsxs("div", { className: "min-h-0 flex-1 overflow-y-auto px-7 pb-7", children: [error && (_jsx("div", { className: "mb-3 rounded-md border border-red-500/20 bg-red-500/5 px-3 py-2 text-[12px] leading-relaxed text-red-600 dark:text-red-400", children: error })), _jsx("div", { className: "grid gap-3 sm:grid-cols-2", children: filteredIntegrations.map((integration) => {
|
|
203
245
|
const connected = connectedUrls.has(compareUrl(integration.url));
|
|
204
|
-
const
|
|
246
|
+
const requiresHeaders = integration.authMode === "headers";
|
|
205
247
|
return (_jsxs("article", { className: "flex min-h-[128px] flex-col rounded-md border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20", children: [_jsx("h3", { className: "truncate text-[13px] font-semibold text-foreground", children: integration.name }), _jsx("p", { className: "mt-1 line-clamp-2 flex-1 text-[12px] leading-relaxed text-muted-foreground", children: t(integration.descriptionKey) }), _jsxs("div", { className: "mt-3 flex items-center gap-2", children: [_jsxs("button", { type: "button", onClick: () => quickConnect(integration), disabled: busy || connected, className: cn("inline-flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md px-2.5 text-[12px] font-medium", connected
|
|
206
248
|
? "border border-border bg-muted text-muted-foreground"
|
|
207
249
|
: "bg-primary text-primary-foreground hover:bg-primary/90", (busy || connected) &&
|
|
208
250
|
"cursor-not-allowed opacity-70"), children: [quickBusyId === integration.id ? (_jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" })) : null, connected
|
|
209
251
|
? t("mcpIntegrations.connected")
|
|
210
|
-
:
|
|
211
|
-
? t("mcpIntegrations.
|
|
212
|
-
:
|
|
252
|
+
: integration.authMode === "oauth"
|
|
253
|
+
? t("mcpIntegrations.connectWithOAuth")
|
|
254
|
+
: requiresHeaders
|
|
255
|
+
? t("mcpIntegrations.configure")
|
|
256
|
+
: t("mcpIntegrations.connect")] }), integration.docsUrl && (_jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("a", { href: integration.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "inline-flex h-8 w-8 items-center justify-center rounded-md border border-border text-muted-foreground hover:bg-accent hover:text-foreground", "aria-label": t("mcpIntegrations.docsLabel", {
|
|
213
257
|
name: integration.name,
|
|
214
258
|
}), children: _jsx(IconExternalLink, { className: "h-3.5 w-3.5" }) }) }), _jsx(TooltipContent, { children: t("mcpIntegrations.docsLabel", {
|
|
215
259
|
name: integration.name,
|
|
@@ -234,14 +278,14 @@ export function McpIntegrationDialog({ open, onOpenChange, defaultScope, canCrea
|
|
|
234
278
|
}, className: "w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring", placeholder: t("mcpIntegrations.urlPlaceholder") })] }), _jsxs("label", { className: "block", children: [_jsx("span", { className: "mb-1 block text-[10px] font-medium text-muted-foreground", children: t("mcpIntegrations.fieldDescription") }), _jsx("input", { value: description, onChange: (event) => {
|
|
235
279
|
setDescription(event.target.value);
|
|
236
280
|
clearFeedback();
|
|
237
|
-
}, className: "w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring", placeholder: t("mcpIntegrations.descriptionPlaceholder") })] }), _jsxs("label", { className: "block", children: [_jsx("span", { className: "mb-1 block text-[10px] font-medium text-muted-foreground", children: t("mcpIntegrations.headers") }), _jsx("textarea", { value: headersText, onChange: (event) => {
|
|
281
|
+
}, className: "w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring", placeholder: t("mcpIntegrations.descriptionPlaceholder") })] }), selected?.authMode !== "oauth" && (_jsxs("label", { className: "block", children: [_jsx("span", { className: "mb-1 block text-[10px] font-medium text-muted-foreground", children: t("mcpIntegrations.headers") }), _jsx("textarea", { value: headersText, onChange: (event) => {
|
|
238
282
|
setHeadersText(event.target.value);
|
|
239
283
|
clearFeedback();
|
|
240
284
|
}, rows: 3, className: "w-full resize-y rounded-md border border-border bg-background px-2.5 py-1.5 text-[12px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring", style: {
|
|
241
285
|
fontFamily: 'ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace',
|
|
242
286
|
}, placeholder: selected?.headerPlaceholder ??
|
|
243
|
-
t("mcpIntegrations.headersPlaceholder") })] }), selected?.docsUrl && (_jsxs("a", { href: selected.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground underline hover:text-foreground", children: [t("mcpIntegrations.openSetupDocs"), _jsx(IconExternalLink, { className: "h-3 w-3" })] })), testResult && (_jsxs("div", { className: cn("flex items-start gap-1 rounded-md px-3 py-2 text-[11px] leading-snug", testResult.ok
|
|
287
|
+
t("mcpIntegrations.headersPlaceholder") })] })), selected?.docsUrl && (_jsxs("a", { href: selected.docsUrl, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-1 text-[11px] text-muted-foreground underline hover:text-foreground", children: [t("mcpIntegrations.openSetupDocs"), _jsx(IconExternalLink, { className: "h-3 w-3" })] })), testResult && (_jsxs("div", { className: cn("flex items-start gap-1 rounded-md px-3 py-2 text-[11px] leading-snug", testResult.ok
|
|
244
288
|
? "bg-green-500/5 text-green-600 dark:text-green-400"
|
|
245
|
-
: "bg-red-500/5 text-red-600 dark:text-red-400"), children: [testResult.ok && (_jsx(IconCheck, { className: "mt-0.5 h-3 w-3 shrink-0" })), _jsx("span", { className: "min-w-0 break-words", children: testResult.message })] })), error && (_jsx("div", { className: "break-words rounded-md bg-red-500/5 px-3 py-2 text-[11px] leading-snug text-red-600 dark:text-red-400", children: error }))] }) }), _jsxs("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border px-7 py-4", children: [_jsx("button", { type: "button", onClick: runTest, disabled: !url.trim() || busy, className: "rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40", children: t("mcpIntegrations.test") }), _jsxs("button", { type: "button", onClick: submitForm, disabled: !name.trim() || !url.trim() || busy, className: "inline-flex min-w-[92px] items-center justify-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-40", children: [busy && _jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), t("mcpIntegrations.connect")] })] })] })) }) }));
|
|
289
|
+
: "bg-red-500/5 text-red-600 dark:text-red-400"), children: [testResult.ok && (_jsx(IconCheck, { className: "mt-0.5 h-3 w-3 shrink-0" })), _jsx("span", { className: "min-w-0 break-words", children: testResult.message })] })), error && (_jsx("div", { className: "break-words rounded-md bg-red-500/5 px-3 py-2 text-[11px] leading-snug text-red-600 dark:text-red-400", children: error }))] }) }), _jsxs("div", { className: "flex shrink-0 items-center justify-between gap-2 border-t border-border px-7 py-4", children: [_jsx("button", { type: "button", onClick: runTest, disabled: !url.trim() || busy, className: "rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40", children: t("mcpIntegrations.test") }), !selected && (_jsx("button", { type: "button", onClick: connectCustomWithOAuth, disabled: !name.trim() || !url.trim() || busy, className: "rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40", children: t("mcpIntegrations.connectWithOAuth") })), _jsxs("button", { type: "button", onClick: submitForm, disabled: !name.trim() || !url.trim() || busy, className: "inline-flex min-w-[92px] items-center justify-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-40", children: [busy && _jsx(IconLoader2, { className: "h-3.5 w-3.5 animate-spin" }), t("mcpIntegrations.connect")] })] })] })) }) }));
|
|
246
290
|
}
|
|
247
291
|
//# sourceMappingURL=McpIntegrationDialog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"McpIntegrationDialog.js","sourceRoot":"","sources":["../../../src/client/resources/McpIntegrationDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,UAAU,GACX,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EACL,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,YAAY,EACZ,WAAW,GACZ,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,GACf,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAClC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EACL,gCAAgC,EAChC,qBAAqB,EACrB,yBAAyB,EACzB,6BAA6B,GAE9B,MAAM,8BAA8B,CAAC;AACtC,OAAO,EACL,oBAAoB,EACpB,wBAAwB,EACxB,gBAAgB,EAChB,aAAa,GAGd,MAAM,sBAAsB,CAAC;AAmB9B,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CACR,cAAK,SAAS,EAAC,uGAAuG,YACnH,KAAK,GACF,CACP,IACG,GACF,EACN,eAAK,SAAS,EAAC,mFAAmF,aAChG,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,OAAO,EAChB,QAAQ,EAAE,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,EAC7B,SAAS,EAAC,oKAAoK,YAE7K,CAAC,CAAC,sBAAsB,CAAC,GACnB,EACT,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,EAC7C,SAAS,EAAC,qNAAqN,aAE9N,IAAI,IAAI,KAAC,WAAW,IAAC,SAAS,EAAC,0BAA0B,GAAG,EAC5D,CAAC,CAAC,yBAAyB,CAAC,IACtB,IACL,IACL,CACJ,GACa,GACT,CACV,CAAC;AACJ,CAAC","sourcesContent":["import {\n IconArrowLeft,\n IconCheck,\n IconExternalLink,\n IconLoader2,\n IconSearch,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\n\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"../components/ui/dialog.js\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"../components/ui/tooltip.js\";\nimport { useT } from \"../i18n.js\";\nimport { cn } from \"../utils.js\";\nimport {\n createMcpIntegrationFormDefaults,\n filterMcpIntegrations,\n getDefaultMcpIntegrations,\n isCustomMcpIntegrationEnabled,\n type DefaultMcpIntegration,\n} from \"./mcp-integration-catalog.js\";\nimport {\n formatMcpServerError,\n getMcpUrlValidationError,\n testMcpServerUrl,\n useMcpServers,\n type CreateMcpServerArgs,\n type McpServerScope,\n} from \"./use-mcp-servers.js\";\n\ntype DialogMode = \"catalog\" | \"form\";\n\ninterface McpIntegrationDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n defaultScope: McpServerScope;\n canCreateOrgMcp: boolean;\n hasOrg: boolean;\n onCreateMcpServer: (args: CreateMcpServerArgs) => Promise<unknown>;\n onCreated?: () => void;\n}\n\ninterface TestResult {\n ok: boolean;\n message: string;\n}\n\nfunction parseHeaderLines(text: string): Record<string, string> | undefined {\n const out: Record<string, string> = {};\n for (const line of text.split(/\\r?\\n/)) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n const idx = trimmed.indexOf(\":\");\n if (idx <= 0) continue;\n const key = trimmed.slice(0, idx).trim();\n const value = trimmed.slice(idx + 1).trim();\n if (!key || !value) continue;\n out[key] = value;\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nfunction compareUrl(value: string): string {\n try {\n const url = new URL(value.trim());\n url.hash = \"\";\n return url.toString().replace(/\\/+$/, \"\");\n } catch {\n return value.trim().replace(/\\/+$/, \"\");\n }\n}\n\nexport function McpIntegrationDialog({\n open,\n onOpenChange,\n defaultScope,\n canCreateOrgMcp,\n hasOrg,\n onCreateMcpServer,\n onCreated,\n}: McpIntegrationDialogProps) {\n const t = useT();\n const [mode, setMode] = useState<DialogMode>(\"catalog\");\n const [query, setQuery] = useState(\"\");\n const [selected, setSelected] = useState<DefaultMcpIntegration | null>(null);\n const [scope, setScope] = useState<McpServerScope>(defaultScope);\n const [name, setName] = useState(\"\");\n const [url, setUrl] = useState(\"\");\n const [description, setDescription] = useState(\"\");\n const [headersText, setHeadersText] = useState(\"\");\n const [busy, setBusy] = useState(false);\n const [quickBusyId, setQuickBusyId] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [testResult, setTestResult] = useState<TestResult | null>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const mcpServersQuery = useMcpServers();\n const defaultIntegrations = useMemo(() => getDefaultMcpIntegrations(), []);\n const customIntegrationEnabled = useMemo(\n () => isCustomMcpIntegrationEnabled(),\n [],\n );\n const showCatalog = defaultIntegrations.length > 0;\n\n const connectedUrls = useMemo(() => {\n const servers = [\n ...(mcpServersQuery.data?.user ?? []),\n ...(mcpServersQuery.data?.org ?? []),\n ];\n // A saved server is not necessarily a working connection. The settings\n // page reports failed and unknown health states separately, so only mark\n // catalog entries as connected after the health probe succeeds.\n return new Set(\n servers\n .filter((server) => server.status.state === \"connected\")\n .map((server) => compareUrl(server.url)),\n );\n }, [mcpServersQuery.data]);\n\n const filteredIntegrations = useMemo(\n () => filterMcpIntegrations(query, defaultIntegrations),\n [defaultIntegrations, query],\n );\n\n useEffect(() => {\n if (!open) return;\n setMode(showCatalog ? \"catalog\" : \"form\");\n setQuery(\"\");\n setSelected(null);\n setScope(defaultScope);\n setName(\"\");\n setUrl(\"\");\n setDescription(\"\");\n setHeadersText(\"\");\n setBusy(false);\n setQuickBusyId(null);\n setError(null);\n setTestResult(null);\n }, [defaultScope, open, showCatalog]);\n\n useEffect(() => {\n if (open && mode === \"form\") {\n const timer = window.setTimeout(() => inputRef.current?.focus(), 60);\n return () => window.clearTimeout(timer);\n }\n }, [mode, open]);\n\n const clearFeedback = () => {\n setError(null);\n setTestResult(null);\n };\n\n const openForm = (integration?: DefaultMcpIntegration | null) => {\n const defaults = createMcpIntegrationFormDefaults(integration);\n setSelected(integration ?? null);\n setScope(defaultScope);\n setName(defaults.name);\n setUrl(defaults.url);\n setDescription(defaults.description);\n setHeadersText(defaults.headersText);\n setError(null);\n setTestResult(null);\n setMode(\"form\");\n };\n\n const createServer = async (\n args: CreateMcpServerArgs,\n options?: { quickId?: string },\n ) => {\n const validationError = getMcpUrlValidationError(args.url);\n if (validationError) {\n setError(validationError);\n setTestResult(null);\n return;\n }\n\n if (options?.quickId) setQuickBusyId(options.quickId);\n setBusy(true);\n setError(null);\n try {\n await onCreateMcpServer(args);\n onOpenChange(false);\n onCreated?.();\n } catch (err) {\n setError(formatMcpServerError(err));\n } finally {\n setBusy(false);\n setQuickBusyId(null);\n }\n };\n\n const submitForm = () => {\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n if (!trimmedName || !trimmedUrl || busy) return;\n void createServer({\n scope,\n name: trimmedName,\n url: trimmedUrl,\n headers: parseHeaderLines(headersText),\n description: description.trim() || undefined,\n });\n };\n\n const quickConnect = (integration: DefaultMcpIntegration) => {\n if (integration.authMode !== \"none\") {\n openForm(integration);\n return;\n }\n void createServer(\n {\n scope: defaultScope,\n name: integration.name,\n url: integration.url,\n description: integration.description,\n },\n { quickId: integration.id },\n );\n };\n\n const runTest = async () => {\n const trimmedUrl = url.trim();\n if (!trimmedUrl || busy) return;\n const validationError = getMcpUrlValidationError(trimmedUrl);\n if (validationError) {\n setTestResult({ ok: false, message: validationError });\n setError(null);\n return;\n }\n setBusy(true);\n setError(null);\n setTestResult(null);\n try {\n const res = await testMcpServerUrl(\n trimmedUrl,\n parseHeaderLines(headersText),\n );\n setTestResult(\n res.ok\n ? {\n ok: true,\n message: t(\"mcpIntegrations.toolsAvailable\", {\n count: res.toolCount ?? 0,\n }),\n }\n : { ok: false, message: res.error ?? t(\"mcpIntegrations.failed\") },\n );\n } catch (err) {\n setTestResult({ ok: false, message: formatMcpServerError(err) });\n } finally {\n setBusy(false);\n }\n };\n\n const renderScopeSelector = () => {\n const orgTooltip = !hasOrg\n ? t(\"mcpIntegrations.orgNoOrg\")\n : !canCreateOrgMcp\n ? t(\"mcpIntegrations.orgAdminOnly\")\n : null;\n\n return (\n <div className=\"flex gap-1 rounded-md border border-border bg-background p-0.5\">\n <button\n type=\"button\"\n onClick={() => setScope(\"user\")}\n className={cn(\n \"flex-1 rounded px-2 py-1.5 text-[11px] font-medium\",\n scope === \"user\"\n ? \"bg-accent text-foreground\"\n : \"text-muted-foreground hover:text-foreground\",\n )}\n >\n {t(\"mcpIntegrations.personal\")}\n </button>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={() => hasOrg && canCreateOrgMcp && setScope(\"org\")}\n disabled={!hasOrg || !canCreateOrgMcp}\n className={cn(\n \"flex-1 rounded px-2 py-1.5 text-[11px] font-medium\",\n scope === \"org\"\n ? \"bg-accent text-foreground\"\n : \"text-muted-foreground hover:text-foreground\",\n (!hasOrg || !canCreateOrgMcp) &&\n \"cursor-not-allowed opacity-50 hover:text-muted-foreground\",\n )}\n >\n {t(\"mcpIntegrations.organization\")}\n </button>\n </TooltipTrigger>\n {orgTooltip && <TooltipContent>{orgTooltip}</TooltipContent>}\n </Tooltip>\n </div>\n );\n };\n\n if (!showCatalog && !customIntegrationEnabled) return null;\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent className=\"flex max-h-[min(820px,calc(100vh-32px))] w-[calc(100vw-24px)] max-w-[760px] flex-col gap-0 p-0 sm:w-[min(760px,calc(100vw-48px))]\">\n {mode === \"catalog\" ? (\n <>\n <DialogHeader className=\"shrink-0 px-7 pb-5 pe-14 pt-6\">\n <DialogTitle>{t(\"mcpIntegrations.title\")}</DialogTitle>\n <DialogDescription>\n {t(\"mcpIntegrations.description\")}\n </DialogDescription>\n </DialogHeader>\n <div className=\"flex shrink-0 flex-col gap-3 px-7 pb-5 sm:flex-row\">\n <label className=\"relative min-w-0 flex-1\">\n <IconSearch className=\"pointer-events-none absolute start-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n <input\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n className=\"h-9 w-full rounded-md border border-border bg-background pe-3 ps-8 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n placeholder={t(\"mcpIntegrations.searchPlaceholder\")}\n />\n </label>\n <button\n type=\"button\"\n onClick={() => openForm(null)}\n className={cn(\n \"inline-flex h-9 items-center justify-center gap-1.5 rounded-md border border-border bg-background px-3 text-[12px] font-medium text-foreground hover:bg-accent\",\n !customIntegrationEnabled && \"hidden\",\n )}\n >\n {t(\"mcpIntegrations.addYourOwn\")}\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-y-auto px-7 pb-7\">\n {error && (\n <div className=\"mb-3 rounded-md border border-red-500/20 bg-red-500/5 px-3 py-2 text-[12px] leading-relaxed text-red-600 dark:text-red-400\">\n {error}\n </div>\n )}\n <div className=\"grid gap-3 sm:grid-cols-2\">\n {filteredIntegrations.map((integration) => {\n const connected = connectedUrls.has(\n compareUrl(integration.url),\n );\n const requiresConfig = integration.authMode !== \"none\";\n return (\n <article\n key={integration.id}\n className=\"flex min-h-[128px] flex-col rounded-md border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20\"\n >\n <h3 className=\"truncate text-[13px] font-semibold text-foreground\">\n {integration.name}\n </h3>\n <p className=\"mt-1 line-clamp-2 flex-1 text-[12px] leading-relaxed text-muted-foreground\">\n {t(integration.descriptionKey)}\n </p>\n <div className=\"mt-3 flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => quickConnect(integration)}\n disabled={busy || connected}\n className={cn(\n \"inline-flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md px-2.5 text-[12px] font-medium\",\n connected\n ? \"border border-border bg-muted text-muted-foreground\"\n : \"bg-primary text-primary-foreground hover:bg-primary/90\",\n (busy || connected) &&\n \"cursor-not-allowed opacity-70\",\n )}\n >\n {quickBusyId === integration.id ? (\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : null}\n {connected\n ? t(\"mcpIntegrations.connected\")\n : requiresConfig\n ? t(\"mcpIntegrations.configure\")\n : t(\"mcpIntegrations.connect\")}\n </button>\n {integration.docsUrl && (\n <Tooltip>\n <TooltipTrigger asChild>\n <a\n href={integration.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md border border-border text-muted-foreground hover:bg-accent hover:text-foreground\"\n aria-label={t(\"mcpIntegrations.docsLabel\", {\n name: integration.name,\n })}\n >\n <IconExternalLink className=\"h-3.5 w-3.5\" />\n </a>\n </TooltipTrigger>\n <TooltipContent>\n {t(\"mcpIntegrations.docsLabel\", {\n name: integration.name,\n })}\n </TooltipContent>\n </Tooltip>\n )}\n </div>\n </article>\n );\n })}\n </div>\n {filteredIntegrations.length === 0 && (\n <div className=\"rounded-md border border-dashed border-border p-6 text-center text-[12px] text-muted-foreground\">\n {t(\"mcpIntegrations.noMatches\")}\n </div>\n )}\n </div>\n </>\n ) : (\n <>\n <DialogHeader className=\"shrink-0 border-b border-border px-7 pb-5 pe-14 pt-6\">\n <button\n type=\"button\"\n onClick={() => {\n clearFeedback();\n setMode(\"catalog\");\n }}\n className={cn(\n \"mb-1 inline-flex w-fit items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground\",\n !showCatalog && \"hidden\",\n )}\n >\n <IconArrowLeft className=\"h-3 w-3 rtl:-scale-x-100\" />\n {t(\"mcpIntegrations.backToIntegrations\")}\n </button>\n <DialogTitle>\n {selected\n ? t(\"mcpIntegrations.configureTitle\", {\n name: selected.name,\n })\n : t(\"mcpIntegrations.customTitle\")}\n </DialogTitle>\n <DialogDescription>\n {selected\n ? selected.authMode === \"none\"\n ? t(\"mcpIntegrations.presetNoAuthDescription\")\n : t(\"mcpIntegrations.presetAuthDescription\")\n : t(\"mcpIntegrations.customDescription\")}\n </DialogDescription>\n </DialogHeader>\n <div className=\"min-h-0 flex-1 overflow-y-auto px-7 py-5\">\n <div className=\"space-y-3\">\n {renderScopeSelector()}\n {selected?.setupNoteKey && (\n <div className=\"rounded-md border border-amber-500/20 bg-amber-500/5 px-3 py-2 text-[11px] leading-relaxed text-amber-700 dark:text-amber-300\">\n {t(selected.setupNoteKey)}\n </div>\n )}\n {selected?.authMode === \"oauth\" && (\n <div className=\"rounded-md border border-blue-500/20 bg-blue-500/5 px-3 py-2 text-[11px] leading-relaxed text-blue-700 dark:text-blue-300\">\n {t(\"mcpIntegrations.oauthNotice\")}\n </div>\n )}\n <label className=\"block\">\n <span className=\"mb-1 block text-[10px] font-medium text-muted-foreground\">\n {t(\"mcpIntegrations.serverName\")}\n </span>\n <input\n ref={inputRef}\n value={name}\n onChange={(event) => {\n setName(event.target.value);\n clearFeedback();\n }}\n className=\"w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n placeholder={t(\"mcpIntegrations.serverNamePlaceholder\")}\n />\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-[10px] font-medium text-muted-foreground\">\n {t(\"mcpIntegrations.url\")}\n </span>\n <input\n value={url}\n onChange={(event) => {\n setUrl(event.target.value);\n clearFeedback();\n }}\n className=\"w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n placeholder={t(\"mcpIntegrations.urlPlaceholder\")}\n />\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-[10px] font-medium text-muted-foreground\">\n {t(\"mcpIntegrations.fieldDescription\")}\n </span>\n <input\n value={description}\n onChange={(event) => {\n setDescription(event.target.value);\n clearFeedback();\n }}\n className=\"w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n placeholder={t(\"mcpIntegrations.descriptionPlaceholder\")}\n />\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-[10px] font-medium text-muted-foreground\">\n {t(\"mcpIntegrations.headers\")}\n </span>\n <textarea\n value={headersText}\n onChange={(event) => {\n setHeadersText(event.target.value);\n clearFeedback();\n }}\n rows={3}\n className=\"w-full resize-y rounded-md border border-border bg-background px-2.5 py-1.5 text-[12px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n style={{\n fontFamily:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace',\n }}\n placeholder={\n selected?.headerPlaceholder ??\n t(\"mcpIntegrations.headersPlaceholder\")\n }\n />\n </label>\n {selected?.docsUrl && (\n <a\n href={selected.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 text-[11px] text-muted-foreground underline hover:text-foreground\"\n >\n {t(\"mcpIntegrations.openSetupDocs\")}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n )}\n {testResult && (\n <div\n className={cn(\n \"flex items-start gap-1 rounded-md px-3 py-2 text-[11px] leading-snug\",\n testResult.ok\n ? \"bg-green-500/5 text-green-600 dark:text-green-400\"\n : \"bg-red-500/5 text-red-600 dark:text-red-400\",\n )}\n >\n {testResult.ok && (\n <IconCheck className=\"mt-0.5 h-3 w-3 shrink-0\" />\n )}\n <span className=\"min-w-0 break-words\">\n {testResult.message}\n </span>\n </div>\n )}\n {error && (\n <div className=\"break-words rounded-md bg-red-500/5 px-3 py-2 text-[11px] leading-snug text-red-600 dark:text-red-400\">\n {error}\n </div>\n )}\n </div>\n </div>\n <div className=\"flex shrink-0 items-center justify-between gap-2 border-t border-border px-7 py-4\">\n <button\n type=\"button\"\n onClick={runTest}\n disabled={!url.trim() || busy}\n className=\"rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40\"\n >\n {t(\"mcpIntegrations.test\")}\n </button>\n <button\n type=\"button\"\n onClick={submitForm}\n disabled={!name.trim() || !url.trim() || busy}\n className=\"inline-flex min-w-[92px] items-center justify-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-40\"\n >\n {busy && <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />}\n {t(\"mcpIntegrations.connect\")}\n </button>\n </div>\n </>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"]}
|
|
1
|
+
{"version":3,"file":"McpIntegrationDialog.js","sourceRoot":"","sources":["../../../src/client/resources/McpIntegrationDialog.tsx"],"names":[],"mappings":";AAAA,OAAO,EACL,aAAa,EACb,SAAS,EACT,gBAAgB,EAChB,WAAW,EACX,UAAU,GACX,MAAM,qBAAqB,CAAC;A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AC,oKAAoK,YAE7K,CAAC,CAAC,sBAAsB,CAAC,GACnB,EACR,CAAC,QAAQ,IAAI,CACZ,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,sBAAsB,EAC/B,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,EAC7C,SAAS,EAAC,oKAAoK,YAE7K,CAAC,CAAC,kCAAkC,CAAC,GAC/B,CACV,EACD,kBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,UAAU,EACnB,QAAQ,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,IAAI,EAC7C,SAAS,EAAC,qNAAqN,aAE9N,IAAI,IAAI,KAAC,WAAW,IAAC,SAAS,EAAC,0BAA0B,GAAG,EAC5D,CAAC,CAAC,yBAAyB,CAAC,IACtB,IACL,IACL,CACJ,GACa,GACT,CACV,CAAC;AACJ,CAAC","sourcesContent":["import {\n IconArrowLeft,\n IconCheck,\n IconExternalLink,\n IconLoader2,\n IconSearch,\n} from \"@tabler/icons-react\";\nimport { useEffect, useMemo, useRef, useState } from \"react\";\n\nimport { agentNativePath } from \"../api-path.js\";\nimport {\n Dialog,\n DialogContent,\n DialogDescription,\n DialogHeader,\n DialogTitle,\n} from \"../components/ui/dialog.js\";\nimport {\n Tooltip,\n TooltipContent,\n TooltipTrigger,\n} from \"../components/ui/tooltip.js\";\nimport { useT } from \"../i18n.js\";\nimport { cn } from \"../utils.js\";\nimport {\n buildMcpOAuthStartUrl,\n createMcpIntegrationFormDefaults,\n filterMcpIntegrations,\n getDefaultMcpIntegrations,\n isCustomMcpIntegrationEnabled,\n resolveMcpIntegrationScope,\n type DefaultMcpIntegration,\n} from \"./mcp-integration-catalog.js\";\nimport {\n formatMcpServerError,\n getMcpUrlValidationError,\n testMcpServerUrl,\n useMcpServers,\n type CreateMcpServerArgs,\n type McpServerScope,\n} from \"./use-mcp-servers.js\";\n\ntype DialogMode = \"catalog\" | \"form\";\n\ninterface McpIntegrationDialogProps {\n open: boolean;\n onOpenChange: (open: boolean) => void;\n defaultScope: McpServerScope;\n canCreateOrgMcp: boolean;\n hasOrg: boolean;\n onCreateMcpServer: (args: CreateMcpServerArgs) => Promise<unknown>;\n onCreated?: () => void;\n}\n\ninterface TestResult {\n ok: boolean;\n message: string;\n}\n\nfunction parseHeaderLines(text: string): Record<string, string> | undefined {\n const out: Record<string, string> = {};\n for (const line of text.split(/\\r?\\n/)) {\n const trimmed = line.trim();\n if (!trimmed) continue;\n const idx = trimmed.indexOf(\":\");\n if (idx <= 0) continue;\n const key = trimmed.slice(0, idx).trim();\n const value = trimmed.slice(idx + 1).trim();\n if (!key || !value) continue;\n out[key] = value;\n }\n return Object.keys(out).length > 0 ? out : undefined;\n}\n\nfunction compareUrl(value: string): string {\n try {\n const url = new URL(value.trim());\n url.hash = \"\";\n return url.toString().replace(/\\/+$/, \"\");\n } catch {\n return value.trim().replace(/\\/+$/, \"\");\n }\n}\n\nexport function McpIntegrationDialog({\n open,\n onOpenChange,\n defaultScope,\n canCreateOrgMcp,\n hasOrg,\n onCreateMcpServer,\n onCreated,\n}: McpIntegrationDialogProps) {\n const t = useT();\n const [mode, setMode] = useState<DialogMode>(\"catalog\");\n const [query, setQuery] = useState(\"\");\n const [selected, setSelected] = useState<DefaultMcpIntegration | null>(null);\n const safeDefaultScope = resolveMcpIntegrationScope(\n defaultScope,\n hasOrg,\n canCreateOrgMcp,\n );\n const [scope, setScope] = useState<McpServerScope>(safeDefaultScope);\n const [name, setName] = useState(\"\");\n const [url, setUrl] = useState(\"\");\n const [description, setDescription] = useState(\"\");\n const [headersText, setHeadersText] = useState(\"\");\n const [busy, setBusy] = useState(false);\n const [quickBusyId, setQuickBusyId] = useState<string | null>(null);\n const [error, setError] = useState<string | null>(null);\n const [testResult, setTestResult] = useState<TestResult | null>(null);\n const inputRef = useRef<HTMLInputElement>(null);\n const mcpServersQuery = useMcpServers();\n const defaultIntegrations = useMemo(() => getDefaultMcpIntegrations(), []);\n const customIntegrationEnabled = useMemo(\n () => isCustomMcpIntegrationEnabled(),\n [],\n );\n const showCatalog = defaultIntegrations.length > 0;\n\n const connectedUrls = useMemo(() => {\n const servers = [\n ...(mcpServersQuery.data?.user ?? []),\n ...(mcpServersQuery.data?.org ?? []),\n ];\n // A saved server is not necessarily a working connection. The settings\n // page reports failed and unknown health states separately, so only mark\n // catalog entries as connected after the health probe succeeds.\n return new Set(\n servers\n .filter((server) => server.status.state === \"connected\")\n .map((server) => compareUrl(server.url)),\n );\n }, [mcpServersQuery.data]);\n\n const filteredIntegrations = useMemo(\n () => filterMcpIntegrations(query, defaultIntegrations),\n [defaultIntegrations, query],\n );\n\n useEffect(() => {\n if (!open) return;\n setMode(showCatalog ? \"catalog\" : \"form\");\n setQuery(\"\");\n setSelected(null);\n setScope(safeDefaultScope);\n setName(\"\");\n setUrl(\"\");\n setDescription(\"\");\n setHeadersText(\"\");\n setBusy(false);\n setQuickBusyId(null);\n setError(null);\n setTestResult(null);\n }, [open, safeDefaultScope, showCatalog]);\n\n useEffect(() => {\n if (open && mode === \"form\") {\n const timer = window.setTimeout(() => inputRef.current?.focus(), 60);\n return () => window.clearTimeout(timer);\n }\n }, [mode, open]);\n\n const clearFeedback = () => {\n setError(null);\n setTestResult(null);\n };\n\n const openForm = (integration?: DefaultMcpIntegration | null) => {\n const defaults = createMcpIntegrationFormDefaults(integration);\n setSelected(integration ?? null);\n setScope(safeDefaultScope);\n setName(defaults.name);\n setUrl(defaults.url);\n setDescription(defaults.description);\n setHeadersText(defaults.headersText);\n setError(null);\n setTestResult(null);\n setMode(\"form\");\n };\n\n const beginOAuth = (args: {\n name: string;\n url: string;\n description: string;\n }) => {\n const validationError = getMcpUrlValidationError(args.url);\n if (validationError) {\n setError(validationError);\n setTestResult(null);\n return;\n }\n const returnUrl =\n typeof window === \"undefined\"\n ? \"/\"\n : window.location.pathname +\n window.location.search +\n window.location.hash;\n window.location.assign(\n agentNativePath(\n buildMcpOAuthStartUrl({\n name: args.name,\n url: args.url,\n description: args.description,\n scope: safeDefaultScope,\n returnUrl,\n }),\n ),\n );\n };\n\n const connectWithOAuth = (integration: DefaultMcpIntegration) =>\n beginOAuth({\n name: integration.name,\n url: integration.url,\n description: integration.description,\n });\n\n const connectCustomWithOAuth = () => {\n if (!name.trim()) {\n setError(t(\"mcpIntegrations.serverNameRequired\"));\n return;\n }\n beginOAuth({\n name: name.trim(),\n url: url.trim(),\n description: description.trim(),\n });\n };\n\n const createServer = async (\n args: CreateMcpServerArgs,\n options?: { quickId?: string },\n ) => {\n const validationError = getMcpUrlValidationError(args.url);\n if (validationError) {\n setError(validationError);\n setTestResult(null);\n return;\n }\n\n if (options?.quickId) setQuickBusyId(options.quickId);\n setBusy(true);\n setError(null);\n try {\n await onCreateMcpServer(args);\n onOpenChange(false);\n onCreated?.();\n } catch (err) {\n setError(formatMcpServerError(err));\n } finally {\n setBusy(false);\n setQuickBusyId(null);\n }\n };\n\n const submitForm = () => {\n const trimmedName = name.trim();\n const trimmedUrl = url.trim();\n if (!trimmedName || !trimmedUrl || busy) return;\n void createServer({\n scope,\n name: trimmedName,\n url: trimmedUrl,\n headers: parseHeaderLines(headersText),\n description: description.trim() || undefined,\n });\n };\n\n const quickConnect = (integration: DefaultMcpIntegration) => {\n if (integration.authMode === \"oauth\") {\n connectWithOAuth(integration);\n return;\n }\n if (integration.authMode === \"headers\") {\n openForm(integration);\n return;\n }\n void createServer(\n {\n scope: safeDefaultScope,\n name: integration.name,\n url: integration.url,\n description: integration.description,\n },\n { quickId: integration.id },\n );\n };\n\n const runTest = async () => {\n const trimmedUrl = url.trim();\n if (!trimmedUrl || busy) return;\n const validationError = getMcpUrlValidationError(trimmedUrl);\n if (validationError) {\n setTestResult({ ok: false, message: validationError });\n setError(null);\n return;\n }\n setBusy(true);\n setError(null);\n setTestResult(null);\n try {\n const res = await testMcpServerUrl(\n trimmedUrl,\n parseHeaderLines(headersText),\n );\n setTestResult(\n res.ok\n ? {\n ok: true,\n message: t(\"mcpIntegrations.toolsAvailable\", {\n count: res.toolCount ?? 0,\n }),\n }\n : { ok: false, message: res.error ?? t(\"mcpIntegrations.failed\") },\n );\n } catch (err) {\n setTestResult({ ok: false, message: formatMcpServerError(err) });\n } finally {\n setBusy(false);\n }\n };\n\n const renderScopeSelector = () => {\n const orgTooltip = !hasOrg\n ? t(\"mcpIntegrations.orgNoOrg\")\n : !canCreateOrgMcp\n ? t(\"mcpIntegrations.orgAdminOnly\")\n : null;\n\n return (\n <div className=\"flex gap-1 rounded-md border border-border bg-background p-0.5\">\n <button\n type=\"button\"\n onClick={() => setScope(\"user\")}\n className={cn(\n \"flex-1 rounded px-2 py-1.5 text-[11px] font-medium\",\n scope === \"user\"\n ? \"bg-accent text-foreground\"\n : \"text-muted-foreground hover:text-foreground\",\n )}\n >\n {t(\"mcpIntegrations.personal\")}\n </button>\n <Tooltip>\n <TooltipTrigger asChild>\n <button\n type=\"button\"\n onClick={() => hasOrg && canCreateOrgMcp && setScope(\"org\")}\n disabled={!hasOrg || !canCreateOrgMcp}\n className={cn(\n \"flex-1 rounded px-2 py-1.5 text-[11px] font-medium\",\n scope === \"org\"\n ? \"bg-accent text-foreground\"\n : \"text-muted-foreground hover:text-foreground\",\n (!hasOrg || !canCreateOrgMcp) &&\n \"cursor-not-allowed opacity-50 hover:text-muted-foreground\",\n )}\n >\n {t(\"mcpIntegrations.organization\")}\n </button>\n </TooltipTrigger>\n {orgTooltip && <TooltipContent>{orgTooltip}</TooltipContent>}\n </Tooltip>\n </div>\n );\n };\n\n if (!showCatalog && !customIntegrationEnabled) return null;\n\n return (\n <Dialog open={open} onOpenChange={onOpenChange}>\n <DialogContent className=\"flex max-h-[min(820px,calc(100vh-32px))] w-[calc(100vw-24px)] max-w-[760px] flex-col gap-0 p-0 sm:w-[min(760px,calc(100vw-48px))]\">\n {mode === \"catalog\" ? (\n <>\n <DialogHeader className=\"shrink-0 px-7 pb-5 pe-14 pt-6\">\n <DialogTitle>{t(\"mcpIntegrations.title\")}</DialogTitle>\n <DialogDescription>\n {t(\"mcpIntegrations.description\")}\n </DialogDescription>\n </DialogHeader>\n <div className=\"flex shrink-0 flex-col gap-3 px-7 pb-5 sm:flex-row\">\n <label className=\"relative min-w-0 flex-1\">\n <IconSearch className=\"pointer-events-none absolute start-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n <input\n value={query}\n onChange={(event) => setQuery(event.target.value)}\n className=\"h-9 w-full rounded-md border border-border bg-background pe-3 ps-8 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n placeholder={t(\"mcpIntegrations.searchPlaceholder\")}\n />\n </label>\n <button\n type=\"button\"\n onClick={() => openForm(null)}\n className={cn(\n \"inline-flex h-9 items-center justify-center gap-1.5 rounded-md border border-border bg-background px-3 text-[12px] font-medium text-foreground hover:bg-accent\",\n !customIntegrationEnabled && \"hidden\",\n )}\n >\n {t(\"mcpIntegrations.addYourOwn\")}\n </button>\n </div>\n <div className=\"min-h-0 flex-1 overflow-y-auto px-7 pb-7\">\n {error && (\n <div className=\"mb-3 rounded-md border border-red-500/20 bg-red-500/5 px-3 py-2 text-[12px] leading-relaxed text-red-600 dark:text-red-400\">\n {error}\n </div>\n )}\n <div className=\"grid gap-3 sm:grid-cols-2\">\n {filteredIntegrations.map((integration) => {\n const connected = connectedUrls.has(\n compareUrl(integration.url),\n );\n const requiresHeaders = integration.authMode === \"headers\";\n return (\n <article\n key={integration.id}\n className=\"flex min-h-[128px] flex-col rounded-md border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20\"\n >\n <h3 className=\"truncate text-[13px] font-semibold text-foreground\">\n {integration.name}\n </h3>\n <p className=\"mt-1 line-clamp-2 flex-1 text-[12px] leading-relaxed text-muted-foreground\">\n {t(integration.descriptionKey)}\n </p>\n <div className=\"mt-3 flex items-center gap-2\">\n <button\n type=\"button\"\n onClick={() => quickConnect(integration)}\n disabled={busy || connected}\n className={cn(\n \"inline-flex h-8 flex-1 items-center justify-center gap-1.5 rounded-md px-2.5 text-[12px] font-medium\",\n connected\n ? \"border border-border bg-muted text-muted-foreground\"\n : \"bg-primary text-primary-foreground hover:bg-primary/90\",\n (busy || connected) &&\n \"cursor-not-allowed opacity-70\",\n )}\n >\n {quickBusyId === integration.id ? (\n <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />\n ) : null}\n {connected\n ? t(\"mcpIntegrations.connected\")\n : integration.authMode === \"oauth\"\n ? t(\"mcpIntegrations.connectWithOAuth\")\n : requiresHeaders\n ? t(\"mcpIntegrations.configure\")\n : t(\"mcpIntegrations.connect\")}\n </button>\n {integration.docsUrl && (\n <Tooltip>\n <TooltipTrigger asChild>\n <a\n href={integration.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex h-8 w-8 items-center justify-center rounded-md border border-border text-muted-foreground hover:bg-accent hover:text-foreground\"\n aria-label={t(\"mcpIntegrations.docsLabel\", {\n name: integration.name,\n })}\n >\n <IconExternalLink className=\"h-3.5 w-3.5\" />\n </a>\n </TooltipTrigger>\n <TooltipContent>\n {t(\"mcpIntegrations.docsLabel\", {\n name: integration.name,\n })}\n </TooltipContent>\n </Tooltip>\n )}\n </div>\n </article>\n );\n })}\n </div>\n {filteredIntegrations.length === 0 && (\n <div className=\"rounded-md border border-dashed border-border p-6 text-center text-[12px] text-muted-foreground\">\n {t(\"mcpIntegrations.noMatches\")}\n </div>\n )}\n </div>\n </>\n ) : (\n <>\n <DialogHeader className=\"shrink-0 border-b border-border px-7 pb-5 pe-14 pt-6\">\n <button\n type=\"button\"\n onClick={() => {\n clearFeedback();\n setMode(\"catalog\");\n }}\n className={cn(\n \"mb-1 inline-flex w-fit items-center gap-1 text-[11px] text-muted-foreground hover:text-foreground\",\n !showCatalog && \"hidden\",\n )}\n >\n <IconArrowLeft className=\"h-3 w-3 rtl:-scale-x-100\" />\n {t(\"mcpIntegrations.backToIntegrations\")}\n </button>\n <DialogTitle>\n {selected\n ? t(\"mcpIntegrations.configureTitle\", {\n name: selected.name,\n })\n : t(\"mcpIntegrations.customTitle\")}\n </DialogTitle>\n <DialogDescription>\n {selected\n ? selected.authMode === \"none\"\n ? t(\"mcpIntegrations.presetNoAuthDescription\")\n : t(\"mcpIntegrations.presetAuthDescription\")\n : t(\"mcpIntegrations.customDescription\")}\n </DialogDescription>\n </DialogHeader>\n <div className=\"min-h-0 flex-1 overflow-y-auto px-7 py-5\">\n <div className=\"space-y-3\">\n {renderScopeSelector()}\n {selected?.setupNoteKey && (\n <div className=\"rounded-md border border-amber-500/20 bg-amber-500/5 px-3 py-2 text-[11px] leading-relaxed text-amber-700 dark:text-amber-300\">\n {t(selected.setupNoteKey)}\n </div>\n )}\n {selected?.authMode === \"oauth\" && (\n <div className=\"rounded-md border border-blue-500/20 bg-blue-500/5 px-3 py-2 text-[11px] leading-relaxed text-blue-700 dark:text-blue-300\">\n {t(\"mcpIntegrations.oauthNotice\")}\n </div>\n )}\n <label className=\"block\">\n <span className=\"mb-1 block text-[10px] font-medium text-muted-foreground\">\n {t(\"mcpIntegrations.serverName\")}\n </span>\n <input\n ref={inputRef}\n value={name}\n onChange={(event) => {\n setName(event.target.value);\n clearFeedback();\n }}\n className=\"w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n placeholder={t(\"mcpIntegrations.serverNamePlaceholder\")}\n />\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-[10px] font-medium text-muted-foreground\">\n {t(\"mcpIntegrations.url\")}\n </span>\n <input\n value={url}\n onChange={(event) => {\n setUrl(event.target.value);\n clearFeedback();\n }}\n className=\"w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n placeholder={t(\"mcpIntegrations.urlPlaceholder\")}\n />\n </label>\n <label className=\"block\">\n <span className=\"mb-1 block text-[10px] font-medium text-muted-foreground\">\n {t(\"mcpIntegrations.fieldDescription\")}\n </span>\n <input\n value={description}\n onChange={(event) => {\n setDescription(event.target.value);\n clearFeedback();\n }}\n className=\"w-full rounded-md border border-border bg-background px-2.5 py-1.5 text-[13px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n placeholder={t(\"mcpIntegrations.descriptionPlaceholder\")}\n />\n </label>\n {selected?.authMode !== \"oauth\" && (\n <label className=\"block\">\n <span className=\"mb-1 block text-[10px] font-medium text-muted-foreground\">\n {t(\"mcpIntegrations.headers\")}\n </span>\n <textarea\n value={headersText}\n onChange={(event) => {\n setHeadersText(event.target.value);\n clearFeedback();\n }}\n rows={3}\n className=\"w-full resize-y rounded-md border border-border bg-background px-2.5 py-1.5 text-[12px] text-foreground outline-none placeholder:text-muted-foreground/50 focus:ring-1 focus:ring-ring\"\n style={{\n fontFamily:\n 'ui-monospace, SFMono-Regular, \"SF Mono\", Menlo, Consolas, monospace',\n }}\n placeholder={\n selected?.headerPlaceholder ??\n t(\"mcpIntegrations.headersPlaceholder\")\n }\n />\n </label>\n )}\n {selected?.docsUrl && (\n <a\n href={selected.docsUrl}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1 text-[11px] text-muted-foreground underline hover:text-foreground\"\n >\n {t(\"mcpIntegrations.openSetupDocs\")}\n <IconExternalLink className=\"h-3 w-3\" />\n </a>\n )}\n {testResult && (\n <div\n className={cn(\n \"flex items-start gap-1 rounded-md px-3 py-2 text-[11px] leading-snug\",\n testResult.ok\n ? \"bg-green-500/5 text-green-600 dark:text-green-400\"\n : \"bg-red-500/5 text-red-600 dark:text-red-400\",\n )}\n >\n {testResult.ok && (\n <IconCheck className=\"mt-0.5 h-3 w-3 shrink-0\" />\n )}\n <span className=\"min-w-0 break-words\">\n {testResult.message}\n </span>\n </div>\n )}\n {error && (\n <div className=\"break-words rounded-md bg-red-500/5 px-3 py-2 text-[11px] leading-snug text-red-600 dark:text-red-400\">\n {error}\n </div>\n )}\n </div>\n </div>\n <div className=\"flex shrink-0 items-center justify-between gap-2 border-t border-border px-7 py-4\">\n <button\n type=\"button\"\n onClick={runTest}\n disabled={!url.trim() || busy}\n className=\"rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40\"\n >\n {t(\"mcpIntegrations.test\")}\n </button>\n {!selected && (\n <button\n type=\"button\"\n onClick={connectCustomWithOAuth}\n disabled={!name.trim() || !url.trim() || busy}\n className=\"rounded-md border border-border bg-background px-3 py-1.5 text-[12px] font-medium text-foreground hover:bg-accent disabled:pointer-events-none disabled:opacity-40\"\n >\n {t(\"mcpIntegrations.connectWithOAuth\")}\n </button>\n )}\n <button\n type=\"button\"\n onClick={submitForm}\n disabled={!name.trim() || !url.trim() || busy}\n className=\"inline-flex min-w-[92px] items-center justify-center gap-1.5 rounded-md bg-primary px-3 py-1.5 text-[12px] font-medium text-primary-foreground hover:bg-primary/90 disabled:pointer-events-none disabled:opacity-40\"\n >\n {busy && <IconLoader2 className=\"h-3.5 w-3.5 animate-spin\" />}\n {t(\"mcpIntegrations.connect\")}\n </button>\n </div>\n </>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"]}
|
|
@@ -21,11 +21,20 @@ export interface McpIntegrationFormDefaults {
|
|
|
21
21
|
description: string;
|
|
22
22
|
headersText: string;
|
|
23
23
|
}
|
|
24
|
+
export interface McpOAuthStartParams {
|
|
25
|
+
name: string;
|
|
26
|
+
url: string;
|
|
27
|
+
description: string;
|
|
28
|
+
scope: "user" | "org";
|
|
29
|
+
returnUrl: string;
|
|
30
|
+
}
|
|
24
31
|
export declare const DEFAULT_MCP_INTEGRATIONS: DefaultMcpIntegration[];
|
|
25
32
|
export declare function getDefaultMcpIntegrations(config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig): DefaultMcpIntegration[];
|
|
26
33
|
export declare function isCustomMcpIntegrationEnabled(config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig): boolean;
|
|
27
34
|
export declare function isMcpIntegrationCatalogAvailable(config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig): boolean;
|
|
28
35
|
export declare function mcpIntegrationAuthLabel(mode: McpIntegrationAuthMode): string;
|
|
36
|
+
export declare function buildMcpOAuthStartUrl({ name, url, description, scope, returnUrl, }: McpOAuthStartParams): string;
|
|
37
|
+
export declare function resolveMcpIntegrationScope(defaultScope: "user" | "org", hasOrg: boolean, canCreateOrgMcp: boolean): "user" | "org";
|
|
29
38
|
export declare function filterMcpIntegrations(query: string, integrations?: DefaultMcpIntegration[]): DefaultMcpIntegration[];
|
|
30
39
|
export declare function createMcpIntegrationFormDefaults(integration?: DefaultMcpIntegration | null): McpIntegrationFormDefaults;
|
|
31
40
|
//# sourceMappingURL=mcp-integration-catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-integration-catalog.d.ts","sourceRoot":"","sources":["../../../src/client/resources/mcp-integration-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAEhD,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAMlE,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,MAAM,CAAC;IACvB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,sBAAsB,CAAC;IACjC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAED,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;CACrB;AAED,eAAO,MAAM,wBAAwB,EAAE,qBAAqB,EA0H3D,CAAC;AAsBF,wBAAgB,yBAAyB,CACvC,MAAM,CAAC,EAAE,0BAA0B,GAAG,+BAA+B,GACpE,qBAAqB,EAAE,CAazB;AAED,wBAAgB,6BAA6B,CAC3C,MAAM,CAAC,EAAE,0BAA0B,GAAG,+BAA+B,GACpE,OAAO,CAGT;AAED,wBAAgB,gCAAgC,CAC9C,MAAM,CAAC,EAAE,0BAA0B,GAAG,+BAA+B,GACpE,OAAO,CAIT;AAED,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,sBAAsB,GAAG,MAAM,CAI5E;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,YAAY,GAAE,qBAAqB,EAAgC,GAClE,qBAAqB,EAAE,CAgBzB;AAED,wBAAgB,gCAAgC,CAC9C,WAAW,CAAC,EAAE,qBAAqB,GAAG,IAAI,GACzC,0BAA0B,CAe5B"}
|
|
1
|
+
{"version":3,"file":"mcp-integration-catalog.d.ts","sourceRoot":"","sources":["../../../src/client/resources/mcp-integration-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,+BAA+B,EACrC,MAAM,wCAAwC,CAAC;AAEhD,MAAM,MAAM,sBAAsB,GAAG,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC;AAMlE,MAAM,WAAW,qBAAqB;IACpC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,WA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AAM,GAAG,KAAK,EAC5B,MAAM,EAAE,OAAO,EACf,eAAe,EAAE,OAAO,GACvB,MAAM,GAAG,KAAK,CAEhB;AAED,wBAAgB,qBAAqB,CACnC,KAAK,EAAE,MAAM,EACb,YAAY,GAAE,qBAAqB,EAAgC,GAClE,qBAAqB,EAAE,CAgBzB;AAED,wBAAgB,gCAAgC,CAC9C,WAAW,CAAC,EAAE,qBAAqB,GAAG,IAAI,GACzC,0BAA0B,CAe5B"}
|
|
@@ -168,6 +168,19 @@ export function mcpIntegrationAuthLabel(mode) {
|
|
|
168
168
|
return "Header";
|
|
169
169
|
return "OAuth";
|
|
170
170
|
}
|
|
171
|
+
export function buildMcpOAuthStartUrl({ name, url, description, scope, returnUrl, }) {
|
|
172
|
+
const params = new URLSearchParams({
|
|
173
|
+
name,
|
|
174
|
+
url,
|
|
175
|
+
description,
|
|
176
|
+
scope,
|
|
177
|
+
return: returnUrl,
|
|
178
|
+
});
|
|
179
|
+
return `/_agent-native/mcp/servers/oauth/start?${params.toString()}`;
|
|
180
|
+
}
|
|
181
|
+
export function resolveMcpIntegrationScope(defaultScope, hasOrg, canCreateOrgMcp) {
|
|
182
|
+
return defaultScope === "org" && hasOrg && canCreateOrgMcp ? "org" : "user";
|
|
183
|
+
}
|
|
171
184
|
export function filterMcpIntegrations(query, integrations = getDefaultMcpIntegrations()) {
|
|
172
185
|
const needle = query.trim().toLowerCase();
|
|
173
186
|
if (!needle)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mcp-integration-catalog.js","sourceRoot":"","sources":["../../../src/client/resources/mcp-integration-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,GAG/B,MAAM,wCAAwC,CAAC;AA+BhD,MAAM,CAAC,MAAM,wBAAwB,GAA4B;IAC/D;QACE,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,4CAA4C;QACzD,cAAc,EAAE,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AAK,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,CAAC;IAC1C,IAAI,CAAC,MAAM;QAAE,OAAO,YAAY,CAAC;IACjC,OAAO,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE;QACzC,MAAM,QAAQ,GAAG;YACf,WAAW,CAAC,IAAI;YAChB,WAAW,CAAC,QAAQ;YACpB,WAAW,CAAC,WAAW;YACvB,WAAW,CAAC,OAAO;YACnB,WAAW,CAAC,GAAG;YACf,GAAG,WAAW,CAAC,QAAQ;SACxB;aACE,IAAI,CAAC,GAAG,CAAC;aACT,WAAW,EAAE,CAAC;QACjB,OAAO,QAAQ,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC;AAED,MAAM,UAAU,gCAAgC,CAC9C,WAA0C;IAE1C,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,OAAO;YACL,IAAI,EAAE,EAAE;YACR,GAAG,EAAE,EAAE;YACP,WAAW,EAAE,EAAE;YACf,WAAW,EAAE,EAAE;SAChB,CAAC;IACJ,CAAC;IACD,OAAO;QACL,IAAI,EAAE,WAAW,CAAC,IAAI;QACtB,GAAG,EAAE,WAAW,CAAC,GAAG;QACpB,WAAW,EAAE,WAAW,CAAC,WAAW;QACpC,WAAW,EAAE,EAAE;KAChB,CAAC;AACJ,CAAC","sourcesContent":["import {\n normalizeMcpIntegrationsConfig,\n type McpIntegrationsConfigInput,\n type NormalizedMcpIntegrationsConfig,\n} from \"../../shared/mcp-integration-config.js\";\n\nexport type McpIntegrationAuthMode = \"none\" | \"headers\" | \"oauth\";\n\ndeclare const __AGENT_NATIVE_MCP_INTEGRATIONS_CONFIG__:\n | NormalizedMcpIntegrationsConfig\n | undefined;\n\nexport interface DefaultMcpIntegration {\n id: string;\n name: string;\n provider: string;\n description: string;\n descriptionKey: string;\n useCase: string;\n useCaseKey: string;\n url: string;\n authMode: McpIntegrationAuthMode;\n docsUrl?: string;\n setupNoteKey?: string;\n headerPlaceholder?: string;\n keywords: string[];\n}\n\nexport interface McpIntegrationFormDefaults {\n name: string;\n url: string;\n description: string;\n headersText: string;\n}\n\nexport const DEFAULT_MCP_INTEGRATIONS: DefaultMcpIntegration[] = [\n {\n id: \"context7\",\n name: \"Context7\",\n provider: \"context7\",\n description: \"Fetch current library docs in agent chats.\",\n descriptionKey: \"mcpIntegrations.catalog.context7.description\",\n useCase: \"documentation, technical reference, API docs, framework guides\",\n useCaseKey: \"mcpIntegrations.catalog.context7.useCase\",\n url: \"https://mcp.context7.com/mcp\",\n authMode: \"none\",\n docsUrl: \"https://context7.com/\",\n keywords: [\"docs\", \"documentation\", \"libraries\", \"frameworks\"],\n },\n {\n id: \"sentry\",\n name: \"Sentry\",\n provider: \"sentry\",\n description: \"Inspect issues, events, and debugging data.\",\n descriptionKey: \"mcpIntegrations.catalog.sentry.description\",\n useCase: \"error monitoring, debugging, performance, crash reports\",\n useCaseKey: \"mcpIntegrations.catalog.sentry.useCase\",\n url: \"https://mcp.sentry.dev/mcp\",\n authMode: \"headers\",\n docsUrl: \"https://docs.sentry.io/product/sentry-mcp/\",\n headerPlaceholder: \"Authorization: Bearer <sentry-token>\",\n keywords: [\"errors\", \"monitoring\", \"debugging\", \"issues\"],\n },\n {\n id: \"notion\",\n name: \"Notion\",\n provider: \"notion\",\n description: \"Search pages and team knowledge.\",\n descriptionKey: \"mcpIntegrations.catalog.notion.description\",\n useCase: \"documentation, knowledge management, notes, content creation\",\n useCaseKey: \"mcpIntegrations.catalog.notion.useCase\",\n url: \"https://mcp.notion.com/sse\",\n authMode: \"oauth\",\n docsUrl: \"https://developers.notion.com/docs/mcp\",\n keywords: [\"docs\", \"knowledge\", \"notes\", \"pages\"],\n },\n {\n id: \"semgrep\",\n name: \"Semgrep\",\n provider: \"semgrep\",\n description: \"Scan code for security findings.\",\n descriptionKey: \"mcpIntegrations.catalog.semgrep.description\",\n useCase: \"security scanning, vulnerability detection, code analysis\",\n useCaseKey: \"mcpIntegrations.catalog.semgrep.useCase\",\n url: \"https://mcp.semgrep.ai/mcp\",\n authMode: \"none\",\n docsUrl: \"https://github.com/semgrep/mcp#readme\",\n keywords: [\"security\", \"sast\", \"code scanning\", \"vulnerabilities\"],\n },\n {\n id: \"linear\",\n name: \"Linear\",\n provider: \"linear\",\n description: \"Read and write Linear issues.\",\n descriptionKey: \"mcpIntegrations.catalog.linear.description\",\n useCase: \"project management, issue tracking, planning, bug reports\",\n useCaseKey: \"mcpIntegrations.catalog.linear.useCase\",\n url: \"https://mcp.linear.app/sse\",\n authMode: \"oauth\",\n docsUrl: \"https://www.builder.io/c/docs/fusion-connect-to-linear\",\n keywords: [\"issues\", \"tickets\", \"planning\", \"project management\"],\n },\n {\n id: \"atlassian\",\n name: \"Atlassian\",\n provider: \"atlassian\",\n description: \"Read and write Jira issues and Confluence content.\",\n descriptionKey: \"mcpIntegrations.catalog.atlassian.description\",\n useCase:\n \"project management, issue tracking, documentation, team collaboration\",\n useCaseKey: \"mcpIntegrations.catalog.atlassian.useCase\",\n url: \"https://mcp.atlassian.com/v1/mcp/authv2\",\n authMode: \"oauth\",\n docsUrl:\n \"https://developer.atlassian.com/cloud/rovo-mcp/guides/getting-started/\",\n setupNoteKey: \"mcpIntegrations.catalog.atlassian.setupNote\",\n keywords: [\"atlassian\", \"jira\", \"confluence\", \"issues\", \"tickets\"],\n },\n {\n id: \"supabase\",\n name: \"Supabase\",\n provider: \"supabase\",\n description: \"Manage data, auth, and backend services.\",\n descriptionKey: \"mcpIntegrations.catalog.supabase.description\",\n useCase: \"database, authentication, storage, edge functions\",\n useCaseKey: \"mcpIntegrations.catalog.supabase.useCase\",\n url: \"https://mcp.supabase.com/mcp\",\n authMode: \"oauth\",\n docsUrl: \"https://www.builder.io/c/docs/fusion-connect-to-supabase\",\n keywords: [\"database\", \"auth\", \"postgres\", \"storage\"],\n },\n {\n id: \"neon\",\n name: \"Neon\",\n provider: \"neon\",\n description: \"Work with serverless Postgres projects.\",\n descriptionKey: \"mcpIntegrations.catalog.neon.description\",\n useCase: \"database management, serverless postgres, data storage\",\n useCaseKey: \"mcpIntegrations.catalog.neon.useCase\",\n url: \"https://mcp.neon.tech/sse\",\n authMode: \"oauth\",\n docsUrl: \"https://www.builder.io/c/docs/fusion-connect-to-neon\",\n keywords: [\"database\", \"postgres\", \"serverless\", \"backend\"],\n },\n {\n id: \"stripe\",\n name: \"Stripe\",\n provider: \"stripe\",\n description: \"Manage payments, subscriptions, and customers.\",\n descriptionKey: \"mcpIntegrations.catalog.stripe.description\",\n useCase: \"payments, subscriptions, invoicing, customer management\",\n useCaseKey: \"mcpIntegrations.catalog.stripe.useCase\",\n url: \"https://mcp.stripe.com\",\n authMode: \"oauth\",\n docsUrl: \"https://docs.stripe.com/mcp\",\n keywords: [\"payments\", \"billing\", \"subscriptions\", \"customers\"],\n },\n];\n\nfunction readRuntimeMcpIntegrationsConfig(): NormalizedMcpIntegrationsConfig {\n try {\n if (typeof __AGENT_NATIVE_MCP_INTEGRATIONS_CONFIG__ !== \"undefined\") {\n return normalizeMcpIntegrationsConfig(\n __AGENT_NATIVE_MCP_INTEGRATIONS_CONFIG__,\n );\n }\n } catch {\n // Test and non-Vite contexts may not define the compile-time constant.\n }\n return normalizeMcpIntegrationsConfig();\n}\n\nfunction normalizePresetConfig(\n config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig,\n): NormalizedMcpIntegrationsConfig {\n if (config === undefined) return readRuntimeMcpIntegrationsConfig();\n return normalizeMcpIntegrationsConfig(config);\n}\n\nexport function getDefaultMcpIntegrations(\n config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig,\n): DefaultMcpIntegration[] {\n const normalized = normalizePresetConfig(config);\n if (!normalized.enabled || !normalized.defaults.enabled) return [];\n\n const include = normalized.defaults.include\n ? new Set(normalized.defaults.include)\n : null;\n const exclude = new Set(normalized.defaults.exclude);\n return DEFAULT_MCP_INTEGRATIONS.filter((integration) => {\n const id = integration.id.toLowerCase();\n if (include && !include.has(id)) return false;\n return !exclude.has(id);\n });\n}\n\nexport function isCustomMcpIntegrationEnabled(\n config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig,\n): boolean {\n const normalized = normalizePresetConfig(config);\n return normalized.enabled && normalized.custom;\n}\n\nexport function isMcpIntegrationCatalogAvailable(\n config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig,\n): boolean {\n const normalized = normalizePresetConfig(config);\n if (!normalized.enabled) return false;\n return normalized.custom || getDefaultMcpIntegrations(normalized).length > 0;\n}\n\nexport function mcpIntegrationAuthLabel(mode: McpIntegrationAuthMode): string {\n if (mode === \"none\") return \"No auth\";\n if (mode === \"headers\") return \"Header\";\n return \"OAuth\";\n}\n\nexport function filterMcpIntegrations(\n query: string,\n integrations: DefaultMcpIntegration[] = getDefaultMcpIntegrations(),\n): DefaultMcpIntegration[] {\n const needle = query.trim().toLowerCase();\n if (!needle) return integrations;\n return integrations.filter((integration) => {\n const haystack = [\n integration.name,\n integration.provider,\n integration.description,\n integration.useCase,\n integration.url,\n ...integration.keywords,\n ]\n .join(\" \")\n .toLowerCase();\n return haystack.includes(needle);\n });\n}\n\nexport function createMcpIntegrationFormDefaults(\n integration?: DefaultMcpIntegration | null,\n): McpIntegrationFormDefaults {\n if (!integration) {\n return {\n name: \"\",\n url: \"\",\n description: \"\",\n headersText: \"\",\n };\n }\n return {\n name: integration.name,\n url: integration.url,\n description: integration.description,\n headersText: \"\",\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"mcp-integration-catalog.js","sourceRoot":"","sources":["../../../src/client/resources/mcp-integration-catalog.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,8BAA8B,GAG/B,MAAM,wCAAwC,CAAC;AAuChD,MAAM,CAAC,MAAM,wBAAwB,GAA4B;IAC/D;QACE,EAAE,EAAE,UAAU;QACd,IAAI,EAAE,UAAU;QAChB,QAAQ,EAAE,UAAU;QACpB,WAAW,EAAE,4CAA4C;QACzD,cAAc,EAAE,8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AC,GAAG;QACpB,WAAW,EAAE,WAAW,CAAC,WAAW;QACpC,WAAW,EAAE,EAAE;KAChB,CAAC;AACJ,CAAC","sourcesContent":["import {\n normalizeMcpIntegrationsConfig,\n type McpIntegrationsConfigInput,\n type NormalizedMcpIntegrationsConfig,\n} from \"../../shared/mcp-integration-config.js\";\n\nexport type McpIntegrationAuthMode = \"none\" | \"headers\" | \"oauth\";\n\ndeclare const __AGENT_NATIVE_MCP_INTEGRATIONS_CONFIG__:\n | NormalizedMcpIntegrationsConfig\n | undefined;\n\nexport interface DefaultMcpIntegration {\n id: string;\n name: string;\n provider: string;\n description: string;\n descriptionKey: string;\n useCase: string;\n useCaseKey: string;\n url: string;\n authMode: McpIntegrationAuthMode;\n docsUrl?: string;\n setupNoteKey?: string;\n headerPlaceholder?: string;\n keywords: string[];\n}\n\nexport interface McpIntegrationFormDefaults {\n name: string;\n url: string;\n description: string;\n headersText: string;\n}\n\nexport interface McpOAuthStartParams {\n name: string;\n url: string;\n description: string;\n scope: \"user\" | \"org\";\n returnUrl: string;\n}\n\nexport const DEFAULT_MCP_INTEGRATIONS: DefaultMcpIntegration[] = [\n {\n id: \"context7\",\n name: \"Context7\",\n provider: \"context7\",\n description: \"Fetch current library docs in agent chats.\",\n descriptionKey: \"mcpIntegrations.catalog.context7.description\",\n useCase: \"documentation, technical reference, API docs, framework guides\",\n useCaseKey: \"mcpIntegrations.catalog.context7.useCase\",\n url: \"https://mcp.context7.com/mcp\",\n authMode: \"none\",\n docsUrl: \"https://context7.com/\",\n keywords: [\"docs\", \"documentation\", \"libraries\", \"frameworks\"],\n },\n {\n id: \"sentry\",\n name: \"Sentry\",\n provider: \"sentry\",\n description: \"Inspect issues, events, and debugging data.\",\n descriptionKey: \"mcpIntegrations.catalog.sentry.description\",\n useCase: \"error monitoring, debugging, performance, crash reports\",\n useCaseKey: \"mcpIntegrations.catalog.sentry.useCase\",\n url: \"https://mcp.sentry.dev/mcp\",\n authMode: \"headers\",\n docsUrl: \"https://docs.sentry.io/product/sentry-mcp/\",\n headerPlaceholder: \"Authorization: Bearer <sentry-token>\",\n keywords: [\"errors\", \"monitoring\", \"debugging\", \"issues\"],\n },\n {\n id: \"notion\",\n name: \"Notion\",\n provider: \"notion\",\n description: \"Search pages and team knowledge.\",\n descriptionKey: \"mcpIntegrations.catalog.notion.description\",\n useCase: \"documentation, knowledge management, notes, content creation\",\n useCaseKey: \"mcpIntegrations.catalog.notion.useCase\",\n url: \"https://mcp.notion.com/sse\",\n authMode: \"oauth\",\n docsUrl: \"https://developers.notion.com/docs/mcp\",\n keywords: [\"docs\", \"knowledge\", \"notes\", \"pages\"],\n },\n {\n id: \"semgrep\",\n name: \"Semgrep\",\n provider: \"semgrep\",\n description: \"Scan code for security findings.\",\n descriptionKey: \"mcpIntegrations.catalog.semgrep.description\",\n useCase: \"security scanning, vulnerability detection, code analysis\",\n useCaseKey: \"mcpIntegrations.catalog.semgrep.useCase\",\n url: \"https://mcp.semgrep.ai/mcp\",\n authMode: \"none\",\n docsUrl: \"https://github.com/semgrep/mcp#readme\",\n keywords: [\"security\", \"sast\", \"code scanning\", \"vulnerabilities\"],\n },\n {\n id: \"linear\",\n name: \"Linear\",\n provider: \"linear\",\n description: \"Read and write Linear issues.\",\n descriptionKey: \"mcpIntegrations.catalog.linear.description\",\n useCase: \"project management, issue tracking, planning, bug reports\",\n useCaseKey: \"mcpIntegrations.catalog.linear.useCase\",\n url: \"https://mcp.linear.app/sse\",\n authMode: \"oauth\",\n docsUrl: \"https://www.builder.io/c/docs/fusion-connect-to-linear\",\n keywords: [\"issues\", \"tickets\", \"planning\", \"project management\"],\n },\n {\n id: \"atlassian\",\n name: \"Atlassian\",\n provider: \"atlassian\",\n description: \"Read and write Jira issues and Confluence content.\",\n descriptionKey: \"mcpIntegrations.catalog.atlassian.description\",\n useCase:\n \"project management, issue tracking, documentation, team collaboration\",\n useCaseKey: \"mcpIntegrations.catalog.atlassian.useCase\",\n url: \"https://mcp.atlassian.com/v1/mcp/authv2\",\n authMode: \"oauth\",\n docsUrl:\n \"https://developer.atlassian.com/cloud/rovo-mcp/guides/getting-started/\",\n setupNoteKey: \"mcpIntegrations.catalog.atlassian.setupNote\",\n keywords: [\"atlassian\", \"jira\", \"confluence\", \"issues\", \"tickets\"],\n },\n {\n id: \"supabase\",\n name: \"Supabase\",\n provider: \"supabase\",\n description: \"Manage data, auth, and backend services.\",\n descriptionKey: \"mcpIntegrations.catalog.supabase.description\",\n useCase: \"database, authentication, storage, edge functions\",\n useCaseKey: \"mcpIntegrations.catalog.supabase.useCase\",\n url: \"https://mcp.supabase.com/mcp\",\n authMode: \"oauth\",\n docsUrl: \"https://www.builder.io/c/docs/fusion-connect-to-supabase\",\n keywords: [\"database\", \"auth\", \"postgres\", \"storage\"],\n },\n {\n id: \"neon\",\n name: \"Neon\",\n provider: \"neon\",\n description: \"Work with serverless Postgres projects.\",\n descriptionKey: \"mcpIntegrations.catalog.neon.description\",\n useCase: \"database management, serverless postgres, data storage\",\n useCaseKey: \"mcpIntegrations.catalog.neon.useCase\",\n url: \"https://mcp.neon.tech/sse\",\n authMode: \"oauth\",\n docsUrl: \"https://www.builder.io/c/docs/fusion-connect-to-neon\",\n keywords: [\"database\", \"postgres\", \"serverless\", \"backend\"],\n },\n {\n id: \"stripe\",\n name: \"Stripe\",\n provider: \"stripe\",\n description: \"Manage payments, subscriptions, and customers.\",\n descriptionKey: \"mcpIntegrations.catalog.stripe.description\",\n useCase: \"payments, subscriptions, invoicing, customer management\",\n useCaseKey: \"mcpIntegrations.catalog.stripe.useCase\",\n url: \"https://mcp.stripe.com\",\n authMode: \"oauth\",\n docsUrl: \"https://docs.stripe.com/mcp\",\n keywords: [\"payments\", \"billing\", \"subscriptions\", \"customers\"],\n },\n];\n\nfunction readRuntimeMcpIntegrationsConfig(): NormalizedMcpIntegrationsConfig {\n try {\n if (typeof __AGENT_NATIVE_MCP_INTEGRATIONS_CONFIG__ !== \"undefined\") {\n return normalizeMcpIntegrationsConfig(\n __AGENT_NATIVE_MCP_INTEGRATIONS_CONFIG__,\n );\n }\n } catch {\n // Test and non-Vite contexts may not define the compile-time constant.\n }\n return normalizeMcpIntegrationsConfig();\n}\n\nfunction normalizePresetConfig(\n config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig,\n): NormalizedMcpIntegrationsConfig {\n if (config === undefined) return readRuntimeMcpIntegrationsConfig();\n return normalizeMcpIntegrationsConfig(config);\n}\n\nexport function getDefaultMcpIntegrations(\n config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig,\n): DefaultMcpIntegration[] {\n const normalized = normalizePresetConfig(config);\n if (!normalized.enabled || !normalized.defaults.enabled) return [];\n\n const include = normalized.defaults.include\n ? new Set(normalized.defaults.include)\n : null;\n const exclude = new Set(normalized.defaults.exclude);\n return DEFAULT_MCP_INTEGRATIONS.filter((integration) => {\n const id = integration.id.toLowerCase();\n if (include && !include.has(id)) return false;\n return !exclude.has(id);\n });\n}\n\nexport function isCustomMcpIntegrationEnabled(\n config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig,\n): boolean {\n const normalized = normalizePresetConfig(config);\n return normalized.enabled && normalized.custom;\n}\n\nexport function isMcpIntegrationCatalogAvailable(\n config?: McpIntegrationsConfigInput | NormalizedMcpIntegrationsConfig,\n): boolean {\n const normalized = normalizePresetConfig(config);\n if (!normalized.enabled) return false;\n return normalized.custom || getDefaultMcpIntegrations(normalized).length > 0;\n}\n\nexport function mcpIntegrationAuthLabel(mode: McpIntegrationAuthMode): string {\n if (mode === \"none\") return \"No auth\";\n if (mode === \"headers\") return \"Header\";\n return \"OAuth\";\n}\n\nexport function buildMcpOAuthStartUrl({\n name,\n url,\n description,\n scope,\n returnUrl,\n}: McpOAuthStartParams): string {\n const params = new URLSearchParams({\n name,\n url,\n description,\n scope,\n return: returnUrl,\n });\n return `/_agent-native/mcp/servers/oauth/start?${params.toString()}`;\n}\n\nexport function resolveMcpIntegrationScope(\n defaultScope: \"user\" | \"org\",\n hasOrg: boolean,\n canCreateOrgMcp: boolean,\n): \"user\" | \"org\" {\n return defaultScope === \"org\" && hasOrg && canCreateOrgMcp ? \"org\" : \"user\";\n}\n\nexport function filterMcpIntegrations(\n query: string,\n integrations: DefaultMcpIntegration[] = getDefaultMcpIntegrations(),\n): DefaultMcpIntegration[] {\n const needle = query.trim().toLowerCase();\n if (!needle) return integrations;\n return integrations.filter((integration) => {\n const haystack = [\n integration.name,\n integration.provider,\n integration.description,\n integration.useCase,\n integration.url,\n ...integration.keywords,\n ]\n .join(\" \")\n .toLowerCase();\n return haystack.includes(needle);\n });\n}\n\nexport function createMcpIntegrationFormDefaults(\n integration?: DefaultMcpIntegration | null,\n): McpIntegrationFormDefaults {\n if (!integration) {\n return {\n name: \"\",\n url: \"\",\n description: \"\",\n headersText: \"\",\n };\n }\n return {\n name: integration.name,\n url: integration.url,\n description: integration.description,\n headersText: \"\",\n };\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"use-mcp-servers.d.ts","sourceRoot":"","sources":["../../../src/client/resources/use-mcp-servers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAMH,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,KAAK,CAAC;AAE5C,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,cAAc,CAAC;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,MAAM,CAAC;IACZ,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE;QAAE,GAAG,EAAE,IAAI,CAAA;KAAE,CAAC,CAAC;IACxC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EACF;QAAE,KAAK,EAAE,WAAW,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,GACzC;QAAE,KA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;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAqB,EAAE,QAAgB;IAClE,OAAO,OAAO,KAAK,IAAI,QAAQ,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,EAAU;IAEV,MAAM,CAAC,GAAG,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3C,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAmB,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * React-query hooks for remote MCP servers surfaced inside the Workspace\n * tab as a virtual `mcp-servers/` folder.\n *\n * MCP servers live in the settings store (user- and org-scope), not the\n * resources table. These hooks wrap the existing `/_agent-native/mcp/servers`\n * endpoints so the Workspace UI can list, create, and delete them with the\n * same keys/invalidations the old Settings panel used.\n */\n\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\n\nimport { agentNativePath } from \"../api-path.js\";\n\nexport type McpServerScope = \"user\" | \"org\";\n\nexport interface McpServer {\n id: string;\n scope: McpServerScope;\n name: string;\n url: string;\n headers?: Record<string, { set: true }>;\n description?: string;\n firstParty?: boolean;\n createdAt: number;\n mergedId: string;\n status:\n | { state: \"connected\"; toolCount: number }\n | { state: \"error\"; error: string }\n | { state: \"unknown\" };\n}\n\nexport interface McpServersList {\n user: McpServer[];\n org: McpServer[];\n orgId: string | null;\n role: string | null;\n}\n\nconst ENDPOINT = agentNativePath(\"/_agent-native/mcp/servers\");\nconst LIST_KEY = [\"mcp-servers\"] as const;\n\nexport function useMcpServers() {\n return useQuery<McpServersList>({\n queryKey: LIST_KEY,\n queryFn: async () => {\n const res = await fetch(ENDPOINT, { credentials: \"include\" });\n if (!res.ok) throw new Error(`Failed to load (${res.status})`);\n return (await res.json()) as McpServersList;\n },\n staleTime: 10_000,\n });\n}\n\nexport interface CreateMcpServerArgs {\n scope: McpServerScope;\n name: string;\n url: string;\n headers?: Record<string, string>;\n description?: string;\n}\n\nexport function useCreateMcpServer() {\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (args: CreateMcpServerArgs) => {\n const res = await fetch(ENDPOINT, {\n method: \"POST\",\n credentials: \"include\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(args),\n });\n const body = (await res.json().catch(() => ({}))) as {\n ok?: boolean;\n error?: string;\n server?: McpServer;\n };\n if (!res.ok || !body.ok) {\n throw new Error(body.error || `Create failed (${res.status})`);\n }\n return body.server!;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: LIST_KEY }),\n });\n}\n\nexport function useDeleteMcpServer() {\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (args: { id: string; scope: McpServerScope }) => {\n const res = await fetch(\n `${ENDPOINT}/${encodeURIComponent(args.id)}?scope=${args.scope}`,\n {\n method: \"DELETE\",\n credentials: \"include\",\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n const body = (await res.json().catch(() => ({}))) as {\n ok?: boolean;\n error?: string;\n };\n if (!res.ok || !body.ok) {\n throw new Error(body.error || `Delete failed (${res.status})`);\n }\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: LIST_KEY }),\n });\n}\n\nexport interface TestMcpUrlResult {\n ok: boolean;\n error?: string;\n toolCount?: number;\n tools?: string[];\n}\n\nexport function getMcpUrlValidationError(rawUrl: string): string | null {\n const trimmed = rawUrl.trim();\n if (!trimmed) return \"Enter the Streamable HTTP MCP server URL.\";\n let url: URL;\n try {\n url = new URL(trimmed);\n } catch {\n return \"Enter a full URL, including https://.\";\n }\n if (url.protocol !== \"https:\" && url.protocol !== \"http:\") {\n return \"MCP server URLs must start with https://.\";\n }\n if (\n url.protocol === \"http:\" &&\n ![\"localhost\", \"127.0.0.1\"].includes(url.hostname)\n ) {\n return \"Use https:// for remote MCP servers. Plain http:// is only allowed for localhost.\";\n }\n return null;\n}\n\nexport function formatMcpServerError(error: unknown): string {\n const raw =\n typeof error === \"string\"\n ? error\n : error instanceof Error\n ? error.message\n : String(error ?? \"\");\n const text = raw.trim();\n if (!text) return \"Could not connect to that MCP server.\";\n if (\n /<!doctype|<html[\\s>]|<\\/html>|unexpected token '<'|is not valid json/i.test(\n text,\n )\n ) {\n return \"That URL returned a web page instead of an MCP response. Check that you pasted the Streamable HTTP endpoint, often ending in /mcp.\";\n }\n if (\n /streamable http/i.test(text) &&\n /error|failed|non-200|status/i.test(text)\n ) {\n return \"The server did not complete the Streamable HTTP MCP handshake. Check the URL and any required authorization headers.\";\n }\n if (\n /failed to fetch|fetch failed|networkerror|econnrefused|enotfound|timed out/i.test(\n text,\n )\n ) {\n return \"Could not reach that MCP server. Check the URL and make sure it is publicly reachable from this app.\";\n }\n if (/401|403|unauthorized|forbidden/i.test(text)) {\n return \"The MCP server rejected the request. Add or update the required Authorization header.\";\n }\n if (/404|not found|405|method not allowed/i.test(text)) {\n return \"That URL is reachable, but it does not look like the MCP endpoint. Check the server's Streamable HTTP path.\";\n }\n return text.length > 240 ? `${text.slice(0, 237).trimEnd()}...` : text;\n}\n\nexport async function testMcpServerUrl(\n url: string,\n headers?: Record<string, string>,\n): Promise<TestMcpUrlResult> {\n const validationError = getMcpUrlValidationError(url);\n if (validationError) return { ok: false, error: validationError };\n const res = await fetch(`${ENDPOINT}/test`, {\n method: \"POST\",\n credentials: \"include\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ url, headers }),\n });\n const body = (await res.json().catch(() => ({}))) as TestMcpUrlResult;\n if (!res.ok) {\n return {\n ok: false,\n error: formatMcpServerError(body.error || \"Test failed\"),\n };\n }\n return body.ok === false\n ? { ...body, error: formatMcpServerError(body.error) }\n : body;\n}\n\n/**\n * Virtual tree-node id used when a server is surfaced in the Workspace tree.\n * Shape: `mcp:<scope>:<serverId>`. Not a real resource row; purely a handle\n * the panel uses to route clicks/delete back to the MCP endpoints.\n */\nexport function mcpVirtualId(scope: McpServerScope, serverId: string): string {\n return `mcp:${scope}:${serverId}`;\n}\n\nexport function parseMcpVirtualId(\n id: string,\n): { scope: McpServerScope; serverId: string } | null {\n const m = /^mcp:(user|org):(.+)$/.exec(id);\n if (!m) return null;\n return { scope: m[1] as McpServerScope, serverId: m[2] };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"use-mcp-servers.js","sourceRoot":"","sources":["../../../src/client/resources/use-mcp-servers.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE9E,OAAO,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AA4BjD,MAAM,QAAQ,GAAG,eAAe,CAAC,4BAA4B,CAAC,CAAC;AAC/D,MAAM,QAAQ,GAAG,CAAC,aAAa,CAAU,CAAC;AAE1C,MAAM,UAAU,aAAa;IAC3B,OAAO,QAAQ,CAAiB;QAC9B,QAAQ,EAAE,QAAQ;QAClB,OAAO,EAAE,KAAK,IAAI,EAAE;YAClB,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE,EAAE,WAAW,EAAE,SAAS,EAAE,CAAC,CAAC;YAC9D,IAAI,CAAC,GAAG,CAAC,EAAE;gBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,GAAG,CAAC,MAAM,GAAG,CAAC,CAAC;YAC/D,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAmB,CAAC;QAC9C,CAAC;QACD,SAAS,EAAE,MAAM;KAClB,CAAC,CAAC;AACL,CAAC;AAUD,MAAM,UAAU,kBAAkB;IAChC,MAAM,EAAE,GAAG,cAAc,EAAE,CAAC;IAC5B,OAAO,WAAW,CAAC;QACjB,UAAU,EAAE,KAAK,EAAE,IAAyB,EAAE,EAAE;YAC9C,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,QAAQ,EAAE;gBAChC,MAAM,EAAE,MAAM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ACH,MAAM,IAAI,GAAG,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,CAAqB,CAAC;IACtE,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,OAAO;YACL,EAAE,EAAE,KAAK;YACT,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,IAAI,aAAa,CAAC;SACzD,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,EAAE,KAAK,KAAK;QACtB,CAAC,CAAC,EAAE,GAAG,IAAI,EAAE,KAAK,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE;QACtD,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAqB,EAAE,QAAgB;IAClE,OAAO,OAAO,KAAK,IAAI,QAAQ,EAAE,CAAC;AACpC,CAAC;AAED,MAAM,UAAU,iBAAiB,CAC/B,EAAU;IAEV,MAAM,CAAC,GAAG,uBAAuB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC3C,IAAI,CAAC,CAAC;QAAE,OAAO,IAAI,CAAC;IACpB,OAAO,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC,CAAmB,EAAE,QAAQ,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAC3D,CAAC","sourcesContent":["/**\n * React-query hooks for remote MCP servers surfaced inside the Workspace\n * tab as a virtual `mcp-servers/` folder.\n *\n * MCP servers live in the settings store (user- and org-scope), not the\n * resources table. These hooks wrap the existing `/_agent-native/mcp/servers`\n * endpoints so the Workspace UI can list, create, and delete them with the\n * same keys/invalidations the old Settings panel used.\n */\n\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\n\nimport { agentNativePath } from \"../api-path.js\";\n\nexport type McpServerScope = \"user\" | \"org\";\n\nexport interface McpServer {\n id: string;\n scope: McpServerScope;\n name: string;\n url: string;\n headers?: Record<string, { set: true }>;\n authMode: \"none\" | \"headers\" | \"oauth\";\n description?: string;\n firstParty?: boolean;\n createdAt: number;\n mergedId: string;\n status:\n | { state: \"connected\"; toolCount: number }\n | { state: \"error\"; error: string }\n | { state: \"unknown\" };\n}\n\nexport interface McpServersList {\n user: McpServer[];\n org: McpServer[];\n orgId: string | null;\n role: string | null;\n}\n\nconst ENDPOINT = agentNativePath(\"/_agent-native/mcp/servers\");\nconst LIST_KEY = [\"mcp-servers\"] as const;\n\nexport function useMcpServers() {\n return useQuery<McpServersList>({\n queryKey: LIST_KEY,\n queryFn: async () => {\n const res = await fetch(ENDPOINT, { credentials: \"include\" });\n if (!res.ok) throw new Error(`Failed to load (${res.status})`);\n return (await res.json()) as McpServersList;\n },\n staleTime: 10_000,\n });\n}\n\nexport interface CreateMcpServerArgs {\n scope: McpServerScope;\n name: string;\n url: string;\n headers?: Record<string, string>;\n description?: string;\n}\n\nexport function useCreateMcpServer() {\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (args: CreateMcpServerArgs) => {\n const res = await fetch(ENDPOINT, {\n method: \"POST\",\n credentials: \"include\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify(args),\n });\n const body = (await res.json().catch(() => ({}))) as {\n ok?: boolean;\n error?: string;\n server?: McpServer;\n };\n if (!res.ok || !body.ok) {\n throw new Error(body.error || `Create failed (${res.status})`);\n }\n return body.server!;\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: LIST_KEY }),\n });\n}\n\nexport function useDeleteMcpServer() {\n const qc = useQueryClient();\n return useMutation({\n mutationFn: async (args: { id: string; scope: McpServerScope }) => {\n const res = await fetch(\n `${ENDPOINT}/${encodeURIComponent(args.id)}?scope=${args.scope}`,\n {\n method: \"DELETE\",\n credentials: \"include\",\n headers: { \"Content-Type\": \"application/json\" },\n },\n );\n const body = (await res.json().catch(() => ({}))) as {\n ok?: boolean;\n error?: string;\n };\n if (!res.ok || !body.ok) {\n throw new Error(body.error || `Delete failed (${res.status})`);\n }\n },\n onSuccess: () => qc.invalidateQueries({ queryKey: LIST_KEY }),\n });\n}\n\nexport interface TestMcpUrlResult {\n ok: boolean;\n error?: string;\n toolCount?: number;\n tools?: string[];\n}\n\nexport function getMcpUrlValidationError(rawUrl: string): string | null {\n const trimmed = rawUrl.trim();\n if (!trimmed) return \"Enter the Streamable HTTP MCP server URL.\";\n let url: URL;\n try {\n url = new URL(trimmed);\n } catch {\n return \"Enter a full URL, including https://.\";\n }\n if (url.protocol !== \"https:\" && url.protocol !== \"http:\") {\n return \"MCP server URLs must start with https://.\";\n }\n if (\n url.protocol === \"http:\" &&\n ![\"localhost\", \"127.0.0.1\"].includes(url.hostname)\n ) {\n return \"Use https:// for remote MCP servers. Plain http:// is only allowed for localhost.\";\n }\n return null;\n}\n\nexport function formatMcpServerError(error: unknown): string {\n const raw =\n typeof error === \"string\"\n ? error\n : error instanceof Error\n ? error.message\n : String(error ?? \"\");\n const text = raw.trim();\n if (!text) return \"Could not connect to that MCP server.\";\n if (\n /<!doctype|<html[\\s>]|<\\/html>|unexpected token '<'|is not valid json/i.test(\n text,\n )\n ) {\n return \"That URL returned a web page instead of an MCP response. Check that you pasted the Streamable HTTP endpoint, often ending in /mcp.\";\n }\n if (\n /streamable http/i.test(text) &&\n /error|failed|non-200|status/i.test(text)\n ) {\n return \"The server did not complete the Streamable HTTP MCP handshake. Check the URL and any required authorization headers.\";\n }\n if (\n /failed to fetch|fetch failed|networkerror|econnrefused|enotfound|timed out/i.test(\n text,\n )\n ) {\n return \"Could not reach that MCP server. Check the URL and make sure it is publicly reachable from this app.\";\n }\n if (/401|403|unauthorized|forbidden/i.test(text)) {\n return \"The MCP server rejected the request. Add or update the required Authorization header.\";\n }\n if (/404|not found|405|method not allowed/i.test(text)) {\n return \"That URL is reachable, but it does not look like the MCP endpoint. Check the server's Streamable HTTP path.\";\n }\n return text.length > 240 ? `${text.slice(0, 237).trimEnd()}...` : text;\n}\n\nexport async function testMcpServerUrl(\n url: string,\n headers?: Record<string, string>,\n): Promise<TestMcpUrlResult> {\n const validationError = getMcpUrlValidationError(url);\n if (validationError) return { ok: false, error: validationError };\n const res = await fetch(`${ENDPOINT}/test`, {\n method: \"POST\",\n credentials: \"include\",\n headers: { \"Content-Type\": \"application/json\" },\n body: JSON.stringify({ url, headers }),\n });\n const body = (await res.json().catch(() => ({}))) as TestMcpUrlResult;\n if (!res.ok) {\n return {\n ok: false,\n error: formatMcpServerError(body.error || \"Test failed\"),\n };\n }\n return body.ok === false\n ? { ...body, error: formatMcpServerError(body.error) }\n : body;\n}\n\n/**\n * Virtual tree-node id used when a server is surfaced in the Workspace tree.\n * Shape: `mcp:<scope>:<serverId>`. Not a real resource row; purely a handle\n * the panel uses to route clicks/delete back to the MCP endpoints.\n */\nexport function mcpVirtualId(scope: McpServerScope, serverId: string): string {\n return `mcp:${scope}:${serverId}`;\n}\n\nexport function parseMcpVirtualId(\n id: string,\n): { scope: McpServerScope; serverId: string } | null {\n const m = /^mcp:(user|org):(.+)$/.exec(id);\n if (!m) return null;\n return { scope: m[1] as McpServerScope, serverId: m[2] };\n}\n"]}
|
|
@@ -7,6 +7,7 @@ export interface UseChatModelsResult {
|
|
|
7
7
|
selectedModel: string;
|
|
8
8
|
selectedEngine: string;
|
|
9
9
|
selectedEffort: ReasoningEffort;
|
|
10
|
+
isLoading: boolean;
|
|
10
11
|
onModelChange: (model: string, engine: string) => void;
|
|
11
12
|
onEffortChange: (effort: ReasoningEffort) => void;
|
|
12
13
|
refreshEngines: () => void;
|