@noob9527/dsh-mcp-oauth 0.0.0-stage → 0.2.0-rc.1

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 ADDED
@@ -0,0 +1,24 @@
1
+ # Changelog
2
+
3
+ ## 0.2.0-rc.1 — 2026-11-16
4
+
5
+ - 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.
6
+
7
+ - Manual authorization response submission through an owner-only settings form, with no listener, one-use state and PKCE retained.
8
+
9
+ - Remote personal-instance OAuth callbacks through an HTTPS reverse proxy, with a separate loopback listener port.
10
+ - Deployment selection and bilingual guidance in settings.
11
+ - Reject ambiguous callback parameters; preserve one-use state, PKCE and owner-only credential access.
12
+ - Existing settings default to local mode. Older versions cannot read newly saved callback fields; restore compatible configuration before downgrade.
13
+
14
+ ## 0.1.0 — 2026-11-16
15
+
16
+ - Public npm identity: `@noob9527/dsh-mcp-oauth`, including scoped Host and Client module registration.
17
+
18
+ - Standalone Host/Client plugin targeting unmodified DSH 0.2.2-rc.2.
19
+ - Streamable HTTP tools with OAuth Authorization Code + PKCE, CIMD, pre-registration and DCR.
20
+ - Profile/service credential isolation, refresh rotation, cancellation and bounded connection recovery.
21
+ - Service settings with English and Chinese labels.
22
+ - Deterministic local OAuth/MCP and HTTPS metadata fixtures; Web acceptance and failure matrix.
23
+
24
+ Initial preview release. Desktop qualification remains pending.
@@ -0,0 +1,24 @@
1
+ # Contributing
2
+
3
+ Use Node 24.9 or newer, pnpm 12.5.1, Git and OpenSSL with `req -addext`. Install dependencies with `pnpm install --frozen-lockfile --ignore-scripts`.
4
+
5
+ Before a pull request:
6
+
7
+ ```sh
8
+ pnpm run check:release
9
+ pnpm run typecheck
10
+ pnpm test
11
+ pnpm run build
12
+ pnpm pack --pack-destination artifacts
13
+ node scripts/check-release.mjs --tarball artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.1.tgz
14
+ ```
15
+
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
+
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
+
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
+
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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 dsh-mcp-oauth contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,126 @@
1
- # Temporary Holding Version
1
+ # DSH MCP OAuth
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ 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
+
5
+ [中文](README.zh.md)
6
+
7
+ ## Status and compatibility
8
+
9
+ Independent community plugin; not an official DeepSeek product. The npm 0.1.0 release supports local callbacks. The 0.2.0-rc.1 preview adds remote personal-instance callbacks and manual response submission.
10
+
11
+ | Surface | Status |
12
+ | --- | --- |
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
+ | Official Desktop | Intended scope; acceptance pending |
15
+ | Other DSH versions | Not declared compatible |
16
+ | Remote personal DSH, 0.2.0-rc.1 | HTTPS proxy fixture verified; actual deployment acceptance required |
17
+ | Shared multi-user DSH | Not supported |
18
+
19
+ Version 0.2.0-rc.1 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
+
21
+ ## Install from npm
22
+
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
+ Install the preview by its exact version below, or use the `next` tag. The stable `latest` tag remains on 0.1.0.
26
+
27
+ Install the preview release:
28
+
29
+ ```sh
30
+ dsh plugin --profile web add @noob9527/dsh-mcp-oauth@0.2.0-rc.1
31
+ ```
32
+
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.
34
+
35
+ ## Install from source
36
+
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:
38
+
39
+ ```sh
40
+ pnpm install --frozen-lockfile --ignore-scripts
41
+ pnpm run typecheck
42
+ pnpm test
43
+ pnpm pack --pack-destination artifacts
44
+ dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.1.tgz"
45
+ ```
46
+
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/`.
48
+
49
+ Desktop has a separate profile; installation and OAuth behavior there are not yet qualified.
50
+
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.
54
+
55
+ ## Configuration
56
+
57
+ The initial service list is empty. A placeholder endpoint is `https://mcp.example.com/mcp`; it is not a live service.
58
+
59
+ | Setting | Meaning |
60
+ | --- | --- |
61
+ | Service ID | Stable lower-case identifier; namespaces tools and credentials |
62
+ | Registration mode | Automatic, CIMD, pre-registered or DCR |
63
+ | Client metadata document URL | Public HTTPS CIMD document maintained by the client operator |
64
+ | Client ID / secret | Pre-registered identity; the secret is stored separately |
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:6274/oauth/callback`; must match permitted redirects |
68
+ | Scopes | Optional space-separated scope names |
69
+
70
+ Automatic mode uses configured pre-registration first, then CIMD when configured and supported, then dynamic registration. Explicit CIMD fails when unsupported. The plugin does not host a public CIMD document. Configure its redirect URI before login; the plugin does not silently select another port if the configured port is occupied.
71
+
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.
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
+
76
+ ## Credentials and lifecycle
77
+
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.
79
+
80
+ Client secrets, access tokens and refresh tokens are not returned to the UI or written to service configuration. PKCE verifiers and state remain in memory during authorization. One running DSH process per profile is supported; concurrent processes sharing a profile are not a token-refresh coordination mechanism.
81
+
82
+ Disabling preserves authorization. Clearing authorization disconnects and deletes the local grant. Deleting removes both the configuration and its grant. These actions do not claim server-side revocation. Uninstalling the package leaves local persisted data; clear grants and delete services first if you want to remove that data.
83
+
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.
85
+
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.
93
+
94
+ ## Development and validation
95
+
96
+ ```sh
97
+ pnpm install --frozen-lockfile --ignore-scripts
98
+ pnpm run typecheck
99
+ pnpm test
100
+ pnpm run build
101
+ pnpm pack
102
+ pnpm exec tsx tests/serve-fixture.ts
103
+ ```
104
+
105
+ Tests run deterministic OAuth/MCP and HTTPS metadata servers on loopback. CIMD authorization fetches and validates the actual metadata document, including client identity and redirect URI, before consent. OpenSSL generates a temporary per-run certificate trusted only by the test authorization server; TLS verification remains enabled. Run `pnpm exec tsx tests/serve-cimd.ts` for browser acceptance. This local test does not certify public hosting or a third-party authorization server.
106
+
107
+ See [acceptance](docs/acceptance.md) for the official-client workflow and current verification status. Protocol tests are not a substitute for actual chat invocation.
108
+
109
+ ## Troubleshooting
110
+
111
+ - `OAUTH_CALLBACK_UNAVAILABLE`: free the configured loopback port, or configure a different redirect permitted by your client metadata.
112
+ - `OAUTH_CIMD_UNSUPPORTED`: choose a registration method supported by the authorization server.
113
+ - `OAUTH_ISSUER_CHANGED`: verify the server's issuer and clear the old authorization before logging in again.
114
+ - `OAUTH_LOGIN_REQUIRED`: refresh is unavailable or rejected; sign in again.
115
+ - `MCP_CALL_OUTCOME_UNKNOWN`: inspect the operation on the server before retrying it.
116
+ - `OAUTH_CONFIG_UNREADABLE`: repair the profile configuration file; the plugin does not discard unreadable configuration.
117
+
118
+ ## Contributing and releases
119
+
120
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development, [SECURITY.md](SECURITY.md) for sensitive reports, and [the release guide](docs/releasing.md) for publishing source or packages. GitHub CI checks, tests and builds the project without model credentials; a green CI run does not replace Desktop or real-chat acceptance.
121
+
122
+ Authentication recovery failure withdraws the affected service’s tools and requires sign-in. A lost response or timeout reports an unknown outcome and never automatically replays tools/call; reconnect only reinitializes the connection and discovers tools. Closing a connection rejects new calls and drains admitted work. See the [failure acceptance matrix](docs/acceptance.md#high--and-medium-priority-failure-acceptance) for automated versus browser evidence.
123
+
124
+ ## License
125
+
126
+ [MIT](LICENSE). Dependencies retain their own licenses.
package/README.zh.md ADDED
@@ -0,0 +1,106 @@
1
+ # DSH MCP OAuth
2
+
3
+ 为未经修改的官方 DeepSeek Harness 提供 OAuth MCP 工具接入。插件自行管理 MCP 连接,通过官方工具、凭据、授权及插件页面接口集成。
4
+
5
+ [English](README.md)
6
+
7
+ ## 状态与兼容性
8
+
9
+ 本项目是独立社区插件,并非 DeepSeek 官方产品。npm 0.1.0 仅支持本机回调;0.2.0-rc.1 预览版新增远程个人实例回调和手动粘贴授权响应。
10
+
11
+ | 客户端 | 验证状态 |
12
+ | --- | --- |
13
+ | 官方 DSH 0.2.1-alpha.3 / 0.2.2-rc.1 Web,本机 macOS | 当前候选包:已验证浏览器 CIMD 授权和真实聊天调用 |
14
+ | 官方 Desktop | 计划支持,尚待验收 |
15
+ | 其他 DSH 版本 | 未声明兼容 |
16
+ | 远程个人 DSH,0.2.0-rc.1 | HTTPS 代理 fixture 已验证,实际部署仍需验收 |
17
+ | 多人共享 DSH | 不支持 |
18
+
19
+ 0.2.0-rc.1 要求 DSH `>=0.2.1-alpha.3`。[17 版本兼容矩阵](docs/compatibility.md)中满足下限的 13 个已发布版本均通过自动化检查。范围允许安装后续版本,但不代表后续版本自动通过验收。0.1.0 保留原 rc.2 限制。
20
+
21
+ ## 从 npm 安装
22
+
23
+ 需要 Node 24.9+ 和满足 `>=0.2.1-alpha.3` 的未经修改官方 DSH。公开包名为 `@noob9527/dsh-mcp-oauth`。
24
+
25
+ 使用下面的精确版本号或 `next` 标签安装预览版;稳定版 `latest` 标签保留为 0.1.0。
26
+
27
+ 安装预览版:
28
+
29
+ ```sh
30
+ dsh plugin --profile web add @noob9527/dsh-mcp-oauth@0.2.0-rc.1
31
+ ```
32
+
33
+ 无 scope 的 `dsh-mcp-oauth` 属于其他项目。从本地旧包迁移时,先移除旧插件条目,再安装新包,不要同时启用两者。使用相同 DSH profile 和 home,以保留本机服务配置和授权记录。
34
+
35
+ ## 从源码安装
36
+
37
+ 需要 Node **24.9+**、pnpm **12.5.1**,以及满足 **`>=0.2.1-alpha.3`** 的未经修改官方 DSH。克隆本仓库后,在仓库目录运行:
38
+
39
+ ```sh
40
+ pnpm install --frozen-lockfile --ignore-scripts
41
+ pnpm run typecheck
42
+ pnpm test
43
+ pnpm pack --pack-destination artifacts
44
+ dsh plugin --profile web add "$(pwd)/artifacts/noob9527-dsh-mcp-oauth-0.2.0-rc.1.tgz"
45
+ ```
46
+
47
+ 测试需要支持 `req -addext` 的 OpenSSL;自动化测试不需要模型 API Key 或业务 MCP 服务。DSH 提示需要重启时,重启后继续。如果使用自定义 `DSH_HOME`,安装插件和启动 DSH 时必须使用相同值。通过 npm 安装时,如无法解析包名,请检查 `npm config get registry`;公开 registry 为 `https://registry.npmjs.org/`。
48
+
49
+ Desktop 使用独立 profile,目前尚未完成其安装和 OAuth 验收。
50
+
51
+ ## 登录
52
+
53
+ 进入“Plugins → Built-in plugin settings → OAuth MCP”(当前官方扩展位把设置入口放在这个分组中),添加服务、保存并点击“登录”,随后打开授权页面。本机模式下,浏览器必须运行在 DSH 所在的电脑上;远程个人实例模式下,管理员配置 HTTPS 回调代理后,可在自己的浏览器登录。回调页只确认已收到授权响应;最终授权状态和工具连接状态分别显示在 DSH 中。
54
+
55
+ ## 配置
56
+
57
+ 开发版支持“本机”“远程个人实例”自动回调和“手动粘贴授权响应”三种回调方式。远程模式配置公网 HTTPS 回调 URL 和内部监听端口(默认 6274),监听地址固定为 `127.0.0.1`。代理必须与实例共享网络命名空间,每人拥有独立 Host、profile 和凭据存储。部署步骤、CIMD 模板及降级限制见[远程个人实例指南](docs/remote-personal-instances.zh.md)。
58
+
59
+ 默认服务列表为空。文档中的 `https://mcp.example.com/mcp` 仅为占位地址。
60
+
61
+ - 自动模式优先使用已配置的预注册身份,其次使用服务端支持的 CIMD,最后尝试 DCR。
62
+ - CIMD 文档需由客户端运营者托管在 HTTPS 地址;本插件不提供公共文档托管。
63
+ - 默认回调为 `http://127.0.0.1:6274/oauth/callback`,必须与客户端允许的回调一致。端口占用时不会自动换端口。
64
+ - 客户端密钥单独保存;编辑表单留空表示保留已有值。清除授权会删除包含密钥的本机授权记录。
65
+ - 高级设置默认:连接超时 30 秒、授权超时 5 分钟、工具总时限 10 分钟、提前 60 秒刷新、最多重连 5 次且间隔不超过 30 秒。
66
+
67
+ 无法反代回调时,可选择“手动粘贴授权响应”。浏览器授权后,将完整回调 URL 粘贴到该服务的待登录表单;插件不启动监听器,仍校验 PKCE、一次性 state 和已登记回调地址。详见[手动授权指南](docs/manual-authorization.zh.md)。
68
+
69
+ ## 凭据与失败处理
70
+
71
+ 服务配置保存在当前 profile 的 `mcp-oauth/servers.json`。授权信息通过 DSH 凭据服务保存,按 profile 的真实目录和服务标识区分。默认存储为本地文件,不是系统钥匙串。修改服务地址、客户端身份、权限范围或回调配置后需要重新授权。
72
+
73
+ 停用保留凭据;清除授权断开连接并删除本机凭据;删除服务同时删除配置和凭据。这些操作不代表已在授权服务器撤销 token。卸载包保留持久化数据,如需清理,请先清除授权并删除服务。首版不支持多个 DSH 进程同时使用同一 profile。
74
+
75
+ 刷新 token 不主动中断已受理的长调用。HTTP 401 最多触发一次 SDK 认证后重发;断线或超时不会自动重放工具调用。出现“结果未知”时,先核查服务端执行情况,再决定是否重试。
76
+
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`。
84
+
85
+ ## 开发与验收
86
+
87
+ ```sh
88
+ pnpm install --frozen-lockfile --ignore-scripts
89
+ pnpm run typecheck
90
+ pnpm test
91
+ pnpm run build
92
+ pnpm pack
93
+ pnpm exec tsx tests/serve-fixture.ts
94
+ ```
95
+
96
+ 本地测试服务提供确定性搜索、延迟返回和调用计数。CIMD 测试启动独立 HTTPS 文档服务,授权服务器在同意授权前实际抓取并校验客户端身份和回调地址。OpenSSL 为每次测试生成临时证书,仅测试授权服务器显式信任,TLS 校验保持开启。运行 `pnpm exec tsx tests/serve-cimd.ts` 可进行浏览器验收;这不代表验证了公网托管或第三方授权服务器。官方客户端验收步骤和已完成项目见 [验收说明](docs/acceptance.md)。
97
+
98
+ ## 贡献与发布
99
+
100
+ 开发流程见 [CONTRIBUTING.md](CONTRIBUTING.md),敏感问题报告见 [SECURITY.md](SECURITY.md),源码与包的发布步骤见[发布指南](docs/releasing.md)。GitHub CI 不需要模型凭据;CI 通过不代表完成 Desktop 或真实聊天验收。
101
+
102
+ 认证恢复失败会注销受影响服务的工具并提示重新登录。响应丢失或超时会报告结果未知,不会自动重放 tools/call;重连仅重新初始化连接和发现工具。关闭连接会拒绝新调用并等待已受理工作结束。[故障验收矩阵](docs/acceptance.md#high--and-medium-priority-failure-acceptance)区分自动化测试与真实页面证据。
103
+
104
+ ## 许可证
105
+
106
+ [MIT](LICENSE)。依赖保留各自的许可证。
package/SECURITY.md ADDED
@@ -0,0 +1,11 @@
1
+ # Security
2
+
3
+ This preview integrates OAuth credentials and external tools. Only DSH 0.2.2-rc.2 is currently targeted; Desktop acceptance is pending. See the README for deployment limitations.
4
+
5
+ Do not put tokens, client secrets, authorization codes, credential files or unsanitized logs in public issues or pull requests.
6
+
7
+ If the repository's Security tab provides **Report a vulnerability**, use that private channel. If it is unavailable, open a public issue requesting a private contact channel without vulnerability details. Do not disclose exploit instructions or credentials while waiting for a private channel. There is no guaranteed response-time commitment.
8
+
9
+ For an exposed credential, revoke or rotate it at its issuer. Clearing local plugin authorization does not revoke it at the server.
10
+
11
+ The maintainer should enable GitHub private vulnerability reporting before making the repository public. Reports should identify the plugin and DSH versions, deployment type, impact, and a reproduction using synthetic credentials and local fixtures.
@@ -0,0 +1,3 @@
1
+ - insert:
2
+ - id: mcp-oauth
3
+ name: "@noob9527/dsh-mcp-oauth"
@@ -0,0 +1,120 @@
1
+ # Official-client acceptance
2
+
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
+
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
+ 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
+ 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
+ 4. Sign in, open the authorization page and approve. Verify that authorization succeeds, the connection becomes connected and two tools are listed.
9
+ 5. Configure model credentials through DSH's own UI. Start a chat asking it to call the configured search tool with query `oauth`. Verify the tool card contains `document-1`; do not substitute a terminal SDK call for this step.
10
+ 6. Restart DSH and verify another chat call succeeds without browser authorization.
11
+ 7. Check cancellation, disabled state, clear authorization, failed login and disconnected state. Inspect light/dark themes and a narrow window.
12
+ 8. Repeat installation and the interaction in the official Desktop app's separate profile.
13
+
14
+ The fixture contains no business environment or personal data. Do not record browser address bars containing authorization codes, access tokens or callback state. Actual model credentials must remain outside this repository.
15
+
16
+ ## Evidence status
17
+
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
+
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
+
26
+ ## Local CIMD Web acceptance
27
+
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.
29
+
30
+ The metadata host owns a temporary certificate and key. Only the fixture authorization server trusts that certificate. Neither DSH nor the browser needs a trust override: the authorization server fetches the HTTPS document. The test server pins the permitted document URL, allowing its owned loopback endpoint only; it is not a production SSRF policy implementation. No global certificate store or TLS verification flag is changed.
31
+
32
+ Sign in, open the authorization page, approve, and wait for Authorized / Connected / Tools: 2. Ask the real DSH chat to invoke `mcp__cimd-test__search` once with query `cimd-e2e` (use service ID `cimd-test`). Inspect both the tool card and the audit endpoint. The audit endpoint exposes counters only, never tokens or authorization codes.
33
+
34
+ Observed on 2026-11-16 in the unmodified official DSH 0.2.2-rc.2 Web client, with installed plugin build6 tarball:
35
+
36
+ | Evidence | Observed |
37
+ | --- | --- |
38
+ | HTTPS metadata retrieval / validation | 1 / 1 |
39
+ | Authorization / authorization-code token exchange | 1 / 1 |
40
+ | DCR registration | 0 |
41
+ | Actual chat tool calls | 1 |
42
+ | Tool input | query = cimd-e2e |
43
+ | Tool output | document-1; OAuth MCP test document; query = cimd-e2e |
44
+
45
+ This exercises discovery, explicit CIMD client selection, actual HTTPS metadata retrieval and validation, browser consent, PKCE code exchange, authenticated MCP discovery and real-model tool execution. The document and authorization server are repository-owned test fixtures, not public hosting or a third-party identity provider. No production plugin code was changed for this CIMD verification; later uninstalled lifecycle changes are outside this browser evidence. Desktop CIMD acceptance remains pending.
46
+
47
+ The automated suite also rejects a metadata document with a mismatched client_id or redirect URI before consent and token exchange. Typechecking and all 18 tests passed after these fixture changes. The fixtures keep token state in memory: restarting the fixture requires fresh authorization.
48
+
49
+ ## CIMD expiry, long call and process restart
50
+
51
+ Run `CIMD_TOKEN_SECONDS=10 CIMD_CALLBACK_URL=http://127.0.0.1:16277/oauth/callback pnpm exec tsx tests/serve-cimd.ts`. Add a separate `cimd-lifecycle` service in the official Web client using the printed endpoints and explicit CIMD mode. Set Advanced → Refresh lead time to 0 ms so this test exercises actual expiry rather than the default 60-second early refresh. This is a test setting, not a recommended production default.
52
+
53
+ Complete browser authorization once. From actual DSH chat call `mcp__cimd-lifecycle__delayed_echo` with message `cimd-long-survived-expiry` and delayMs 20000. Then call `mcp__cimd-lifecycle__search` with query `cimd-after-expiry`. Stop the DSH process and wait for it to exit; keep the fixture process alive. Start the same official DSH installation with the same DSH_HOME, reopen the newly printed Web login URL and call search with query `cimd-after-process-restart`. Do not sign in to the MCP service again.
54
+
55
+ Observed on 2026-11-16 with official DSH 0.2.2-rc.2 and installed plugin build6 (no product-code changes for this test):
56
+
57
+ | Stage | Refresh count | Tool execution count | Result |
58
+ | --- | --- | --- | --- |
59
+ | Initial authorization | 0 | 0 | Connected, two tools |
60
+ | Long tool completed | 1 | 1 | cimd-long-survived-expiry |
61
+ | Search after expiry | 2 | 2 | document-1, query cimd-after-expiry |
62
+ | DSH process restarted | 3 | 2 | Credentials loaded, automatic refresh |
63
+ | Chat search after restart | 4 | 3 | document-1, query cimd-after-process-restart |
64
+
65
+ The long call ran for 20,001 ms. Its bearer token expired 9,991 ms after acceptance; the result completed 10,010 ms after expiry. Refresh count remained 1 throughout that call, so refreshing did not interrupt or replay it. Each of the three requested tools executed once. Browser authorization and authorization-code exchange counts remained 1; metadata retrieval remained 1; DCR registration remained 0. The fourth refresh occurred because the short token issued during startup expired before the next chat call.
66
+
67
+ The fixture rotates and invalidates each consumed refresh token. Successful refresh after a real process restart therefore verifies that the rotated refresh token was persisted and reused. This verifies request-time expiry handling; it does not claim periodic background refresh or require every server to continue an accepted call after token expiry. The fixture deliberately allows accepted work to complete.
68
+
69
+ Evidence is stored locally in ignored `artifacts/evidence/cimd-lifecycle-*.json`, `dsh-cimd-long-call.png` and `dsh-cimd-after-restart.png`; JSON contains counters and timestamps, not tokens. The audit endpoint now includes token issuance/expiry and tool acceptance/completion events. The automatic suite includes CIMD concurrent refresh, rotated-grant reload and a deterministic clock-controlled long-call expiry case; typechecking and all 20 tests passed.
70
+
71
+ ## High- and medium-priority failure acceptance
72
+
73
+ Verified on 2026-11-16 with unmodified official DSH 0.2.2-rc.2 Web and the new `dsh-mcp-oauth-0.1.0.tgz` from the failure-acceptance pack directory. This package replaces build6 for these checks. No official DSH files were modified.
74
+
75
+ | Scenario | Automated evidence | Real Web evidence |
76
+ | --- | --- | --- |
77
+ | Refresh token revoked | Login-required error, tools withdrawn, no interactive retry | Chat reports sign-in required; no tool executes or new consent opens |
78
+ | Early 401 | One refresh, one successful tool execution | Covered by automated bridge test |
79
+ | Repeated 401 | One refresh, then sign-in required and zero tools | Two rejected requests, one refresh, no tool execution; settings show sign-in required |
80
+ | Response lost after acceptance | Unknown outcome; reconnect without replay | One accepted call, two connection initializations; chat explicitly says result unknown |
81
+ | Disconnect during long work | Barrier-controlled accepted long call; one execution, reconnect | Response-loss case above; held long-work case is automated |
82
+ | Tool timeout | Unknown outcome; one execution | Automated only |
83
+ | User cancellation | Cancellation reaches server, no replay | Stop button sends one cancellation; delayed work has cancelledAt and no completedAt |
84
+ | Clear/disable/unload during login or refresh | Six controlled Host cases; no late credential restore, no remaining tools or callback listener | Automated only |
85
+ | Concurrent expiry | Eight actual tool calls share one refresh | Automated only |
86
+ | Multiple services | Credential/tool namespaces and failure isolation | Healthy service search succeeds while failed service requires login |
87
+ | Tool list changes | Real SSE notification; removed tools disappear; duplicate names never partially register | Settings count changes 2 → 3 → 1 |
88
+ | Reconnect budget and manual recovery | Two retries after initial failure, then stop; explicit reconnect recovers | Successful reconnect after response loss; exhaustion is automated |
89
+ | Configuration identity changes | URL, metadata identity, callback, scope, mode/client ID do not reuse mismatched grants | Automated only |
90
+ | Disable/enable/delete | Disable retains grant, enable restores tools without consent, delete removes grant and flow | Earlier enable/disable check plus current Host tests |
91
+ | Unload with an active call | Connection closes and drains in-flight work; no late tool registration | Automated only |
92
+
93
+ The fault fixture is started with `CIMD_CALLBACK_URL=http://127.0.0.1:16278/oauth/callback pnpm exec tsx tests/serve-cimd.ts`. Its optional `/test-control` route exists only in audit-enabled manual fixtures. POST a strict JSON object with selected flags (`dropCalls`, `rejectTokens`, `rejectOnce`, `refreshFails`, `failInitialize`) or `toolNames`. Requests with Origin or a content type other than application/json are rejected; the server listens only on loopback. These controls are test infrastructure and are not in the npm plugin package.
94
+
95
+ The browser sequence used `cimd-faults`: drop response, cancel a 60-second delayed call, reject every bearer token, manually sign in again, publish tool-list changes, reject one bearer request while refusing refresh, then call the separate healthy `cimd-test` service. Its final pre-reset audit recorded two manual authorizations, zero DCR registrations, two accepted tools (one dropped response, one cancelled), one successful refresh and one refused refresh. No new tool execution occurred during either authentication failure. All fault flags were reset after validation; the fault service remains sign-in required until explicitly logged in again.
96
+
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.
98
+
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.
@@ -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。