dsh-mcp 1.2.0 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.en.md +29 -0
- package/CHANGELOG.md +29 -0
- package/README.en.md +23 -5
- package/README.md +19 -4
- package/lib/client.js +989 -388
- package/lib/index.js +322 -13
- package/lib/oauth.js +46 -5
- package/package.json +1 -1
- package/src/client/GlobalEnvEditor.module.css +194 -0
- package/src/client/GlobalEnvEditor.tsx +245 -0
- package/src/client/McpSettingsSection.module.css +67 -0
- package/src/client/McpSettingsSection.tsx +82 -18
- package/src/client/ServerForm.module.css +0 -47
- package/src/client/ServerForm.tsx +25 -70
- package/src/client/ServersJsonEditor.module.css +90 -0
- package/src/client/ServersJsonEditor.tsx +226 -0
- package/src/client/index.ts +21 -3
- package/src/client/locales.ts +54 -4
- package/src/client/mcp-store.ts +4 -54
- package/src/client/remote-contribution.js +163 -2
- package/src/client/types.ts +2 -0
package/src/client/mcp-store.ts
CHANGED
|
@@ -6,21 +6,9 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { defineStore, type EngineStoreHandle } from '@deepseek-ai/dsh-client-runtime/client'
|
|
8
8
|
import type {
|
|
9
|
-
|
|
9
|
+
McpProbeView, McpServerId, McpServerInput, McpServerView, McpTransportKind,
|
|
10
10
|
} from './types.ts'
|
|
11
11
|
|
|
12
|
-
/** One env row in the editor. */
|
|
13
|
-
export interface McpEnvRowDraft {
|
|
14
|
-
/** Stable row key for React lists. */
|
|
15
|
-
readonly key: string
|
|
16
|
-
readonly name: string
|
|
17
|
-
readonly secret: boolean
|
|
18
|
-
/** Editor text; a blank secret value keeps the stored one on save. */
|
|
19
|
-
readonly value: string
|
|
20
|
-
/** Whether a stored value exists (secret rows render write-only). */
|
|
21
|
-
readonly configured: boolean
|
|
22
|
-
}
|
|
23
|
-
|
|
24
12
|
/** One server being edited. */
|
|
25
13
|
export interface McpDraft {
|
|
26
14
|
/** Existing server id; null creates a new server. */
|
|
@@ -35,7 +23,6 @@ export interface McpDraft {
|
|
|
35
23
|
readonly url: string
|
|
36
24
|
/** Headers as "Name: value" lines. */
|
|
37
25
|
readonly headersText: string
|
|
38
|
-
readonly env: readonly McpEnvRowDraft[]
|
|
39
26
|
/** Timeout as editor text; blank falls back to the default. */
|
|
40
27
|
readonly toolCallTimeoutMs: string
|
|
41
28
|
readonly failOnStartupError: boolean
|
|
@@ -75,19 +62,6 @@ type McpManagerActions = {
|
|
|
75
62
|
/** Default tool-call timeout when the editor leaves it blank (ms). */
|
|
76
63
|
export const DEFAULT_TOOL_CALL_TIMEOUT_MS = 60_000
|
|
77
64
|
|
|
78
|
-
let envRowSeq = 0
|
|
79
|
-
|
|
80
|
-
/** A fresh env row key for React identity. */
|
|
81
|
-
function nextEnvRowKey(): string {
|
|
82
|
-
envRowSeq += 1
|
|
83
|
-
return `env-${envRowSeq}`
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/** A fresh empty env row for the editor. */
|
|
87
|
-
export function createEnvRowDraft(): McpEnvRowDraft {
|
|
88
|
-
return { key: nextEnvRowKey(), name: '', secret: false, value: '', configured: false }
|
|
89
|
-
}
|
|
90
|
-
|
|
91
65
|
/** Build an empty create draft. */
|
|
92
66
|
export function emptyDraft(): McpDraft {
|
|
93
67
|
return {
|
|
@@ -100,7 +74,6 @@ export function emptyDraft(): McpDraft {
|
|
|
100
74
|
cwd: '',
|
|
101
75
|
url: '',
|
|
102
76
|
headersText: '',
|
|
103
|
-
env: [],
|
|
104
77
|
toolCallTimeoutMs: String(DEFAULT_TOOL_CALL_TIMEOUT_MS),
|
|
105
78
|
// Reject the mount by default when the startup connection fails, so a
|
|
106
79
|
// broken server never registers stale tools.
|
|
@@ -120,13 +93,6 @@ export function draftFromServer(server: McpServerView): McpDraft {
|
|
|
120
93
|
cwd: server.cwd,
|
|
121
94
|
url: server.url,
|
|
122
95
|
headersText: server.headers.map(header => `${header.name}: ${header.value}`).join('\n'),
|
|
123
|
-
env: server.env.map(entry => ({
|
|
124
|
-
key: nextEnvRowKey(),
|
|
125
|
-
name: entry.name,
|
|
126
|
-
secret: entry.secret,
|
|
127
|
-
value: '',
|
|
128
|
-
configured: entry.configured,
|
|
129
|
-
})),
|
|
130
96
|
toolCallTimeoutMs: String(server.toolCallTimeoutMs),
|
|
131
97
|
failOnStartupError: server.failOnStartupError,
|
|
132
98
|
}
|
|
@@ -159,12 +125,12 @@ function parseTimeout(text: string): number {
|
|
|
159
125
|
/** The Remote submission derived from the current draft. */
|
|
160
126
|
export interface McpSubmission {
|
|
161
127
|
readonly server: McpServerInput
|
|
162
|
-
readonly env: readonly McpEnvVarInput[]
|
|
163
128
|
}
|
|
164
129
|
|
|
165
130
|
/**
|
|
166
|
-
* Convert the editing draft into the Remote upsert/test payload.
|
|
167
|
-
*
|
|
131
|
+
* Convert the editing draft into the Remote upsert/test payload. The form no
|
|
132
|
+
* longer edits env rows (process-level env vars are managed separately), so
|
|
133
|
+
* no env is submitted and the host keeps the stored env untouched.
|
|
168
134
|
*/
|
|
169
135
|
export function draftToSubmission(draft: McpDraft): McpSubmission {
|
|
170
136
|
return {
|
|
@@ -180,22 +146,6 @@ export function draftToSubmission(draft: McpDraft): McpSubmission {
|
|
|
180
146
|
toolCallTimeoutMs: parseTimeout(draft.toolCallTimeoutMs),
|
|
181
147
|
failOnStartupError: draft.failOnStartupError,
|
|
182
148
|
},
|
|
183
|
-
env: draft.env.map(row => ({
|
|
184
|
-
name: row.name.trim(),
|
|
185
|
-
secret: row.secret,
|
|
186
|
-
...row.secret && row.value.trim().length === 0 ? {} : { value: row.value },
|
|
187
|
-
})),
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
|
|
191
|
-
/** Map a Remote failure code to a locale key for user-facing copy. */
|
|
192
|
-
export function failureLocaleKey(code: string): string {
|
|
193
|
-
switch (code) {
|
|
194
|
-
case 'MCP_SERVER_NAME_CONFLICT': return 'serverNameConflict'
|
|
195
|
-
case 'MCP_SERVER_NOT_FOUND': return 'notFound'
|
|
196
|
-
case 'MCP_INVALID_SPEC': return 'invalidSpec'
|
|
197
|
-
case 'MCP_MOUNT_FAILED': return 'mountFailed'
|
|
198
|
-
default: return 'failureTitle'
|
|
199
149
|
}
|
|
200
150
|
}
|
|
201
151
|
|
|
@@ -32,6 +32,7 @@ const _deepseek_ai_dsh_mcp_manager_mcpManager_list_result$schema = z.object({
|
|
|
32
32
|
'name': z.string().readonly(),
|
|
33
33
|
'secret': z.boolean().readonly(),
|
|
34
34
|
'configured': z.boolean().readonly(),
|
|
35
|
+
'value': z.string().readonly().optional(),
|
|
35
36
|
})).readonly(),
|
|
36
37
|
'toolCallTimeoutMs': z.number().readonly(),
|
|
37
38
|
'failOnStartupError': z.boolean().readonly(),
|
|
@@ -63,7 +64,7 @@ const _deepseek_ai_dsh_mcp_manager_mcpManager_test_parameter_0$schema = z.object
|
|
|
63
64
|
'name': z.string().readonly(),
|
|
64
65
|
'secret': z.boolean().readonly(),
|
|
65
66
|
'value': z.string().readonly().optional(),
|
|
66
|
-
})).readonly(),
|
|
67
|
+
})).readonly().optional(),
|
|
67
68
|
})
|
|
68
69
|
const _deepseek_ai_dsh_mcp_manager_mcpManager_test_result$schema = z.object({
|
|
69
70
|
'ok': z.literal(true).readonly(),
|
|
@@ -100,7 +101,7 @@ const _deepseek_ai_dsh_mcp_manager_mcpManager_upsert_parameter_0$schema = z.obje
|
|
|
100
101
|
'name': z.string().readonly(),
|
|
101
102
|
'secret': z.boolean().readonly(),
|
|
102
103
|
'value': z.string().readonly().optional(),
|
|
103
|
-
})).readonly(),
|
|
104
|
+
})).readonly().optional(),
|
|
104
105
|
})
|
|
105
106
|
const _deepseek_ai_dsh_mcp_manager_mcpManager_upsert_result$schema = z.union([z.object({
|
|
106
107
|
'ok': z.literal(true).readonly(),
|
|
@@ -121,6 +122,7 @@ const _deepseek_ai_dsh_mcp_manager_mcpManager_upsert_result$schema = z.union([z.
|
|
|
121
122
|
'name': z.string().readonly(),
|
|
122
123
|
'secret': z.boolean().readonly(),
|
|
123
124
|
'configured': z.boolean().readonly(),
|
|
125
|
+
'value': z.string().readonly().optional(),
|
|
124
126
|
})).readonly(),
|
|
125
127
|
'toolCallTimeoutMs': z.number().readonly(),
|
|
126
128
|
'failOnStartupError': z.boolean().readonly(),
|
|
@@ -137,6 +139,69 @@ const _deepseek_ai_dsh_mcp_manager_mcpManager_upsert_result$schema = z.union([z.
|
|
|
137
139
|
'message': z.string().readonly(),
|
|
138
140
|
}).readonly(),
|
|
139
141
|
})])
|
|
142
|
+
const _deepseek_ai_dsh_mcp_manager_mcpManager_upsertJson_parameter_0$schema = z.object({
|
|
143
|
+
'servers': z.array(z.object({
|
|
144
|
+
'server': z.object({
|
|
145
|
+
'serverName': z.string().readonly(),
|
|
146
|
+
'transport': z.union([z.literal("stdio"), z.literal("streamable-http")]).readonly(),
|
|
147
|
+
'enabled': z.boolean().readonly().optional(),
|
|
148
|
+
'command': z.string().readonly().optional(),
|
|
149
|
+
'args': z.array(z.string()).readonly().optional(),
|
|
150
|
+
'cwd': z.string().readonly().optional(),
|
|
151
|
+
'url': z.string().readonly().optional(),
|
|
152
|
+
'headers': z.union([z.record(z.string(), z.string()), z.array(z.object({
|
|
153
|
+
'name': z.string().readonly(),
|
|
154
|
+
'value': z.string().readonly(),
|
|
155
|
+
})).readonly()]).readonly().optional(),
|
|
156
|
+
'toolCallTimeoutMs': z.number().readonly().optional(),
|
|
157
|
+
'failOnStartupError': z.boolean().readonly().optional(),
|
|
158
|
+
}).readonly(),
|
|
159
|
+
'env': z.array(z.object({
|
|
160
|
+
'name': z.string().readonly(),
|
|
161
|
+
'secret': z.boolean().readonly().optional(),
|
|
162
|
+
'value': z.string().readonly().optional(),
|
|
163
|
+
})).readonly().optional(),
|
|
164
|
+
})).readonly(),
|
|
165
|
+
})
|
|
166
|
+
const _deepseek_ai_dsh_mcp_manager_mcpManager_upsertJson_result$schema = z.union([z.object({
|
|
167
|
+
'ok': z.literal(true).readonly(),
|
|
168
|
+
'added': z.number().readonly(),
|
|
169
|
+
'updated': z.number().readonly(),
|
|
170
|
+
'removed': z.number().readonly(),
|
|
171
|
+
'servers': z.array(z.object({
|
|
172
|
+
'id': z.intersection(z.string(), z.unknown()).readonly(),
|
|
173
|
+
'serverName': z.string().readonly(),
|
|
174
|
+
'transport': z.union([z.literal("stdio"), z.literal("streamable-http")]).readonly(),
|
|
175
|
+
'enabled': z.boolean().readonly(),
|
|
176
|
+
'command': z.string().readonly(),
|
|
177
|
+
'args': z.array(z.string()).readonly(),
|
|
178
|
+
'cwd': z.string().readonly(),
|
|
179
|
+
'url': z.string().readonly(),
|
|
180
|
+
'headers': z.array(z.object({
|
|
181
|
+
'name': z.string().readonly(),
|
|
182
|
+
'value': z.string().readonly(),
|
|
183
|
+
})).readonly(),
|
|
184
|
+
'env': z.array(z.object({
|
|
185
|
+
'name': z.string().readonly(),
|
|
186
|
+
'secret': z.boolean().readonly(),
|
|
187
|
+
'configured': z.boolean().readonly(),
|
|
188
|
+
'value': z.string().readonly().optional(),
|
|
189
|
+
})).readonly(),
|
|
190
|
+
'toolCallTimeoutMs': z.number().readonly(),
|
|
191
|
+
'failOnStartupError': z.boolean().readonly(),
|
|
192
|
+
'status': z.object({
|
|
193
|
+
'phase': z.union([z.literal("failed"), z.literal("stopped"), z.literal("mounting"), z.literal("live")]).readonly(),
|
|
194
|
+
'tools': z.array(z.string()).readonly(),
|
|
195
|
+
'error': z.string().readonly().optional(),
|
|
196
|
+
}).readonly(),
|
|
197
|
+
})).readonly(),
|
|
198
|
+
}), z.object({
|
|
199
|
+
'ok': z.literal(false).readonly(),
|
|
200
|
+
'error': z.object({
|
|
201
|
+
'code': z.union([z.literal("MCP_SERVER_NOT_FOUND"), z.literal("MCP_SERVER_NAME_CONFLICT"), z.literal("MCP_INVALID_SPEC"), z.literal("MCP_MOUNT_FAILED")]).readonly(),
|
|
202
|
+
'message': z.string().readonly(),
|
|
203
|
+
}).readonly(),
|
|
204
|
+
})])
|
|
140
205
|
const _deepseek_ai_dsh_mcp_manager_mcpManager_toolsList_result$schema = z.object({
|
|
141
206
|
'ok': z.literal(true).readonly(),
|
|
142
207
|
'tools': z.array(z.object({
|
|
@@ -174,6 +239,37 @@ const _deepseek_ai_dsh_mcp_manager_mcpManager_toolsMode_result$schema = z.union(
|
|
|
174
239
|
'message': z.string().readonly(),
|
|
175
240
|
}).readonly(),
|
|
176
241
|
})])
|
|
242
|
+
const _deepseek_ai_dsh_mcp_manager_mcpManager_envList_result$schema = z.object({
|
|
243
|
+
'ok': z.literal(true).readonly(),
|
|
244
|
+
'vars': z.array(z.object({
|
|
245
|
+
'name': z.string().readonly(),
|
|
246
|
+
'secret': z.boolean().readonly(),
|
|
247
|
+
'configured': z.boolean().readonly(),
|
|
248
|
+
'value': z.string().readonly().optional(),
|
|
249
|
+
})).readonly(),
|
|
250
|
+
})
|
|
251
|
+
const _deepseek_ai_dsh_mcp_manager_mcpManager_envSet_parameter_0$schema = z.object({
|
|
252
|
+
'vars': z.array(z.object({
|
|
253
|
+
'name': z.string().readonly(),
|
|
254
|
+
'secret': z.boolean().readonly().optional(),
|
|
255
|
+
'value': z.string().readonly().optional(),
|
|
256
|
+
})).readonly(),
|
|
257
|
+
})
|
|
258
|
+
const _deepseek_ai_dsh_mcp_manager_mcpManager_envSet_result$schema = z.union([z.object({
|
|
259
|
+
'ok': z.literal(true).readonly(),
|
|
260
|
+
'vars': z.array(z.object({
|
|
261
|
+
'name': z.string().readonly(),
|
|
262
|
+
'secret': z.boolean().readonly(),
|
|
263
|
+
'configured': z.boolean().readonly(),
|
|
264
|
+
'value': z.string().readonly().optional(),
|
|
265
|
+
})).readonly(),
|
|
266
|
+
}), z.object({
|
|
267
|
+
'ok': z.literal(false).readonly(),
|
|
268
|
+
'error': z.object({
|
|
269
|
+
'code': z.union([z.literal("MCP_INVALID_SPEC")]).readonly(),
|
|
270
|
+
'message': z.string().readonly(),
|
|
271
|
+
}).readonly(),
|
|
272
|
+
})])
|
|
177
273
|
|
|
178
274
|
export const TYPERT_REMOTE = {
|
|
179
275
|
package: '@deepseek-ai/dsh-mcp-manager',
|
|
@@ -268,6 +364,31 @@ export const TYPERT_REMOTE = {
|
|
|
268
364
|
},
|
|
269
365
|
sourceLocation: {"file":"packages/mcp/mcp-manager/src/index.ts","line":329,"column":9},
|
|
270
366
|
},
|
|
367
|
+
{
|
|
368
|
+
id: '@deepseek-ai/dsh-mcp-manager#mcpManager/upsertJson',
|
|
369
|
+
service: 'mcpManager',
|
|
370
|
+
namespace: 'mcpManager',
|
|
371
|
+
method: 'upsertJson',
|
|
372
|
+
invocation: { kind: 'direct' },
|
|
373
|
+
parameters: [
|
|
374
|
+
{
|
|
375
|
+
name: 'request',
|
|
376
|
+
wire: 'request',
|
|
377
|
+
source: 'json',
|
|
378
|
+
codec: {
|
|
379
|
+
mode: 'strict',
|
|
380
|
+
typeSymbol: '@deepseek-ai/dsh-mcp-manager/types#McpManagerUpsertJsonRequest',
|
|
381
|
+
schema: _deepseek_ai_dsh_mcp_manager_mcpManager_upsertJson_parameter_0$schema,
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
],
|
|
385
|
+
result: {
|
|
386
|
+
mode: 'strict',
|
|
387
|
+
typeSymbol: '@deepseek-ai/dsh-mcp-manager/types#McpManagerUpsertJsonResult',
|
|
388
|
+
schema: _deepseek_ai_dsh_mcp_manager_mcpManager_upsertJson_result$schema,
|
|
389
|
+
},
|
|
390
|
+
sourceLocation: {"file":"lib/index.js"},
|
|
391
|
+
},
|
|
271
392
|
{
|
|
272
393
|
id: '@deepseek-ai/dsh-mcp-manager#mcpManager/toolsList',
|
|
273
394
|
service: 'mcpManager',
|
|
@@ -333,6 +454,46 @@ export const TYPERT_REMOTE = {
|
|
|
333
454
|
},
|
|
334
455
|
sourceLocation: {"file":"lib/index.js"},
|
|
335
456
|
},
|
|
457
|
+
{
|
|
458
|
+
id: '@deepseek-ai/dsh-mcp-manager#mcpManager/envList',
|
|
459
|
+
service: 'mcpManager',
|
|
460
|
+
namespace: 'mcpManager',
|
|
461
|
+
method: 'envList',
|
|
462
|
+
invocation: { kind: 'direct' },
|
|
463
|
+
parameters: [
|
|
464
|
+
],
|
|
465
|
+
result: {
|
|
466
|
+
mode: 'strict',
|
|
467
|
+
typeSymbol: '@deepseek-ai/dsh-mcp-manager/types#McpManagerEnvListResult',
|
|
468
|
+
schema: _deepseek_ai_dsh_mcp_manager_mcpManager_envList_result$schema,
|
|
469
|
+
},
|
|
470
|
+
sourceLocation: {"file":"lib/index.js"},
|
|
471
|
+
},
|
|
472
|
+
{
|
|
473
|
+
id: '@deepseek-ai/dsh-mcp-manager#mcpManager/envSet',
|
|
474
|
+
service: 'mcpManager',
|
|
475
|
+
namespace: 'mcpManager',
|
|
476
|
+
method: 'envSet',
|
|
477
|
+
invocation: { kind: 'direct' },
|
|
478
|
+
parameters: [
|
|
479
|
+
{
|
|
480
|
+
name: 'request',
|
|
481
|
+
wire: 'request',
|
|
482
|
+
source: 'json',
|
|
483
|
+
codec: {
|
|
484
|
+
mode: 'strict',
|
|
485
|
+
typeSymbol: '@deepseek-ai/dsh-mcp-manager/types#McpManagerEnvSetRequest',
|
|
486
|
+
schema: _deepseek_ai_dsh_mcp_manager_mcpManager_envSet_parameter_0$schema,
|
|
487
|
+
},
|
|
488
|
+
},
|
|
489
|
+
],
|
|
490
|
+
result: {
|
|
491
|
+
mode: 'strict',
|
|
492
|
+
typeSymbol: '@deepseek-ai/dsh-mcp-manager/types#McpManagerEnvSetResult',
|
|
493
|
+
schema: _deepseek_ai_dsh_mcp_manager_mcpManager_envSet_result$schema,
|
|
494
|
+
},
|
|
495
|
+
sourceLocation: {"file":"lib/index.js"},
|
|
496
|
+
},
|
|
336
497
|
],
|
|
337
498
|
}
|
|
338
499
|
|
package/src/client/types.ts
CHANGED
|
@@ -52,6 +52,8 @@ export interface McpEnvVarView {
|
|
|
52
52
|
readonly name: string
|
|
53
53
|
readonly secret: boolean
|
|
54
54
|
readonly configured: boolean
|
|
55
|
+
/** Plain-text value of a non-secret env var (secret values never leave the Host). */
|
|
56
|
+
readonly value?: string
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
/** Lifecycle phase of one managed server's live mount. */
|