@noob9527/dsh-mcp-oauth 0.1.0 → 0.2.0-rc.2

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.
@@ -0,0 +1,73 @@
1
+ # Remote personal instances
2
+
3
+ [中文](remote-personal-instances.zh.md)
4
+
5
+ Remote callbacks require the unreleased 0.2.0-rc.1 build or later; npm 0.1.0 supports local callbacks only. Install a reviewed tarball until a remote-capable release is published. This mode does not modify official DSH.
6
+
7
+ If no callback proxy can be configured, use [manual authorization response](manual-authorization.md). The proxy requirements below apply only to remote automatic callbacks.
8
+
9
+ ## Deployment requirements
10
+
11
+ Each person must have a dedicated DSH Host process, profile directory and credential store. The authenticated DSH Web connection must represent that instance's owner. A URL prefix alone does not establish isolation. Shared multi-user Hosts, multiple replicas of one instance and shared credential files are unsupported. Do not broaden the plugin's owner-only Remote API policy to work around access failures.
12
+
13
+ Use a fixed HTTPS callback such as `https://dsh.example.com/u/alice/oauth/mcp/callback`. An administrator routes exactly this path to the plugin's HTTP receiver on `127.0.0.1:6274`. The proxy must run on the same machine/network namespace as the DSH process. In Kubernetes, use a proxy sidecar in the same pod; a separate pod cannot reach this loopback listener. The plugin never listens on all interfaces. Other services in the same network namespace must be trusted.
14
+
15
+ The callback listener exists only during sign-in. A 502 before sign-in or after completion is expected. One login at a time can use a given port. Separate processes on the same host network need different ports; separate pod network namespaces can reuse the same port. Occupied ports produce an error rather than choosing a different callback silently.
16
+
17
+ ## Proxy routing
18
+
19
+ This Nginx fragment belongs in an existing HTTPS virtual host with a valid certificate. It preserves the complete path and supplies the configured external Host explicitly; it does not expose DSH's application routes anonymously.
20
+
21
+ ```nginx
22
+ location = /u/alice/oauth/mcp/callback {
23
+ proxy_pass http://127.0.0.1:6274;
24
+ proxy_set_header Host dsh.example.com;
25
+ proxy_set_header X-Forwarded-Host "";
26
+ proxy_set_header X-Forwarded-Proto "";
27
+ proxy_cache off;
28
+ access_log off;
29
+ }
30
+ ```
31
+
32
+ The plugin validates Host and path against the configured HTTPS callback URL and ignores forwarded headers. Preserve query parameters for the OAuth response. If the public URL has a non-default port, include that port in the forwarded Host. Do not rewrite the user-specific path into a shared callback path or derive upstream selection from query parameters. A shared outer ingress must route each user's callback to the correct personal instance.
33
+
34
+ The browser must be able to reach the HTTPS callback, including any required VPN. The authorization server fetches the CIMD document; it does not make the browser callback request. A callback can be reachable without the DSH Web session cookie: its one-time state and PKCE bind the response to a pending owner-initiated login. If the gateway authenticates callback requests, ensure it preserves the response query through login. Any anonymous exception must cover only the exact callback location, never the whole DSH instance.
35
+
36
+ Exclude OAuth callback queries, authorization codes and state from access/error logs, tracing and analytics at every proxy layer. The example disables access logging only for this location; configure other diagnostics to omit raw requests. Callback responses use `no-store`, `no-referrer` and a restrictive content security policy, with no third-party resources or echoed response parameters.
37
+
38
+ ## CIMD document and plugin settings
39
+
40
+ Host an HTTPS metadata document reachable by the authorization server. A separate document per instance makes its callback list explicit. A shared document is also possible if every exact callback is maintained in its list; do not use wildcard redirect URLs.
41
+
42
+ ```json
43
+ {
44
+ "client_id": "https://metadata.example.com/oauth/dsh/alice.json",
45
+ "client_name": "DSH MCP OAuth",
46
+ "redirect_uris": ["https://dsh.example.com/u/alice/oauth/mcp/callback"],
47
+ "grant_types": ["authorization_code", "refresh_token"],
48
+ "response_types": ["code"],
49
+ "token_endpoint_auth_method": "none"
50
+ }
51
+ ```
52
+
53
+ In Plugins → Built-in plugin settings → OAuth MCP → Add service:
54
+
55
+ - Select **Remote personal instance** under Callback mode.
56
+ - Set **OAuth callback URL** to the exact public HTTPS URL in the document.
57
+ - Set **Internal loopback listener port** to the proxy upstream port, for example `6274`.
58
+ - Select CIMD and enter the metadata document URL; leave the pre-registered client ID and secret empty.
59
+ - Configure the MCP endpoint and any required scopes, save, then select Sign in and open the authorization page in your own browser.
60
+
61
+ The browser returns to the remote callback. The instance validates the pending response, exchanges the authorization code using its in-memory PKCE verifier, stores the grant in its credential store, then connects to MCP. The callback page acknowledges receipt only; confirm Authorized and Connected in DSH before using tools. Tokens and PKCE verifiers do not pass through the settings UI.
62
+
63
+ ## Recovery and compatibility
64
+
65
+ Invalid state, duplicate parameters, incorrect Host/path and repeated responses are rejected. Rejection does not authorize a different instance. Cancel, timeout, disable, grant clearing and plugin shutdown release the listener. Process restarts discard pending state and verifiers; start a new login. Persisted grants remain usable after restart when their existing identity binding matches. Changing the external callback URL requires reauthorization; changing only the internal port does not change the OAuth identity.
66
+
67
+ Old service configurations default to local mode. Local callbacks continue to use the port in their HTTP redirect URL. Remote mode uses the separate internal port and requires a dedicated HTTPS path. Save a backup of profile configuration outside the repository before upgrading: an older plugin's strict parser cannot read the new callback fields after they are saved. Do not downgrade without restoring compatible configuration.
68
+
69
+ ## Validation
70
+
71
+ The automated HTTPS ingress fixture uses a per-run certificate and explicit client CA trust without disabling TLS verification. It covers CIMD document fetch, PKCE exchange, callback rejection, cancellation/timeouts, refresh and restarted grant reuse followed by an MCP search. Local fixture success does not certify an organization's ingress, owner-session mapping or real authorization server. Before deployment, verify these through the real DSH UI and check that a callback for one instance cannot complete another instance's login.
72
+
73
+ Deployment URLs, ingress manifests with private hostnames, credentials and live test evidence belong outside this public repository. Examples here use reserved domains only.
@@ -0,0 +1,73 @@
1
+ # 远程个人实例
2
+
3
+ [English](remote-personal-instances.md)
4
+
5
+ 远程回调需要尚未发布的 0.2.0-rc.1 或后续支持该功能的版本;npm 0.1.0 仅支持本机回调。在支持远程模式的版本发布前,请安装经过检查的 tarball 安装包。此模式无需修改官方 DSH。
6
+
7
+ 如果无法配置回调代理,可使用[手动粘贴授权响应](manual-authorization.zh.md)。下述代理要求仅适用于远程自动回调。
8
+
9
+ ## 部署要求
10
+
11
+ 每位用户必须拥有独立的 DSH Host 进程、profile 目录和凭据存储。经过认证的 DSH Web 连接必须代表该实例的所有者。仅有不同的 URL 前缀不能证明实例已隔离。不支持多人共享 Host、单个实例运行多个副本或共享凭据文件。不要为了绕过访问失败而放宽插件仅允许所有者访问的 Remote API 策略。
12
+
13
+ 使用固定的 HTTPS 回调地址,例如 `https://dsh.example.com/u/alice/oauth/mcp/callback`。管理员将这个精确路径转发到插件位于 `127.0.0.1:6274` 的 HTTP 回调接收器。代理必须与 DSH 进程运行在同一主机和网络命名空间中。在 Kubernetes 中,可以使用同一个 Pod 内的代理 sidecar;其他 Pod 无法访问此回环监听地址。插件不会监听所有网络接口。同一网络命名空间内的其他服务必须可信。
14
+
15
+ 回调监听器仅在登录过程中运行。登录前或完成后访问回调地址返回 502 属于预期情况。同一个端口一次只能用于一项登录。同一主机网络中的独立进程需要使用不同端口;处于不同 Pod 网络命名空间中的实例可以复用相同端口。端口被占用时会报错,不会静默切换回调地址。
16
+
17
+ ## 代理路由
18
+
19
+ 以下 Nginx 配置片段应放入已有的 HTTPS 虚拟主机中,该虚拟主机须使用有效证书。配置保留完整路径,并显式传递配置中的外部 Host;它不会把 DSH 的应用路由开放为匿名访问。
20
+
21
+ ```nginx
22
+ location = /u/alice/oauth/mcp/callback {
23
+ proxy_pass http://127.0.0.1:6274;
24
+ proxy_set_header Host dsh.example.com;
25
+ proxy_set_header X-Forwarded-Host "";
26
+ proxy_set_header X-Forwarded-Proto "";
27
+ proxy_cache off;
28
+ access_log off;
29
+ }
30
+ ```
31
+
32
+ 插件根据配置中的 HTTPS 回调 URL 校验 Host 和路径,不使用转发头推断外部地址。代理必须保留 OAuth 响应的查询参数。如果公网 URL 使用非默认端口,转发的 Host 也必须包含该端口。不要将用户专属路径改写成共享回调路径,也不要根据查询参数选择上游实例。共用的外层 Ingress 必须将每位用户的回调路由到正确的个人实例。
33
+
34
+ 用户浏览器必须能够访问 HTTPS 回调地址,必要时需要连接 VPN。授权服务器负责获取 CIMD 文档,并不代替浏览器发起回调请求。回调接口可以不依赖 DSH Web 会话 Cookie:一次性 state 和 PKCE 将响应绑定到所有者发起的待完成登录。如果网关对回调请求执行登录认证,必须确保认证跳转前后保留 OAuth 响应查询参数。任何匿名访问例外都只能覆盖精确的回调路径,不能覆盖整个 DSH 实例。
35
+
36
+ 每一层代理的访问日志、错误日志、链路追踪和分析记录都应排除 OAuth 回调查询参数、授权码和 state。示例仅关闭此回调路径的访问日志;其他诊断功能也需要配置为不记录原始请求。回调响应使用 `no-store`、`no-referrer` 和严格的内容安全策略,不加载第三方资源,也不回显响应参数。
37
+
38
+ ## CIMD 文档与插件设置
39
+
40
+ 托管一份授权服务器能够通过 HTTPS 获取的客户端元数据文档。每个实例使用独立文档,可以明确限定各自的回调列表。也可以共用文档,但必须在列表中维护每个精确的回调地址,不能使用通配符重定向 URL。
41
+
42
+ ```json
43
+ {
44
+ "client_id": "https://metadata.example.com/oauth/dsh/alice.json",
45
+ "client_name": "DSH MCP OAuth",
46
+ "redirect_uris": ["https://dsh.example.com/u/alice/oauth/mcp/callback"],
47
+ "grant_types": ["authorization_code", "refresh_token"],
48
+ "response_types": ["code"],
49
+ "token_endpoint_auth_method": "none"
50
+ }
51
+ ```
52
+
53
+ 进入 Plugins → Built-in plugin settings → OAuth MCP → 添加服务:
54
+
55
+ - 在“回调方式”中选择“远程个人实例”。
56
+ - 将“OAuth 回调 URL”设置为文档中完整、精确的公网 HTTPS 地址。
57
+ - 将“内部 loopback 监听端口”设置为代理上游使用的端口,例如 `6274`。
58
+ - 注册方式选择 CIMD,填写客户端元数据文档 URL;预注册客户端 ID 和密钥留空。
59
+ - 配置 MCP 服务地址和所需权限范围,保存后点击“登录”,在自己的浏览器中打开授权页面。
60
+
61
+ 浏览器完成授权后跳转到远程回调地址。实例校验待处理的授权响应,使用内存中的 PKCE verifier 换取 token,将授权信息保存到凭据存储,再连接 MCP。回调页面只确认收到响应;使用工具前,需要在 DSH 中确认状态为“已授权”和“已连接”。Token 和 PKCE verifier 不会通过设置界面传递。
62
+
63
+ ## 恢复与兼容性
64
+
65
+ 错误的 state、重复参数、错误的 Host 或路径,以及重复提交的响应都会被拒绝。拒绝的回调不会为其他实例完成授权。取消、超时、停用、清除授权和插件关闭都会释放监听器。进程重启会丢弃待完成登录的 state 和 verifier,此时需要重新发起登录。已持久化的授权在身份绑定仍匹配时可以于重启后复用。修改外部回调 URL 需要重新授权;仅修改内部端口不会改变 OAuth 客户端身份。
66
+
67
+ 旧服务配置默认使用本机模式。本机回调继续使用其 HTTP 回调 URL 中的端口;远程模式使用单独配置的内部端口,并要求专用的 HTTPS 路径。升级前请在仓库外备份 profile 配置:新回调字段保存后,旧插件的严格解析器无法读取这些字段。降级前必须恢复兼容的配置。
68
+
69
+ ## 验证
70
+
71
+ 自动化 HTTPS Ingress fixture 为每次运行生成证书,并由测试客户端显式信任对应 CA,不关闭 TLS 校验。测试覆盖 CIMD 文档获取、PKCE 换票、回调拒绝、取消与超时、刷新,以及重启后复用授权并执行 MCP 搜索。本地 fixture 通过不代表公司的 Ingress、所有者会话映射或真实授权服务器已经验收。部署前应通过真实 DSH 界面验证这些环节,并确认一个实例的回调无法完成另一个实例的登录。
72
+
73
+ 实际部署 URL、包含内部主机名的 Ingress 配置、凭据和真实联调证据应保存在此公开仓库之外。本文示例仅使用保留域名。
package/lib/client.js CHANGED
@@ -19745,7 +19745,7 @@ function date4(params) {
19745
19745
  return _coercedDate(ZodDate, params);
19746
19746
  }
19747
19747
 
19748
- // node_modules/.pnpm/@deepseek-ai+dsh-typert-protocol@0.2.2-rc.2_@deepseek-ai+cordis@4.1.0/node_modules/@deepseek-ai/dsh-typert-protocol/lib/index.js
19748
+ // node_modules/.pnpm/@deepseek-ai+dsh-typert-protocol@0.2.1-alpha.3_@deepseek-ai+cordis@4.0.5-alpha.2/node_modules/@deepseek-ai/dsh-typert-protocol/lib/index.js
19749
19749
  var TYPERT_OWNED_VALUE = Symbol.for("dsh.typert.owned-value");
19750
19750
  function createTypertRemoteInfo(spec, zod) {
19751
19751
  return new RemoteInfo(spec, zod);
@@ -19895,6 +19895,7 @@ var ResultValue = class {
19895
19895
 
19896
19896
  // src/config.ts
19897
19897
  var endpoint = external_exports.string().url().refine((value) => {
19898
+ if (!URL.canParse(value)) return false;
19898
19899
  const url2 = new URL(value);
19899
19900
  return !url2.username && !url2.password && !url2.hash && (url2.protocol === "https:" || url2.protocol === "http:" && ["127.0.0.1", "[::1]", "localhost"].includes(url2.hostname));
19900
19901
  }, "Use HTTPS, or HTTP on loopback, without user information or fragments.");
@@ -19907,13 +19908,13 @@ var serverSchema = external_exports.object({
19907
19908
  mode: external_exports.enum(["auto", "cimd", "preregistered", "dcr"]).default("auto"),
19908
19909
  clientId: external_exports.string().max(2048).default(""),
19909
19910
  metadataUrl: external_exports.union([external_exports.literal(""), external_exports.string().url().refine((value) => {
19911
+ if (!URL.canParse(value)) return false;
19910
19912
  const url2 = new URL(value);
19911
19913
  return url2.protocol === "https:" && url2.pathname !== "/" && !url2.username && !url2.password && !url2.hash;
19912
19914
  })]).default(""),
19913
- redirectUrl: external_exports.string().url().default("http://127.0.0.1:6274/oauth/callback").refine((value) => {
19914
- const url2 = new URL(value);
19915
- return url2.protocol === "http:" && url2.hostname === "127.0.0.1" && !!url2.port && Number(url2.port) > 0 && url2.pathname !== "/" && !url2.search && !url2.hash && !url2.username && !url2.password;
19916
- }, "Use an explicit loopback port and callback path."),
19915
+ callbackMode: external_exports.enum(["local", "remote", "manual"]).default("local"),
19916
+ callbackPort: external_exports.number().int().min(1).max(65535).default(6274),
19917
+ redirectUrl: external_exports.string().url().default("http://127.0.0.1/oauth/callback"),
19917
19918
  scope: external_exports.string().max(2048).default(""),
19918
19919
  connectTimeoutMs: duration3.default(3e4),
19919
19920
  authTimeoutMs: duration3.default(3e5),
@@ -19922,6 +19923,18 @@ var serverSchema = external_exports.object({
19922
19923
  reconnectAttempts: external_exports.number().int().min(0).max(20).default(5),
19923
19924
  reconnectMaxDelayMs: duration3.default(3e4)
19924
19925
  }).strict().superRefine((value, ctx) => {
19926
+ let redirect;
19927
+ try {
19928
+ redirect = new URL(value.redirectUrl);
19929
+ } catch {
19930
+ return;
19931
+ }
19932
+ const clean = redirect.pathname !== "/" && !redirect.search && !redirect.hash && !redirect.username && !redirect.password;
19933
+ const https = redirect.protocol === "https:" && !["localhost", "127.0.0.1", "[::1]"].includes(redirect.hostname);
19934
+ const loopback = redirect.protocol === "http:" && ["127.0.0.1", "localhost"].includes(redirect.hostname);
19935
+ const manualLoopback = loopback && !!redirect.port && Number(redirect.port) > 0;
19936
+ const valid = value.callbackMode === "remote" ? https : value.callbackMode === "manual" ? https || manualLoopback : loopback;
19937
+ if (!clean || !valid) ctx.addIssue({ code: "custom", path: ["redirectUrl"], message: "Use HTTPS for remote callbacks; local callbacks require a loopback HTTP URL with a path; omit the port for automatic allocation. Manual mode requires HTTPS or an explicit loopback port." });
19925
19938
  if (value.mode === "cimd" && !value.metadataUrl) ctx.addIssue({ code: "custom", path: ["metadataUrl"], message: "CIMD requires a metadata document URL." });
19926
19939
  if (value.mode === "preregistered" && !value.clientId) ctx.addIssue({ code: "custom", path: ["clientId"], message: "Pre-registration requires a client ID." });
19927
19940
  });
@@ -19945,13 +19958,64 @@ function method(parameters, result) {
19945
19958
  var remoteInfo = createTypertRemoteInfo({ package: "@noob9527/dsh-mcp-oauth", methods: {
19946
19959
  "mcpOAuth/list": method([], external_exports.array(statusSchema)),
19947
19960
  "mcpOAuth/save": method([["config", serverSchema], ["secret", external_exports.string().max(8192).optional()]], external_exports.null()),
19961
+ "mcpOAuth/submitResponse": method([["id", external_exports.string().max(32)], ["response", external_exports.string().min(1).max(16384)]], external_exports.null()),
19948
19962
  "mcpOAuth/act": method([["id", external_exports.string()], ["action", actionSchema]], external_exports.null())
19949
19963
  } }, external_exports);
19950
19964
 
19965
+ // src/client/form.ts
19966
+ function parseServiceForm(config2) {
19967
+ return serverSchema.safeParse({
19968
+ ...config2,
19969
+ metadataUrl: config2.mode === "dcr" || config2.mode === "preregistered" ? "" : config2.metadataUrl
19970
+ });
19971
+ }
19972
+ var defaultMetadataUrl = "https://noob9527.github.io/dsh-mcp-oauth/oauth/client-metadata.json";
19973
+ function usesDefaultMetadata(config2) {
19974
+ return config2.metadataUrl === defaultMetadataUrl && (config2.mode === "cimd" || config2.mode === "auto" && !config2.clientId);
19975
+ }
19976
+ function showsCallbackUrl(config2) {
19977
+ return config2.callbackMode !== "local" && !usesDefaultMetadata(config2);
19978
+ }
19979
+ function changeCallbackMode(config2, callbackMode) {
19980
+ const redirect = URL.canParse(config2.redirectUrl) ? new URL(config2.redirectUrl) : void 0;
19981
+ const local = redirect?.protocol === "http:" && ["127.0.0.1", "localhost"].includes(redirect.hostname);
19982
+ return { ...config2, callbackMode, redirectUrl: callbackMode === "local" && !local ? "http://127.0.0.1/oauth/callback" : config2.redirectUrl };
19983
+ }
19984
+
19985
+ // src/client/service-id.ts
19986
+ function serviceIdFromLabel(label) {
19987
+ const slug = label.normalize("NFKD").toLowerCase().replace(/\p{M}/gu, "").replace(/[^a-z0-9\s-]/gu, (char) => /\p{L}|\p{N}/u.test(char) ? `-u${char.codePointAt(0).toString(16)}-` : "-").replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "");
19988
+ return (slug ? /^[a-z]/.test(slug) ? slug : `service-${slug}` : "service").slice(0, 32).replace(/-+$/g, "");
19989
+ }
19990
+
19951
19991
  // src/client/locales.ts
19952
19992
  var en = {
19993
+ fieldHelp: "Help",
19994
+ defaultCallbackHelp: "The default CIMD document is for local callbacks. Select Local, or configure a custom document matching your remote or manual callback.",
19995
+ clientIdAutoPlaceholder: "Optional; leave blank to try CIMD or dynamic registration",
19996
+ clientIdRequiredPlaceholder: "Required; enter the pre-registered client ID",
19997
+ secretPlaceholder: "Optional; only for pre-registered confidential clients",
19998
+ secretEditPlaceholder: "Leave blank to keep any saved secret",
19999
+ labelTooltip: "Name shown in the service list. Renaming a saved service does not change its Service ID.",
20000
+ urlTooltip: "Streamable HTTP endpoint of the MCP server. Use the MCP endpoint, not the authorization or metadata URL.",
20001
+ idTooltip: "Unique identifier for tool names and stored authorization. Leave blank to use the identifier generated from the display name, shown as placeholder text. Read-only after saving. Duplicate IDs must be changed manually.",
20002
+ modeTooltip: "Automatic uses configured pre-registration first, then supported CIMD, then DCR. An explicit mode does not fall back to a different registration method.",
20003
+ clientIdTooltip: "Client identifier issued by the authorization server for pre-registration. In automatic mode, a supplied ID takes priority; leave blank to try CIMD or dynamic registration. CIMD uses the metadata document URL as the client ID. Required in pre-registered mode.",
20004
+ secretTooltip: "Secret for a pre-registered confidential client, stored separately from service configuration. Leave blank for public clients; when editing, blank preserves an existing secret.",
20005
+ metadataUrlTooltip: "Public HTTPS CIMD JSON document describing this client and its permitted callbacks. New services use the plugin\u2019s hosted document; custom callbacks need a matching document.",
20006
+ callbackModeTooltip: "Local receives the browser callback on this computer. Remote personal instance uses an administrator-configured HTTPS proxy. Manual response paste accepts the full callback URL without starting a listener.",
20007
+ redirectUrlTooltip: "OAuth return address. Local mode supports 127.0.0.1 or localhost and chooses a free port when omitted; explicit ports stay fixed. Remote mode requires HTTPS. Manual mode requires HTTPS or an explicit local port. Must be allowed by the client metadata.",
20008
+ callbackPortTooltip: "Internal port bound to 127.0.0.1 in remote mode. The HTTPS reverse proxy must forward to this port while preserving the external Host and path.",
20009
+ scopeTooltip: "Permissions requested during OAuth login. Leave blank for automatic discovery; separate multiple scopes with spaces. The authorization server decides which permissions are granted.",
20010
+ connectTimeoutMsTooltip: "Timeout in milliseconds for connection setup, tool discovery and individual OAuth network requests. Default: 30000 ms.",
20011
+ authTimeoutMsTooltip: "Total time allowed to complete one login, including browser consent. Expiry cancels the pending login. Default: 300000 ms.",
20012
+ toolTimeoutMsTooltip: "Total deadline for a tool call. A timeout can leave its result unknown; the plugin does not automatically replay it. Default: 600000 ms.",
20013
+ refreshSkewMsTooltip: "Refresh an expiring token this many milliseconds early before a request, when a refresh token is available. Does not interrupt an accepted tool call. Default: 60000 ms.",
20014
+ reconnectAttemptsTooltip: "Maximum automatic connection recovery attempts. Set 0 to disable automatic recovery. Reconnection does not replay tool calls. Default: 5.",
20015
+ reconnectMaxDelayMsTooltip: "Upper limit in milliseconds on the increasing delay between automatic reconnection attempts. Default: 30000 ms.",
20016
+ manualResponseTooltip: "Paste the complete callback URL from the login you just approved. It contains a sensitive one-use authorization response; do not send it in chat or paste an access token here.",
19953
20017
  title: "OAuth MCP",
19954
- description: "Connect local DSH to OAuth-protected MCP tools.",
20018
+ description: "Connect personal DSH instances to OAuth-protected MCP tools.",
19955
20019
  add: "Add service",
19956
20020
  edit: "Edit",
19957
20021
  save: "Save",
@@ -19973,9 +20037,10 @@ var en = {
19973
20037
  mode: "Registration mode",
19974
20038
  clientId: "Client ID",
19975
20039
  metadataUrl: "Client metadata document URL",
19976
- redirectUrl: "Loopback callback URL",
20040
+ redirectUrl: "OAuth callback URL",
19977
20041
  scope: "Scopes",
19978
- secret: "Client secret (blank keeps existing value)",
20042
+ scopePlaceholder: "Auto-discover (optional)",
20043
+ secret: "Client secret",
19979
20044
  advanced: "Advanced",
19980
20045
  connectTimeoutMs: "Connection timeout (ms)",
19981
20046
  authTimeoutMs: "Sign-in timeout (ms)",
@@ -19995,15 +20060,53 @@ var en = {
19995
20060
  connecting: "Connecting",
19996
20061
  connected: "Connected",
19997
20062
  connectionFailed: "Connection failed",
20063
+ duplicateId: "Invalid configuration: Service ID already exists. Change Service ID in Advanced.",
19998
20064
  tools: "Tools",
19999
- invalid: "Check the highlighted configuration values. HTTPS is required except on loopback.",
20000
- local: "Local use only: open the authorization link on the computer running DSH.",
20065
+ invalid: "Check the following fields:",
20066
+ deploymentHelp: "Supports local and remote personal instances. Shared multi-user hosts are not supported.",
20067
+ callbackMode: "Callback mode",
20068
+ localMode: "Local",
20069
+ remoteMode: "Remote personal instance",
20070
+ manualMode: "Manual response paste",
20071
+ manualResponse: "Full authorization callback URL",
20072
+ manualSubmit: "Submit authorization response",
20073
+ manualHelp: "No listener or callback proxy is started. Register an HTTPS display page or a loopback URL, then paste the complete callback URL here after approving your own login.",
20074
+ manualInstructions: "Paste only the complete callback URL from the login you just started. A loopback page may fail to load; copy its address bar. Never paste tokens or send the response in chat.",
20075
+ manualInvalid: "Response rejected or login expired. Check the full callback URL for this attempt, or cancel and sign in again.",
20076
+ manualReceived: "Response received. Wait for authorization and connection results above.",
20077
+ callbackPort: "Internal loopback listener port",
20078
+ remoteHelp: "An administrator must proxy your HTTPS callback to 127.0.0.1 on this instance, preserving Host and path. The proxy must share its network namespace. Use a dedicated instance and credential store.",
20079
+ local: "Open the authorization link on the computer running DSH. Omit the callback port to choose a free port automatically.",
20001
20080
  deleteConfirm: "Delete this service and its local authorization?",
20002
20081
  clearConfirm: "Clear the local authorization and disconnect this service?"
20003
20082
  };
20004
20083
  var zh = {
20084
+ fieldHelp: "\u8BF4\u660E",
20085
+ defaultCallbackHelp: "\u9ED8\u8BA4 CIMD \u6587\u6863\u7528\u4E8E\u672C\u673A\u56DE\u8C03\u3002\u8BF7\u9009\u62E9\u672C\u673A\u6A21\u5F0F\uFF0C\u6216\u914D\u7F6E\u4E0E\u8FDC\u7A0B\u3001\u624B\u52A8\u56DE\u8C03\u5339\u914D\u7684\u81EA\u5B9A\u4E49\u6587\u6863\u3002",
20086
+ clientIdAutoPlaceholder: "\u53EF\u9009\uFF1B\u7559\u7A7A\u65F6\u5C1D\u8BD5 CIMD \u6216\u52A8\u6001\u6CE8\u518C",
20087
+ clientIdRequiredPlaceholder: "\u5FC5\u586B\uFF1B\u8BF7\u8F93\u5165\u9884\u6CE8\u518C\u7684\u5BA2\u6237\u7AEF ID",
20088
+ secretPlaceholder: "\u53EF\u9009\uFF1B\u4EC5\u9884\u6CE8\u518C\u673A\u5BC6\u5BA2\u6237\u7AEF\u9700\u8981",
20089
+ secretEditPlaceholder: "\u7559\u7A7A\u4FDD\u7559\u5DF2\u6709\u5BC6\u94A5",
20090
+ labelTooltip: "\u670D\u52A1\u5217\u8868\u4E2D\u663E\u793A\u7684\u540D\u79F0\u3002\u4FEE\u6539\u5DF2\u4FDD\u5B58\u670D\u52A1\u7684\u540D\u79F0\u4E0D\u4F1A\u6539\u53D8\u670D\u52A1\u6807\u8BC6\u3002",
20091
+ urlTooltip: "MCP \u670D\u52A1\u7684 Streamable HTTP \u63A5\u53E3\u5730\u5740\uFF0C\u5E94\u586B\u5199 MCP \u7AEF\u70B9\uFF0C\u800C\u975E\u6388\u6743\u9875\u6216\u5143\u6570\u636E\u6587\u6863\u5730\u5740\u3002",
20092
+ idTooltip: "\u7528\u4E8E\u5DE5\u5177\u547D\u540D\u548C\u6388\u6743\u5B58\u50A8\u7684\u552F\u4E00\u6807\u8BC6\u3002\u7559\u7A7A\u65F6\u4F7F\u7528\u5360\u4F4D\u6587\u5B57\u4E2D\u6839\u636E\u663E\u793A\u540D\u79F0\u751F\u6210\u7684\u6807\u8BC6\uFF0C\u4FDD\u5B58\u540E\u53EA\u8BFB\uFF1B\u91CD\u590D\u65F6\u9700\u8981\u624B\u52A8\u4FEE\u6539\u3002",
20093
+ modeTooltip: "\u81EA\u52A8\u6A21\u5F0F\u4F18\u5148\u4F7F\u7528\u5DF2\u914D\u7F6E\u7684\u9884\u6CE8\u518C\u8EAB\u4EFD\uFF0C\u5176\u6B21\u4F7F\u7528\u53D7\u652F\u6301\u7684 CIMD\uFF0C\u6700\u540E\u5C1D\u8BD5 DCR\u3002\u660E\u786E\u9009\u62E9\u4E00\u79CD\u65B9\u5F0F\u540E\uFF0C\u4E0D\u4F1A\u81EA\u52A8\u5207\u6362\u5176\u4ED6\u6CE8\u518C\u65B9\u5F0F\u3002",
20094
+ clientIdTooltip: "\u6388\u6743\u670D\u52A1\u5668\u4E3A\u9884\u6CE8\u518C\u5BA2\u6237\u7AEF\u63D0\u4F9B\u7684\u6807\u8BC6\u3002\u81EA\u52A8\u6A21\u5F0F\u4E0B\u586B\u5199\u540E\u4F18\u5148\u4F7F\u7528\u9884\u6CE8\u518C\u8EAB\u4EFD\uFF0C\u7559\u7A7A\u65F6\u5C1D\u8BD5 CIMD \u6216\u52A8\u6001\u6CE8\u518C\uFF1BCIMD \u4F7F\u7528\u5143\u6570\u636E\u6587\u6863 URL \u4F5C\u4E3A\u5BA2\u6237\u7AEF ID\u3002\u9884\u6CE8\u518C\u6A21\u5F0F\u4E0B\u5FC5\u586B\u3002",
20095
+ secretTooltip: "\u9884\u6CE8\u518C\u673A\u5BC6\u5BA2\u6237\u7AEF\u7684\u5BC6\u94A5\uFF0C\u4E0E\u670D\u52A1\u914D\u7F6E\u5206\u5F00\u5B58\u50A8\u3002\u516C\u5171\u5BA2\u6237\u7AEF\u65E0\u9700\u586B\u5199\uFF1B\u7F16\u8F91\u65F6\u7559\u7A7A\u4F1A\u4FDD\u7559\u5DF2\u6709\u5BC6\u94A5\u3002",
20096
+ metadataUrlTooltip: "\u516C\u5F00\u7684 HTTPS CIMD JSON \u6587\u6863\uFF0C\u58F0\u660E\u5BA2\u6237\u7AEF\u8EAB\u4EFD\u548C\u5141\u8BB8\u7684\u56DE\u8C03\u5730\u5740\u3002\u65B0\u589E\u670D\u52A1\u9ED8\u8BA4\u4F7F\u7528\u63D2\u4EF6\u6258\u7BA1\u6587\u6863\uFF1B\u81EA\u5B9A\u4E49\u56DE\u8C03\u9700\u5339\u914D\u5BF9\u5E94\u6587\u6863\u3002",
20097
+ callbackModeTooltip: "\u672C\u673A\u6A21\u5F0F\u5728\u5F53\u524D\u7535\u8111\u63A5\u6536\u6D4F\u89C8\u5668\u56DE\u8C03\uFF1B\u8FDC\u7A0B\u4E2A\u4EBA\u5B9E\u4F8B\u6A21\u5F0F\u4F7F\u7528\u7BA1\u7406\u5458\u914D\u7F6E\u7684 HTTPS \u4EE3\u7406\uFF1B\u624B\u52A8\u54CD\u5E94\u6A21\u5F0F\u7C98\u8D34\u5B8C\u6574\u56DE\u8C03 URL\uFF0C\u4E0D\u542F\u52A8\u76D1\u542C\u5668\u3002",
20098
+ redirectUrlTooltip: "OAuth \u6388\u6743\u540E\u7684\u8FD4\u56DE\u5730\u5740\u3002\u672C\u673A\u6A21\u5F0F\u652F\u6301 127.0.0.1 \u6216 localhost\uFF0C\u7701\u7565\u7AEF\u53E3\u65F6\u81EA\u52A8\u5206\u914D\uFF0C\u663E\u5F0F\u7AEF\u53E3\u4FDD\u6301\u56FA\u5B9A\u3002\u8FDC\u7A0B\u6A21\u5F0F\u987B\u4E3A HTTPS\uFF1B\u624B\u52A8\u6A21\u5F0F\u987B\u4E3A HTTPS \u6216\u5E26\u660E\u786E\u7AEF\u53E3\u7684\u672C\u673A\u5730\u5740\u3002\u5FC5\u987B\u7B26\u5408\u5BA2\u6237\u7AEF\u5143\u6570\u636E\u5141\u8BB8\u7684\u56DE\u8C03\u3002",
20099
+ callbackPortTooltip: "\u8FDC\u7A0B\u6A21\u5F0F\u4E0B\u5728 127.0.0.1 \u4E0A\u76D1\u542C\u7684\u5185\u90E8\u7AEF\u53E3\u3002HTTPS \u53CD\u5411\u4EE3\u7406\u987B\u8F6C\u53D1\u5230\u8BE5\u7AEF\u53E3\uFF0C\u5E76\u4FDD\u7559\u5916\u90E8 Host \u548C\u8DEF\u5F84\u3002",
20100
+ scopeTooltip: "OAuth \u767B\u5F55\u65F6\u7533\u8BF7\u7684\u6743\u9650\u3002\u7559\u7A7A\u65F6\u81EA\u52A8\u53D1\u73B0\uFF1B\u591A\u4E2A\u6743\u9650\u7528\u7A7A\u683C\u5206\u9694\u3002\u5B9E\u9645\u6388\u4E88\u7684\u6743\u9650\u7531\u6388\u6743\u670D\u52A1\u5668\u51B3\u5B9A\u3002",
20101
+ connectTimeoutMsTooltip: "\u8FDE\u63A5\u5EFA\u7ACB\u3001\u5DE5\u5177\u53D1\u73B0\u53CA\u5355\u6B21 OAuth \u7F51\u7EDC\u8BF7\u6C42\u7684\u8D85\u65F6\u65F6\u95F4\uFF0C\u5355\u4F4D\u4E3A\u6BEB\u79D2\u3002\u9ED8\u8BA4 30000 \u6BEB\u79D2\u3002",
20102
+ authTimeoutMsTooltip: "\u5B8C\u6210\u4E00\u6B21\u767B\u5F55\u7684\u603B\u65F6\u9650\uFF0C\u5305\u542B\u6D4F\u89C8\u5668\u6388\u6743\u7B49\u5F85\u3002\u8D85\u65F6\u4F1A\u53D6\u6D88\u672C\u6B21\u767B\u5F55\u3002\u9ED8\u8BA4 300000 \u6BEB\u79D2\u3002",
20103
+ toolTimeoutMsTooltip: "\u5355\u6B21\u5DE5\u5177\u8C03\u7528\u7684\u603B\u65F6\u9650\u3002\u8D85\u65F6\u53EF\u80FD\u5BFC\u81F4\u7ED3\u679C\u672A\u77E5\uFF0C\u63D2\u4EF6\u4E0D\u4F1A\u81EA\u52A8\u91CD\u653E\u8C03\u7528\u3002\u9ED8\u8BA4 600000 \u6BEB\u79D2\u3002",
20104
+ refreshSkewMsTooltip: "\u6709\u5237\u65B0\u4EE4\u724C\u65F6\uFF0C\u5728\u8BF7\u6C42\u524D\u63D0\u524D\u6307\u5B9A\u6BEB\u79D2\u6570\u5237\u65B0\u5373\u5C06\u5230\u671F\u7684 token\u3002\u4E0D\u4F1A\u4E2D\u65AD\u5DF2\u53D7\u7406\u7684\u5DE5\u5177\u8C03\u7528\u3002\u9ED8\u8BA4 60000 \u6BEB\u79D2\u3002",
20105
+ reconnectAttemptsTooltip: "\u81EA\u52A8\u6062\u590D\u8FDE\u63A5\u7684\u6700\u5927\u5C1D\u8BD5\u6B21\u6570\uFF0C\u8BBE\u4E3A 0 \u53EF\u5173\u95ED\u81EA\u52A8\u6062\u590D\u3002\u91CD\u8FDE\u4E0D\u4F1A\u91CD\u653E\u5DE5\u5177\u8C03\u7528\u3002\u9ED8\u8BA4 5 \u6B21\u3002",
20106
+ reconnectMaxDelayMsTooltip: "\u81EA\u52A8\u91CD\u8FDE\u9010\u6B65\u589E\u52A0\u7684\u7B49\u5F85\u95F4\u9694\u4E0A\u9650\uFF0C\u5355\u4F4D\u4E3A\u6BEB\u79D2\u3002\u9ED8\u8BA4 30000 \u6BEB\u79D2\u3002",
20107
+ manualResponseTooltip: "\u7C98\u8D34\u521A\u521A\u6279\u51C6\u7684\u767B\u5F55\u6240\u5BF9\u5E94\u7684\u5B8C\u6574\u56DE\u8C03 URL\u3002\u5176\u4E2D\u5305\u542B\u654F\u611F\u7684\u4E00\u6B21\u6027\u6388\u6743\u54CD\u5E94\uFF0C\u8BF7\u52FF\u53D1\u9001\u5230\u804A\u5929\u4E2D\uFF0C\u4E5F\u4E0D\u8981\u5728\u6B64\u7C98\u8D34\u8BBF\u95EE\u4EE4\u724C\u3002",
20005
20108
  title: "OAuth MCP",
20006
- description: "\u5728\u672C\u673A DSH \u4E2D\u8FDE\u63A5\u9700\u8981 OAuth \u6388\u6743\u7684 MCP \u5DE5\u5177\u3002",
20109
+ description: "\u5728\u4E2A\u4EBA DSH \u5B9E\u4F8B\u4E2D\u8FDE\u63A5\u9700\u8981 OAuth \u6388\u6743\u7684 MCP \u5DE5\u5177\u3002",
20007
20110
  add: "\u6DFB\u52A0\u670D\u52A1",
20008
20111
  edit: "\u7F16\u8F91",
20009
20112
  save: "\u4FDD\u5B58",
@@ -20025,9 +20128,10 @@ var zh = {
20025
20128
  mode: "\u6CE8\u518C\u65B9\u5F0F",
20026
20129
  clientId: "\u5BA2\u6237\u7AEF ID",
20027
20130
  metadataUrl: "\u5BA2\u6237\u7AEF\u5143\u6570\u636E\u6587\u6863 URL",
20028
- redirectUrl: "\u672C\u673A\u56DE\u8C03 URL",
20131
+ redirectUrl: "OAuth \u56DE\u8C03 URL",
20029
20132
  scope: "\u6743\u9650\u8303\u56F4",
20030
- secret: "\u5BA2\u6237\u7AEF\u5BC6\u94A5\uFF08\u7559\u7A7A\u4FDD\u7559\u539F\u503C\uFF09",
20133
+ scopePlaceholder: "\u81EA\u52A8\u53D1\u73B0\uFF08\u53EF\u9009\uFF09",
20134
+ secret: "\u5BA2\u6237\u7AEF\u5BC6\u94A5",
20031
20135
  advanced: "\u9AD8\u7EA7\u8BBE\u7F6E",
20032
20136
  connectTimeoutMs: "\u8FDE\u63A5\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
20033
20137
  authTimeoutMs: "\u767B\u5F55\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
@@ -20048,8 +20152,22 @@ var zh = {
20048
20152
  connected: "\u5DF2\u8FDE\u63A5",
20049
20153
  connectionFailed: "\u8FDE\u63A5\u5931\u8D25",
20050
20154
  tools: "\u5DE5\u5177\u6570",
20051
- invalid: "\u8BF7\u68C0\u67E5\u914D\u7F6E\u5B57\u6BB5\uFF1B\u9664\u672C\u673A\u5730\u5740\u5916\u5FC5\u987B\u4F7F\u7528 HTTPS\u3002",
20052
- local: "\u4EC5\u652F\u6301\u672C\u673A\u4F7F\u7528\uFF1A\u8BF7\u5728\u8FD0\u884C DSH \u7684\u7535\u8111\u4E0A\u6253\u5F00\u6388\u6743\u94FE\u63A5\u3002",
20155
+ duplicateId: "\u914D\u7F6E\u65E0\u6548\uFF1A\u670D\u52A1\u6807\u8BC6\u5DF2\u5B58\u5728\uFF0C\u8BF7\u5728\u9AD8\u7EA7\u8BBE\u7F6E\u4E2D\u4FEE\u6539\u670D\u52A1\u6807\u8BC6\u3002",
20156
+ invalid: "\u8BF7\u68C0\u67E5\u4EE5\u4E0B\u5B57\u6BB5\uFF1A",
20157
+ local: "\u8BF7\u5728\u8FD0\u884C DSH \u7684\u7535\u8111\u4E0A\u6253\u5F00\u6388\u6743\u94FE\u63A5\u3002\u4E0D\u586B\u5199\u56DE\u8C03\u7AEF\u53E3\u65F6\uFF0C\u81EA\u52A8\u9009\u62E9\u7A7A\u95F2\u7AEF\u53E3\u3002",
20158
+ deploymentHelp: "\u652F\u6301\u672C\u673A\u6216\u8FDC\u7A0B\u4E2A\u4EBA\u5B9E\u4F8B\uFF0C\u4E0D\u652F\u6301\u591A\u4EBA\u5171\u4EAB Host\u3002",
20159
+ callbackMode: "\u56DE\u8C03\u65B9\u5F0F",
20160
+ localMode: "\u672C\u673A",
20161
+ remoteMode: "\u8FDC\u7A0B\u4E2A\u4EBA\u5B9E\u4F8B",
20162
+ manualMode: "\u624B\u52A8\u7C98\u8D34\u6388\u6743\u54CD\u5E94",
20163
+ manualResponse: "\u5B8C\u6574\u6388\u6743\u56DE\u8C03 URL",
20164
+ manualSubmit: "\u63D0\u4EA4\u6388\u6743\u54CD\u5E94",
20165
+ manualHelp: "\u4E0D\u542F\u52A8\u76D1\u542C\u5668\uFF0C\u4E5F\u4E0D\u9700\u8981\u56DE\u8C03\u4EE3\u7406\u3002\u767B\u8BB0 HTTPS \u5C55\u793A\u9875\u6216\u672C\u673A\u56DE\u8C03\u5730\u5740\uFF0C\u6279\u51C6\u81EA\u5DF1\u53D1\u8D77\u7684\u767B\u5F55\u540E\uFF0C\u5C06\u5B8C\u6574\u56DE\u8C03 URL \u7C98\u8D34\u5230\u6B64\u8BBE\u7F6E\u9875\u3002",
20166
+ manualInstructions: "\u4EC5\u7C98\u8D34\u81EA\u5DF1\u521A\u53D1\u8D77\u7684\u767B\u5F55\u5BF9\u5E94\u7684\u5B8C\u6574\u56DE\u8C03 URL\u3002\u672C\u673A\u56DE\u8C03\u9875\u53EF\u80FD\u65E0\u6CD5\u6253\u5F00\uFF0C\u6B64\u65F6\u590D\u5236\u5730\u5740\u680F\u3002\u4E0D\u8981\u7C98\u8D34 token\uFF0C\u4E5F\u4E0D\u8981\u628A\u54CD\u5E94\u53D1\u5230\u804A\u5929\u4E2D\u3002",
20167
+ manualInvalid: "\u54CD\u5E94\u88AB\u62D2\u7EDD\u6216\u767B\u5F55\u5DF2\u8FC7\u671F\u3002\u8BF7\u6838\u5BF9\u672C\u6B21\u767B\u5F55\u7684\u5B8C\u6574\u56DE\u8C03 URL\uFF0C\u6216\u53D6\u6D88\u540E\u91CD\u65B0\u767B\u5F55\u3002",
20168
+ manualReceived: "\u5DF2\u6536\u5230\u54CD\u5E94\uFF0C\u8BF7\u7B49\u5F85\u4E0A\u65B9\u663E\u793A\u6388\u6743\u548C\u8FDE\u63A5\u7ED3\u679C\u3002",
20169
+ callbackPort: "\u5185\u90E8 loopback \u76D1\u542C\u7AEF\u53E3",
20170
+ remoteHelp: "\u7BA1\u7406\u5458\u987B\u5C06 HTTPS \u56DE\u8C03\u8F6C\u53D1\u5230\u6B64\u5B9E\u4F8B\u7684 127.0.0.1\uFF0C\u4FDD\u7559 Host \u548C\u8DEF\u5F84\uFF1B\u4EE3\u7406\u987B\u4E0E\u5B9E\u4F8B\u5171\u4EAB\u7F51\u7EDC\u547D\u540D\u7A7A\u95F4\u3002\u6BCF\u4EBA\u987B\u4F7F\u7528\u72EC\u7ACB\u5B9E\u4F8B\u548C\u51ED\u636E\u5B58\u50A8\u3002",
20053
20171
  deleteConfirm: "\u5220\u9664\u6B64\u670D\u52A1\u53CA\u5176\u672C\u673A\u6388\u6743\uFF1F",
20054
20172
  clearConfirm: "\u6E05\u9664\u672C\u673A\u6388\u6743\u5E76\u65AD\u5F00\u6B64\u670D\u52A1\uFF1F"
20055
20173
  };
@@ -20060,12 +20178,52 @@ var stack = { display: "grid", gap: 12, minWidth: 0 };
20060
20178
  var actions = { display: "flex", flexWrap: "wrap", gap: 8 };
20061
20179
  var box = { ...stack, padding: 16, border: "1px solid var(--dsw-border)", borderRadius: 12, overflowWrap: "anywhere" };
20062
20180
  var numeric = ["connectTimeoutMs", "authTimeoutMs", "toolTimeoutMs", "refreshSkewMs", "reconnectAttempts", "reconnectMaxDelayMs"];
20181
+ function Field({ name, t, children }) {
20182
+ const id = (0, import_react.useId)();
20183
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: stack, children: [
20184
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: { display: "flex", alignItems: "center", gap: 4 }, children: [
20185
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("label", { htmlFor: id, children: t(name) }),
20186
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Tooltip, { label: t(`${name}Tooltip`), side: "top", portal: true, openOnClick: true, maxWidth: 320, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { type: "button", size: "sm", "aria-label": `${t(name)} \u2014 ${t("fieldHelp")}`, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.IconInfoOutlineRegular, { size: 16 }) }) })
20187
+ ] }),
20188
+ (0, import_react.cloneElement)(children, { id })
20189
+ ] });
20190
+ }
20191
+ function ManualInput({ id, t, invoke }) {
20192
+ const [response, setResponse] = (0, import_react.useState)("");
20193
+ const [pending, setPending] = (0, import_react.useState)(false);
20194
+ const [received, setReceived] = (0, import_react.useState)(false);
20195
+ const [error62, setError] = (0, import_react.useState)("");
20196
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { style: stack, onSubmit: async (event) => {
20197
+ event.preventDefault();
20198
+ if (pending || received) return;
20199
+ const value = response;
20200
+ setResponse("");
20201
+ setPending(true);
20202
+ setError("");
20203
+ try {
20204
+ await invoke("submitResponse", { id, response: value });
20205
+ setReceived(true);
20206
+ } catch {
20207
+ setError(t("manualInvalid"));
20208
+ } finally {
20209
+ setPending(false);
20210
+ }
20211
+ }, children: [
20212
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("manualInstructions") }),
20213
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "manualResponse", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { type: "password", autoComplete: "off", spellCheck: false, maxLength: 16384, value: response, disabled: pending || received, onChange: (event) => setResponse(event.target.value) }) }),
20214
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { type: "submit", disabled: pending || received || !response.trim(), children: t("manualSubmit") }),
20215
+ error62 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", children: error62 }),
20216
+ received && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: t("manualReceived") })
20217
+ ] });
20218
+ }
20063
20219
  function Card({ t, view, invoke }) {
20064
20220
  const [rows, setRows] = (0, import_react.useState)();
20065
20221
  const [error62, setError] = (0, import_react.useState)("");
20066
20222
  const [busy, setBusy] = (0, import_react.useState)(false);
20067
20223
  const [draft, setDraft] = (0, import_react.useState)();
20068
20224
  const [editing, setEditing] = (0, import_react.useState)(false);
20225
+ const [customId, setCustomId] = (0, import_react.useState)("");
20226
+ const [advanced, setAdvanced] = (0, import_react.useState)(false);
20069
20227
  const [secret, setSecret] = (0, import_react.useState)("");
20070
20228
  (0, import_react.useEffect)(() => {
20071
20229
  if (view === "summary") return;
@@ -20107,7 +20265,7 @@ function Card({ t, view, invoke }) {
20107
20265
  void run(() => invoke("act", { id, action }));
20108
20266
  };
20109
20267
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { style: stack, children: [
20110
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("local") }),
20268
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("deploymentHelp") }),
20111
20269
  error62 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", children: error62 }),
20112
20270
  !rows ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("loading") }) : !rows.length ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t("empty") }) : rows.map((row) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { style: box, children: [
20113
20271
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("strong", { children: row.config.label }),
@@ -20128,12 +20286,15 @@ function Card({ t, view, invoke }) {
20128
20286
  ")"
20129
20287
  ] }),
20130
20288
  row.authorizationUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: row.authorizationUrl, target: "_blank", rel: "noopener noreferrer", children: t("open") }),
20289
+ row.config.callbackMode === "manual" && row.authentication === "authorizing" && row.authorizationUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ManualInput, { id: row.config.id, t, invoke }, row.authorizationUrl),
20131
20290
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: actions, children: [
20132
20291
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { disabled: busy || !row.config.enabled, onClick: () => act(row.config.id, row.authentication === "authorizing" ? "cancel" : "login"), children: t(row.authentication === "authorizing" ? "cancel" : "login") }),
20133
20292
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { disabled: busy || row.authentication !== "authorized" || !row.config.enabled, onClick: () => act(row.config.id, "reconnect"), children: t("reconnect") }),
20134
20293
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { disabled: busy, onClick: () => {
20135
20294
  setDraft(row.config);
20136
20295
  setEditing(true);
20296
+ setCustomId("");
20297
+ setAdvanced(false);
20137
20298
  setSecret("");
20138
20299
  }, children: t("edit") }),
20139
20300
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { disabled: busy, onClick: () => {
@@ -20144,15 +20305,31 @@ function Card({ t, view, invoke }) {
20144
20305
  ] })
20145
20306
  ] }, row.config.id)),
20146
20307
  !draft && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { disabled: busy, onClick: () => {
20147
- setDraft(serverSchema.parse({ id: "service", label: "MCP", url: "https://mcp.example.com/mcp" }));
20308
+ setDraft(serverSchema.parse({ id: serviceIdFromLabel("MCP"), label: "MCP", url: "https://mcp.example.com/mcp", metadataUrl: defaultMetadataUrl }));
20148
20309
  setEditing(false);
20310
+ setCustomId("");
20311
+ setAdvanced(false);
20149
20312
  setSecret("");
20150
20313
  }, children: t("add") }),
20151
- draft && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { style: box, onSubmit: (event) => {
20314
+ draft && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { noValidate: true, style: box, onSubmit: (event) => {
20152
20315
  event.preventDefault();
20153
- const parsed = serverSchema.safeParse(draft);
20154
- if (!parsed.success || !editing && rows?.some((row) => row.config.id === draft.id)) {
20155
- setError(t("invalid"));
20316
+ if (busy) return;
20317
+ if (usesDefaultMetadata(draft) && draft.callbackMode !== "local") {
20318
+ setAdvanced(true);
20319
+ setError(t("defaultCallbackHelp"));
20320
+ return;
20321
+ }
20322
+ const effectiveId = editing ? draft.id : customId || serviceIdFromLabel(draft.label);
20323
+ const parsed = parseServiceForm({ ...draft, id: effectiveId });
20324
+ if (!editing && rows?.some((row) => row.config.id === effectiveId)) {
20325
+ setAdvanced(true);
20326
+ setError(t("duplicateId"));
20327
+ return;
20328
+ }
20329
+ if (!parsed.success) {
20330
+ const fields = [...new Set(parsed.error.issues.map((issue2) => issue2.path[0]))];
20331
+ if (fields.some((field) => field !== "label" && field !== "url")) setAdvanced(true);
20332
+ setError(t("invalid") + " " + fields.filter((field) => typeof field === "string" && field in en).map((field) => t(field)).join(", "));
20156
20333
  return;
20157
20334
  }
20158
20335
  void run(async () => {
@@ -20161,24 +20338,29 @@ function Card({ t, view, invoke }) {
20161
20338
  setSecret("");
20162
20339
  });
20163
20340
  }, children: [
20164
- ["id", "label", "url", "clientId", "metadataUrl", "redirectUrl", "scope"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { style: stack, children: [
20165
- t(key),
20166
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { value: draft[key], disabled: busy || key === "id" && editing, onChange: (event) => setDraft({ ...draft, [key]: event.target.value }) })
20167
- ] }, key)),
20168
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { style: stack, children: [
20169
- t("mode"),
20170
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", { disabled: busy, value: draft.mode, onChange: (event) => setDraft({ ...draft, mode: serverSchema.shape.mode.parse(event.target.value) }), children: ["auto", "cimd", "preregistered", "dcr"].map((mode) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: mode, children: t(mode) }, mode)) })
20171
- ] }),
20172
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { style: stack, children: [
20173
- t("secret"),
20174
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { type: "password", autoComplete: "new-password", value: secret, disabled: busy, onChange: (event) => setSecret(event.target.value) })
20175
- ] }),
20176
- /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { children: [
20341
+ ["label", "url"].map((key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: key, t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { value: draft[key], disabled: busy, onChange: (event) => setDraft({ ...draft, [key]: event.target.value }) }) }, key)),
20342
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("details", { open: advanced, onToggle: (event) => setAdvanced(event.currentTarget.open), children: [
20177
20343
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("summary", { children: t("advanced") }),
20178
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { style: stack, children: numeric.map((key) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("label", { style: stack, children: [
20179
- t(key),
20180
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { type: "number", value: draft[key], onChange: (event) => setDraft({ ...draft, [key]: Number(event.target.value) }) })
20181
- ] }, key)) })
20344
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: stack, children: [
20345
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "id", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { value: editing ? draft.id : customId, placeholder: editing ? void 0 : serviceIdFromLabel(draft.label), disabled: busy || editing, onChange: (event) => setCustomId(event.target.value) }) }),
20346
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "mode", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("select", { disabled: busy, value: draft.mode, onChange: (event) => setDraft({ ...draft, mode: serverSchema.shape.mode.parse(event.target.value) }), children: ["auto", "cimd", "preregistered", "dcr"].map((mode) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: mode, children: t(mode) }, mode)) }) }),
20347
+ (draft.mode === "auto" || draft.mode === "cimd") && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "metadataUrl", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { value: draft.metadataUrl, required: draft.mode === "cimd", disabled: busy, onChange: (event) => setDraft({ ...draft, metadataUrl: event.target.value }) }) }),
20348
+ (draft.mode === "auto" || draft.mode === "preregistered") && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
20349
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "clientId", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { value: draft.clientId, placeholder: t(draft.mode === "auto" ? "clientIdAutoPlaceholder" : "clientIdRequiredPlaceholder"), required: draft.mode === "preregistered", disabled: busy, onChange: (event) => setDraft({ ...draft, clientId: event.target.value }) }) }),
20350
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "secret", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { type: "password", autoComplete: "new-password", placeholder: t(editing ? "secretEditPlaceholder" : "secretPlaceholder"), value: secret, disabled: busy, onChange: (event) => setSecret(event.target.value) }) })
20351
+ ] }),
20352
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "callbackMode", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("select", { disabled: busy, value: draft.callbackMode, onChange: (event) => setDraft(changeCallbackMode(draft, serverSchema.shape.callbackMode.parse(event.target.value))), children: [
20353
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "local", children: t("localMode") }),
20354
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "remote", children: t("remoteMode") }),
20355
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("option", { value: "manual", children: t("manualMode") })
20356
+ ] }) }),
20357
+ usesDefaultMetadata(draft) && draft.callbackMode !== "local" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "status", children: t("defaultCallbackHelp") }),
20358
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { children: t(draft.callbackMode === "manual" ? "manualHelp" : draft.callbackMode === "remote" ? "remoteHelp" : "local") }),
20359
+ draft.callbackMode === "remote" && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "callbackPort", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { type: "number", disabled: busy, value: draft.callbackPort, onChange: (event) => setDraft({ ...draft, callbackPort: Number(event.target.value) }) }) }),
20360
+ showsCallbackUrl(draft) && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "redirectUrl", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { value: draft.redirectUrl, disabled: busy, onChange: (event) => setDraft({ ...draft, redirectUrl: event.target.value }) }) }),
20361
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: "scope", t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { value: draft.scope, disabled: busy, placeholder: t("scopePlaceholder"), onChange: (event) => setDraft({ ...draft, scope: event.target.value }) }) }),
20362
+ numeric.map((key) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Field, { name: key, t, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Input, { type: "number", disabled: busy, value: draft[key], onChange: (event) => setDraft({ ...draft, [key]: Number(event.target.value) }) }) }, key))
20363
+ ] })
20182
20364
  ] }),
20183
20365
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: actions, children: [
20184
20366
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dsh_client_ui_primitives.Button, { type: "submit", disabled: busy, children: t("save") }),