@smithery/cli 0.0.25 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,37 @@
1
+ import { ConfigManager } from "./config-manager.js";
2
+ import { getServerConfiguration } from "./registry-utils.js";
3
+ import { promptForRestart } from "./client-utils.js";
4
+ import { collectConfigValues } from "./runtime-utils.js";
5
+ export class ServerManager {
6
+ constructor(configManager = ConfigManager) {
7
+ this.configManager = configManager;
8
+ }
9
+ validateConnection(server) {
10
+ const connection = server.connections?.[0];
11
+ if (!connection) {
12
+ throw new Error("No connection configuration found");
13
+ }
14
+ return connection;
15
+ }
16
+ async installServer(server) {
17
+ const connection = this.validateConnection(server);
18
+ const values = await collectConfigValues(connection);
19
+ const serverConfig = await getServerConfiguration(server.id, values, connection.type);
20
+ if (!serverConfig) {
21
+ throw new Error(`Unable to fetch server configuration for server ${server.id}`);
22
+ }
23
+ await this.configManager.installServer(server.id, serverConfig, server.client);
24
+ await promptForRestart(server.client);
25
+ }
26
+ async uninstallServer(serverId, client) {
27
+ try {
28
+ await this.configManager.uninstallServer(serverId, client);
29
+ console.log(`\nUninstalled ${serverId}`);
30
+ await promptForRestart(client);
31
+ }
32
+ catch (error) {
33
+ console.error("Failed to uninstall server:", error);
34
+ throw error;
35
+ }
36
+ }
37
+ }
package/package.json CHANGED
@@ -1,56 +1,39 @@
1
1
  {
2
2
  "name": "@smithery/cli",
3
- "version": "0.0.25",
3
+ "version": "1.0.1",
4
4
  "type": "commonjs",
5
5
  "private": false,
6
6
  "homepage": "https://smithery.ai/",
7
- "description": "A NPX command to install and list Model Context Protocols",
7
+ "description": "A NPX command to install and list Model Context Protocols from Smithery",
8
8
  "main": "dist/index.js",
9
9
  "scripts": {
10
- "build": "node build.mjs && chmod +x dist/index.js",
10
+ "build": "tsc && node build.mjs && chmod +x dist/index.js",
11
11
  "start": "node dist/index.js",
12
12
  "test:list": "node --loader ts-node/esm src/index.ts list",
13
13
  "test:install": "node --loader ts-node/esm src/index.ts install",
14
14
  "test:installed": "node --loader ts-node/esm src/index.ts installed",
15
15
  "extract": "node --loader ts-node/esm src/extractors/modelcontextprotocol-extractor.ts",
16
16
  "test:uninstall": "node --loader ts-node/esm src/index.ts uninstall",
17
- "version:patch": "npm version patch",
18
- "version:minor": "npm version minor",
19
- "version:major": "npm version major",
20
- "publish:npm": "npm run build && npm publish --access public",
21
- "pr-check": "node src/scripts/pr-check.js",
22
- "test:watch": "NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.mjs --watch",
23
- "test:coverage": "NODE_OPTIONS=--experimental-vm-modules jest --config jest.config.mjs --coverage",
24
17
  "prepare": "npm run build",
25
- "lint": "npx @biomejs/biome lint --write",
26
- "format": "npx @biomejs/biome format --write"
18
+ "check": "npx @biomejs/biome check --write --unsafe"
27
19
  },
28
20
  "bin": {
29
21
  "cli": "dist/index.js"
30
22
  },
31
23
  "dependencies": {
32
- "@iarna/toml": "^2.2.5",
33
24
  "@modelcontextprotocol/sdk": "^1.0.3",
34
- "@types/iarna__toml": "^2.0.5",
35
25
  "chalk": "^4.1.2",
36
- "cli-table3": "^0.6.5",
37
- "fuzzy": "^0.1.3",
38
26
  "inquirer": "^8.2.4",
39
- "inquirer-autocomplete-prompt": "^2.0.0",
40
- "open": "^10.1.0",
41
- "string-width": "^4.2.3"
27
+ "inquirer-autocomplete-prompt": "^2.0.0"
42
28
  },
43
29
  "devDependencies": {
44
30
  "@biomejs/biome": "^1.5.3",
45
31
  "@types/inquirer": "^8.2.4",
46
32
  "@types/inquirer-autocomplete-prompt": "^3.0.3",
47
- "@types/jest": "^29.5.14",
48
33
  "@types/json-schema": "^7.0.15",
49
34
  "@types/node": "^14.0.0",
50
35
  "dotenv": "^16.4.7",
51
36
  "esbuild": "^0.24.0",
52
- "jest": "^29.7.0",
53
- "ts-jest": "^29.2.5",
54
37
  "ts-node": "^10.9.1",
55
38
  "tsx": "^4.19.2",
56
39
  "typescript": "^5.0.0"