@noob9527/dsh-mcp-oauth 0.2.0-rc.3 → 0.2.0-rc.4

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/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.0-rc.4 — 2026-12-01
4
+
5
+ - Recover interrupted modern MCP tool subscriptions with bounded retries while keeping registered tools and in-flight calls available. The settings page reports a stale catalog until resubscription and refresh succeed.
6
+
3
7
  ## 0.2.0-rc.3 — 2026-11-27
4
8
 
5
9
  - Negotiate modern MCP connections with legacy fallback and refresh registered tool descriptions and schemas when the server sends a tool-list change.
package/CONTRIBUTING.md CHANGED
@@ -10,7 +10,7 @@ pnpm run typecheck
10
10
  pnpm test
11
11
  pnpm run build
12
12
  pnpm pack --pack-destination artifacts
13
- node scripts/check-release.mjs --tarball artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.3.tgz
13
+ node scripts/check-release.mjs --tarball artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.4.tgz
14
14
  ```
15
15
 
16
16
  Describe the user-visible behavior, relevant tests and compatibility impact. Add regression tests for changes to authorization, refresh, retries or teardown. Use loopback fixtures, atomic port allocation and explicit lifecycle cleanup. Do not weaken TLS verification, log credentials or silently retry tools with unknown outcomes.
package/README.md CHANGED
@@ -25,11 +25,13 @@ Version 0.2.0-rc.2 requires DSH `>=0.2.1-alpha.3`. All 13 published versions at
25
25
 
26
26
  The plugin probes each MCP server with `server/discover` and falls back to the legacy `initialize` handshake when the server does not recognize discovery. On modern connections it subscribes to advertised tool-list changes. On legacy connections the server can deliver those changes over SSE. Each notification refreshes the full tool catalog, including descriptions and input schemas.
27
27
 
28
+ If a modern tool subscription ends or its acknowledgement fails, the plugin keeps the registered tools and in-flight calls available while it retries the subscription on the same client. The settings page warns that the catalog may be stale. After resubscribing, the plugin fetches the full catalog. Rapid disconnects share the configured retry budget until a subscription lasts for the maximum retry delay. If retries run out, Reconnect in the service settings refreshes the catalog.
29
+
28
30
  ## Install from npm
29
31
 
30
32
  Requires Node 24.9+ and an unmodified official DSH installation satisfying `>=0.2.1-alpha.3`. The public package name is `@noob9527/dsh-mcp-oauth`.
31
33
 
32
- Version `0.2.0-rc.3` is a release candidate distributed under `next`. Use `latest` for the stable release.
34
+ Version `0.2.0-rc.4` is a release candidate distributed under `next`. Use `latest` for the stable release.
33
35
 
34
36
  Install the published preview:
35
37
 
@@ -48,7 +50,7 @@ pnpm install --frozen-lockfile --ignore-scripts
48
50
  pnpm run typecheck
49
51
  pnpm test
50
52
  pnpm pack --pack-destination artifacts
51
- dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.3.tgz"
53
+ dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.4.tgz"
52
54
  ```
53
55
 
54
56
  Tests require OpenSSL supporting `req -addext`. No model API key or business MCP endpoint is needed for automated tests. Restart DSH when prompted. If DSH uses a custom `DSH_HOME`, use the same value for plugin installation and startup. For npm installation, check `npm config get registry` if the package cannot be resolved; the public registry is `https://registry.npmjs.org/`.
package/README.zh.md CHANGED
@@ -25,11 +25,13 @@
25
25
 
26
26
  插件连接每个 MCP 服务时先尝试 `server/discover`。旧服务无法识别该方法时,插件会回退到 `initialize` 握手。现代连接会订阅服务端声明支持的工具列表变更;旧版连接可通过服务端的 SSE 流接收变更。每次收到通知,插件都会重新拉取完整工具目录,包括描述和输入 schema。
27
27
 
28
+ 现代工具订阅中断或未获确认时,插件会保留已注册的工具和在途调用,在同一客户端上重试订阅。设置页会提示目录可能已过期。订阅恢复后,插件重新拉取完整目录。短时间内反复断流共用配置的重试次数,直到订阅持续达到最大重连间隔。重试耗尽后,可在服务设置中点击「重新连接」刷新目录。
29
+
28
30
  ## 从 npm 安装
29
31
 
30
32
  需要 Node 24.9+ 和满足 `>=0.2.1-alpha.3` 的未经修改官方 DSH。公开包名为 `@noob9527/dsh-mcp-oauth`。
31
33
 
32
- `0.2.0-rc.3` 为通过 `next` 分发的候选版本;`latest` 用于安装稳定版。
34
+ `0.2.0-rc.4` 为通过 `next` 分发的候选版本;`latest` 用于安装稳定版。
33
35
 
34
36
  安装已发布的预览版:
35
37
 
@@ -48,7 +50,7 @@ pnpm install --frozen-lockfile --ignore-scripts
48
50
  pnpm run typecheck
49
51
  pnpm test
50
52
  pnpm pack --pack-destination artifacts
51
- dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.3.tgz"
53
+ dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.4.tgz"
52
54
  ```
53
55
 
54
56
  测试需要支持 `req -addext` 的 OpenSSL;自动化测试不需要模型 API Key 或业务 MCP 服务。DSH 提示需要重启时,重启后继续。如果使用自定义 `DSH_HOME`,安装插件和启动 DSH 时必须使用相同值。通过 npm 安装时,如无法解析包名,请检查 `npm config get registry`;公开 registry 为 `https://registry.npmjs.org/`。
package/docs/releasing.md CHANGED
@@ -13,34 +13,23 @@ The project uses MIT. Review the license holder and existing Git author informat
13
13
 
14
14
  Suggested description: OAuth MCP tools for unmodified DeepSeek Harness, with PKCE, CIMD and credential refresh.
15
15
 
16
- GitHub CI has read-only repository permissions and no model or registry secrets. It builds a tarball artifact; it does not publish Releases, tags or npm packages. Linux/macOS workflow execution is confirmed only by a real GitHub run, not by a local test result.
16
+ ## Configure npm publishing
17
+
18
+ In the npm settings for `@noob9527/dsh-mcp-oauth`, add the GitHub Actions trusted publisher for owner `noob9527`, repository `dsh-mcp-oauth`, workflow `ci.yml`. Leave the environment empty and allow direct publishing. Only the publish job requests an OIDC token. A new binding requires its first successful publish within two days. See [npm trusted publishing](https://docs.npmjs.com/trusted-publishers/).
17
19
 
18
20
  ## Release a package
19
21
 
20
- Before declaring a release, complete the intended platform acceptance matrix, verify the exact tarball on an unmodified supported DSH, update compatibility statements and turn the changelog preview into an accurately dated release entry. Choose the release version before packing; change the documented tarball names when the version changes.
22
+ Update the version in package.json, MCP client version, changelog and affected installation examples. Complete the intended platform acceptance and push the release commit to master. Push a Git tag matching its package version when ready to publish:
21
23
 
22
24
  ```sh
23
- pnpm install --frozen-lockfile --ignore-scripts
24
- pnpm run check:release
25
- pnpm run typecheck
26
- pnpm test
27
- pnpm pack --pack-destination artifacts
28
- node scripts/check-release.mjs --tarball artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.3.tgz
25
+ version=$(node -p 'require("./package.json").version')
26
+ git tag "v$version"
27
+ git push origin "refs/tags/v$version"
29
28
  ```
30
29
 
31
- Manually create a GitHub prerelease and attach the reviewed tarball if preview distribution is desired. A source release and an npm release are distinct operations.
32
-
33
- Version `0.2.0-rc.3` is a release candidate. Publishing requires acceptance and explicit release approval. Publish release candidates under `next`, leaving the stable `latest` tag unchanged.
34
-
35
- The distribution target is the public npm registry under `@noob9527/dsh-mcp-oauth`. Package metadata fixes the registry and public access. Authenticate as an account permitted to publish under the `noob9527` scope; keep credentials outside this repository. Review the exact tarball with `npm publish ./artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.3.tgz --dry-run`, then publish that same file with `npm publish ./artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.3.tgz --access public --tag next`. Verify the registry version and install the published package into a clean official DSH profile before announcing it. No workflow automatically publishes npm packages.
36
-
37
- ## Authentication and post-publication checks
38
-
39
- Before publishing, check `npm config get registry` and `npm whoami --registry=https://registry.npmjs.org/`. The expected registry is `https://registry.npmjs.org/` and the account must have access to the package scope. A successful login alone does not satisfy npm's publishing authentication requirements. Complete the account's 2FA/browser verification when requested; do not put tokens, one-time codes or verification URLs in repository files or CI logs.
40
-
41
- An exit code of zero can mean the upload was accepted while npm still processes the package. If the CLI reports processing and public lookup returns 404, wait and check again; do not repeatedly publish the same version. Confirm `npm view @noob9527/dsh-mcp-oauth@0.2.0-rc.3 version dist.shasum --registry=https://registry.npmjs.org/`, compare the package digest, and install by registry package name in a clean official DSH profile. Only then mark registry installation as verified and remove any pending-availability notice from the READMEs and acceptance record.
30
+ A version-tag push runs the Linux, macOS and published-DSH compatibility checks. CI publishes the checked Linux tarball to the public npm registry after all checks pass. Stable versions use `latest`; versions ending in `-rc.N` use `next`. Branch pushes, pull requests and manual CI runs only validate the code.
42
31
 
43
- Published name/version pairs cannot be overwritten. Repository documentation fixes after publication do not update the README bundled in that tarball; include them in a subsequent package version when needed. Keep the reviewed release tarball intact for digest comparison.
32
+ CI waits for the public channel and tarball digest to match, then installs the exact version in a clean official DSH Web profile. If verification fails after upload, rerun the failed jobs after checking the registry. An existing version can pass verification only with the original digest. Check the tag run and its install result before announcing a release.
44
33
 
45
34
  ## Evidence limits
46
35
 
package/lib/client.js CHANGED
@@ -19990,6 +19990,7 @@ function serviceIdFromLabel(label) {
19990
19990
 
19991
19991
  // src/client/locales.ts
19992
19992
  var en = {
19993
+ catalogStale: "Tool updates are unavailable. The catalog may be out of date. Reconnect to refresh it.",
19993
19994
  fieldHelp: "Help",
19994
19995
  defaultCallbackHelp: "The default CIMD document is for local callbacks. Select Local, or configure a custom document matching your remote or manual callback.",
19995
19996
  clientIdAutoPlaceholder: "Optional; leave blank to try CIMD or dynamic registration",
@@ -20081,6 +20082,7 @@ var en = {
20081
20082
  clearConfirm: "Clear the local authorization and disconnect this service?"
20082
20083
  };
20083
20084
  var zh = {
20085
+ catalogStale: "\u5DE5\u5177\u66F4\u65B0\u6682\u4E0D\u53EF\u7528\uFF0C\u5F53\u524D\u76EE\u5F55\u53EF\u80FD\u5DF2\u8FC7\u671F\u3002\u53EF\u91CD\u65B0\u8FDE\u63A5\u4EE5\u5237\u65B0\u76EE\u5F55\u3002",
20084
20086
  fieldHelp: "\u8BF4\u660E",
20085
20087
  defaultCallbackHelp: "\u9ED8\u8BA4 CIMD \u6587\u6863\u7528\u4E8E\u672C\u673A\u56DE\u8C03\u3002\u8BF7\u9009\u62E9\u672C\u673A\u6A21\u5F0F\uFF0C\u6216\u914D\u7F6E\u4E0E\u8FDC\u7A0B\u3001\u624B\u52A8\u56DE\u8C03\u5339\u914D\u7684\u81EA\u5B9A\u4E49\u6587\u6863\u3002",
20086
20088
  clientIdAutoPlaceholder: "\u53EF\u9009\uFF1B\u7559\u7A7A\u65F6\u5C1D\u8BD5 CIMD \u6216\u52A8\u6001\u6CE8\u518C",
@@ -20279,12 +20281,12 @@ function Card({ t, view, invoke }) {
20279
20281
  ": ",
20280
20282
  row.toolCount
20281
20283
  ] }),
20282
- row.error && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { role: "alert", children: [
20284
+ row.error && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { role: "alert", children: row.error === "MCP_TOOL_CATALOG_STALE" ? t("catalogStale") : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
20283
20285
  t("failed"),
20284
20286
  " (",
20285
20287
  row.error,
20286
20288
  ")"
20287
- ] }),
20289
+ ] }) }),
20288
20290
  row.authorizationUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: row.authorizationUrl, target: "_blank", rel: "noopener noreferrer", children: t("open") }),
20289
20291
  row.config.callbackMode === "manual" && row.authentication === "authorizing" && row.authorizationUrl && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ManualInput, { id: row.config.id, t, invoke }, row.authorizationUrl),
20290
20292
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { style: actions, children: [
package/lib/index.js CHANGED
@@ -515,6 +515,7 @@ var Provider = class {
515
515
  };
516
516
 
517
517
  // src/connection.ts
518
+ import { setTimeout as delay } from "node:timers/promises";
518
519
  import { createHash as createHash3 } from "node:crypto";
519
520
  import { Client, StreamableHTTPClientTransport, UnauthorizedError, SdkHttpError, SdkErrorCode } from "@modelcontextprotocol/client";
520
521
  import { createMcpToolDefinition } from "@deepseek-ai/dsh-mcp-client";
@@ -535,6 +536,7 @@ var Connection = class {
535
536
  pending;
536
537
  timer;
537
538
  disposed = false;
539
+ subscriptionTask;
538
540
  attempts = 0;
539
541
  calls = /* @__PURE__ */ new Set();
540
542
  retiring = /* @__PURE__ */ new Set();
@@ -554,14 +556,22 @@ var Connection = class {
554
556
  this.timer = void 0;
555
557
  this.status.connection = "connecting";
556
558
  this.status.error = "";
557
- const client = new Client({ name: "@noob9527/dsh-mcp-oauth", version: "0.2.0-rc.3" }, {
559
+ const client = new Client({ name: "@noob9527/dsh-mcp-oauth", version: "0.2.0-rc.4" }, {
558
560
  versionNegotiation: { mode: "auto" },
559
561
  listChanged: { tools: {
560
562
  autoRefresh: false,
561
563
  debounceMs: 0,
562
564
  onChanged: () => {
563
565
  if (client !== this.client || this.disposed) return;
564
- void this.synchronize(client).catch(() => this.retire(client, "MCP_TOOL_LIST_FAILED", true));
566
+ void this.synchronize(client).then(() => {
567
+ if (client === this.client && this.status.error === "MCP_TOOL_LIST_FAILED") this.status.error = "";
568
+ }, (error) => {
569
+ if (client !== this.client || this.disposed) return;
570
+ if (client.getProtocolEra() !== "modern" || isRegistrationFailure(error)) {
571
+ return this.retire(client, "MCP_TOOL_LIST_FAILED", true);
572
+ }
573
+ if (!this.status.error) this.status.error = "MCP_TOOL_LIST_FAILED";
574
+ });
565
575
  }
566
576
  } }
567
577
  });
@@ -583,17 +593,59 @@ var Connection = class {
583
593
  this.status.connection = "connected";
584
594
  this.status.error = "";
585
595
  this.attempts = 0;
596
+ if (client.getProtocolEra() === "modern" && client.getServerCapabilities()?.tools?.listChanged) {
597
+ this.subscriptionTask = this.maintainSubscription(client, abort.signal, client.autoOpenedSubscription);
598
+ }
586
599
  } catch (error) {
600
+ if (this.disposed || client !== this.client) return;
601
+ this.client = void 0;
587
602
  client.onclose = void 0;
603
+ this.unregister();
604
+ abort.abort();
588
605
  await client.close().catch(() => {
589
606
  });
590
- if (this.disposed || client !== this.client) return;
607
+ if (this.disposed) return;
591
608
  this.status.connection = "failed";
592
609
  this.status.error = isAuthenticationError(error) ? "OAUTH_LOGIN_REQUIRED" : error instanceof OAuthMcpError ? error.code : "MCP_CONNECT_FAILED";
593
610
  if (this.status.error === "OAUTH_LOGIN_REQUIRED") this.status.authentication = "required";
594
611
  else this.schedule();
595
612
  }
596
613
  }
614
+ /** A lost notification stream leaves the client's independent HTTP tool calls usable. */
615
+ async maintainSubscription(client, signal, subscription) {
616
+ const { reconnectAttempts, reconnectMaxDelayMs, connectTimeoutMs } = this.provider.config;
617
+ let attempts = 0;
618
+ while (!signal.aborted) {
619
+ if (subscription?.honoredFilter.toolsListChanged) {
620
+ const since = performance.now();
621
+ const cause = await subscription.closed;
622
+ if (signal.aborted || cause === "local") return;
623
+ if (performance.now() - since >= reconnectMaxDelayMs) attempts = 0;
624
+ } else if (subscription) {
625
+ await subscription.close();
626
+ }
627
+ if (signal.aborted) return;
628
+ this.status.error = "MCP_TOOL_CATALOG_STALE";
629
+ if (attempts >= reconnectAttempts) return;
630
+ subscription = void 0;
631
+ try {
632
+ await delay(Math.min(1e3 * 2 ** attempts++, reconnectMaxDelayMs), void 0, { signal });
633
+ subscription = await client.listen({ toolsListChanged: true }, { signal, timeout: connectTimeoutMs });
634
+ if (subscription.honoredFilter.toolsListChanged) {
635
+ await this.synchronize(client);
636
+ if (!signal.aborted) this.status.error = "";
637
+ }
638
+ } catch (error) {
639
+ if (signal.aborted) return;
640
+ if (isRegistrationFailure(error)) {
641
+ await this.retire(client, "MCP_TOOL_REGISTRATION_FAILED", true);
642
+ return;
643
+ }
644
+ await subscription?.close();
645
+ subscription = void 0;
646
+ }
647
+ }
648
+ }
597
649
  synchronize(client) {
598
650
  const task = this.sync.then(async () => {
599
651
  const tools = [];
@@ -660,7 +712,6 @@ var Connection = class {
660
712
  this.status.toolCount = definitions.length;
661
713
  });
662
714
  this.sync = task.catch(() => {
663
- this.status.error = "MCP_TOOL_LIST_FAILED";
664
715
  });
665
716
  return task;
666
717
  }
@@ -681,15 +732,18 @@ var Connection = class {
681
732
  } finally {
682
733
  this.retiring.delete(task);
683
734
  }
684
- if (retry) this.schedule();
735
+ if (retry) {
736
+ await this.pending;
737
+ if (!this.client) this.schedule();
738
+ }
685
739
  }
686
740
  schedule() {
687
741
  if (this.disposed || this.timer || this.attempts >= this.provider.config.reconnectAttempts) return;
688
- const delay = Math.min(1e3 * 2 ** this.attempts++, this.provider.config.reconnectMaxDelayMs);
742
+ const delay2 = Math.min(1e3 * 2 ** this.attempts++, this.provider.config.reconnectMaxDelayMs);
689
743
  this.timer = setTimeout(() => {
690
744
  this.timer = void 0;
691
745
  void this.connect();
692
- }, delay);
746
+ }, delay2);
693
747
  }
694
748
  unregister() {
695
749
  for (const dispose of this.registrations.splice(0)) dispose();
@@ -706,6 +760,7 @@ var Connection = class {
706
760
  });
707
761
  }
708
762
  await this.pending;
763
+ await this.subscriptionTask;
709
764
  await this.sync;
710
765
  await Promise.allSettled([...this.calls, ...this.retiring]);
711
766
  this.status.connection = this.provider.config.enabled ? "disconnected" : "disabled";
@@ -714,6 +769,9 @@ var Connection = class {
714
769
  function isAuthenticationError(error) {
715
770
  return error instanceof UnauthorizedError || error instanceof SdkHttpError && error.code === SdkErrorCode.ClientHttpAuthentication;
716
771
  }
772
+ function isRegistrationFailure(error) {
773
+ return error instanceof OAuthMcpError && error.code === "MCP_TOOL_REGISTRATION_FAILED";
774
+ }
717
775
 
718
776
  // src/remote.ts
719
777
  import { z as z3 } from "zod";
@@ -1,5 +1,6 @@
1
1
  /** Locale-owned configuration and action labels. */
2
2
  export declare const en: {
3
+ readonly catalogStale: "Tool updates are unavailable. The catalog may be out of date. Reconnect to refresh it.";
3
4
  readonly fieldHelp: "Help";
4
5
  readonly defaultCallbackHelp: "The default CIMD document is for local callbacks. Select Local, or configure a custom document matching your remote or manual callback.";
5
6
  readonly clientIdAutoPlaceholder: "Optional; leave blank to try CIMD or dynamic registration";
@@ -12,6 +12,7 @@ export declare class Connection {
12
12
  private pending?;
13
13
  private timer?;
14
14
  private disposed;
15
+ private subscriptionTask?;
15
16
  private attempts;
16
17
  private calls;
17
18
  private retiring;
@@ -19,6 +20,8 @@ export declare class Connection {
19
20
  constructor(ctx: Context, provider: Provider, status: ServerStatus);
20
21
  connect(): Promise<void>;
21
22
  private open;
23
+ /** A lost notification stream leaves the client's independent HTTP tool calls usable. */
24
+ private maintainSubscription;
22
25
  private synchronize;
23
26
  private retire;
24
27
  private schedule;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@noob9527/dsh-mcp-oauth",
3
- "version": "0.2.0-rc.3",
3
+ "version": "0.2.0-rc.4",
4
4
  "description": "OAuth MCP tools for unmodified DeepSeek Harness",
5
5
  "type": "module",
6
6
  "license": "MIT",