@noob9527/dsh-mcp-oauth 0.2.0-rc.2 → 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 +8 -0
- package/CONTRIBUTING.md +1 -1
- package/README.md +11 -2
- package/README.zh.md +11 -2
- package/docs/releasing.md +9 -20
- package/lib/client.js +4 -2
- package/lib/index.js +74 -13
- package/lib/types/client/locales.d.ts +1 -0
- package/lib/types/connection.d.ts +3 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
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
|
+
|
|
7
|
+
## 0.2.0-rc.3 — 2026-11-27
|
|
8
|
+
|
|
9
|
+
- Negotiate modern MCP connections with legacy fallback and refresh registered tool descriptions and schemas when the server sends a tool-list change.
|
|
10
|
+
|
|
3
11
|
## 0.2.0-rc.2 — 2026-11-17
|
|
4
12
|
|
|
5
13
|
- Report malformed MCP URLs as field validation errors. Exclude unused metadata URLs when saving DCR or pre-registered settings, and identify invalid fields in localized messages.
|
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.
|
|
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
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# DSH MCP OAuth
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@noob9527/dsh-mcp-oauth)
|
|
4
|
+
[](https://www.npmjs.com/package/@noob9527/dsh-mcp-oauth?activeTab=versions)
|
|
5
|
+
[](https://github.com/noob9527/dsh-mcp-oauth/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
3
8
|
OAuth-protected MCP tools for an unmodified DeepSeek Harness installation. The plugin owns its MCP connections and uses the official tool registry, credential store, authorization service and plugin-page extension.
|
|
4
9
|
|
|
5
10
|
[中文](README.zh.md)
|
|
@@ -18,11 +23,15 @@ Independent community plugin; not an official DeepSeek product. The npm 0.1.0 re
|
|
|
18
23
|
|
|
19
24
|
Version 0.2.0-rc.2 requires DSH `>=0.2.1-alpha.3`. All 13 published versions at or above this floor in the [17-version compatibility matrix](docs/compatibility.md) passed automated checks. Later versions are admitted by the range but are not automatically certified. Version 0.1.0 retains its original rc.2 requirement.
|
|
20
25
|
|
|
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
|
+
|
|
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
|
+
|
|
21
30
|
## Install from npm
|
|
22
31
|
|
|
23
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`.
|
|
24
33
|
|
|
25
|
-
Version `0.2.0-rc.
|
|
34
|
+
Version `0.2.0-rc.4` is a release candidate distributed under `next`. Use `latest` for the stable release.
|
|
26
35
|
|
|
27
36
|
Install the published preview:
|
|
28
37
|
|
|
@@ -41,7 +50,7 @@ pnpm install --frozen-lockfile --ignore-scripts
|
|
|
41
50
|
pnpm run typecheck
|
|
42
51
|
pnpm test
|
|
43
52
|
pnpm pack --pack-destination artifacts
|
|
44
|
-
dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.
|
|
53
|
+
dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.4.tgz"
|
|
45
54
|
```
|
|
46
55
|
|
|
47
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
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
# DSH MCP OAuth
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@noob9527/dsh-mcp-oauth)
|
|
4
|
+
[](https://www.npmjs.com/package/@noob9527/dsh-mcp-oauth?activeTab=versions)
|
|
5
|
+
[](https://github.com/noob9527/dsh-mcp-oauth/actions/workflows/ci.yml)
|
|
6
|
+
[](LICENSE)
|
|
7
|
+
|
|
3
8
|
为未经修改的官方 DeepSeek Harness 提供 OAuth MCP 工具接入。插件自行管理 MCP 连接,通过官方工具、凭据、授权及插件页面接口集成。
|
|
4
9
|
|
|
5
10
|
[English](README.md)
|
|
@@ -18,11 +23,15 @@
|
|
|
18
23
|
|
|
19
24
|
0.2.0-rc.2 要求 DSH `>=0.2.1-alpha.3`。[17 版本兼容矩阵](docs/compatibility.md)中满足下限的 13 个已发布版本均通过自动化检查。范围允许安装后续版本,但不代表后续版本自动通过验收。0.1.0 保留原 rc.2 限制。
|
|
20
25
|
|
|
26
|
+
插件连接每个 MCP 服务时先尝试 `server/discover`。旧服务无法识别该方法时,插件会回退到 `initialize` 握手。现代连接会订阅服务端声明支持的工具列表变更;旧版连接可通过服务端的 SSE 流接收变更。每次收到通知,插件都会重新拉取完整工具目录,包括描述和输入 schema。
|
|
27
|
+
|
|
28
|
+
现代工具订阅中断或未获确认时,插件会保留已注册的工具和在途调用,在同一客户端上重试订阅。设置页会提示目录可能已过期。订阅恢复后,插件重新拉取完整目录。短时间内反复断流共用配置的重试次数,直到订阅持续达到最大重连间隔。重试耗尽后,可在服务设置中点击「重新连接」刷新目录。
|
|
29
|
+
|
|
21
30
|
## 从 npm 安装
|
|
22
31
|
|
|
23
32
|
需要 Node 24.9+ 和满足 `>=0.2.1-alpha.3` 的未经修改官方 DSH。公开包名为 `@noob9527/dsh-mcp-oauth`。
|
|
24
33
|
|
|
25
|
-
`0.2.0-rc.
|
|
34
|
+
`0.2.0-rc.4` 为通过 `next` 分发的候选版本;`latest` 用于安装稳定版。
|
|
26
35
|
|
|
27
36
|
安装已发布的预览版:
|
|
28
37
|
|
|
@@ -41,7 +50,7 @@ pnpm install --frozen-lockfile --ignore-scripts
|
|
|
41
50
|
pnpm run typecheck
|
|
42
51
|
pnpm test
|
|
43
52
|
pnpm pack --pack-destination artifacts
|
|
44
|
-
dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.
|
|
53
|
+
dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.4.tgz"
|
|
45
54
|
```
|
|
46
55
|
|
|
47
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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.2.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
|
-
|
|
32
|
-
|
|
33
|
-
Version `0.2.0-rc.2` 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.2.tgz --dry-run`, then publish that same file with `npm publish ./artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.2.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.2 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
|
-
|
|
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.
|
|
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,7 +556,25 @@ 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.
|
|
559
|
+
const client = new Client({ name: "@noob9527/dsh-mcp-oauth", version: "0.2.0-rc.4" }, {
|
|
560
|
+
versionNegotiation: { mode: "auto" },
|
|
561
|
+
listChanged: { tools: {
|
|
562
|
+
autoRefresh: false,
|
|
563
|
+
debounceMs: 0,
|
|
564
|
+
onChanged: () => {
|
|
565
|
+
if (client !== this.client || this.disposed) return;
|
|
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
|
+
});
|
|
575
|
+
}
|
|
576
|
+
} }
|
|
577
|
+
});
|
|
558
578
|
const abort = new AbortController();
|
|
559
579
|
this.client = client;
|
|
560
580
|
this.abort = abort;
|
|
@@ -566,13 +586,6 @@ var Connection = class {
|
|
|
566
586
|
client.onclose = lost;
|
|
567
587
|
client.onerror = () => {
|
|
568
588
|
};
|
|
569
|
-
client.setNotificationHandler("notifications/tools/list_changed", async () => {
|
|
570
|
-
try {
|
|
571
|
-
await this.synchronize(client);
|
|
572
|
-
} catch {
|
|
573
|
-
await this.retire(client, "MCP_TOOL_LIST_FAILED", true);
|
|
574
|
-
}
|
|
575
|
-
});
|
|
576
589
|
try {
|
|
577
590
|
await client.connect(transport, { timeout: config.connectTimeoutMs, signal: abort.signal });
|
|
578
591
|
await this.synchronize(client);
|
|
@@ -580,17 +593,59 @@ var Connection = class {
|
|
|
580
593
|
this.status.connection = "connected";
|
|
581
594
|
this.status.error = "";
|
|
582
595
|
this.attempts = 0;
|
|
596
|
+
if (client.getProtocolEra() === "modern" && client.getServerCapabilities()?.tools?.listChanged) {
|
|
597
|
+
this.subscriptionTask = this.maintainSubscription(client, abort.signal, client.autoOpenedSubscription);
|
|
598
|
+
}
|
|
583
599
|
} catch (error) {
|
|
600
|
+
if (this.disposed || client !== this.client) return;
|
|
601
|
+
this.client = void 0;
|
|
584
602
|
client.onclose = void 0;
|
|
603
|
+
this.unregister();
|
|
604
|
+
abort.abort();
|
|
585
605
|
await client.close().catch(() => {
|
|
586
606
|
});
|
|
587
|
-
if (this.disposed
|
|
607
|
+
if (this.disposed) return;
|
|
588
608
|
this.status.connection = "failed";
|
|
589
609
|
this.status.error = isAuthenticationError(error) ? "OAUTH_LOGIN_REQUIRED" : error instanceof OAuthMcpError ? error.code : "MCP_CONNECT_FAILED";
|
|
590
610
|
if (this.status.error === "OAUTH_LOGIN_REQUIRED") this.status.authentication = "required";
|
|
591
611
|
else this.schedule();
|
|
592
612
|
}
|
|
593
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
|
+
}
|
|
594
649
|
synchronize(client) {
|
|
595
650
|
const task = this.sync.then(async () => {
|
|
596
651
|
const tools = [];
|
|
@@ -657,7 +712,6 @@ var Connection = class {
|
|
|
657
712
|
this.status.toolCount = definitions.length;
|
|
658
713
|
});
|
|
659
714
|
this.sync = task.catch(() => {
|
|
660
|
-
this.status.error = "MCP_TOOL_LIST_FAILED";
|
|
661
715
|
});
|
|
662
716
|
return task;
|
|
663
717
|
}
|
|
@@ -678,15 +732,18 @@ var Connection = class {
|
|
|
678
732
|
} finally {
|
|
679
733
|
this.retiring.delete(task);
|
|
680
734
|
}
|
|
681
|
-
if (retry)
|
|
735
|
+
if (retry) {
|
|
736
|
+
await this.pending;
|
|
737
|
+
if (!this.client) this.schedule();
|
|
738
|
+
}
|
|
682
739
|
}
|
|
683
740
|
schedule() {
|
|
684
741
|
if (this.disposed || this.timer || this.attempts >= this.provider.config.reconnectAttempts) return;
|
|
685
|
-
const
|
|
742
|
+
const delay2 = Math.min(1e3 * 2 ** this.attempts++, this.provider.config.reconnectMaxDelayMs);
|
|
686
743
|
this.timer = setTimeout(() => {
|
|
687
744
|
this.timer = void 0;
|
|
688
745
|
void this.connect();
|
|
689
|
-
},
|
|
746
|
+
}, delay2);
|
|
690
747
|
}
|
|
691
748
|
unregister() {
|
|
692
749
|
for (const dispose of this.registrations.splice(0)) dispose();
|
|
@@ -703,6 +760,7 @@ var Connection = class {
|
|
|
703
760
|
});
|
|
704
761
|
}
|
|
705
762
|
await this.pending;
|
|
763
|
+
await this.subscriptionTask;
|
|
706
764
|
await this.sync;
|
|
707
765
|
await Promise.allSettled([...this.calls, ...this.retiring]);
|
|
708
766
|
this.status.connection = this.provider.config.enabled ? "disconnected" : "disabled";
|
|
@@ -711,6 +769,9 @@ var Connection = class {
|
|
|
711
769
|
function isAuthenticationError(error) {
|
|
712
770
|
return error instanceof UnauthorizedError || error instanceof SdkHttpError && error.code === SdkErrorCode.ClientHttpAuthentication;
|
|
713
771
|
}
|
|
772
|
+
function isRegistrationFailure(error) {
|
|
773
|
+
return error instanceof OAuthMcpError && error.code === "MCP_TOOL_REGISTRATION_FAILED";
|
|
774
|
+
}
|
|
714
775
|
|
|
715
776
|
// src/remote.ts
|
|
716
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;
|