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/configs.js CHANGED
@@ -2,8 +2,12 @@ import { z } from "zod";
2
2
  const CONFIGS_KEY = "configs";
3
3
  const OVERLAY_KEY_SEPARATOR = "\0";
4
4
  const overlaySchema = z.object({
5
- /** 显式 OAuth 开关(缺省 false)。 */
5
+ /** 显式 OAuth 开关(缺省 false)。true 时注册项带 `oauth.credentialKey`,授权由官方承担。 */
6
6
  oauth: z.boolean().optional(),
7
+ /** OAuth `scope` 覆盖(缺省交给官方:按服务器的 challenge 决定)。 */
8
+ oauthScope: z.string().optional(),
9
+ /** OAuth 预注册 client id(缺省交给官方:动态客户端注册)。 */
10
+ oauthClientId: z.string().optional(),
7
11
  /** 文件未给出 `timeout` 时的覆盖;文件给了则以文件为准。 */
8
12
  toolCallTimeoutMs: z.number().optional(),
9
13
  /** 用户在本插件里强制启停(覆盖文件的 `disabled`)。 */
@@ -26,7 +30,7 @@ const globalEnvSchema = z.object({
26
30
  value: z.string()
27
31
  });
28
32
  const DEFAULT_CONFIGS = {
29
- injectionMode: "search",
33
+ injectionMode: "eager",
30
34
  injectGlobalEnvToStdio: true,
31
35
  overlays: {},
32
36
  tool_switches: {},
@@ -37,7 +41,7 @@ function overlayKey(serverName) {
37
41
  }
38
42
  function isBlankOverlay(record) {
39
43
  if (record === void 0) return true;
40
- return record.oauth === void 0 && record.toolCallTimeoutMs === void 0 && record.enabledOverride === void 0 && record.injectGlobalEnv === void 0;
44
+ return record.oauth === void 0 && record.oauthScope === void 0 && record.oauthClientId === void 0 && record.toolCallTimeoutMs === void 0 && record.enabledOverride === void 0 && record.injectGlobalEnv === void 0;
41
45
  }
42
46
  function normalizeOverlayKey(key) {
43
47
  const index = key.lastIndexOf(OVERLAY_KEY_SEPARATOR);
@@ -52,6 +56,12 @@ function configDiagnostic(detail, path) {
52
56
  messageKey: "diagnostics.CONFIGS_INVALID"
53
57
  };
54
58
  }
59
+ function normalizeInjectionMode(raw) {
60
+ if (raw === "on-demand" || raw === "eager") return raw;
61
+ if (raw === "search") return "eager";
62
+ if (raw === "full") return "eager";
63
+ return void 0;
64
+ }
55
65
  function normalizeConfigs(raw, path) {
56
66
  const diagnostics = [];
57
67
  if (raw === void 0 || raw === null) return { configs: DEFAULT_CONFIGS, diagnostics };
@@ -79,15 +89,16 @@ function normalizeConfigs(raw, path) {
79
89
  }
80
90
  return out;
81
91
  };
82
- let injectionMode = DEFAULT_CONFIGS.injectionMode;
83
- if (record.injectionMode === "search" || record.injectionMode === "full") injectionMode = record.injectionMode;
84
- else if (record.injectionMode !== void 0) diagnostics.push(configDiagnostic("injectionMode", path));
92
+ const injectionMode = normalizeInjectionMode(record.injectionMode);
93
+ if (record.injectionMode !== void 0 && injectionMode === void 0) {
94
+ diagnostics.push(configDiagnostic("injectionMode", path));
95
+ }
85
96
  let injectGlobalEnvToStdio = DEFAULT_CONFIGS.injectGlobalEnvToStdio;
86
97
  if (typeof record.injectGlobalEnvToStdio === "boolean") injectGlobalEnvToStdio = record.injectGlobalEnvToStdio;
87
98
  else if (record.injectGlobalEnvToStdio !== void 0) diagnostics.push(configDiagnostic("injectGlobalEnvToStdio", path));
88
99
  return {
89
100
  configs: {
90
- injectionMode,
101
+ injectionMode: injectionMode ?? DEFAULT_CONFIGS.injectionMode,
91
102
  injectGlobalEnvToStdio,
92
103
  overlays: table("overlays", overlaySchema),
93
104
  tool_switches: table("tool_switches", toolSwitchSchema),
@@ -119,7 +130,8 @@ function configsFromDomainSnapshot(snapshot) {
119
130
  if (one.success) env[key] = one.data;
120
131
  }
121
132
  return {
122
- injectionMode: global.injectionMode === "full" ? "full" : "search",
133
+ // 旧域文件里同样可能是历史值(`search` / `full`):先按新值域归一。
134
+ injectionMode: normalizeInjectionMode(global.injectionMode) ?? DEFAULT_CONFIGS.injectionMode,
123
135
  injectGlobalEnvToStdio: global.injectGlobalEnvToStdio !== false,
124
136
  overlays,
125
137
  tool_switches: switches,
@@ -138,6 +150,7 @@ export {
138
150
  isBlankOverlay,
139
151
  isDefaultConfigs,
140
152
  normalizeConfigs,
153
+ normalizeInjectionMode,
141
154
  normalizeOverlayKey,
142
155
  overlayKey,
143
156
  overlaySchema,
@@ -1,27 +1,9 @@
1
1
  const zh = {
2
- // `mcp_tool_search` 的模型可见文案。
3
- toolSearchDesc: "\u6309\u5173\u952E\u8BCD\u68C0\u7D22\u5F53\u524D\u542F\u7528\u7684 MCP \u5DE5\u5177\uFF0C\u8FD4\u56DE\u5339\u914D\u5DE5\u5177\u7684\u540D\u79F0/\u63CF\u8FF0/\u53C2\u6570 schema\uFF0C\u5E76\u628A\u547D\u4E2D\u7684\u5DE5\u5177\u52A0\u5165\u70ED\u6CE8\u5165\u96C6\uFF08\u4E0B\u4E00\u8F6E\u6A21\u578B\u8BF7\u6C42\u5373\u53EF\u76F4\u63A5\u8C03\u7528\uFF09\u3002\u9700\u8981\u67D0\u4E2A MCP \u5DE5\u5177\u4F46\u4E0D\u77E5\u9053\u786E\u5207\u540D\u79F0\u65F6\u4F7F\u7528\u3002",
4
- toolSearchQuery: "\u68C0\u7D22\u5173\u952E\u8BCD\uFF0C\u5982 gitlab merge request\u3001feishu \u6587\u6863\u3001hive \u8868\u7B49",
5
- toolSearchLimit: "\u6700\u591A\u8FD4\u56DE\u6761\u6570\uFF0C\u9ED8\u8BA4 8\uFF0C\u6700\u5927 20",
6
- searchHit: "\u5339\u914D MCP \u5DE5\u5177\uFF08\u5DF2\u70ED\u542F\u7528\uFF0C\u4E0B\u4E00\u8F6E\u53EF\u76F4\u63A5\u8C03\u7528\uFF09\uFF1A\n{lines}",
7
- searchMiss: "\u672A\u627E\u5230\u5339\u914D\u7684 MCP \u5DE5\u5177\uFF0C\u53EF\u6362\u5173\u952E\u8BCD\u91CD\u8BD5\u3002",
8
- searchDisabled: "\u6CA1\u6709\u53EF\u68C0\u7D22\u7684 MCP \u5DE5\u5177\uFF08\u670D\u52A1\u5668\u672A\u8FDE\u63A5\uFF0C\u6216\u5DE5\u5177\u5DF2\u88AB\u9010\u4E2A\u5173\u95ED\uFF09\u3002",
9
2
  // 调用侧守卫的拒绝理由(B61)—— 这串文本会**原样进模型可见的错误**,所以说清"它存在但被关了"。
10
- toolDisabled: "\u5DE5\u5177 {name} \u5DF2\u88AB\u7528\u6237\u5173\u95ED\uFF0C\u65E0\u6CD5\u8C03\u7528\uFF1B\u8BF7\u8BA9\u7528\u6237\u5728\u300C\u8BBE\u7F6E \u2192 MCP \u670D\u52A1\u300D\u91CC\u542F\u7528\u5B83\u3002",
11
- // 注入的提示词段落。
12
- toolControlPrompt: "MCP \u5DE5\u5177\u6309\u9700\u53EF\u7528\uFF1A\u9700\u8981\u67D0\u4E2A MCP \u5DE5\u5177\u65F6\u5148\u8C03\u7528 mcp_tool_search(query) \u68C0\u7D22\uFF0C\u547D\u4E2D\u540E\u8BE5\u5DE5\u5177\u4F1A\u81EA\u52A8\u6CE8\u5165\u5F53\u524D\u5BF9\u8BDD\uFF1B\u5F53\u524D\u53EF\u7528 MCP \u670D\u52A1\u5668\uFF1A{servers}\u3002",
13
- noServers: "\uFF08\u65E0\uFF09"
3
+ toolDisabled: "\u5DE5\u5177 {name} \u5DF2\u88AB\u7528\u6237\u5173\u95ED\uFF0C\u65E0\u6CD5\u8C03\u7528\uFF1B\u8BF7\u8BA9\u7528\u6237\u5728\u300C\u8BBE\u7F6E \u2192 MCP \u670D\u52A1\u300D\u91CC\u542F\u7528\u5B83\u3002"
14
4
  };
15
5
  const en = {
16
- toolSearchDesc: "Search the enabled MCP tools by keyword; returns matching tool names/descriptions/parameter schemas and hot-injects the hits (callable in the next model request). Use when you need an MCP tool but do not know its exact name.",
17
- toolSearchQuery: "Search keywords, e.g. gitlab merge request, feishu document, hive table",
18
- toolSearchLimit: "Maximum number of results; default 8, max 20",
19
- searchHit: "Matching MCP tools (hot-enabled, callable in the next request):\n{lines}",
20
- searchMiss: "No matching MCP tools found; try different keywords.",
21
- searchDisabled: "No MCP tools to search (no server connected, or every tool is switched off).",
22
- toolDisabled: "The tool {name} is switched off by the user and cannot be called; ask the user to enable it in Settings \u2192 MCP servers.",
23
- toolControlPrompt: "MCP tools are available on demand: when you need an MCP tool, first call mcp_tool_search(query); a hit is hot-injected into the current conversation. Enabled MCP servers: {servers}.",
24
- noServers: "(none)"
6
+ toolDisabled: "The tool {name} is switched off by the user and cannot be called; ask the user to enable it in Settings \u2192 MCP servers."
25
7
  };
26
8
  const HOST_LOCALE_KEYS = Object.keys(zh);
27
9
  function renderHostText(template, vars) {
package/lib/mount.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import { Config as McpClientConfig } from "@deepseek-ai/dsh-mcp-client";
2
2
  import { buildChildEnv, makeLookup, resolveEnv, resolveHeaders } from "./env.js";
3
3
  import { errorText } from "./error-text.js";
4
- import { ensureFreshToken } from "./oauth-store.js";
4
+ import { oauthCredentialKey } from "./oauth-key.js";
5
5
  import { probeServer } from "./probe.js";
6
- import { canHoldCredentialRef, SERVER_NAME_RE, isLegacySecretRow, oauthAccessRef } from "./refs.js";
6
+ import { SERVER_NAME_RE, isLegacySecretRow } from "./refs.js";
7
7
  const STARTUP_TIMEOUT_MS = 6e4;
8
8
  class MountManager {
9
9
  /** 宿主上下文。 */
@@ -170,6 +170,15 @@ class MountManager {
170
170
  if (this.hasUnsupportedTemplate(value)) continue;
171
171
  safe[name] = value;
172
172
  }
173
+ if (request.overlay?.oauth === true) {
174
+ diagnostics.push({
175
+ code: "OAUTH_NOT_SUPPORTED",
176
+ level: "warn",
177
+ serverName: request.serverName,
178
+ detail: "OAuth requires the streamable-http transport; the stdio entry is mounted without it",
179
+ messageKey: "diagnostics.OAUTH_NOT_SUPPORTED"
180
+ });
181
+ }
173
182
  return {
174
183
  entry: {
175
184
  transport: "stdio",
@@ -179,6 +188,7 @@ class MountManager {
179
188
  // 环境变量注入:这里传的是"父进程 scrub 后 + 进程级 + 服务器级"的合并结果。
180
189
  env: safe,
181
190
  startupTimeoutMs: STARTUP_TIMEOUT_MS,
191
+ toolLoading: request.toolLoading ?? "on-demand",
182
192
  ...timeout === void 0 ? {} : { toolCallTimeoutMs: timeout }
183
193
  },
184
194
  diagnostics
@@ -199,46 +209,22 @@ class MountManager {
199
209
  if (this.hasUnsupportedTemplate(value)) continue;
200
210
  clean[name] = value;
201
211
  }
202
- if (request.overlay?.oauth === true) {
203
- if (!canHoldCredentialRef(request.serverName)) {
204
- return {
205
- diagnostics,
206
- error: `serverName "${request.serverName}" cannot back a credential ref ("-" is outside the ref grammar); rename it to use OAuth`
207
- };
208
- }
209
- const fresh = await ensureFreshToken(this.ctx.credentials, request.serverName, request.spec.url ?? "");
210
- if (fresh.token === void 0) {
211
- const diagnostic = {
212
- code: "OAUTH_NOT_AUTHORIZED",
213
- level: "warn",
214
- serverName: request.serverName,
215
- detail: fresh.error ?? "no fresh token; run oauthStart (Settings \u2192 \u6D4B\u8BD5\u8FDE\u63A5/\u6388\u6743) first",
216
- messageKey: "diagnostics.OAUTH_NOT_AUTHORIZED"
217
- };
218
- diagnostics.push(diagnostic);
219
- return { diagnostics, error: diagnostic.detail };
220
- }
221
- if (fresh.refreshed) {
222
- diagnostics.push({
223
- code: "OAUTH_TOKEN_REFRESHED",
224
- level: "info",
225
- serverName: request.serverName,
226
- detail: "expired access token was refreshed with the stored refresh_token",
227
- messageKey: "diagnostics.OAUTH_TOKEN_REFRESHED"
228
- });
229
- }
230
- clean.Authorization = `Bearer \${credential:${String(oauthAccessRef(request.serverName))}}`;
231
- }
212
+ const oauth = request.overlay?.oauth === true ? {
213
+ credentialKey: oauthCredentialKey(request.serverName),
214
+ ...request.overlay.oauthScope === void 0 || request.overlay.oauthScope === "" ? {} : { scope: request.overlay.oauthScope },
215
+ ...request.overlay.oauthClientId === void 0 || request.overlay.oauthClientId === "" ? {} : { clientId: request.overlay.oauthClientId }
216
+ } : void 0;
232
217
  return {
233
218
  entry: {
234
219
  transport: "streamable-http",
235
220
  url: request.spec.url ?? "",
236
221
  headers: clean,
237
222
  startupTimeoutMs: STARTUP_TIMEOUT_MS,
238
- ...timeout === void 0 ? {} : { toolCallTimeoutMs: timeout }
223
+ toolLoading: request.toolLoading ?? "on-demand",
224
+ ...timeout === void 0 ? {} : { toolCallTimeoutMs: timeout },
225
+ ...oauth === void 0 ? {} : { oauth }
239
226
  },
240
- diagnostics,
241
- ...request.overlay?.oauth === true ? {} : {}
227
+ diagnostics
242
228
  };
243
229
  }
244
230
  /**
@@ -305,7 +291,7 @@ class MountManager {
305
291
  * @returns 落定状态(`connected` 或失败态)与清理函数;超时时 resolve `undefined`。
306
292
  */
307
293
  statusWaiter(serverName) {
308
- const settled = (status) => status !== void 0 && (status.state === "connected" || status.state === "failed" || status.state === "waiting-credentials" || status.state === "reconnecting" || status.state === "closed");
294
+ const settled = (status) => status !== void 0 && (status.state === "connected" || status.state === "failed" || status.state === "waiting-credentials" || status.state === "reconnecting" || status.state === "waiting-authorization" || status.state === "closed");
309
295
  let resolve = () => {
310
296
  };
311
297
  let finished = false;
@@ -384,6 +370,10 @@ class MountManager {
384
370
  return { phase: "failed", error: status.lastError };
385
371
  case "waiting-credentials":
386
372
  return { phase: "failed", error: status.lastError };
373
+ // 官方 OAuth:没有可用 grant(或过期/绑定不匹配/被拒/缺 scope),等用户显式授权。
374
+ // 单独一档而不是 `failed`:这是"可操作"的中间态,界面要给授权按钮。
375
+ case "waiting-authorization":
376
+ return { phase: "waiting-authorization", error: status.lastError };
387
377
  case "failed":
388
378
  return { phase: "failed", error: status.lastError ?? status.reason };
389
379
  case "closed":
@@ -537,15 +527,14 @@ class MountManager {
537
527
  /**
538
528
  * 一次性探测一个服务器配置(**不注册、不落盘、不改 `mounts`**)。
539
529
  *
540
- * 走官方 `probeServer()`(manager 的 `probe()` 底层就是它):连接、列工具、关闭,
541
- * 不占 `serverName`、不注册工具。表单里的**草稿**配置也能测,这是 manager.probe
542
- * (只测已注册项)做不到的。
530
+ * 走官方 `ctx.mcpClientHost.probe()`(0.2.3 起 `probeServer` 已不在包根):连接、列工具、关闭,
531
+ * 不占 `serverName`、不注册工具、不碰活动实例。表单里的**草稿**配置也能测,这是
532
+ * `ctx.mcpManager.probe()`(只测已注册项)做不到的。
543
533
  *
544
534
  * @param request - 目标状态(只用到配置与 env 合并)。
545
- * @param options - `oauth: true` 时用交互式预算(T4)。
546
535
  * @returns 探测结论。
547
536
  */
548
- async probe(request, options = {}) {
537
+ async probe(request) {
549
538
  const started = Date.now();
550
539
  const materialized = await this.materialize(request);
551
540
  if (materialized.entry === void 0) {
@@ -565,7 +554,7 @@ class MountManager {
565
554
  reconnect: { enabled: false },
566
555
  expandTemplates: true
567
556
  });
568
- const outcome = await probeServer(this.ctx, config, { oauth: options.oauth === true });
557
+ const outcome = await probeServer(this.ctx, config);
569
558
  return { ...outcome, diagnostics: materialized.diagnostics };
570
559
  }
571
560
  /**
@@ -0,0 +1,21 @@
1
+ import { createHash } from "node:crypto";
2
+ const OAUTH_CREDENTIAL_SCOPE = "mcp-client";
3
+ const HASH_LENGTH = 8;
4
+ const SLUG_MAX = 40;
5
+ function oauthKeySlug(serverName) {
6
+ const lowered = serverName.toLowerCase();
7
+ const folded = lowered.replace(/[^a-z0-9]+/g, "-").replace(/^-+|-+$/g, "").slice(0, SLUG_MAX).replace(/-+$/g, "");
8
+ return /^[a-z]/.test(folded) ? folded : `s${folded}`;
9
+ }
10
+ function oauthCredentialKey(serverName, digest = sha256Hex) {
11
+ const hash = digest(serverName).slice(0, HASH_LENGTH);
12
+ return `${OAUTH_CREDENTIAL_SCOPE}/${oauthKeySlug(serverName)}-${hash}`;
13
+ }
14
+ function sha256Hex(value) {
15
+ return createHash("sha256").update(value).digest("hex");
16
+ }
17
+ export {
18
+ OAUTH_CREDENTIAL_SCOPE,
19
+ oauthCredentialKey,
20
+ oauthKeySlug
21
+ };
package/lib/probe.js CHANGED
@@ -1,8 +1,6 @@
1
1
  import { createHash } from "node:crypto";
2
- import * as McpClient from "@deepseek-ai/dsh-mcp-client";
3
2
  import { errorText } from "./error-text.js";
4
3
  const PROBE_BUDGET_MS = 6e4;
5
- const PROBE_OAUTH_BUDGET_MS = 5 * 6e4;
6
4
  const MAX_PUBLIC_NAME_LENGTH = 64;
7
5
  const INVALID_NAME_CHARS = /[^A-Za-z0-9_-]/g;
8
6
  const HASH_LENGTH = 12;
@@ -14,10 +12,24 @@ function publicToolName(serverName, rawName) {
14
12
  return `${normalized.slice(0, MAX_PUBLIC_NAME_LENGTH - HASH_LENGTH - 1)}_${hash}`;
15
13
  }
16
14
  async function probeServer(ctx, config, options = {}) {
17
- const budgetMs = options.budgetMs ?? (options.oauth === true ? PROBE_OAUTH_BUDGET_MS : PROBE_BUDGET_MS);
15
+ const budgetMs = options.budgetMs ?? PROBE_BUDGET_MS;
18
16
  const started = Date.now();
17
+ const host = ctx.get("mcpClientHost");
18
+ if (process.env.DSH_MCP_OPS_DEBUG !== void 0) {
19
+ process.stderr.write(`dsh-mcp-ops: probe(${config.serverName}) host=${host === void 0 ? "MISSING" : "ok"}
20
+ `);
21
+ }
22
+ if (host === void 0) {
23
+ return {
24
+ ok: false,
25
+ tools: [],
26
+ message: "mcpClientHost is unavailable in this composition (mount @deepseek-ai/dsh-mcp-manager to test connections)",
27
+ elapsedMs: Date.now() - started
28
+ };
29
+ }
19
30
  try {
20
- const result = await McpClient.probeServer(ctx, McpClient.Config(config), { timeoutMs: budgetMs });
31
+ const resolved = host.validate(config, ["probe", config.serverName]);
32
+ const result = await host.probe(resolved, { timeoutMs: budgetMs });
21
33
  return {
22
34
  ok: result.ok,
23
35
  tools: result.ok ? result.toolNames.map((name) => ({ name: publicToolName(config.serverName, name) })) : [],
@@ -25,12 +37,14 @@ async function probeServer(ctx, config, options = {}) {
25
37
  elapsedMs: result.ok ? result.durationMs : Date.now() - started
26
38
  };
27
39
  } catch (error) {
28
- return { ok: false, tools: [], message: errorText(error), elapsedMs: Date.now() - started };
40
+ const message = errorText(error);
41
+ if (process.env.DSH_MCP_OPS_DEBUG !== void 0) process.stderr.write(`dsh-mcp-ops: probe(${config.serverName}) failed: ${message}
42
+ `);
43
+ return { ok: false, tools: [], message, elapsedMs: Date.now() - started };
29
44
  }
30
45
  }
31
46
  export {
32
47
  PROBE_BUDGET_MS,
33
- PROBE_OAUTH_BUDGET_MS,
34
48
  probeServer,
35
49
  publicToolName
36
50
  };
package/lib/refs.js CHANGED
@@ -1,18 +1,13 @@
1
- import { createHash } from "node:crypto";
2
1
  const REF_PREFIX = "DSH_MCP_";
3
2
  const SERVER_REF_PREFIX = `${REF_PREFIX}_`;
4
3
  const SERVER_REF_SEP = "__";
5
4
  const LEGACY_SERVER_REF_PREFIX = REF_PREFIX;
6
5
  const LEGACY_MCP_SERVER_REF_PREFIX = `${REF_PREFIX}mcp_`;
7
6
  const GLOBAL_REF_PREFIX = `${REF_PREFIX}ENV_`;
8
- const OAUTH_REF_PREFIX = `${REF_PREFIX}OAUTH_`;
9
- const OAUTH_CLIENT_REF_PREFIX = `${REF_PREFIX}OAUTH_CLIENT_`;
10
- const OAUTH_ACCESS_REF_PREFIX = `${REF_PREFIX}OAUTH_AT_`;
11
7
  const SECRET_PLACEHOLDER = "_$secret$_";
12
8
  const SERVER_NAME_RE = /^[A-Za-z0-9_-]{1,32}$/;
13
9
  const REF_SAFE_SERVER_NAME_RE = /^[A-Za-z0-9_]{1,32}$/;
14
10
  const ENV_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
15
- const OAUTH_HASH_RE = /^[0-9a-f]{12}$/;
16
11
  const REF_NAME_RE = /^[A-Za-z_][A-Za-z0-9_]*$/;
17
12
  function refName(value) {
18
13
  if (!REF_NAME_RE.test(value)) {
@@ -55,18 +50,6 @@ function globalRef(envName) {
55
50
  }
56
51
  return refName(`${GLOBAL_REF_PREFIX}${envName}`);
57
52
  }
58
- function oauthHash(serverName) {
59
- return createHash("sha256").update(serverName, "utf8").digest("hex").slice(0, 12);
60
- }
61
- function oauthRef(serverName, client = false) {
62
- assertRefSafeServerName(serverName);
63
- const prefix = client ? OAUTH_CLIENT_REF_PREFIX : OAUTH_REF_PREFIX;
64
- return refName(`${prefix}${serverName}_${oauthHash(serverName)}`);
65
- }
66
- function oauthAccessRef(serverName) {
67
- assertRefSafeServerName(serverName);
68
- return refName(`${OAUTH_ACCESS_REF_PREFIX}${serverName}_${oauthHash(serverName)}`);
69
- }
70
53
  function resolveServerRef(ref, serverNames) {
71
54
  if (typeof ref !== "string") return void 0;
72
55
  const names = [...serverNames];
@@ -105,7 +88,6 @@ function legacySecretRef(serverName, envName, raw) {
105
88
  if (braced === null) return void 0;
106
89
  if (braced[1].startsWith(SERVER_REF_PREFIX)) return void 0;
107
90
  if (braced[1].startsWith(GLOBAL_REF_PREFIX)) return void 0;
108
- if (resolveOAuthRef(braced[1], [serverName]) !== void 0) return void 0;
109
91
  const hit = resolveServerRef(braced[1], [serverName]);
110
92
  if (hit === void 0 || hit.serverName !== serverName || hit.envName !== envName) return void 0;
111
93
  if (!REF_NAME_RE.test(braced[1])) return void 0;
@@ -119,22 +101,6 @@ function resolveGlobalRef(ref) {
119
101
  const name = ref.slice(GLOBAL_REF_PREFIX.length);
120
102
  return ENV_NAME_RE.test(name) ? { envName: name } : void 0;
121
103
  }
122
- function resolveOAuthRef(ref, serverNames) {
123
- if (typeof ref !== "string") return void 0;
124
- const client = ref.startsWith(OAUTH_CLIENT_REF_PREFIX);
125
- const access = !client && ref.startsWith(OAUTH_ACCESS_REF_PREFIX);
126
- const prefix = client ? OAUTH_CLIENT_REF_PREFIX : access ? OAUTH_ACCESS_REF_PREFIX : OAUTH_REF_PREFIX;
127
- if (!ref.startsWith(prefix)) return void 0;
128
- const rest = ref.slice(prefix.length);
129
- const cut = rest.lastIndexOf("_");
130
- if (cut <= 0) return void 0;
131
- const hash = rest.slice(cut + 1);
132
- if (!OAUTH_HASH_RE.test(hash)) return void 0;
133
- const namePart = rest.slice(0, cut);
134
- const hits = [...serverNames].filter((name) => name === namePart);
135
- if (hits.length !== 1) return void 0;
136
- return { serverName: hits[0], client, ...access ? { access: true } : {} };
137
- }
138
104
  function upperCaseConflict(candidate, existing) {
139
105
  const upper = candidate.toUpperCase();
140
106
  return [...existing].find((name) => name !== candidate && name.toUpperCase() === upper);
@@ -144,10 +110,6 @@ export {
144
110
  GLOBAL_REF_PREFIX,
145
111
  LEGACY_MCP_SERVER_REF_PREFIX,
146
112
  LEGACY_SERVER_REF_PREFIX,
147
- OAUTH_ACCESS_REF_PREFIX,
148
- OAUTH_CLIENT_REF_PREFIX,
149
- OAUTH_HASH_RE,
150
- OAUTH_REF_PREFIX,
151
113
  REF_NAME_RE,
152
114
  REF_PREFIX,
153
115
  REF_SAFE_SERVER_NAME_RE,
@@ -160,11 +122,7 @@ export {
160
122
  isLegacySecretRow,
161
123
  legacySecretRef,
162
124
  legacyServerRef,
163
- oauthAccessRef,
164
- oauthHash,
165
- oauthRef,
166
125
  resolveGlobalRef,
167
- resolveOAuthRef,
168
126
  resolveServerRef,
169
127
  serverEnvRefPrefix,
170
128
  serverRef,