dsh-dragonbyte-client 0.0.0-stage → 0.4.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +158 -2
- package/client.js +201 -0
- package/cordis.patch.yml +3 -0
- package/package.json +58 -4
- package/src/desktop.mjs +421 -0
- package/src/host-main.mjs +275 -0
- package/src/host.mjs +325 -0
- package/src/protocol.v1.json +72 -0
- package/src/schema.mjs +118 -0
- package/src/wire.mjs +129 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Maha Inc.
|
|
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,159 @@
|
|
|
1
|
-
#
|
|
1
|
+
# dsh-dragonbyte-client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Share the MCP servers running on **your own machine** with a DSH tenant, without
|
|
4
|
+
opening a port, without a public name, and without moving the servers off your
|
|
5
|
+
laptop.
|
|
6
|
+
|
|
7
|
+
Two ways to run it, and they install differently:
|
|
8
|
+
|
|
9
|
+
| Where | What you get | How it installs |
|
|
10
|
+
| --- | --- | --- |
|
|
11
|
+
| a DSH Desktop (or any DSH Host) | `Settings -> DragonByte`, with pairing, the bridged servers and status | as a DSH **plugin bundle** |
|
|
12
|
+
| a plain machine | a headless host process | `npx -y dsh-dragonbyte-client` |
|
|
13
|
+
|
|
14
|
+
## In DSH Desktop
|
|
15
|
+
|
|
16
|
+
Install the bundle through the Plugin Manager, or point it at the npm package:
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
Plugin Manager -> install dsh-dragonbyte-client
|
|
20
|
+
Settings -> DragonByte -> Pair this machine
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
`github:mahainc-internal/dsh-dragonbyte-client` still works as an install
|
|
24
|
+
source, but the published npm package is what a release ships.
|
|
25
|
+
|
|
26
|
+
Pairing opens your browser on `edge01.snapai.app`, where you sign in with the
|
|
27
|
+
Google account that owns the DSH tenants. Approve it and the machine comes back
|
|
28
|
+
paired. There is nothing to copy and no token to paste.
|
|
29
|
+
|
|
30
|
+
**Once paired, the pair button is gone and the panel names the machine.** A
|
|
31
|
+
second pairing would mint a second device record for a machine that already has
|
|
32
|
+
one, so a paired machine offers **Reconnect** and **Disconnect** instead. The
|
|
33
|
+
name shown is this machine's OS hostname — the same one the tenant's device list
|
|
34
|
+
shows — overridden by `DSH_DRAGONBYTE_LABEL` when two machines have alike
|
|
35
|
+
hostnames.
|
|
36
|
+
|
|
37
|
+
**A paired machine serves every tenant that account owns.** There is no tenant
|
|
38
|
+
picker: which tenants an address owns is a registry question the bridge answers
|
|
39
|
+
on every publish, so handing the choice to a person would only be a way to
|
|
40
|
+
answer it wrongly.
|
|
41
|
+
|
|
42
|
+
**The MCP server list is typed here.** One line per server, either
|
|
43
|
+
`name: command args` or `name: https://host/mcp`; `#` starts a comment. **Save
|
|
44
|
+
servers** writes the list to the bridge first — the bridge is what every start
|
|
45
|
+
reads it from — and only then to the local credential, which is the copy an
|
|
46
|
+
offline start uses. Deleting every line is a real answer: the machine stops
|
|
47
|
+
sharing and says so instead of publishing an empty catalog.
|
|
48
|
+
|
|
49
|
+
The pairing page no longer has an editor. It signs a browser in and hands the
|
|
50
|
+
code back to the machine; the list has one home, and this is it.
|
|
51
|
+
|
|
52
|
+
⚠ **The browser step is not optional, and it cannot happen inside the app.** A
|
|
53
|
+
desktop shell serves its UI from an `app://` origin, which Firebase will never
|
|
54
|
+
accept as an authorized domain. The pairing page is therefore served by the
|
|
55
|
+
bridge on `edge01.snapai.app`; the app only opens it and waits on `127.0.0.1` for
|
|
56
|
+
the one-time code that comes back.
|
|
57
|
+
|
|
58
|
+
## On a plain machine
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
# in a DSH tenant: Settings -> DragonByte -> Create token, then:
|
|
62
|
+
npx -y dsh-dragonbyte-client
|
|
63
|
+
# paste the token; answer once for each MCP server
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
The credential is saved in `~/.config/dsh-dragonbyte/credential.json` and the
|
|
67
|
+
host renews its own token before it expires.
|
|
68
|
+
|
|
69
|
+
## What it does
|
|
70
|
+
|
|
71
|
+
One outbound WebSocket to `edge01.snapai.app/dragonbyte/ws`, then it publishes a
|
|
72
|
+
catalog of your MCP tools upward and answers calls on that socket. A DSH tenant
|
|
73
|
+
gets one tool per bridged entry, named `mcp__dragonbyte_<server>__<tool>`.
|
|
74
|
+
|
|
75
|
+
The connection points downward on purpose: your machine has no public name, no
|
|
76
|
+
certificate and no inbound port, so giving it one is the whole problem this
|
|
77
|
+
avoids.
|
|
78
|
+
|
|
79
|
+
## Supported MCP servers
|
|
80
|
+
|
|
81
|
+
| Transport | How to enter it | Notes |
|
|
82
|
+
| --- | --- | --- |
|
|
83
|
+
| `stdio` | `name: command args` | spawned on this machine, inherits its environment |
|
|
84
|
+
| `http` | `name: https://host/path` | Streamable HTTP, optional static headers |
|
|
85
|
+
|
|
86
|
+
Not supported, and refused rather than half-connected: legacy SSE transport,
|
|
87
|
+
OAuth-protected servers, and anything that is not one of the two rows above.
|
|
88
|
+
|
|
89
|
+
Limits worth knowing before you plan around them:
|
|
90
|
+
|
|
91
|
+
- **16 servers** per machine; a name must match `[a-z][a-z0-9-]{0,31}`.
|
|
92
|
+
- **A tool result over 4 MiB is refused.** Serving large files as base64 through
|
|
93
|
+
this path will not work.
|
|
94
|
+
- **A server that fails to connect is skipped**, and the others still serve. If
|
|
95
|
+
none connect, the host publishes nothing rather than binding a tenant to a
|
|
96
|
+
machine that can do nothing.
|
|
97
|
+
- **Calls are at-most-once.** A timed-out call is reported as "may have run" and
|
|
98
|
+
is never retried, because a local MCP tool is an arbitrary side effect.
|
|
99
|
+
|
|
100
|
+
## Where settings live
|
|
101
|
+
|
|
102
|
+
| What | Where |
|
|
103
|
+
| --- | --- |
|
|
104
|
+
| the device token and tenant binding | `~/.config/dsh-dragonbyte/credential.json` (0600) |
|
|
105
|
+
| the MCP server list | the bridge's paired-device store, typed in `Settings -> DragonByte` and cached in the credential for an offline start |
|
|
106
|
+
| revocation | `Settings -> DragonByte -> Disconnect` |
|
|
107
|
+
|
|
108
|
+
Override the config location with `DSH_DRAGONBYTE_CONFIG_DIR`.
|
|
109
|
+
|
|
110
|
+
## Run it headless
|
|
111
|
+
|
|
112
|
+
```sh
|
|
113
|
+
# first run: reads the token from the prompt (or DSH_DRAGONBYTE_TOKEN)
|
|
114
|
+
dsh-dragonbyte-host
|
|
115
|
+
|
|
116
|
+
# later runs: everything comes from the credential file
|
|
117
|
+
dsh-dragonbyte-host --bridge wss://edge01.snapai.app/dragonbyte/ws
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
| Flag / variable | Meaning |
|
|
121
|
+
| --- | --- |
|
|
122
|
+
| `--bridge <url>` | bridge WebSocket; defaults to `DSH_DRAGONBYTE_BRIDGE` or the edge01 URL |
|
|
123
|
+
| `--mcp <mcp.json>` | a standard `{ "mcpServers": { … } }` file instead of the saved list |
|
|
124
|
+
| `--tenant <id>` | required only when this address owns more than one tenant |
|
|
125
|
+
| `DSH_DRAGONBYTE_TOKEN` | the device token, for a first run without a prompt |
|
|
126
|
+
| `DSH_DRAGONBYTE_CONFIG_DIR` | where `credential.json` lives |
|
|
127
|
+
|
|
128
|
+
`--help` exits without prompting, and a run with a saved credential never asks
|
|
129
|
+
for input — which is what lets it run under a supervisor or a login item.
|
|
130
|
+
|
|
131
|
+
## Revoking a machine
|
|
132
|
+
|
|
133
|
+
`Settings -> DragonByte -> Disconnect`. The bridge re-reads its revocation list on
|
|
134
|
+
its 15-second sweep and closes an already-open socket, so the tenant's tools go
|
|
135
|
+
away within about half a minute rather than when the machine happens to
|
|
136
|
+
reconnect.
|
|
137
|
+
|
|
138
|
+
## Requirements
|
|
139
|
+
|
|
140
|
+
Node.js **>= 22.5** (the global `WebSocket`, and `@modelcontextprotocol/client`).
|
|
141
|
+
The DSH Host provides its own runtime, so an installed bundle needs nothing on
|
|
142
|
+
the machine's `PATH`.
|
|
143
|
+
|
|
144
|
+
## Develop
|
|
145
|
+
|
|
146
|
+
```sh
|
|
147
|
+
npm ci
|
|
148
|
+
npm test
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
The tests cover the socket protocol, the credential file, the settings exchange,
|
|
152
|
+
the `/dragonbyte/status` route the panel reads (including the machine name it
|
|
153
|
+
renders), the no-prompt exit path, and how the pairing page URL is built. The pairing
|
|
154
|
+
endpoint, the Firebase token check and the device store live in the tenant-side
|
|
155
|
+
[`dsh-dragonbyte`](../dsh-dragonbyte) package, because they run on edge01.
|
|
156
|
+
|
|
157
|
+
## License
|
|
158
|
+
|
|
159
|
+
MIT
|
package/client.js
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
window.__ModuleLoader__.load({
|
|
2
|
+
id: 'dsh-dragonbyte-client',
|
|
3
|
+
factory(require) {
|
|
4
|
+
const React = require('react');
|
|
5
|
+
const h = React.createElement;
|
|
6
|
+
const namespace = 'dsh-dragonbyte';
|
|
7
|
+
const zh = {
|
|
8
|
+
'DragonByte': 'DragonByte',
|
|
9
|
+
'Serve the MCP servers on your own machine to your DSH tenant.': '将你机器上的 MCP 服务器提供给你的 DSH 租户。',
|
|
10
|
+
'Pair this machine': '配对此机器',
|
|
11
|
+
'Pairing…': '正在配对…',
|
|
12
|
+
'Paired': '已配对',
|
|
13
|
+
'Machine': '机器',
|
|
14
|
+
'This machine': '此机器',
|
|
15
|
+
'Not paired yet.': '尚未配对。',
|
|
16
|
+
'Open Google sign-in in your browser, approve this machine, then come back.': '在浏览器中打开 Google 登录,批准此机器后返回。',
|
|
17
|
+
'Keep this window open. Finish the sign-in in your browser; this finishes on its own.': '请保持此窗口打开。在浏览器中完成登录,此处会自动完成。',
|
|
18
|
+
'MCP servers': 'MCP 服务器',
|
|
19
|
+
'Reconnect': '重新连接',
|
|
20
|
+
'Disconnect': '断开连接',
|
|
21
|
+
'Connected': '已连接',
|
|
22
|
+
'Connecting…': '正在连接…',
|
|
23
|
+
'Not connected': '未连接',
|
|
24
|
+
'No servers configured yet.': '尚未配置服务器。',
|
|
25
|
+
'One per line: name: command, or name: https URL.': '每行一个:name: 命令,或 name: https URL。',
|
|
26
|
+
'These run on this machine.': '这些服务器在此机器上运行。',
|
|
27
|
+
'Save servers': '保存服务器',
|
|
28
|
+
'Saving…': '正在保存…',
|
|
29
|
+
'Could not reach the local host.': '无法连接本地主机。',
|
|
30
|
+
'Could not pair. Try again.': '无法配对,请重试。',
|
|
31
|
+
'Revoking…': '正在撤销…',
|
|
32
|
+
};
|
|
33
|
+
const en = Object.fromEntries(Object.keys(zh).map((key) => [key, key]));
|
|
34
|
+
const css = `
|
|
35
|
+
.dsh-dragonbyte { width: 100%; max-width: 840px; min-width: 0; box-sizing: border-box; color: var(--dsw-alias-label-primary); }
|
|
36
|
+
.dsh-dragonbyte *, .dsh-dragonbyte *::before, .dsh-dragonbyte *::after { box-sizing: border-box; }
|
|
37
|
+
.dsh-dragonbyte h2 { margin: 0 0 8px; font-size: 20px; font-weight: 500; line-height: 1.4; }
|
|
38
|
+
.dsh-dragonbyte > p { margin: 0 0 20px; color: var(--dsw-alias-label-secondary); font-size: 13px; line-height: 1.5; }
|
|
39
|
+
.dsh-dragonbyte h3 { margin: 0 0 8px; font-size: 14px; font-weight: 500; }
|
|
40
|
+
.dsh-dragonbyte .group { display: grid; gap: 12px; margin: 0 0 28px; }
|
|
41
|
+
.dsh-dragonbyte .row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 20px; min-width: 0; padding: 16px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 10px; background: var(--dsw-alias-bg-layer-1); }
|
|
42
|
+
.dsh-dragonbyte .detail { flex: 1 1 200px; min-width: 0; }
|
|
43
|
+
.dsh-dragonbyte .muted { margin: 0; color: var(--dsw-alias-label-secondary); font-size: 13px; line-height: 1.5; overflow-wrap: anywhere; }
|
|
44
|
+
.dsh-dragonbyte .actions { display: flex; flex-wrap: wrap; gap: 12px; }
|
|
45
|
+
.dsh-dragonbyte textarea { width: 100%; min-height: 96px; resize: vertical; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; padding: 8px 10px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; background: var(--dsw-alias-bg-layer-1); color: var(--dsw-alias-label-primary); }
|
|
46
|
+
.dsh-dragonbyte textarea:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary); outline-offset: 1px; }
|
|
47
|
+
.dsh-dragonbyte .link { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 14px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1); font-size: 13px; text-decoration: none; }
|
|
48
|
+
.dsh-dragonbyte .link:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
49
|
+
.dsh-dragonbyte button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 7px 14px; border: 1px solid var(--dsw-alias-border-l2); border-radius: 8px; color: var(--dsw-alias-label-primary); background: var(--dsw-alias-bg-layer-1); font: inherit; font-size: 13px; cursor: pointer; }
|
|
50
|
+
.dsh-dragonbyte button:hover { background: var(--dsw-alias-interactive-bg-hover); }
|
|
51
|
+
.dsh-dragonbyte button:focus-visible { outline: 2px solid var(--dsw-alias-state-business-primary); outline-offset: 2px; }
|
|
52
|
+
.dsh-dragonbyte button:disabled { cursor: default; opacity: .6; }
|
|
53
|
+
@media (max-width: 560px) { .dsh-dragonbyte button { width: 100%; min-height: 44px; } }
|
|
54
|
+
`;
|
|
55
|
+
|
|
56
|
+
// ⚠ THESE ROUTES ARE THE LOCAL HOST'S, NOT THE GATEWAY'S. The page is served
|
|
57
|
+
// by the DSH this plugin is installed in, and that Host owns the routes
|
|
58
|
+
// under its own origin — the same origin `dsh-app://app` forwards to.
|
|
59
|
+
function hostBase() {
|
|
60
|
+
return new URL('dragonbyte/', document.baseURI).toString();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
const STATUS_LABEL = {
|
|
64
|
+
connected: 'Connected', connecting: 'Connecting…', idle: 'Not connected',
|
|
65
|
+
'no-servers': 'No servers configured yet.', error: 'Not connected',
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
function DragonbyteSection({ t }) {
|
|
69
|
+
const base = React.useMemo(hostBase, []);
|
|
70
|
+
const [state, setState] = React.useState({ loading: true, status: 'idle', servers: '', paired: false, tenantId: '', label: '' });
|
|
71
|
+
const [draft, setDraft] = React.useState('');
|
|
72
|
+
// ⚠ A REFRESH MUST NOT EAT A HALF-TYPED LINE. The field takes the host's
|
|
73
|
+
// value until the person types in it; a save clears this again.
|
|
74
|
+
const edited = React.useRef(false);
|
|
75
|
+
const [error, setError] = React.useState('');
|
|
76
|
+
const [busy, setBusy] = React.useState('');
|
|
77
|
+
|
|
78
|
+
const load = React.useCallback(async (signal) => {
|
|
79
|
+
try {
|
|
80
|
+
const response = await fetch(`${base}status`, { cache: 'no-store', signal, headers: { accept: 'application/json' } });
|
|
81
|
+
if (!response.ok) throw new Error('Could not reach the local host.');
|
|
82
|
+
const payload = await response.json();
|
|
83
|
+
setState({ loading: false, ...payload });
|
|
84
|
+
if (!edited.current) setDraft(payload.servers);
|
|
85
|
+
setError('');
|
|
86
|
+
} catch (failure) {
|
|
87
|
+
if (!signal?.aborted) { setState((s) => ({ ...s, loading: false })); setError(failure.message || 'Could not reach the local host.'); }
|
|
88
|
+
}
|
|
89
|
+
}, [base]);
|
|
90
|
+
|
|
91
|
+
React.useEffect(() => { const controller = new AbortController(); void load(controller.signal); return () => controller.abort(); }, [load]);
|
|
92
|
+
|
|
93
|
+
const call = async (path, init, { adopt = true } = {}) => {
|
|
94
|
+
const response = await fetch(`${base}${path}`, { cache: 'no-store', ...init });
|
|
95
|
+
const payload = await response.json().catch(() => null);
|
|
96
|
+
if (!response.ok) throw new Error(payload?.error || 'Request failed. Try again.');
|
|
97
|
+
// ⚠ A SAVE DOES NOT REPLACE THE FIELD WITH WHAT IT JUST SENT. Adopting
|
|
98
|
+
// the answer here would rewrite the textarea with the same text, which
|
|
99
|
+
// puts the caret back at the end mid-line.
|
|
100
|
+
if (adopt) setState({ loading: false, ...payload });
|
|
101
|
+
return payload;
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
async function pair() {
|
|
105
|
+
setBusy('pair');
|
|
106
|
+
try {
|
|
107
|
+
await call('pair', {
|
|
108
|
+
method: 'POST', headers: { 'content-type': 'application/json' },
|
|
109
|
+
body: JSON.stringify({ tenantId: state.tenantId || '' }),
|
|
110
|
+
});
|
|
111
|
+
setError('');
|
|
112
|
+
} catch (failure) { setError(failure.message || 'Could not pair. Try again.'); }
|
|
113
|
+
finally { setBusy(''); void load(); }
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
async function save() {
|
|
117
|
+
setBusy('save');
|
|
118
|
+
try {
|
|
119
|
+
// ⚠ THE HOST PARSES AND VALIDATES THIS TEXT. It is the same parser the
|
|
120
|
+
// headless prompt uses, so a line means the same thing in both, and a
|
|
121
|
+
// bad line comes back as the message shown here.
|
|
122
|
+
await call('servers', {
|
|
123
|
+
method: 'PUT', headers: { 'content-type': 'application/json' },
|
|
124
|
+
body: JSON.stringify({ text: draft }),
|
|
125
|
+
}, { adopt: false });
|
|
126
|
+
edited.current = false;
|
|
127
|
+
setError('');
|
|
128
|
+
} catch (failure) { setError(failure.message || 'Could not save. Check the format and retry.'); }
|
|
129
|
+
finally { setBusy(''); void load(); }
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
async function disconnect() {
|
|
133
|
+
setBusy('revoke');
|
|
134
|
+
try { await call('credential', { method: 'DELETE' }); setError(''); }
|
|
135
|
+
catch (failure) { setError(failure.message || 'Could not revoke. Try again.'); }
|
|
136
|
+
finally { setBusy(''); }
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const statusLabel = STATUS_LABEL[state.status] || 'Not connected';
|
|
140
|
+
|
|
141
|
+
return h('section', { className: 'dsh-dragonbyte' },
|
|
142
|
+
h('style', null, css),
|
|
143
|
+
h('h2', null, t('DragonByte')),
|
|
144
|
+
h('p', null, t('Serve the MCP servers on your own machine to your DSH tenant.')),
|
|
145
|
+
error ? h('p', { className: 'muted', role: 'alert' }, t(error)) : null,
|
|
146
|
+
|
|
147
|
+
h('div', { className: 'group' },
|
|
148
|
+
// ⚠ THE HEADING FOLLOWS THE STATE. "Pair this machine" over a row
|
|
149
|
+
// with no pair button reads like the button failed to load.
|
|
150
|
+
h('h3', null, t(state.paired ? 'This machine' : 'Pair this machine')),
|
|
151
|
+
h('div', { className: 'row' },
|
|
152
|
+
h('div', { className: 'detail' },
|
|
153
|
+
h('p', { className: 'muted' },
|
|
154
|
+
state.paired
|
|
155
|
+
? `${t('Paired')} · ${state.label || t('Machine')} · ${state.tenantId || '—'} · ${t(statusLabel)}`
|
|
156
|
+
: t('Not paired yet.')),
|
|
157
|
+
h('p', { className: 'muted' }, t('Keep this window open. Finish the sign-in in your browser; this finishes on its own.'))),
|
|
158
|
+
h('div', { className: 'actions' },
|
|
159
|
+
// ⚠ NO PAIR BUTTON ONCE THIS MACHINE IS PAIRED. Pairing again
|
|
160
|
+
// would mint a second device record for a machine that already
|
|
161
|
+
// has one. A paired machine that lost its connection is fixed
|
|
162
|
+
// with Reconnect, or by Disconnect and pairing afresh.
|
|
163
|
+
state.paired ? null : h('button', { type: 'button', disabled: busy !== '', onClick: () => void pair() },
|
|
164
|
+
busy === 'pair' ? t('Pairing…') : t('Pair this machine')),
|
|
165
|
+
state.paired ? h('button', { type: 'button', disabled: busy !== '', onClick: () => void call('reconnect', { method: 'POST' }).catch(() => setError('Could not reach the local host.')) },
|
|
166
|
+
t('Reconnect')) : null,
|
|
167
|
+
state.paired ? h('button', { type: 'button', disabled: busy !== '', onClick: () => void disconnect() },
|
|
168
|
+
busy === 'revoke' ? t('Revoking…') : t('Disconnect')) : null))),
|
|
169
|
+
|
|
170
|
+
// ⚠ THIS IS THE ONE EDITOR. A save goes to the bridge, which is what
|
|
171
|
+
// re-reads the list on every start, and the bridge's copy is written
|
|
172
|
+
// first so a list that never arrived never looks saved.
|
|
173
|
+
h('div', { className: 'group' },
|
|
174
|
+
h('h3', null, t('MCP servers')),
|
|
175
|
+
state.paired ? null : h('p', { className: 'muted' }, t('No servers configured yet.')),
|
|
176
|
+
h('p', { className: 'muted' }, t('One per line: name: command, or name: https URL.')),
|
|
177
|
+
h('p', { className: 'muted' }, t('These run on this machine.')),
|
|
178
|
+
h('textarea', {
|
|
179
|
+
value: draft, spellCheck: false, rows: 6,
|
|
180
|
+
onChange: (event) => { edited.current = true; setDraft(event.target.value); },
|
|
181
|
+
'aria-label': t('MCP servers'),
|
|
182
|
+
}),
|
|
183
|
+
h('div', { className: 'actions' },
|
|
184
|
+
h('button', { type: 'button', disabled: busy !== '', onClick: () => void save() },
|
|
185
|
+
busy === 'save' ? t('Saving…') : t('Save servers')))));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
inject: ['slots', 'locale'],
|
|
190
|
+
apply(ctx) {
|
|
191
|
+
ctx.effect(() => ctx.locale.register(namespace, { zh, en }), 'dragonbyte: locale');
|
|
192
|
+
const t = ctx.locale.bind(namespace);
|
|
193
|
+
function Section() { return h(DragonbyteSection, { t }); }
|
|
194
|
+
ctx.effect(() => ctx.slots.inject('settings.section', () => ctx.slots.register({
|
|
195
|
+
name: 'settings.section', id: 'dragonbyte', order: 23,
|
|
196
|
+
label: () => t('DragonByte'), locale: namespace,
|
|
197
|
+
}, Section)), 'dragonbyte: settings section');
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
},
|
|
201
|
+
});
|
package/cordis.patch.yml
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,60 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-dragonbyte-client",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
6
|
-
|
|
3
|
+
"version": "0.4.2",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "Share the MCP servers on your own machine with a DSH tenant",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": "./src/desktop.mjs",
|
|
8
|
+
"./host": "./src/host.mjs",
|
|
9
|
+
"./client": "./client.js"
|
|
10
|
+
},
|
|
11
|
+
"bin": {
|
|
12
|
+
"dsh-dragonbyte-host": "./src/host-main.mjs"
|
|
13
|
+
},
|
|
14
|
+
"files": [
|
|
15
|
+
"src",
|
|
16
|
+
"client.js",
|
|
17
|
+
"cordis.patch.yml",
|
|
18
|
+
"README.md",
|
|
19
|
+
"LICENSE"
|
|
20
|
+
],
|
|
21
|
+
"dsh": {
|
|
22
|
+
"bundle": {
|
|
23
|
+
"patch": "./cordis.patch.yml"
|
|
24
|
+
},
|
|
25
|
+
"client": {
|
|
26
|
+
"platform": "web",
|
|
27
|
+
"immediately": true,
|
|
28
|
+
"inject": [
|
|
29
|
+
"@deepseek-ai/dsh-client-ui-renderer",
|
|
30
|
+
"@deepseek-ai/dsh-client-ui-settings",
|
|
31
|
+
"@deepseek-ai/dsh-client-ui-slots",
|
|
32
|
+
"@deepseek-ai/dsh-client-locale"
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
"engines": {
|
|
37
|
+
"node": ">=22.5"
|
|
38
|
+
},
|
|
39
|
+
"scripts": {
|
|
40
|
+
"test": "node --test --test-timeout=30000"
|
|
41
|
+
},
|
|
42
|
+
"dependencies": {
|
|
43
|
+
"@modelcontextprotocol/client": "2.2.0"
|
|
44
|
+
},
|
|
45
|
+
"license": "MIT",
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "git+https://github.com/mahainc-internal/dsh-dragonbyte-client.git"
|
|
49
|
+
},
|
|
50
|
+
"homepage": "https://github.com/mahainc-internal/dsh-dragonbyte-client#readme",
|
|
51
|
+
"bugs": {
|
|
52
|
+
"url": "https://github.com/mahainc-internal/dsh-dragonbyte-client/issues"
|
|
53
|
+
},
|
|
54
|
+
"keywords": [
|
|
55
|
+
"mcp",
|
|
56
|
+
"dsh",
|
|
57
|
+
"modelcontextprotocol",
|
|
58
|
+
"cli"
|
|
59
|
+
]
|
|
60
|
+
}
|