mc8yp 1.0.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.
@@ -0,0 +1,21 @@
1
+ import { defineCommand, runCommand } from "citty";
2
+
3
+ //#region src/cli/subcommands/creds.ts
4
+ const command = defineCommand({
5
+ meta: {
6
+ name: "creds",
7
+ description: "Manage your Cumulocity credentials"
8
+ },
9
+ subCommands: {
10
+ add: () => import("./add-BnID18hd.mjs").then((m) => m.default),
11
+ remove: () => import("./remove-B-bSxaTt.mjs").then((m) => m.default),
12
+ list: () => import("./list-qI93mmZ-.mjs").then((m) => m.default)
13
+ },
14
+ run: async ({ rawArgs }) => {
15
+ await runCommand(await import("./add-BnID18hd.mjs").then((m) => m.default), { rawArgs });
16
+ }
17
+ });
18
+ var creds_default = command;
19
+
20
+ //#endregion
21
+ export { creds_default as default };
@@ -0,0 +1,31 @@
1
+ import { r as getStoredC8yAuth } from "./cli.mjs";
2
+ import { defineCommand } from "citty";
3
+ import consola from "consola";
4
+ import { exit } from "node:process";
5
+
6
+ //#region src/cli/subcommands/subcommands/list.ts
7
+ const command = defineCommand({
8
+ meta: {
9
+ name: "list",
10
+ description: "List stored Cumulocity credentials"
11
+ },
12
+ run: async () => {
13
+ try {
14
+ const creds = await getStoredC8yAuth();
15
+ if (!creds || creds.length === 0) {
16
+ consola.info("No credentials stored.");
17
+ exit();
18
+ }
19
+ consola.box("Stored credentials");
20
+ for (const c of creds) consola.log(`${c.tenantUrl} — ${c.user}`);
21
+ exit();
22
+ } catch (err) {
23
+ consola.error("Failed to list credentials:", err);
24
+ exit(1);
25
+ }
26
+ }
27
+ });
28
+ var list_default = command;
29
+
30
+ //#endregion
31
+ export { list_default as default };
@@ -0,0 +1,51 @@
1
+ import { n as deleteStoredC8yAuth, r as getStoredC8yAuth } from "./cli.mjs";
2
+ import { defineCommand } from "citty";
3
+ import consola from "consola";
4
+ import { exit } from "node:process";
5
+
6
+ //#region src/cli/subcommands/subcommands/remove.ts
7
+ const command = defineCommand({
8
+ meta: {
9
+ name: "remove",
10
+ description: "Remove stored Cumulocity credentials"
11
+ },
12
+ run: async () => {
13
+ try {
14
+ const creds = await getStoredC8yAuth();
15
+ if (!creds || creds.length === 0) {
16
+ consola.info("No credentials stored.");
17
+ exit();
18
+ }
19
+ const options = creds.map((c) => ({
20
+ value: c.tenantUrl,
21
+ label: `${c.tenantUrl} — ${c.user}`
22
+ }));
23
+ const selected = await consola.prompt("Select credentials to remove:", {
24
+ type: "multiselect",
25
+ options,
26
+ cancel: "reject"
27
+ });
28
+ if (!selected || Array.isArray(selected) && selected.length === 0) {
29
+ consola.info("Cancelled.");
30
+ exit();
31
+ }
32
+ const selections = Array.isArray(selected) ? selected : [selected];
33
+ let removed = 0;
34
+ for (const sel of selections) {
35
+ const tenantUrl = typeof sel === "string" ? sel : sel.value;
36
+ if (await deleteStoredC8yAuth(tenantUrl)) removed++;
37
+ else consola.warn(`Failed to remove credentials for: ${tenantUrl}`);
38
+ }
39
+ if (removed === 0) consola.info("No credentials were removed.");
40
+ else consola.success(`Removed ${removed} credential(s).`);
41
+ exit();
42
+ } catch (error) {
43
+ consola.error("Failed to remove credentials:", error);
44
+ exit(1);
45
+ }
46
+ }
47
+ });
48
+ var remove_default = command;
49
+
50
+ //#endregion
51
+ export { remove_default as default };
package/package.json ADDED
@@ -0,0 +1,70 @@
1
+ {
2
+ "name": "mc8yp",
3
+ "version": "1.0.0",
4
+ "type": "module",
5
+ "description": "Cumulocity IoT MCP Server - Model Context Protocol integration for IoT device management",
6
+ "keywords": [
7
+ "cumulocity",
8
+ "c8y",
9
+ "iot",
10
+ "mcp",
11
+ "model-context-protocol",
12
+ "cli"
13
+ ],
14
+ "license": "MIT",
15
+ "author": "schplitt",
16
+ "homepage": "https://github.com/schplitt/mc8yp#readme",
17
+ "repository": {
18
+ "type": "git",
19
+ "url": "https://github.com/schplitt/mc8yp.git"
20
+ },
21
+ "bugs": {
22
+ "url": "https://github.com/schplitt/mc8yp/issues"
23
+ },
24
+ "bin": {
25
+ "mc8yp": "./dist/cli.mjs"
26
+ },
27
+ "files": [
28
+ "LICENSE",
29
+ "README.md",
30
+ "dist"
31
+ ],
32
+ "dependencies": {
33
+ "@c8y/client": "^1023.12.0",
34
+ "@napi-rs/keyring": "^1.2.0",
35
+ "@schplitt/eslint-config": "^1.1.0",
36
+ "@tmcp/adapter-valibot": "^0.1.5",
37
+ "@tmcp/transport-http": "^0.8.3",
38
+ "@tmcp/transport-stdio": "^0.4.1",
39
+ "@toon-format/toon": "^2.1.0",
40
+ "bumpp": "^10.3.2",
41
+ "citty": "^0.1.6",
42
+ "consola": "^3.4.2",
43
+ "h3": "2.0.1-rc.6",
44
+ "tmcp": "^1.19.0",
45
+ "ufo": "^1.6.1",
46
+ "unctx": "^2.4.1",
47
+ "valibot": "^1.2.0"
48
+ },
49
+ "devDependencies": {
50
+ "@antfu/eslint-config": "^6.6.1",
51
+ "@types/node": "^22.19.2",
52
+ "eslint": "^9.39.1",
53
+ "tsdown": "^0.18.0",
54
+ "typescript": "^5.9.3"
55
+ },
56
+ "engines": {
57
+ "node": ">=20.0.0"
58
+ },
59
+ "scripts": {
60
+ "creds-add": "pnpm dlx jiti ./src/cli/index.ts creds add",
61
+ "creds-remove": "pnpm dlx jiti ./src/cli/index.ts creds remove",
62
+ "creds-list": "pnpm dlx jiti ./src/cli/index.ts creds list",
63
+ "build": "tsdown",
64
+ "lint": "eslint",
65
+ "lint:fix": "eslint --fix",
66
+ "typecheck": "tsc --noEmit",
67
+ "prerelease": "eslint && tsc --noEmit && pnpm build",
68
+ "release": "bumpp"
69
+ }
70
+ }