dsh-mcp-ops 0.2.2 → 0.3.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/lib/client.js CHANGED
@@ -121,7 +121,7 @@ var server$schema = import_zod.z.object({
121
121
  error: import_zod.z.string().readonly().optional()
122
122
  }).readonly()
123
123
  }).readonly();
124
- var mode$schema = import_zod.z.union([import_zod.z.literal("search"), import_zod.z.literal("full")]).readonly();
124
+ var mode$schema = import_zod.z.union([import_zod.z.literal("on-demand"), import_zod.z.literal("eager")]).readonly();
125
125
  var config$schema = import_zod.z.object({
126
126
  injectionMode: mode$schema,
127
127
  injectGlobalEnvToStdio: import_zod.z.boolean().readonly()
@@ -137,14 +137,11 @@ var toolRow$schema = import_zod.z.object({
137
137
  server: import_zod.z.string().readonly(),
138
138
  tool: import_zod.z.string().readonly(),
139
139
  description: import_zod.z.string().readonly(),
140
- enabled: import_zod.z.boolean().readonly(),
141
- hot: import_zod.z.boolean().readonly()
140
+ enabled: import_zod.z.boolean().readonly()
142
141
  }).readonly();
143
142
  var toolsPayload$schema = import_zod.z.object({
144
143
  tools: import_zod.z.array(toolRow$schema).readonly(),
145
144
  mode: mode$schema,
146
- hotSize: import_zod.z.number().readonly(),
147
- hotLimit: import_zod.z.number().readonly(),
148
145
  enforcement: import_zod.z.union([import_zod.z.literal("mask"), import_zod.z.literal("unavailable")]).readonly()
149
146
  }).readonly();
150
147
  var listResult$schema = import_zod.z.union([
@@ -211,6 +208,8 @@ var serverInput$schema = import_zod.z.object({
211
208
  }).readonly()).readonly().optional(),
212
209
  timeoutMs: import_zod.z.number().readonly().optional(),
213
210
  oauth: import_zod.z.boolean().readonly().optional(),
211
+ oauthScope: import_zod.z.string().readonly().optional(),
212
+ oauthClientId: import_zod.z.string().readonly().optional(),
214
213
  enabled: import_zod.z.boolean().readonly().optional()
215
214
  }).readonly();
216
215
  var writePayload$schema = import_zod.z.object({
@@ -276,10 +275,24 @@ var envResult$schema = import_zod.z.union([
276
275
  error: import_zod.z.object({ code: import_zod.z.string().readonly(), message: import_zod.z.string().readonly() }).readonly()
277
276
  }).readonly()
278
277
  ]);
278
+ var oauthAttempt$schema = import_zod.z.object({
279
+ attemptId: import_zod.z.string().readonly(),
280
+ phase: import_zod.z.string().readonly(),
281
+ authorizationUrl: import_zod.z.string().readonly().optional(),
282
+ lastError: import_zod.z.string().readonly().optional()
283
+ }).readonly();
284
+ var servers$schema = import_zod.z.object({ servers: import_zod.z.array(server$schema).readonly() }).readonly();
279
285
  var oauthStartPayload$schema = import_zod.z.object({
280
- authorizeUrl: import_zod.z.string().readonly(),
281
- redirectUri: import_zod.z.string().readonly()
286
+ attempt: oauthAttempt$schema,
287
+ servers: import_zod.z.array(server$schema).readonly()
282
288
  }).readonly();
289
+ var oauthServersResult$schema = import_zod.z.union([
290
+ import_zod.z.object({ ok: import_zod.z.literal(true).readonly(), value: servers$schema }).readonly(),
291
+ import_zod.z.object({
292
+ ok: import_zod.z.literal(false).readonly(),
293
+ error: import_zod.z.object({ code: import_zod.z.string().readonly(), message: import_zod.z.string().readonly() }).readonly()
294
+ }).readonly()
295
+ ]);
283
296
  var oauthStartResult$schema = import_zod.z.union([
284
297
  import_zod.z.object({ ok: import_zod.z.literal(true).readonly(), value: oauthStartPayload$schema }).readonly(),
285
298
  import_zod.z.object({
@@ -383,13 +396,21 @@ var TYPERT_REMOTE = {
383
396
  }).readonly(), "dsh-mcp-ops/types#EnvSetRequest")
384
397
  ]),
385
398
  endpoint("oauthStart", oauthStartResult$schema, "dsh-mcp-ops/types#OAuthStartResult", [
399
+ // 0.3.0:授权交给官方 manager,入参只剩服务器名(URL/origin 都由官方从注册项与宿主推断)。
386
400
  parameter("request", import_zod.z.object({
387
- serverName: import_zod.z.string().readonly(),
388
- url: import_zod.z.string().readonly(),
389
- // B81:浏览器 origin(可选)。host 只在"干净 origin + 组合里有官方 webServer"时用它走
390
- // Web 回调,否则回退回环 —— 所以老客户端不传也照样成立(字段必须可选)。
391
- origin: import_zod.z.string().readonly().optional()
401
+ serverName: import_zod.z.string().readonly()
392
402
  }).readonly(), "dsh-mcp-ops/types#OAuthStartRequest")
403
+ ]),
404
+ endpoint("oauthCancel", oauthServersResult$schema, "dsh-mcp-ops/types#OAuthServersResult", [
405
+ parameter("request", import_zod.z.object({
406
+ serverName: import_zod.z.string().readonly(),
407
+ attemptId: import_zod.z.string().readonly()
408
+ }).readonly(), "dsh-mcp-ops/types#OAuthCancelRequest")
409
+ ]),
410
+ endpoint("oauthSignOut", oauthServersResult$schema, "dsh-mcp-ops/types#OAuthServersResult", [
411
+ parameter("request", import_zod.z.object({
412
+ serverName: import_zod.z.string().readonly()
413
+ }).readonly(), "dsh-mcp-ops/types#OAuthSignOutRequest")
393
414
  ])
394
415
  ]
395
416
  };
@@ -415,11 +436,12 @@ var zh = {
415
436
  // 文件源提示(只在需要时出现:未创建 / 只读)
416
437
  fileMissing: "\u914D\u7F6E\u6587\u4EF6 {path} \u5C1A\u672A\u521B\u5EFA\uFF0C\u4FDD\u5B58\u7B2C\u4E00\u6761\u670D\u52A1\u65F6\u4F1A\u81EA\u52A8\u521B\u5EFA\u3002",
417
438
  fileReadonly: "\u914D\u7F6E\u6587\u4EF6 {path} \u5F53\u524D\u53EA\u8BFB\uFF1A{reason}",
418
- // 注入模式(B37:独立成 tab,tab 内不再重复小标题;副标题里的「省 token」已按用户要求删掉)
419
- modeSearch: "\u6309\u9700\u68C0\u7D22\uFF08\u4EC5\u6CE8\u5165\u5E38\u7528 / \u68C0\u7D22\u5230\u7684\u5DE5\u5177\uFF09",
420
- modeFull: "\u5168\u91CF\u6CE8\u5165\uFF08\u6BCF\u8F6E\u6CE8\u5165\u6240\u6709\u542F\u7528\u7684 MCP \u5DE5\u5177\uFF09",
421
- modeHintSearch: "\u6309\u9700\u6A21\u5F0F\uFF1A\u6A21\u578B\u9700\u8981\u67D0 MCP \u5DE5\u5177\u65F6\u4F1A\u8C03\u7528 mcp_tool_search \u68C0\u7D22\u5E76\u81EA\u52A8\u6CE8\u5165\u5F53\u524D\u5BF9\u8BDD\u3002",
422
- modeHintFull: "\u5168\u91CF\u6A21\u5F0F\uFF1A\u6240\u6709\u5DF2\u542F\u7528\u7684\u5DE5\u5177\u6BCF\u8F6E\u90FD\u5199\u8FDB\u63D0\u793A\u8BCD\uFF0C\u5DE5\u5177\u591A\u65F6\u66F4\u8D39 token\u3002",
439
+ // 注入模式(0.3.0:直接映射官方 `toolLoading`,不再有热集 / 检索工具)。
440
+ // 键名沿用 B37 的 `modeSearch` / `modeFull`(历史包袱,文案已按官方语义改写)。
441
+ modeSearch: "\u6309\u9700\u52A0\u8F7D\uFF08\u5B98\u65B9 load_tools\uFF0C\u4EC5\u5BF9\u53D1\u8D77\u7684\u4F1A\u8BDD\u751F\u6548\uFF09",
442
+ modeFull: "\u5168\u91CF\u6CE8\u5165",
443
+ modeHintSearch: "\u6309\u9700\u52A0\u8F7D\uFF1A\u5DE5\u5177\u5148\u53EA\u8FDB\u63D0\u793A\u8BCD\u76EE\u5F55\uFF0C\u6A21\u578B\u8C03\u7528\u67D0\u53F0\u670D\u52A1\u7684 load_tools \u540E\u624D\u88C5\u8F7D\u8FDB\u53D1\u8D77\u8FD9\u6B21\u8C03\u7528\u7684\u4F1A\u8BDD\uFF1B\u8BE5\u6A21\u5F0F\u4E0B\u300C\u5C55\u5F00\u5DE5\u5177\u300D\u53EA\u663E\u793A\u5DF2\u88C5\u8F7D\u7684\u5DE5\u5177\uFF0C\u8981\u9010\u4E2A\u7BA1\u7406\u8BF7\u5207\u5230\u5168\u91CF\u6CE8\u5165\u3002",
444
+ modeHintFull: "\u5168\u91CF\u6CE8\u5165\uFF1A\u6240\u6709\u5DF2\u542F\u7528\u7684\u5DE5\u5177\u76F4\u63A5\u6CE8\u518C\u3001\u6BCF\u8F6E\u90FD\u5199\u8FDB\u63D0\u793A\u8BCD\uFF0C\u5DE5\u5177\u591A\u65F6\u66F4\u8D39\u4E0A\u4E0B\u6587\u3002",
423
445
  // 服务卡片
424
446
  addServer: "\u6DFB\u52A0\u670D\u52A1",
425
447
  refreshList: "\u5237\u65B0\u5217\u8868",
@@ -446,6 +468,7 @@ var zh = {
446
468
  phaseFailed: "\u8FDE\u63A5\u5931\u8D25",
447
469
  phaseStopped: "\u672A\u542F\u7528",
448
470
  phaseStoppedConflict: "\u88AB\u7EC4\u5408\u5C42\u5360\u7528",
471
+ phaseWaitingAuth: "\u5F85\u6388\u6743",
449
472
  readonlyParseError: "\u89E3\u6790\u5931\u8D25\uFF0C\u53EA\u8BFB",
450
473
  readonlyNotWritable: "\u4E0D\u53EF\u5199",
451
474
  // 服务表单
@@ -471,7 +494,21 @@ var zh = {
471
494
  formTimeout: "\u5DE5\u5177\u8C03\u7528\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
472
495
  formTimeoutHint: "\u7559\u7A7A = \u4E0D\u7528\u672C\u63D2\u4EF6\u7684\u8986\u76D6\u503C\uFF0C\u6309\u5B98\u65B9 dsh-mcp-client \u7684\u9ED8\u8BA4 60000 \u6BEB\u79D2\uFF0860 \u79D2\uFF09\u6267\u884C\u3002",
473
496
  formOAuth: "\u4F7F\u7528 OAuth \u6388\u6743\uFF08\u6D4F\u89C8\u5668\u6388\u6743 + PKCE\uFF09",
474
- formOAuthHint: "\u4EC5\u5F53\u8BE5\u670D\u52A1\u786E\u5B9E\u4F7F\u7528 OAuth\uFF08MCP \u6388\u6743\u7801 + PKCE\uFF09\u65F6\u52FE\u9009\u3002\u7528\u9759\u6001 token \u6216\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\u8BA4\u8BC1\u7684\u670D\u52A1\u8BF7\u52FF\u52FE\u9009\u2014\u2014\u6CA1\u6709\u65B0\u9C9C\u4EE4\u724C\u65F6\u672C\u63D2\u4EF6\u4F1A\u76F4\u63A5\u7ED9\u51FA\u8BCA\u65AD\uFF0C\u800C\u4E0D\u662F\u5E26\u7740\u7A7A\u5934\u53BB\u649E 401\u3002",
497
+ formOAuthHint: "\u4EC5\u5F53\u8BE5\u670D\u52A1\u786E\u5B9E\u4F7F\u7528 OAuth\uFF08MCP \u6388\u6743\u7801 + PKCE\uFF09\u65F6\u52FE\u9009\uFF1B\u6388\u6743\u6D41\u7A0B\u7531\u5B98\u65B9 mcp-client \u5B8C\u6210\u3002\u7528\u9759\u6001 token \u6216\u81EA\u5B9A\u4E49\u8BF7\u6C42\u5934\u7684\u670D\u52A1\u8BF7\u52FF\u52FE\u9009\u2014\u2014\u58F0\u660E OAuth \u540E\u5B98\u65B9\u4E0D\u5141\u8BB8\u518D\u624B\u5DE5\u914D Authorization \u5934\u3002",
498
+ oauthScope: "scope\uFF08\u53EF\u9009\uFF09",
499
+ oauthScopeHint: "\u7559\u7A7A\u6309\u670D\u52A1\u5668\u7684\u8981\u6C42\u51B3\u5B9A",
500
+ oauthClientId: "client id\uFF08\u53EF\u9009\uFF09",
501
+ oauthClientIdHint: "\u7559\u7A7A\u7531\u5B98\u65B9\u52A8\u6001\u6CE8\u518C",
502
+ oauthAuthorize: "\u6388\u6743",
503
+ oauthCancel: "\u53D6\u6D88\u6388\u6743",
504
+ oauthSignOut: "\u9000\u51FA\u767B\u5F55",
505
+ oauthSignOutConfirm: "\u786E\u8BA4\u9000\u51FA\u767B\u5F55\uFF1F\u4F1A\u5220\u9664\u672C\u5730\u6388\u6743\u51ED\u636E",
506
+ oauthSignedOut: "\u5DF2\u9000\u51FA\u767B\u5F55",
507
+ oauthWaiting: "\u7B49\u5F85\u6D4F\u89C8\u5668\u5B8C\u6210\u6388\u6743\u2026",
508
+ oauthInProgress: "\u6388\u6743\u4E2D\u2026",
509
+ oauthDone: "\u6388\u6743\u5B8C\u6210",
510
+ oauthCancelled: "\u6388\u6743\u5DF2\u53D6\u6D88",
511
+ oauthFailed: "\u6388\u6743\u5931\u8D25\uFF1A{message}",
475
512
  formEnabled: "\u542F\u7528",
476
513
  formTest: "\u6D4B\u8BD5\u8FDE\u63A5",
477
514
  formSave: "\u4FDD\u5B58",
@@ -479,8 +516,7 @@ var zh = {
479
516
  formTestOk: "\u8FDE\u63A5\u6210\u529F\uFF1A{count} \u4E2A\u5DE5\u5177",
480
517
  formTestFail: "\u8FDE\u63A5\u5931\u8D25\uFF1A{message}",
481
518
  formTesting: "\u6B63\u5728\u6D4B\u8BD5\u8FDE\u63A5\u2026",
482
- formAuthorize: "\u83B7\u53D6\u6388\u6743\u94FE\u63A5",
483
- formAuthorizeHint: "\u5728\u6D4F\u89C8\u5668\u6253\u5F00\u4EE5\u4E0B\u5730\u5740\u5B8C\u6210\u6388\u6743\uFF0C\u7136\u540E\u518D\u6B21\u70B9\u300C\u6D4B\u8BD5\u8FDE\u63A5\u300D\uFF1A",
519
+ formAuthorizeHint: "\u6388\u6743\u9875\uFF08\u53EA\u5728\u7B49\u5F85\u6D4F\u89C8\u5668\u5B8C\u6210\u6388\u6743\u65F6\u51FA\u73B0\uFF09\uFF1A",
484
520
  // 服务级环境变量(表单内,B37)
485
521
  formEnv: "\u73AF\u5883\u53D8\u91CF",
486
522
  formEnvHint: "\u4E00\u884C\u4E00\u4E2A\u53D8\u91CF\u3002\u52FE\u9009\u300C\u5BC6\u94A5\u300D\u7684\u53D8\u91CF\u4E0D\u5199\u8FDB .mcp.json\uFF0C\u53EA\u5B58\u8FDB\u51ED\u636E\u6587\u6863\uFF08\u952E DSH_MCP__{\u670D\u52A1\u540D\u5927\u5199}__{\u53D8\u91CF\u540D}\uFF09\uFF1B\u8BE5\u670D\u52A1\u5728\u51ED\u636E\u6587\u6863\u91CC\u4EE5\u8FD9\u4E2A\u524D\u7F00\u767B\u8BB0\u7684\u53D8\u91CF\u90FD\u4F1A\u81EA\u52A8\u6CE8\u5165\u3002\u503C\u7559\u7A7A\u8868\u793A\u4FDD\u7559\u5DF2\u5B58\u5BC6\u94A5\u3002",
@@ -550,10 +586,10 @@ var en = {
550
586
  errorTitle: "Action failed",
551
587
  fileMissing: "The configuration file {path} does not exist yet; saving the first service creates it.",
552
588
  fileReadonly: "The configuration file {path} is currently read-only: {reason}",
553
- modeSearch: "On demand (only common / searched tools are injected)",
554
- modeFull: "Inject everything (every enabled MCP tool in every turn)",
555
- modeHintSearch: "On-demand mode: when the model needs an MCP tool it calls mcp_tool_search, and a hit is injected into the conversation.",
556
- modeHintFull: "Full mode: every enabled tool enters the prompt each turn \u2014 more tokens when there are many tools.",
589
+ modeSearch: "On demand (official load_tools, per initiating session)",
590
+ modeFull: "Inject everything",
591
+ modeHintSearch: "On demand: tools only enter the prompt catalog and are loaded into the calling session via a service\u2019s load_tools. In this mode \u201CExpand tools\u201D only lists loaded tools; switch to full injection to manage them individually.",
592
+ modeHintFull: "Everything: every enabled tool is registered directly and enters the prompt each turn \u2014 more context when there are many tools.",
557
593
  addServer: "Add service",
558
594
  refreshList: "Refresh list",
559
595
  refreshListHint: "Re-read the file and refresh the list (entries added outside show up here)",
@@ -578,6 +614,7 @@ var en = {
578
614
  phaseFailed: "failed",
579
615
  phaseStopped: "disabled",
580
616
  phaseStoppedConflict: "occupied by composition",
617
+ phaseWaitingAuth: "needs authorization",
581
618
  readonlyParseError: "parse error, read-only",
582
619
  readonlyNotWritable: "not writable",
583
620
  formNew: "New service",
@@ -602,7 +639,21 @@ var en = {
602
639
  formTimeout: "Tool call timeout (ms)",
603
640
  formTimeoutHint: "Blank = no plugin override; the official dsh-mcp-client default of 60000 ms (60 s) applies.",
604
641
  formOAuth: "Use OAuth (browser authorization + PKCE)",
605
- formOAuthHint: "Tick only when the service really uses OAuth (MCP authorization code + PKCE). Services authenticated with a static token or custom headers must stay unticked \u2014 without a fresh token this plugin reports a diagnostic instead of hitting a 401 with an empty header.",
642
+ formOAuthHint: "Tick only when the service really uses OAuth (MCP authorization code + PKCE); the official mcp-client runs the flow. Services authenticated with a static token or custom headers must stay unticked \u2014 declaring OAuth forbids a manual Authorization header.",
643
+ oauthScope: "scope (optional)",
644
+ oauthScopeHint: "Leave empty to let the service decide",
645
+ oauthClientId: "client id (optional)",
646
+ oauthClientIdHint: "Leave empty to let the official client register dynamically",
647
+ oauthAuthorize: "Authorize",
648
+ oauthCancel: "Cancel authorization",
649
+ oauthSignOut: "Sign out",
650
+ oauthSignOutConfirm: "Sign out? This deletes the local authorization credentials.",
651
+ oauthSignedOut: "Signed out",
652
+ oauthWaiting: "Waiting for the browser to finish authorization\u2026",
653
+ oauthInProgress: "Authorizing\u2026",
654
+ oauthDone: "Authorization complete",
655
+ oauthCancelled: "Authorization cancelled",
656
+ oauthFailed: "Authorization failed: {message}",
606
657
  formEnabled: "Enabled",
607
658
  formTest: "Test connection",
608
659
  formSave: "Save",
@@ -610,8 +661,7 @@ var en = {
610
661
  formTestOk: "Connected: {count} tool(s)",
611
662
  formTestFail: "Connection failed: {message}",
612
663
  formTesting: "Testing the connection\u2026",
613
- formAuthorize: "Get authorization link",
614
- formAuthorizeHint: "Open the address below in a browser to authorize, then click \u201CTest connection\u201D again:",
664
+ formAuthorizeHint: "Authorization page (only shown while the browser is waiting):",
615
665
  formEnv: "Environment variables",
616
666
  formEnvHint: "One variable per row. A \u201CSecret\u201D row is not written to .mcp.json at all \u2014 it lives only in the credentials document (key DSH_MCP__{UPPER service}__{VAR}); every variable registered under that prefix is injected automatically. A blank value keeps the stored secret.",
617
667
  formEnvAdd: "Add variable",
@@ -666,36 +716,12 @@ var import_react3 = require("react");
666
716
  var import_dsh_client_ui_primitives6 = require("@deepseek-ai/dsh-client-ui-primitives");
667
717
 
668
718
  // src/client/McpOpsSection.module.css
669
- (function() {
670
- if (typeof document !== "undefined") {
671
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="McpOpsSection.module.css"]');
672
- if (!existing) {
673
- const style = document.createElement("style");
674
- style.setAttribute("data-plugin", "dsh-mcp-ops");
675
- style.setAttribute("data-file", "McpOpsSection.module.css");
676
- style.textContent = "\n\n.dsh-mcp-ops-McpOpsSection-panel {\n display: flex;\n flex-direction: column;\n gap: 14px;\n max-width: 960px;\n}\n\n\n.dsh-mcp-ops-McpOpsSection-tabs {\n margin-bottom: 2px;\n}\n\n.dsh-mcp-ops-McpOpsSection-tabPanel {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\n.dsh-mcp-ops-McpOpsSection-error {\n margin: 0;\n font-size: 13px;\n color: #d14343;\n}\n\n.dsh-mcp-ops-McpOpsSection-saved {\n margin: 0;\n font-size: 12px;\n color: #1e8449;\n}\n\n\n.dsh-mcp-ops-McpOpsSection-dialog {\n width: min(680px, 100%);\n \n padding: 0;\n}\n\n.dsh-mcp-ops-McpOpsSection-modal {\n width: 100%;\n max-height: 88vh;\n overflow-y: auto;\n}\n\n\n.dsh-mcp-ops-McpOpsSection-modal > form {\n border: none;\n border-radius: 12px;\n}\n\n";
677
- document.head.appendChild(style);
678
- }
679
- }
680
- })();
681
719
  var McpOpsSection_default = { "panel": "dsh-mcp-ops-McpOpsSection-panel", "tabs": "dsh-mcp-ops-McpOpsSection-tabs", "tabPanel": "dsh-mcp-ops-McpOpsSection-tabPanel", "error": "dsh-mcp-ops-McpOpsSection-error", "saved": "dsh-mcp-ops-McpOpsSection-saved", "dialog": "dsh-mcp-ops-McpOpsSection-dialog", "modal": "dsh-mcp-ops-McpOpsSection-modal" };
682
720
 
683
721
  // src/client/sections/ConfirmDialog.tsx
684
722
  var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
685
723
 
686
724
  // src/client/sections/ConfirmDialog.module.css
687
- (function() {
688
- if (typeof document !== "undefined") {
689
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ConfirmDialog.module.css"]');
690
- if (!existing) {
691
- const style = document.createElement("style");
692
- style.setAttribute("data-plugin", "dsh-mcp-ops");
693
- style.setAttribute("data-file", "ConfirmDialog.module.css");
694
- style.textContent = "\n\n.dsh-mcp-ops-ConfirmDialog-dialog {\n width: min(420px, 100%);\n padding: 0;\n}\n\n.dsh-mcp-ops-ConfirmDialog-modal {\n display: flex;\n flex-direction: column;\n gap: 10px;\n width: 100%;\n padding: 14px;\n box-sizing: border-box;\n}\n\n.dsh-mcp-ops-ConfirmDialog-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n}\n\n.dsh-mcp-ops-ConfirmDialog-body {\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n opacity: 0.8;\n}\n\n.dsh-mcp-ops-ConfirmDialog-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n padding-top: 2px;\n}\n\n\n\n.dsh-mcp-ops-ConfirmDialog-danger {\n color: #d14343;\n border-color: color-mix(in srgb, #d14343 60%, transparent);\n}\n";
695
- document.head.appendChild(style);
696
- }
697
- }
698
- })();
699
725
  var ConfirmDialog_default = { "dialog": "dsh-mcp-ops-ConfirmDialog-dialog", "modal": "dsh-mcp-ops-ConfirmDialog-modal", "title": "dsh-mcp-ops-ConfirmDialog-title", "body": "dsh-mcp-ops-ConfirmDialog-body", "actions": "dsh-mcp-ops-ConfirmDialog-actions", "danger": "dsh-mcp-ops-ConfirmDialog-danger" };
700
726
 
701
727
  // src/client/sections/ConfirmDialog.tsx
@@ -736,18 +762,6 @@ var import_react = require("react");
736
762
  var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
737
763
 
738
764
  // src/client/sections/EnvPanel.module.css
739
- (function() {
740
- if (typeof document !== "undefined") {
741
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="EnvPanel.module.css"]');
742
- if (!existing) {
743
- const style = document.createElement("style");
744
- style.setAttribute("data-plugin", "dsh-mcp-ops");
745
- style.setAttribute("data-file", "EnvPanel.module.css");
746
- style.textContent = "\n\n.dsh-mcp-ops-EnvPanel-panel {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n\n.dsh-mcp-ops-EnvPanel-toggle {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n font-weight: 600;\n}\n\n.dsh-mcp-ops-EnvPanel-switchWrap {\n display: inline-flex;\n flex: none;\n}\n\n.dsh-mcp-ops-EnvPanel-hint {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n opacity: 0.65;\n}\n\n.dsh-mcp-ops-EnvPanel-intro {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-EnvPanel-rows {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.dsh-mcp-ops-EnvPanel-rowLine {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n\n.dsh-mcp-ops-EnvPanel-field {\n flex: 1;\n min-width: 0;\n}\n\n\n.dsh-mcp-ops-EnvPanel-fieldName {\n flex: 35 1 0;\n}\n\n.dsh-mcp-ops-EnvPanel-fieldValue {\n flex: 65 1 0;\n}\n\n\n.dsh-mcp-ops-EnvPanel-input {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n}\n\n\n.dsh-mcp-ops-EnvPanel-checkbox {\n flex: none;\n font-size: 13px;\n}\n\n.dsh-mcp-ops-EnvPanel-remove {\n flex: none;\n width: 24px;\n height: 24px;\n padding: 0;\n color: #d14343;\n font-size: 16px;\n line-height: 1;\n}\n\n\n.dsh-mcp-ops-EnvPanel-dialog {\n width: min(520px, 100%);\n padding: 0;\n}\n\n.dsh-mcp-ops-EnvPanel-modal {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n padding: 14px;\n box-sizing: border-box;\n}\n\n.dsh-mcp-ops-EnvPanel-modalTitle {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n}\n\n.dsh-mcp-ops-EnvPanel-batchHint {\n margin: 0;\n font-size: 12px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-EnvPanel-textarea {\n width: 100%;\n box-sizing: border-box;\n resize: vertical;\n padding: 6px 8px;\n border: 1px solid color-mix(in srgb, currentColor 25%, transparent);\n border-radius: 6px;\n background: transparent;\n color: inherit;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 12px;\n line-height: 18px;\n}\n\n\n.dsh-mcp-ops-EnvPanel-batchActions {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n}\n\n.dsh-mcp-ops-EnvPanel-batchButtons {\n display: inline-flex;\n flex: none;\n align-items: center;\n gap: 10px;\n}\n\n\n.dsh-mcp-ops-EnvPanel-actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 10px;\n}\n\n\n\n.dsh-mcp-ops-EnvPanel-note,\n.dsh-mcp-ops-EnvPanel-error {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n}\n\n.dsh-mcp-ops-EnvPanel-note {\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-EnvPanel-error {\n color: #d14343;\n}\n\n.dsh-mcp-ops-EnvPanel-saved {\n font-size: 12px;\n color: #1e8449;\n}\n";
747
- document.head.appendChild(style);
748
- }
749
- }
750
- })();
751
765
  var EnvPanel_default = { "panel": "dsh-mcp-ops-EnvPanel-panel", "toggle": "dsh-mcp-ops-EnvPanel-toggle", "switchWrap": "dsh-mcp-ops-EnvPanel-switchWrap", "hint": "dsh-mcp-ops-EnvPanel-hint", "intro": "dsh-mcp-ops-EnvPanel-intro", "rows": "dsh-mcp-ops-EnvPanel-rows", "rowLine": "dsh-mcp-ops-EnvPanel-rowLine", "field": "dsh-mcp-ops-EnvPanel-field", "fieldName": "dsh-mcp-ops-EnvPanel-fieldName", "fieldValue": "dsh-mcp-ops-EnvPanel-fieldValue", "input": "dsh-mcp-ops-EnvPanel-input", "checkbox": "dsh-mcp-ops-EnvPanel-checkbox", "remove": "dsh-mcp-ops-EnvPanel-remove", "dialog": "dsh-mcp-ops-EnvPanel-dialog", "modal": "dsh-mcp-ops-EnvPanel-modal", "modalTitle": "dsh-mcp-ops-EnvPanel-modalTitle", "batchHint": "dsh-mcp-ops-EnvPanel-batchHint", "textarea": "dsh-mcp-ops-EnvPanel-textarea", "batchActions": "dsh-mcp-ops-EnvPanel-batchActions", "batchButtons": "dsh-mcp-ops-EnvPanel-batchButtons", "actions": "dsh-mcp-ops-EnvPanel-actions", "note": "dsh-mcp-ops-EnvPanel-note", "error": "dsh-mcp-ops-EnvPanel-error", "saved": "dsh-mcp-ops-EnvPanel-saved" };
752
766
 
753
767
  // src/client/sections/EnvPanel.tsx
@@ -951,18 +965,6 @@ function EnvPanel(props) {
951
965
  }
952
966
 
953
967
  // src/client/sections/InjectionMode.module.css
954
- (function() {
955
- if (typeof document !== "undefined") {
956
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="InjectionMode.module.css"]');
957
- if (!existing) {
958
- const style = document.createElement("style");
959
- style.setAttribute("data-plugin", "dsh-mcp-ops");
960
- style.setAttribute("data-file", "InjectionMode.module.css");
961
- style.textContent = "\n\n.dsh-mcp-ops-InjectionMode-panel {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 2px 0;\n}\n\n.dsh-mcp-ops-InjectionMode-option {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n font-size: 13px;\n line-height: 20px;\n cursor: pointer;\n}\n\n.dsh-mcp-ops-InjectionMode-option input {\n margin-top: 3px;\n}\n\n.dsh-mcp-ops-InjectionMode-hint {\n margin: 2px 0 0;\n font-size: 12px;\n line-height: 18px;\n opacity: 0.65;\n}\n";
962
- document.head.appendChild(style);
963
- }
964
- }
965
- })();
966
968
  var InjectionMode_default = { "panel": "dsh-mcp-ops-InjectionMode-panel", "option": "dsh-mcp-ops-InjectionMode-option", "hint": "dsh-mcp-ops-InjectionMode-hint" };
967
969
 
968
970
  // src/client/sections/InjectionMode.tsx
@@ -971,7 +973,7 @@ var MODE_INPUT_NAME = "mcp-ops-injection-mode";
971
973
  function InjectionMode(props) {
972
974
  const { t, mode, busy } = props;
973
975
  return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("section", { className: InjectionMode_default.panel, "data-plugin": "dsh-mcp-ops", "data-section": "injection-mode", "data-mode": mode, children: [
974
- ["search", "full"].map((value) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: InjectionMode_default.option, "data-mode": value, children: [
976
+ ["on-demand", "eager"].map((value) => /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("label", { className: InjectionMode_default.option, "data-mode": value, children: [
975
977
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
976
978
  "input",
977
979
  {
@@ -984,9 +986,9 @@ function InjectionMode(props) {
984
986
  }
985
987
  }
986
988
  ),
987
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: value === "search" ? t("modeSearch") : t("modeFull") })
989
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { children: value === "on-demand" ? t("modeSearch") : t("modeFull") })
988
990
  ] }, value)),
989
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: InjectionMode_default.hint, children: mode === "search" ? t("modeHintSearch") : t("modeHintFull") })
991
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: InjectionMode_default.hint, children: mode === "on-demand" ? t("modeHintSearch") : t("modeHintFull") })
990
992
  ] });
991
993
  }
992
994
 
@@ -994,19 +996,7 @@ function InjectionMode(props) {
994
996
  var import_react2 = require("react");
995
997
 
996
998
  // src/client/sections/ServerForm.module.css
997
- (function() {
998
- if (typeof document !== "undefined") {
999
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ServerForm.module.css"]');
1000
- if (!existing) {
1001
- const style = document.createElement("style");
1002
- style.setAttribute("data-plugin", "dsh-mcp-ops");
1003
- style.setAttribute("data-file", "ServerForm.module.css");
1004
- style.textContent = "\n\n.dsh-mcp-ops-ServerForm-form {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 14px;\n border: 1px solid color-mix(in srgb, currentColor 18%, transparent);\n border-radius: 10px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.dsh-mcp-ops-ServerForm-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n}\n\n.dsh-mcp-ops-ServerForm-headActions {\n display: flex;\n flex: none;\n gap: 8px;\n}\n\n\n.dsh-mcp-ops-ServerForm-gridName {\n display: grid;\n grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);\n gap: 12px;\n align-items: end;\n}\n\n\n.dsh-mcp-ops-ServerForm-gridTransport {\n display: grid;\n grid-template-columns: minmax(272px, 1fr) minmax(0, 2fr);\n gap: 12px;\n align-items: end;\n}\n\n.dsh-mcp-ops-ServerForm-field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n font-size: 13px;\n min-width: 0;\n}\n\n\n.dsh-mcp-ops-ServerForm-label {\n opacity: 0.8;\n}\n\n\n.dsh-mcp-ops-ServerForm-field textarea {\n width: 100%;\n max-width: 100%;\n min-width: 0;\n box-sizing: border-box;\n padding: 5px 8px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n}\n\n.dsh-mcp-ops-ServerForm-field textarea:disabled {\n opacity: 0.5;\n}\n\n\n.dsh-mcp-ops-ServerForm-transportWrap,\n.dsh-mcp-ops-ServerForm-transportMenu {\n display: block;\n width: 100%;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-transportTrigger {\n width: 100%;\n justify-content: space-between;\n}\n\n\n.dsh-mcp-ops-ServerForm-transportLabel {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.dsh-mcp-ops-ServerForm-transportChevron {\n display: inline-flex;\n width: 16px;\n height: 16px;\n align-items: center;\n justify-content: center;\n color: var(--dsw-alias-label-tertiary);\n}\n\n\n.dsh-mcp-ops-ServerForm-fieldInput {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-field textarea {\n resize: vertical;\n}\n\n.dsh-mcp-ops-ServerForm-hint,\n.dsh-mcp-ops-ServerForm-preview,\n.dsh-mcp-ops-ServerForm-warn {\n font-size: 12px;\n line-height: 18px;\n opacity: 0.6;\n}\n\n.dsh-mcp-ops-ServerForm-preview {\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n overflow-wrap: anywhere;\n}\n\n.dsh-mcp-ops-ServerForm-warn {\n color: #b26a00;\n opacity: 0.9;\n}\n\n.dsh-mcp-ops-ServerForm-rows {\n display: flex;\n flex-direction: column;\n gap: 6px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-rowLine {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n}\n\n\n.dsh-mcp-ops-ServerForm-keyInput {\n flex: 0 0 auto;\n width: 162px;\n}\n\n.dsh-mcp-ops-ServerForm-valueInput {\n flex: 1 1 0;\n}\n\n\n.dsh-mcp-ops-ServerForm-field input[type='checkbox'] {\n width: auto;\n max-width: none;\n padding: 0;\n border: 0;\n border-radius: 0;\n}\n\n\n.dsh-mcp-ops-ServerForm-checkWrap {\n display: inline-flex;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-rowCheck {\n flex: none;\n font-size: 12px;\n opacity: 0.8;\n white-space: nowrap;\n}\n\n\n.dsh-mcp-ops-ServerForm-oauthCheck {\n align-self: flex-start;\n}\n\n.dsh-mcp-ops-ServerForm-remove {\n flex: none;\n width: 24px;\n height: 24px;\n padding: 0;\n color: #d14343;\n font-size: 16px;\n line-height: 1;\n}\n\n\n.dsh-mcp-ops-ServerForm-fieldCheck {\n padding-bottom: 6px;\n font-size: 13px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-actions {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding-top: 2px;\n}\n\n.dsh-mcp-ops-ServerForm-actionButtons {\n display: inline-flex;\n flex: none;\n align-items: center;\n gap: 8px;\n}\n\n\n\n\n.dsh-mcp-ops-ServerForm-danger {\n color: #d14343;\n border-color: color-mix(in srgb, #d14343 60%, transparent);\n}\n\n\n.dsh-mcp-ops-ServerForm-secondary {\n align-self: flex-start;\n}\n\n\n.dsh-mcp-ops-ServerForm-problem {\n flex: 1 1 auto;\n min-width: 0;\n min-height: 18px;\n color: #d14343;\n font-size: 12px;\n line-height: 18px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.dsh-mcp-ops-ServerForm-testResult {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n}\n\n.dsh-mcp-ops-ServerForm-testResult[data-ok='true'] {\n color: #1e8449;\n}\n\n.dsh-mcp-ops-ServerForm-testResult[data-ok='false'] {\n color: #d14343;\n}\n";
1005
- document.head.appendChild(style);
1006
- }
1007
- }
1008
- })();
1009
- var ServerForm_default = { "form": "dsh-mcp-ops-ServerForm-form", "head": "dsh-mcp-ops-ServerForm-head", "title": "dsh-mcp-ops-ServerForm-title", "headActions": "dsh-mcp-ops-ServerForm-headActions", "gridName": "dsh-mcp-ops-ServerForm-gridName", "gridTransport": "dsh-mcp-ops-ServerForm-gridTransport", "field": "dsh-mcp-ops-ServerForm-field", "label": "dsh-mcp-ops-ServerForm-label", "transportWrap": "dsh-mcp-ops-ServerForm-transportWrap", "transportMenu": "dsh-mcp-ops-ServerForm-transportMenu", "transportTrigger": "dsh-mcp-ops-ServerForm-transportTrigger", "transportLabel": "dsh-mcp-ops-ServerForm-transportLabel", "transportChevron": "dsh-mcp-ops-ServerForm-transportChevron", "fieldInput": "dsh-mcp-ops-ServerForm-fieldInput", "hint": "dsh-mcp-ops-ServerForm-hint", "preview": "dsh-mcp-ops-ServerForm-preview", "warn": "dsh-mcp-ops-ServerForm-warn", "rows": "dsh-mcp-ops-ServerForm-rows", "rowLine": "dsh-mcp-ops-ServerForm-rowLine", "keyInput": "dsh-mcp-ops-ServerForm-keyInput", "valueInput": "dsh-mcp-ops-ServerForm-valueInput", "checkWrap": "dsh-mcp-ops-ServerForm-checkWrap", "rowCheck": "dsh-mcp-ops-ServerForm-rowCheck", "oauthCheck": "dsh-mcp-ops-ServerForm-oauthCheck", "remove": "dsh-mcp-ops-ServerForm-remove", "fieldCheck": "dsh-mcp-ops-ServerForm-fieldCheck", "actions": "dsh-mcp-ops-ServerForm-actions", "actionButtons": "dsh-mcp-ops-ServerForm-actionButtons", "danger": "dsh-mcp-ops-ServerForm-danger", "secondary": "dsh-mcp-ops-ServerForm-secondary", "problem": "dsh-mcp-ops-ServerForm-problem", "testResult": "dsh-mcp-ops-ServerForm-testResult" };
999
+ var ServerForm_default = { "form": "dsh-mcp-ops-ServerForm-form", "head": "dsh-mcp-ops-ServerForm-head", "title": "dsh-mcp-ops-ServerForm-title", "headActions": "dsh-mcp-ops-ServerForm-headActions", "gridName": "dsh-mcp-ops-ServerForm-gridName", "gridTransport": "dsh-mcp-ops-ServerForm-gridTransport", "gridOAuth": "dsh-mcp-ops-ServerForm-gridOAuth", "field": "dsh-mcp-ops-ServerForm-field", "label": "dsh-mcp-ops-ServerForm-label", "transportWrap": "dsh-mcp-ops-ServerForm-transportWrap", "transportMenu": "dsh-mcp-ops-ServerForm-transportMenu", "transportTrigger": "dsh-mcp-ops-ServerForm-transportTrigger", "transportLabel": "dsh-mcp-ops-ServerForm-transportLabel", "transportChevron": "dsh-mcp-ops-ServerForm-transportChevron", "fieldInput": "dsh-mcp-ops-ServerForm-fieldInput", "hint": "dsh-mcp-ops-ServerForm-hint", "preview": "dsh-mcp-ops-ServerForm-preview", "warn": "dsh-mcp-ops-ServerForm-warn", "oauthActions": "dsh-mcp-ops-ServerForm-oauthActions", "oauthStatus": "dsh-mcp-ops-ServerForm-oauthStatus", "rows": "dsh-mcp-ops-ServerForm-rows", "rowLine": "dsh-mcp-ops-ServerForm-rowLine", "keyInput": "dsh-mcp-ops-ServerForm-keyInput", "valueInput": "dsh-mcp-ops-ServerForm-valueInput", "checkWrap": "dsh-mcp-ops-ServerForm-checkWrap", "rowCheck": "dsh-mcp-ops-ServerForm-rowCheck", "oauthCheck": "dsh-mcp-ops-ServerForm-oauthCheck", "remove": "dsh-mcp-ops-ServerForm-remove", "fieldCheck": "dsh-mcp-ops-ServerForm-fieldCheck", "actions": "dsh-mcp-ops-ServerForm-actions", "actionButtons": "dsh-mcp-ops-ServerForm-actionButtons", "danger": "dsh-mcp-ops-ServerForm-danger", "secondary": "dsh-mcp-ops-ServerForm-secondary", "problem": "dsh-mcp-ops-ServerForm-problem", "testResult": "dsh-mcp-ops-ServerForm-testResult" };
1010
1000
 
1011
1001
  // src/client/validate.ts
1012
1002
  var REF_SAFE_SERVER_NAME_RE = /^[A-Za-z0-9_]{1,32}$/;
@@ -1034,6 +1024,8 @@ function emptyFormValue() {
1034
1024
  env: [],
1035
1025
  timeoutMs: "",
1036
1026
  oauth: false,
1027
+ oauthScope: "",
1028
+ oauthClientId: "",
1037
1029
  enabled: true
1038
1030
  };
1039
1031
  }
@@ -1054,7 +1046,11 @@ function formToInput(value) {
1054
1046
  } : {
1055
1047
  url: value.url.trim(),
1056
1048
  headers: value.headers.filter((row) => row.name.trim() !== ""),
1057
- oauth: value.oauth
1049
+ oauth: value.oauth,
1050
+ // scope / clientId 是**可选覆盖**:空串一律省略(host 对缺省字段不动已存值,
1051
+ // 取消勾选时才会清)。只在勾了 OAuth 时送,避免给非 OAuth 服务写无意义的覆盖行。
1052
+ ...value.oauth && value.oauthScope.trim() !== "" ? { oauthScope: value.oauthScope.trim() } : {},
1053
+ ...value.oauth && value.oauthClientId.trim() !== "" ? { oauthClientId: value.oauthClientId.trim() } : {}
1058
1054
  },
1059
1055
  // 密钥行照旧只送 name/value/secret(真值留空即"保留")。
1060
1056
  env: value.env.filter((row) => row.name.trim() !== "").map((row) => ({ name: row.name.trim(), value: row.value, secret: row.secret })),
@@ -1134,6 +1130,10 @@ function formValueOf(server) {
1134
1130
  })),
1135
1131
  timeoutMs: server.toolCallTimeoutMs === void 0 ? "" : String(server.toolCallTimeoutMs),
1136
1132
  oauth: server.oauth,
1133
+ // 视图不暴露 `oauthScope` / `oauthClientId`(host 只把它们写进 `configs.overlays`),
1134
+ // 所以编辑态一律回显空串:保存时省略 = 不覆盖(见 `ServerFormValue.oauthScope` 的说明)。
1135
+ oauthScope: "",
1136
+ oauthClientId: "",
1137
1137
  enabled: server.enabled
1138
1138
  };
1139
1139
  }
@@ -1163,6 +1163,9 @@ function ServerForm(props) {
1163
1163
  const blocked = problems.some((problem2) => problem2.kind === "error");
1164
1164
  const problem = problems[0];
1165
1165
  const problemText = props.error !== void 0 && props.error !== null ? `${t("errorTitle")}\uFF1A${props.error}` : problem === void 0 ? "" : t(problem.messageKey, problem.params);
1166
+ const attempt = props.oauthAttempt ?? null;
1167
+ const oauthPending = attempt !== null && (attempt.phase === "starting" || attempt.phase === "waiting-browser" || attempt.phase === "exchanging" || attempt.phase === "committing");
1168
+ const oauthStatus = attempt === null || attempt.phase === "waiting-browser" && props.oauthUrl !== void 0 && props.oauthUrl !== null ? null : attempt.phase === "authorized" ? t("oauthDone") : attempt.phase === "failed" ? t("oauthFailed", { message: attempt.lastError ?? "" }) : attempt.phase === "cancelled" ? t("oauthCancelled") : attempt.phase === "waiting-browser" ? t("oauthWaiting") : t("oauthInProgress");
1166
1169
  const submit = (event) => {
1167
1170
  event.preventDefault();
1168
1171
  if (blocked) {
@@ -1394,8 +1397,54 @@ function ServerForm(props) {
1394
1397
  }
1395
1398
  ) }),
1396
1399
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: ServerForm_default.hint, children: t("formOAuthHint") }),
1397
- value.oauth && props.onOAuth !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "outline", className: ServerForm_default.secondary, disabled: busy, "data-role": "form-authorize", onClick: () => props.onOAuth?.(value), children: t("formAuthorize") }) }) : null,
1398
- props.oauthUrl === void 0 || props.oauthUrl === null ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("small", { className: ServerForm_default.hint, children: [
1400
+ value.oauth ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
1401
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.gridOAuth, children: [
1402
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: ServerForm_default.field, children: [
1403
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: t("oauthScope") }),
1404
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1405
+ import_dsh_client_ui_primitives3.Input,
1406
+ {
1407
+ className: ServerForm_default.fieldInput,
1408
+ value: value.oauthScope,
1409
+ disabled: busy,
1410
+ placeholder: t("oauthScopeHint"),
1411
+ "data-role": "form-oauth-scope",
1412
+ onChange: (event) => patch({ oauthScope: event.target.value })
1413
+ }
1414
+ )
1415
+ ] }),
1416
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("label", { className: ServerForm_default.field, children: [
1417
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("span", { className: ServerForm_default.label, children: t("oauthClientId") }),
1418
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1419
+ import_dsh_client_ui_primitives3.Input,
1420
+ {
1421
+ className: ServerForm_default.fieldInput,
1422
+ value: value.oauthClientId,
1423
+ disabled: busy,
1424
+ placeholder: t("oauthClientIdHint"),
1425
+ "data-role": "form-oauth-client-id",
1426
+ onChange: (event) => patch({ oauthClientId: event.target.value })
1427
+ }
1428
+ )
1429
+ ] })
1430
+ ] }),
1431
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: ServerForm_default.oauthActions, children: [
1432
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
1433
+ import_dsh_client_ui_primitives3.Button,
1434
+ {
1435
+ variant: "outline",
1436
+ className: ServerForm_default.secondary,
1437
+ disabled: busy || value.serverName.trim() === "",
1438
+ "data-role": "form-authorize",
1439
+ onClick: () => props.onOAuth?.(value.serverName.trim()),
1440
+ children: t("oauthAuthorize")
1441
+ }
1442
+ ),
1443
+ oauthPending && props.onOAuthCancel !== void 0 ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_dsh_client_ui_primitives3.Button, { variant: "ghost", disabled: busy, "data-role": "form-oauth-cancel", onClick: props.onOAuthCancel, children: t("oauthCancel") }) : null
1444
+ ] })
1445
+ ] }) : null,
1446
+ oauthStatus === null ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: ServerForm_default.oauthStatus, role: "status", "data-role": "oauth-status", "data-phase": attempt?.phase, children: oauthStatus }),
1447
+ props.oauthUrl === void 0 || props.oauthUrl === null ? null : /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("small", { className: ServerForm_default.hint, "data-role": "oauth-url", children: [
1399
1448
  t("formAuthorizeHint"),
1400
1449
  " ",
1401
1450
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: props.oauthUrl, target: "_blank", rel: "noreferrer", children: props.oauthUrl })
@@ -1472,51 +1521,15 @@ function RowEditor(props) {
1472
1521
  }
1473
1522
 
1474
1523
  // src/client/sections/ServerList.module.css
1475
- (function() {
1476
- if (typeof document !== "undefined") {
1477
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ServerList.module.css"]');
1478
- if (!existing) {
1479
- const style = document.createElement("style");
1480
- style.setAttribute("data-plugin", "dsh-mcp-ops");
1481
- style.setAttribute("data-file", "ServerList.module.css");
1482
- style.textContent = "\n\n\n.dsh-mcp-ops-ServerList-head {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 12px;\n}\n\n.dsh-mcp-ops-ServerList-headActions {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: none;\n}\n\n\n\n.dsh-mcp-ops-ServerList-fileNotice {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-ServerList-note {\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-ServerList-cards {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n";
1483
- document.head.appendChild(style);
1484
- }
1485
- }
1486
- })();
1487
1524
  var ServerList_default = { "head": "dsh-mcp-ops-ServerList-head", "headActions": "dsh-mcp-ops-ServerList-headActions", "fileNotice": "dsh-mcp-ops-ServerList-fileNotice", "note": "dsh-mcp-ops-ServerList-note", "cards": "dsh-mcp-ops-ServerList-cards" };
1488
1525
 
1489
1526
  // src/client/sections/ServerList.tsx
1490
1527
  var import_dsh_client_ui_primitives5 = require("@deepseek-ai/dsh-client-ui-primitives");
1491
1528
 
1492
1529
  // src/client/sections/ServerCard.module.css
1493
- (function() {
1494
- if (typeof document !== "undefined") {
1495
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ServerCard.module.css"]');
1496
- if (!existing) {
1497
- const style = document.createElement("style");
1498
- style.setAttribute("data-plugin", "dsh-mcp-ops");
1499
- style.setAttribute("data-file", "ServerCard.module.css");
1500
- style.textContent = "\n\n.dsh-mcp-ops-ServerCard-card {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 12px 14px;\n border: 1px solid color-mix(in srgb, currentColor 18%, transparent);\n border-radius: 10px;\n}\n\n\n.dsh-mcp-ops-ServerCard-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.dsh-mcp-ops-ServerCard-identity {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerCard-name {\n font-size: 14px;\n font-weight: 600;\n}\n\n\n.dsh-mcp-ops-ServerCard-badge {\n margin-left: 6px;\n}\n\n.dsh-mcp-ops-ServerCard-errorMark {\n display: inline-flex;\n align-items: center;\n margin-left: 6px;\n}\n\n\n.dsh-mcp-ops-ServerCard-meta {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n justify-content: flex-start;\n gap: 6px;\n font-size: 12px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-ServerCard-actions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n justify-content: flex-end;\n flex: none;\n gap: 6px;\n}\n\n\n\n";
1501
- document.head.appendChild(style);
1502
- }
1503
- }
1504
- })();
1505
1530
  var ServerCard_default = { "card": "dsh-mcp-ops-ServerCard-card", "row": "dsh-mcp-ops-ServerCard-row", "identity": "dsh-mcp-ops-ServerCard-identity", "name": "dsh-mcp-ops-ServerCard-name", "badge": "dsh-mcp-ops-ServerCard-badge", "errorMark": "dsh-mcp-ops-ServerCard-errorMark", "meta": "dsh-mcp-ops-ServerCard-meta", "actions": "dsh-mcp-ops-ServerCard-actions" };
1506
1531
 
1507
1532
  // src/client/sections/ToolSelector.module.css
1508
- (function() {
1509
- if (typeof document !== "undefined") {
1510
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ToolSelector.module.css"]');
1511
- if (!existing) {
1512
- const style = document.createElement("style");
1513
- style.setAttribute("data-plugin", "dsh-mcp-ops");
1514
- style.setAttribute("data-file", "ToolSelector.module.css");
1515
- style.textContent = "\n\n.dsh-mcp-ops-ToolSelector-list {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 10px 0 0;\n padding: 10px 12px;\n border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);\n list-style: none;\n}\n\n.dsh-mcp-ops-ToolSelector-item {\n font-size: 13px;\n}\n\n.dsh-mcp-ops-ToolSelector-label {\n display: flex;\n \n align-items: flex-start;\n gap: 6px;\n cursor: pointer;\n}\n\n.dsh-mcp-ops-ToolSelector-label input {\n margin-top: 3px;\n flex: none;\n}\n\n.dsh-mcp-ops-ToolSelector-text {\n display: flex;\n flex-direction: column;\n gap: 1px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ToolSelector-name {\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 12.5px;\n \n font-weight: 700;\n overflow-wrap: anywhere;\n}\n\n.dsh-mcp-ops-ToolSelector-description {\n font-size: 12px;\n line-height: 17px;\n opacity: 0.68;\n overflow-wrap: anywhere;\n}\n\n.dsh-mcp-ops-ToolSelector-note {\n margin: 10px 0 0;\n font-size: 12px;\n opacity: 0.6;\n}\n";
1516
- document.head.appendChild(style);
1517
- }
1518
- }
1519
- })();
1520
1533
  var ToolSelector_default = { "list": "dsh-mcp-ops-ToolSelector-list", "item": "dsh-mcp-ops-ToolSelector-item", "label": "dsh-mcp-ops-ToolSelector-label", "text": "dsh-mcp-ops-ToolSelector-text", "name": "dsh-mcp-ops-ToolSelector-name", "description": "dsh-mcp-ops-ToolSelector-description", "note": "dsh-mcp-ops-ToolSelector-note" };
1521
1534
 
1522
1535
  // src/client/sections/ToolSelector.tsx
@@ -1524,7 +1537,7 @@ var import_jsx_runtime7 = require("react/jsx-runtime");
1524
1537
  function ToolSelector(props) {
1525
1538
  const { t, tools, busy, pending } = props;
1526
1539
  if (tools.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: ToolSelector_default.note, children: t("toolsNone") });
1527
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: ToolSelector_default.list, "data-role": "tool-selector", children: tools.map((tool) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { className: ToolSelector_default.item, "data-tool": tool.name, "data-enabled": String(tool.enabled), "data-hot": String(tool.hot), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: ToolSelector_default.label, children: [
1540
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("ul", { className: ToolSelector_default.list, "data-role": "tool-selector", children: tools.map((tool) => /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("li", { className: ToolSelector_default.item, "data-tool": tool.name, "data-enabled": String(tool.enabled), children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("label", { className: ToolSelector_default.label, children: [
1528
1541
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1529
1542
  "input",
1530
1543
  {
@@ -1556,6 +1569,9 @@ function badgeTone(server) {
1556
1569
  return "info";
1557
1570
  case "stopped-conflict":
1558
1571
  return "warning";
1572
+ // 0.3.0:官方 OAuth 没有可用 grant 时进入这个相位 —— 不是故障,是"等人操作",用 warning。
1573
+ case "waiting-authorization":
1574
+ return "warning";
1559
1575
  default:
1560
1576
  return "neutral";
1561
1577
  }
@@ -1571,6 +1587,8 @@ function badgeKey(server) {
1571
1587
  return "phaseMounting";
1572
1588
  case "stopped-conflict":
1573
1589
  return "phaseStoppedConflict";
1590
+ case "waiting-authorization":
1591
+ return "phaseWaitingAuth";
1574
1592
  default:
1575
1593
  return "phaseStopped";
1576
1594
  }
@@ -1579,6 +1597,9 @@ function ServerCard(props) {
1579
1597
  const { t, server, busy } = props;
1580
1598
  const composition = server.source === "cordis";
1581
1599
  const badge = badgeKey(server);
1600
+ const phase = server.status.phase;
1601
+ const showAuthorize = server.oauth && (!server.enabled || phase === "waiting-authorization");
1602
+ const showSignOut = server.oauth && (phase === "live" || phase === "waiting-authorization" || phase === "failed");
1582
1603
  const problems = server.diagnostics.filter((entry) => entry.level !== "info");
1583
1604
  const mountError = server.enabled ? server.status.error : void 0;
1584
1605
  const marker = mountError === void 0 && problems.length === 0 ? void 0 : [
@@ -1614,6 +1635,8 @@ function ServerCard(props) {
1614
1635
  server.capabilities.adoptable ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "adopt", onClick: () => props.actions.onAdopt(server), children: t("adopt") }) : null,
1615
1636
  server.capabilities.adopted ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "release", onClick: () => props.actions.onRelease(server), children: t("release") }) : null,
1616
1637
  !composition ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "toggle", onClick: () => props.actions.onToggleEnabled(server), children: server.enabled ? t("disable") : t("enable") }) : null,
1638
+ showAuthorize ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "authorize", onClick: () => props.actions.onAuthorize(server), children: t("oauthAuthorize") }) : null,
1639
+ showSignOut ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "oauth-sign-out", onClick: () => props.actions.onSignOut(server), children: t("oauthSignOut") }) : null,
1617
1640
  /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, title: t("refreshHint"), "data-action": "refresh", onClick: () => props.actions.onRefresh(server), children: busy ? t("refreshing") : t("refresh") }),
1618
1641
  server.status.tools.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "expand", onClick: () => props.actions.onToggleExpand(server.serverName), children: props.expanded ? t("collapseTools") : t("expandTools") }) : null,
1619
1642
  server.writable ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_dsh_client_ui_primitives4.Button, { variant: "outline", size: "sm", disabled: busy, "data-action": "edit", onClick: () => props.actions.onEdit(server), children: t("edit") }) : null
@@ -1684,6 +1707,10 @@ var TABS_ID = "mcp-ops-tabs";
1684
1707
  function panelId(tab) {
1685
1708
  return `${TABS_ID}-${tab}-panel`;
1686
1709
  }
1710
+ function openAuthorizationPage(url) {
1711
+ if (typeof window === "undefined") return;
1712
+ window.open(url, "_blank", "noopener");
1713
+ }
1687
1714
  function McpOpsSection(props) {
1688
1715
  const t = props.t;
1689
1716
  const propsRef = (0, import_react3.useRef)(props);
@@ -1698,6 +1725,8 @@ function McpOpsSection(props) {
1698
1725
  const [confirm, setConfirm] = (0, import_react3.useState)(null);
1699
1726
  const [testResult, setTestResult] = (0, import_react3.useState)(null);
1700
1727
  const [oauthUrl, setOAuthUrl] = (0, import_react3.useState)(null);
1728
+ const [oauthAttempt, setOAuthAttempt] = (0, import_react3.useState)(null);
1729
+ const [oauthServer, setOAuthServer] = (0, import_react3.useState)(null);
1701
1730
  const [expanded, setExpanded] = (0, import_react3.useState)(/* @__PURE__ */ new Set());
1702
1731
  const [tools, setTools] = (0, import_react3.useState)(null);
1703
1732
  const [pendingTool, setPendingTool] = (0, import_react3.useState)(null);
@@ -1727,6 +1756,8 @@ function McpOpsSection(props) {
1727
1756
  setEditing(null);
1728
1757
  setTestResult(null);
1729
1758
  setOAuthUrl(null);
1759
+ setOAuthAttempt(null);
1760
+ setOAuthServer(null);
1730
1761
  setFormError(null);
1731
1762
  }, []);
1732
1763
  const run = (0, import_react3.useCallback)(async (action, done, options = {}) => {
@@ -1806,15 +1837,103 @@ function McpOpsSection(props) {
1806
1837
  setError(null);
1807
1838
  }).catch((problem) => setError(problem instanceof Error ? problem.message : String(problem))).finally(() => setBusy(false));
1808
1839
  };
1809
- const startOAuth = (value) => {
1810
- const input = formToInput(value);
1811
- if (input.url === void 0 || input.url === "") return;
1840
+ const replaceServers = (0, import_react3.useCallback)((servers2) => {
1841
+ setData((current) => current === null ? current : { ...current, servers: servers2 });
1842
+ }, []);
1843
+ const attemptText = (attempt) => {
1844
+ switch (attempt.phase) {
1845
+ case "authorized":
1846
+ return t("oauthDone");
1847
+ case "failed":
1848
+ return t("oauthFailed", { message: attempt.lastError ?? "" });
1849
+ case "cancelled":
1850
+ return t("oauthCancelled");
1851
+ case "waiting-browser":
1852
+ return t("oauthWaiting");
1853
+ default:
1854
+ return t("oauthInProgress");
1855
+ }
1856
+ };
1857
+ const startOAuth = (serverName) => {
1858
+ const name = serverName.trim();
1859
+ if (name === "") return;
1812
1860
  setBusy(true);
1813
- void propsRef.current.oauthStart(input.serverName === "" ? "probe" : input.serverName, input.url).then((payload) => {
1814
- setOAuthUrl(payload.authorizeUrl);
1861
+ setOAuthUrl(null);
1862
+ setOAuthAttempt(null);
1863
+ setOAuthServer(null);
1864
+ void propsRef.current.oauthStart(name).then((started) => {
1865
+ replaceServers(started.servers);
1815
1866
  setError(null);
1867
+ setFormError(null);
1868
+ setOAuthUrl(started.attempt.authorizationUrl ?? null);
1869
+ setOAuthAttempt(started.attempt);
1870
+ setOAuthServer(name);
1871
+ if (started.attempt.authorizationUrl !== void 0) {
1872
+ openAuthorizationPage(started.attempt.authorizationUrl);
1873
+ }
1874
+ }).catch((problem) => {
1875
+ const message = problem instanceof Error ? problem.message : String(problem);
1876
+ setError(message);
1877
+ setFormError(message);
1878
+ }).finally(() => setBusy(false));
1879
+ };
1880
+ const cancelOAuth = () => {
1881
+ if (oauthAttempt === null || oauthServer === null) return;
1882
+ setBusy(true);
1883
+ void propsRef.current.oauthCancel(oauthServer, oauthAttempt.attemptId).then((payload) => {
1884
+ replaceServers(payload.servers);
1885
+ setOAuthUrl(null);
1886
+ setOAuthAttempt(null);
1887
+ setOAuthServer(null);
1888
+ setError(null);
1889
+ setFormError(null);
1890
+ }).catch((problem) => {
1891
+ const message = problem instanceof Error ? problem.message : String(problem);
1892
+ setError(message);
1893
+ setFormError(message);
1894
+ }).finally(() => setBusy(false));
1895
+ };
1896
+ const authorizeOne = (server) => {
1897
+ setBusy(true);
1898
+ void propsRef.current.oauthStart(server.serverName).then((started) => {
1899
+ replaceServers(started.servers);
1900
+ if (started.attempt.authorizationUrl !== void 0) {
1901
+ openAuthorizationPage(started.attempt.authorizationUrl);
1902
+ setNote(t("oauthWaiting"));
1903
+ setError(null);
1904
+ return;
1905
+ }
1906
+ const text = attemptText(started.attempt);
1907
+ if (started.attempt.phase === "failed") {
1908
+ setError(text);
1909
+ setNote(null);
1910
+ } else {
1911
+ setNote(text);
1912
+ setError(null);
1913
+ }
1914
+ }).catch((problem) => {
1915
+ setError(problem instanceof Error ? problem.message : String(problem));
1916
+ setNote(null);
1917
+ }).finally(() => setBusy(false));
1918
+ };
1919
+ const signOutOne = (server) => {
1920
+ setBusy(true);
1921
+ void propsRef.current.oauthSignOut(server.serverName).then(async (payload) => {
1922
+ replaceServers(payload.servers);
1923
+ setError(null);
1924
+ setNote(t("oauthSignedOut"));
1925
+ await loadTools();
1816
1926
  }).catch((problem) => setError(problem instanceof Error ? problem.message : String(problem))).finally(() => setBusy(false));
1817
1927
  };
1928
+ const askSignOut = (server) => {
1929
+ setConfirm({
1930
+ title: t("oauthSignOut"),
1931
+ body: t("oauthSignOutConfirm"),
1932
+ yes: t("oauthSignOut"),
1933
+ danger: true,
1934
+ run: () => signOutOne(server)
1935
+ });
1936
+ };
1818
1937
  const adoptOne = (server) => {
1819
1938
  setBusy(true);
1820
1939
  void propsRef.current.adopt(server.serverName).then(async (payload) => {
@@ -1874,6 +1993,8 @@ function McpOpsSection(props) {
1874
1993
  setEditing(formValueOf(server));
1875
1994
  setTestResult(null);
1876
1995
  setOAuthUrl(null);
1996
+ setOAuthAttempt(null);
1997
+ setOAuthServer(null);
1877
1998
  setNote(null);
1878
1999
  setFormError(null);
1879
2000
  },
@@ -1881,6 +2002,8 @@ function McpOpsSection(props) {
1881
2002
  onRefresh: (server) => void run(async () => await propsRef.current.refreshServer(server.serverName), t("refreshed")),
1882
2003
  onAdopt: (server) => askAdopt(server),
1883
2004
  onRelease: (server) => askRelease(server),
2005
+ onAuthorize: (server) => authorizeOne(server),
2006
+ onSignOut: (server) => askSignOut(server),
1884
2007
  onToggleTool: toggleTool
1885
2008
  };
1886
2009
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: McpOpsSection_default.panel, "data-plugin": "dsh-mcp-ops", "data-tab": tab, children: [
@@ -1915,6 +2038,8 @@ function McpOpsSection(props) {
1915
2038
  setEditing(emptyFormValue());
1916
2039
  setTestResult(null);
1917
2040
  setOAuthUrl(null);
2041
+ setOAuthAttempt(null);
2042
+ setOAuthServer(null);
1918
2043
  setNote(null);
1919
2044
  setFormError(null);
1920
2045
  },
@@ -1939,7 +2064,7 @@ function McpOpsSection(props) {
1939
2064
  await run(async () => await propsRef.current.envInject(enabled), t("saved"));
1940
2065
  }
1941
2066
  }
1942
- ) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: McpOpsSection_default.tabPanel, role: "tabpanel", id: panelId("mode"), "data-panel": "mode", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InjectionMode, { t, mode: tools?.mode ?? "search", busy, onChange: changeMode }) }),
2067
+ ) }) : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: McpOpsSection_default.tabPanel, role: "tabpanel", id: panelId("mode"), "data-panel": "mode", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(InjectionMode, { t, mode: tools?.mode ?? "eager", busy, onChange: changeMode }) }),
1943
2068
  editing === null ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1944
2069
  import_dsh_client_ui_primitives6.Modal,
1945
2070
  {
@@ -1957,11 +2082,13 @@ function McpOpsSection(props) {
1957
2082
  busy,
1958
2083
  testResult: testResult === null ? null : { ok: testResult.probe.ok, tools: testResult.probe.tools.map((tool) => tool.name), ...testResult.probe.message === void 0 ? {} : { message: testResult.probe.message } },
1959
2084
  oauthUrl,
2085
+ oauthAttempt,
1960
2086
  error: formError,
1961
2087
  onCancel: closeForm,
1962
2088
  onSubmit: submit,
1963
2089
  onTest: testOne,
1964
2090
  onOAuth: startOAuth,
2091
+ onOAuthCancel: cancelOAuth,
1965
2092
  ...editing.serverName === "" ? {} : { onDelete: () => askRemove(editing.serverName) }
1966
2093
  }
1967
2094
  ) })
@@ -2054,14 +2181,23 @@ async function activate(ctx) {
2054
2181
  envList: async () => await call(ctx, (api) => api.envList()),
2055
2182
  envSet: async (vars) => await call(ctx, (api) => api.envSet({ vars })),
2056
2183
  envInject: async (enabled) => await call(ctx, (api) => api.envInject({ enabled })),
2057
- // B81:把浏览器 origin 一路带到 host —— Web 组合下 OAuth 回调落在宿主 origin 的固定路径上,
2058
- // 回环只作为回退。SSR/无 window 的环境(以及钉死的 `file://` 壳)传 undefined,host 自动回退。
2059
- oauthStart: async (serverName, url) => await call(ctx, (api) => api.oauthStart({
2060
- serverName,
2061
- url,
2062
- ...typeof window === "undefined" ? {} : { origin: window.location.origin }
2063
- }))
2184
+ // 0.3.0:OAuth 委托官方 manager —— 浏览器半部只传服务名,URL / 回调 / origin 全由 host
2185
+ // 与官方 mcp-client 决定(B81 那条"把浏览器 origin 带给自研回调"的透传随 oauth-web 一起删除)。
2186
+ oauthStart: async (serverName) => await call(ctx, (api) => api.oauthStart({ serverName })),
2187
+ oauthCancel: async (serverName, attemptId) => await call(ctx, (api) => api.oauthCancel({ serverName, attemptId })),
2188
+ oauthSignOut: async (serverName) => await call(ctx, (api) => api.oauthSignOut({ serverName }))
2064
2189
  })
2065
2190
  }, McpOpsSection));
2066
2191
  }
2067
- return module.exports; } });
2192
+
2193
+ return module.exports; },
2194
+ meta: () => ({ stylesheets: {
2195
+ "src/client/McpOpsSection.module.css": { text: () => "\n\n.dsh-mcp-ops-McpOpsSection-panel {\n display: flex;\n flex-direction: column;\n gap: 14px;\n max-width: 960px;\n}\n\n\n.dsh-mcp-ops-McpOpsSection-tabs {\n margin-bottom: 2px;\n}\n\n.dsh-mcp-ops-McpOpsSection-tabPanel {\n display: flex;\n flex-direction: column;\n gap: 14px;\n}\n\n.dsh-mcp-ops-McpOpsSection-error {\n margin: 0;\n font-size: 13px;\n color: #d14343;\n}\n\n.dsh-mcp-ops-McpOpsSection-saved {\n margin: 0;\n font-size: 12px;\n color: #1e8449;\n}\n\n\n.dsh-mcp-ops-McpOpsSection-dialog {\n width: min(680px, 100%);\n \n padding: 0;\n}\n\n.dsh-mcp-ops-McpOpsSection-modal {\n width: 100%;\n max-height: 88vh;\n overflow-y: auto;\n}\n\n\n.dsh-mcp-ops-McpOpsSection-modal > form {\n border: none;\n border-radius: 12px;\n}\n\n" },
2196
+ "src/client/sections/ConfirmDialog.module.css": { text: () => "\n\n.dsh-mcp-ops-ConfirmDialog-dialog {\n width: min(420px, 100%);\n padding: 0;\n}\n\n.dsh-mcp-ops-ConfirmDialog-modal {\n display: flex;\n flex-direction: column;\n gap: 10px;\n width: 100%;\n padding: 14px;\n box-sizing: border-box;\n}\n\n.dsh-mcp-ops-ConfirmDialog-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n}\n\n.dsh-mcp-ops-ConfirmDialog-body {\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n opacity: 0.8;\n}\n\n.dsh-mcp-ops-ConfirmDialog-actions {\n display: flex;\n justify-content: flex-end;\n gap: 8px;\n padding-top: 2px;\n}\n\n\n\n.dsh-mcp-ops-ConfirmDialog-danger {\n color: #d14343;\n border-color: color-mix(in srgb, #d14343 60%, transparent);\n}\n" },
2197
+ "src/client/sections/EnvPanel.module.css": { text: () => "\n\n.dsh-mcp-ops-EnvPanel-panel {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n\n\n.dsh-mcp-ops-EnvPanel-toggle {\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: 13px;\n font-weight: 600;\n}\n\n.dsh-mcp-ops-EnvPanel-switchWrap {\n display: inline-flex;\n flex: none;\n}\n\n.dsh-mcp-ops-EnvPanel-hint {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n opacity: 0.65;\n}\n\n.dsh-mcp-ops-EnvPanel-intro {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-EnvPanel-rows {\n display: flex;\n flex-direction: column;\n gap: 8px;\n}\n\n.dsh-mcp-ops-EnvPanel-rowLine {\n display: flex;\n align-items: center;\n gap: 10px;\n}\n\n.dsh-mcp-ops-EnvPanel-field {\n flex: 1;\n min-width: 0;\n}\n\n\n.dsh-mcp-ops-EnvPanel-fieldName {\n flex: 35 1 0;\n}\n\n.dsh-mcp-ops-EnvPanel-fieldValue {\n flex: 65 1 0;\n}\n\n\n.dsh-mcp-ops-EnvPanel-input {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n}\n\n\n.dsh-mcp-ops-EnvPanel-checkbox {\n flex: none;\n font-size: 13px;\n}\n\n.dsh-mcp-ops-EnvPanel-remove {\n flex: none;\n width: 24px;\n height: 24px;\n padding: 0;\n color: #d14343;\n font-size: 16px;\n line-height: 1;\n}\n\n\n.dsh-mcp-ops-EnvPanel-dialog {\n width: min(520px, 100%);\n padding: 0;\n}\n\n.dsh-mcp-ops-EnvPanel-modal {\n display: flex;\n flex-direction: column;\n gap: 8px;\n width: 100%;\n padding: 14px;\n box-sizing: border-box;\n}\n\n.dsh-mcp-ops-EnvPanel-modalTitle {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n}\n\n.dsh-mcp-ops-EnvPanel-batchHint {\n margin: 0;\n font-size: 12px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-EnvPanel-textarea {\n width: 100%;\n box-sizing: border-box;\n resize: vertical;\n padding: 6px 8px;\n border: 1px solid color-mix(in srgb, currentColor 25%, transparent);\n border-radius: 6px;\n background: transparent;\n color: inherit;\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 12px;\n line-height: 18px;\n}\n\n\n.dsh-mcp-ops-EnvPanel-batchActions {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 10px;\n}\n\n.dsh-mcp-ops-EnvPanel-batchButtons {\n display: inline-flex;\n flex: none;\n align-items: center;\n gap: 10px;\n}\n\n\n.dsh-mcp-ops-EnvPanel-actions {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 10px;\n}\n\n\n\n.dsh-mcp-ops-EnvPanel-note,\n.dsh-mcp-ops-EnvPanel-error {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n}\n\n.dsh-mcp-ops-EnvPanel-note {\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-EnvPanel-error {\n color: #d14343;\n}\n\n.dsh-mcp-ops-EnvPanel-saved {\n font-size: 12px;\n color: #1e8449;\n}\n" },
2198
+ "src/client/sections/InjectionMode.module.css": { text: () => "\n\n.dsh-mcp-ops-InjectionMode-panel {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 2px 0;\n}\n\n.dsh-mcp-ops-InjectionMode-option {\n display: flex;\n align-items: flex-start;\n gap: 8px;\n font-size: 13px;\n line-height: 20px;\n cursor: pointer;\n}\n\n.dsh-mcp-ops-InjectionMode-option input {\n margin-top: 3px;\n}\n\n.dsh-mcp-ops-InjectionMode-hint {\n margin: 2px 0 0;\n font-size: 12px;\n line-height: 18px;\n opacity: 0.65;\n}\n" },
2199
+ "src/client/sections/ServerCard.module.css": { text: () => "\n\n.dsh-mcp-ops-ServerCard-card {\n display: flex;\n flex-direction: column;\n gap: 6px;\n padding: 12px 14px;\n border: 1px solid color-mix(in srgb, currentColor 18%, transparent);\n border-radius: 10px;\n}\n\n\n.dsh-mcp-ops-ServerCard-row {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.dsh-mcp-ops-ServerCard-identity {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n gap: 6px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerCard-name {\n font-size: 14px;\n font-weight: 600;\n}\n\n\n.dsh-mcp-ops-ServerCard-badge {\n margin-left: 6px;\n}\n\n.dsh-mcp-ops-ServerCard-errorMark {\n display: inline-flex;\n align-items: center;\n margin-left: 6px;\n}\n\n\n.dsh-mcp-ops-ServerCard-meta {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n justify-content: flex-start;\n gap: 6px;\n font-size: 12px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-ServerCard-actions {\n display: flex;\n align-items: center;\n flex-wrap: wrap;\n justify-content: flex-end;\n flex: none;\n gap: 6px;\n}\n\n\n\n" },
2200
+ "src/client/sections/ServerForm.module.css": { text: () => "\n\n.dsh-mcp-ops-ServerForm-form {\n display: flex;\n flex-direction: column;\n gap: 12px;\n padding: 14px;\n border: 1px solid color-mix(in srgb, currentColor 18%, transparent);\n border-radius: 10px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-head {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n}\n\n.dsh-mcp-ops-ServerForm-title {\n margin: 0;\n font-size: 15px;\n font-weight: 600;\n}\n\n.dsh-mcp-ops-ServerForm-headActions {\n display: flex;\n flex: none;\n gap: 8px;\n}\n\n\n.dsh-mcp-ops-ServerForm-gridName {\n display: grid;\n grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);\n gap: 12px;\n align-items: end;\n}\n\n\n.dsh-mcp-ops-ServerForm-gridTransport {\n display: grid;\n grid-template-columns: minmax(272px, 1fr) minmax(0, 2fr);\n gap: 12px;\n align-items: end;\n}\n\n\n.dsh-mcp-ops-ServerForm-gridOAuth {\n display: grid;\n grid-template-columns: repeat(2, minmax(0, 1fr));\n gap: 12px;\n align-items: start;\n}\n\n.dsh-mcp-ops-ServerForm-field {\n display: flex;\n flex-direction: column;\n gap: 4px;\n font-size: 13px;\n min-width: 0;\n}\n\n\n.dsh-mcp-ops-ServerForm-label {\n opacity: 0.8;\n}\n\n\n.dsh-mcp-ops-ServerForm-field textarea {\n width: 100%;\n max-width: 100%;\n min-width: 0;\n box-sizing: border-box;\n padding: 5px 8px;\n border: 0.5px solid var(--dsw-alias-border-l4);\n border-radius: var(--dsw-radius-md);\n background: var(--dsw-alias-bg-layer-1);\n color: var(--dsw-alias-label-primary);\n font: inherit;\n font-size: 13px;\n}\n\n.dsh-mcp-ops-ServerForm-field textarea:disabled {\n opacity: 0.5;\n}\n\n\n.dsh-mcp-ops-ServerForm-transportWrap,\n.dsh-mcp-ops-ServerForm-transportMenu {\n display: block;\n width: 100%;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-transportTrigger {\n width: 100%;\n justify-content: space-between;\n}\n\n\n.dsh-mcp-ops-ServerForm-transportLabel {\n min-width: 0;\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n\n.dsh-mcp-ops-ServerForm-transportChevron {\n display: inline-flex;\n width: 16px;\n height: 16px;\n align-items: center;\n justify-content: center;\n color: var(--dsw-alias-label-tertiary);\n}\n\n\n.dsh-mcp-ops-ServerForm-fieldInput {\n box-sizing: border-box;\n width: 100%;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-field textarea {\n resize: vertical;\n}\n\n.dsh-mcp-ops-ServerForm-hint,\n.dsh-mcp-ops-ServerForm-preview,\n.dsh-mcp-ops-ServerForm-warn {\n font-size: 12px;\n line-height: 18px;\n opacity: 0.6;\n}\n\n.dsh-mcp-ops-ServerForm-preview {\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n overflow-wrap: anywhere;\n}\n\n.dsh-mcp-ops-ServerForm-warn {\n color: #b26a00;\n opacity: 0.9;\n}\n\n\n.dsh-mcp-ops-ServerForm-oauthActions {\n display: inline-flex;\n align-self: flex-start;\n align-items: center;\n gap: 8px;\n}\n\n\n.dsh-mcp-ops-ServerForm-oauthStatus {\n font-size: 12px;\n line-height: 18px;\n opacity: 0.8;\n}\n\n.dsh-mcp-ops-ServerForm-oauthStatus[data-phase='failed'] {\n color: #d14343;\n opacity: 1;\n}\n\n.dsh-mcp-ops-ServerForm-oauthStatus[data-phase='authorized'] {\n color: #1e8449;\n opacity: 1;\n}\n\n.dsh-mcp-ops-ServerForm-rows {\n display: flex;\n flex-direction: column;\n gap: 6px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-rowLine {\n display: flex;\n align-items: center;\n gap: 6px;\n min-width: 0;\n}\n\n\n.dsh-mcp-ops-ServerForm-keyInput {\n flex: 0 0 auto;\n width: 162px;\n}\n\n.dsh-mcp-ops-ServerForm-valueInput {\n flex: 1 1 0;\n}\n\n\n.dsh-mcp-ops-ServerForm-field input[type='checkbox'] {\n width: auto;\n max-width: none;\n padding: 0;\n border: 0;\n border-radius: 0;\n}\n\n\n.dsh-mcp-ops-ServerForm-checkWrap {\n display: inline-flex;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-rowCheck {\n flex: none;\n font-size: 12px;\n opacity: 0.8;\n white-space: nowrap;\n}\n\n\n.dsh-mcp-ops-ServerForm-oauthCheck {\n align-self: flex-start;\n}\n\n.dsh-mcp-ops-ServerForm-remove {\n flex: none;\n width: 24px;\n height: 24px;\n padding: 0;\n color: #d14343;\n font-size: 16px;\n line-height: 1;\n}\n\n\n.dsh-mcp-ops-ServerForm-fieldCheck {\n padding-bottom: 6px;\n font-size: 13px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ServerForm-actions {\n display: flex;\n align-items: center;\n justify-content: space-between;\n gap: 12px;\n padding-top: 2px;\n}\n\n.dsh-mcp-ops-ServerForm-actionButtons {\n display: inline-flex;\n flex: none;\n align-items: center;\n gap: 8px;\n}\n\n\n\n\n.dsh-mcp-ops-ServerForm-danger {\n color: #d14343;\n border-color: color-mix(in srgb, #d14343 60%, transparent);\n}\n\n\n.dsh-mcp-ops-ServerForm-secondary {\n align-self: flex-start;\n}\n\n\n.dsh-mcp-ops-ServerForm-problem {\n flex: 1 1 auto;\n min-width: 0;\n min-height: 18px;\n color: #d14343;\n font-size: 12px;\n line-height: 18px;\n white-space: nowrap;\n overflow: hidden;\n text-overflow: ellipsis;\n}\n\n.dsh-mcp-ops-ServerForm-testResult {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n}\n\n.dsh-mcp-ops-ServerForm-testResult[data-ok='true'] {\n color: #1e8449;\n}\n\n.dsh-mcp-ops-ServerForm-testResult[data-ok='false'] {\n color: #d14343;\n}\n" },
2201
+ "src/client/sections/ServerList.module.css": { text: () => "\n\n\n.dsh-mcp-ops-ServerList-head {\n display: flex;\n align-items: center;\n justify-content: flex-end;\n gap: 12px;\n}\n\n.dsh-mcp-ops-ServerList-headActions {\n display: flex;\n align-items: center;\n gap: 8px;\n flex: none;\n}\n\n\n\n.dsh-mcp-ops-ServerList-fileNotice {\n margin: 0;\n font-size: 12px;\n line-height: 18px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-ServerList-note {\n margin: 0;\n font-size: 13px;\n line-height: 20px;\n opacity: 0.7;\n}\n\n.dsh-mcp-ops-ServerList-cards {\n display: flex;\n flex-direction: column;\n gap: 10px;\n}\n" },
2202
+ "src/client/sections/ToolSelector.module.css": { text: () => "\n\n.dsh-mcp-ops-ToolSelector-list {\n display: flex;\n flex-direction: column;\n gap: 6px;\n margin: 10px 0 0;\n padding: 10px 12px;\n border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);\n list-style: none;\n}\n\n.dsh-mcp-ops-ToolSelector-item {\n font-size: 13px;\n}\n\n.dsh-mcp-ops-ToolSelector-label {\n display: flex;\n \n align-items: flex-start;\n gap: 6px;\n cursor: pointer;\n}\n\n.dsh-mcp-ops-ToolSelector-label input {\n margin-top: 3px;\n flex: none;\n}\n\n.dsh-mcp-ops-ToolSelector-text {\n display: flex;\n flex-direction: column;\n gap: 1px;\n min-width: 0;\n}\n\n.dsh-mcp-ops-ToolSelector-name {\n font-family: ui-monospace, SFMono-Regular, Menlo, monospace;\n font-size: 12.5px;\n \n font-weight: 700;\n overflow-wrap: anywhere;\n}\n\n.dsh-mcp-ops-ToolSelector-description {\n font-size: 12px;\n line-height: 17px;\n opacity: 0.68;\n overflow-wrap: anywhere;\n}\n\n.dsh-mcp-ops-ToolSelector-note {\n margin: 10px 0 0;\n font-size: 12px;\n opacity: 0.6;\n}\n" },
2203
+ } }) });