@smithery/cli 1.0.1 → 1.0.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/README.md +1 -1
- package/dist/commands/inspect.js +9 -3
- package/dist/commands/install.js +2 -2
- package/dist/commands/installed.js +12 -6
- package/dist/commands/uninstall.js +12 -4
- package/dist/commands/view.js +9 -3
- package/dist/constants.js +1 -1
- package/dist/index.js +60 -56
- package/dist/utils/config-manager.js +27 -24
- package/dist/utils/registry-utils.js +1 -1
- package/dist/utils/server-actions.js +4 -4
- package/dist/utils/server-manager.js +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
package/dist/commands/inspect.js
CHANGED
|
@@ -3,14 +3,20 @@ import { createServerConnection, inspectServer, } from "../utils/server-inspecto
|
|
|
3
3
|
import { ConfigManager } from "../utils/config-manager.js";
|
|
4
4
|
import { createListChoices } from "../utils/server-display.js";
|
|
5
5
|
import inquirer from "inquirer";
|
|
6
|
-
|
|
6
|
+
import { VALID_CLIENTS } from "../constants.js";
|
|
7
|
+
export async function inspect(client) {
|
|
7
8
|
try {
|
|
8
|
-
|
|
9
|
+
// ensure client is valid
|
|
10
|
+
if (client && !VALID_CLIENTS.includes(client)) {
|
|
11
|
+
console.error(chalk.red(`Invalid client: ${client}\nValid clients are: ${VALID_CLIENTS.join(", ")}`));
|
|
12
|
+
process.exit(1);
|
|
13
|
+
}
|
|
14
|
+
const installedIds = ConfigManager.getInstalledServerIds(client);
|
|
9
15
|
if (installedIds.length === 0) {
|
|
10
16
|
console.log(chalk.yellow("\nNo MCP servers are currently installed."));
|
|
11
17
|
return;
|
|
12
18
|
}
|
|
13
|
-
const config = ConfigManager.readConfig();
|
|
19
|
+
const config = ConfigManager.readConfig(client);
|
|
14
20
|
while (true) {
|
|
15
21
|
const choices = createListChoices(installedIds.map((id) => ({
|
|
16
22
|
id,
|
package/dist/commands/install.js
CHANGED
|
@@ -16,6 +16,6 @@ export async function install(serverId, client) {
|
|
|
16
16
|
process.exit(1);
|
|
17
17
|
}
|
|
18
18
|
// install server using the serverManager instance
|
|
19
|
-
await serverManager.installServer(server);
|
|
20
|
-
console.log(chalk.green(`✓ Successfully installed package '${serverId}'`));
|
|
19
|
+
await serverManager.installServer(server, client);
|
|
20
|
+
console.log(chalk.green(`✓ Successfully installed package '${serverId}' for ${client}`));
|
|
21
21
|
}
|
|
@@ -5,10 +5,16 @@ import AutocompletePrompt from "inquirer-autocomplete-prompt";
|
|
|
5
5
|
import { handleServerAction } from "../utils/server-actions.js";
|
|
6
6
|
import { ConfigManager } from "../utils/config-manager.js";
|
|
7
7
|
import { displayServerDetails, printServerListHeader, createListChoices, } from "../utils/server-display.js";
|
|
8
|
+
import { VALID_CLIENTS } from "../constants.js";
|
|
8
9
|
inquirer.registerPrompt("autocomplete", AutocompletePrompt);
|
|
9
10
|
let installedServersCache = null;
|
|
10
|
-
export async function listInstalledServers() {
|
|
11
|
-
|
|
11
|
+
export async function listInstalledServers(client) {
|
|
12
|
+
// ensure client is valid
|
|
13
|
+
if (client && !VALID_CLIENTS.includes(client)) {
|
|
14
|
+
console.error(chalk.red(`Invalid client: ${client}\nValid clients are: ${VALID_CLIENTS.join(", ")}`));
|
|
15
|
+
process.exit(1);
|
|
16
|
+
}
|
|
17
|
+
const installedIds = ConfigManager.getInstalledServerIds(client);
|
|
12
18
|
if (installedIds.length === 0) {
|
|
13
19
|
console.log(chalk.yellow("\nNo MCP servers are currently installed."));
|
|
14
20
|
return;
|
|
@@ -16,7 +22,7 @@ export async function listInstalledServers() {
|
|
|
16
22
|
const denormalizedIds = installedIds.map((id) => ConfigManager.denormalizeServerId(id));
|
|
17
23
|
if (!installedServersCache ||
|
|
18
24
|
!areArraysEqual(denormalizedIds, installedServersCache.map((server) => server.id))) {
|
|
19
|
-
installedServersCache = await fetchServers(
|
|
25
|
+
installedServersCache = await fetchServers(client, denormalizedIds);
|
|
20
26
|
installedServersCache.forEach((server) => {
|
|
21
27
|
server.isInstalled = true;
|
|
22
28
|
});
|
|
@@ -34,9 +40,9 @@ export async function listInstalledServers() {
|
|
|
34
40
|
}
|
|
35
41
|
const action = await displayServerDetails(answer.selectedServer);
|
|
36
42
|
await handleServerAction(answer.selectedServer, action, {
|
|
37
|
-
onUninstall: () => listInstalledServers(),
|
|
38
|
-
onBack: listInstalledServers,
|
|
39
|
-
});
|
|
43
|
+
onUninstall: () => listInstalledServers(client),
|
|
44
|
+
onBack: () => listInstalledServers(client),
|
|
45
|
+
}, true, client);
|
|
40
46
|
}
|
|
41
47
|
function areArraysEqual(arr1, arr2) {
|
|
42
48
|
return (arr1.length === arr2.length &&
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import chalk from "chalk";
|
|
2
2
|
import inquirer from "inquirer";
|
|
3
3
|
import { ServerManager } from "../utils/server-manager.js";
|
|
4
|
+
import { VALID_CLIENTS } from "../constants.js";
|
|
4
5
|
const serverManager = new ServerManager();
|
|
5
|
-
export async function uninstall(serverId) {
|
|
6
|
+
export async function uninstall(serverId, client) {
|
|
6
7
|
try {
|
|
8
|
+
// ensure client is valid
|
|
9
|
+
if (client && !VALID_CLIENTS.includes(client)) {
|
|
10
|
+
console.error(chalk.red(`Invalid client: ${client}\nValid clients are: ${VALID_CLIENTS.join(", ")}`));
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
7
13
|
// If no server name provided, show error
|
|
8
14
|
if (!serverId) {
|
|
9
15
|
console.error(chalk.red("Error: Server ID is required"));
|
|
@@ -24,9 +30,11 @@ export async function uninstall(serverId) {
|
|
|
24
30
|
return;
|
|
25
31
|
}
|
|
26
32
|
// Perform uninstallation
|
|
27
|
-
await serverManager.uninstallServer(serverId);
|
|
28
|
-
console.log(chalk.green(`\nSuccessfully uninstalled ${serverId}`));
|
|
29
|
-
|
|
33
|
+
await serverManager.uninstallServer(serverId, client);
|
|
34
|
+
console.log(chalk.green(`\nSuccessfully uninstalled ${serverId} for ${client}`));
|
|
35
|
+
if (client === "claude") {
|
|
36
|
+
console.log(chalk.yellow("\nNote: Please restart Claude for the changes to take effect."));
|
|
37
|
+
}
|
|
30
38
|
}
|
|
31
39
|
catch (error) {
|
|
32
40
|
console.error(chalk.red("Failed to uninstall server:"));
|
package/dist/commands/view.js
CHANGED
|
@@ -2,15 +2,21 @@ import chalk from "chalk";
|
|
|
2
2
|
import { resolveServer } from "../utils/registry-utils.js";
|
|
3
3
|
import { handleServerAction } from "../utils/server-actions.js";
|
|
4
4
|
import { displayServerDetails } from "../utils/server-display.js";
|
|
5
|
-
|
|
5
|
+
import { VALID_CLIENTS } from "../constants.js";
|
|
6
|
+
export async function get(serverId, client) {
|
|
6
7
|
try {
|
|
7
|
-
|
|
8
|
+
// ensure client is valid
|
|
9
|
+
if (client && !VALID_CLIENTS.includes(client)) {
|
|
10
|
+
console.error(chalk.red(`Invalid client: ${client}\nValid clients are: ${VALID_CLIENTS.join(", ")}`));
|
|
11
|
+
process.exit(1);
|
|
12
|
+
}
|
|
13
|
+
const server = await resolveServer(serverId, client);
|
|
8
14
|
if (!server) {
|
|
9
15
|
console.log(chalk.yellow(`No server found with ID: ${serverId}`));
|
|
10
16
|
return;
|
|
11
17
|
}
|
|
12
18
|
const action = await displayServerDetails(server, false);
|
|
13
|
-
await handleServerAction(server, action, {});
|
|
19
|
+
await handleServerAction(server, action, {}, false, client);
|
|
14
20
|
}
|
|
15
21
|
catch (error) {
|
|
16
22
|
console.error(chalk.red("Error loading server:"));
|
package/dist/constants.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VALID_CLIENTS = ["claude"];
|
|
1
|
+
export const VALID_CLIENTS = ["claude", "cline"];
|