dsh-mcp-connectors 0.1.0 → 0.1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +57 -0
- package/CHANGELOG.zh-CN.md +39 -0
- package/README.md +76 -42
- package/README.zh-CN.md +109 -0
- package/assets/screenshots/panel-dark.png +0 -0
- package/assets/screenshots/panel-light.png +0 -0
- package/lib/client.js +4 -4
- package/package.json +9 -3
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here. Format follows [Keep a Changelog](https://keepachangelog.com/), versions use [SemVer](https://semver.org/).
|
|
4
|
+
|
|
5
|
+
## [Unreleased]
|
|
6
|
+
|
|
7
|
+
## [0.1.4] - 2026-11-18
|
|
8
|
+
|
|
9
|
+
### 变更
|
|
10
|
+
|
|
11
|
+
- Also publishes to GitHub Packages (`@elegant01/dsh-mcp-connectors`) so the repo sidebar shows the package.
|
|
12
|
+
|
|
13
|
+
## [0.1.3] - 2026-11-18
|
|
14
|
+
|
|
15
|
+
### 变更
|
|
16
|
+
|
|
17
|
+
- CI lockfile switched to registry.npmjs.org (mirror tarball URLs are rejected by npm’s EALLOWREMOTE check).
|
|
18
|
+
|
|
19
|
+
## [0.1.2] - 2026-11-18
|
|
20
|
+
|
|
21
|
+
### Changed
|
|
22
|
+
|
|
23
|
+
- Publishing now uses npm Trusted Publishing (GitHub OIDC) — no token, no OTP.
|
|
24
|
+
|
|
25
|
+
## [0.1.1] - 2026-11-17
|
|
26
|
+
|
|
27
|
+
### Changed
|
|
28
|
+
|
|
29
|
+
- Bilingual README (English + 简体中文) with light/dark screenshots.
|
|
30
|
+
- Added `CHANGELOG.md` / `CHANGELOG.zh-CN.md`.
|
|
31
|
+
- Added GitHub Actions: `ci.yml` (typecheck + full regression on push/PR) and `publish.yml` (publishes to npm when a `v*` tag is pushed, with provenance).
|
|
32
|
+
- Package name is `dsh-mcp-connectors` (the original `dsh-mcp-manager` is taken on npm).
|
|
33
|
+
|
|
34
|
+
## [0.1.0] - 2026-11-17
|
|
35
|
+
|
|
36
|
+
First public release.
|
|
37
|
+
|
|
38
|
+
### Added
|
|
39
|
+
|
|
40
|
+
- Auto-discovery of MCP config files across local AI agents (home dot-dirs, `%APPDATA%`, `%LOCALAPPDATA%`, with macOS/Linux equivalents). Identification by file name and content, not by hard-coded per-agent tables; unknown agents can be registered manually.
|
|
41
|
+
- Support for four config shapes: JSON `mcpServers`, OpenCode-style `mcp`, Codex TOML `[mcp_servers.*]`, and JSONC (comments and trailing commas).
|
|
42
|
+
- Enable/disable servers. Since MCP has no cross-tool `disabled` flag, disabling moves the entry out of the config into plugin state; enabling writes it back.
|
|
43
|
+
- Add, edit and delete servers, with form and raw-JSON modes. Unrecognized fields are preserved on edit.
|
|
44
|
+
- Automatic backup of the target file before every write (last 100 kept), one-click restore, and the restore itself is backed up first.
|
|
45
|
+
- Codex TOML is rewritten per server section only — comments and unrelated settings survive.
|
|
46
|
+
- Product grouping: files belonging to the same product (e.g. WorkBuddy user-level + connectors) render as one card while each server stays bound to its own file.
|
|
47
|
+
- Drag-to-reorder servers in the panel; ordering is display-only and never touches config files.
|
|
48
|
+
- BoardUI-style panel adapted to the settings page: vertical layout, sticky section headers, collapsible groups, status/agent filters, back-to-top button, light/dark theme following the host.
|
|
49
|
+
- Per-source config path override and custom source registration.
|
|
50
|
+
- Settings sidebar entry with a dedicated icon.
|
|
51
|
+
- Full regression suite (`npm test`) running against a temporary HOME.
|
|
52
|
+
|
|
53
|
+
### Fixed
|
|
54
|
+
|
|
55
|
+
- Invalid server input (bad names, non-http URLs, malformed JSON) is rejected with a specific error code.
|
|
56
|
+
- Empty (0-byte) placeholder config files are treated as "no servers" instead of raising a parse error.
|
|
57
|
+
- Opening the host folder reports a readable error instead of throwing when the source is unknown.
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# 更新日志
|
|
2
|
+
|
|
3
|
+
本项目的重要变更都记录在此。格式遵循 [Keep a Changelog](https://keepachangelog.com/),版本号遵循 [SemVer](https://semver.org/)。
|
|
4
|
+
|
|
5
|
+
## [未发布]
|
|
6
|
+
|
|
7
|
+
## [0.1.1] - 2026-11-17
|
|
8
|
+
|
|
9
|
+
### 变更
|
|
10
|
+
|
|
11
|
+
- 补齐中英双语 README(含明暗两套截图)。
|
|
12
|
+
- 新增 `CHANGELOG.md` / `CHANGELOG.zh-CN.md`。
|
|
13
|
+
- 新增 GitHub Actions:`ci.yml`(push/PR 跑类型检查与全量回归)、`publish.yml`(推 `v*` 标签自动发布 npm,带 provenance)。
|
|
14
|
+
- 包名确定为 `dsh-mcp-connectors`(原名 `dsh-mcp-manager` 在 npm 上已被占用)。
|
|
15
|
+
|
|
16
|
+
## [0.1.0] - 2026-11-17
|
|
17
|
+
|
|
18
|
+
首个公开版本。
|
|
19
|
+
|
|
20
|
+
### 新增
|
|
21
|
+
|
|
22
|
+
- 自动发现本机各 AI Agent 的 MCP 配置文件(主目录点目录、`%APPDATA%`、`%LOCALAPPDATA%`,并覆盖 macOS / Linux 对应目录)。按文件名与文件内容识别,不依赖写死的 agent 清单;清单外的 agent 可手动登记。
|
|
23
|
+
- 支持四种配置形态:JSON `mcpServers`、OpenCode 风格 `mcp`、Codex TOML `[mcp_servers.*]`、JSONC(注释与尾逗号)。
|
|
24
|
+
- 服务器启停。MCP 没有跨工具通用的 `disabled` 字段,因此停用会把条目移出配置文件、定义存入插件状态;启用再写回。
|
|
25
|
+
- 新增、编辑、删除服务器,支持表单与原始 JSON 两种模式;编辑时保留未识别字段。
|
|
26
|
+
- 每次写入前自动备份目标文件(保留最近 100 份),支持一键恢复,且恢复前也会先备份当前内容。
|
|
27
|
+
- Codex TOML 仅按服务器节区重写——注释和其它配置原样保留。
|
|
28
|
+
- 产品归组:同一产品散布在多个文件的配置(如 WorkBuddy 用户级 + 连接器)合成一张卡片,每台服务器仍绑定自己的文件。
|
|
29
|
+
- 面板内拖拽排序;顺序仅用于展示,不修改配置文件。
|
|
30
|
+
- 适配设置页的 BoardUI 风格面板:竖向布局、区块头吸顶、分组折叠、状态 / Agent 筛选、回到顶部、跟随宿主的明暗主题。
|
|
31
|
+
- 单个来源的配置路径可覆盖,支持登记自定义来源。
|
|
32
|
+
- 设置侧栏入口与专属图标。
|
|
33
|
+
- 全量回归测试(`npm test`),在临时 HOME 下运行。
|
|
34
|
+
|
|
35
|
+
### 修复
|
|
36
|
+
|
|
37
|
+
- 非法服务器输入(名称格式、非 http(s) 地址、非法 JSON)会返回明确的错误码。
|
|
38
|
+
- 0 字节的占位配置文件视为「无服务器」,不再报解析错误。
|
|
39
|
+
- 来源不存在时「打开所在文件夹」返回可读错误,而不是抛异常。
|
package/README.md
CHANGED
|
@@ -1,76 +1,110 @@
|
|
|
1
|
-
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/icon.svg" width="88" height="88" alt="DSH MCP Connectors" />
|
|
3
|
+
</p>
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
<h1 align="center">DSH MCP Connectors</h1>
|
|
4
6
|
|
|
5
|
-
|
|
7
|
+
<p align="center">
|
|
8
|
+
在 DeepSeek Harness 里统一管理本机各个 AI Agent 的 MCP 服务器。<br/>
|
|
9
|
+
Manage MCP servers across every local AI agent — directly inside DeepSeek Harness.
|
|
10
|
+
</p>
|
|
6
11
|
|
|
7
|
-
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="README.zh-CN.md">简体中文</a> · <b>English</b> ·
|
|
14
|
+
<a href="https://www.npmjs.com/package/dsh-mcp-connectors">npm</a>
|
|
15
|
+
</p>
|
|
8
16
|
|
|
9
|
-
|
|
17
|
+

|
|
10
18
|
|
|
11
|
-
|
|
12
|
-
- **启停不丢定义**:停用 = 条目从配置文件移出、原定义存进管理器状态(各家 MCP 格式没有统一的 disabled 字段,这是不污染原文件语义的做法);启用一键写回。
|
|
13
|
-
- **读写带备份回退**:每次写配置文件前自动快照原文件(保留最近 100 份),随时一键回退;回退前也会先备份当前内容。
|
|
14
|
-
- **Codex TOML 安全改写**:只重写 `[mcp_servers.*]` 节区,文件其余内容(注释、其它配置)逐字节保留。
|
|
15
|
-
- **BoardUI 风格界面**:浮动侧栏导航、KPI 卡片、服务器卡片网格、明暗双主题,与表格型管理器完全不同的观感。
|
|
19
|
+
## Why
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
Every AI agent keeps its own MCP config in its own file, in its own format. Finding out which servers are running, and toggling one off for a single tool, means hand-editing JSON and remembering which file belongs to whom.
|
|
18
22
|
|
|
19
|
-
|
|
23
|
+
This plugin auto-discovers those files, shows them in one panel, and lets you toggle, add, edit and delete servers — backing up every file before it is written, with one-click rollback.
|
|
24
|
+
|
|
25
|
+
## Features
|
|
26
|
+
|
|
27
|
+
- **Auto-discovery** — scans `~`, `%APPDATA%` and `%LOCALAPPDATA%` (macOS/Linux equivalents included), identifies configs by file name **and** content (`mcpServers` / `mcp` keys, `[mcp_servers]` sections). First scan ≈250 ms on a typical dev machine, then cached.
|
|
28
|
+
- **Multi-format support** — JSON (`mcpServers`), OpenCode-style (`mcp`), Codex TOML (`[mcp_servers.*]`, rewritten per section so comments and unrelated settings survive byte-for-byte), and JSONC (comments / trailing commas).
|
|
29
|
+
- **Safe writes** — every write snapshots the original file into `~/.dsh/mcp-connectors/backups/` (last 100 kept). Restore any version with one click; the restore itself is backed up too.
|
|
30
|
+
- **Enable / disable** — MCP has no cross-tool `disabled` flag, so disabling removes the entry from the config and keeps its definition in the manager state; enabling writes it back.
|
|
31
|
+
- **Product grouping** — tools that split their config across files (e.g. WorkBuddy user-level + connectors) render as one card, each server still bound to its own file.
|
|
32
|
+
- **Drag to reorder** — display-only ordering stored in plugin state; config files are never touched.
|
|
33
|
+
- **Panel that fits the settings page** — vertical layout, sticky section headers, collapsible groups, status/agent filters, back-to-top, and light/dark that follows the host theme.
|
|
34
|
+
|
|
35
|
+

|
|
36
|
+
|
|
37
|
+
## Supported configs
|
|
38
|
+
|
|
39
|
+
| Agent | Path | Format |
|
|
20
40
|
| --- | --- | --- |
|
|
21
41
|
| DSH | `~/.dsh/mcp.json` | JSON `mcpServers` |
|
|
22
42
|
| Claude Code | `~/.claude.json` | JSON `mcpServers` |
|
|
23
43
|
| Codex | `~/.codex/config.toml` | TOML `[mcp_servers.*]` |
|
|
24
44
|
| Cursor | `~/.cursor/mcp.json` | JSON `mcpServers` |
|
|
25
45
|
| Gemini | `~/.gemini/settings.json` | JSON `mcpServers` |
|
|
46
|
+
| Google Antigravity | `~/.gemini/config/mcp_config.json` | JSON `mcpServers` |
|
|
47
|
+
| Qwen Code | `~/.qwen/settings.json` | JSON `mcpServers` |
|
|
48
|
+
| Kimi Code | `~/.kimi-code/config.toml` | TOML |
|
|
49
|
+
| AtomCode | `~/.atomcode/mcp.json` | JSON `mcpServers` |
|
|
26
50
|
| OpenCode | `~/.config/opencode/opencode.json` | JSON `mcp` |
|
|
27
51
|
| Windsurf | `~/.codeium/windsurf/mcp_config.json` | JSON `mcpServers` |
|
|
28
|
-
| Trae /
|
|
52
|
+
| Trae / Trae CN | `~/.trae/mcp.json`, `~/.trae-cn/mcp.json` | JSON `mcpServers` |
|
|
53
|
+
| Qoder | `~/.qoder/mcp.json` | JSON `mcpServers` |
|
|
54
|
+
| CodeBuddy / CN | `~/.codebuddy/mcp.json` | JSON `mcpServers` |
|
|
55
|
+
| WorkBuddy | `~/.workbuddy/mcp.json`, `~/.workbuddy/connectors/default/mcp.json` | JSON `mcpServers` |
|
|
56
|
+
| VS Code | `%APPDATA%/Code/User/mcp.json` | JSONC |
|
|
57
|
+
| …and anything else auto-discovered | — | — |
|
|
29
58
|
|
|
30
|
-
|
|
59
|
+
Paths are configurable per source; an override is stored in `~/.dsh/mcp-connectors/state.json`. A source whose file does not exist simply doesn't appear.
|
|
31
60
|
|
|
32
|
-
##
|
|
61
|
+
## Install
|
|
33
62
|
|
|
34
63
|
```powershell
|
|
35
|
-
dsh plugin --profile web add
|
|
64
|
+
dsh plugin --profile web add dsh-mcp-connectors
|
|
36
65
|
```
|
|
37
66
|
|
|
38
|
-
|
|
39
|
-
- **设置 → MCP 服务器**:完整面板;
|
|
40
|
-
- **侧栏「插件」下方**:常驻 MCP 图标入口,大面板浏览。
|
|
41
|
-
|
|
42
|
-
## 开发
|
|
67
|
+
or from GitHub:
|
|
43
68
|
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
npm run typecheck # tsc --noEmit
|
|
47
|
-
npm run build # 生成 lib/(host 不打包,client 打包成 DSH ModuleLoader CJS)
|
|
48
|
-
node scripts/preview.mjs # 生成 docs/preview.html,浏览器里预览 UI(mock 数据)
|
|
69
|
+
```powershell
|
|
70
|
+
dsh plugin --profile web add https://github.com/elegant01/dsh-mcp-connectors
|
|
49
71
|
```
|
|
50
72
|
|
|
51
|
-
|
|
73
|
+
Restart DSH, then open **Settings → Connectors**. Host routes are registered at startup, so a full restart (tray → quit) is required after upgrading.
|
|
74
|
+
|
|
75
|
+
## Security
|
|
52
76
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
-
|
|
77
|
+
- Every mutating request needs a custom header, `application/json`, and a same-origin `Origin`; the host's `connection.fetch` gate still applies.
|
|
78
|
+
- Writes are serialized, and a backup always precedes a write.
|
|
79
|
+
- Deleting a server removes only that entry; other keys in the file are preserved (JSON is re-serialized, Codex TOML is rewritten per section).
|
|
56
80
|
|
|
57
|
-
##
|
|
81
|
+
## Development
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
npm install
|
|
85
|
+
npm run typecheck
|
|
86
|
+
npm run build # lib/ (host unbundled, client bundled for DSH ModuleLoader)
|
|
87
|
+
npm test # full regression suite against a temp HOME
|
|
88
|
+
npm run preview # docs/preview.html — real component with fixture data
|
|
89
|
+
```
|
|
58
90
|
|
|
59
|
-
|
|
91
|
+
## Releasing
|
|
60
92
|
|
|
61
|
-
|
|
93
|
+
Publishing is fully automated:
|
|
62
94
|
|
|
63
|
-
|
|
95
|
+
```bash
|
|
96
|
+
node scripts/bump.cjs 0.2.0 # bump package.json + lockfile + changelog
|
|
97
|
+
git commit -am "chore(release): v0.2.0"
|
|
98
|
+
git push origin main
|
|
99
|
+
git tag v0.2.0 && git push origin v0.2.0
|
|
100
|
+
```
|
|
64
101
|
|
|
65
|
-
|
|
102
|
+
The `publish.yml` workflow runs the full test suite and publishes with [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers) (GitHub OIDC) — no `NPM_TOKEN`, no OTP, and provenance is signed automatically.
|
|
66
103
|
|
|
67
|
-
##
|
|
104
|
+
## Icons
|
|
68
105
|
|
|
69
|
-
|
|
106
|
+
Agent brand marks in `assets/agent-icons/` come from [@lobehub/icons](https://github.com/lobehub/lobe-icons) (MIT) and are vendored here; they are inlined into the build, so nothing is loaded from external paths at runtime.
|
|
70
107
|
|
|
71
|
-
|
|
72
|
-
- Every write snapshots the original file first (last 100 kept); one-click restore, and restoring backs up the current content too.
|
|
73
|
-
- Codex `config.toml` is rewritten per `[mcp_servers.*]` section only — comments and unrelated settings are preserved byte-for-byte.
|
|
74
|
-
- UI: floating sidebar nav, KPI cards, server card grid, light/dark themes.
|
|
108
|
+
## License
|
|
75
109
|
|
|
76
|
-
|
|
110
|
+
[Apache-2.0](LICENSE)
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="assets/icon.svg" width="88" height="88" alt="DSH MCP Connectors" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">DSH MCP Connectors</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
在 DeepSeek Harness 里统一管理本机各个 AI Agent 的 MCP 服务器。
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<b>简体中文</b> · <a href="README.md">English</a> ·
|
|
13
|
+
<a href="https://www.npmjs.com/package/dsh-mcp-connectors">npm</a>
|
|
14
|
+
</p>
|
|
15
|
+
|
|
16
|
+

|
|
17
|
+
|
|
18
|
+
## 为什么做这个
|
|
19
|
+
|
|
20
|
+
每个 AI Agent 都把自己的 MCP 配置放在不同文件、不同格式里。想知道本机到底跑着哪些 server、想单独关掉某一个工具里的某个 server,就得手改 JSON,还得记住哪个文件属于谁。
|
|
21
|
+
|
|
22
|
+
这个插件把这些文件自动找出来,集中到一个面板里,支持启停、新增、编辑、删除——**每次写文件前自动备份,随时一键回退**。
|
|
23
|
+
|
|
24
|
+
## 功能
|
|
25
|
+
|
|
26
|
+
- **自动发现**——扫描 `~`、`%APPDATA%`、`%LOCALAPPDATA%`(macOS / Linux 对应目录同样覆盖),按文件名**和**文件内容双重判据识别(`mcpServers` / `mcp` 键、`[mcp_servers]` 节区)。常规开发机首扫约 250ms,之后走缓存。
|
|
27
|
+
- **多格式**——JSON(`mcpServers`)、OpenCode 风格(`mcp`)、Codex TOML(`[mcp_servers.*]` 按节区重写,注释和其它配置逐字节保留)、以及 JSONC(注释 / 尾逗号)。
|
|
28
|
+
- **安全写入**——每次写入前把原文件快照到 `~/.dsh/mcp-connectors/backups/`(保留最近 100 份),任意版本一键恢复;恢复前也会先备份当前内容。
|
|
29
|
+
- **启停**——各家 MCP 没有统一的 `disabled` 字段,所以停用 = 条目移出配置文件、定义存进管理器状态;启用再写回。
|
|
30
|
+
- **产品归组**——配置分散在多个文件里的工具(如 WorkBuddy 用户级 + 连接器)合成一张卡片,但每台 server 仍绑定自己的文件。
|
|
31
|
+
- **拖拽排序**——顺序只存在插件状态里,配置文件一个字节都不动。
|
|
32
|
+
- **适配设置页的面板**——竖向布局、区块头吸顶、分组可折叠、状态 / Agent 筛选、回到顶部,明暗主题跟随宿主。
|
|
33
|
+
|
|
34
|
+

|
|
35
|
+
|
|
36
|
+
## 支持的配置
|
|
37
|
+
|
|
38
|
+
| Agent | 路径 | 格式 |
|
|
39
|
+
| --- | --- | --- |
|
|
40
|
+
| DSH | `~/.dsh/mcp.json` | JSON `mcpServers` |
|
|
41
|
+
| Claude Code | `~/.claude.json` | JSON `mcpServers` |
|
|
42
|
+
| Codex | `~/.codex/config.toml` | TOML `[mcp_servers.*]` |
|
|
43
|
+
| Cursor | `~/.cursor/mcp.json` | JSON `mcpServers` |
|
|
44
|
+
| Gemini | `~/.gemini/settings.json` | JSON `mcpServers` |
|
|
45
|
+
| Google Antigravity | `~/.gemini/config/mcp_config.json` | JSON `mcpServers` |
|
|
46
|
+
| Qwen Code | `~/.qwen/settings.json` | JSON `mcpServers` |
|
|
47
|
+
| Kimi Code | `~/.kimi-code/config.toml` | TOML |
|
|
48
|
+
| AtomCode | `~/.atomcode/mcp.json` | JSON `mcpServers` |
|
|
49
|
+
| OpenCode | `~/.config/opencode/opencode.json` | JSON `mcp` |
|
|
50
|
+
| Windsurf | `~/.codeium/windsurf/mcp_config.json` | JSON `mcpServers` |
|
|
51
|
+
| Trae / Trae CN | `~/.trae/mcp.json`、`~/.trae-cn/mcp.json` | JSON `mcpServers` |
|
|
52
|
+
| Qoder | `~/.qoder/mcp.json` | JSON `mcpServers` |
|
|
53
|
+
| CodeBuddy / 国内版 | `~/.codebuddy/mcp.json` | JSON `mcpServers` |
|
|
54
|
+
| WorkBuddy | `~/.workbuddy/mcp.json`、`~/.workbuddy/connectors/default/mcp.json` | JSON `mcpServers` |
|
|
55
|
+
| VS Code | `%APPDATA%/Code/User/mcp.json` | JSONC |
|
|
56
|
+
| ……其它自动发现 | — | — |
|
|
57
|
+
|
|
58
|
+
每个来源的路径都可以在面板里改,覆盖存于 `~/.dsh/mcp-connectors/state.json`。文件不存在的来源不会出现在列表里。
|
|
59
|
+
|
|
60
|
+
## 安装
|
|
61
|
+
|
|
62
|
+
```powershell
|
|
63
|
+
dsh plugin --profile web add dsh-mcp-connectors
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
或从 GitHub 安装:
|
|
67
|
+
|
|
68
|
+
```powershell
|
|
69
|
+
dsh plugin --profile web add https://github.com/elegant01/dsh-mcp-connectors
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
重启 DSH 后打开 **设置 → 连接器**。后端路由在启动时注册,升级后需要**彻底退出应用**(托盘退出)再启动。
|
|
73
|
+
|
|
74
|
+
## 安全边界
|
|
75
|
+
|
|
76
|
+
- 所有写接口要求自定义头 + `application/json` + 同源 `Origin`,宿主 `connection.fetch` 门禁照常生效;
|
|
77
|
+
- 写操作串行执行,写前必备份;
|
|
78
|
+
- 删除服务器只删目标条目,文件里的其它键原样保留(JSON 重序列化,Codex TOML 按节区重写)。
|
|
79
|
+
|
|
80
|
+
## 开发
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
npm install
|
|
84
|
+
npm run typecheck
|
|
85
|
+
npm run build # 生成 lib/(host 不打包,client 打成 DSH ModuleLoader 包)
|
|
86
|
+
npm test # 用临时 HOME 跑全量回归
|
|
87
|
+
npm run preview # docs/preview.html,真实组件 + 假数据
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## 发版
|
|
91
|
+
|
|
92
|
+
发布全自动:
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
node scripts/bump.cjs 0.2.0 # 同步 package.json + lockfile + changelog
|
|
96
|
+
git commit -am "chore(release): v0.2.0"
|
|
97
|
+
git push origin main
|
|
98
|
+
git tag v0.2.0 && git push origin v0.2.0
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
`publish.yml` 会跑完整测试并用 [npm Trusted Publishing](https://docs.npmjs.com/trusted-publishers)(GitHub OIDC)发布——**不需要 NPM_TOKEN,也不受 OTP 限制**,provenance 自动签名。
|
|
102
|
+
|
|
103
|
+
## 图标
|
|
104
|
+
|
|
105
|
+
`assets/agent-icons/` 下的各 Agent 品牌图标取自 [@lobehub/icons](https://github.com/lobehub/lobe-icons)(MIT),已随仓库拷贝并在构建时内联,运行时不依赖任何外部路径。
|
|
106
|
+
|
|
107
|
+
## 许可证
|
|
108
|
+
|
|
109
|
+
[Apache-2.0](LICENSE)
|
|
Binary file
|
|
Binary file
|
package/lib/client.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
window.__ModuleLoader__.load({ id: "dsh-mcp-connectors", factory: (require) => {
|
|
2
2
|
var module = { exports: {} };
|
|
3
3
|
var exports = module.exports;
|
|
4
|
-
"use strict";var
|
|
4
|
+
"use strict";var Ee=Object.create;var ae=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Te=Object.getOwnPropertyNames;var Re=Object.getPrototypeOf,Ae=Object.prototype.hasOwnProperty;var _e=(s,t)=>{for(var a in t)ae(s,a,{get:t[a],enumerable:!0})},he=(s,t,a,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let d of Te(t))!Ae.call(s,d)&&d!==a&&ae(s,d,{get:()=>t[d],enumerable:!(i=ze(t,d))||i.enumerable});return s};var Le=(s,t,a)=>(a=s!=null?Ee(Re(s)):{},he(t||!s||!s.__esModule?ae(a,"default",{value:s,enumerable:!0}):a,s)),Be=s=>he(ae({},"__esModule",{value:!0}),s);var Ze={};_e(Ze,{McpManagerApp:()=>ye,ZH:()=>xe,apply:()=>Je,inject:()=>Ye,name:()=>qe});module.exports=Be(Ze);var me=Le(require("react"),1);var fe=`
|
|
5
5
|
.dmm {
|
|
6
6
|
--n-50:#fafafa; --n-100:#f5f5f5; --n-200:#e5e5e5; --n-300:#d4d4d4;
|
|
7
7
|
--n-400:#a3a3a3; --n-500:#737373; --n-600:#525252; --n-700:#404040;
|
|
@@ -457,14 +457,14 @@ var exports = module.exports;
|
|
|
457
457
|
<rect width="40" height="40" rx="20" fill="white" style="fill:white;fill-opacity:1;"/>\r
|
|
458
458
|
</clipPath>\r
|
|
459
459
|
</defs>\r
|
|
460
|
-
</svg>`,factory:'<svg fill="currentColor" style="flex:none;line-height:1" viewBox="0 0 67 65" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><title>Factory Droid</title><path fill="currentColor" d="M47.75 11.15a.867.867 0 0 1-.671-.806.84.84 0 0 1 .067-.362c1.688-4.007 2.433-7.213 1.23-8.555-3.183-3.56-15.952 3.52-20.024 5.919a.9.9 0 0 1-1.273-.41c-1.711-3.998-3.51-6.78-5.334-6.9-4.833-.323-8.73 13.49-9.87 17.992a.85.85 0 0 1-.459.563.9.9 0 0 1-.737.027c-4.109-1.647-7.398-2.373-8.773-1.2-3.651 3.104 3.609 15.557 6.068 19.528a.85.85 0 0 1-.11 1.031.9.9 0 0 1-.31.21C3.455 39.856.604 41.61.478 43.389c-.329 4.713 13.834 8.513 18.452 9.625q.186.046.337.163a.87.87 0 0 1 .332.642.84.84 0 0 1-.067.362c-1.688 4.007-2.433 7.214-1.23 8.555 3.183 3.561 15.954-3.519 20.025-5.917a.9.9 0 0 1 1.058.107.9.9 0 0 1 .215.302c1.711 3.997 3.509 6.779 5.334 6.9 4.833.322 8.73-13.49 9.868-17.993a.85.85 0 0 1 .168-.33.88.88 0 0 1 .659-.324.9.9 0 0 1 .371.066c4.109 1.647 7.397 2.372 8.773 1.2 3.651-3.105-3.61-15.559-6.07-19.53a.85.85 0 0 1 .111-1.03.9.9 0 0 1 .31-.21c4.1-1.67 6.952-3.424 7.075-5.203.331-4.713-13.833-8.513-18.45-9.623m-5.546-4.518c.93 1.624-3.858 12.446-7.42 20.015a.7.7 0 0 1-.28.303.71.71 0 0 1-.796-.059.7.7 0 0 1-.23-.341c-1.439-4.921-3.082-10.704-4.841-15.612a.84.84 0 0 1 .01-.594.87.87 0 0 1 .401-.446c4.392-2.34 11.908-5.446 13.156-3.266m-21.048 1.34c1.833.507 6.294 11.46 9.264 19.268a.67.67 0 0 1-.2.754.71.71 0 0 1-.794.08c-4.589-2.485-9.94-5.444-14.743-7.702a.87.87 0 0 1-.422-.427.84.84 0 0 1-.04-.591c1.414-4.679 4.471-12.063 6.935-11.383M7.243 23.433c1.664-.906 12.762 3.763 20.522 7.235.13.058.239.154.311.274a.67.67 0 0 1-.06.776.7.7 0 0 1-.35.225c-5.045 1.403-10.976 3.006-16.01 4.721a.9.9 0 0 1-.607-.01.88.88 0 0 1-.456-.391c-2.395-4.284-5.586-11.613-3.35-12.83M8.617 43.96c.519-1.788 11.752-6.14 19.758-9.035a.72.72 0 0 1 .773.195.67.67 0 0 1 .081.774c-2.548 4.475-5.582 9.694-7.898 14.377a.87.87 0 0 1-.437.413.9.9 0 0 1-.607.039c-4.797-1.37-12.37-4.36-11.67-6.763m15.855 13.568c-.93-1.623 3.859-12.446 7.42-20.014a.7.7 0 0 1 .28-.303.715.715 0 0 1 .796.059.7.7 0 0 1 .23.34c1.439 4.92 3.083 10.705 4.841 15.613a.84.84 0 0 1-.01.593.87.87 0 0 1-.402.445c-4.391 2.335-11.908 5.447-13.15 3.267zm21.049-1.34c-1.836-.506-6.297-11.461-9.266-19.269a.67.67 0 0 1 .2-.755.71.71 0 0 1 .795-.078c4.587 2.484 9.94 5.445 14.742 7.703.189.088.339.24.423.426a.84.84 0 0 1 .039.592c-1.413 4.686-4.47 12.063-6.933 11.381m13.912-15.462c-1.665.907-12.762-3.763-20.523-7.236a.7.7 0 0 1-.311-.273.67.67 0 0 1 .06-.777.7.7 0 0 1 .35-.225c5.046-1.402 10.975-3.005 16.009-4.72a.9.9 0 0 1 .609.01.88.88 0 0 1 .457.392c2.393 4.282 5.584 11.613 3.349 12.829M58.06 20.2c-.521 1.79-11.753 6.14-19.759 9.036a.72.72 0 0 1-.774-.195.67.67 0 0 1-.08-.776c2.547-4.474 5.581-9.694 7.897-14.377a.87.87 0 0 1 .437-.412.9.9 0 0 1 .607-.038c4.797 1.377 12.37 4.359 11.672 6.762"></path></svg>',openclaw:'<svg style="flex:none;line-height:1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><title>OpenClaw</title><path d="M12 2.568c-6.33 0-9.495 5.275-9.495 9.495 0 4.22 3.165 8.44 6.33 9.494v2.11h2.11v-2.11s1.055.422 2.11 0v2.11h2.11v-2.11c3.165-1.055 6.33-5.274 6.33-9.494S18.33 2.568 12 2.568z" fill="url(#lobe-icons-open-claw-0-_R_0_)"></path><path d="M3.56 9.953C.396 8.898-.66 11.008.396 13.118c1.055 2.11 3.164 1.055 4.22-1.055.632-1.477 0-2.11-1.056-2.11z" fill="url(#lobe-icons-open-claw-1-_R_0_)"></path><path d="M20.44 9.953c3.164-1.055 4.22 1.055 3.164 3.165-1.055 2.11-3.164 1.055-4.22-1.055-.632-1.477 0-2.11 1.056-2.11z" fill="url(#lobe-icons-open-claw-2-_R_0_)"></path><path d="M5.507 1.875c.476-.285 1.036-.233 1.615.037.577.27 1.223.774 1.937 1.488a.316.316 0 01-.447.447c-.693-.693-1.279-1.138-1.757-1.361-.475-.222-.795-.205-1.022-.069a.317.317 0 01-.326-.542zM16.877 1.913c.58-.27 1.14-.323 1.616-.038a.317.317 0 01-.326.542c-.227-.136-.547-.153-1.022.069-.478.223-1.064.668-1.756 1.361a.316.316 0 11-.448-.447c.714-.714 1.36-1.218 1.936-1.487z" fill="#FF4D4D"></path><path d="M8.835 9.109a1.266 1.266 0 100-2.532 1.266 1.266 0 000 2.532zM15.165 9.109a1.266 1.266 0 100-2.532 1.266 1.266 0 000 2.532z" fill="#050810"></path><path d="M9.046 8.16a.527.527 0 100-1.056.527.527 0 000 1.055zM15.376 8.16a.527.527 0 100-1.055.527.527 0 000 1.054z" fill="#00E5CC"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-open-claw-0-_R_0_" x1="-.659" x2="27.023" y1=".458" y2="22.855"><stop stop-color="#FF4D4D"></stop><stop offset="1" stop-color="#991B1B"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-open-claw-1-_R_0_" x1="0" x2="4.311" y1="9.672" y2="14.949"><stop stop-color="#FF4D4D"></stop><stop offset="1" stop-color="#991B1B"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-open-claw-2-_R_0_" x1="19.385" x2="24.399" y1="9.953" y2="14.462"><stop stop-color="#FF4D4D"></stop><stop offset="1" stop-color="#991B1B"></stop></linearGradient></defs></svg>',roo:'<svg fill="currentColor" fill-rule="evenodd" style="flex:none;line-height:1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><title>Cline</title><path d="M17.035 3.991c2.75 0 4.98 2.24 4.98 5.003v1.667l1.45 2.896a1.01 1.01 0 01-.002.909l-1.448 2.864v1.668c0 2.762-2.23 5.002-4.98 5.002H7.074c-2.751 0-4.98-2.24-4.98-5.002V17.33l-1.48-2.855a1.01 1.01 0 01-.003-.927l1.482-2.887V8.994c0-2.763 2.23-5.003 4.98-5.003h9.962zM8.265 9.6a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 004.547 0v-4.042A2.274 2.274 0 008.265 9.6zm7.326 0a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 104.548 0v-4.042A2.274 2.274 0 0015.59 9.6z"></path><path d="M12.054 5.558a2.779 2.779 0 100-5.558 2.779 2.779 0 000 5.558z"></path></svg>',ccswitch:'<svg fill="currentColor" fill-rule="evenodd" style="flex:none;line-height:1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><title>Cline</title><path d="M17.035 3.991c2.75 0 4.98 2.24 4.98 5.003v1.667l1.45 2.896a1.01 1.01 0 01-.002.909l-1.448 2.864v1.668c0 2.762-2.23 5.002-4.98 5.002H7.074c-2.751 0-4.98-2.24-4.98-5.002V17.33l-1.48-2.855a1.01 1.01 0 01-.003-.927l1.482-2.887V8.994c0-2.763 2.23-5.003 4.98-5.003h9.962zM8.265 9.6a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 004.547 0v-4.042A2.274 2.274 0 008.265 9.6zm7.326 0a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 104.548 0v-4.042A2.274 2.274 0 0015.59 9.6z"></path><path d="M12.054 5.558a2.779 2.779 0 100-5.558 2.779 2.779 0 000 5.558z"></path></svg>',fallback:'<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><path d="M6 1.5v3M10 1.5v3M4 4.5h8v3a4 4 0 0 1-8 0v-3zM8 11.5v3"/></svg>'};var e=me.createElement,{useCallback:O,useEffect:oe,useMemo:q,useRef:ce,useState:v}=me,Le={title:"\u8FDE\u63A5\u5668",subtitle:"\u7EDF\u4E00\u7BA1\u7406\u672C\u673A\u5404 Agent \u7684 MCP \u670D\u52A1\u5668\u914D\u7F6E",brandSub:"\u8DE8 Agent \u914D\u7F6E\u4E2D\u5FC3",navAll:"\u5168\u90E8\u670D\u52A1\u5668",navBackups:"\u5907\u4EFD\u4E0E\u56DE\u9000",navSources:"AGENT \u6765\u6E90",navGeneral:"\u603B\u89C8",searchPlaceholder:"\u641C\u7D22\u670D\u52A1\u5668\u540D\u3001\u547D\u4EE4\u6216\u5730\u5740\u2026",refresh:"\u5237\u65B0",addServer:"\u6DFB\u52A0\u670D\u52A1\u5668",kpiAgents:"Agent \u6765\u6E90",kpiServers:"\u670D\u52A1\u5668\u603B\u6570",kpiEnabled:"\u5DF2\u542F\u7528",kpiBackups:"\u914D\u7F6E\u5907\u4EFD",filterStatus:"\u72B6\u6001",statusAll:"\u5168\u90E8\u72B6\u6001",statusOn:"\u8FD0\u884C\u4E2D",statusOff:"\u5DF2\u505C\u7528",collapse:"\u6536\u8D77",expand:"\u5C55\u5F00",collapseAll:"\u5168\u90E8\u6536\u8D77",expandAll:"\u5168\u90E8\u5C55\u5F00",filterAgentAll:"\u5168\u90E8 Agent",switchEnable:"\u542F\u7528",switchDisable:"\u505C\u7528",empty:"\u6CA1\u6709\u5339\u914D\u7684\u670D\u52A1\u5668\u3002",emptySource:"\u8BE5\u6765\u6E90\u8FD8\u6CA1\u6709 MCP \u670D\u52A1\u5668\u3002",loading:"\u6B63\u5728\u8BFB\u53D6\u5404 Agent \u914D\u7F6E\u2026",loadFailed:"\u8BFB\u53D6\u5931\u8D25",serversUnit:"\u53F0",detailEdit:"\u7F16\u8F91",detailDelete:"\u5220\u9664",detailJson:"JSON",enabledTag:"\u8FD0\u884C\u4E2D",disabledTag:"\u5DF2\u505C\u7528",readonlyTag:"\u53EA\u8BFB",customTag:"\u81EA\u5B9A\u4E49",autoTag:"\u81EA\u52A8\u53D1\u73B0",overriddenTag:"\u8DEF\u5F84\u5DF2\u6539",errorTag:"\u89E3\u6790\u5931\u8D25",configPath:"\u914D\u7F6E\u6587\u4EF6",addSource:"\u6DFB\u52A0\u6765\u6E90",editPath:"\u6539\u8DEF\u5F84",restore:"\u56DE\u9000\u5230\u6B64\u7248\u672C",deleteBackup:"\u5220\u9664\u5907\u4EFD",backupReason:"\u64CD\u4F5C",backupEmpty:"\u8FD8\u6CA1\u6709\u5907\u4EFD\u3002\u6BCF\u6B21\u5199\u914D\u7F6E\u524D\u4F1A\u81EA\u52A8\u7559\u5B58\u4E00\u4EFD\u3002",modalAddTitle:"\u6DFB\u52A0 MCP \u670D\u52A1\u5668",modalEditTitle:"\u7F16\u8F91 MCP \u670D\u52A1\u5668",fieldSource:"\u5199\u5165\u76EE\u6807",fieldName:"\u540D\u79F0",fieldTransport:"\u7C7B\u578B",fieldCommand:"\u542F\u52A8\u547D\u4EE4",fieldArgs:"\u53C2\u6570\uFF08\u6BCF\u884C\u4E00\u4E2A\uFF09",fieldEnv:"\u73AF\u5883\u53D8\u91CF\uFF08KEY=VALUE \u6BCF\u884C\u4E00\u4E2A\uFF09",fieldUrl:"\u670D\u52A1\u5730\u5740",fieldHeaders:"\u8BF7\u6C42\u5934\uFF08KEY=VALUE \u6BCF\u884C\u4E00\u4E2A\uFF09",fieldRaw:"\u5B8C\u6574 JSON \u5B9A\u4E49",modeForm:"\u8868\u5355",modeRaw:"JSON",cancel:"\u53D6\u6D88",save:"\u4FDD\u5B58",confirmDeleteTitle:"\u5220\u9664\u670D\u52A1\u5668\uFF1F",confirmDeleteDesc:"\u5C06\u4ECE\u914D\u7F6E\u6587\u4EF6\u4E2D\u79FB\u9664\uFF0C\u5220\u9664\u524D\u4F1A\u81EA\u52A8\u5907\u4EFD\u3002",confirmDelete:"\u5220\u9664",confirmRestoreTitle:"\u56DE\u9000\u914D\u7F6E\uFF1F",confirmRestoreDesc:"\u914D\u7F6E\u6587\u4EF6\u5C06\u6062\u590D\u5230\u6B64\u5907\u4EFD\u7684\u5185\u5BB9\u3002\u56DE\u9000\u524D\u4F1A\u5148\u5907\u4EFD\u5F53\u524D\u5185\u5BB9\u3002",confirmRestore:"\u56DE\u9000",rootPathTitle:"\u4FEE\u6539\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84",rootPathSave:"\u4FDD\u5B58",rootPathReset:"\u6062\u590D\u9ED8\u8BA4",customSourceTitle:"\u6DFB\u52A0\u81EA\u5B9A\u4E49\u6765\u6E90",customSourcePath:"\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84",customSourceLabel:"\u663E\u793A\u540D\uFF08\u53EF\u9009\uFF09",toastSaved:"\u5DF2\u4FDD\u5B58",toastDeleted:"\u5DF2\u5220\u9664",toastEnabled:"\u5DF2\u542F\u7528",toastDisabled:"\u5DF2\u505C\u7528",toastRestored:"\u5DF2\u56DE\u9000",toastFailed:"\u64CD\u4F5C\u5931\u8D25",themeToggle:"\u5207\u6362\u4E3B\u9898",openFolder:"\u6253\u5F00\u6240\u5728\u6587\u4EF6\u5939",backToTop:"\u56DE\u5230\u9876\u90E8"},Be={title:"Connectors",subtitle:"Manage MCP server configs across local AI agents",brandSub:"Cross-agent config hub",navAll:"All servers",navBackups:"Backups & rollback",navSources:"AGENT SOURCES",navGeneral:"Overview",searchPlaceholder:"Search name, command or URL\u2026",refresh:"Refresh",addServer:"Add server",kpiAgents:"Agent sources",kpiServers:"Total servers",kpiEnabled:"Enabled",kpiBackups:"Config backups",filterStatus:"Status",statusAll:"All status",statusOn:"Active",statusOff:"Disabled",collapse:"Collapse",expand:"Expand",collapseAll:"Collapse all",expandAll:"Expand all",filterAgentAll:"All agents",switchEnable:"Enable",switchDisable:"Disable",empty:"No matching servers.",emptySource:"No MCP servers in this source yet.",loading:"Reading agent configs\u2026",loadFailed:"Failed to load",serversUnit:"",detailEdit:"Edit",detailDelete:"Delete",detailJson:"JSON",enabledTag:"Active",disabledTag:"Disabled",readonlyTag:"Read-only",customTag:"Custom",autoTag:"Auto-detected",overriddenTag:"Path changed",errorTag:"Parse error",configPath:"Config file",addSource:"Add source",editPath:"Edit path",restore:"Restore this version",deleteBackup:"Delete backup",backupReason:"Action",backupEmpty:"No backups yet. One is saved automatically before every write.",modalAddTitle:"Add MCP server",modalEditTitle:"Edit MCP server",fieldSource:"Target source",fieldName:"Name",fieldTransport:"Type",fieldCommand:"Command",fieldArgs:"Args (one per line)",fieldEnv:"Env (KEY=VALUE per line)",fieldUrl:"Server URL",fieldHeaders:"Headers (KEY=VALUE per line)",fieldRaw:"Full JSON definition",modeForm:"Form",modeRaw:"JSON",cancel:"Cancel",save:"Save",confirmDeleteTitle:"Delete server?",confirmDeleteDesc:"It will be removed from the config file. A backup is saved first.",confirmDelete:"Delete",confirmRestoreTitle:"Restore config?",confirmRestoreDesc:"The config file will be restored to this backup. The current content is backed up first.",confirmRestore:"Restore",rootPathTitle:"Change config file path",rootPathSave:"Save",rootPathReset:"Reset to default",customSourceTitle:"Add custom source",customSourcePath:"Config file path",customSourceLabel:"Label (optional)",toastSaved:"Saved",toastDeleted:"Deleted",toastEnabled:"Enabled",toastDisabled:"Disabled",toastRestored:"Restored",toastFailed:"Operation failed",themeToggle:"Toggle theme",openFolder:"Open folder",backToTop:"Back to top"};function De(s){let t=null;try{s.locale&&typeof s.locale.bind=="function"&&(t=s.locale.bind("mcp-manager"))}catch{}let i=typeof navigator<"u"&&(navigator.language||"zh").toLowerCase().startsWith("zh")?Le:Be;return d=>{if(t)try{let u=t(d);if(u&&u!==d)return u}catch{}return i[d]??d}}var He="/api/dsh-mcp-connectors",de={"content-type":"application/json","x-dsh-mcp-connectors":"1"};function Oe(s){let t="/";try{t=document.baseURI||"/"}catch{}return new URL(`${He}${s}`,t).toString()}async function re(s,t){let a=await fetch(Oe(s),t),i=null;try{i=await a.json()}catch{throw new Error(`non-JSON response (HTTP ${a.status})`)}if(!i||i.ok!==!0)throw new Error(i?.error||`HTTP ${a.status}`);return i.data}var Pe=Object.keys(Y).filter(s=>s!=="fallback").map(s=>[s.replace(/[^a-z0-9]/g,""),s]);function Fe(s,t=14,a){let i=Y[s]?s:null;if(!i&&a){let u=a.toLowerCase().replace(/[^a-z0-9]/g,"");if(u.length>=4){let h=Pe.find(([y])=>u.includes(y)||y.length>=4&&y.includes(u));h&&(i=h[1])}}let d=Y[i??"fallback"]??Y.fallback;return e("span",{className:"dmm-agent-icon",style:{fontSize:t},dangerouslySetInnerHTML:{__html:d}})}function S(s,t=14){return e("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e("path",{d:s}))}var M={search:"M7 12.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM11 11l3.5 3.5",refresh:"M13.5 8a5.5 5.5 0 1 1-1.61-3.89M13.5 1.5v3h-3",plus:"M8 3v10M3 8h10",edit:"M11.3 2.7a1.4 1.4 0 0 1 2 2L5 13l-2.6.6L3 11z",trash:"M3 4h10M6.5 4V2.8a.8.8 0 0 1 .8-.8h1.4a.8.8 0 0 1 .8.8V4m2.5 0v9a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4",sun:"M8 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM8 1.5v1.2M8 13.3v1.2M14.5 8h-1.2M2.7 8H1.5M12.6 3.4l-.9.9M4.3 11.7l-.9.9M12.6 12.6l-.9-.9M4.3 4.3l-.9-.9",moon:"M13.5 9.5A5.5 5.5 0 0 1 6.5 2.5a5.5 5.5 0 1 0 7 7z",restore:"M2.5 8a5.5 5.5 0 1 0 1.61-3.89M2.5 1.5v3h3",close:"M4 4l8 8M12 4l-8 8",folder:"M2 4.5A1.5 1.5 0 0 1 3.5 3h2.6a1.5 1.5 0 0 1 1.06.44L8.3 4.6a1.5 1.5 0 0 0 1.06.44h3.14A1.5 1.5 0 0 1 14 6.55v5.95a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5z",chevron:"M4 6l4 4 4-4",fold:"M4 8h8M4 12h8M4 4h8",bolt:"M9 1.5L3.5 9H8l-1 5.5L12.5 7H8z"};function ve(){try{let s=[document.documentElement,document.body].filter(Boolean);for(let t of s){let a=(t.getAttribute("data-theme")||t.getAttribute("data-mode")||"").toLowerCase();if(a.includes("dark"))return"dark";if(a.includes("light"))return"light";let i=String(t.className||"");if(/(^|[\s_-])dark([\s_-]|$)/i.test(i))return"dark";if(/(^|[\s_-])light([\s_-]|$)/i.test(i))return"light"}if(document.body){let a=getComputedStyle(document.body).backgroundColor.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)(?:[,\s/]+([\d.]+))?/);if(a&&(a[4]===void 0||Number(a[4])>.1)){let i=.299*Number(a[1])+.587*Number(a[2])+.114*Number(a[3]);if(i<128)return"dark";if(i>200)return"light"}}}catch{}return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function Ve(){let[s,t]=v(()=>ve());return oe(()=>{let a=()=>t(ve()),i=new MutationObserver(a);i.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]}),document.body&&i.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});let d=typeof matchMedia<"u"?matchMedia("(prefers-color-scheme: dark)"):null;return d?.addEventListener?.("change",a),()=>{i.disconnect(),d?.removeEventListener?.("change",a)}},[]),s}function se(s){let{onClose:t,wide:a,children:i}=s;return oe(()=>{let d=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopImmediatePropagation(),t())};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[t]),e("div",{className:"dmm-overlay",onMouseDown:d=>{d.target===d.currentTarget&&t()}},e("div",{className:"dmm-modal",style:a?{width:680}:void 0},i))}function $e(s){let{t}=s,[a,i]=v(null),[d,u]=v(null),[h,y]=v(""),[b,T]=v("all"),[R,A]=v("all"),[P,w]=v(null),[Z,_]=v([]),[F,L]=v(null),[W,E]=v(null),[V,$]=v(()=>{try{return JSON.parse(localStorage.getItem("dmm-collapsed")||"{}")}catch{return{}}}),le=Ve(),U=ce(0),G=ce(null),X=ce(null),[ne,B]=v(!1),[z,ie]=v({right:24,bottom:24});oe(()=>{let r=G.current;if(!r)return;let o=()=>{let n=document.scrollingElement?.scrollTop??window.scrollY??0,m=null,g=r.parentElement;for(;g;){let ge=getComputedStyle(g);(ge.overflowY==="auto"||ge.overflowY==="scroll")&&g.scrollHeight>g.clientHeight+1&&g.scrollTop>n&&(n=g.scrollTop,m=g),g=g.parentElement}X.current=m,B(n>300);let f=window.innerHeight,N=window.innerWidth,H=(m??r).getBoundingClientRect(),x=Math.min(H.right,N),Ne=Math.min(H.bottom,f);ie({right:Math.max(16,N-x+16),bottom:Math.max(16,f-Ne+16)})};o(),document.addEventListener("scroll",o,!0),window.addEventListener("resize",o);let l=null;return typeof ResizeObserver<"u"&&(l=new ResizeObserver(o),l.observe(r)),()=>{document.removeEventListener("scroll",o,!0),window.removeEventListener("resize",o),l?.disconnect()}},[]);let c=O(()=>{let o=G.current?.parentElement??null;for(;o;){let l=getComputedStyle(o);(l.overflowY==="auto"||l.overflowY==="scroll")&&o.scrollTop>0&&o.scrollTo({top:0,behavior:"smooth"}),o=o.parentElement}document.scrollingElement?.scrollTo?.({top:0,behavior:"smooth"}),window.scrollTo({top:0,behavior:"smooth"})},[]),p=O((r,o)=>{let l=++U.current;_(n=>[...n,{id:l,text:r,err:o}]),setTimeout(()=>_(n=>n.filter(m=>m.id!==l)),2600)},[]),C=O(r=>{$(o=>{let l=r(o);try{localStorage.setItem("dmm-collapsed",JSON.stringify(l))}catch{}return l})},[]),k=O(async()=>{try{let r=await re("/state");i(r),u(null)}catch(r){u(String(r instanceof Error?r.message:r))}},[]);oe(()=>{k()},[k]);let Q=O(async(r,o,l)=>{let n=`${r}:${String(o.source??o.id??"")}:${String(o.name??"")}`;L(n);try{await re(r,{method:"POST",headers:de,body:JSON.stringify(o)}),p(l),w(null),await k()}catch(m){p(`${t("toastFailed")}: ${m instanceof Error?m.message:String(m)}`,!0)}finally{L(null)}},[k,t,p]),j=a?.sources??[],ee=a?.backups??[],pe=a?.warnings??[],D=q(()=>j.filter(r=>r.servers.length>0||!!r.error),[j]),xe=q(()=>{let r=new Map;for(let o of D){let l=o.group||o.key,n=r.get(l);n||(n={key:l,label:o.groupLabel||o.label,sources:[]},r.set(l,n)),n.sources.push(o)}return[...r.values()]},[j]),ue=q(()=>{let r=h.trim().toLowerCase(),o=[];for(let l of D)if(!(b!=="all"&&b!=="backups"&&(l.group||l.key)!==b))for(let n of l.servers)R==="on"&&!n.enabled||R==="off"&&n.enabled||r&&!`${n.name} ${n.summary} ${l.label}`.toLowerCase().includes(r)||o.push({source:l,server:n});return o},[D,b,h,R]),I=q(()=>{let r=0,o=0;for(let n of D)r+=n.servers.length,o+=n.servers.filter(m=>m.enabled).length;return{agents:new Set(D.map(n=>n.group||n.key)).size,servers:r,enabled:o,backups:ee.length}},[D,ee]),K=q(()=>{let r=new Map;for(let l of ue){let n=l.source.group||l.source.key,m=r.get(n);m||(m={key:n,label:l.source.groupLabel||l.source.label,sources:[],servers:[]},r.set(n,m)),m.sources.some(g=>g.key===l.source.key)||m.sources.push(l.source),m.servers.push(l)}let o=a?.order??{};for(let l of r.values()){let n=o[l.key];if(!Array.isArray(n)||!n.length)continue;let m=g=>{let f=n.indexOf(`${g.source.key}/${g.server.name}`);return f<0?Number.MAX_SAFE_INTEGER:f};l.servers.sort((g,f)=>m(g)-m(f))}return[...r.values()]},[ue,a]),te=(r,o,l)=>e("div",{className:"dmm-kpi",key:l,title:`${r}: ${o}`},e("span",{className:"dmm-kpi-label"},r),e("span",{className:"dmm-kpi-n"},o)),ye=O(async(r,o,l,n)=>{let m=o.map(f=>`${f.source.key}/${f.server.name}`);if(!m.includes(l)||!m.includes(n)||l===n)return;let g=m.filter(f=>f!==l);g.splice(g.indexOf(n),0,l);try{await re("/reorder",{method:"POST",headers:de,body:JSON.stringify({group:r,items:g})}),await k()}catch(f){p(`${t("toastFailed")}: ${f instanceof Error?f.message:String(f)}`,!0)}},[k,t,p]),we=(r,o,l)=>{let n=`:${r.key}:${o.name}`,m=`${r.key}/${o.name}`,g=F!==null&&F.endsWith(n),f=o.transport==="stdio"?"gray":o.transport==="sse"?"purple":"blue";return e("div",{className:`dmm-server${o.enabled?"":" off"}${W===m?" dragging":""}`,key:m,draggable:!0,onDragStart:N=>{E(m),N.dataTransfer.setData("text/plain",m),N.dataTransfer.effectAllowed="move"},onDragEnd:()=>E(null),onDragOver:N=>{N.preventDefault(),N.dataTransfer.dropEffect="move"},onDrop:N=>{N.preventDefault(),N.stopPropagation();let J=N.dataTransfer.getData("text/plain")||W;E(null),J&&ye(l.groupKey,l.rows,J,m)}},e("div",{className:"dmm-server-top"},e("span",{className:`dmm-tag ${f}`},e("span",{className:"dots"}),o.transport),e("span",{className:"dmm-server-name",title:o.name},o.name),e("button",{className:"dmm-switch",role:"switch","aria-checked":o.enabled,disabled:!r.writable||g,title:o.enabled?t("switchDisable"):t("switchEnable"),onClick:()=>Q(o.enabled?"/disable":"/enable",{source:r.key,name:o.name},o.enabled?t("toastDisabled"):t("toastEnabled"))})),e("div",{className:"dmm-server-cmd",title:o.summary},o.summary),e("div",{className:"dmm-server-foot"},e("span",{className:`dmm-tag ${o.enabled?"green":"gray"}`},e("span",{className:"dots"}),o.enabled?t("enabledTag"):t("disabledTag")),e("span",{style:{flex:1}}),e("button",{className:"dmm-btn dmm-btn-secondary dmm-btn-sm",onClick:()=>w({type:"json",name:o.name,spec:o.spec})},t("detailJson")),e("button",{className:"dmm-btn dmm-btn-secondary dmm-btn-sm",disabled:!r.writable,onClick:()=>w({type:"edit",source:r.key,name:o.name,spec:o.spec})},t("detailEdit")),e("button",{className:"dmm-btn dmm-btn-danger dmm-btn-sm",disabled:!r.writable,onClick:()=>w({type:"delete",source:r.key,name:o.name})},t("detailDelete"))))},Ce=r=>{let{key:o,label:l,sources:n,servers:m}=r,g=V[o]!==!1,f=n[0],N=n.some(x=>x.error),J=n.every(x=>!x.writable),H=()=>C(x=>({...x,[o]:!g}));return e("section",{className:"dmm-card",key:o},e("div",{className:"dmm-card-head",role:"button",tabIndex:0,"aria-expanded":!g,onClick:H,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),H())}},Fe(f.group?f.group:f.key,34,l),e("div",{className:"grow"},e("div",{className:"dmm-card-title"},l),e("div",{className:"dmm-card-sub",title:n.map(x=>x.path??"").join(`
|
|
461
|
-
`)},n.map(x=>x.path??"\u2014").join(" \xB7 "))),N?e("span",{className:"dmm-tag red"},e("span",{className:"dots"}),t("errorTag")):null,n.some(x=>x.overridden)?e("span",{className:"dmm-tag yellow"},t("overriddenTag")):null,J?e("span",{className:"dmm-tag gray"},t("readonlyTag")):null,f.key.startsWith("custom-")?e("span",{className:"dmm-tag cyan"},t("customTag")):null,f.discovered?e("span",{className:"dmm-tag cyan"},t("autoTag")):null,e("span",{className:"dmm-nav-count"},m.length),e("button",{className:"dmm-icon-btn",title:t("editPath"),onClick:x=>{x.stopPropagation(),w({type:"rootPath",source:f})}},S(M.folder)),e("button",{className:"dmm-icon-btn",title:t(g?"expand":"collapse"),onClick:x=>{x.stopPropagation(),H()}},e("span",{className:`dmm-chevron${g?" folded":""}`,style:{display:"inline-flex"}},S(M.chevron)))),e("div",{className:`dmm-collapse${g?" closed":""}`},e("div",{className:"dmm-collapse-inner"},m.length?e("div",{className:"dmm-server-grid"},m.map(x=>
|
|
460
|
+
</svg>`,factory:'<svg fill="currentColor" style="flex:none;line-height:1" viewBox="0 0 67 65" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><title>Factory Droid</title><path fill="currentColor" d="M47.75 11.15a.867.867 0 0 1-.671-.806.84.84 0 0 1 .067-.362c1.688-4.007 2.433-7.213 1.23-8.555-3.183-3.56-15.952 3.52-20.024 5.919a.9.9 0 0 1-1.273-.41c-1.711-3.998-3.51-6.78-5.334-6.9-4.833-.323-8.73 13.49-9.87 17.992a.85.85 0 0 1-.459.563.9.9 0 0 1-.737.027c-4.109-1.647-7.398-2.373-8.773-1.2-3.651 3.104 3.609 15.557 6.068 19.528a.85.85 0 0 1-.11 1.031.9.9 0 0 1-.31.21C3.455 39.856.604 41.61.478 43.389c-.329 4.713 13.834 8.513 18.452 9.625q.186.046.337.163a.87.87 0 0 1 .332.642.84.84 0 0 1-.067.362c-1.688 4.007-2.433 7.214-1.23 8.555 3.183 3.561 15.954-3.519 20.025-5.917a.9.9 0 0 1 1.058.107.9.9 0 0 1 .215.302c1.711 3.997 3.509 6.779 5.334 6.9 4.833.322 8.73-13.49 9.868-17.993a.85.85 0 0 1 .168-.33.88.88 0 0 1 .659-.324.9.9 0 0 1 .371.066c4.109 1.647 7.397 2.372 8.773 1.2 3.651-3.105-3.61-15.559-6.07-19.53a.85.85 0 0 1 .111-1.03.9.9 0 0 1 .31-.21c4.1-1.67 6.952-3.424 7.075-5.203.331-4.713-13.833-8.513-18.45-9.623m-5.546-4.518c.93 1.624-3.858 12.446-7.42 20.015a.7.7 0 0 1-.28.303.71.71 0 0 1-.796-.059.7.7 0 0 1-.23-.341c-1.439-4.921-3.082-10.704-4.841-15.612a.84.84 0 0 1 .01-.594.87.87 0 0 1 .401-.446c4.392-2.34 11.908-5.446 13.156-3.266m-21.048 1.34c1.833.507 6.294 11.46 9.264 19.268a.67.67 0 0 1-.2.754.71.71 0 0 1-.794.08c-4.589-2.485-9.94-5.444-14.743-7.702a.87.87 0 0 1-.422-.427.84.84 0 0 1-.04-.591c1.414-4.679 4.471-12.063 6.935-11.383M7.243 23.433c1.664-.906 12.762 3.763 20.522 7.235.13.058.239.154.311.274a.67.67 0 0 1-.06.776.7.7 0 0 1-.35.225c-5.045 1.403-10.976 3.006-16.01 4.721a.9.9 0 0 1-.607-.01.88.88 0 0 1-.456-.391c-2.395-4.284-5.586-11.613-3.35-12.83M8.617 43.96c.519-1.788 11.752-6.14 19.758-9.035a.72.72 0 0 1 .773.195.67.67 0 0 1 .081.774c-2.548 4.475-5.582 9.694-7.898 14.377a.87.87 0 0 1-.437.413.9.9 0 0 1-.607.039c-4.797-1.37-12.37-4.36-11.67-6.763m15.855 13.568c-.93-1.623 3.859-12.446 7.42-20.014a.7.7 0 0 1 .28-.303.715.715 0 0 1 .796.059.7.7 0 0 1 .23.34c1.439 4.92 3.083 10.705 4.841 15.613a.84.84 0 0 1-.01.593.87.87 0 0 1-.402.445c-4.391 2.335-11.908 5.447-13.15 3.267zm21.049-1.34c-1.836-.506-6.297-11.461-9.266-19.269a.67.67 0 0 1 .2-.755.71.71 0 0 1 .795-.078c4.587 2.484 9.94 5.445 14.742 7.703.189.088.339.24.423.426a.84.84 0 0 1 .039.592c-1.413 4.686-4.47 12.063-6.933 11.381m13.912-15.462c-1.665.907-12.762-3.763-20.523-7.236a.7.7 0 0 1-.311-.273.67.67 0 0 1 .06-.777.7.7 0 0 1 .35-.225c5.046-1.402 10.975-3.005 16.009-4.72a.9.9 0 0 1 .609.01.88.88 0 0 1 .457.392c2.393 4.282 5.584 11.613 3.349 12.829M58.06 20.2c-.521 1.79-11.753 6.14-19.759 9.036a.72.72 0 0 1-.774-.195.67.67 0 0 1-.08-.776c2.547-4.474 5.581-9.694 7.897-14.377a.87.87 0 0 1 .437-.412.9.9 0 0 1 .607-.038c4.797 1.377 12.37 4.359 11.672 6.762"></path></svg>',openclaw:'<svg style="flex:none;line-height:1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><title>OpenClaw</title><path d="M12 2.568c-6.33 0-9.495 5.275-9.495 9.495 0 4.22 3.165 8.44 6.33 9.494v2.11h2.11v-2.11s1.055.422 2.11 0v2.11h2.11v-2.11c3.165-1.055 6.33-5.274 6.33-9.494S18.33 2.568 12 2.568z" fill="url(#lobe-icons-open-claw-0-_R_0_)"></path><path d="M3.56 9.953C.396 8.898-.66 11.008.396 13.118c1.055 2.11 3.164 1.055 4.22-1.055.632-1.477 0-2.11-1.056-2.11z" fill="url(#lobe-icons-open-claw-1-_R_0_)"></path><path d="M20.44 9.953c3.164-1.055 4.22 1.055 3.164 3.165-1.055 2.11-3.164 1.055-4.22-1.055-.632-1.477 0-2.11 1.056-2.11z" fill="url(#lobe-icons-open-claw-2-_R_0_)"></path><path d="M5.507 1.875c.476-.285 1.036-.233 1.615.037.577.27 1.223.774 1.937 1.488a.316.316 0 01-.447.447c-.693-.693-1.279-1.138-1.757-1.361-.475-.222-.795-.205-1.022-.069a.317.317 0 01-.326-.542zM16.877 1.913c.58-.27 1.14-.323 1.616-.038a.317.317 0 01-.326.542c-.227-.136-.547-.153-1.022.069-.478.223-1.064.668-1.756 1.361a.316.316 0 11-.448-.447c.714-.714 1.36-1.218 1.936-1.487z" fill="#FF4D4D"></path><path d="M8.835 9.109a1.266 1.266 0 100-2.532 1.266 1.266 0 000 2.532zM15.165 9.109a1.266 1.266 0 100-2.532 1.266 1.266 0 000 2.532z" fill="#050810"></path><path d="M9.046 8.16a.527.527 0 100-1.056.527.527 0 000 1.055zM15.376 8.16a.527.527 0 100-1.055.527.527 0 000 1.054z" fill="#00E5CC"></path><defs><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-open-claw-0-_R_0_" x1="-.659" x2="27.023" y1=".458" y2="22.855"><stop stop-color="#FF4D4D"></stop><stop offset="1" stop-color="#991B1B"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-open-claw-1-_R_0_" x1="0" x2="4.311" y1="9.672" y2="14.949"><stop stop-color="#FF4D4D"></stop><stop offset="1" stop-color="#991B1B"></stop></linearGradient><linearGradient gradientUnits="userSpaceOnUse" id="lobe-icons-open-claw-2-_R_0_" x1="19.385" x2="24.399" y1="9.953" y2="14.462"><stop stop-color="#FF4D4D"></stop><stop offset="1" stop-color="#991B1B"></stop></linearGradient></defs></svg>',roo:'<svg fill="currentColor" fill-rule="evenodd" style="flex:none;line-height:1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><title>Cline</title><path d="M17.035 3.991c2.75 0 4.98 2.24 4.98 5.003v1.667l1.45 2.896a1.01 1.01 0 01-.002.909l-1.448 2.864v1.668c0 2.762-2.23 5.002-4.98 5.002H7.074c-2.751 0-4.98-2.24-4.98-5.002V17.33l-1.48-2.855a1.01 1.01 0 01-.003-.927l1.482-2.887V8.994c0-2.763 2.23-5.003 4.98-5.003h9.962zM8.265 9.6a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 004.547 0v-4.042A2.274 2.274 0 008.265 9.6zm7.326 0a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 104.548 0v-4.042A2.274 2.274 0 0015.59 9.6z"></path><path d="M12.054 5.558a2.779 2.779 0 100-5.558 2.779 2.779 0 000 5.558z"></path></svg>',ccswitch:'<svg fill="currentColor" fill-rule="evenodd" style="flex:none;line-height:1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><title>Cline</title><path d="M17.035 3.991c2.75 0 4.98 2.24 4.98 5.003v1.667l1.45 2.896a1.01 1.01 0 01-.002.909l-1.448 2.864v1.668c0 2.762-2.23 5.002-4.98 5.002H7.074c-2.751 0-4.98-2.24-4.98-5.002V17.33l-1.48-2.855a1.01 1.01 0 01-.003-.927l1.482-2.887V8.994c0-2.763 2.23-5.003 4.98-5.003h9.962zM8.265 9.6a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 004.547 0v-4.042A2.274 2.274 0 008.265 9.6zm7.326 0a2.274 2.274 0 00-2.274 2.274v4.042a2.274 2.274 0 104.548 0v-4.042A2.274 2.274 0 0015.59 9.6z"></path><path d="M12.054 5.558a2.779 2.779 0 100-5.558 2.779 2.779 0 000 5.558z"></path></svg>',fallback:'<svg viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round" width="1em" height="1em" aria-hidden="true" style="vertical-align:-0.15em"><path d="M6 1.5v3M10 1.5v3M4 4.5h8v3a4 4 0 0 1-8 0v-3zM8 11.5v3"/></svg>'};var e=me.createElement,{useCallback:O,useEffect:oe,useMemo:q,useRef:ce,useState:v}=me,xe={title:"\u8FDE\u63A5\u5668",subtitle:"\u7EDF\u4E00\u7BA1\u7406\u672C\u673A\u5404 Agent \u7684 MCP \u670D\u52A1\u5668\u914D\u7F6E",brandSub:"\u8DE8 Agent \u914D\u7F6E\u4E2D\u5FC3",navAll:"\u5168\u90E8\u670D\u52A1\u5668",navBackups:"\u5907\u4EFD\u4E0E\u56DE\u9000",navSources:"AGENT \u6765\u6E90",navGeneral:"\u603B\u89C8",searchPlaceholder:"\u641C\u7D22\u670D\u52A1\u5668\u540D\u3001\u547D\u4EE4\u6216\u5730\u5740\u2026",refresh:"\u5237\u65B0",addServer:"\u6DFB\u52A0\u670D\u52A1\u5668",kpiAgents:"Agent \u6765\u6E90",kpiServers:"\u670D\u52A1\u5668\u603B\u6570",kpiEnabled:"\u5DF2\u542F\u7528",kpiBackups:"\u914D\u7F6E\u5907\u4EFD",filterStatus:"\u72B6\u6001",statusAll:"\u5168\u90E8\u72B6\u6001",statusOn:"\u8FD0\u884C\u4E2D",statusOff:"\u5DF2\u505C\u7528",collapse:"\u6536\u8D77",expand:"\u5C55\u5F00",collapseAll:"\u5168\u90E8\u6536\u8D77",expandAll:"\u5168\u90E8\u5C55\u5F00",filterAgentAll:"\u5168\u90E8 Agent",switchEnable:"\u542F\u7528",switchDisable:"\u505C\u7528",empty:"\u6CA1\u6709\u5339\u914D\u7684\u670D\u52A1\u5668\u3002",emptySource:"\u8BE5\u6765\u6E90\u8FD8\u6CA1\u6709 MCP \u670D\u52A1\u5668\u3002",loading:"\u6B63\u5728\u8BFB\u53D6\u5404 Agent \u914D\u7F6E\u2026",loadFailed:"\u8BFB\u53D6\u5931\u8D25",serversUnit:"\u53F0",detailEdit:"\u7F16\u8F91",detailDelete:"\u5220\u9664",detailJson:"JSON",enabledTag:"\u8FD0\u884C\u4E2D",disabledTag:"\u5DF2\u505C\u7528",readonlyTag:"\u53EA\u8BFB",customTag:"\u81EA\u5B9A\u4E49",autoTag:"\u81EA\u52A8\u53D1\u73B0",overriddenTag:"\u8DEF\u5F84\u5DF2\u6539",errorTag:"\u89E3\u6790\u5931\u8D25",configPath:"\u914D\u7F6E\u6587\u4EF6",addSource:"\u6DFB\u52A0\u6765\u6E90",editPath:"\u6539\u8DEF\u5F84",restore:"\u56DE\u9000\u5230\u6B64\u7248\u672C",deleteBackup:"\u5220\u9664\u5907\u4EFD",backupReason:"\u64CD\u4F5C",backupEmpty:"\u8FD8\u6CA1\u6709\u5907\u4EFD\u3002\u6BCF\u6B21\u5199\u914D\u7F6E\u524D\u4F1A\u81EA\u52A8\u7559\u5B58\u4E00\u4EFD\u3002",modalAddTitle:"\u6DFB\u52A0 MCP \u670D\u52A1\u5668",modalEditTitle:"\u7F16\u8F91 MCP \u670D\u52A1\u5668",fieldSource:"\u5199\u5165\u76EE\u6807",fieldName:"\u540D\u79F0",fieldTransport:"\u7C7B\u578B",fieldCommand:"\u542F\u52A8\u547D\u4EE4",fieldArgs:"\u53C2\u6570\uFF08\u6BCF\u884C\u4E00\u4E2A\uFF09",fieldEnv:"\u73AF\u5883\u53D8\u91CF\uFF08KEY=VALUE \u6BCF\u884C\u4E00\u4E2A\uFF09",fieldUrl:"\u670D\u52A1\u5730\u5740",fieldHeaders:"\u8BF7\u6C42\u5934\uFF08KEY=VALUE \u6BCF\u884C\u4E00\u4E2A\uFF09",fieldRaw:"\u5B8C\u6574 JSON \u5B9A\u4E49",modeForm:"\u8868\u5355",modeRaw:"JSON",cancel:"\u53D6\u6D88",save:"\u4FDD\u5B58",confirmDeleteTitle:"\u5220\u9664\u670D\u52A1\u5668\uFF1F",confirmDeleteDesc:"\u5C06\u4ECE\u914D\u7F6E\u6587\u4EF6\u4E2D\u79FB\u9664\uFF0C\u5220\u9664\u524D\u4F1A\u81EA\u52A8\u5907\u4EFD\u3002",confirmDelete:"\u5220\u9664",confirmRestoreTitle:"\u56DE\u9000\u914D\u7F6E\uFF1F",confirmRestoreDesc:"\u914D\u7F6E\u6587\u4EF6\u5C06\u6062\u590D\u5230\u6B64\u5907\u4EFD\u7684\u5185\u5BB9\u3002\u56DE\u9000\u524D\u4F1A\u5148\u5907\u4EFD\u5F53\u524D\u5185\u5BB9\u3002",confirmRestore:"\u56DE\u9000",rootPathTitle:"\u4FEE\u6539\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84",rootPathSave:"\u4FDD\u5B58",rootPathReset:"\u6062\u590D\u9ED8\u8BA4",customSourceTitle:"\u6DFB\u52A0\u81EA\u5B9A\u4E49\u6765\u6E90",customSourcePath:"\u914D\u7F6E\u6587\u4EF6\u8DEF\u5F84",customSourceLabel:"\u663E\u793A\u540D\uFF08\u53EF\u9009\uFF09",toastSaved:"\u5DF2\u4FDD\u5B58",toastDeleted:"\u5DF2\u5220\u9664",toastEnabled:"\u5DF2\u542F\u7528",toastDisabled:"\u5DF2\u505C\u7528",toastRestored:"\u5DF2\u56DE\u9000",toastFailed:"\u64CD\u4F5C\u5931\u8D25",themeToggle:"\u5207\u6362\u4E3B\u9898",openFolder:"\u6253\u5F00\u6240\u5728\u6587\u4EF6\u5939",backToTop:"\u56DE\u5230\u9876\u90E8"},De={title:"Connectors",subtitle:"Manage MCP server configs across local AI agents",brandSub:"Cross-agent config hub",navAll:"All servers",navBackups:"Backups & rollback",navSources:"AGENT SOURCES",navGeneral:"Overview",searchPlaceholder:"Search name, command or URL\u2026",refresh:"Refresh",addServer:"Add server",kpiAgents:"Agent sources",kpiServers:"Total servers",kpiEnabled:"Enabled",kpiBackups:"Config backups",filterStatus:"Status",statusAll:"All status",statusOn:"Active",statusOff:"Disabled",collapse:"Collapse",expand:"Expand",collapseAll:"Collapse all",expandAll:"Expand all",filterAgentAll:"All agents",switchEnable:"Enable",switchDisable:"Disable",empty:"No matching servers.",emptySource:"No MCP servers in this source yet.",loading:"Reading agent configs\u2026",loadFailed:"Failed to load",serversUnit:"",detailEdit:"Edit",detailDelete:"Delete",detailJson:"JSON",enabledTag:"Active",disabledTag:"Disabled",readonlyTag:"Read-only",customTag:"Custom",autoTag:"Auto-detected",overriddenTag:"Path changed",errorTag:"Parse error",configPath:"Config file",addSource:"Add source",editPath:"Edit path",restore:"Restore this version",deleteBackup:"Delete backup",backupReason:"Action",backupEmpty:"No backups yet. One is saved automatically before every write.",modalAddTitle:"Add MCP server",modalEditTitle:"Edit MCP server",fieldSource:"Target source",fieldName:"Name",fieldTransport:"Type",fieldCommand:"Command",fieldArgs:"Args (one per line)",fieldEnv:"Env (KEY=VALUE per line)",fieldUrl:"Server URL",fieldHeaders:"Headers (KEY=VALUE per line)",fieldRaw:"Full JSON definition",modeForm:"Form",modeRaw:"JSON",cancel:"Cancel",save:"Save",confirmDeleteTitle:"Delete server?",confirmDeleteDesc:"It will be removed from the config file. A backup is saved first.",confirmDelete:"Delete",confirmRestoreTitle:"Restore config?",confirmRestoreDesc:"The config file will be restored to this backup. The current content is backed up first.",confirmRestore:"Restore",rootPathTitle:"Change config file path",rootPathSave:"Save",rootPathReset:"Reset to default",customSourceTitle:"Add custom source",customSourcePath:"Config file path",customSourceLabel:"Label (optional)",toastSaved:"Saved",toastDeleted:"Deleted",toastEnabled:"Enabled",toastDisabled:"Disabled",toastRestored:"Restored",toastFailed:"Operation failed",themeToggle:"Toggle theme",openFolder:"Open folder",backToTop:"Back to top"};function He(s){let t=null;try{s.locale&&typeof s.locale.bind=="function"&&(t=s.locale.bind("mcp-manager"))}catch{}let i=typeof navigator<"u"&&(navigator.language||"zh").toLowerCase().startsWith("zh")?xe:De;return d=>{if(t)try{let u=t(d);if(u&&u!==d)return u}catch{}return i[d]??d}}var Oe="/api/dsh-mcp-connectors",de={"content-type":"application/json","x-dsh-mcp-connectors":"1"};function Pe(s){let t="/";try{t=document.baseURI||"/"}catch{}return new URL(`${Oe}${s}`,t).toString()}async function re(s,t){let a=await fetch(Pe(s),t),i=null;try{i=await a.json()}catch{throw new Error(`non-JSON response (HTTP ${a.status})`)}if(!i||i.ok!==!0)throw new Error(i?.error||`HTTP ${a.status}`);return i.data}var Fe=Object.keys(Y).filter(s=>s!=="fallback").map(s=>[s.replace(/[^a-z0-9]/g,""),s]);function Ve(s,t=14,a){let i=Y[s]?s:null;if(!i&&a){let u=a.toLowerCase().replace(/[^a-z0-9]/g,"");if(u.length>=4){let h=Fe.find(([y])=>u.includes(y)||y.length>=4&&y.includes(u));h&&(i=h[1])}}let d=Y[i??"fallback"]??Y.fallback;return e("span",{className:"dmm-agent-icon",style:{fontSize:t},dangerouslySetInnerHTML:{__html:d}})}function S(s,t=14){return e("svg",{viewBox:"0 0 16 16",width:t,height:t,fill:"none",stroke:"currentColor",strokeWidth:1.5,strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":!0},e("path",{d:s}))}var M={search:"M7 12.5a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11zM11 11l3.5 3.5",refresh:"M13.5 8a5.5 5.5 0 1 1-1.61-3.89M13.5 1.5v3h-3",plus:"M8 3v10M3 8h10",edit:"M11.3 2.7a1.4 1.4 0 0 1 2 2L5 13l-2.6.6L3 11z",trash:"M3 4h10M6.5 4V2.8a.8.8 0 0 1 .8-.8h1.4a.8.8 0 0 1 .8.8V4m2.5 0v9a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V4",sun:"M8 11a3 3 0 1 0 0-6 3 3 0 0 0 0 6zM8 1.5v1.2M8 13.3v1.2M14.5 8h-1.2M2.7 8H1.5M12.6 3.4l-.9.9M4.3 11.7l-.9.9M12.6 12.6l-.9-.9M4.3 4.3l-.9-.9",moon:"M13.5 9.5A5.5 5.5 0 0 1 6.5 2.5a5.5 5.5 0 1 0 7 7z",restore:"M2.5 8a5.5 5.5 0 1 0 1.61-3.89M2.5 1.5v3h3",close:"M4 4l8 8M12 4l-8 8",folder:"M2 4.5A1.5 1.5 0 0 1 3.5 3h2.6a1.5 1.5 0 0 1 1.06.44L8.3 4.6a1.5 1.5 0 0 0 1.06.44h3.14A1.5 1.5 0 0 1 14 6.55v5.95a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 12.5z",chevron:"M4 6l4 4 4-4",fold:"M4 8h8M4 12h8M4 4h8",bolt:"M9 1.5L3.5 9H8l-1 5.5L12.5 7H8z"};function ve(){try{let s=[document.documentElement,document.body].filter(Boolean);for(let t of s){let a=(t.getAttribute("data-theme")||t.getAttribute("data-mode")||"").toLowerCase();if(a.includes("dark"))return"dark";if(a.includes("light"))return"light";let i=String(t.className||"");if(/(^|[\s_-])dark([\s_-]|$)/i.test(i))return"dark";if(/(^|[\s_-])light([\s_-]|$)/i.test(i))return"light"}if(document.body){let a=getComputedStyle(document.body).backgroundColor.match(/rgba?\(\s*(\d+)[,\s]+(\d+)[,\s]+(\d+)(?:[,\s/]+([\d.]+))?/);if(a&&(a[4]===void 0||Number(a[4])>.1)){let i=.299*Number(a[1])+.587*Number(a[2])+.114*Number(a[3]);if(i<128)return"dark";if(i>200)return"light"}}}catch{}return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function $e(){let[s,t]=v(()=>ve());return oe(()=>{let a=()=>t(ve()),i=new MutationObserver(a);i.observe(document.documentElement,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]}),document.body&&i.observe(document.body,{attributes:!0,attributeFilter:["class","data-theme","data-mode","style"]});let d=typeof matchMedia<"u"?matchMedia("(prefers-color-scheme: dark)"):null;return d?.addEventListener?.("change",a),()=>{i.disconnect(),d?.removeEventListener?.("change",a)}},[]),s}function se(s){let{onClose:t,wide:a,children:i}=s;return oe(()=>{let d=u=>{u.key==="Escape"&&(u.preventDefault(),u.stopImmediatePropagation(),t())};return window.addEventListener("keydown",d,!0),()=>window.removeEventListener("keydown",d,!0)},[t]),e("div",{className:"dmm-overlay",onMouseDown:d=>{d.target===d.currentTarget&&t()}},e("div",{className:"dmm-modal",style:a?{width:680}:void 0},i))}function ye(s){let{t}=s,[a,i]=v(null),[d,u]=v(null),[h,y]=v(""),[b,T]=v("all"),[R,A]=v("all"),[P,w]=v(null),[Z,_]=v([]),[F,L]=v(null),[W,E]=v(null),[V,$]=v(()=>{try{return JSON.parse(localStorage.getItem("dmm-collapsed")||"{}")}catch{return{}}}),le=$e(),U=ce(0),G=ce(null),X=ce(null),[ne,B]=v(!1),[z,ie]=v({right:24,bottom:24});oe(()=>{let r=G.current;if(!r)return;let o=()=>{let n=document.scrollingElement?.scrollTop??window.scrollY??0,m=null,g=r.parentElement;for(;g;){let ge=getComputedStyle(g);(ge.overflowY==="auto"||ge.overflowY==="scroll")&&g.scrollHeight>g.clientHeight+1&&g.scrollTop>n&&(n=g.scrollTop,m=g),g=g.parentElement}X.current=m,B(n>300);let f=window.innerHeight,N=window.innerWidth,H=(m??r).getBoundingClientRect(),x=Math.min(H.right,N),Me=Math.min(H.bottom,f);ie({right:Math.max(16,N-x+16),bottom:Math.max(16,f-Me+16)})};o(),document.addEventListener("scroll",o,!0),window.addEventListener("resize",o);let l=null;return typeof ResizeObserver<"u"&&(l=new ResizeObserver(o),l.observe(r)),()=>{document.removeEventListener("scroll",o,!0),window.removeEventListener("resize",o),l?.disconnect()}},[]);let c=O(()=>{let o=G.current?.parentElement??null;for(;o;){let l=getComputedStyle(o);(l.overflowY==="auto"||l.overflowY==="scroll")&&o.scrollTop>0&&o.scrollTo({top:0,behavior:"smooth"}),o=o.parentElement}document.scrollingElement?.scrollTo?.({top:0,behavior:"smooth"}),window.scrollTo({top:0,behavior:"smooth"})},[]),p=O((r,o)=>{let l=++U.current;_(n=>[...n,{id:l,text:r,err:o}]),setTimeout(()=>_(n=>n.filter(m=>m.id!==l)),2600)},[]),C=O(r=>{$(o=>{let l=r(o);try{localStorage.setItem("dmm-collapsed",JSON.stringify(l))}catch{}return l})},[]),k=O(async()=>{try{let r=await re("/state");i(r),u(null)}catch(r){u(String(r instanceof Error?r.message:r))}},[]);oe(()=>{k()},[k]);let Q=O(async(r,o,l)=>{let n=`${r}:${String(o.source??o.id??"")}:${String(o.name??"")}`;L(n);try{await re(r,{method:"POST",headers:de,body:JSON.stringify(o)}),p(l),w(null),await k()}catch(m){p(`${t("toastFailed")}: ${m instanceof Error?m.message:String(m)}`,!0)}finally{L(null)}},[k,t,p]),j=a?.sources??[],ee=a?.backups??[],pe=a?.warnings??[],D=q(()=>j.filter(r=>r.servers.length>0||!!r.error),[j]),we=q(()=>{let r=new Map;for(let o of D){let l=o.group||o.key,n=r.get(l);n||(n={key:l,label:o.groupLabel||o.label,sources:[]},r.set(l,n)),n.sources.push(o)}return[...r.values()]},[j]),ue=q(()=>{let r=h.trim().toLowerCase(),o=[];for(let l of D)if(!(b!=="all"&&b!=="backups"&&(l.group||l.key)!==b))for(let n of l.servers)R==="on"&&!n.enabled||R==="off"&&n.enabled||r&&!`${n.name} ${n.summary} ${l.label}`.toLowerCase().includes(r)||o.push({source:l,server:n});return o},[D,b,h,R]),I=q(()=>{let r=0,o=0;for(let n of D)r+=n.servers.length,o+=n.servers.filter(m=>m.enabled).length;return{agents:new Set(D.map(n=>n.group||n.key)).size,servers:r,enabled:o,backups:ee.length}},[D,ee]),K=q(()=>{let r=new Map;for(let l of ue){let n=l.source.group||l.source.key,m=r.get(n);m||(m={key:n,label:l.source.groupLabel||l.source.label,sources:[],servers:[]},r.set(n,m)),m.sources.some(g=>g.key===l.source.key)||m.sources.push(l.source),m.servers.push(l)}let o=a?.order??{};for(let l of r.values()){let n=o[l.key];if(!Array.isArray(n)||!n.length)continue;let m=g=>{let f=n.indexOf(`${g.source.key}/${g.server.name}`);return f<0?Number.MAX_SAFE_INTEGER:f};l.servers.sort((g,f)=>m(g)-m(f))}return[...r.values()]},[ue,a]),te=(r,o,l)=>e("div",{className:"dmm-kpi",key:l,title:`${r}: ${o}`},e("span",{className:"dmm-kpi-label"},r),e("span",{className:"dmm-kpi-n"},o)),Ce=O(async(r,o,l,n)=>{let m=o.map(f=>`${f.source.key}/${f.server.name}`);if(!m.includes(l)||!m.includes(n)||l===n)return;let g=m.filter(f=>f!==l);g.splice(g.indexOf(n),0,l);try{await re("/reorder",{method:"POST",headers:de,body:JSON.stringify({group:r,items:g})}),await k()}catch(f){p(`${t("toastFailed")}: ${f instanceof Error?f.message:String(f)}`,!0)}},[k,t,p]),ke=(r,o,l)=>{let n=`:${r.key}:${o.name}`,m=`${r.key}/${o.name}`,g=F!==null&&F.endsWith(n),f=o.transport==="stdio"?"gray":o.transport==="sse"?"purple":"blue";return e("div",{className:`dmm-server${o.enabled?"":" off"}${W===m?" dragging":""}`,key:m,draggable:!0,onDragStart:N=>{E(m),N.dataTransfer.setData("text/plain",m),N.dataTransfer.effectAllowed="move"},onDragEnd:()=>E(null),onDragOver:N=>{N.preventDefault(),N.dataTransfer.dropEffect="move"},onDrop:N=>{N.preventDefault(),N.stopPropagation();let J=N.dataTransfer.getData("text/plain")||W;E(null),J&&Ce(l.groupKey,l.rows,J,m)}},e("div",{className:"dmm-server-top"},e("span",{className:`dmm-tag ${f}`},e("span",{className:"dots"}),o.transport),e("span",{className:"dmm-server-name",title:o.name},o.name),e("button",{className:"dmm-switch",role:"switch","aria-checked":o.enabled,disabled:!r.writable||g,title:o.enabled?t("switchDisable"):t("switchEnable"),onClick:()=>Q(o.enabled?"/disable":"/enable",{source:r.key,name:o.name},o.enabled?t("toastDisabled"):t("toastEnabled"))})),e("div",{className:"dmm-server-cmd",title:o.summary},o.summary),e("div",{className:"dmm-server-foot"},e("span",{className:`dmm-tag ${o.enabled?"green":"gray"}`},e("span",{className:"dots"}),o.enabled?t("enabledTag"):t("disabledTag")),e("span",{style:{flex:1}}),e("button",{className:"dmm-btn dmm-btn-secondary dmm-btn-sm",onClick:()=>w({type:"json",name:o.name,spec:o.spec})},t("detailJson")),e("button",{className:"dmm-btn dmm-btn-secondary dmm-btn-sm",disabled:!r.writable,onClick:()=>w({type:"edit",source:r.key,name:o.name,spec:o.spec})},t("detailEdit")),e("button",{className:"dmm-btn dmm-btn-danger dmm-btn-sm",disabled:!r.writable,onClick:()=>w({type:"delete",source:r.key,name:o.name})},t("detailDelete"))))},Ne=r=>{let{key:o,label:l,sources:n,servers:m}=r,g=V[o]!==!1,f=n[0],N=n.some(x=>x.error),J=n.every(x=>!x.writable),H=()=>C(x=>({...x,[o]:!g}));return e("section",{className:"dmm-card",key:o},e("div",{className:"dmm-card-head",role:"button",tabIndex:0,"aria-expanded":!g,onClick:H,onKeyDown:x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),H())}},Ve(f.group?f.group:f.key,34,l),e("div",{className:"grow"},e("div",{className:"dmm-card-title"},l),e("div",{className:"dmm-card-sub",title:n.map(x=>x.path??"").join(`
|
|
461
|
+
`)},n.map(x=>x.path??"\u2014").join(" \xB7 "))),N?e("span",{className:"dmm-tag red"},e("span",{className:"dots"}),t("errorTag")):null,n.some(x=>x.overridden)?e("span",{className:"dmm-tag yellow"},t("overriddenTag")):null,J?e("span",{className:"dmm-tag gray"},t("readonlyTag")):null,f.key.startsWith("custom-")?e("span",{className:"dmm-tag cyan"},t("customTag")):null,f.discovered?e("span",{className:"dmm-tag cyan"},t("autoTag")):null,e("span",{className:"dmm-nav-count"},m.length),e("button",{className:"dmm-icon-btn",title:t("editPath"),onClick:x=>{x.stopPropagation(),w({type:"rootPath",source:f})}},S(M.folder)),e("button",{className:"dmm-icon-btn",title:t(g?"expand":"collapse"),onClick:x=>{x.stopPropagation(),H()}},e("span",{className:`dmm-chevron${g?" folded":""}`,style:{display:"inline-flex"}},S(M.chevron)))),e("div",{className:`dmm-collapse${g?" closed":""}`},e("div",{className:"dmm-collapse-inner"},m.length?e("div",{className:"dmm-server-grid"},m.map(x=>ke(x.source,x.server,{groupKey:o,rows:m}))):e("div",{className:"dmm-empty"},f.error??t("emptySource")))))},Se=r=>e("div",{className:"dmm-backup-row",key:r.id},e("span",{className:"dmm-tag blue"},r.sourceLabel),e("div",{className:"grow"},e("div",null,`${new Date(r.createdAt).toLocaleString()} \xB7 ${r.reason}`),e("div",{className:"dmm-backup-path",title:r.targetPath},r.targetPath)),e("span",{className:"dmm-tag gray"},`${(r.size/1024).toFixed(1)} KB`),e("button",{className:"dmm-btn dmm-btn-secondary dmm-btn-sm",onClick:()=>w({type:"restore",backup:r})},t("restore")),e("button",{className:"dmm-btn dmm-btn-danger dmm-btn-sm",onClick:()=>w({type:"deleteBackup",backup:r})},t("deleteBackup")));return e("div",{className:"dmm","data-theme":le,ref:G},e("style",null,fe),e("div",{className:"dmm-app"},e("div",{className:"dmm-topbar"},e("div",{className:"dmm-search"},S(M.search),e("input",{value:h,placeholder:t("searchPlaceholder"),onChange:r=>y(r.target.value)})),e("select",{className:"dmm-select dmm-filter-select",value:R,title:t("filterStatus"),onChange:r=>A(r.target.value)},e("option",{value:"all"},t("statusAll")),e("option",{value:"on"},t("statusOn")),e("option",{value:"off"},t("statusOff"))),e("select",{className:"dmm-select dmm-filter-select",value:b,onChange:r=>T(r.target.value)},e("option",{value:"all"},t("filterAgentAll")),we.map(r=>e("option",{key:r.key,value:r.key},`${r.label} (${r.sources.reduce((o,l)=>o+l.servers.length,0)})`)),e("option",{value:"backups"},`${t("navBackups")} (${I.backups})`)),e("button",{className:"dmm-icon-btn",title:t("addSource"),onClick:()=>w({type:"customSource"})},S(M.plus)),e("div",{className:"grow"}),e("button",{className:"dmm-icon-btn",title:t("refresh"),onClick:()=>k()},S(M.refresh)),e("button",{className:"dmm-btn dmm-btn-primary",onClick:()=>w({type:"edit",source:b!=="all"&&b!=="backups"?b:j[0]?.key??""})},S(M.plus),t("addServer"))),e("div",{className:"dmm-page-head"},e("div",{className:"grow"},e("div",{className:"dmm-page-title"},t("title")),e("div",{className:"dmm-page-sub"},t("subtitle"))),e("button",{className:"dmm-btn dmm-btn-secondary dmm-btn-sm",onClick:()=>{let r=K.every(o=>V[o.key]!==!1);C(o=>{let l={...o};for(let n of K)l[n.key]=!r;return l})}},S(M.fold,12),K.every(r=>V[r.key]!==!1)?t("expandAll"):t("collapseAll"))),pe.length?e("div",{className:"dmm-warn"},pe.map((r,o)=>e("div",{key:o},r.error))):null,e("div",{className:"dmm-kpi-grid"},te(t("kpiAgents"),I.agents,"a"),te(t("kpiServers"),I.servers,"s"),te(t("kpiEnabled"),I.enabled,"e"),te(t("kpiBackups"),I.backups,"b")),d?e("div",{className:"dmm-card"},e("div",{className:"dmm-empty"},`${t("loadFailed")}: ${d}`)):a?b==="backups"?e("section",{className:"dmm-card"},e("div",{className:"dmm-card-head"},e("div",{className:"dmm-card-title"},t("navBackups"))),ee.length?e("div",{className:"dmm-backup-list"},ee.map(Se)):e("div",{className:"dmm-empty"},t("backupEmpty"))):K.length?K.map(Ne):e("div",{className:"dmm-card"},e("div",{className:"dmm-empty"},t("empty"))):e("div",{className:"dmm-card"},e("div",{className:"dmm-loading"},t("loading")))),Z.length?e("div",{className:"dmm-toast-wrap"},Z.map(r=>e("div",{key:r.id,className:`dmm-toast${r.err?" err":""}`},r.text))):null,e("button",{className:`dmm-totop${ne?" show":""}`,title:t("backToTop"),onClick:c,style:{right:z.right,bottom:z.bottom}},e("span",{style:{display:"inline-flex",transform:"rotate(180deg)"}},S(M.chevron,16))),P?Ue(P,{t,sources:j,busy:F,setModal:w,mutate:Q,toast:p}):null)}function Ue(s,t){let{t:a,setModal:i,mutate:d}=t,u=()=>i(null),h=(b,T=!1)=>e(se,{onClose:u,wide:T},b),y=b=>e("div",{className:"dmm-modal-head"},e("div",{className:"dmm-modal-title"},b),e("button",{className:"dmm-close",onClick:u},S(M.close)));switch(s.type){case"json":return h([y(`${s.name} \xB7 JSON`),e("div",{className:"dmm-modal-body",key:"b"},e("textarea",{className:"dmm-textarea",readOnly:!0,style:{minHeight:260},value:JSON.stringify(s.spec,null,2)})),e("div",{className:"dmm-modal-foot",key:"f"},e("button",{className:"dmm-btn dmm-btn-secondary",onClick:u},a("cancel")))],!0);case"delete":return h([y(a("confirmDeleteTitle")),e("div",{className:"dmm-modal-body",key:"b"},e("div",null,`${s.name} \u2014 ${a("confirmDeleteDesc")}`)),e("div",{className:"dmm-modal-foot",key:"f"},e("button",{className:"dmm-btn dmm-btn-secondary",onClick:u},a("cancel")),e("button",{className:"dmm-btn dmm-btn-danger",onClick:()=>d("/delete",{source:s.source,name:s.name},a("toastDeleted"))},a("confirmDelete")))]);case"restore":return h([y(a("confirmRestoreTitle")),e("div",{className:"dmm-modal-body",key:"b"},e("div",null,`${s.backup.sourceLabel} \xB7 ${new Date(s.backup.createdAt).toLocaleString()}`),e("div",{className:"dmm-backup-path"},s.backup.targetPath),e("div",null,a("confirmRestoreDesc"))),e("div",{className:"dmm-modal-foot",key:"f"},e("button",{className:"dmm-btn dmm-btn-secondary",onClick:u},a("cancel")),e("button",{className:"dmm-btn dmm-btn-primary",onClick:()=>d("/backup-restore",{id:s.backup.id},a("toastRestored"))},a("confirmRestore")))]);case"deleteBackup":return h([y(a("deleteBackup")),e("div",{className:"dmm-modal-body",key:"b"},e("div",null,`${s.backup.sourceLabel} \xB7 ${new Date(s.backup.createdAt).toLocaleString()}`),e("div",{className:"dmm-backup-path"},s.backup.file)),e("div",{className:"dmm-modal-foot",key:"f"},e("button",{className:"dmm-btn dmm-btn-secondary",onClick:u},a("cancel")),e("button",{className:"dmm-btn dmm-btn-danger",onClick:()=>d("/backup-delete",{id:s.backup.id},a("toastDeleted"))},a("confirmDelete")))]);case"rootPath":return e(je,{modal:s,t:a,close:u,mutate:d,toast:t.toast});case"customSource":return e(Ie,{t:a,close:u,mutate:d});case"edit":return e(Ge,{modal:s,t:a,sources:t.sources,close:u,mutate:d})}}function Ge(s){let{modal:t,t:a,sources:i,close:d,mutate:u}=s,h=t.spec??{},[y,b]=v(t.source),[T,R]=v(t.name??""),[A,P]=v("form"),[w,Z]=v(h.url?/sse/i.test(h.url)?"sse":"http":"stdio"),[_,F]=v(h.command??""),[L,W]=v((h.args??[]).join(`
|
|
462
462
|
`)),[E,V]=v(Object.entries(h.env??{}).map(([c,p])=>`${c}=${p}`).join(`
|
|
463
463
|
`)),[$,le]=v(h.url??""),[U,G]=v(Object.entries(h.headers??{}).map(([c,p])=>`${c}=${p}`).join(`
|
|
464
464
|
`)),[X,ne]=v(()=>JSON.stringify(h,null,2)),B=t.name!==void 0,z=c=>{let p={};for(let C of c.split(`
|
|
465
465
|
`)){let k=C.indexOf("=");k>0&&(p[C.slice(0,k).trim()]=C.slice(k+1).trim())}return p},ie=()=>{let c={source:y,name:T.trim()};if(A==="raw")c.raw=X;else if(B){let p={...t.spec??{}};if(delete p.command,delete p.args,delete p.env,delete p.url,delete p.headers,delete p.serverUrl,w==="stdio"){p.command=_;let C=L.split(`
|
|
466
466
|
`).map(Q=>Q.trim()).filter(Boolean);C.length&&(p.args=C);let k=z(E);Object.keys(k).length&&(p.env=k)}else{p.url=$;let C=z(U);Object.keys(C).length&&(p.headers=C)}c.raw=JSON.stringify(p)}else if(w==="stdio"){c.transport="stdio",c.command=_,c.args=L.split(`
|
|
467
467
|
`).map(C=>C.trim()).filter(Boolean);let p=z(E);Object.keys(p).length&&(c.env=p)}else{c.transport=w,c.url=$;let p=z(U);Object.keys(p).length&&(c.headers=p)}u("/upsert",c,a("toastSaved"))};return e(se,{onClose:d},e("div",{className:"dmm-modal-head"},e("div",{className:"dmm-modal-title"},a(B?"modalEditTitle":"modalAddTitle")),e("div",{className:"dmm-segmented"},e("button",{"aria-selected":A==="form",onClick:()=>P("form")},a("modeForm")),e("button",{"aria-selected":A==="raw",onClick:()=>P("raw")},a("modeRaw"))),e("button",{className:"dmm-close",onClick:d},S(M.close))),e("div",{className:"dmm-modal-body"},e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},a("fieldSource")),e("select",{className:"dmm-select",value:y,disabled:B,onChange:c=>b(c.target.value)},i.filter(c=>c.writable).map(c=>e("option",{key:c.key,value:c.key},c.label)))),e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},a("fieldName")),e("input",{className:"dmm-input",value:T,disabled:B,placeholder:"my-mcp-server",onChange:c=>R(c.target.value)})),A==="form"?[e("div",{className:"dmm-field",key:"tr"},e("label",{className:"dmm-field-label"},a("fieldTransport")),e("div",{className:"dmm-segmented"},["stdio","http","sse"].map(c=>e("button",{key:c,"aria-selected":w===c,onClick:()=>Z(c)},c)))),w==="stdio"?[e("div",{className:"dmm-field",key:"cmd"},e("label",{className:"dmm-field-label"},a("fieldCommand")),e("input",{className:"dmm-input",value:_,placeholder:"npx",onChange:c=>F(c.target.value)})),e("div",{className:"dmm-field",key:"args"},e("label",{className:"dmm-field-label"},a("fieldArgs")),e("textarea",{className:"dmm-textarea",style:{minHeight:72},value:L,placeholder:`-y
|
|
468
|
-
@modelcontextprotocol/server-filesystem`,onChange:c=>W(c.target.value)})),e("div",{className:"dmm-field",key:"env"},e("label",{className:"dmm-field-label"},a("fieldEnv")),e("textarea",{className:"dmm-textarea",style:{minHeight:72},value:E,onChange:c=>V(c.target.value)}))]:[e("div",{className:"dmm-field",key:"url"},e("label",{className:"dmm-field-label"},a("fieldUrl")),e("input",{className:"dmm-input",value:$,placeholder:"https://example.com/mcp",onChange:c=>le(c.target.value)})),e("div",{className:"dmm-field",key:"hd"},e("label",{className:"dmm-field-label"},a("fieldHeaders")),e("textarea",{className:"dmm-textarea",style:{minHeight:72},value:U,placeholder:"Authorization=Bearer \u2026",onChange:c=>G(c.target.value)}))]]:e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},a("fieldRaw")),e("textarea",{className:"dmm-textarea",style:{minHeight:240},value:X,onChange:c=>ne(c.target.value)}))),e("div",{className:"dmm-modal-foot"},e("button",{className:"dmm-btn dmm-btn-secondary",onClick:d},a("cancel")),e("button",{className:"dmm-btn dmm-btn-primary",onClick:ie},a("save"))))}function je(s){let{modal:t,t:a,close:i,mutate:d,toast:u}=s,[h,y]=v(t.source.path??"");return e(se,{onClose:i},e("div",{className:"dmm-modal-head"},e("div",{className:"dmm-modal-title"},`${a("rootPathTitle")} \xB7 ${t.source.label}`),e("button",{className:"dmm-close",onClick:i},S(M.close))),e("div",{className:"dmm-modal-body"},e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},a("configPath")),e("input",{className:"dmm-input",value:h,onChange:b=>y(b.target.value)}),e("div",{className:"dmm-field-hint"},t.source.path??""))),e("div",{className:"dmm-modal-foot"},e("button",{className:"dmm-btn dmm-btn-secondary",style:{marginRight:"auto"},onClick:()=>re("/open-folder",{method:"POST",headers:de,body:JSON.stringify({source:t.source.key})}).catch(b=>u(`${a("toastFailed")}: ${b instanceof Error?b.message:String(b)}`,!0))},S(M.folder,13),a("openFolder")),t.source.overridden?e("button",{className:"dmm-btn dmm-btn-secondary",onClick:()=>d("/root-path",{key:t.source.key,path:null},a("toastSaved"))},a("rootPathReset")):null,e("button",{className:"dmm-btn dmm-btn-secondary",onClick:i},a("cancel")),e("button",{className:"dmm-btn dmm-btn-primary",onClick:()=>d("/root-path",{key:t.source.key,path:h},a("toastSaved"))},a("rootPathSave"))))}function Ie(s){let{t,close:a,mutate:i}=s,[d,u]=v(""),[h,y]=v("");return e(se,{onClose:a},e("div",{className:"dmm-modal-head"},e("div",{className:"dmm-modal-title"},t("customSourceTitle")),e("button",{className:"dmm-close",onClick:a},S(M.close))),e("div",{className:"dmm-modal-body"},e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},t("customSourcePath")),e("input",{className:"dmm-input",value:d,placeholder:"C:\\Users\\you\\tool\\mcp.json",onChange:b=>u(b.target.value)})),e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},t("customSourceLabel")),e("input",{className:"dmm-input",value:h,onChange:b=>y(b.target.value)}))),e("div",{className:"dmm-modal-foot"},e("button",{className:"dmm-btn dmm-btn-secondary",onClick:a},t("cancel")),e("button",{className:"dmm-btn dmm-btn-primary",onClick:()=>i("/custom-source-add",{path:d,label:h},t("toastSaved"))},t("save"))))}var be="mcp-manager";function Ke(s){let t=s?.size??16;return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"8 14 72 72",width:t,height:t,"aria-hidden":!0},e("path",{d:"M50 22 A 24 24 0 1 0 50 78",stroke:"currentColor",strokeWidth:8,fill:"none",strokeLinecap:"round"}),e("path",{d:"M50 34 A 16 16 0 1 1 50 66",stroke:"currentColor",strokeWidth:8,fill:"none",strokeLinecap:"round"}))}function Je(s){let t=
|
|
468
|
+
@modelcontextprotocol/server-filesystem`,onChange:c=>W(c.target.value)})),e("div",{className:"dmm-field",key:"env"},e("label",{className:"dmm-field-label"},a("fieldEnv")),e("textarea",{className:"dmm-textarea",style:{minHeight:72},value:E,onChange:c=>V(c.target.value)}))]:[e("div",{className:"dmm-field",key:"url"},e("label",{className:"dmm-field-label"},a("fieldUrl")),e("input",{className:"dmm-input",value:$,placeholder:"https://example.com/mcp",onChange:c=>le(c.target.value)})),e("div",{className:"dmm-field",key:"hd"},e("label",{className:"dmm-field-label"},a("fieldHeaders")),e("textarea",{className:"dmm-textarea",style:{minHeight:72},value:U,placeholder:"Authorization=Bearer \u2026",onChange:c=>G(c.target.value)}))]]:e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},a("fieldRaw")),e("textarea",{className:"dmm-textarea",style:{minHeight:240},value:X,onChange:c=>ne(c.target.value)}))),e("div",{className:"dmm-modal-foot"},e("button",{className:"dmm-btn dmm-btn-secondary",onClick:d},a("cancel")),e("button",{className:"dmm-btn dmm-btn-primary",onClick:ie},a("save"))))}function je(s){let{modal:t,t:a,close:i,mutate:d,toast:u}=s,[h,y]=v(t.source.path??"");return e(se,{onClose:i},e("div",{className:"dmm-modal-head"},e("div",{className:"dmm-modal-title"},`${a("rootPathTitle")} \xB7 ${t.source.label}`),e("button",{className:"dmm-close",onClick:i},S(M.close))),e("div",{className:"dmm-modal-body"},e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},a("configPath")),e("input",{className:"dmm-input",value:h,onChange:b=>y(b.target.value)}),e("div",{className:"dmm-field-hint"},t.source.path??""))),e("div",{className:"dmm-modal-foot"},e("button",{className:"dmm-btn dmm-btn-secondary",style:{marginRight:"auto"},onClick:()=>re("/open-folder",{method:"POST",headers:de,body:JSON.stringify({source:t.source.key})}).catch(b=>u(`${a("toastFailed")}: ${b instanceof Error?b.message:String(b)}`,!0))},S(M.folder,13),a("openFolder")),t.source.overridden?e("button",{className:"dmm-btn dmm-btn-secondary",onClick:()=>d("/root-path",{key:t.source.key,path:null},a("toastSaved"))},a("rootPathReset")):null,e("button",{className:"dmm-btn dmm-btn-secondary",onClick:i},a("cancel")),e("button",{className:"dmm-btn dmm-btn-primary",onClick:()=>d("/root-path",{key:t.source.key,path:h},a("toastSaved"))},a("rootPathSave"))))}function Ie(s){let{t,close:a,mutate:i}=s,[d,u]=v(""),[h,y]=v("");return e(se,{onClose:a},e("div",{className:"dmm-modal-head"},e("div",{className:"dmm-modal-title"},t("customSourceTitle")),e("button",{className:"dmm-close",onClick:a},S(M.close))),e("div",{className:"dmm-modal-body"},e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},t("customSourcePath")),e("input",{className:"dmm-input",value:d,placeholder:"C:\\Users\\you\\tool\\mcp.json",onChange:b=>u(b.target.value)})),e("div",{className:"dmm-field"},e("label",{className:"dmm-field-label"},t("customSourceLabel")),e("input",{className:"dmm-input",value:h,onChange:b=>y(b.target.value)}))),e("div",{className:"dmm-modal-foot"},e("button",{className:"dmm-btn dmm-btn-secondary",onClick:a},t("cancel")),e("button",{className:"dmm-btn dmm-btn-primary",onClick:()=>i("/custom-source-add",{path:d,label:h},t("toastSaved"))},t("save"))))}var be="mcp-manager";function Ke(s){let t=s?.size??16;return e("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"8 14 72 72",width:t,height:t,"aria-hidden":!0},e("path",{d:"M50 22 A 24 24 0 1 0 50 78",stroke:"currentColor",strokeWidth:8,fill:"none",strokeLinecap:"round"}),e("path",{d:"M50 34 A 16 16 0 1 1 50 66",stroke:"currentColor",strokeWidth:8,fill:"none",strokeLinecap:"round"}))}function Je(s){let t=He(s),a=()=>e(ye,{t});if(s.slots&&typeof s.slots.inject=="function"){try{s.slots.inject("settings.section",()=>{try{return s.slots.register({name:"settings.section",id:"mcp-manager",order:26,label:()=>t("title"),locale:be},()=>e("div",{style:{minHeight:"70vh"}},a()))}catch(i){return console.warn("mcp-manager: register settings.section failed:",i),()=>{}}})}catch(i){console.warn("mcp-manager: inject settings.section failed:",i)}try{s.slots.inject("settings.section.icon",()=>{try{return s.slots.register({name:"settings.section.icon",id:"mcp-manager",locale:be},Ke)}catch(i){return console.warn("mcp-manager: register settings.section.icon failed:",i),()=>{}}})}catch(i){console.warn("mcp-manager: inject settings.section.icon failed:",i)}}}var Ye=["slots","locale"],qe="mcp-manager";
|
|
469
469
|
return module.exports;
|
|
470
470
|
} });
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mcp-connectors",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"description": "DSH MCP Manager — 在 DeepSeek Harness 中统一管理本机各 Agent 的 MCP 服务器 · Manage MCP servers across local AI agents in DSH",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -17,7 +17,10 @@
|
|
|
17
17
|
"lib",
|
|
18
18
|
"assets",
|
|
19
19
|
"cordis.patch.yml",
|
|
20
|
-
"
|
|
20
|
+
"CHANGELOG.md",
|
|
21
|
+
"CHANGELOG.zh-CN.md",
|
|
22
|
+
"README.md",
|
|
23
|
+
"README.zh-CN.md"
|
|
21
24
|
],
|
|
22
25
|
"dsh": {
|
|
23
26
|
"manifestVersion": 1,
|
|
@@ -36,7 +39,10 @@
|
|
|
36
39
|
"scripts": {
|
|
37
40
|
"build": "node scripts/build.mjs",
|
|
38
41
|
"typecheck": "tsc --noEmit",
|
|
39
|
-
"
|
|
42
|
+
"test": "node scripts/build.mjs && node scripts/test.mjs",
|
|
43
|
+
"preview": "node scripts/build-preview.mjs",
|
|
44
|
+
"prepack": "npm run typecheck && npm run build",
|
|
45
|
+
"prepublishOnly": "npm test"
|
|
40
46
|
},
|
|
41
47
|
"peerDependencies": {
|
|
42
48
|
"react": "^18.2.0",
|