@noob9527/dsh-mcp-oauth 0.1.0 → 0.2.0-rc.2
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 +25 -0
- package/CONTRIBUTING.md +4 -2
- package/README.md +49 -12
- package/README.zh.md +50 -13
- package/SECURITY.md +1 -1
- package/docs/acceptance.md +41 -2
- package/docs/compatibility.md +55 -0
- package/docs/manual-authorization.md +41 -0
- package/docs/manual-authorization.zh.md +41 -0
- package/docs/releasing.md +18 -2
- package/docs/remote-personal-instances.md +73 -0
- package/docs/remote-personal-instances.zh.md +73 -0
- package/lib/client.js +220 -38
- package/lib/index.js +186 -31
- package/lib/types/callback.d.ts +13 -2
- package/lib/types/client/form.d.ts +33 -0
- package/lib/types/client/locales.d.ts +44 -5
- package/lib/types/client/service-id.d.ts +2 -0
- package/lib/types/config.d.ts +12 -0
- package/lib/types/diagnostics.d.ts +21 -0
- package/lib/types/errors.d.ts +1 -1
- package/lib/types/index.d.ts +2 -0
- package/lib/types/manual-response.d.ts +21 -0
- package/lib/types/provider.d.ts +6 -0
- package/package.json +45 -26
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,30 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.2.0-rc.2 — 2026-11-17
|
|
4
|
+
|
|
5
|
+
- 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.
|
|
6
|
+
|
|
7
|
+
- Allocate an available local callback port when the URL omits it; declare native CIMD redirects for both localhost and 127.0.0.1. Keep explicit ports and existing configuration unchanged.
|
|
8
|
+
|
|
9
|
+
- Host a public CIMD document on GitHub Pages and prefill its editable URL under Advanced for new services; preserve existing values. Invalid metadata URLs report validation errors.
|
|
10
|
+
|
|
11
|
+
- Simplify the service form with Advanced settings, registration-specific fields and bilingual help tooltips. Restrict the default hosted CIMD document to local callbacks.
|
|
12
|
+
|
|
13
|
+
- Move Service ID into Advanced and generate it from the display name for new services. Keep saved IDs read-only and report duplicate IDs for manual correction.
|
|
14
|
+
- Add sanitized Host OAuth failure diagnostics with operation stages, bounded error chains, network/OAuth reason codes and proxy tunnel rejection status. Raw messages, URLs, stacks and credentials are excluded.
|
|
15
|
+
- Preserve existing Client error codes and authentication recovery behavior.
|
|
16
|
+
|
|
17
|
+
## 0.2.0-rc.1 — 2026-11-16
|
|
18
|
+
|
|
19
|
+
- Lower the DSH requirement to `>=0.2.1-alpha.3`, using the public `dsh-llm` error export and the Client locale type entry. Build against the minimum version and validate all 17 published 0.2.x versions.
|
|
20
|
+
|
|
21
|
+
- Manual authorization response submission through an owner-only settings form, with no listener, one-use state and PKCE retained.
|
|
22
|
+
|
|
23
|
+
- Remote personal-instance OAuth callbacks through an HTTPS reverse proxy, with a separate loopback listener port.
|
|
24
|
+
- Deployment selection and bilingual guidance in settings.
|
|
25
|
+
- Reject ambiguous callback parameters; preserve one-use state, PKCE and owner-only credential access.
|
|
26
|
+
- Existing settings default to local mode. Older versions cannot read newly saved callback fields; restore compatible configuration before downgrade.
|
|
27
|
+
|
|
3
28
|
## 0.1.0 — 2026-11-16
|
|
4
29
|
|
|
5
30
|
- Public npm identity: `@noob9527/dsh-mcp-oauth`, including scoped Host and Client module registration.
|
package/CONTRIBUTING.md
CHANGED
|
@@ -10,13 +10,15 @@ 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.
|
|
13
|
+
node scripts/check-release.mjs --tarball artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.2.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.
|
|
17
17
|
|
|
18
|
-
Keep the plugin independent of DSH source workspaces and internal imports. Update both README languages for user-facing behavior changes.
|
|
18
|
+
Keep the plugin independent of DSH source workspaces and internal imports. Update both README languages for user-facing behavior changes. Build dependencies are pinned to the minimum supported DSH version. Do not lower that floor without packed-plugin acceptance on the proposed minimum release. The minimum range admits future versions; report tested versions separately from versions merely allowed by the installer.
|
|
19
19
|
|
|
20
20
|
Use reserved example domains and repository-owned fixtures. Do not commit organization-specific services, .env files, tokens, authorization codes, callback URLs containing state, credentials files, personal paths, or unreviewed recordings. See [SECURITY.md](SECURITY.md) for sensitive reports. The release check is a limited hygiene check, not a comprehensive secret scanner.
|
|
21
21
|
|
|
22
22
|
[Official-client acceptance](docs/acceptance.md) requires a local model key supplied outside the repository. Report browser, protocol and Desktop evidence separately. A PR does not need to publish a package or a GitHub Release.
|
|
23
|
+
|
|
24
|
+
When changing supported DSH versions, run `pnpm run test:compatibility` and follow [the compatibility matrix](docs/compatibility.md). Missing matching peers are unsupported, not skipped runtime passes.
|
package/README.md
CHANGED
|
@@ -6,42 +6,51 @@ OAuth-protected MCP tools for an unmodified DeepSeek Harness installation. The p
|
|
|
6
6
|
|
|
7
7
|
## Status and compatibility
|
|
8
8
|
|
|
9
|
-
Independent community plugin; not an official DeepSeek product.
|
|
9
|
+
Independent community plugin; not an official DeepSeek product. The npm 0.1.0 release supports local callbacks. Version 0.2.0-rc.2 adds remote personal-instance callbacks and manual response submission.
|
|
10
10
|
|
|
11
11
|
| Surface | Status |
|
|
12
12
|
| --- | --- |
|
|
13
|
-
| Official DSH 0.2.2-rc.
|
|
13
|
+
| Official DSH 0.2.1-alpha.3 / 0.2.2-rc.1 Web, local macOS | Current candidate: browser CIMD OAuth and real chat tool calls verified |
|
|
14
14
|
| Official Desktop | Intended scope; acceptance pending |
|
|
15
15
|
| Other DSH versions | Not declared compatible |
|
|
16
|
-
| Remote
|
|
16
|
+
| Remote personal DSH, 0.2.0-rc.2 | HTTPS proxy fixture verified; actual deployment acceptance required |
|
|
17
|
+
| Shared multi-user DSH | Not supported |
|
|
18
|
+
|
|
19
|
+
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.
|
|
17
20
|
|
|
18
21
|
## Install from npm
|
|
19
22
|
|
|
20
|
-
The public package name is `@noob9527/dsh-mcp-oauth`.
|
|
23
|
+
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
|
+
|
|
25
|
+
Version `0.2.0-rc.2` is a release candidate distributed under `next`. Use `latest` for the stable release.
|
|
26
|
+
|
|
27
|
+
Install the published preview:
|
|
21
28
|
|
|
22
29
|
```sh
|
|
23
|
-
dsh plugin --profile web add @noob9527/dsh-mcp-oauth@
|
|
30
|
+
dsh plugin --profile web add @noob9527/dsh-mcp-oauth@next
|
|
24
31
|
```
|
|
25
32
|
|
|
26
33
|
The unscoped `dsh-mcp-oauth` package is a different project. When migrating a local unscoped installation, remove its plugin entry before installing this package; do not enable both together. Use the same DSH profile and home to retain locally stored service settings and grants.
|
|
27
34
|
|
|
28
35
|
## Install from source
|
|
29
36
|
|
|
30
|
-
Requires Node **24.9+**, pnpm **12.5.1**, and an unmodified official DSH
|
|
37
|
+
Requires Node **24.9+**, pnpm **12.5.1**, and an unmodified official DSH installation satisfying **`>=0.2.1-alpha.3`**. Clone this repository and run these commands from its directory:
|
|
31
38
|
|
|
32
39
|
```sh
|
|
33
40
|
pnpm install --frozen-lockfile --ignore-scripts
|
|
34
41
|
pnpm run typecheck
|
|
35
42
|
pnpm test
|
|
36
43
|
pnpm pack --pack-destination artifacts
|
|
37
|
-
dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.
|
|
44
|
+
dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.2.tgz"
|
|
38
45
|
```
|
|
39
46
|
|
|
40
|
-
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.
|
|
47
|
+
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/`.
|
|
41
48
|
|
|
42
49
|
Desktop has a separate profile; installation and OAuth behavior there are not yet qualified.
|
|
43
50
|
|
|
44
|
-
|
|
51
|
+
## Sign in
|
|
52
|
+
|
|
53
|
+
Open **Plugins → Built-in plugin settings → OAuth MCP → Add service** (the current public DSH slot places this settings entry in that group). Enter the service URL and registration settings, save, click **Sign in**, then **Open authorization page**. For local mode, approve in the browser on the computer running DSH. For remote mode, open the link in your own browser after the administrator configures the HTTPS callback. The callback page only confirms receipt; the DSH page separately displays authorization and connection completion. Tools become available to normal chat once connected.
|
|
45
54
|
|
|
46
55
|
## Configuration
|
|
47
56
|
|
|
@@ -53,13 +62,17 @@ The initial service list is empty. A placeholder endpoint is `https://mcp.exampl
|
|
|
53
62
|
| Registration mode | Automatic, CIMD, pre-registered or DCR |
|
|
54
63
|
| Client metadata document URL | Public HTTPS CIMD document maintained by the client operator |
|
|
55
64
|
| Client ID / secret | Pre-registered identity; the secret is stored separately |
|
|
56
|
-
| Callback
|
|
65
|
+
| Callback mode | Local automatic, remote HTTPS automatic, or manual response paste; remote automatic requires an administrator-configured proxy |
|
|
66
|
+
| Internal loopback listener port | Remote mode only; defaults to 6274, always bound to 127.0.0.1 |
|
|
67
|
+
| Callback URL | Defaults to `http://127.0.0.1/oauth/callback`; local mode chooses a free port when none is specified |
|
|
57
68
|
| Scopes | Optional space-separated scope names |
|
|
58
69
|
|
|
59
|
-
Automatic mode uses configured pre-registration first, then CIMD when configured and supported, then dynamic registration. Explicit CIMD fails when unsupported. The
|
|
70
|
+
Automatic mode uses configured pre-registration first, then CIMD when configured and supported, then dynamic registration. Explicit CIMD fails when unsupported. The public CIMD document declares native-client callbacks at `http://127.0.0.1/oauth/callback` and `http://localhost/oauth/callback`. Local mode binds an OS-assigned port before authorization and uses that exact URL for authorization and token exchange. Explicitly configured ports remain fixed and report conflicts; existing settings are not migrated. Authorization servers must support native loopback port matching (RFC 8252). Remote HTTPS callbacks and manual responses retain exact matching.
|
|
60
71
|
|
|
61
72
|
Advanced defaults: connection timeout 30 seconds, sign-in timeout 5 minutes, tool deadline 10 minutes, refresh lead time 60 seconds, 5 reconnect attempts with a maximum delay of 30 seconds. Tool deadlines are total deadlines, not progress-reset timers.
|
|
62
73
|
|
|
74
|
+
For remote instances without a callback proxy, choose **Manual response paste**. After browser consent, paste the complete callback URL into the service’s pending-login form. No listener starts; PKCE, one-time state and registered redirect validation remain required. See [manual authorization](docs/manual-authorization.md).
|
|
75
|
+
|
|
63
76
|
## Credentials and lifecycle
|
|
64
77
|
|
|
65
78
|
Service configuration is stored in the active profile's `mcp-oauth/servers.json`. Grants are stored through DSH credentials, with keys derived from the canonical profile directory and service ID. The default DSH store is a local credential file, not an OS keychain. A service's URL, registration mode, client identity, scopes and callback bind its credentials; changing them requires new authorization.
|
|
@@ -70,7 +83,13 @@ Disabling preserves authorization. Clearing authorization disconnects and delete
|
|
|
70
83
|
|
|
71
84
|
Requests refresh an expiring token when possible. Concurrent refresh work is coalesced; a 401 permits one SDK authentication retry. Refresh alone does not interrupt accepted calls. Network failures and tool timeouts never cause automatic replay; an unknown outcome must be checked before manually repeating a state-changing tool.
|
|
72
85
|
|
|
73
|
-
|
|
86
|
+
Local instances and remote personal Web instances are in scope. Shared multi-user Hosts, legacy SSE/stdio transports, MCP Tasks, resource browsing and prompt browsing are unsupported. See [remote deployment](docs/remote-personal-instances.md) for proxy routing, CIMD documents, isolation requirements and downgrade precautions.
|
|
87
|
+
|
|
88
|
+
## Upgrade and uninstall
|
|
89
|
+
|
|
90
|
+
Install a supported release with `dsh plugin --profile web add @noob9527/dsh-mcp-oauth@<version>`, then restart DSH. Check that release's DSH compatibility before upgrading.
|
|
91
|
+
|
|
92
|
+
To uninstall, run `dsh plugin --profile web remove @noob9527/dsh-mcp-oauth` and restart DSH. If you want to remove saved service settings and grants, delete the services in the plugin settings before uninstalling. Keep the same `DSH_HOME` for these commands.
|
|
74
93
|
|
|
75
94
|
## Development and validation
|
|
76
95
|
|
|
@@ -105,3 +124,21 @@ Authentication recovery failure withdraws the affected service’s tools and req
|
|
|
105
124
|
## License
|
|
106
125
|
|
|
107
126
|
[MIT](LICENSE). Dependencies retain their own licenses.
|
|
127
|
+
|
|
128
|
+
### Host OAuth diagnostics
|
|
129
|
+
|
|
130
|
+
OAuth login and refresh failures emit a JSON `mcp_oauth_failure` record to Host stderr. Container operators should inspect the Host/container logs, not the chat transcript. Records contain a hashed service identifier, the failure stage, and up to six allowlisted error classifications, network codes and HTTP status numbers. Stages are `callback_setup`, `resource_challenge`, `discovery_and_registration`, `authorization_callback`, `token_exchange`, `credential_persistence` and `refresh`. The discovery stage includes SDK-managed registration. Unknown errors remain `UnknownError`; absence of a classified reason does not imply success. Proxy tunnel rejection status is extracted from recognized proxy error text without retaining the text.
|
|
131
|
+
|
|
132
|
+
Diagnostics omit raw messages, stacks, URLs, service labels, request/response bodies, headers, authorization codes, state and credentials. They are not returned in Client state or session events. UI error codes remain unchanged. A hashed identifier correlates failures but is not an access credential.
|
|
133
|
+
|
|
134
|
+
When adding a service, Service ID is blank under Advanced, with a placeholder generated from the display name. Saving uses the entered ID or, when blank, the generated ID. Clearing a manually entered ID restores automatic generation. Non-ASCII letters use Unicode code-point segments. Duplicate IDs are rejected; change the ID in Advanced. Saved services retain their existing, read-only ID when renamed.
|
|
135
|
+
|
|
136
|
+
New services prefill the [public client metadata document](https://noob9527.github.io/dsh-mcp-oauth/oauth/client-metadata.json) in **Advanced → Client metadata document URL**. You can edit or clear this value. Existing services retain their saved value, including an empty value. The hosted document supports both local hostnames with the `/oauth/callback` path and variable ports. Other callback paths or remote callbacks require a matching document.
|
|
137
|
+
|
|
138
|
+
Scopes appears under Advanced and defaults to empty for automatic discovery. Separate multiple scopes with spaces. Existing configured scopes remain unchanged.
|
|
139
|
+
|
|
140
|
+
The service form shows only Display name and MCP URL by default. All other configuration fields are under Advanced; expanding it does not change stored values. Validation errors in advanced fields expand that section automatically.
|
|
141
|
+
|
|
142
|
+
Each configuration field has a help button with a localized tooltip. Hover, focus with the keyboard or click to read its purpose; click outside or press Escape to dismiss it.
|
|
143
|
+
|
|
144
|
+
Registration mode controls the fields in Advanced: Automatic shows Client ID, Client secret and Client metadata document URL; CIMD shows only the document URL; Pre-registration shows Client ID and Client secret; DCR shows none of these. Switching modes retains draft values. Saving DCR or pre-registered settings clears the unused metadata URL; hidden client identity values are retained. Validation errors name the affected fields. The callback URL is hidden for local callbacks or when the active registration identity uses the default hosted document; its saved value is preserved. The default document supports local callbacks only. Remote or manual callbacks need compatible client metadata and callback settings.
|
package/README.zh.md
CHANGED
|
@@ -6,53 +6,66 @@
|
|
|
6
6
|
|
|
7
7
|
## 状态与兼容性
|
|
8
8
|
|
|
9
|
-
本项目是独立社区插件,并非 DeepSeek 官方产品。0.1.0
|
|
9
|
+
本项目是独立社区插件,并非 DeepSeek 官方产品。npm 0.1.0 仅支持本机回调;0.2.0-rc.2 新增远程个人实例回调和手动粘贴授权响应。
|
|
10
10
|
|
|
11
11
|
| 客户端 | 验证状态 |
|
|
12
12
|
| --- | --- |
|
|
13
|
-
| 官方 DSH 0.2.2-rc.
|
|
13
|
+
| 官方 DSH 0.2.1-alpha.3 / 0.2.2-rc.1 Web,本机 macOS | 当前候选包:已验证浏览器 CIMD 授权和真实聊天调用 |
|
|
14
14
|
| 官方 Desktop | 计划支持,尚待验收 |
|
|
15
15
|
| 其他 DSH 版本 | 未声明兼容 |
|
|
16
|
-
|
|
|
16
|
+
| 远程个人 DSH,0.2.0-rc.2 | HTTPS 代理 fixture 已验证,实际部署仍需验收 |
|
|
17
|
+
| 多人共享 DSH | 不支持 |
|
|
18
|
+
|
|
19
|
+
0.2.0-rc.2 要求 DSH `>=0.2.1-alpha.3`。[17 版本兼容矩阵](docs/compatibility.md)中满足下限的 13 个已发布版本均通过自动化检查。范围允许安装后续版本,但不代表后续版本自动通过验收。0.1.0 保留原 rc.2 限制。
|
|
17
20
|
|
|
18
21
|
## 从 npm 安装
|
|
19
22
|
|
|
20
|
-
|
|
23
|
+
需要 Node 24.9+ 和满足 `>=0.2.1-alpha.3` 的未经修改官方 DSH。公开包名为 `@noob9527/dsh-mcp-oauth`。
|
|
24
|
+
|
|
25
|
+
`0.2.0-rc.2` 为通过 `next` 分发的候选版本;`latest` 用于安装稳定版。
|
|
26
|
+
|
|
27
|
+
安装已发布的预览版:
|
|
21
28
|
|
|
22
29
|
```sh
|
|
23
|
-
dsh plugin --profile web add @noob9527/dsh-mcp-oauth@
|
|
30
|
+
dsh plugin --profile web add @noob9527/dsh-mcp-oauth@next
|
|
24
31
|
```
|
|
25
32
|
|
|
26
33
|
无 scope 的 `dsh-mcp-oauth` 属于其他项目。从本地旧包迁移时,先移除旧插件条目,再安装新包,不要同时启用两者。使用相同 DSH profile 和 home,以保留本机服务配置和授权记录。
|
|
27
34
|
|
|
28
|
-
##
|
|
35
|
+
## 从源码安装
|
|
29
36
|
|
|
30
|
-
需要 Node **24.9+**、pnpm **12.5.1
|
|
37
|
+
需要 Node **24.9+**、pnpm **12.5.1**,以及满足 **`>=0.2.1-alpha.3`** 的未经修改官方 DSH。克隆本仓库后,在仓库目录运行:
|
|
31
38
|
|
|
32
39
|
```sh
|
|
33
40
|
pnpm install --frozen-lockfile --ignore-scripts
|
|
34
41
|
pnpm run typecheck
|
|
35
42
|
pnpm test
|
|
36
43
|
pnpm pack --pack-destination artifacts
|
|
37
|
-
dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.
|
|
44
|
+
dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.2.tgz"
|
|
38
45
|
```
|
|
39
46
|
|
|
40
|
-
测试需要支持 `req -addext` 的 OpenSSL;自动化测试不需要模型 API Key 或业务 MCP 服务。DSH 提示需要重启时,重启后继续。如果使用自定义 `DSH_HOME`,安装插件和启动 DSH
|
|
47
|
+
测试需要支持 `req -addext` 的 OpenSSL;自动化测试不需要模型 API Key 或业务 MCP 服务。DSH 提示需要重启时,重启后继续。如果使用自定义 `DSH_HOME`,安装插件和启动 DSH 时必须使用相同值。通过 npm 安装时,如无法解析包名,请检查 `npm config get registry`;公开 registry 为 `https://registry.npmjs.org/`。
|
|
41
48
|
|
|
42
49
|
Desktop 使用独立 profile,目前尚未完成其安装和 OAuth 验收。
|
|
43
50
|
|
|
44
|
-
|
|
51
|
+
## 登录
|
|
52
|
+
|
|
53
|
+
进入“Plugins → Built-in plugin settings → OAuth MCP”(当前官方扩展位把设置入口放在这个分组中),添加服务、保存并点击“登录”,随后打开授权页面。本机模式下,浏览器必须运行在 DSH 所在的电脑上;远程个人实例模式下,管理员配置 HTTPS 回调代理后,可在自己的浏览器登录。回调页只确认已收到授权响应;最终授权状态和工具连接状态分别显示在 DSH 中。
|
|
45
54
|
|
|
46
55
|
## 配置
|
|
47
56
|
|
|
57
|
+
候选版本支持“本机”“远程个人实例”自动回调和“手动粘贴授权响应”三种回调方式。远程模式配置公网 HTTPS 回调 URL 和内部监听端口(默认 6274),监听地址固定为 `127.0.0.1`。代理必须与实例共享网络命名空间,每人拥有独立 Host、profile 和凭据存储。部署步骤、CIMD 模板及降级限制见[远程个人实例指南](docs/remote-personal-instances.zh.md)。
|
|
58
|
+
|
|
48
59
|
默认服务列表为空。文档中的 `https://mcp.example.com/mcp` 仅为占位地址。
|
|
49
60
|
|
|
50
61
|
- 自动模式优先使用已配置的预注册身份,其次使用服务端支持的 CIMD,最后尝试 DCR。
|
|
51
|
-
- CIMD
|
|
52
|
-
- 默认回调为 `http://127.0.0.1
|
|
62
|
+
- 插件提供公共 CIMD 文档,声明 `127.0.0.1` 和 `localhost` 两种本机回调;用户仍可替换文档地址。
|
|
63
|
+
- 默认回调为 `http://127.0.0.1/oauth/callback`。本机模式未填写端口时,登录前由系统分配空闲端口,授权请求和 token 交换使用同一个实际地址;授权服务器须支持 RFC 8252 原生客户端 loopback 端口匹配。已有显式端口配置保持固定,冲突时仍报错;远程 HTTPS 回调和手动响应仍精确匹配。
|
|
53
64
|
- 客户端密钥单独保存;编辑表单留空表示保留已有值。清除授权会删除包含密钥的本机授权记录。
|
|
54
65
|
- 高级设置默认:连接超时 30 秒、授权超时 5 分钟、工具总时限 10 分钟、提前 60 秒刷新、最多重连 5 次且间隔不超过 30 秒。
|
|
55
66
|
|
|
67
|
+
无法反代回调时,可选择“手动粘贴授权响应”。浏览器授权后,将完整回调 URL 粘贴到该服务的待登录表单;插件不启动监听器,仍校验 PKCE、一次性 state 和已登记回调地址。详见[手动授权指南](docs/manual-authorization.zh.md)。
|
|
68
|
+
|
|
56
69
|
## 凭据与失败处理
|
|
57
70
|
|
|
58
71
|
服务配置保存在当前 profile 的 `mcp-oauth/servers.json`。授权信息通过 DSH 凭据服务保存,按 profile 的真实目录和服务标识区分。默认存储为本地文件,不是系统钥匙串。修改服务地址、客户端身份、权限范围或回调配置后需要重新授权。
|
|
@@ -61,7 +74,13 @@ Desktop 使用独立 profile,目前尚未完成其安装和 OAuth 验收。
|
|
|
61
74
|
|
|
62
75
|
刷新 token 不主动中断已受理的长调用。HTTP 401 最多触发一次 SDK 认证后重发;断线或超时不会自动重放工具调用。出现“结果未知”时,先核查服务端执行情况,再决定是否重试。
|
|
63
76
|
|
|
64
|
-
|
|
77
|
+
候选版本支持本机及远程个人 Web 实例;Desktop 仍待验收。不支持多人共享 Host、旧版 SSE/stdio、MCP Tasks、资源浏览和提示词浏览。
|
|
78
|
+
|
|
79
|
+
## 升级与卸载
|
|
80
|
+
|
|
81
|
+
使用 `dsh plugin --profile web add @noob9527/dsh-mcp-oauth@<version>` 安装指定版本后重启 DSH。升级前先确认该版本声明的 DSH 兼容范围。
|
|
82
|
+
|
|
83
|
+
卸载命令为 `dsh plugin --profile web remove @noob9527/dsh-mcp-oauth`,完成后重启 DSH。若需同时清除本机服务配置和授权,请在卸载前通过插件设置页删除服务。以上操作始终使用相同 `DSH_HOME`。
|
|
65
84
|
|
|
66
85
|
## 开发与验收
|
|
67
86
|
|
|
@@ -85,3 +104,21 @@ pnpm exec tsx tests/serve-fixture.ts
|
|
|
85
104
|
## 许可证
|
|
86
105
|
|
|
87
106
|
[MIT](LICENSE)。依赖保留各自的许可证。
|
|
107
|
+
|
|
108
|
+
### Host OAuth 诊断日志
|
|
109
|
+
|
|
110
|
+
OAuth 登录和刷新失败会向 Host 标准错误输出 JSON `mcp_oauth_failure` 记录。容器部署请查看 Host/容器日志,而非聊天记录。日志包含服务标识摘要、失败阶段,以及最多六层允许输出的错误分类、网络错误码和 HTTP 状态码。阶段包括 `callback_setup`、`resource_challenge`、`discovery_and_registration`、`authorization_callback`、`token_exchange`、`credential_persistence` 和 `refresh`;发现阶段包含 SDK 管理的客户端注册。未知错误保留为 `UnknownError`,未识别原因不表示成功。代理隧道拒绝状态从已识别的错误文本中提取,原始文本不会保留。
|
|
111
|
+
|
|
112
|
+
日志不包含原始消息、堆栈、URL、服务显示名称、请求或响应正文、请求头、授权码、state 或凭据,也不进入 Client 状态和会话事件。UI 错误码保持不变。服务标识摘要用于关联错误,不是访问凭据。
|
|
113
|
+
|
|
114
|
+
新增服务时,高级设置中的服务标识默认为空,占位文字展示根据显示名称生成的标识。保存时使用手动填写的标识,留空则使用自动生成值;清空手动填写的标识可恢复自动生成。非 ASCII 字母使用 Unicode 码点片段。标识重复时拒绝保存,请在高级设置中修改。已有服务保留原标识,编辑时不可修改,重命名也不会改变标识。
|
|
115
|
+
|
|
116
|
+
新增服务在 **Advanced → Client metadata document URL** 中预填[公开客户端元数据文档](https://noob9527.github.io/dsh-mcp-oauth/oauth/client-metadata.json),允许修改或清空。已有服务保留原值,包括空值。该文档支持两种本机主机名、`/oauth/callback` 路径和动态端口;其他路径或远程回调需要使用匹配的文档。
|
|
117
|
+
|
|
118
|
+
Scopes(权限范围)位于高级设置,默认留空以自动发现;多个权限用空格分隔。已有配置的权限范围保持不变。
|
|
119
|
+
|
|
120
|
+
服务表单默认仅显示 Display name(显示名称)和 MCP URL,其余配置项均位于 Advanced(高级设置)。展开高级设置不会改变已有配置;高级字段校验失败时自动展开。
|
|
121
|
+
|
|
122
|
+
每个配置项旁都有说明按钮,支持悬停、键盘聚焦或点击查看中英文用途提示;点击外部或按 Escape 可关闭。
|
|
123
|
+
|
|
124
|
+
高级设置中的字段按注册模式显示:自动模式显示客户端 ID、客户端密钥和元数据文档 URL;CIMD 仅显示文档 URL;预注册显示客户端 ID 和密钥;DCR 隐藏这三项。切换模式时保留草稿值;保存 DCR 或预注册配置时清空不适用的元数据文档 URL,隐藏的客户端身份值保持不变。校验错误会列出有问题的字段。本机回调或当前注册身份使用默认托管文档时隐藏回调 URL,保留已保存的值。默认文档仅支持本机回调;远程或手动回调需要相匹配的客户端元数据和回调配置。
|
package/SECURITY.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Security
|
|
2
2
|
|
|
3
|
-
This
|
|
3
|
+
This plugin integrates OAuth credentials and external tools. DSH >=0.2.1-alpha.3 is supported; Desktop acceptance is pending. See the README for deployment limitations.
|
|
4
4
|
|
|
5
5
|
Do not put tokens, client secrets, authorization codes, credential files or unsanitized logs in public issues or pull requests.
|
|
6
6
|
|
package/docs/acceptance.md
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
# Official-client acceptance
|
|
2
2
|
|
|
3
|
-
Use an isolated `DSH_HOME` and an unmodified npm installation of DSH
|
|
3
|
+
Use an isolated `DSH_HOME` and an unmodified npm installation of a DSH version listed in the [compatibility matrix](compatibility.md). Never use source overlays or workspace links as release evidence.
|
|
4
4
|
|
|
5
|
-
1. Run `pnpm pack`, then install the tarball with `dsh plugin --profile web add /absolute/path/to/dsh-mcp-oauth-0.
|
|
5
|
+
1. Run `pnpm pack`, then install the tarball with `dsh plugin --profile web add /absolute/path/to/noob9527-dsh-mcp-oauth-0.2.0-rc.1.tgz`.
|
|
6
6
|
2. Run `dsh web --no-open --port 3097` with the same isolated home. Open the exact URL printed by DSH; its local login token must not be recorded in screenshots or documentation.
|
|
7
7
|
3. Run `pnpm exec tsx tests/serve-fixture.ts`. Add its printed MCP endpoint in Plugins → OAuth MCP, use DCR and a free permitted loopback callback port.
|
|
8
8
|
4. Sign in, open the authorization page and approve. Verify that authorization succeeds, the connection becomes connected and two tools are listed.
|
|
@@ -17,6 +17,12 @@ The fixture contains no business environment or personal data. Do not record bro
|
|
|
17
17
|
|
|
18
18
|
The automated protocol suite and actual client acceptance are separate evidence categories. The implementation session records executed checks in its delivery report; unexecuted model, Desktop and visual checks must not be described as passed.
|
|
19
19
|
|
|
20
|
+
## Scoped package installation
|
|
21
|
+
|
|
22
|
+
On 2026-11-16, the packed `@noob9527/dsh-mcp-oauth@0.1.0` was installed through the official DSH plugin command into a new isolated home. The Web plugin list displayed the scoped package as enabled, and OAuth MCP settings loaded the empty service list through the Host API. The 47 automated tests and typecheck passed after the package and Host/Client identifiers changed.
|
|
23
|
+
|
|
24
|
+
Public npm availability was subsequently verified on 2026-11-16: `latest` resolved to 0.1.0, the registry SHA-1 matched the uploaded tarball (`7d358ef005c083be399cccd2325488797e5b0f85`), and installation by scoped package name into a new isolated official DSH Web profile succeeded. The settings-page check used the local tarball; the registry check verified package installation. Earlier records below retain their original artifact names; they do not claim that every scenario was rerun on the scoped release artifact.
|
|
25
|
+
|
|
20
26
|
## Local CIMD Web acceptance
|
|
21
27
|
|
|
22
28
|
Run `pnpm exec tsx tests/serve-cimd.ts` (requires OpenSSL with `req -addext` support). The command prints an MCP URL, HTTPS metadata document URL, loopback callback URL and read-only audit URL. Set `CIMD_CALLBACK_URL` before starting if the default callback port is unavailable. Use those exact values in Plugins → OAuth MCP → Add service, with a new service ID and explicit CIMD mode. Leave the pre-registered client ID and secret empty.
|
|
@@ -91,3 +97,36 @@ The browser sequence used `cimd-faults`: drop response, cancel a 60-second delay
|
|
|
91
97
|
Local evidence lives in ignored `artifacts/evidence/faults-{drop,cancel,401,refresh}.json` and `dsh-fault-*.png` / `dsh-faults-and-isolation.png`. The regression suite now has 47 passing tests. New tests first exposed exhausted-401 misclassification, missing persistent authentication error status and missing reconnect after a lost tool response; these were fixed in the accepted package. The package also drains active calls during close and gives unknown-outcome failures an explicit no-automatic-retry message.
|
|
92
98
|
|
|
93
99
|
This matrix distinguishes automated published-API integration tests from actual browser evidence. It does not constitute Desktop qualification, public-network identity-provider acceptance, or a claim that every matrix row was exercised through a model chat.
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
## Remote personal-instance preview
|
|
103
|
+
|
|
104
|
+
The unreleased 0.2.0-rc.1 build passed typecheck and 54 automated tests on 2026-11-16. New cases use an HTTPS proxy with per-test certificate trust to forward browser-equivalent requests to a loopback receiver. They verify exact Host/path and state matching, ambiguous and duplicate responses, cancellation/timeouts, occupied internal ports, independent instance states, CIMD/PKCE exchange, refresh and restarted grant reuse followed by a search. The Host test also rejects non-owner list, save and login requests.
|
|
105
|
+
|
|
106
|
+
A clean official DSH Web installation loaded the tarball and its settings page. Browser checks covered local defaults, remote selection, rejection of an HTTP callback in remote mode, saving HTTPS CIMD configuration and reopening the saved fields. This UI check did not perform remote browser consent or a model-driven search through a deployed ingress. Organization ingress routing, owner-session mapping, trusted TLS and real OAuth acceptance still require deployment-specific verification; Desktop remains unqualified.
|
|
107
|
+
|
|
108
|
+
## Manual response preview
|
|
109
|
+
|
|
110
|
+
The unreleased 0.2.0-rc.1 build passed typecheck and 69 automated tests on 2026-11-16. Manual-mode cases cover CIMD, DCR and pre-registration with PKCE, one-use exchange, refresh and restarted credential reuse followed by a search. Parser tests cover wrong destinations, state and issuer mismatch, duplicate fields, denial, cancellation and timeout. Host tests cover owner-only submission, clear/disable/unload/cancel races, tool registration and absence of the submitted code from configuration, grant records, returned state and captured logs. The original local and remote automatic-callback tests remain in the suite.
|
|
111
|
+
|
|
112
|
+
A clean official DSH Web installation loaded the packed tarball without workspace links. In the settings page, manual CIMD configuration was saved, a malformed response was rejected and cleared, and cancellation removed the input. A new browser consent then redirected to a separate loopback display fixture. Copying its full URL into the masked plugin input completed exchange and discovery; the page showed **Authorized · Connected · Tools: 2**. The display fixture did not exchange tokens or forward responses. This used the repository's local OAuth/MCP and HTTPS CIMD fixtures, not a company service. The browser check verified consent, form submission and discovery, not a new model-driven chat call or Desktop qualification.
|
|
113
|
+
|
|
114
|
+
The in-app browser's failed-navigation API exposed an internal error page instead of the original callback URL, so the UI run used the independent display fixture. No-listener operation is covered by automated tests that fail if the plugin tries to create a callback listener. For reproduction, start `tests/serve-cimd.ts` with `CIMD_CALLBACK_URL` set to a registered loopback URL, then follow the [manual authorization guide](manual-authorization.md) in a normal browser. Use an unused port when relying on the connection-failure address bar, or an isolated display fixture that does not log request URLs.
|
|
115
|
+
|
|
116
|
+
## Minimum-version compatibility acceptance
|
|
117
|
+
|
|
118
|
+
On 2026-11-16, the adapted 0.2.0-rc.1 candidate was built against DSH 0.2.1-alpha.3 and installed as a tarball in clean official Web profiles for 0.2.1-alpha.3 and 0.2.2-rc.1. Both passed plugin/settings loading, independent browser CIMD login, discovery of two tools, and a real-chat search returning `document-1`. The fixture confirmed exactly one search per client, two validated CIMD documents and no DCR registration. See the [17-version matrix](compatibility.md) for automated coverage and evidence limits.
|
|
119
|
+
|
|
120
|
+
When preparing model credentials in an isolated home, retain the official versioned document format (`version: 1` with `refs`); a flat or incomplete credentials document prevents OAuth credential writes and can prevent DSH startup. Keep the file and values outside the repository.
|
|
121
|
+
|
|
122
|
+
## Dynamic local callback ports
|
|
123
|
+
|
|
124
|
+
The 0.2.0-rc.2 development build passed 89 automated tests on 2026-11-17. Local callbacks without a port bind an OS-assigned loopback port before OAuth discovery; the authorization request and token exchange use the same actual URL. Both `127.0.0.1` and `localhost` complete CIMD, DCR and pre-registered flows against the local fixture, refresh tokens, reuse persisted grants after restart and call the deterministic search tool. Concurrent receivers have distinct active ports; wrong state, Host, path and repeated responses are rejected, and cancellation releases the listener. Explicit-port conflict tests and remote/manual callback tests still pass.
|
|
125
|
+
|
|
126
|
+
The CIMD fixture applies native loopback port matching only; scheme, hostname, path and query changes remain mismatches. These tests establish compatibility with that fixture policy, not with arbitrary authorization servers. Local DCR browser acceptance is recorded under Configuration form release acceptance below. Existing persisted explicit-port configurations retain their fixed-port behavior.
|
|
127
|
+
|
|
128
|
+
## Configuration form release acceptance
|
|
129
|
+
|
|
130
|
+
On 2026-11-17, the 0.2.0-rc.2 configuration page was exercised in the in-app browser using packed installations on unmodified DSH 0.2.1-alpha.3 and isolated profiles. Checks covered generated/read-only service IDs, duplicate rejection, registration-dependent fields, default CIMD callback restrictions, save/edit persistence, English/dark and Chinese/light rendering, constrained layouts and help dismissal. Local DCR consent with a dynamically allocated callback port reached Authorized / Connected / Tools: 2; disable/enable restored tools without renewed consent.
|
|
131
|
+
|
|
132
|
+
After validation fixes, the rebuilt tarball rejected malformed MCP URLs with a field-specific message and no browser console errors. DCR and pre-registration saved despite an invalid inactive metadata draft; CIMD still rejected invalid metadata, and pre-registration still required Client ID. Saved DCR metadata was empty on reopening. Typecheck, build and all 99 automated tests passed. These checks do not qualify Desktop, deployed remote authorization or a new model-driven chat call.
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
# DSH 0.2.x compatibility
|
|
2
|
+
|
|
3
|
+
Checked on 2026-11-16 against the public npm registry. Version 0.2.0-rc.1 requires **`>=0.2.1-alpha.3`**. This is a minimum-version range, not an exact-version allowlist. The official DSH installer includes prereleases when evaluating this range. Future versions can install without editing the manifest, but compatibility with an untested future API is not guaranteed. The published plugin 0.1.0 retains its original requirement; install 0.2.0-rc.1 to use the expanded range.
|
|
4
|
+
|
|
5
|
+
## Published-version matrix
|
|
6
|
+
|
|
7
|
+
| DSH version | Automated result |
|
|
8
|
+
| --- | --- |
|
|
9
|
+
| `0.2.0-rc.1` | Unsupported: matching `dsh-api-remote-access` is unavailable |
|
|
10
|
+
| `0.2.0-rc.2` | Unsupported: matching `dsh-api-remote-access` is unavailable |
|
|
11
|
+
| `0.2.1-alpha.1` | Unsupported: matching `dsh-api-remote-access` is unavailable |
|
|
12
|
+
| `0.2.1-alpha.2` | Unsupported: matching `dsh-api-remote-access` is unavailable |
|
|
13
|
+
| `0.2.1-alpha.3` | 70/70 tests; typecheck, build and official CLI passed |
|
|
14
|
+
| `0.2.1-alpha.4` | 70/70 tests; typecheck, build and official CLI passed |
|
|
15
|
+
| `0.2.1-alpha.5` | 70/70 tests; typecheck, build and official CLI passed |
|
|
16
|
+
| `0.2.1-rc.1` | 70/70 tests; typecheck, build and official CLI passed |
|
|
17
|
+
| `0.2.1-rc.2` | 70/70 tests; typecheck, build and official CLI passed |
|
|
18
|
+
| `0.2.1-rc.3` | 70/70 tests; typecheck, build and official CLI passed |
|
|
19
|
+
| `0.2.1-rc.4` | 70/70 tests; typecheck, build and official CLI passed |
|
|
20
|
+
| `0.2.1-rc.5` | 70/70 tests; typecheck, build and official CLI passed |
|
|
21
|
+
| `0.2.2-alpha.2` | 70/70 tests; typecheck, build and official CLI passed |
|
|
22
|
+
| `0.2.2-alpha.3` | 70/70 tests; typecheck, build and official CLI passed |
|
|
23
|
+
| `0.2.2-rc.1` | 70/70 tests; typecheck, build and official CLI passed |
|
|
24
|
+
| `0.2.2-rc.2` | 70/70 tests; typecheck, build and official CLI passed |
|
|
25
|
+
| `0.2.2-rc.3` | 70/70 tests; typecheck, build and official CLI passed |
|
|
26
|
+
|
|
27
|
+
## Compatibility implementation
|
|
28
|
+
|
|
29
|
+
`HarnessError` comes from the public `@deepseek-ai/dsh-llm` root, available throughout the supported releases. The plugin remains a native Host `HarnessError` subclass with stable machine-readable codes. Client locale types come from the public `/client` entry. No official package, prototype or internal source import is patched.
|
|
30
|
+
|
|
31
|
+
The first four versions also lack the checked `typert-protocol` public `principalOf` declaration used for owner-only settings and credential access. They are rejected rather than removing the identity check or mixing newer Host packages into an older runtime. The floor describes this plugin implementation, not a claim that earlier DSH can never support OAuth.
|
|
32
|
+
|
|
33
|
+
Development dependencies and the lockfile are pinned to the minimum supported DSH version. DSH peers and `engines.dsh` declare the same minimum range; Cordis requires `>=4.0.5-alpha.2`. `check:release` exercises the official installer API against versions below, at and above the floor, including later prereleases. npm peer warnings follow npm's own prerelease rules; they do not replace the DSH runtime compatibility check.
|
|
34
|
+
|
|
35
|
+
## Automated coverage
|
|
36
|
+
|
|
37
|
+
Each viable version uses a separate temporary npm installation with all direct DSH test and peer dependencies pinned to that version and Cordis selected from that release's own dependency declaration. All 13 supported published versions passed 70 tests each (910 passing test executions), typechecking, Host/Client/declaration builds and `dsh web --help`. No workspace links or official source edits are used.
|
|
38
|
+
|
|
39
|
+
The tests cover DCR, pre-registration, CIMD, token expiry and rotation, concurrent refresh, long calls, cancellation, bounded 401 recovery, no unsafe replay, tool updates, multiple services, credential reuse and unload cleanup. Remote callback and manual response tests run against local fixtures; they do not establish an external deployment's proxy routing or user isolation.
|
|
40
|
+
|
|
41
|
+
## Packed Web acceptance
|
|
42
|
+
|
|
43
|
+
On macOS, the same candidate tarball built against the minimum version was installed with the official `dsh plugin --profile web add` command into clean `0.2.1-alpha.3` and `0.2.2-rc.1` profiles, with no compatibility exemptions. Both loaded the settings page, completed independent browser CIMD authorization against the local HTTPS metadata/OAuth/MCP fixture, discovered two tools and invoked `mcp__compat__search` from real model chat. The UI displayed inputs and the `document-1` result for `compat-min-alpha3` and `compat-022-rc1`. The fixture recorded two validated metadata fetches, two token exchanges, zero DCR registrations and exactly two search calls.
|
|
44
|
+
|
|
45
|
+
The final package differs from that browser-tested archive only in documentation; package metadata, patch and every built runtime/type file are byte-identical. Raw evidence, credentials, profiles and screenshots remain outside the public repository. Client acceptance is distinct from the 13-version automated matrix: the other eleven versions were not all retested in the browser for this candidate. Earlier rc.2/rc.3 evidence belongs to the earlier implementation. Desktop and external remote deployments are not certified by this version matrix. See [official-client acceptance](acceptance.md) for deployment-specific limitations.
|
|
46
|
+
|
|
47
|
+
## Reproduce
|
|
48
|
+
|
|
49
|
+
```sh
|
|
50
|
+
pnpm run test:compatibility
|
|
51
|
+
# Or focus on the minimum and a later release:
|
|
52
|
+
pnpm run test:compatibility 0.2.1-alpha.3 0.2.2-rc.1
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
The script queries the official registry and rejects missing matching DSH peers before installation. It discovers all test files rather than a fixed subset. It prints a private temporary evidence directory containing `report.json`, stage logs and isolated lockfiles. Existing model credentials and DSH home variables are excluded from child environments. Network access and OpenSSL are required. Browser consent and real-model chat require separate packed-plugin acceptance. Local checks do not establish GitHub CI or other-platform results.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# Manual authorization response
|
|
2
|
+
|
|
3
|
+
[中文](manual-authorization.zh.md)
|
|
4
|
+
|
|
5
|
+
Available in the unreleased 0.2.0-rc.1 build. npm 0.1.0 does not include this mode. Use it when a personal DSH instance cannot receive automatic callbacks. Local and remote automatic modes remain available. Shared multi-user Hosts are unsupported.
|
|
6
|
+
|
|
7
|
+
## Choose a callback
|
|
8
|
+
|
|
9
|
+
Manual mode opens no listening port and needs no callback reverse proxy. It still uses Authorization Code + PKCE S256, the configured redirect URI and a one-time state. It is an alternate response delivery mechanism, not a new OAuth grant or token import feature.
|
|
10
|
+
|
|
11
|
+
Register one of these exact callback URLs in the CIMD document or pre-registered client:
|
|
12
|
+
|
|
13
|
+
- A trusted HTTPS response display page, for example `https://callback.example.com/oauth/response`. Its operator must prevent query logging, third-party scripts, analytics and response persistence. A page may display or copy the complete callback URL; it must not exchange codes for tokens. This plugin does not deploy such a page.
|
|
14
|
+
- An HTTP loopback URL with an explicit port/path, for example `http://127.0.0.1:6274/oauth/callback`. The browser may show a connection error after consent because no receiver is running on your computer. Copy the complete address bar anyway. Choose a port not used by another local application, which would otherwise receive the authorization response.
|
|
15
|
+
|
|
16
|
+
The authorization server must allow the selected callback. A successful consent page alone is not a completed plugin login. Remote DSH must be accessed over authenticated HTTPS, and each person must have a separate Host process, profile and credential store.
|
|
17
|
+
|
|
18
|
+
## Sign in
|
|
19
|
+
|
|
20
|
+
1. Open Plugins → Built-in plugin settings → OAuth MCP → Add service or Edit.
|
|
21
|
+
2. Select **Manual response paste** under Callback mode. Set the MCP endpoint, registration mode, client metadata URL or pre-registered identity, scopes and registered callback URL. The internal listener port is unused in this mode.
|
|
22
|
+
3. Save, select Sign in, and open the authorization page. Approve only the login you just started.
|
|
23
|
+
4. Copy the full final callback URL, including `code`, `state` and `iss` when present. Do not copy the initial authorization URL, a success message, an access token or a bare code.
|
|
24
|
+
5. Return to the same service's pending login in DSH. Paste into **Full authorization callback URL** and select **Submit authorization response**. Never paste it into chat or send it to another person.
|
|
25
|
+
6. The field clears when submitted. “Response received” acknowledges delivery only. Wait until DSH displays Authorized and Connected and discovers the tools.
|
|
26
|
+
|
|
27
|
+
The input is masked, is not stored in browser local storage and belongs to one pending attempt. Cancellation, completion, expiry or leaving the settings page removes it. The backend exchanges the code using its in-memory verifier and saves only the grant through the existing credential store. The form clears on rejected submissions too; paste the corrected response again if the attempt is still pending.
|
|
28
|
+
|
|
29
|
+
## Validation and recovery
|
|
30
|
+
|
|
31
|
+
The plugin parses the submitted URL without fetching it. It verifies the exact configured origin/path, absence of user information and fragments, one-time matching state, single-valued response parameters, and the discovered issuer when an `iss` parameter is supplied. A response must contain either a nonempty code or an OAuth error. Duplicate parameters, token parameters, arbitrary extra parameters and responses longer than 16,384 characters are rejected. Standard `error_description` and `error_uri` fields are accepted but never echoed or followed.
|
|
32
|
+
|
|
33
|
+
Malformed or mismatched responses leave the current attempt pending. A valid code or denial consumes the response once; repeated submission fails. Cancellation, timeout, disabling/removing the service, clearing authorization or unloading the plugin invalidates pending submissions. Restarting the process loses pending state and verifiers; start a fresh login. A response from an earlier attempt or another service cannot complete the new login.
|
|
34
|
+
|
|
35
|
+
If code exchange fails because the authorization code expired or was already used, start a new login rather than resubmitting it. Existing refresh and connection behavior is unchanged. Manual input is required only for interactive authorization; successful refresh does not require another paste.
|
|
36
|
+
|
|
37
|
+
## Sensitive data handling
|
|
38
|
+
|
|
39
|
+
Submission uses the plugin's owner-only direct Remote API, not chat, a model tool or a session command. The API returns no submitted URL or code, and errors use fixed codes. Automated tests verify rejection of non-owner requests and absence of submitted codes from returned state, saved configuration, grant records and captured logs. The inspected official unary Remote dispatch does not log the request arguments; this does not certify additional deployment diagnostics.
|
|
40
|
+
|
|
41
|
+
Do not record request bodies for `mcpOAuth/submitResponse` in gateway diagnostics, custom tracing or debugging middleware. The clipboard, browser history and the destination page can contain the response until cleared; the plugin does not erase those surfaces. Never record authorization URLs or callback parameters in repository files, screenshots, issue reports or analytics. This repository uses reserved domains and local fixtures only.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
# 手动粘贴授权响应
|
|
2
|
+
|
|
3
|
+
[English](manual-authorization.md)
|
|
4
|
+
|
|
5
|
+
此功能包含在尚未发布的 0.2.0-rc.1 开发版中,npm 0.1.0 不支持。适用于个人 DSH 实例无法接收自动回调的场景。本机和远程自动回调方式保持可用,不支持多人共享 Host。
|
|
6
|
+
|
|
7
|
+
## 选择回调地址
|
|
8
|
+
|
|
9
|
+
手动模式不启动监听端口,也不需要回调反向代理。它仍使用 Authorization Code + PKCE S256、配置中的回调地址和一次性 state,只是通过手动提交传递授权响应,不是新的 OAuth 授权类型,也不是 token 导入功能。
|
|
10
|
+
|
|
11
|
+
在 CIMD 文档或预注册客户端中登记以下任一种精确回调地址:
|
|
12
|
+
|
|
13
|
+
- 可信的 HTTPS 授权响应展示页,例如 `https://callback.example.com/oauth/response`。页面运营者必须禁止记录查询参数、加载第三方脚本或统计组件,以及持久化响应。页面可以展示或复制完整回调 URL,但不能代替插件换取 token。本插件不负责部署此页面。
|
|
14
|
+
- 带明确端口和路径的 HTTP 本机回调地址,例如 `http://127.0.0.1:6274/oauth/callback`。由于自己的电脑没有运行接收器,授权后浏览器可能显示连接失败,此时仍可复制完整地址栏。应选择未被其他本机应用占用的端口,否则其他应用会收到授权响应。
|
|
15
|
+
|
|
16
|
+
授权服务器必须允许所选回调地址。浏览器显示同意授权成功,并不代表插件登录已经完成。远程 DSH 必须通过经过认证的 HTTPS 访问,每位用户拥有独立 Host 进程、profile 和凭据存储。
|
|
17
|
+
|
|
18
|
+
## 登录步骤
|
|
19
|
+
|
|
20
|
+
1. 进入 Plugins → Built-in plugin settings → OAuth MCP,添加或编辑服务。
|
|
21
|
+
2. 在“回调方式”中选择“手动粘贴授权响应”。填写 MCP 服务地址、注册方式、客户端元数据 URL 或预注册身份、权限范围和已登记的回调 URL。此模式不使用内部监听端口。
|
|
22
|
+
3. 保存后点击“登录”,打开授权页面,只批准自己刚发起的登录。
|
|
23
|
+
4. 复制最终的完整回调 URL,包括 `code`、`state` 和存在时的 `iss` 参数。不要复制初始授权链接、成功提示文字、access token 或单独的授权码。
|
|
24
|
+
5. 回到 DSH 中同一服务的待完成登录,将内容粘贴到“完整授权回调 URL”输入框,点击“提交授权响应”。不要将其粘贴到聊天或发送给他人。
|
|
25
|
+
6. 提交后输入框会清空。“已收到响应”仅表示接收成功;请继续等待 DSH 显示“已授权”和“已连接”,并发现工具。
|
|
26
|
+
|
|
27
|
+
输入框以掩码显示,不写入浏览器本地存储,仅属于当前待完成登录。取消、完成、过期或离开设置页会移除该输入。后端使用内存中的 verifier 换票,再通过已有凭据存储保存授权记录。提交被拒绝时也会清空输入框;如果该次登录仍在等待,可重新粘贴正确响应。
|
|
28
|
+
|
|
29
|
+
## 校验与恢复
|
|
30
|
+
|
|
31
|
+
插件只解析提交的 URL,不会请求该地址。它会校验配置中的精确 origin 和路径、URL 不含用户信息或片段、一次性 state 匹配、响应参数不重复,以及提供 `iss` 时它与已发现 issuer 一致。响应必须包含非空的授权码或 OAuth 错误,两者不能同时存在。重复参数、token 参数、其他未支持参数,以及超过 16,384 个字符的响应会被拒绝。标准 `error_description` 和 `error_uri` 字段可以接收,但不会回显,也不会访问其中的链接。
|
|
32
|
+
|
|
33
|
+
格式错误或不匹配的响应不会消耗当前登录机会。有效授权码或拒绝授权响应只能被接收一次,重复提交会失败。取消、超时、停用或删除服务、清除授权以及卸载插件都会使待提交响应失效。进程重启会丢失待完成登录的 state 和 verifier,此时需要重新登录。旧登录或其他服务的响应不能完成新登录。
|
|
34
|
+
|
|
35
|
+
如果授权码已过期或已使用导致换票失败,应重新发起登录,不要反复提交同一个响应。已有刷新和连接行为不变。手动输入仅用于交互式授权,成功刷新 token 不需要再次粘贴。
|
|
36
|
+
|
|
37
|
+
## 敏感信息处理
|
|
38
|
+
|
|
39
|
+
提交经过插件仅允许所有者访问的直接 Remote API,不经过聊天、模型工具或会话命令。API 不返回提交的 URL 或授权码,错误使用固定错误码。自动化测试验证非 owner 请求被拒绝,提交的授权码不出现在返回状态、服务配置、授权记录或捕获的日志中。已检查的官方一元 Remote 调用路径不记录请求参数,但这不能替代对额外部署诊断功能的检查。
|
|
40
|
+
|
|
41
|
+
不要让网关诊断、自定义追踪或调试中间件记录 `mcpOAuth/submitResponse` 请求体。剪贴板、浏览器历史和目标回调页面在清理前可能保留响应,插件不会清除这些位置。不要把授权链接或回调参数写入仓库文件、截图、Issue 或分析记录。此仓库仅使用保留域名和本地 fixture。
|
package/docs/releasing.md
CHANGED
|
@@ -25,13 +25,29 @@ pnpm run check:release
|
|
|
25
25
|
pnpm run typecheck
|
|
26
26
|
pnpm test
|
|
27
27
|
pnpm pack --pack-destination artifacts
|
|
28
|
-
node scripts/check-release.mjs --tarball artifacts/noob9527-dsh-mcp-oauth-0.
|
|
28
|
+
node scripts/check-release.mjs --tarball artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.2.tgz
|
|
29
29
|
```
|
|
30
30
|
|
|
31
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
32
|
|
|
33
|
-
|
|
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.
|
|
42
|
+
|
|
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.
|
|
34
44
|
|
|
35
45
|
## Evidence limits
|
|
36
46
|
|
|
37
47
|
Local Web acceptance and the automated suite are recorded in acceptance.md. Desktop remains unqualified. Local screenshots, counters and tarballs under artifacts/ are intentionally ignored; review them before any separate upload. Do not publish URLs containing browser login tokens, callback codes or OAuth state.
|
|
48
|
+
|
|
49
|
+
## Publish the client metadata document
|
|
50
|
+
|
|
51
|
+
The `site/` directory contains only public OAuth client metadata. Its GitHub Pages deployment uses the `gh-pages` branch root. After reviewing and committing changes to `site/`, publish its subtree with `git subtree split --prefix=site` and push the returned commit with `git push origin <commit>:gh-pages`. Subsequent deployments must retain branch history; do not force-push. Configure repository Pages to deploy from `gh-pages` at `/ (root)`. This publishes static metadata only, not an npm package.
|
|
52
|
+
|
|
53
|
+
Verify the document URL returns HTTP 200 without redirects, a JSON Content-Type, and a `client_id` exactly matching its URL. Keep the URL stable and retain supported redirect URIs when updating the document. The default native-client document supports the `/oauth/callback` path on localhost and 127.0.0.1 with variable ports; it contains no credentials or deployment-specific service addresses.
|