@cci-labs/mode-mcp 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.
package/dist/utils.js ADDED
@@ -0,0 +1,68 @@
1
+ import { ModeApiError } from "./mode-client.js";
2
+ export function formatError(e) {
3
+ if (e instanceof ModeApiError) {
4
+ const suggestion = e.suggestion ? `\n${e.suggestion}` : "";
5
+ return `${e.message}${suggestion}`;
6
+ }
7
+ return e instanceof Error ? e.message : String(e);
8
+ }
9
+ export function formatDate(d) {
10
+ if (!d)
11
+ return "N/A";
12
+ const s = String(d);
13
+ if (s.includes("T") || s.includes(" ")) {
14
+ return s.replace("T", " ").replace(/\.\d+Z?$/, "").replace(/Z$/, "");
15
+ }
16
+ return s;
17
+ }
18
+ export function formatBytes(bytes) {
19
+ if (bytes < 1024)
20
+ return `${bytes} B`;
21
+ if (bytes < 1024 * 1024)
22
+ return `${(bytes / 1024).toFixed(0)} KB`;
23
+ return `${(bytes / (1024 * 1024)).toFixed(1)} MB`;
24
+ }
25
+ /** Build a markdown table from headers and rows */
26
+ export function markdownTable(headers, rows) {
27
+ if (headers.length === 0 || rows.length === 0)
28
+ return "(no data)";
29
+ const sep = headers.map(() => "---").join(" | ");
30
+ const headerLine = headers.join(" | ");
31
+ const dataLines = rows.map((row) => headers.map((h) => row[h] ?? "").join(" | "));
32
+ return `| ${headerLine} |\n| ${sep} |\n` + dataLines.map((l) => `| ${l} |`).join("\n");
33
+ }
34
+ // Simple CSV parser that handles quoted fields
35
+ export function parseCSVLine(line) {
36
+ const result = [];
37
+ let current = "";
38
+ let inQuotes = false;
39
+ for (let i = 0; i < line.length; i++) {
40
+ const ch = line[i];
41
+ if (inQuotes) {
42
+ if (ch === '"') {
43
+ if (i + 1 < line.length && line[i + 1] === '"') {
44
+ current += '"';
45
+ i++;
46
+ }
47
+ else {
48
+ inQuotes = false;
49
+ }
50
+ }
51
+ else {
52
+ current += ch;
53
+ }
54
+ }
55
+ else if (ch === '"') {
56
+ inQuotes = true;
57
+ }
58
+ else if (ch === ",") {
59
+ result.push(current);
60
+ current = "";
61
+ }
62
+ else {
63
+ current += ch;
64
+ }
65
+ }
66
+ result.push(current);
67
+ return result;
68
+ }
package/package.json ADDED
@@ -0,0 +1,59 @@
1
+ {
2
+ "name": "@cci-labs/mode-mcp",
3
+ "version": "1.0.1",
4
+ "description": "MCP server for Mode Analytics — read-only report access and execution",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "files": [
8
+ "dist",
9
+ "!dist/__tests__"
10
+ ],
11
+ "bin": {
12
+ "mode-mcp": "./dist/index.js"
13
+ },
14
+ "engines": {
15
+ "node": ">=22"
16
+ },
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "start": "node dist/index.js",
20
+ "dev": "tsc --watch",
21
+ "lint": "tsc --noEmit && eslint src/",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest",
24
+ "prepare": "git config core.hooksPath .githooks 2>/dev/null || true",
25
+ "prepublishOnly": "npm run build && npm test"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/AwesomeCICD/mode-mcp.git"
30
+ },
31
+ "keywords": [
32
+ "mcp",
33
+ "mode",
34
+ "analytics"
35
+ ],
36
+ "author": "",
37
+ "license": "MIT",
38
+ "bugs": {
39
+ "url": "https://github.com/AwesomeCICD/mode-mcp/issues"
40
+ },
41
+ "homepage": "https://github.com/AwesomeCICD/mode-mcp#readme",
42
+ "dependencies": {
43
+ "@modelcontextprotocol/sdk": "^1.27.1",
44
+ "dotenv": "^17.3.1",
45
+ "zod": "^4.3.6"
46
+ },
47
+ "devDependencies": {
48
+ "@eslint/js": "^10.0.1",
49
+ "@semantic-release/changelog": "^6.0.3",
50
+ "@semantic-release/git": "^10.0.1",
51
+ "@types/node": "^25.4.0",
52
+ "@vitest/coverage-v8": "^4.1.0",
53
+ "eslint": "^10.0.3",
54
+ "semantic-release": "^25.0.3",
55
+ "typescript": "^5.9.3",
56
+ "typescript-eslint": "^8.57.0",
57
+ "vitest": "^4.0.18"
58
+ }
59
+ }