dsh-mcp-ops 0.2.1 → 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,12 @@ 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()
145
+ enforcement: import_zod.z.union([import_zod.z.literal("mask"), import_zod.z.literal("unavailable")]).readonly()
148
146
  }).readonly();
149
147
  var listResult$schema = import_zod.z.union([
150
148
  import_zod.z.object({ ok: import_zod.z.literal(true).readonly(), value: payload$schema }).readonly(),
@@ -210,6 +208,8 @@ var serverInput$schema = import_zod.z.object({
210
208
  }).readonly()).readonly().optional(),
211
209
  timeoutMs: import_zod.z.number().readonly().optional(),
212
210
  oauth: import_zod.z.boolean().readonly().optional(),
211
+ oauthScope: import_zod.z.string().readonly().optional(),
212
+ oauthClientId: import_zod.z.string().readonly().optional(),
213
213
  enabled: import_zod.z.boolean().readonly().optional()
214
214
  }).readonly();
215
215
  var writePayload$schema = import_zod.z.object({
@@ -275,10 +275,24 @@ var envResult$schema = import_zod.z.union([
275
275
  error: import_zod.z.object({ code: import_zod.z.string().readonly(), message: import_zod.z.string().readonly() }).readonly()
276
276
  }).readonly()
277
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();
278
285
  var oauthStartPayload$schema = import_zod.z.object({
279
- authorizeUrl: import_zod.z.string().readonly(),
280
- redirectUri: import_zod.z.string().readonly()
286
+ attempt: oauthAttempt$schema,
287
+ servers: import_zod.z.array(server$schema).readonly()
281
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
+ ]);
282
296
  var oauthStartResult$schema = import_zod.z.union([
283
297
  import_zod.z.object({ ok: import_zod.z.literal(true).readonly(), value: oauthStartPayload$schema }).readonly(),
284
298
  import_zod.z.object({
@@ -382,13 +396,21 @@ var TYPERT_REMOTE = {
382
396
  }).readonly(), "dsh-mcp-ops/types#EnvSetRequest")
383
397
  ]),
384
398
  endpoint("oauthStart", oauthStartResult$schema, "dsh-mcp-ops/types#OAuthStartResult", [
399
+ // 0.3.0:授权交给官方 manager,入参只剩服务器名(URL/origin 都由官方从注册项与宿主推断)。
385
400
  parameter("request", import_zod.z.object({
386
- serverName: import_zod.z.string().readonly(),
387
- url: import_zod.z.string().readonly(),
388
- // B81:浏览器 origin(可选)。host 只在"干净 origin + 组合里有官方 webServer"时用它走
389
- // Web 回调,否则回退回环 —— 所以老客户端不传也照样成立(字段必须可选)。
390
- origin: import_zod.z.string().readonly().optional()
401
+ serverName: import_zod.z.string().readonly()
391
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")
392
414
  ])
393
415
  ]
394
416
  };
@@ -414,11 +436,12 @@ var zh = {
414
436
  // 文件源提示(只在需要时出现:未创建 / 只读)
415
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",
416
438
  fileReadonly: "\u914D\u7F6E\u6587\u4EF6 {path} \u5F53\u524D\u53EA\u8BFB\uFF1A{reason}",
417
- // 注入模式(B37:独立成 tab,tab 内不再重复小标题;副标题里的「省 token」已按用户要求删掉)
418
- modeSearch: "\u6309\u9700\u68C0\u7D22\uFF08\u4EC5\u6CE8\u5165\u5E38\u7528 / \u68C0\u7D22\u5230\u7684\u5DE5\u5177\uFF09",
419
- modeFull: "\u5168\u91CF\u6CE8\u5165\uFF08\u6BCF\u8F6E\u6CE8\u5165\u6240\u6709\u542F\u7528\u7684 MCP \u5DE5\u5177\uFF09",
420
- 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",
421
- 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",
422
445
  // 服务卡片
423
446
  addServer: "\u6DFB\u52A0\u670D\u52A1",
424
447
  refreshList: "\u5237\u65B0\u5217\u8868",
@@ -445,6 +468,7 @@ var zh = {
445
468
  phaseFailed: "\u8FDE\u63A5\u5931\u8D25",
446
469
  phaseStopped: "\u672A\u542F\u7528",
447
470
  phaseStoppedConflict: "\u88AB\u7EC4\u5408\u5C42\u5360\u7528",
471
+ phaseWaitingAuth: "\u5F85\u6388\u6743",
448
472
  readonlyParseError: "\u89E3\u6790\u5931\u8D25\uFF0C\u53EA\u8BFB",
449
473
  readonlyNotWritable: "\u4E0D\u53EF\u5199",
450
474
  // 服务表单
@@ -470,7 +494,21 @@ var zh = {
470
494
  formTimeout: "\u5DE5\u5177\u8C03\u7528\u8D85\u65F6\uFF08\u6BEB\u79D2\uFF09",
471
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",
472
496
  formOAuth: "\u4F7F\u7528 OAuth \u6388\u6743\uFF08\u6D4F\u89C8\u5668\u6388\u6743 + PKCE\uFF09",
473
- 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}",
474
512
  formEnabled: "\u542F\u7528",
475
513
  formTest: "\u6D4B\u8BD5\u8FDE\u63A5",
476
514
  formSave: "\u4FDD\u5B58",
@@ -478,8 +516,7 @@ var zh = {
478
516
  formTestOk: "\u8FDE\u63A5\u6210\u529F\uFF1A{count} \u4E2A\u5DE5\u5177",
479
517
  formTestFail: "\u8FDE\u63A5\u5931\u8D25\uFF1A{message}",
480
518
  formTesting: "\u6B63\u5728\u6D4B\u8BD5\u8FDE\u63A5\u2026",
481
- formAuthorize: "\u83B7\u53D6\u6388\u6743\u94FE\u63A5",
482
- 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",
483
520
  // 服务级环境变量(表单内,B37)
484
521
  formEnv: "\u73AF\u5883\u53D8\u91CF",
485
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",
@@ -549,10 +586,10 @@ var en = {
549
586
  errorTitle: "Action failed",
550
587
  fileMissing: "The configuration file {path} does not exist yet; saving the first service creates it.",
551
588
  fileReadonly: "The configuration file {path} is currently read-only: {reason}",
552
- modeSearch: "On demand (only common / searched tools are injected)",
553
- modeFull: "Inject everything (every enabled MCP tool in every turn)",
554
- modeHintSearch: "On-demand mode: when the model needs an MCP tool it calls mcp_tool_search, and a hit is injected into the conversation.",
555
- 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.",
556
593
  addServer: "Add service",
557
594
  refreshList: "Refresh list",
558
595
  refreshListHint: "Re-read the file and refresh the list (entries added outside show up here)",
@@ -577,6 +614,7 @@ var en = {
577
614
  phaseFailed: "failed",
578
615
  phaseStopped: "disabled",
579
616
  phaseStoppedConflict: "occupied by composition",
617
+ phaseWaitingAuth: "needs authorization",
580
618
  readonlyParseError: "parse error, read-only",
581
619
  readonlyNotWritable: "not writable",
582
620
  formNew: "New service",
@@ -601,7 +639,21 @@ var en = {
601
639
  formTimeout: "Tool call timeout (ms)",
602
640
  formTimeoutHint: "Blank = no plugin override; the official dsh-mcp-client default of 60000 ms (60 s) applies.",
603
641
  formOAuth: "Use OAuth (browser authorization + PKCE)",
604
- 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}",
605
657
  formEnabled: "Enabled",
606
658
  formTest: "Test connection",
607
659
  formSave: "Save",
@@ -609,8 +661,7 @@ var en = {
609
661
  formTestOk: "Connected: {count} tool(s)",
610
662
  formTestFail: "Connection failed: {message}",
611
663
  formTesting: "Testing the connection\u2026",
612
- formAuthorize: "Get authorization link",
613
- 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):",
614
665
  formEnv: "Environment variables",
615
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.",
616
667
  formEnvAdd: "Add variable",
@@ -665,36 +716,12 @@ var import_react3 = require("react");
665
716
  var import_dsh_client_ui_primitives6 = require("@deepseek-ai/dsh-client-ui-primitives");
666
717
 
667
718
  // src/client/McpOpsSection.module.css
668
- (function() {
669
- if (typeof document !== "undefined") {
670
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="McpOpsSection.module.css"]');
671
- if (!existing) {
672
- const style = document.createElement("style");
673
- style.setAttribute("data-plugin", "dsh-mcp-ops");
674
- style.setAttribute("data-file", "McpOpsSection.module.css");
675
- 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";
676
- document.head.appendChild(style);
677
- }
678
- }
679
- })();
680
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" };
681
720
 
682
721
  // src/client/sections/ConfirmDialog.tsx
683
722
  var import_dsh_client_ui_primitives = require("@deepseek-ai/dsh-client-ui-primitives");
684
723
 
685
724
  // src/client/sections/ConfirmDialog.module.css
686
- (function() {
687
- if (typeof document !== "undefined") {
688
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ConfirmDialog.module.css"]');
689
- if (!existing) {
690
- const style = document.createElement("style");
691
- style.setAttribute("data-plugin", "dsh-mcp-ops");
692
- style.setAttribute("data-file", "ConfirmDialog.module.css");
693
- 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";
694
- document.head.appendChild(style);
695
- }
696
- }
697
- })();
698
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" };
699
726
 
700
727
  // src/client/sections/ConfirmDialog.tsx
@@ -735,18 +762,6 @@ var import_react = require("react");
735
762
  var import_dsh_client_ui_primitives2 = require("@deepseek-ai/dsh-client-ui-primitives");
736
763
 
737
764
  // src/client/sections/EnvPanel.module.css
738
- (function() {
739
- if (typeof document !== "undefined") {
740
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="EnvPanel.module.css"]');
741
- if (!existing) {
742
- const style = document.createElement("style");
743
- style.setAttribute("data-plugin", "dsh-mcp-ops");
744
- style.setAttribute("data-file", "EnvPanel.module.css");
745
- 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";
746
- document.head.appendChild(style);
747
- }
748
- }
749
- })();
750
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" };
751
766
 
752
767
  // src/client/sections/EnvPanel.tsx
@@ -950,18 +965,6 @@ function EnvPanel(props) {
950
965
  }
951
966
 
952
967
  // src/client/sections/InjectionMode.module.css
953
- (function() {
954
- if (typeof document !== "undefined") {
955
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="InjectionMode.module.css"]');
956
- if (!existing) {
957
- const style = document.createElement("style");
958
- style.setAttribute("data-plugin", "dsh-mcp-ops");
959
- style.setAttribute("data-file", "InjectionMode.module.css");
960
- 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";
961
- document.head.appendChild(style);
962
- }
963
- }
964
- })();
965
968
  var InjectionMode_default = { "panel": "dsh-mcp-ops-InjectionMode-panel", "option": "dsh-mcp-ops-InjectionMode-option", "hint": "dsh-mcp-ops-InjectionMode-hint" };
966
969
 
967
970
  // src/client/sections/InjectionMode.tsx
@@ -970,7 +973,7 @@ var MODE_INPUT_NAME = "mcp-ops-injection-mode";
970
973
  function InjectionMode(props) {
971
974
  const { t, mode, busy } = props;
972
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: [
973
- ["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: [
974
977
  /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
975
978
  "input",
976
979
  {
@@ -983,9 +986,9 @@ function InjectionMode(props) {
983
986
  }
984
987
  }
985
988
  ),
986
- /* @__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") })
987
990
  ] }, value)),
988
- /* @__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") })
989
992
  ] });
990
993
  }
991
994
 
@@ -993,19 +996,7 @@ function InjectionMode(props) {
993
996
  var import_react2 = require("react");
994
997
 
995
998
  // src/client/sections/ServerForm.module.css
996
- (function() {
997
- if (typeof document !== "undefined") {
998
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ServerForm.module.css"]');
999
- if (!existing) {
1000
- const style = document.createElement("style");
1001
- style.setAttribute("data-plugin", "dsh-mcp-ops");
1002
- style.setAttribute("data-file", "ServerForm.module.css");
1003
- 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";
1004
- document.head.appendChild(style);
1005
- }
1006
- }
1007
- })();
1008
- 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" };
1009
1000
 
1010
1001
  // src/client/validate.ts
1011
1002
  var REF_SAFE_SERVER_NAME_RE = /^[A-Za-z0-9_]{1,32}$/;
@@ -1033,6 +1024,8 @@ function emptyFormValue() {
1033
1024
  env: [],
1034
1025
  timeoutMs: "",
1035
1026
  oauth: false,
1027
+ oauthScope: "",
1028
+ oauthClientId: "",
1036
1029
  enabled: true
1037
1030
  };
1038
1031
  }
@@ -1053,7 +1046,11 @@ function formToInput(value) {
1053
1046
  } : {
1054
1047
  url: value.url.trim(),
1055
1048
  headers: value.headers.filter((row) => row.name.trim() !== ""),
1056
- 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() } : {}
1057
1054
  },
1058
1055
  // 密钥行照旧只送 name/value/secret(真值留空即"保留")。
1059
1056
  env: value.env.filter((row) => row.name.trim() !== "").map((row) => ({ name: row.name.trim(), value: row.value, secret: row.secret })),
@@ -1133,6 +1130,10 @@ function formValueOf(server) {
1133
1130
  })),
1134
1131
  timeoutMs: server.toolCallTimeoutMs === void 0 ? "" : String(server.toolCallTimeoutMs),
1135
1132
  oauth: server.oauth,
1133
+ // 视图不暴露 `oauthScope` / `oauthClientId`(host 只把它们写进 `configs.overlays`),
1134
+ // 所以编辑态一律回显空串:保存时省略 = 不覆盖(见 `ServerFormValue.oauthScope` 的说明)。
1135
+ oauthScope: "",
1136
+ oauthClientId: "",
1136
1137
  enabled: server.enabled
1137
1138
  };
1138
1139
  }
@@ -1162,6 +1163,9 @@ function ServerForm(props) {
1162
1163
  const blocked = problems.some((problem2) => problem2.kind === "error");
1163
1164
  const problem = problems[0];
1164
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");
1165
1169
  const submit = (event) => {
1166
1170
  event.preventDefault();
1167
1171
  if (blocked) {
@@ -1393,8 +1397,54 @@ function ServerForm(props) {
1393
1397
  }
1394
1398
  ) }),
1395
1399
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("small", { className: ServerForm_default.hint, children: t("formOAuthHint") }),
1396
- 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,
1397
- 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: [
1398
1448
  t("formAuthorizeHint"),
1399
1449
  " ",
1400
1450
  /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("a", { href: props.oauthUrl, target: "_blank", rel: "noreferrer", children: props.oauthUrl })
@@ -1471,51 +1521,15 @@ function RowEditor(props) {
1471
1521
  }
1472
1522
 
1473
1523
  // src/client/sections/ServerList.module.css
1474
- (function() {
1475
- if (typeof document !== "undefined") {
1476
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ServerList.module.css"]');
1477
- if (!existing) {
1478
- const style = document.createElement("style");
1479
- style.setAttribute("data-plugin", "dsh-mcp-ops");
1480
- style.setAttribute("data-file", "ServerList.module.css");
1481
- 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";
1482
- document.head.appendChild(style);
1483
- }
1484
- }
1485
- })();
1486
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" };
1487
1525
 
1488
1526
  // src/client/sections/ServerList.tsx
1489
1527
  var import_dsh_client_ui_primitives5 = require("@deepseek-ai/dsh-client-ui-primitives");
1490
1528
 
1491
1529
  // src/client/sections/ServerCard.module.css
1492
- (function() {
1493
- if (typeof document !== "undefined") {
1494
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ServerCard.module.css"]');
1495
- if (!existing) {
1496
- const style = document.createElement("style");
1497
- style.setAttribute("data-plugin", "dsh-mcp-ops");
1498
- style.setAttribute("data-file", "ServerCard.module.css");
1499
- 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";
1500
- document.head.appendChild(style);
1501
- }
1502
- }
1503
- })();
1504
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" };
1505
1531
 
1506
1532
  // src/client/sections/ToolSelector.module.css
1507
- (function() {
1508
- if (typeof document !== "undefined") {
1509
- const existing = document.querySelector('style[data-plugin="dsh-mcp-ops"][data-file="ToolSelector.module.css"]');
1510
- if (!existing) {
1511
- const style = document.createElement("style");
1512
- style.setAttribute("data-plugin", "dsh-mcp-ops");
1513
- style.setAttribute("data-file", "ToolSelector.module.css");
1514
- 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";
1515
- document.head.appendChild(style);
1516
- }
1517
- }
1518
- })();
1519
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" };
1520
1534
 
1521
1535
  // src/client/sections/ToolSelector.tsx
@@ -1523,7 +1537,7 @@ var import_jsx_runtime7 = require("react/jsx-runtime");
1523
1537
  function ToolSelector(props) {
1524
1538
  const { t, tools, busy, pending } = props;
1525
1539
  if (tools.length === 0) return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("p", { className: ToolSelector_default.note, children: t("toolsNone") });
1526
- 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: [
1527
1541
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1528
1542
  "input",
1529
1543
  {
@@ -1555,6 +1569,9 @@ function badgeTone(server) {
1555
1569
  return "info";
1556
1570
  case "stopped-conflict":
1557
1571
  return "warning";
1572
+ // 0.3.0:官方 OAuth 没有可用 grant 时进入这个相位 —— 不是故障,是"等人操作",用 warning。
1573
+ case "waiting-authorization":
1574
+ return "warning";
1558
1575
  default:
1559
1576
  return "neutral";
1560
1577
  }
@@ -1570,6 +1587,8 @@ function badgeKey(server) {
1570
1587
  return "phaseMounting";
1571
1588
  case "stopped-conflict":
1572
1589
  return "phaseStoppedConflict";
1590
+ case "waiting-authorization":
1591
+ return "phaseWaitingAuth";
1573
1592
  default:
1574
1593
  return "phaseStopped";
1575
1594
  }
@@ -1578,6 +1597,9 @@ function ServerCard(props) {
1578
1597
  const { t, server, busy } = props;
1579
1598
  const composition = server.source === "cordis";
1580
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");
1581
1603
  const problems = server.diagnostics.filter((entry) => entry.level !== "info");
1582
1604
  const mountError = server.enabled ? server.status.error : void 0;
1583
1605
  const marker = mountError === void 0 && problems.length === 0 ? void 0 : [
@@ -1613,6 +1635,8 @@ function ServerCard(props) {
1613
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,
1614
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,
1615
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,
1616
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") }),
1617
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,
1618
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
@@ -1683,6 +1707,10 @@ var TABS_ID = "mcp-ops-tabs";
1683
1707
  function panelId(tab) {
1684
1708
  return `${TABS_ID}-${tab}-panel`;
1685
1709
  }
1710
+ function openAuthorizationPage(url) {
1711
+ if (typeof window === "undefined") return;
1712
+ window.open(url, "_blank", "noopener");
1713
+ }
1686
1714
  function McpOpsSection(props) {
1687
1715
  const t = props.t;
1688
1716
  const propsRef = (0, import_react3.useRef)(props);
@@ -1697,6 +1725,8 @@ function McpOpsSection(props) {
1697
1725
  const [confirm, setConfirm] = (0, import_react3.useState)(null);
1698
1726
  const [testResult, setTestResult] = (0, import_react3.useState)(null);
1699
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);
1700
1730
  const [expanded, setExpanded] = (0, import_react3.useState)(/* @__PURE__ */ new Set());
1701
1731
  const [tools, setTools] = (0, import_react3.useState)(null);
1702
1732
  const [pendingTool, setPendingTool] = (0, import_react3.useState)(null);
@@ -1726,6 +1756,8 @@ function McpOpsSection(props) {
1726
1756
  setEditing(null);
1727
1757
  setTestResult(null);
1728
1758
  setOAuthUrl(null);
1759
+ setOAuthAttempt(null);
1760
+ setOAuthServer(null);
1729
1761
  setFormError(null);
1730
1762
  }, []);
1731
1763
  const run = (0, import_react3.useCallback)(async (action, done, options = {}) => {
@@ -1805,15 +1837,103 @@ function McpOpsSection(props) {
1805
1837
  setError(null);
1806
1838
  }).catch((problem) => setError(problem instanceof Error ? problem.message : String(problem))).finally(() => setBusy(false));
1807
1839
  };
1808
- const startOAuth = (value) => {
1809
- const input = formToInput(value);
1810
- 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;
1811
1860
  setBusy(true);
1812
- void propsRef.current.oauthStart(input.serverName === "" ? "probe" : input.serverName, input.url).then((payload) => {
1813
- setOAuthUrl(payload.authorizeUrl);
1861
+ setOAuthUrl(null);
1862
+ setOAuthAttempt(null);
1863
+ setOAuthServer(null);
1864
+ void propsRef.current.oauthStart(name).then((started) => {
1865
+ replaceServers(started.servers);
1814
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();
1815
1926
  }).catch((problem) => setError(problem instanceof Error ? problem.message : String(problem))).finally(() => setBusy(false));
1816
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
+ };
1817
1937
  const adoptOne = (server) => {
1818
1938
  setBusy(true);
1819
1939
  void propsRef.current.adopt(server.serverName).then(async (payload) => {
@@ -1873,6 +1993,8 @@ function McpOpsSection(props) {
1873
1993
  setEditing(formValueOf(server));
1874
1994
  setTestResult(null);
1875
1995
  setOAuthUrl(null);
1996
+ setOAuthAttempt(null);
1997
+ setOAuthServer(null);
1876
1998
  setNote(null);
1877
1999
  setFormError(null);
1878
2000
  },
@@ -1880,6 +2002,8 @@ function McpOpsSection(props) {
1880
2002
  onRefresh: (server) => void run(async () => await propsRef.current.refreshServer(server.serverName), t("refreshed")),
1881
2003
  onAdopt: (server) => askAdopt(server),
1882
2004
  onRelease: (server) => askRelease(server),
2005
+ onAuthorize: (server) => authorizeOne(server),
2006
+ onSignOut: (server) => askSignOut(server),
1883
2007
  onToggleTool: toggleTool
1884
2008
  };
1885
2009
  return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("section", { className: McpOpsSection_default.panel, "data-plugin": "dsh-mcp-ops", "data-tab": tab, children: [
@@ -1914,6 +2038,8 @@ function McpOpsSection(props) {
1914
2038
  setEditing(emptyFormValue());
1915
2039
  setTestResult(null);
1916
2040
  setOAuthUrl(null);
2041
+ setOAuthAttempt(null);
2042
+ setOAuthServer(null);
1917
2043
  setNote(null);
1918
2044
  setFormError(null);
1919
2045
  },
@@ -1938,7 +2064,7 @@ function McpOpsSection(props) {
1938
2064
  await run(async () => await propsRef.current.envInject(enabled), t("saved"));
1939
2065
  }
1940
2066
  }
1941
- ) }) : /* @__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 }) }),
1942
2068
  editing === null ? null : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1943
2069
  import_dsh_client_ui_primitives6.Modal,
1944
2070
  {
@@ -1956,11 +2082,13 @@ function McpOpsSection(props) {
1956
2082
  busy,
1957
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 } },
1958
2084
  oauthUrl,
2085
+ oauthAttempt,
1959
2086
  error: formError,
1960
2087
  onCancel: closeForm,
1961
2088
  onSubmit: submit,
1962
2089
  onTest: testOne,
1963
2090
  onOAuth: startOAuth,
2091
+ onOAuthCancel: cancelOAuth,
1964
2092
  ...editing.serverName === "" ? {} : { onDelete: () => askRemove(editing.serverName) }
1965
2093
  }
1966
2094
  ) })
@@ -2053,14 +2181,23 @@ async function activate(ctx) {
2053
2181
  envList: async () => await call(ctx, (api) => api.envList()),
2054
2182
  envSet: async (vars) => await call(ctx, (api) => api.envSet({ vars })),
2055
2183
  envInject: async (enabled) => await call(ctx, (api) => api.envInject({ enabled })),
2056
- // B81:把浏览器 origin 一路带到 host —— Web 组合下 OAuth 回调落在宿主 origin 的固定路径上,
2057
- // 回环只作为回退。SSR/无 window 的环境(以及钉死的 `file://` 壳)传 undefined,host 自动回退。
2058
- oauthStart: async (serverName, url) => await call(ctx, (api) => api.oauthStart({
2059
- serverName,
2060
- url,
2061
- ...typeof window === "undefined" ? {} : { origin: window.location.origin }
2062
- }))
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 }))
2063
2189
  })
2064
2190
  }, McpOpsSection));
2065
2191
  }
2066
- 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
+ } }) });