dsh-mcp-skills 0.2.1 → 0.2.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.
Files changed (2) hide show
  1. package/lib/index.js +36 -14
  2. package/package.json +5 -1
package/lib/index.js CHANGED
@@ -19,7 +19,7 @@ export const inject = []
19
19
 
20
20
  const SKILL_NAME = /^[a-z0-9]+(?:-[a-z0-9]+)*$/
21
21
  /** Kept in step with package.json (the smoke test reports it to the server). */
22
- const PLUGIN_VERSION = '0.2.1'
22
+ const PLUGIN_VERSION = '0.2.2'
23
23
  const MCP_CONFIG_FILENAME = 'mcp-servers.yaml'
24
24
  const MCP_PROFILE_ROW_PREFIX = 'mcp-'
25
25
  /** Same grammar as @deepseek-ai/dsh-mcp-client's SERVER_NAME_PATTERN. */
@@ -520,28 +520,50 @@ function scrubbedParentEnv() {
520
520
  * The MCP SDK is an optional peer dependency the host installation provides,
521
521
  * loaded on demand so a missing copy disables only the connection smoke test
522
522
  * instead of breaking the whole plugin at import time.
523
+ *
524
+ * The package was renamed across host releases, so both spellings are tried:
525
+ * `@modelcontextprotocol/client` (current) and `@modelcontextprotocol/sdk`
526
+ * (older). Both expose the same Client/transport API.
523
527
  */
524
528
  let mcpSdkPromise
525
529
  function loadMcpSdk() {
526
530
  if (mcpSdkPromise === undefined) {
527
- mcpSdkPromise = Promise.all([
528
- import('@modelcontextprotocol/sdk/client/index.js'),
529
- import('@modelcontextprotocol/sdk/client/stdio.js'),
530
- import('@modelcontextprotocol/sdk/client/streamableHttp.js'),
531
- ])
532
- .then(([index, stdio, streamableHttp]) => ({
533
- Client: index.Client,
534
- StdioClientTransport: stdio.StdioClientTransport,
535
- StreamableHTTPClientTransport: streamableHttp.StreamableHTTPClientTransport,
536
- }))
537
- .catch((error) => {
531
+ mcpSdkPromise = loadCurrentMcpSdk().catch((currentError) =>
532
+ loadLegacyMcpSdk().catch((legacyError) => {
538
533
  mcpSdkPromise = undefined // let a later call retry after a transient failure
539
- throw new ManageError('mcp-sdk-unavailable', `no MCP SDK in this installation: ${error instanceof Error ? error.message : String(error)}`)
540
- })
534
+ const reason = legacyError instanceof Error ? legacyError.message : String(legacyError)
535
+ const current = currentError instanceof Error ? currentError.message : String(currentError)
536
+ throw new ManageError('mcp-sdk-unavailable', `no MCP SDK in this installation (tried @modelcontextprotocol/client: ${current}; @modelcontextprotocol/sdk: ${reason})`)
537
+ }),
538
+ )
541
539
  }
542
540
  return mcpSdkPromise
543
541
  }
544
542
 
543
+ /** The current `@modelcontextprotocol/client` spelling. */
544
+ async function loadCurrentMcpSdk() {
545
+ const [main, stdio] = await Promise.all([import('@modelcontextprotocol/client'), import('@modelcontextprotocol/client/stdio')])
546
+ return {
547
+ Client: main.Client,
548
+ StdioClientTransport: stdio.StdioClientTransport,
549
+ StreamableHTTPClientTransport: main.StreamableHTTPClientTransport,
550
+ }
551
+ }
552
+
553
+ /** The older `@modelcontextprotocol/sdk` spelling. */
554
+ async function loadLegacyMcpSdk() {
555
+ const [index, stdio, streamableHttp] = await Promise.all([
556
+ import('@modelcontextprotocol/sdk/client/index.js'),
557
+ import('@modelcontextprotocol/sdk/client/stdio.js'),
558
+ import('@modelcontextprotocol/sdk/client/streamableHttp.js'),
559
+ ])
560
+ return {
561
+ Client: index.Client,
562
+ StdioClientTransport: stdio.StdioClientTransport,
563
+ StreamableHTTPClientTransport: streamableHttp.StreamableHTTPClientTransport,
564
+ }
565
+ }
566
+
545
567
  /** Connect to a server and list its tools (connection smoke test). */
546
568
  async function testMcpConnection(server) {
547
569
  const { Client, StdioClientTransport, StreamableHTTPClientTransport } = await loadMcpSdk()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-mcp-skills",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "DeepSeek Harness web plugin: settings pages for managing user skills and MCP servers",
5
5
  "type": "module",
6
6
  "repository": {
@@ -41,9 +41,13 @@
41
41
  "yaml": "^2.4.0"
42
42
  },
43
43
  "peerDependencies": {
44
+ "@modelcontextprotocol/client": "^2.0.0",
44
45
  "@modelcontextprotocol/sdk": "^1.30.0"
45
46
  },
46
47
  "peerDependenciesMeta": {
48
+ "@modelcontextprotocol/client": {
49
+ "optional": true
50
+ },
47
51
  "@modelcontextprotocol/sdk": {
48
52
  "optional": true
49
53
  }