dsh-mcp 1.15.2 → 1.15.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.en.md +24 -0
- package/CHANGELOG.md +24 -0
- package/README.en.md +1 -1
- package/README.md +1 -1
- package/lib/client.js +14 -14
- package/lib/index.js +8 -1
- package/lib/oauth-server-url.js +37 -0
- package/lib/oauth.js +12 -1
- package/package.json +1 -1
- package/src/client/remote-contribution.js +23 -14
package/CHANGELOG.en.md
CHANGED
|
@@ -12,6 +12,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
12
12
|
- **Supported DSH version**: **dsh `0.2.2-rc.3`** — the latest release is developed and verified on `0.2.2-rc.3` (declared in `package.json` → `dsh.supported`); older entries state the version verified at their time. When the DSH and plugin versions do not match, the Settings page reports a diagnosis (check whether the bundle is selected → restart `dsh web` → hard-refresh → upgrade both sides).
|
|
13
13
|
- **Release convention**: every version entry states `- **Supported DSH version**: dsh <version>`, mirrored in the GitHub Release notes. The release body is written in **Chinese** (matching [CHANGELOG.md](CHANGELOG.md)), with heading levels mirroring the entry.
|
|
14
14
|
|
|
15
|
+
## [1.15.4] - 2026-11-21
|
|
16
|
+
|
|
17
|
+
- **Supported DSH version**: **dsh `0.2.2-rc.3`**
|
|
18
|
+
|
|
19
|
+
### Fixed
|
|
20
|
+
|
|
21
|
+
- **OAuth token exchange failed: the callback rebuilt the authorization-server URL from `authorizationUrl.origin`, dropping the issuer's path (issue #27)**: `createToolAuthorizationUrlOnce()` already receives the path-bearing `info.authorizationServerUrl` from `discoverOAuthServerInfo()` (Appwrite's `https://fra.cloud.appwrite.io/v1/oauth2/console`, Keycloak's `/realms/<realm>`, …), but the token-exchange callback used `new URL(authorizationUrl.origin)`. For a path-based issuer that requests `<host>/.well-known/oauth-authorization-server`, which answers 404, so the SDK throws before sending any token request — the browser shows a successful authorization while tokens are never stored, and mount retries keep re-opening the authorization page
|
|
22
|
+
- New dependency-free `lib/oauth-server-url.js`: prefers the discovered authorization-server URL and falls back to the authorization page's origin only when no discovery result exists; the callback in `lib/oauth.js` now uses that helper
|
|
23
|
+
- New `test/oauth-server-url.test.mjs`: covers a path-based issuer (Appwrite), a string discovery result, the no-discovery fallback, and an invalid discovery result — asserting it never degrades to the origin
|
|
24
|
+
|
|
25
|
+
## [1.15.3] - 2026-11-18
|
|
26
|
+
|
|
27
|
+
- **Supported DSH version**: **dsh `0.2.2-rc.3`**
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
|
|
31
|
+
- **Plugin failed to mount on DSH 0.2.2-rc.3: `service "mcpManager" has been registered at <McpServerManager>` (issue #25)**: since rc.3 DSH ships `McpServerManager`, which owns the `mcpManager` Cordis service key, while this plugin registered the very same key — Cordis refuses a second registration of one key, so the plugin row errored out and the MCP settings page was unusable. The plugin's Cordis service key is now **`dshMcpManager`**, with the wire namespace still declared as `mcpManager` (`super(ctx, "dshMcpManager", { namespace: "mcpManager" })`). The Remote contract is therefore unchanged: the client contribution's `namespace` and every endpoint stay as they were, and the gateway routes by `<namespace>/<method>` rather than by service key; the endpoint sets still never overlap the built-in manager's `mcpManager/probe|restart|watch`
|
|
32
|
+
- The client descriptors' `service` field now names `dshMcpManager` too (14 places) while `namespace` stays `mcpManager`: the gateway resolves the receiver with `ctx.get(descriptor.service)` and then validates the binding against `descriptor.namespace`, so both must mirror the host's `super(ctx, …)` arguments — changing one side alone makes every call fail with `gateway/method-unavailable`
|
|
33
|
+
- New `test/service-key.test.mjs`: asserts the host no longer claims the `mcpManager` Cordis service key and that every client descriptor's `service`/`namespace` matches the host declaration (guarding against a one-sided rename)
|
|
34
|
+
|
|
35
|
+
### Notes
|
|
36
|
+
|
|
37
|
+
- `lib/client.js` rebuilt: 14 changed lines (the `service` field), `zod` stays 4.4.3, no dependency or path drift, and the build is reproducible
|
|
38
|
+
|
|
15
39
|
## [1.15.2] - 2026-11-15
|
|
16
40
|
|
|
17
41
|
- **Supported DSH version**: **dsh `0.2.2-rc.3`**
|
package/CHANGELOG.md
CHANGED
|
@@ -12,6 +12,30 @@
|
|
|
12
12
|
- **支持版本**:**dsh `0.2.2-rc.3`** —— 最新版本在 `0.2.2-rc.3` 上开发与验证(`package.json` → `dsh.supported` 同步声明);历史版本条目各自声明当时验证的版本。DSH 与插件版本不匹配时,设置页会给出排查诊断(核对 bundle 是否已选中 → 重启 `dsh web` → 硬刷新 → 同步升级)。
|
|
13
13
|
- **发版约定**:每个版本条目都要声明 `- **支持版本**:dsh <版本>`,并在 GitHub Release notes 中同步。Release 正文用**中文**(与本文档一致),标题层级与条目一致。
|
|
14
14
|
|
|
15
|
+
## [1.15.4] - 2026-11-21
|
|
16
|
+
|
|
17
|
+
- **支持版本**:**dsh `0.2.2-rc.3`**
|
|
18
|
+
|
|
19
|
+
### 修复
|
|
20
|
+
|
|
21
|
+
- **OAuth 换 token 失败:回调里用 `authorizationUrl.origin` 重建授权服务器地址,丢掉 issuer 的路径(issue #27)**:`createToolAuthorizationUrlOnce()` 已经通过 `discoverOAuthServerInfo()` 拿到带路径的 `info.authorizationServerUrl`(如 Appwrite 的 `https://fra.cloud.appwrite.io/v1/oauth2/console`、Keycloak 的 `/realms/<realm>`),但回调换 token 时改成了 `new URL(authorizationUrl.origin)`。对带路径的 issuer,这会请求 `<host>/.well-known/oauth-authorization-server` 并得到 404,SDK 在发出 token 请求之前就抛错——浏览器已显示授权成功,token 却永远不落库,挂载重试还会反复弹出授权页
|
|
22
|
+
- 新增无依赖模块 `lib/oauth-server-url.js`:优先使用发现结果中的授权服务器 URL,仅在没有任何发现结果时回退到授权页的 origin;`lib/oauth.js` 的回调改用该 helper
|
|
23
|
+
- 新增 `test/oauth-server-url.test.mjs`:覆盖带路径 issuer(Appwrite)、字符串形式的发现结果、无发现结果回退、以及非法发现结果回退,断言不会退化成 origin
|
|
24
|
+
|
|
25
|
+
## [1.15.3] - 2026-11-18
|
|
26
|
+
|
|
27
|
+
- **支持版本**:**dsh `0.2.2-rc.3`**
|
|
28
|
+
|
|
29
|
+
### 修复
|
|
30
|
+
|
|
31
|
+
- **DSH 0.2.2-rc.3 上插件挂载失败:`service "mcpManager" has been registered at <McpServerManager>`(issue #25)**:rc.3 起 DSH 内置的 `McpServerManager` 占用了 Cordis 服务键 `mcpManager`,而本插件一直用它作为自己的服务名——Cordis 不允许同一个服务键注册两次,于是插件行直接报错、MCP 设置页不可用。现在把本插件的 Cordis 服务键改为 **`dshMcpManager`**,同时**显式声明线名仍为 `mcpManager`**(`super(ctx, "dshMcpManager", { namespace: "mcpManager" })`)。Remote 契约因此完全不变:客户端 contribution 的 `namespace` 与全部 endpoint 一个未动,网关按 `<namespace>/<method>` 路由而非按服务键解析;与内置管理器 `mcpManager/probe|restart|watch` 的端点依然无交集
|
|
32
|
+
- 客户端 descriptor 的 `service` 字段同步改为 `dshMcpManager`(14 处),`namespace` 保持 `mcpManager`:网关是按 `ctx.get(descriptor.service)` 取接收者、再用 `descriptor.namespace` 校验绑定的,两者必须与宿主 `super(ctx, …)` 参数一一对应,只改一侧会让每次调用报 `gateway/method-unavailable`
|
|
33
|
+
- 新增 `test/service-key.test.mjs`:断言宿主不再占用 `mcpManager` 这个 Cordis 服务键、且客户端每个 descriptor 的 `service`/`namespace` 都与宿主声明完全一致(防止只改一侧)
|
|
34
|
+
|
|
35
|
+
### 说明
|
|
36
|
+
|
|
37
|
+
- `lib/client.js` 重建:diff 仅 14 行(`service` 字段),`zod` 仍为 4.4.3,无依赖/路径漂移,重建可复现
|
|
38
|
+
|
|
15
39
|
## [1.15.2] - 2026-11-15
|
|
16
40
|
|
|
17
41
|
- **支持版本**:**dsh `0.2.2-rc.3`**
|
package/README.en.md
CHANGED
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
- **Image result passthrough**: images returned by MCP tools (screenshots/charts) are projected through the attachment service into model image context, with strict preflight and bounded fallbacks (PR #4)
|
|
24
24
|
- **Two injection modes**: `search` (on-demand, token-saving) and `full` (inject everything)
|
|
25
25
|
- **Zero npm dependencies**: plugs into DeepSeek Harness internals, install and go
|
|
26
|
-
- **OAuth authentication**: for `streamable-http` servers using MCP OAuth (authorization-code + PKCE), the server card has an **Authorize** button and the **Host opens the system browser** for the login; the page then polls the authorization status every 5 seconds. Tokens and OAuth client info are persisted in the credentials document; when the access token expires the SDK **renews it silently** with the stored refresh token (no interruption, no browser), and only a revoked/expired refresh token needs re-authorization. **Before you authorize it only says "authorizing"; a real failure reports its reason**
|
|
26
|
+
- **OAuth authentication**: for `streamable-http` servers using MCP OAuth (authorization-code + PKCE), the server card has an **Authorize** button and the **Host opens the system browser** for the login; the page then polls the authorization status every 5 seconds. Tokens and OAuth client info are persisted in the credentials document; when the access token expires the SDK **renews it silently** with the stored refresh token (no interruption, no browser), and only a revoked/expired refresh token needs re-authorization. **Before you authorize it only says "authorizing"; a real failure reports its reason**. **Path-based issuers are supported** (Appwrite's `/v1/oauth2/console`, Keycloak's `/realms/<realm>`, …): both discovery and the token exchange keep the issuer's full path instead of degrading to the site root (which makes `.well-known` answer 404 and leaves a completed authorization without stored tokens)
|
|
27
27
|
- **HTTPS verified against the system trust store by default**: intranet/corporate CAs (roots installed in the OS keychain) no longer need `NODE_OPTIONS=--use-system-ca` on `dsh web`; the plugin merges the OS store into Node's default root store at startup
|
|
28
28
|
- **Three install paths**: npm / GitHub git source / local link; bilingual UI and docs
|
|
29
29
|
|
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
- **图片结果透传**:MCP 工具返回的图片(截图/图表等)经附件服务投影为图片引用进入模型上下文,带严格预检与有界降级文案(PR #4)
|
|
26
26
|
- **双注入模式**:`search`(按需检索,省 token)与 `full`(全量注入)
|
|
27
27
|
- **零 npm 依赖**:直接对接 DeepSeek Harness 内部能力,安装即用
|
|
28
|
-
- **OAuth 认证支持**:`streamable-http` 服务器若走 MCP OAuth(授权码 + PKCE),服务器卡片点「OAuth 授权」按钮,**由宿主打开系统浏览器**完成授权,本页每 5 秒轮询授权状态;token 与 client 信息持久化在凭据文档;access token 过期后由 SDK 用存储的 refresh token **静默续期**(不会打断使用、也不会再弹浏览器),只有 refresh token
|
|
28
|
+
- **OAuth 认证支持**:`streamable-http` 服务器若走 MCP OAuth(授权码 + PKCE),服务器卡片点「OAuth 授权」按钮,**由宿主打开系统浏览器**完成授权,本页每 5 秒轮询授权状态;token 与 client 信息持久化在凭据文档;access token 过期后由 SDK 用存储的 refresh token **静默续期**(不会打断使用、也不会再弹浏览器),只有 refresh token 也被吊销/过期时才需要重新授权。**授权完成前只显示「授权中」,授权失败会写明原因**。**支持 issuer 带路径的授权服务器**(如 Appwrite 的 `/v1/oauth2/console`、Keycloak 的 `/realms/<realm>`):元数据发现与换 token 都使用 issuer 的完整路径,不会退化成站点根路径(否则 `.well-known` 会 404、授权成功但 token 落不了库)
|
|
29
29
|
- **HTTPS 默认按系统证书校验**:内网/公司 CA(只装在系统钥匙串里的根证书)无需再给 `dsh web` 加 `NODE_OPTIONS=--use-system-ca`,插件启动时把系统信任库并入 Node 默认根证书库
|
|
30
30
|
- **三种安装方式**:npm / GitHub git 源 / 本地 link;中英文界面与文档
|
|
31
31
|
|
package/lib/client.js
CHANGED
|
@@ -14983,7 +14983,7 @@ var TYPERT_REMOTE = {
|
|
|
14983
14983
|
descriptors: [
|
|
14984
14984
|
{
|
|
14985
14985
|
id: "dsh-mcp#mcpManager/delete",
|
|
14986
|
-
service: "
|
|
14986
|
+
service: "dshMcpManager",
|
|
14987
14987
|
namespace: "mcpManager",
|
|
14988
14988
|
method: "delete",
|
|
14989
14989
|
invocation: { kind: "direct" },
|
|
@@ -15010,7 +15010,7 @@ var TYPERT_REMOTE = {
|
|
|
15010
15010
|
},
|
|
15011
15011
|
{
|
|
15012
15012
|
id: "dsh-mcp#mcpManager/list",
|
|
15013
|
-
service: "
|
|
15013
|
+
service: "dshMcpManager",
|
|
15014
15014
|
namespace: "mcpManager",
|
|
15015
15015
|
method: "list",
|
|
15016
15016
|
invocation: { kind: "direct" },
|
|
@@ -15025,7 +15025,7 @@ var TYPERT_REMOTE = {
|
|
|
15025
15025
|
},
|
|
15026
15026
|
{
|
|
15027
15027
|
id: "dsh-mcp#mcpManager/test",
|
|
15028
|
-
service: "
|
|
15028
|
+
service: "dshMcpManager",
|
|
15029
15029
|
namespace: "mcpManager",
|
|
15030
15030
|
method: "test",
|
|
15031
15031
|
invocation: { kind: "direct" },
|
|
@@ -15052,7 +15052,7 @@ var TYPERT_REMOTE = {
|
|
|
15052
15052
|
},
|
|
15053
15053
|
{
|
|
15054
15054
|
id: "dsh-mcp#mcpManager/upsert",
|
|
15055
|
-
service: "
|
|
15055
|
+
service: "dshMcpManager",
|
|
15056
15056
|
namespace: "mcpManager",
|
|
15057
15057
|
method: "upsert",
|
|
15058
15058
|
invocation: { kind: "direct" },
|
|
@@ -15079,7 +15079,7 @@ var TYPERT_REMOTE = {
|
|
|
15079
15079
|
},
|
|
15080
15080
|
{
|
|
15081
15081
|
id: "dsh-mcp#mcpManager/upsertJson",
|
|
15082
|
-
service: "
|
|
15082
|
+
service: "dshMcpManager",
|
|
15083
15083
|
namespace: "mcpManager",
|
|
15084
15084
|
method: "upsertJson",
|
|
15085
15085
|
invocation: { kind: "direct" },
|
|
@@ -15106,7 +15106,7 @@ var TYPERT_REMOTE = {
|
|
|
15106
15106
|
},
|
|
15107
15107
|
{
|
|
15108
15108
|
id: "dsh-mcp#mcpManager/toolsList",
|
|
15109
|
-
service: "
|
|
15109
|
+
service: "dshMcpManager",
|
|
15110
15110
|
namespace: "mcpManager",
|
|
15111
15111
|
method: "toolsList",
|
|
15112
15112
|
invocation: { kind: "direct" },
|
|
@@ -15121,7 +15121,7 @@ var TYPERT_REMOTE = {
|
|
|
15121
15121
|
},
|
|
15122
15122
|
{
|
|
15123
15123
|
id: "dsh-mcp#mcpManager/toolsSet",
|
|
15124
|
-
service: "
|
|
15124
|
+
service: "dshMcpManager",
|
|
15125
15125
|
namespace: "mcpManager",
|
|
15126
15126
|
method: "toolsSet",
|
|
15127
15127
|
invocation: { kind: "direct" },
|
|
@@ -15148,7 +15148,7 @@ var TYPERT_REMOTE = {
|
|
|
15148
15148
|
},
|
|
15149
15149
|
{
|
|
15150
15150
|
id: "dsh-mcp#mcpManager/toolsMode",
|
|
15151
|
-
service: "
|
|
15151
|
+
service: "dshMcpManager",
|
|
15152
15152
|
namespace: "mcpManager",
|
|
15153
15153
|
method: "toolsMode",
|
|
15154
15154
|
invocation: { kind: "direct" },
|
|
@@ -15175,7 +15175,7 @@ var TYPERT_REMOTE = {
|
|
|
15175
15175
|
},
|
|
15176
15176
|
{
|
|
15177
15177
|
id: "dsh-mcp#mcpManager/envList",
|
|
15178
|
-
service: "
|
|
15178
|
+
service: "dshMcpManager",
|
|
15179
15179
|
namespace: "mcpManager",
|
|
15180
15180
|
method: "envList",
|
|
15181
15181
|
invocation: { kind: "direct" },
|
|
@@ -15190,7 +15190,7 @@ var TYPERT_REMOTE = {
|
|
|
15190
15190
|
},
|
|
15191
15191
|
{
|
|
15192
15192
|
id: "dsh-mcp#mcpManager/envSet",
|
|
15193
|
-
service: "
|
|
15193
|
+
service: "dshMcpManager",
|
|
15194
15194
|
namespace: "mcpManager",
|
|
15195
15195
|
method: "envSet",
|
|
15196
15196
|
invocation: { kind: "direct" },
|
|
@@ -15217,7 +15217,7 @@ var TYPERT_REMOTE = {
|
|
|
15217
15217
|
},
|
|
15218
15218
|
{
|
|
15219
15219
|
id: "dsh-mcp#mcpManager/adopt",
|
|
15220
|
-
service: "
|
|
15220
|
+
service: "dshMcpManager",
|
|
15221
15221
|
namespace: "mcpManager",
|
|
15222
15222
|
method: "adopt",
|
|
15223
15223
|
invocation: { kind: "direct" },
|
|
@@ -15244,7 +15244,7 @@ var TYPERT_REMOTE = {
|
|
|
15244
15244
|
},
|
|
15245
15245
|
{
|
|
15246
15246
|
id: "dsh-mcp#mcpManager/release",
|
|
15247
|
-
service: "
|
|
15247
|
+
service: "dshMcpManager",
|
|
15248
15248
|
namespace: "mcpManager",
|
|
15249
15249
|
method: "release",
|
|
15250
15250
|
invocation: { kind: "direct" },
|
|
@@ -15271,7 +15271,7 @@ var TYPERT_REMOTE = {
|
|
|
15271
15271
|
},
|
|
15272
15272
|
{
|
|
15273
15273
|
id: "dsh-mcp#mcpManager/oauthStart",
|
|
15274
|
-
service: "
|
|
15274
|
+
service: "dshMcpManager",
|
|
15275
15275
|
namespace: "mcpManager",
|
|
15276
15276
|
method: "oauthStart",
|
|
15277
15277
|
invocation: { kind: "direct" },
|
|
@@ -15298,7 +15298,7 @@ var TYPERT_REMOTE = {
|
|
|
15298
15298
|
},
|
|
15299
15299
|
{
|
|
15300
15300
|
id: "dsh-mcp#mcpManager/oauthStatus",
|
|
15301
|
-
service: "
|
|
15301
|
+
service: "dshMcpManager",
|
|
15302
15302
|
namespace: "mcpManager",
|
|
15303
15303
|
method: "oauthStatus",
|
|
15304
15304
|
invocation: { kind: "direct" },
|
package/lib/index.js
CHANGED
|
@@ -642,7 +642,14 @@ let McpManagerService = (() => {
|
|
|
642
642
|
* @param config - Resolved manager configuration.
|
|
643
643
|
*/
|
|
644
644
|
constructor(ctx, config) {
|
|
645
|
-
|
|
645
|
+
// The Cordis service key must be ours alone: DSH >= 0.2.2-rc.3 ships
|
|
646
|
+
// an official `McpServerManager` that registers the `mcpManager`
|
|
647
|
+
// service key, and Cordis refuses a second registration of the same
|
|
648
|
+
// key (issue #25). The wire namespace is passed explicitly so the
|
|
649
|
+
// Remote contract stays `mcpManager/*` — the browser half and every
|
|
650
|
+
// existing endpoint keep working, and the gateway routes by
|
|
651
|
+
// `<namespace>/<method>` rather than by service key.
|
|
652
|
+
super(ctx, "dshMcpManager", { namespace: "mcpManager" });
|
|
646
653
|
this.probeTimeoutMs = config.probeTimeoutMs;
|
|
647
654
|
this.allowBrowserOnMount = config.allowBrowserOnMount;
|
|
648
655
|
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pick the authorization-server base URL for the token exchange.
|
|
3
|
+
*
|
|
4
|
+
* The exchange (metadata re-discovery + `exchangeAuthorization`) must talk to
|
|
5
|
+
* the authorization server the flow was STARTED against, not to the origin of
|
|
6
|
+
* the authorization page: an issuer may carry a path (`https://host/v1/oauth2/
|
|
7
|
+
* console`, Keycloak's `/realms/<realm>`, …), and `authorizationUrl.origin`
|
|
8
|
+
* silently drops it. Rebuilding from the origin then requests
|
|
9
|
+
* `<host>/.well-known/oauth-authorization-server`, which for a path-based
|
|
10
|
+
* issuer answers 404 — the SDK throws before any token request is made, so a
|
|
11
|
+
* completed authorization never produces stored tokens.
|
|
12
|
+
*
|
|
13
|
+
* The discovered URL is therefore preferred whenever it is available; the
|
|
14
|
+
* authorization URL's origin remains the last-resort fallback for the legacy
|
|
15
|
+
* provider path where no discovery result exists.
|
|
16
|
+
* @module dsh-mcp/oauth-server-url
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Resolve the authorization-server base URL used by the token exchange.
|
|
21
|
+
* @param discoveredUrl - the URL returned by discovery (`info.authorizationServerUrl`), when one exists.
|
|
22
|
+
* @param authorizationUrl - the authorization URL handed to the browser (URL instance).
|
|
23
|
+
* @returns the URL to discover metadata from and to exchange the code against.
|
|
24
|
+
*/
|
|
25
|
+
export function authorizationServerBaseUrl(discoveredUrl, authorizationUrl) {
|
|
26
|
+
if (discoveredUrl !== void 0 && discoveredUrl !== null) {
|
|
27
|
+
const text = String(discoveredUrl);
|
|
28
|
+
if (text.length > 0) {
|
|
29
|
+
try {
|
|
30
|
+
return new URL(text);
|
|
31
|
+
} catch {
|
|
32
|
+
/* not a URL — fall back to the authorization page's origin */
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
return new URL(authorizationUrl.origin);
|
|
37
|
+
}
|
package/lib/oauth.js
CHANGED
|
@@ -22,6 +22,7 @@ import {
|
|
|
22
22
|
} from "@modelcontextprotocol/client";
|
|
23
23
|
import { credentialRef } from "@deepseek-ai/dsh-credentials";
|
|
24
24
|
import { browserCommand } from "./browser-command.js";
|
|
25
|
+
import { authorizationServerBaseUrl } from "./oauth-server-url.js";
|
|
25
26
|
import { hostText } from "./host-locales.js";
|
|
26
27
|
import { systemFetch } from "./system-ca.js";
|
|
27
28
|
|
|
@@ -572,6 +573,16 @@ async function createToolAuthorizationUrlOnce(serverId, ctx, serverUrl) {
|
|
|
572
573
|
});
|
|
573
574
|
const url = String(authorizationUrl);
|
|
574
575
|
|
|
576
|
+
// The exchange must talk to the authorization server this flow was started
|
|
577
|
+
// against. Its issuer may carry a path (Appwrite's
|
|
578
|
+
// `https://fra.cloud.appwrite.io/v1/oauth2/console`, Keycloak's
|
|
579
|
+
// `/realms/<realm>`), and rebuilding it from `authorizationUrl.origin` drops
|
|
580
|
+
// that path — discovery then 404s against `<host>/.well-known/...` and the
|
|
581
|
+
// SDK throws before any token request, so a completed authorization never
|
|
582
|
+
// stores tokens. Keep the discovered URL and let the helper fall back to the
|
|
583
|
+
// origin only when no discovery result exists.
|
|
584
|
+
const discoveredAuthorizationServerUrl = info.authorizationServerUrl;
|
|
585
|
+
|
|
575
586
|
// Background listener: wait for the user to open the URL and authorize.
|
|
576
587
|
const pending = {
|
|
577
588
|
url,
|
|
@@ -600,7 +611,7 @@ async function createToolAuthorizationUrlOnce(serverId, ctx, serverUrl) {
|
|
|
600
611
|
res.end(hostText(ctx, "oauthOkPage"));
|
|
601
612
|
log.info(`${tag}: tool-auth callback received (code)`);
|
|
602
613
|
try {
|
|
603
|
-
const authServerUrl =
|
|
614
|
+
const authServerUrl = authorizationServerBaseUrl(discoveredAuthorizationServerUrl, authorizationUrl);
|
|
604
615
|
const metadata = await discoverAuthorizationServerMetadata(authServerUrl, { fetchFn: systemFetch() });
|
|
605
616
|
const tokens = await exchangeAuthorization(authServerUrl, {
|
|
606
617
|
metadata: metadataForAuthorizationResponse(metadata, iss, log, tag),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp",
|
|
3
|
-
"version": "1.15.
|
|
3
|
+
"version": "1.15.4",
|
|
4
4
|
"description": "MCP 管理界面 + tool search:可视化配置/启停/刷新 MCP 服务器与工具勾选,按需检索(tool search)热注入;工具列表稳定命中缓存、不撑爆上下文。DeepSeek Harness plugin: MCP management UI + tool search — stable tool list, cache-friendly, no context bloat.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|
|
@@ -14,6 +14,15 @@
|
|
|
14
14
|
* The official manager declares only `mcpManager/probe|restart|watch`, so the
|
|
15
15
|
* endpoint sets do not overlap either. Rename these ids back only together with
|
|
16
16
|
* a re-generated FaceModel that carries a unique package name.
|
|
17
|
+
*
|
|
18
|
+
* `service` is the Cordis service key and `namespace` is the wire namespace: the
|
|
19
|
+
* gateway dispatches by `ctx.get(descriptor.service)` and then validates the
|
|
20
|
+
* binding against both fields. DSH 0.2.2-rc.3 ships McpServerManager, which owns
|
|
21
|
+
* the `mcpManager` service key (issue #25), so the host half registers under
|
|
22
|
+
* `dshMcpManager` while keeping the `mcpManager` wire namespace. These
|
|
23
|
+
* descriptors therefore carry `service: 'dshMcpManager'` and
|
|
24
|
+
* `namespace: 'mcpManager'` — both must move together with the host's
|
|
25
|
+
* `super(ctx, …)` arguments.
|
|
17
26
|
*/
|
|
18
27
|
import { z } from 'zod'
|
|
19
28
|
|
|
@@ -461,7 +470,7 @@ export const TYPERT_REMOTE = {
|
|
|
461
470
|
descriptors: [
|
|
462
471
|
{
|
|
463
472
|
id: 'dsh-mcp#mcpManager/delete',
|
|
464
|
-
service: '
|
|
473
|
+
service: 'dshMcpManager',
|
|
465
474
|
namespace: 'mcpManager',
|
|
466
475
|
method: 'delete',
|
|
467
476
|
invocation: { kind: 'direct' },
|
|
@@ -488,7 +497,7 @@ export const TYPERT_REMOTE = {
|
|
|
488
497
|
},
|
|
489
498
|
{
|
|
490
499
|
id: 'dsh-mcp#mcpManager/list',
|
|
491
|
-
service: '
|
|
500
|
+
service: 'dshMcpManager',
|
|
492
501
|
namespace: 'mcpManager',
|
|
493
502
|
method: 'list',
|
|
494
503
|
invocation: { kind: 'direct' },
|
|
@@ -504,7 +513,7 @@ export const TYPERT_REMOTE = {
|
|
|
504
513
|
},
|
|
505
514
|
{
|
|
506
515
|
id: 'dsh-mcp#mcpManager/test',
|
|
507
|
-
service: '
|
|
516
|
+
service: 'dshMcpManager',
|
|
508
517
|
namespace: 'mcpManager',
|
|
509
518
|
method: 'test',
|
|
510
519
|
invocation: { kind: 'direct' },
|
|
@@ -531,7 +540,7 @@ export const TYPERT_REMOTE = {
|
|
|
531
540
|
},
|
|
532
541
|
{
|
|
533
542
|
id: 'dsh-mcp#mcpManager/upsert',
|
|
534
|
-
service: '
|
|
543
|
+
service: 'dshMcpManager',
|
|
535
544
|
namespace: 'mcpManager',
|
|
536
545
|
method: 'upsert',
|
|
537
546
|
invocation: { kind: 'direct' },
|
|
@@ -558,7 +567,7 @@ export const TYPERT_REMOTE = {
|
|
|
558
567
|
},
|
|
559
568
|
{
|
|
560
569
|
id: 'dsh-mcp#mcpManager/upsertJson',
|
|
561
|
-
service: '
|
|
570
|
+
service: 'dshMcpManager',
|
|
562
571
|
namespace: 'mcpManager',
|
|
563
572
|
method: 'upsertJson',
|
|
564
573
|
invocation: { kind: 'direct' },
|
|
@@ -585,7 +594,7 @@ export const TYPERT_REMOTE = {
|
|
|
585
594
|
},
|
|
586
595
|
{
|
|
587
596
|
id: 'dsh-mcp#mcpManager/toolsList',
|
|
588
|
-
service: '
|
|
597
|
+
service: 'dshMcpManager',
|
|
589
598
|
namespace: 'mcpManager',
|
|
590
599
|
method: 'toolsList',
|
|
591
600
|
invocation: { kind: 'direct' },
|
|
@@ -601,7 +610,7 @@ export const TYPERT_REMOTE = {
|
|
|
601
610
|
},
|
|
602
611
|
{
|
|
603
612
|
id: 'dsh-mcp#mcpManager/toolsSet',
|
|
604
|
-
service: '
|
|
613
|
+
service: 'dshMcpManager',
|
|
605
614
|
namespace: 'mcpManager',
|
|
606
615
|
method: 'toolsSet',
|
|
607
616
|
invocation: { kind: 'direct' },
|
|
@@ -628,7 +637,7 @@ export const TYPERT_REMOTE = {
|
|
|
628
637
|
},
|
|
629
638
|
{
|
|
630
639
|
id: 'dsh-mcp#mcpManager/toolsMode',
|
|
631
|
-
service: '
|
|
640
|
+
service: 'dshMcpManager',
|
|
632
641
|
namespace: 'mcpManager',
|
|
633
642
|
method: 'toolsMode',
|
|
634
643
|
invocation: { kind: 'direct' },
|
|
@@ -655,7 +664,7 @@ export const TYPERT_REMOTE = {
|
|
|
655
664
|
},
|
|
656
665
|
{
|
|
657
666
|
id: 'dsh-mcp#mcpManager/envList',
|
|
658
|
-
service: '
|
|
667
|
+
service: 'dshMcpManager',
|
|
659
668
|
namespace: 'mcpManager',
|
|
660
669
|
method: 'envList',
|
|
661
670
|
invocation: { kind: 'direct' },
|
|
@@ -671,7 +680,7 @@ export const TYPERT_REMOTE = {
|
|
|
671
680
|
},
|
|
672
681
|
{
|
|
673
682
|
id: 'dsh-mcp#mcpManager/envSet',
|
|
674
|
-
service: '
|
|
683
|
+
service: 'dshMcpManager',
|
|
675
684
|
namespace: 'mcpManager',
|
|
676
685
|
method: 'envSet',
|
|
677
686
|
invocation: { kind: 'direct' },
|
|
@@ -698,7 +707,7 @@ export const TYPERT_REMOTE = {
|
|
|
698
707
|
},
|
|
699
708
|
{
|
|
700
709
|
id: 'dsh-mcp#mcpManager/adopt',
|
|
701
|
-
service: '
|
|
710
|
+
service: 'dshMcpManager',
|
|
702
711
|
namespace: 'mcpManager',
|
|
703
712
|
method: 'adopt',
|
|
704
713
|
invocation: { kind: 'direct' },
|
|
@@ -725,7 +734,7 @@ export const TYPERT_REMOTE = {
|
|
|
725
734
|
},
|
|
726
735
|
{
|
|
727
736
|
id: 'dsh-mcp#mcpManager/release',
|
|
728
|
-
service: '
|
|
737
|
+
service: 'dshMcpManager',
|
|
729
738
|
namespace: 'mcpManager',
|
|
730
739
|
method: 'release',
|
|
731
740
|
invocation: { kind: 'direct' },
|
|
@@ -752,7 +761,7 @@ export const TYPERT_REMOTE = {
|
|
|
752
761
|
},
|
|
753
762
|
{
|
|
754
763
|
id: 'dsh-mcp#mcpManager/oauthStart',
|
|
755
|
-
service: '
|
|
764
|
+
service: 'dshMcpManager',
|
|
756
765
|
namespace: 'mcpManager',
|
|
757
766
|
method: 'oauthStart',
|
|
758
767
|
invocation: { kind: 'direct' },
|
|
@@ -779,7 +788,7 @@ export const TYPERT_REMOTE = {
|
|
|
779
788
|
},
|
|
780
789
|
{
|
|
781
790
|
id: 'dsh-mcp#mcpManager/oauthStatus',
|
|
782
|
-
service: '
|
|
791
|
+
service: 'dshMcpManager',
|
|
783
792
|
namespace: 'mcpManager',
|
|
784
793
|
method: 'oauthStatus',
|
|
785
794
|
invocation: { kind: 'direct' },
|