From 707d53555b2822034241b08d7933abba93fec748 Mon Sep 17 00:00:00 2001 From: Fernando Fernandes Date: Mon, 30 Mar 2026 17:41:12 +0200 Subject: [PATCH 1/3] Add minimal Xcode Cloud MCP server --- .gitignore | 5 + package-lock.json | 1899 ++++++++++++++++++++++++++++++++ package.json | 36 + src/api/auth.ts | 61 + src/api/base-client.ts | 76 ++ src/api/client.ts | 22 + src/api/resources/artifacts.ts | 78 ++ src/api/resources/builds.ts | 29 + src/api/resources/products.ts | 18 + src/api/resources/workflows.ts | 21 + src/api/types.ts | 117 ++ src/env.ts | 72 ++ src/index.ts | 47 + src/tools/build-runs.ts | 90 ++ src/tools/discovery.ts | 73 ++ src/tools/results.ts | 155 +++ src/tools/tests.ts | 150 +++ src/utils/build-locator.ts | 131 +++ src/utils/identifiers.ts | 15 + src/utils/log-analysis.ts | 161 +++ src/utils/tool-response.ts | 30 + tsconfig.json | 27 + 22 files changed, 3313 insertions(+) create mode 100644 .gitignore create mode 100644 package-lock.json create mode 100644 package.json create mode 100644 src/api/auth.ts create mode 100644 src/api/base-client.ts create mode 100644 src/api/client.ts create mode 100644 src/api/resources/artifacts.ts create mode 100644 src/api/resources/builds.ts create mode 100644 src/api/resources/products.ts create mode 100644 src/api/resources/workflows.ts create mode 100644 src/api/types.ts create mode 100644 src/env.ts create mode 100644 src/index.ts create mode 100644 src/tools/build-runs.ts create mode 100644 src/tools/discovery.ts create mode 100644 src/tools/results.ts create mode 100644 src/tools/tests.ts create mode 100644 src/utils/build-locator.ts create mode 100644 src/utils/identifiers.ts create mode 100644 src/utils/log-analysis.ts create mode 100644 src/utils/tool-response.ts create mode 100644 tsconfig.json diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e1fbe2b --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +node_modules +dist +.env +.DS_Store +coverage diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..67c7ca7 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,1899 @@ +{ + "name": "@thatfactory/xcode-cloud-mcp", + "version": "0.1.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "@thatfactory/xcode-cloud-mcp", + "version": "0.1.0", + "license": "MIT", + "dependencies": { + "@modelcontextprotocol/sdk": "^1.28.0", + "dotenv": "^17.3.1", + "fflate": "^0.8.2", + "jsonwebtoken": "^9.0.3", + "zod": "^4.3.6" + }, + "bin": { + "xcode-cloud-mcp": "dist/index.js" + }, + "devDependencies": { + "@types/jsonwebtoken": "^9.0.10", + "@types/node": "^24.10.1", + "tsx": "^4.21.0", + "typescript": "^6.0.2" + }, + "engines": { + "node": ">=20.0.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.27.4.tgz", + "integrity": "sha512-cQPwL2mp2nSmHHJlCyoXgHGhbEPMrEEU5xhkcy3Hs/O7nGZqEpZ2sUtLaL9MORLtDfRvVl2/3PAuEkYZH0Ty8Q==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.27.4.tgz", + "integrity": "sha512-X9bUgvxiC8CHAGKYufLIHGXPJWnr0OCdR0anD2e21vdvgCI8lIfqFbnoeOz7lBjdrAGUhqLZLcQo6MLhTO2DKQ==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.27.4.tgz", + "integrity": "sha512-gdLscB7v75wRfu7QSm/zg6Rx29VLdy9eTr2t44sfTW7CxwAtQghZ4ZnqHk3/ogz7xao0QAgrkradbBzcqFPasw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.27.4.tgz", + "integrity": "sha512-PzPFnBNVF292sfpfhiyiXCGSn9HZg5BcAz+ivBuSsl6Rk4ga1oEXAamhOXRFyMcjwr2DVtm40G65N3GLeH1Lvw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.27.4.tgz", + "integrity": "sha512-b7xaGIwdJlht8ZFCvMkpDN6uiSmnxxK56N2GDTMYPr2/gzvfdQN8rTfBsvVKmIVY/X7EM+/hJKEIbbHs9oA4tQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.27.4.tgz", + "integrity": "sha512-sR+OiKLwd15nmCdqpXMnuJ9W2kpy0KigzqScqHI3Hqwr7IXxBp3Yva+yJwoqh7rE8V77tdoheRYataNKL4QrPw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.27.4.tgz", + "integrity": "sha512-jnfpKe+p79tCnm4GVav68A7tUFeKQwQyLgESwEAUzyxk/TJr4QdGog9sqWNcUbr/bZt/O/HXouspuQDd9JxFSw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.27.4.tgz", + "integrity": "sha512-2kb4ceA/CpfUrIcTUl1wrP/9ad9Atrp5J94Lq69w7UwOMolPIGrfLSvAKJp0RTvkPPyn6CIWrNy13kyLikZRZQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.27.4.tgz", + "integrity": "sha512-aBYgcIxX/wd5n2ys0yESGeYMGF+pv6g0DhZr3G1ZG4jMfruU9Tl1i2Z+Wnj9/KjGz1lTLCcorqE2viePZqj4Eg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.27.4.tgz", + "integrity": "sha512-7nQOttdzVGth1iz57kxg9uCz57dxQLHWxopL6mYuYthohPKEK0vU0C3O21CcBK6KDlkYVcnDXY099HcCDXd9dA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.27.4.tgz", + "integrity": "sha512-oPtixtAIzgvzYcKBQM/qZ3R+9TEUd1aNJQu0HhGyqtx6oS7qTpvjheIWBbes4+qu1bNlo2V4cbkISr8q6gRBFA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.27.4.tgz", + "integrity": "sha512-8mL/vh8qeCoRcFH2nM8wm5uJP+ZcVYGGayMavi8GmRJjuI3g1v6Z7Ni0JJKAJW+m0EtUuARb6Lmp4hMjzCBWzA==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.27.4.tgz", + "integrity": "sha512-1RdrWFFiiLIW7LQq9Q2NES+HiD4NyT8Itj9AUeCl0IVCA459WnPhREKgwrpaIfTOe+/2rdntisegiPWn/r/aAw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.27.4.tgz", + "integrity": "sha512-tLCwNG47l3sd9lpfyx9LAGEGItCUeRCWeAx6x2Jmbav65nAwoPXfewtAdtbtit/pJFLUWOhpv0FpS6GQAmPrHA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.27.4.tgz", + "integrity": "sha512-BnASypppbUWyqjd1KIpU4AUBiIhVr6YlHx/cnPgqEkNoVOhHg+YiSVxM1RLfiy4t9cAulbRGTNCKOcqHrEQLIw==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.27.4.tgz", + "integrity": "sha512-+eUqgb/Z7vxVLezG8bVB9SfBie89gMueS+I0xYh2tJdw3vqA/0ImZJ2ROeWwVJN59ihBeZ7Tu92dF/5dy5FttA==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.27.4.tgz", + "integrity": "sha512-S5qOXrKV8BQEzJPVxAwnryi2+Iq5pB40gTEIT69BQONqR7JH1EPIcQ/Uiv9mCnn05jff9umq/5nqzxlqTOg9NA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.27.4.tgz", + "integrity": "sha512-xHT8X4sb0GS8qTqiwzHqpY00C95DPAq7nAwX35Ie/s+LO9830hrMd3oX0ZMKLvy7vsonee73x0lmcdOVXFzd6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.27.4.tgz", + "integrity": "sha512-RugOvOdXfdyi5Tyv40kgQnI0byv66BFgAqjdgtAKqHoZTbTF2QqfQrFwa7cHEORJf6X2ht+l9ABLMP0dnKYsgg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.27.4.tgz", + "integrity": "sha512-2MyL3IAaTX+1/qP0O1SwskwcwCoOI4kV2IBX1xYnDDqthmq5ArrW94qSIKCAuRraMgPOmG0RDTA74mzYNQA9ow==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.27.4.tgz", + "integrity": "sha512-u8fg/jQ5aQDfsnIV6+KwLOf1CmJnfu1ShpwqdwC0uA7ZPwFws55Ngc12vBdeUdnuWoQYx/SOQLGDcdlfXhYmXQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.27.4.tgz", + "integrity": "sha512-JkTZrl6VbyO8lDQO3yv26nNr2RM2yZzNrNHEsj9bm6dOwwu9OYN28CjzZkH57bh4w0I2F7IodpQvUAEd1mbWXg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.27.4.tgz", + "integrity": "sha512-/gOzgaewZJfeJTlsWhvUEmUG4tWEY2Spp5M20INYRg2ZKl9QPO3QEEgPeRtLjEWSW8FilRNacPOg8R1uaYkA6g==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.27.4.tgz", + "integrity": "sha512-Z9SExBg2y32smoDQdf1HRwHRt6vAHLXcxD2uGgO/v2jK7Y718Ix4ndsbNMU/+1Qiem9OiOdaqitioZwxivhXYg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.27.4.tgz", + "integrity": "sha512-DAyGLS0Jz5G5iixEbMHi5KdiApqHBWMGzTtMiJ72ZOLhbu/bzxgAe8Ue8CTS3n3HbIUHQz/L51yMdGMeoxXNJw==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.27.4.tgz", + "integrity": "sha512-+knoa0BDoeXgkNvvV1vvbZX4+hizelrkwmGJBdT17t8FNPwG2lKemmuMZlmaNQ3ws3DKKCxpb4zRZEIp3UxFCg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@hono/node-server": { + "version": "1.19.12", + "resolved": "https://registry.npmjs.org/@hono/node-server/-/node-server-1.19.12.tgz", + "integrity": "sha512-txsUW4SQ1iilgE0l9/e9VQWmELXifEFvmdA1j6WFh/aFPj99hIntrSsq/if0UWyGVkmrRPKA1wCeP+UCr1B9Uw==", + "license": "MIT", + "engines": { + "node": ">=18.14.1" + }, + "peerDependencies": { + "hono": "^4" + } + }, + "node_modules/@modelcontextprotocol/sdk": { + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@modelcontextprotocol/sdk/-/sdk-1.28.0.tgz", + "integrity": "sha512-gmloF+i+flI8ouQK7MWW4mOwuMh4RePBuPFAEPC6+pdqyWOUMDOixb6qZ69owLJpz6XmyllCouc4t8YWO+E2Nw==", + "license": "MIT", + "dependencies": { + "@hono/node-server": "^1.19.9", + "ajv": "^8.17.1", + "ajv-formats": "^3.0.1", + "content-type": "^1.0.5", + "cors": "^2.8.5", + "cross-spawn": "^7.0.5", + "eventsource": "^3.0.2", + "eventsource-parser": "^3.0.0", + "express": "^5.2.1", + "express-rate-limit": "^8.2.1", + "hono": "^4.11.4", + "jose": "^6.1.3", + "json-schema-typed": "^8.0.2", + "pkce-challenge": "^5.0.0", + "raw-body": "^3.0.0", + "zod": "^3.25 || ^4.0", + "zod-to-json-schema": "^3.25.1" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "@cfworker/json-schema": "^4.1.1", + "zod": "^3.25 || ^4.0" + }, + "peerDependenciesMeta": { + "@cfworker/json-schema": { + "optional": true + }, + "zod": { + "optional": false + } + } + }, + "node_modules/@types/jsonwebtoken": { + "version": "9.0.10", + "resolved": "https://registry.npmjs.org/@types/jsonwebtoken/-/jsonwebtoken-9.0.10.tgz", + "integrity": "sha512-asx5hIG9Qmf/1oStypjanR7iKTv0gXQ1Ov/jfrX6kS/EO0OFni8orbmGCn0672NHR3kXHwpAwR+B368ZGN/2rA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/ms": "*", + "@types/node": "*" + } + }, + "node_modules/@types/ms": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/@types/ms/-/ms-2.1.0.tgz", + "integrity": "sha512-GsCCIZDE/p3i96vtEqx+7dBUGXrc7zeSK3wwPHIaRThS+9OhWIXRqzs4d6k1SVU8g91DrNRWxWUGhp5KXQb2VA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/node": { + "version": "24.12.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.12.0.tgz", + "integrity": "sha512-GYDxsZi3ChgmckRT9HPU0WEhKLP08ev/Yfcq2AstjrDASOYCSXeyjDsHg4v5t4jOj7cyDX3vmprafKlWIG9MXQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/accepts": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/accepts/-/accepts-2.0.0.tgz", + "integrity": "sha512-5cvg6CtKwfgdmVqY1WIiXKc3Q1bkRqGLi+2W/6ao+6Y7gu/RCwRuAhGEzh5B4KlszSuTLgZYuqFqo5bImjNKng==", + "license": "MIT", + "dependencies": { + "mime-types": "^3.0.0", + "negotiator": "^1.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/ajv": { + "version": "8.18.0", + "resolved": "https://registry.npmjs.org/ajv/-/ajv-8.18.0.tgz", + "integrity": "sha512-PlXPeEWMXMZ7sPYOHqmDyCJzcfNrUr3fGNKtezX14ykXOEIvyK81d+qydx89KY5O71FKMPaQ2vBfBFI5NHR63A==", + "license": "MIT", + "dependencies": { + "fast-deep-equal": "^3.1.3", + "fast-uri": "^3.0.1", + "json-schema-traverse": "^1.0.0", + "require-from-string": "^2.0.2" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/epoberezkin" + } + }, + "node_modules/ajv-formats": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/ajv-formats/-/ajv-formats-3.0.1.tgz", + "integrity": "sha512-8iUql50EUR+uUcdRQ3HDqa6EVyo3docL8g5WJ3FNcWmu62IbkGUue/pEyLBW8VGKKucTPgqeks4fIU1DA4yowQ==", + "license": "MIT", + "dependencies": { + "ajv": "^8.0.0" + }, + "peerDependencies": { + "ajv": "^8.0.0" + }, + "peerDependenciesMeta": { + "ajv": { + "optional": true + } + } + }, + "node_modules/body-parser": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-2.2.2.tgz", + "integrity": "sha512-oP5VkATKlNwcgvxi0vM0p/D3n2C3EReYVX+DNYs5TjZFn/oQt2j+4sVJtSMr18pdRr8wjTcBl6LoV+FUwzPmNA==", + "license": "MIT", + "dependencies": { + "bytes": "^3.1.2", + "content-type": "^1.0.5", + "debug": "^4.4.3", + "http-errors": "^2.0.0", + "iconv-lite": "^0.7.0", + "on-finished": "^2.4.1", + "qs": "^6.14.1", + "raw-body": "^3.0.1", + "type-is": "^2.0.1" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/buffer-equal-constant-time": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/buffer-equal-constant-time/-/buffer-equal-constant-time-1.0.1.tgz", + "integrity": "sha512-zRpUiDwd/xk6ADqPMATG8vc9VPrkck7T07OIx0gnjmJAnHnTVXNQG3vfvWNuiZIkwu9KrKdA1iJKfsfTVxE6NA==", + "license": "BSD-3-Clause" + }, + "node_modules/bytes": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.2.tgz", + "integrity": "sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/call-bind-apply-helpers": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/call-bind-apply-helpers/-/call-bind-apply-helpers-1.0.2.tgz", + "integrity": "sha512-Sp1ablJ0ivDkSzjcaJdxEunN5/XvksFJ2sMBFfq6x0ryhQV/2b/KwFe21cMpmHtPOSij8K99/wSfoEuTObmuMQ==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/call-bound": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/call-bound/-/call-bound-1.0.4.tgz", + "integrity": "sha512-+ys997U96po4Kx/ABpBCqhA9EuxJaQWDQg7295H4hBphv3IZg0boBKuwYpt4YXp6MZ5AmZQnU/tyMTlRpaSejg==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "get-intrinsic": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/content-disposition": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-1.0.1.tgz", + "integrity": "sha512-oIXISMynqSqm241k6kcQ5UwttDILMK4BiurCfGEREw6+X9jkkpEe5T9FZaApyLGGOnFuyMWZpdolTXMtvEJ08Q==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/content-type": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.5.tgz", + "integrity": "sha512-nTjqfcBFEipKdXCv4YDQWCfmcLZKm81ldF0pAopTvyrFGVbcR6P/VAAd5G7N+0tTr8QqiU0tFadD6FK4NtJwOA==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.7.2.tgz", + "integrity": "sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/cookie-signature": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.2.2.tgz", + "integrity": "sha512-D76uU73ulSXrD1UXF4KE2TMxVVwhsnCgfAyTg9k8P6KGZjlXKrOLe4dJQKI3Bxi5wjesZoFXJWElNWBjPZMbhg==", + "license": "MIT", + "engines": { + "node": ">=6.6.0" + } + }, + "node_modules/cors": { + "version": "2.8.6", + "resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz", + "integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==", + "license": "MIT", + "dependencies": { + "object-assign": "^4", + "vary": "^1" + }, + "engines": { + "node": ">= 0.10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/cross-spawn": { + "version": "7.0.6", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.6.tgz", + "integrity": "sha512-uV2QOWP2nWzsy2aMp8aRibhi9dlzF5Hgh5SHaB9OiTGEyDTiJJyx0uy51QXdyWbtAHNua4XJzUKca3OzKUd3vA==", + "license": "MIT", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/depd": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/depd/-/depd-2.0.0.tgz", + "integrity": "sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/dotenv": { + "version": "17.3.1", + "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-17.3.1.tgz", + "integrity": "sha512-IO8C/dzEb6O3F9/twg6ZLXz164a2fhTnEWb95H23Dm4OuN+92NmEAlTrupP9VW6Jm3sO26tQlqyvyi4CsnY9GA==", + "license": "BSD-2-Clause", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://dotenvx.com" + } + }, + "node_modules/dunder-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", + "integrity": "sha512-KIN/nDJBQRcXw0MLVhZE9iQHmG68qAVIBg9CqmUYjmQIhgij9U5MFvrqkUL5FbtyyzZuOeOt0zdeRe4UY7ct+A==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.1", + "es-errors": "^1.3.0", + "gopd": "^1.2.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/ecdsa-sig-formatter": { + "version": "1.0.11", + "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", + "integrity": "sha512-nagl3RYrbNv6kQkeJIpt6NJZy8twLB/2vtz6yN9Z4vRKHN4/QZJIEbqohALSgwKdnksuY3k5Addp5lg8sVoVcQ==", + "license": "Apache-2.0", + "dependencies": { + "safe-buffer": "^5.0.1" + } + }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==", + "license": "MIT" + }, + "node_modules/encodeurl": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-2.0.0.tgz", + "integrity": "sha512-Q0n9HRi4m6JuGIV1eFlmvJB7ZEVxu93IrMyiMsGC0lrMJMWzRgx6WGquyfQgZVb31vhGgXnfmPNNXmxnOkRBrg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/es-define-property": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", + "integrity": "sha512-e3nRfgfUZ4rNGL232gUgX06QNyyez04KdjFrF+LTRoOXmrOgFKDg4BCdsjW8EnT69eqdYGmRpJwiPVYNrCaW3g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/es-object-atoms": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.1.1.tgz", + "integrity": "sha512-FGgH2h8zKNim9ljj7dankFPcICIK9Cp5bm+c2gQSYePhpaG5+esrLODihIorn+Pe6FGJzWhXQotPv73jTaldXA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.27.4", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.27.4.tgz", + "integrity": "sha512-Rq4vbHnYkK5fws5NF7MYTU68FPRE1ajX7heQ/8QXXWqNgqqJ/GkmmyxIzUnf2Sr/bakf8l54716CcMGHYhMrrQ==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.27.4", + "@esbuild/android-arm": "0.27.4", + "@esbuild/android-arm64": "0.27.4", + "@esbuild/android-x64": "0.27.4", + "@esbuild/darwin-arm64": "0.27.4", + "@esbuild/darwin-x64": "0.27.4", + "@esbuild/freebsd-arm64": "0.27.4", + "@esbuild/freebsd-x64": "0.27.4", + "@esbuild/linux-arm": "0.27.4", + "@esbuild/linux-arm64": "0.27.4", + "@esbuild/linux-ia32": "0.27.4", + "@esbuild/linux-loong64": "0.27.4", + "@esbuild/linux-mips64el": "0.27.4", + "@esbuild/linux-ppc64": "0.27.4", + "@esbuild/linux-riscv64": "0.27.4", + "@esbuild/linux-s390x": "0.27.4", + "@esbuild/linux-x64": "0.27.4", + "@esbuild/netbsd-arm64": "0.27.4", + "@esbuild/netbsd-x64": "0.27.4", + "@esbuild/openbsd-arm64": "0.27.4", + "@esbuild/openbsd-x64": "0.27.4", + "@esbuild/openharmony-arm64": "0.27.4", + "@esbuild/sunos-x64": "0.27.4", + "@esbuild/win32-arm64": "0.27.4", + "@esbuild/win32-ia32": "0.27.4", + "@esbuild/win32-x64": "0.27.4" + } + }, + "node_modules/escape-html": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz", + "integrity": "sha512-NiSupZ4OeuGwr68lGIeym/ksIZMJodUGOSCZ/FSnTxcrekbvqrgdUxlJOMpijaKZVjAJrWrGs/6Jy8OMuyj9ow==", + "license": "MIT" + }, + "node_modules/etag": { + "version": "1.8.1", + "resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz", + "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/eventsource": { + "version": "3.0.7", + "resolved": "https://registry.npmjs.org/eventsource/-/eventsource-3.0.7.tgz", + "integrity": "sha512-CRT1WTyuQoD771GW56XEZFQ/ZoSfWid1alKGDYMmkt2yl8UXrVR4pspqWNEcqKvVIzg6PAltWjxcSSPrboA4iA==", + "license": "MIT", + "dependencies": { + "eventsource-parser": "^3.0.1" + }, + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/eventsource-parser": { + "version": "3.0.6", + "resolved": "https://registry.npmjs.org/eventsource-parser/-/eventsource-parser-3.0.6.tgz", + "integrity": "sha512-Vo1ab+QXPzZ4tCa8SwIHJFaSzy4R6SHf7BY79rFBDf0idraZWAkYrDjDj8uWaSm3S2TK+hJ7/t1CEmZ7jXw+pg==", + "license": "MIT", + "engines": { + "node": ">=18.0.0" + } + }, + "node_modules/express": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/express/-/express-5.2.1.tgz", + "integrity": "sha512-hIS4idWWai69NezIdRt2xFVofaF4j+6INOpJlVOLDO8zXGpUVEVzIYk12UUi2JzjEzWL3IOAxcTubgz9Po0yXw==", + "license": "MIT", + "peer": true, + "dependencies": { + "accepts": "^2.0.0", + "body-parser": "^2.2.1", + "content-disposition": "^1.0.0", + "content-type": "^1.0.5", + "cookie": "^0.7.1", + "cookie-signature": "^1.2.1", + "debug": "^4.4.0", + "depd": "^2.0.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "finalhandler": "^2.1.0", + "fresh": "^2.0.0", + "http-errors": "^2.0.0", + "merge-descriptors": "^2.0.0", + "mime-types": "^3.0.0", + "on-finished": "^2.4.1", + "once": "^1.4.0", + "parseurl": "^1.3.3", + "proxy-addr": "^2.0.7", + "qs": "^6.14.0", + "range-parser": "^1.2.1", + "router": "^2.2.0", + "send": "^1.1.0", + "serve-static": "^2.2.0", + "statuses": "^2.0.1", + "type-is": "^2.0.1", + "vary": "^1.1.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/express-rate-limit": { + "version": "8.3.1", + "resolved": "https://registry.npmjs.org/express-rate-limit/-/express-rate-limit-8.3.1.tgz", + "integrity": "sha512-D1dKN+cmyPWuvB+G2SREQDzPY1agpBIcTa9sJxOPMCNeH3gwzhqJRDWCXW3gg0y//+LQ/8j52JbMROWyrKdMdw==", + "license": "MIT", + "dependencies": { + "ip-address": "10.1.0" + }, + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://github.com/sponsors/express-rate-limit" + }, + "peerDependencies": { + "express": ">= 4.11" + } + }, + "node_modules/fast-deep-equal": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "license": "MIT" + }, + "node_modules/fast-uri": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/fast-uri/-/fast-uri-3.1.0.tgz", + "integrity": "sha512-iPeeDKJSWf4IEOasVVrknXpaBV0IApz/gp7S2bb7Z4Lljbl2MGJRqInZiUrQwV16cpzw/D3S5j5Julj/gT52AA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/fastify" + }, + { + "type": "opencollective", + "url": "https://opencollective.com/fastify" + } + ], + "license": "BSD-3-Clause" + }, + "node_modules/fflate": { + "version": "0.8.2", + "resolved": "https://registry.npmjs.org/fflate/-/fflate-0.8.2.tgz", + "integrity": "sha512-cPJU47OaAoCbg0pBvzsgpTPhmhqI5eJjh/JIu8tPj5q+T7iLvW/JAYUqmE7KOB4R1ZyEhzBaIQpQpardBF5z8A==", + "license": "MIT" + }, + "node_modules/finalhandler": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-2.1.1.tgz", + "integrity": "sha512-S8KoZgRZN+a5rNwqTxlZZePjT/4cnm0ROV70LedRHZ0p8u9fRID0hJUZQpkKLzro8LfmC8sx23bY6tVNxv8pQA==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "on-finished": "^2.4.1", + "parseurl": "^1.3.3", + "statuses": "^2.0.1" + }, + "engines": { + "node": ">= 18.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/forwarded": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz", + "integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/fresh": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/fresh/-/fresh-2.0.0.tgz", + "integrity": "sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-intrinsic": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", + "integrity": "sha512-9fSjSaos/fRIVIp+xSJlE6lfwhES7LNtKaCBIamHsjr2na1BiABJPo0mOjjz8GJDURarmCPGqaiVg5mfjb98CQ==", + "license": "MIT", + "dependencies": { + "call-bind-apply-helpers": "^1.0.2", + "es-define-property": "^1.0.1", + "es-errors": "^1.3.0", + "es-object-atoms": "^1.1.1", + "function-bind": "^1.1.2", + "get-proto": "^1.0.1", + "gopd": "^1.2.0", + "has-symbols": "^1.1.0", + "hasown": "^2.0.2", + "math-intrinsics": "^1.1.0" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/get-proto": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/get-proto/-/get-proto-1.0.1.tgz", + "integrity": "sha512-sTSfBjoXBp89JvIKIefqw7U2CCebsc74kiY6awiGogKtoSGbgjYE/G/+l9sF3MWFPNc9IcoOC4ODfKHfxFmp0g==", + "license": "MIT", + "dependencies": { + "dunder-proto": "^1.0.1", + "es-object-atoms": "^1.0.0" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/get-tsconfig": { + "version": "4.13.7", + "resolved": "https://registry.npmjs.org/get-tsconfig/-/get-tsconfig-4.13.7.tgz", + "integrity": "sha512-7tN6rFgBlMgpBML5j8typ92BKFi2sFQvIdpAqLA2beia5avZDrMs0FLZiM5etShWq5irVyGcGMEA1jcDaK7A/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "resolve-pkg-maps": "^1.0.0" + }, + "funding": { + "url": "https://github.com/privatenumber/get-tsconfig?sponsor=1" + } + }, + "node_modules/gopd": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", + "integrity": "sha512-ZUKRh6/kUFoAiTAtTYPZJ3hw9wNxx+BIBOijnlG9PnrJsCcSjs1wyyD6vJpaYtgnzDrKYRSqf3OO6Rfa93xsRg==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/has-symbols": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.1.0.tgz", + "integrity": "sha512-1cDNdwJ2Jaohmb3sg4OmKaMBwuC48sYni5HUw2DvsC8LjGTLK9h+eb1X6RyuOHe4hT0ULCW68iomhjUoKUqlPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/hasown": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", + "integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==", + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/hono": { + "version": "4.12.9", + "resolved": "https://registry.npmjs.org/hono/-/hono-4.12.9.tgz", + "integrity": "sha512-wy3T8Zm2bsEvxKZM5w21VdHDDcwVS1yUFFY6i8UobSsKfFceT7TOwhbhfKsDyx7tYQlmRM5FLpIuYvNFyjctiA==", + "license": "MIT", + "peer": true, + "engines": { + "node": ">=16.9.0" + } + }, + "node_modules/http-errors": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/http-errors/-/http-errors-2.0.1.tgz", + "integrity": "sha512-4FbRdAX+bSdmo4AUFuS0WNiPz8NgFt+r8ThgNWmlrjQjt1Q7ZR9+zTlce2859x4KSXrwIsaeTqDoKQmtP8pLmQ==", + "license": "MIT", + "dependencies": { + "depd": "~2.0.0", + "inherits": "~2.0.4", + "setprototypeof": "~1.2.0", + "statuses": "~2.0.2", + "toidentifier": "~1.0.1" + }, + "engines": { + "node": ">= 0.8" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/iconv-lite": { + "version": "0.7.2", + "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.7.2.tgz", + "integrity": "sha512-im9DjEDQ55s9fL4EYzOAv0yMqmMBSZp6G0VvFyTMPKWxiSBHUj9NW/qqLmXUwXrrM7AvqSlTCfvqRb0cM8yYqw==", + "license": "MIT", + "dependencies": { + "safer-buffer": ">= 2.1.2 < 3.0.0" + }, + "engines": { + "node": ">=0.10.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==", + "license": "ISC" + }, + "node_modules/ip-address": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/ip-address/-/ip-address-10.1.0.tgz", + "integrity": "sha512-XXADHxXmvT9+CRxhXg56LJovE+bmWnEWB78LB83VZTprKTmaC5QfruXocxzTZ2Kl0DNwKuBdlIhjL8LeY8Sf8Q==", + "license": "MIT", + "engines": { + "node": ">= 12" + } + }, + "node_modules/ipaddr.js": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz", + "integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==", + "license": "MIT", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/is-promise": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-4.0.0.tgz", + "integrity": "sha512-hvpoI6korhJMnej285dSg6nu1+e6uxs7zG3BYAm5byqDsgJNWwxzM6z6iZiAgQR4TJ30JmBTOwqZUw3WlyH3AQ==", + "license": "MIT" + }, + "node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", + "license": "ISC" + }, + "node_modules/jose": { + "version": "6.2.2", + "resolved": "https://registry.npmjs.org/jose/-/jose-6.2.2.tgz", + "integrity": "sha512-d7kPDd34KO/YnzaDOlikGpOurfF0ByC2sEV4cANCtdqLlTfBlw2p14O/5d/zv40gJPbIQxfES3nSx1/oYNyuZQ==", + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/panva" + } + }, + "node_modules/json-schema-traverse": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-1.0.0.tgz", + "integrity": "sha512-NM8/P9n3XjXhIZn1lLhkFaACTOURQXjWhV4BA/RnOv8xvgqtqpAX9IO4mRQxSx1Rlo4tqzeqb0sOlruaOy3dug==", + "license": "MIT" + }, + "node_modules/json-schema-typed": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/json-schema-typed/-/json-schema-typed-8.0.2.tgz", + "integrity": "sha512-fQhoXdcvc3V28x7C7BMs4P5+kNlgUURe2jmUT1T//oBRMDrqy1QPelJimwZGo7Hg9VPV3EQV5Bnq4hbFy2vetA==", + "license": "BSD-2-Clause" + }, + "node_modules/jsonwebtoken": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/jsonwebtoken/-/jsonwebtoken-9.0.3.tgz", + "integrity": "sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==", + "license": "MIT", + "dependencies": { + "jws": "^4.0.1", + "lodash.includes": "^4.3.0", + "lodash.isboolean": "^3.0.3", + "lodash.isinteger": "^4.0.4", + "lodash.isnumber": "^3.0.3", + "lodash.isplainobject": "^4.0.6", + "lodash.isstring": "^4.0.1", + "lodash.once": "^4.0.0", + "ms": "^2.1.1", + "semver": "^7.5.4" + }, + "engines": { + "node": ">=12", + "npm": ">=6" + } + }, + "node_modules/jwa": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/jwa/-/jwa-2.0.1.tgz", + "integrity": "sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==", + "license": "MIT", + "dependencies": { + "buffer-equal-constant-time": "^1.0.1", + "ecdsa-sig-formatter": "1.0.11", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/jws": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/jws/-/jws-4.0.1.tgz", + "integrity": "sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==", + "license": "MIT", + "dependencies": { + "jwa": "^2.0.1", + "safe-buffer": "^5.0.1" + } + }, + "node_modules/lodash.includes": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.includes/-/lodash.includes-4.3.0.tgz", + "integrity": "sha512-W3Bx6mdkRTGtlJISOvVD/lbqjTlPPUDTMnlXZFnVwi9NKJ6tiAk6LVdlhZMm17VZisqhKcgzpO5Wz91PCt5b0w==", + "license": "MIT" + }, + "node_modules/lodash.isboolean": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isboolean/-/lodash.isboolean-3.0.3.tgz", + "integrity": "sha512-Bz5mupy2SVbPHURB98VAcw+aHh4vRV5IPNhILUCsOzRmsTmSQ17jIuqopAentWoehktxGd9e/hbIXq980/1QJg==", + "license": "MIT" + }, + "node_modules/lodash.isinteger": { + "version": "4.0.4", + "resolved": "https://registry.npmjs.org/lodash.isinteger/-/lodash.isinteger-4.0.4.tgz", + "integrity": "sha512-DBwtEWN2caHQ9/imiNeEA5ys1JoRtRfY3d7V9wkqtbycnAmTvRRmbHKDV4a0EYc678/dia0jrte4tjYwVBaZUA==", + "license": "MIT" + }, + "node_modules/lodash.isnumber": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/lodash.isnumber/-/lodash.isnumber-3.0.3.tgz", + "integrity": "sha512-QYqzpfwO3/CWf3XP+Z+tkQsfaLL/EnUlXWVkIk5FUPc4sBdTehEqZONuyRt2P67PXAk+NXmTBcc97zw9t1FQrw==", + "license": "MIT" + }, + "node_modules/lodash.isplainobject": { + "version": "4.0.6", + "resolved": "https://registry.npmjs.org/lodash.isplainobject/-/lodash.isplainobject-4.0.6.tgz", + "integrity": "sha512-oSXzaWypCMHkPC3NvBEaPHf0KsA5mvPrOPgQWDsbg8n7orZ290M0BmC/jgRZ4vcJ6DTAhjrsSYgdsW/F+MFOBA==", + "license": "MIT" + }, + "node_modules/lodash.isstring": { + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/lodash.isstring/-/lodash.isstring-4.0.1.tgz", + "integrity": "sha512-0wJxfxH1wgO3GrbuP+dTTk7op+6L41QCXbGINEmD+ny/G/eCqGzxyCsh7159S+mgDDcoarnBw6PC1PS5+wUGgw==", + "license": "MIT" + }, + "node_modules/lodash.once": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/lodash.once/-/lodash.once-4.1.1.tgz", + "integrity": "sha512-Sb487aTOCr9drQVL8pIxOzVhafOjZN9UU54hiN8PU3uAiSV7lx1yYNpbNmex2PK6dSJoNTSJUUswT651yww3Mg==", + "license": "MIT" + }, + "node_modules/math-intrinsics": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", + "integrity": "sha512-/IXtbwEk5HTPyEwyKX6hGkYXxM9nbj64B+ilVJnC/R6B0pH5G4V3b0pVbL7DBj4tkhBAppbQUlf6F6Xl9LHu1g==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/media-typer": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-1.1.0.tgz", + "integrity": "sha512-aisnrDP4GNe06UcKFnV5bfMNPBUw4jsLGaWwWfnH3v02GnBuXX2MCVn5RbrWo0j3pczUilYblq7fQ7Nw2t5XKw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/merge-descriptors": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-2.0.0.tgz", + "integrity": "sha512-Snk314V5ayFLhp3fkUREub6WtjBfPdCPY1Ln8/8munuLuiYhsABgBVWsozAG+MWMbVEvcdcpbi9R7ww22l9Q3g==", + "license": "MIT", + "engines": { + "node": ">=18" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/mime-db": { + "version": "1.54.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.54.0.tgz", + "integrity": "sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-3.0.2.tgz", + "integrity": "sha512-Lbgzdk0h4juoQ9fCKXW4by0UJqj+nOOrI9MJ1sSj4nI8aI2eo1qmvQEie4VD1glsS250n15LsWsYtCugiStS5A==", + "license": "MIT", + "dependencies": { + "mime-db": "^1.54.0" + }, + "engines": { + "node": ">=18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "license": "MIT" + }, + "node_modules/negotiator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/negotiator/-/negotiator-1.0.0.tgz", + "integrity": "sha512-8Ofs/AUQh8MaEcrlq5xOX0CQ9ypTF5dl78mjlMNfOK08fzpgTHQRQPBxcPlEtIw0yRpws+Zo/3r+5WRby7u3Gg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-inspect": { + "version": "1.13.4", + "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", + "integrity": "sha512-W67iLl4J2EXEGTbfeHCffrjDfitvLANg0UlX3wFUUSTx92KXRFegMHUVgSqE+wvhAbi4WqjGg9czysTV2Epbew==", + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "license": "MIT", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "license": "ISC", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/parseurl": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz", + "integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/path-to-regexp": { + "version": "8.4.0", + "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-8.4.0.tgz", + "integrity": "sha512-PuseHIvAnz3bjrM2rGJtSgo1zjgxapTLZ7x2pjhzWwlp4SJQgK3f3iZIQwkpEnBaKz6seKBADpM4B4ySkuYypg==", + "license": "MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/pkce-challenge": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/pkce-challenge/-/pkce-challenge-5.0.1.tgz", + "integrity": "sha512-wQ0b/W4Fr01qtpHlqSqspcj3EhBvimsdh0KlHhH8HRZnMsEa0ea2fTULOXOS9ccQr3om+GcGRk4e+isrZWV8qQ==", + "license": "MIT", + "engines": { + "node": ">=16.20.0" + } + }, + "node_modules/proxy-addr": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz", + "integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==", + "license": "MIT", + "dependencies": { + "forwarded": "0.2.0", + "ipaddr.js": "1.9.1" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/qs": { + "version": "6.15.0", + "resolved": "https://registry.npmjs.org/qs/-/qs-6.15.0.tgz", + "integrity": "sha512-mAZTtNCeetKMH+pSjrb76NAM8V9a05I9aBZOHztWy/UqcJdQYNsf59vrRKWnojAT9Y+GbIvoTBC++CPHqpDBhQ==", + "license": "BSD-3-Clause", + "dependencies": { + "side-channel": "^1.1.0" + }, + "engines": { + "node": ">=0.6" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/range-parser": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz", + "integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==", + "license": "MIT", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/raw-body": { + "version": "3.0.2", + "resolved": "https://registry.npmjs.org/raw-body/-/raw-body-3.0.2.tgz", + "integrity": "sha512-K5zQjDllxWkf7Z5xJdV0/B0WTNqx6vxG70zJE4N0kBs4LovmEYWJzQGxC9bS9RAKu3bgM40lrd5zoLJ12MQ5BA==", + "license": "MIT", + "dependencies": { + "bytes": "~3.1.2", + "http-errors": "~2.0.1", + "iconv-lite": "~0.7.0", + "unpipe": "~1.0.0" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/require-from-string": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/require-from-string/-/require-from-string-2.0.2.tgz", + "integrity": "sha512-Xf0nWe6RseziFMu+Ap9biiUbmplq6S9/p+7w7YXP/JBHhrUDDUhwa+vANyubuqfZWTveU//DYVGsDG7RKL/vEw==", + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/resolve-pkg-maps": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/resolve-pkg-maps/-/resolve-pkg-maps-1.0.0.tgz", + "integrity": "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/privatenumber/resolve-pkg-maps?sponsor=1" + } + }, + "node_modules/router": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/router/-/router-2.2.0.tgz", + "integrity": "sha512-nLTrUKm2UyiL7rlhapu/Zl45FwNgkZGaCpZbIHajDYgwlJCOzLSk+cIPAnsEqV955GjILJnKbdQC1nVPz+gAYQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.0", + "depd": "^2.0.0", + "is-promise": "^4.0.0", + "parseurl": "^1.3.3", + "path-to-regexp": "^8.0.0" + }, + "engines": { + "node": ">= 18" + } + }, + "node_modules/safe-buffer": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", + "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/safer-buffer": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", + "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", + "license": "MIT" + }, + "node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/send": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/send/-/send-1.2.1.tgz", + "integrity": "sha512-1gnZf7DFcoIcajTjTwjwuDjzuz4PPcY2StKPlsGAQ1+YH20IRVrBaXSWmdjowTJ6u8Rc01PoYOGHXfP1mYcZNQ==", + "license": "MIT", + "dependencies": { + "debug": "^4.4.3", + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "etag": "^1.8.1", + "fresh": "^2.0.0", + "http-errors": "^2.0.1", + "mime-types": "^3.0.2", + "ms": "^2.1.3", + "on-finished": "^2.4.1", + "range-parser": "^1.2.1", + "statuses": "^2.0.2" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/serve-static": { + "version": "2.2.1", + "resolved": "https://registry.npmjs.org/serve-static/-/serve-static-2.2.1.tgz", + "integrity": "sha512-xRXBn0pPqQTVQiC8wyQrKs2MOlX24zQ0POGaj0kultvoOCstBQM5yvOhAVSUwOMjQtTvsPWoNCHfPGwaaQJhTw==", + "license": "MIT", + "dependencies": { + "encodeurl": "^2.0.0", + "escape-html": "^1.0.3", + "parseurl": "^1.3.3", + "send": "^1.2.0" + }, + "engines": { + "node": ">= 18" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/express" + } + }, + "node_modules/setprototypeof": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz", + "integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw==", + "license": "ISC" + }, + "node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "license": "MIT", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "license": "MIT", + "engines": { + "node": ">=8" + } + }, + "node_modules/side-channel": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/side-channel/-/side-channel-1.1.0.tgz", + "integrity": "sha512-ZX99e6tRweoUXqR+VBrslhda51Nh5MTQwou5tnUDgbtyM0dBgmhEDtWGP/xbKn6hqfPRHujUNwz5fy/wbbhnpw==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3", + "side-channel-list": "^1.0.0", + "side-channel-map": "^1.0.1", + "side-channel-weakmap": "^1.0.2" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-list": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/side-channel-list/-/side-channel-list-1.0.0.tgz", + "integrity": "sha512-FCLHtRD/gnpCiCHEiJLOwdmFP+wzCmDEkc9y7NsYxeF4u7Btsn1ZuwgwJGxImImHicJArLP4R0yX4c2KCrMrTA==", + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-map": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/side-channel-map/-/side-channel-map-1.0.1.tgz", + "integrity": "sha512-VCjCNfgMsby3tTdo02nbjtM/ewra6jPHmpThenkTYh8pG9ucZ/1P8So4u4FGBek/BjpOVsDCMoLA/iuBKIFXRA==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/side-channel-weakmap": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/side-channel-weakmap/-/side-channel-weakmap-1.0.2.tgz", + "integrity": "sha512-WPS/HvHQTYnHisLo9McqBHOJk2FkHO/tlpvldyrnem4aeQp4hai3gythswg6p01oSoTl58rcpiFAjF2br2Ak2A==", + "license": "MIT", + "dependencies": { + "call-bound": "^1.0.2", + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.5", + "object-inspect": "^1.13.3", + "side-channel-map": "^1.0.1" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/statuses": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/statuses/-/statuses-2.0.2.tgz", + "integrity": "sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/toidentifier": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz", + "integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==", + "license": "MIT", + "engines": { + "node": ">=0.6" + } + }, + "node_modules/tsx": { + "version": "4.21.0", + "resolved": "https://registry.npmjs.org/tsx/-/tsx-4.21.0.tgz", + "integrity": "sha512-5C1sg4USs1lfG0GFb2RLXsdpXqBSEhAaA/0kPL01wxzpMqLILNxIxIOKiILz+cdg/pLnOUxFYOR5yhHU666wbw==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "~0.27.0", + "get-tsconfig": "^4.7.5" + }, + "bin": { + "tsx": "dist/cli.mjs" + }, + "engines": { + "node": ">=18.0.0" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + } + }, + "node_modules/type-is": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/type-is/-/type-is-2.0.1.tgz", + "integrity": "sha512-OZs6gsjF4vMp32qrCbiVSkrFmXtG/AZhY3t0iAMrMBiAZyV9oALtXO8hsrHbMXF9x6L3grlFuwW2oAz7cav+Gw==", + "license": "MIT", + "dependencies": { + "content-type": "^1.0.5", + "media-typer": "^1.1.0", + "mime-types": "^3.0.0" + }, + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/typescript": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/typescript/-/typescript-6.0.2.tgz", + "integrity": "sha512-bGdAIrZ0wiGDo5l8c++HWtbaNCWTS4UTv7RaTH/ThVIgjkveJt83m74bBHMJkuCbslY8ixgLBVZJIOiQlQTjfQ==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "tsc": "bin/tsc", + "tsserver": "bin/tsserver" + }, + "engines": { + "node": ">=14.17" + } + }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==", + "dev": true, + "license": "MIT" + }, + "node_modules/unpipe": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz", + "integrity": "sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/vary": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", + "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==", + "license": "MIT", + "engines": { + "node": ">= 0.8" + } + }, + "node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "license": "ISC", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==", + "license": "ISC" + }, + "node_modules/zod": { + "version": "4.3.6", + "resolved": "https://registry.npmjs.org/zod/-/zod-4.3.6.tgz", + "integrity": "sha512-rftlrkhHZOcjDwkGlnUtZZkvaPHCsDATp4pGpuOOMDaTdDDXF91wuVDJoWoPsKX/3YPQ5fHuF3STjcYyKr+Qhg==", + "license": "MIT", + "peer": true, + "funding": { + "url": "https://github.com/sponsors/colinhacks" + } + }, + "node_modules/zod-to-json-schema": { + "version": "3.25.2", + "resolved": "https://registry.npmjs.org/zod-to-json-schema/-/zod-to-json-schema-3.25.2.tgz", + "integrity": "sha512-O/PgfnpT1xKSDeQYSCfRI5Gy3hPf91mKVDuYLUHZJMiDFptvP41MSnWofm8dnCm0256ZNfZIM7DSzuSMAFnjHA==", + "license": "ISC", + "peerDependencies": { + "zod": "^3.25.28 || ^4" + } + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..5d62449 --- /dev/null +++ b/package.json @@ -0,0 +1,36 @@ +{ + "name": "@thatfactory/xcode-cloud-mcp", + "version": "0.1.0", + "description": "Minimal MCP server for discovering Xcode Cloud workflows and retrieving build logs, issues, and test artifacts.", + "license": "MIT", + "type": "module", + "main": "dist/index.js", + "files": [ + "dist" + ], + "bin": { + "xcode-cloud-mcp": "dist/index.js" + }, + "engines": { + "node": ">=20.0.0" + }, + "scripts": { + "build": "tsc -p tsconfig.json", + "clean": "rm -rf dist", + "prepack": "npm run clean && npm run build", + "test": "node --import tsx --test tests/**/*.test.ts" + }, + "dependencies": { + "@modelcontextprotocol/sdk": "^1.28.0", + "dotenv": "^17.3.1", + "fflate": "^0.8.2", + "jsonwebtoken": "^9.0.3", + "zod": "^4.3.6" + }, + "devDependencies": { + "@types/jsonwebtoken": "^9.0.10", + "@types/node": "^24.10.1", + "tsx": "^4.21.0", + "typescript": "^6.0.2" + } +} diff --git a/src/api/auth.ts b/src/api/auth.ts new file mode 100644 index 0000000..50dfb28 --- /dev/null +++ b/src/api/auth.ts @@ -0,0 +1,61 @@ +import jwt from 'jsonwebtoken'; + +export interface AuthConfig { + keyId: string; + issuerId: string; + privateKey: string; +} + +interface CachedToken { + token: string; + expiresAt: number; +} + +/** + * Generate and cache App Store Connect JWT credentials. + */ +export class AuthManager { + private readonly config: AuthConfig; + private cachedToken: CachedToken | null = null; + + constructor(config: AuthConfig) { + this.config = config; + } + + /** + * Return a valid token, reusing a cached token until close to expiration. + */ + getToken(): string { + const currentTimestamp = Math.floor(Date.now() / 1000); + + if (this.cachedToken && this.cachedToken.expiresAt > currentTimestamp + 60) { + return this.cachedToken.token; + } + + const expiresAt = currentTimestamp + 20 * 60; + const token = jwt.sign( + { + iss: this.config.issuerId, + iat: currentTimestamp, + exp: expiresAt, + aud: 'appstoreconnect-v1', + }, + this.config.privateKey, + { + algorithm: 'ES256', + header: { + alg: 'ES256', + kid: this.config.keyId, + typ: 'JWT', + }, + }, + ); + + this.cachedToken = { + token, + expiresAt, + }; + + return token; + } +} diff --git a/src/api/base-client.ts b/src/api/base-client.ts new file mode 100644 index 0000000..b3bda50 --- /dev/null +++ b/src/api/base-client.ts @@ -0,0 +1,76 @@ +import { AuthManager } from './auth.js'; +import type { APIErrorResponse, APIResponse } from './types.js'; + +const API_BASE_URL = 'https://api.appstoreconnect.apple.com'; + +/** + * Shared HTTP client for App Store Connect endpoints. + */ +export class BaseAPIClient { + protected readonly auth: AuthManager; + protected readonly baseUrl: string; + + constructor(auth: AuthManager, baseUrl: string = API_BASE_URL) { + this.auth = auth; + this.baseUrl = baseUrl; + } + + protected async get( + path: string, + params?: Record, + ): Promise> { + const url = new URL(path, this.baseUrl); + + for (const [key, value] of Object.entries(params ?? {})) { + url.searchParams.set(key, value); + } + + return this.request(url.toString()); + } + + protected async download(url: string): Promise { + const response = await fetch(url, { + headers: { + Authorization: `Bearer ${this.auth.getToken()}`, + }, + }); + + if (!response.ok) { + throw new Error( + `Failed to download artifact: ${response.status} ${response.statusText}`, + ); + } + + return new Uint8Array(await response.arrayBuffer()); + } + + private async request(url: string): Promise> { + const response = await fetch(url, { + headers: { + Authorization: `Bearer ${this.auth.getToken()}`, + 'Content-Type': 'application/json', + }, + }); + + const contentType = response.headers.get('content-type') ?? ''; + + if (!contentType.includes('application/json')) { + throw new Error( + `Unexpected response type from App Store Connect: ${contentType || 'unknown'}`, + ); + } + + const payload = (await response.json()) as APIResponse | APIErrorResponse; + + if (!response.ok) { + const apiErrorResponse = payload as APIErrorResponse; + const message = apiErrorResponse.errors + .map((error) => `${error.title}: ${error.detail}`) + .join('; '); + + throw new Error(`API Error (${response.status}): ${message}`); + } + + return payload as APIResponse; + } +} diff --git a/src/api/client.ts b/src/api/client.ts new file mode 100644 index 0000000..7aa6e66 --- /dev/null +++ b/src/api/client.ts @@ -0,0 +1,22 @@ +import { AuthManager } from './auth.js'; +import { ArtifactsClient } from './resources/artifacts.js'; +import { BuildsClient } from './resources/builds.js'; +import { ProductsClient } from './resources/products.js'; +import { WorkflowsClient } from './resources/workflows.js'; + +/** + * High-level App Store Connect client. + */ +export class AppStoreConnectClient { + readonly products: ProductsClient; + readonly workflows: WorkflowsClient; + readonly builds: BuildsClient; + readonly artifacts: ArtifactsClient; + + constructor(auth: AuthManager) { + this.products = new ProductsClient(auth); + this.workflows = new WorkflowsClient(auth); + this.builds = new BuildsClient(auth); + this.artifacts = new ArtifactsClient(auth); + } +} diff --git a/src/api/resources/artifacts.ts b/src/api/resources/artifacts.ts new file mode 100644 index 0000000..0adf972 --- /dev/null +++ b/src/api/resources/artifacts.ts @@ -0,0 +1,78 @@ +import { BaseAPIClient } from '../base-client.js'; +import type { CiArtifact } from '../types.js'; + +export interface GroupedArtifacts { + logs: CiArtifact[]; + archives: CiArtifact[]; + screenshots: CiArtifact[]; + videos: CiArtifact[]; + resultBundles: CiArtifact[]; + testProducts: CiArtifact[]; + other: CiArtifact[]; +} + +/** + * Artifact endpoints. + */ +export class ArtifactsClient extends BaseAPIClient { + /** + * List artifacts for a build run. + */ + async listForBuildRun(buildRunId: string): Promise { + const response = await this.get( + `/v1/ciBuildRuns/${buildRunId}/artifacts`, + ); + + return groupArtifactsByType(response.data); + } + + /** + * Download a build artifact. + */ + async downloadArtifact(downloadUrl: string): Promise { + return this.download(downloadUrl); + } +} + +/** + * Group artifacts by App Store Connect file type. + */ +export function groupArtifactsByType(artifacts: CiArtifact[]): GroupedArtifacts { + const groupedArtifacts: GroupedArtifacts = { + logs: [], + archives: [], + screenshots: [], + videos: [], + resultBundles: [], + testProducts: [], + other: [], + }; + + for (const artifact of artifacts) { + switch (artifact.attributes.fileType) { + case 'LOG': + groupedArtifacts.logs.push(artifact); + break; + case 'ARCHIVE': + case 'XCODEBUILD_ARCHIVE': + groupedArtifacts.archives.push(artifact); + break; + case 'SCREENSHOT': + groupedArtifacts.screenshots.push(artifact); + break; + case 'VIDEO': + groupedArtifacts.videos.push(artifact); + break; + case 'RESULT_BUNDLE': + groupedArtifacts.resultBundles.push(artifact); + break; + case 'TEST_PRODUCTS': + groupedArtifacts.testProducts.push(artifact); + break; + default: + groupedArtifacts.other.push(artifact); + } + } + + return groupedArtifacts; +} diff --git a/src/api/resources/builds.ts b/src/api/resources/builds.ts new file mode 100644 index 0000000..a672bd7 --- /dev/null +++ b/src/api/resources/builds.ts @@ -0,0 +1,29 @@ +import { BaseAPIClient } from '../base-client.js'; +import type { CiBuildRun } from '../types.js'; + +/** + * Build run endpoints. + */ +export class BuildsClient extends BaseAPIClient { + /** + * Get a build run by id. + */ + async getById(buildRunId: string): Promise { + const response = await this.get(`/v1/ciBuildRuns/${buildRunId}`); + return response.data; + } + + /** + * List recent build runs for a workflow. + */ + async listForWorkflow(workflowId: string, limit?: number): Promise { + const response = await this.get( + `/v1/ciWorkflows/${workflowId}/buildRuns`, + { + ...(limit ? { limit: String(limit) } : {}), + }, + ); + + return response.data; + } +} diff --git a/src/api/resources/products.ts b/src/api/resources/products.ts new file mode 100644 index 0000000..bbfdb5f --- /dev/null +++ b/src/api/resources/products.ts @@ -0,0 +1,18 @@ +import { BaseAPIClient } from '../base-client.js'; +import type { CiProduct } from '../types.js'; + +/** + * Product endpoints. + */ +export class ProductsClient extends BaseAPIClient { + /** + * List Xcode Cloud products. + */ + async list(limit?: number): Promise { + const response = await this.get('/v1/ciProducts', { + ...(limit ? { limit: String(limit) } : {}), + }); + + return response.data; + } +} diff --git a/src/api/resources/workflows.ts b/src/api/resources/workflows.ts new file mode 100644 index 0000000..49ead1a --- /dev/null +++ b/src/api/resources/workflows.ts @@ -0,0 +1,21 @@ +import { BaseAPIClient } from '../base-client.js'; +import type { CiWorkflow } from '../types.js'; + +/** + * Workflow endpoints. + */ +export class WorkflowsClient extends BaseAPIClient { + /** + * List workflows belonging to a product. + */ + async listForProduct(productId: string, limit?: number): Promise { + const response = await this.get( + `/v1/ciProducts/${productId}/workflows`, + { + ...(limit ? { limit: String(limit) } : {}), + }, + ); + + return response.data; + } +} diff --git a/src/api/types.ts b/src/api/types.ts new file mode 100644 index 0000000..aeea5c2 --- /dev/null +++ b/src/api/types.ts @@ -0,0 +1,117 @@ +/** + * App Store Connect API response envelope. + */ +export interface APIResponse { + data: TData; + links?: { + self?: string; + next?: string; + }; + meta?: { + paging?: { + total?: number; + limit?: number; + }; + }; +} + +/** + * App Store Connect API error response. + */ +export interface APIErrorResponse { + errors: Array<{ + status: string; + code: string; + title: string; + detail: string; + }>; +} + +/** + * Xcode Cloud product. + */ +export interface CiProduct { + type: 'ciProducts'; + id: string; + attributes: { + name: string; + createdDate: string; + productType: string; + }; +} + +/** + * Xcode Cloud workflow. + */ +export interface CiWorkflow { + type: 'ciWorkflows'; + id: string; + attributes: { + name: string; + description?: string; + isEnabled: boolean; + clean: boolean; + containerFilePath: string; + lastModifiedDate: string; + }; +} + +export interface CiIssueCounts { + analyzerWarnings: number; + errors: number; + testFailures: number; + warnings: number; +} + +/** + * Xcode Cloud build run. + */ +export interface CiBuildRun { + type: 'ciBuildRuns'; + id: string; + attributes: { + number: number; + createdDate: string; + startedDate?: string; + finishedDate?: string; + executionProgress: 'PENDING' | 'RUNNING' | 'COMPLETE'; + completionStatus?: 'SUCCEEDED' | 'FAILED' | 'ERRORED' | 'CANCELED'; + isPullRequestBuild: boolean; + issueCounts?: CiIssueCounts; + sourceCommit?: { + commitSha: string; + message?: string; + }; + }; + relationships?: { + workflow?: { + data: { + type: 'ciWorkflows'; + id: string; + }; + }; + }; +} + +export type CiArtifactFileType = + | 'LOG' + | 'ARCHIVE' + | 'XCODEBUILD_ARCHIVE' + | 'RESULT_BUNDLE' + | 'TEST_PRODUCTS' + | 'SCREENSHOT' + | 'VIDEO'; + +/** + * Xcode Cloud artifact. + */ +export interface CiArtifact { + type: 'ciArtifacts'; + id: string; + attributes: { + fileName: string; + fileType: CiArtifactFileType; + fileSize?: number; + downloadUrl?: string; + }; +} diff --git a/src/env.ts b/src/env.ts new file mode 100644 index 0000000..1ce0fa6 --- /dev/null +++ b/src/env.ts @@ -0,0 +1,72 @@ +import type { AuthConfig } from './api/auth.js'; + +const PRIMARY_ENV_NAMES = { + keyId: 'APPSTORE_CONNECT_API_KEY_ID', + issuerId: 'APPSTORE_CONNECT_API_ISSUER_ID', + privateKey: 'APPSTORE_CONNECT_API_KEY_CONTENT', +} as const; + +const ALIAS_ENV_NAMES = { + keyId: 'APP_STORE_KEY_ID', + issuerId: 'APP_STORE_ISSUER_ID', + privateKey: 'APP_STORE_PRIVATE_KEY', +} as const; + +export interface AppEnvironment extends AuthConfig {} + +/** + * Load and normalize App Store Connect credentials from the environment. + */ +export function loadEnvironment(env: NodeJS.ProcessEnv = process.env): AppEnvironment { + const keyId = readValue(env, PRIMARY_ENV_NAMES.keyId, ALIAS_ENV_NAMES.keyId); + const issuerId = readValue( + env, + PRIMARY_ENV_NAMES.issuerId, + ALIAS_ENV_NAMES.issuerId, + ); + const privateKey = readValue( + env, + PRIMARY_ENV_NAMES.privateKey, + ALIAS_ENV_NAMES.privateKey, + ); + + const missingNames = [ + !keyId + ? `${PRIMARY_ENV_NAMES.keyId} or ${ALIAS_ENV_NAMES.keyId}` + : null, + !issuerId + ? `${PRIMARY_ENV_NAMES.issuerId} or ${ALIAS_ENV_NAMES.issuerId}` + : null, + !privateKey + ? `${PRIMARY_ENV_NAMES.privateKey} or ${ALIAS_ENV_NAMES.privateKey}` + : null, + ].filter(Boolean); + + if (missingNames.length > 0) { + throw new Error( + `Missing required environment variables: ${missingNames.join(', ')}`, + ); + } + + if (!keyId || !issuerId || !privateKey) { + throw new Error('Environment validation failed unexpectedly.'); + } + + return { + keyId: normalizeValue(keyId), + issuerId: normalizeValue(issuerId), + privateKey: normalizeValue(privateKey).replace(/\\n/g, '\n'), + }; +} + +function readValue( + env: NodeJS.ProcessEnv, + primaryName: string, + aliasName: string, +): string | undefined { + return env[primaryName] ?? env[aliasName]; +} + +function normalizeValue(value: string): string { + return value.trim().replace(/^['"]|['"]$/g, ''); +} diff --git a/src/index.ts b/src/index.ts new file mode 100644 index 0000000..64cfc9f --- /dev/null +++ b/src/index.ts @@ -0,0 +1,47 @@ +#!/usr/bin/env node + +import 'dotenv/config'; + +import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; +import { AuthManager } from './api/auth.js'; +import { AppStoreConnectClient } from './api/client.js'; +import { loadEnvironment } from './env.js'; +import { registerBuildRunTools } from './tools/build-runs.js'; +import { registerDiscoveryTools } from './tools/discovery.js'; +import { registerResultTools } from './tools/results.js'; +import { registerTestTools } from './tools/tests.js'; + +/** + * Create and configure the MCP server. + */ +export function createServer(): McpServer { + const environment = loadEnvironment(); + const auth = new AuthManager(environment); + const client = new AppStoreConnectClient(auth); + + const server = new McpServer({ + name: 'Xcode Cloud MCP', + version: '0.1.0', + }); + + registerDiscoveryTools(server, client); + registerBuildRunTools(server, client); + registerResultTools(server, client); + registerTestTools(server, client); + + return server; +} + +async function main(): Promise { + const server = createServer(); + const transport = new StdioServerTransport(); + await server.connect(transport); + console.error('Xcode Cloud MCP server started successfully'); +} + +main().catch((error: unknown) => { + const message = error instanceof Error ? error.stack ?? error.message : String(error); + console.error(message); + process.exit(1); +}); diff --git a/src/tools/build-runs.ts b/src/tools/build-runs.ts new file mode 100644 index 0000000..37c00d5 --- /dev/null +++ b/src/tools/build-runs.ts @@ -0,0 +1,90 @@ +import { z } from 'zod'; +import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import type { AppStoreConnectClient } from '../api/client.js'; +import type { CiBuildRun } from '../api/types.js'; +import { parseIdentifier } from '../utils/identifiers.js'; +import { + isFailureStatus, + sortBuildRuns, +} from '../utils/build-locator.js'; +import { errorResponse, jsonResponse } from '../utils/tool-response.js'; + +type BuildRunStatusFilter = 'all' | 'failed' | 'succeeded'; + +/** + * Register build run listing tools. + */ +export function registerBuildRunTools( + server: McpServer, + client: AppStoreConnectClient, +): void { + server.registerTool( + 'list_build_runs', + { + description: + 'List recent build runs for a workflow, optionally filtered by outcome.', + inputSchema: { + workflowId: z.string(), + limit: z.number().int().positive().max(200).optional(), + status: z.enum(['all', 'failed', 'succeeded']).optional(), + }, + }, + async ({ + workflowId, + limit, + status, + }: { + workflowId: string; + limit?: number; + status?: BuildRunStatusFilter; + }) => { + try { + const buildRuns = sortBuildRuns( + await client.builds.listForWorkflow( + parseIdentifier(workflowId, 'workflow'), + limit ?? 20, + ), + ); + + return jsonResponse({ + buildRuns: filterBuildRuns(buildRuns, status ?? 'all').map( + (buildRun) => ({ + id: buildRun.id, + workflowId: + buildRun.relationships?.workflow?.data.id ?? + parseIdentifier(workflowId, 'workflow'), + number: buildRun.attributes.number, + executionProgress: buildRun.attributes.executionProgress, + completionStatus: buildRun.attributes.completionStatus, + createdDate: buildRun.attributes.createdDate, + startedDate: buildRun.attributes.startedDate, + finishedDate: buildRun.attributes.finishedDate, + issueCounts: buildRun.attributes.issueCounts, + }), + ), + }); + } catch (error) { + return errorResponse(error); + } + }, + ); +} + +function filterBuildRuns( + buildRuns: CiBuildRun[], + status: BuildRunStatusFilter, +): CiBuildRun[] { + if (status === 'all') { + return buildRuns; + } + + if (status === 'failed') { + return buildRuns.filter((buildRun) => + isFailureStatus(buildRun.attributes.completionStatus), + ); + } + + return buildRuns.filter( + (buildRun) => buildRun.attributes.completionStatus === 'SUCCEEDED', + ); +} diff --git a/src/tools/discovery.ts b/src/tools/discovery.ts new file mode 100644 index 0000000..5cdcac8 --- /dev/null +++ b/src/tools/discovery.ts @@ -0,0 +1,73 @@ +import { z } from 'zod'; +import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import type { AppStoreConnectClient } from '../api/client.js'; +import { parseIdentifier } from '../utils/identifiers.js'; +import { errorResponse, jsonResponse } from '../utils/tool-response.js'; + +/** + * Register discovery tools. + */ +export function registerDiscoveryTools( + server: McpServer, + client: AppStoreConnectClient, +): void { + server.registerTool( + 'list_products', + { + description: + 'List Xcode Cloud products available to the configured App Store Connect account.', + inputSchema: { + limit: z.number().int().positive().max(200).optional(), + }, + }, + async ({ limit }: { limit?: number }) => { + try { + const products = await client.products.list(limit); + + return jsonResponse({ + products: products.map((product) => ({ + id: product.id, + name: product.attributes.name, + productType: product.attributes.productType, + createdDate: product.attributes.createdDate, + })), + }); + } catch (error) { + return errorResponse(error); + } + }, + ); + + server.registerTool( + 'list_workflows', + { + description: 'List workflows for a given Xcode Cloud product.', + inputSchema: { + productId: z.string(), + limit: z.number().int().positive().max(200).optional(), + }, + }, + async ({ productId, limit }: { productId: string; limit?: number }) => { + try { + const workflows = await client.workflows.listForProduct( + parseIdentifier(productId, 'product'), + limit, + ); + + return jsonResponse({ + workflows: workflows.map((workflow) => ({ + id: workflow.id, + name: workflow.attributes.name, + description: workflow.attributes.description, + isEnabled: workflow.attributes.isEnabled, + clean: workflow.attributes.clean, + containerFilePath: workflow.attributes.containerFilePath, + lastModifiedDate: workflow.attributes.lastModifiedDate, + })), + }); + } catch (error) { + return errorResponse(error); + } + }, + ); +} diff --git a/src/tools/results.ts b/src/tools/results.ts new file mode 100644 index 0000000..d7a69fb --- /dev/null +++ b/src/tools/results.ts @@ -0,0 +1,155 @@ +import { z } from 'zod'; +import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import type { AppStoreConnectClient } from '../api/client.js'; +import type { CiArtifact } from '../api/types.js'; +import { + resolveBuildLocator, + type BuildSelector, +} from '../utils/build-locator.js'; +import { + extractTextFromArtifact, + summarizeLogTexts, +} from '../utils/log-analysis.js'; +import { errorResponse, jsonResponse } from '../utils/tool-response.js'; + +interface BuildLookupInput { + buildRunId?: string; + workflowId?: string; + buildNumber?: number; + buildSelector?: BuildSelector; +} + +/** + * Register build issue and log tools. + */ +export function registerResultTools( + server: McpServer, + client: AppStoreConnectClient, +): void { + server.registerTool( + 'get_build_issues', + { + description: + 'Resolve a build and return build identity plus issue counts from Xcode Cloud.', + inputSchema: buildLookupSchema(), + }, + async (input: BuildLookupInput) => { + try { + const buildRun = await resolveBuildLocator(client, input); + + return jsonResponse({ + buildRun: formatBuildRun(buildRun), + issueCounts: buildRun.attributes.issueCounts ?? defaultIssueCounts(), + }); + } catch (error) { + return errorResponse(error); + } + }, + ); + + server.registerTool( + 'get_build_logs', + { + description: + 'Resolve a build, download text-like log artifacts when possible, and summarize the most relevant errors and warnings.', + inputSchema: { + ...buildLookupSchema(), + maxCharacters: z.number().int().positive().max(100_000).optional(), + }, + }, + async (input: BuildLookupInput & { maxCharacters?: number }) => { + try { + const buildRun = await resolveBuildLocator(client, input); + const groupedArtifacts = await client.artifacts.listForBuildRun(buildRun.id); + const maxCharacters = input.maxCharacters ?? 8000; + const parsedLogTexts = await downloadLogTexts( + client, + groupedArtifacts.logs, + ); + const logSummary = summarizeLogTexts(parsedLogTexts, maxCharacters); + + return jsonResponse({ + buildRun: formatBuildRun(buildRun), + issueCounts: buildRun.attributes.issueCounts ?? defaultIssueCounts(), + artifacts: groupedArtifacts.logs.map(formatArtifact), + summary: logSummary.summary, + highlights: logSummary.highlights, + excerpt: logSummary.excerpt, + }); + } catch (error) { + return errorResponse(error); + } + }, + ); +} + +function buildLookupSchema() { + return { + buildRunId: z.string().optional(), + workflowId: z.string().optional(), + buildNumber: z.number().int().positive().optional(), + buildSelector: z.enum(['latest', 'latestFailing']).optional(), + }; +} + +function defaultIssueCounts() { + return { + analyzerWarnings: 0, + errors: 0, + testFailures: 0, + warnings: 0, + }; +} + +function formatBuildRun(buildRun: Awaited>) { + return { + id: buildRun.id, + workflowId: buildRun.relationships?.workflow?.data.id, + number: buildRun.attributes.number, + executionProgress: buildRun.attributes.executionProgress, + completionStatus: buildRun.attributes.completionStatus, + createdDate: buildRun.attributes.createdDate, + startedDate: buildRun.attributes.startedDate, + finishedDate: buildRun.attributes.finishedDate, + }; +} + +function formatArtifact(artifact: CiArtifact) { + return { + id: artifact.id, + fileName: artifact.attributes.fileName, + fileSize: artifact.attributes.fileSize, + downloadUrl: artifact.attributes.downloadUrl, + }; +} + +async function downloadLogTexts( + client: AppStoreConnectClient, + artifacts: CiArtifact[], +): Promise { + const parsedLogTexts: string[] = []; + + for (const artifact of artifacts) { + const downloadUrl = artifact.attributes.downloadUrl; + + if (!downloadUrl) { + continue; + } + + try { + const artifactBytes = await client.artifacts.downloadArtifact(downloadUrl); + const extractedText = extractTextFromArtifact( + artifact.attributes.fileName, + artifactBytes, + ); + + if (extractedText) { + parsedLogTexts.push(extractedText); + } + } catch { + continue; + } + } + + return parsedLogTexts; +} diff --git a/src/tools/tests.ts b/src/tools/tests.ts new file mode 100644 index 0000000..598a9de --- /dev/null +++ b/src/tools/tests.ts @@ -0,0 +1,150 @@ +import { z } from 'zod'; +import type { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'; +import type { AppStoreConnectClient } from '../api/client.js'; +import type { CiArtifact } from '../api/types.js'; +import { + resolveBuildLocator, + type BuildSelector, +} from '../utils/build-locator.js'; +import { + extractTextFromArtifact, + summarizeLogTexts, +} from '../utils/log-analysis.js'; +import { errorResponse, jsonResponse } from '../utils/tool-response.js'; + +interface BuildLookupInput { + buildRunId?: string; + workflowId?: string; + buildNumber?: number; + buildSelector?: BuildSelector; +} + +/** + * Register test summary and artifact tools. + */ +export function registerTestTools( + server: McpServer, + client: AppStoreConnectClient, +): void { + server.registerTool( + 'get_test_results', + { + description: + 'Resolve a build and return build-level test summary information plus result bundle metadata.', + inputSchema: buildLookupSchema(), + }, + async (input: BuildLookupInput) => { + try { + const buildRun = await resolveBuildLocator(client, input); + const groupedArtifacts = await client.artifacts.listForBuildRun(buildRun.id); + const parsedLogTexts = await downloadLogTexts( + client, + groupedArtifacts.logs, + ); + const logSummary = summarizeLogTexts(parsedLogTexts, 4000); + + return jsonResponse({ + buildRun: { + id: buildRun.id, + number: buildRun.attributes.number, + workflowId: buildRun.relationships?.workflow?.data.id, + completionStatus: buildRun.attributes.completionStatus, + }, + issueCounts: buildRun.attributes.issueCounts ?? { + analyzerWarnings: 0, + errors: 0, + testFailures: 0, + warnings: 0, + }, + resultBundles: groupedArtifacts.resultBundles.map(formatArtifact), + summary: { + parsedLogArtifactCount: logSummary.summary.parsedArtifactCount, + errorHighlightCount: logSummary.summary.errorHighlightCount, + warningHighlightCount: logSummary.summary.warningHighlightCount, + }, + highlights: logSummary.highlights, + }); + } catch (error) { + return errorResponse(error); + } + }, + ); + + server.registerTool( + 'get_test_artifacts', + { + description: + 'Resolve a build and return metadata plus download URLs for UI test artifacts and result bundles.', + inputSchema: buildLookupSchema(), + }, + async (input: BuildLookupInput) => { + try { + const buildRun = await resolveBuildLocator(client, input); + const groupedArtifacts = await client.artifacts.listForBuildRun(buildRun.id); + + return jsonResponse({ + buildRun: { + id: buildRun.id, + number: buildRun.attributes.number, + workflowId: buildRun.relationships?.workflow?.data.id, + }, + screenshots: groupedArtifacts.screenshots.map(formatArtifact), + videos: groupedArtifacts.videos.map(formatArtifact), + resultBundles: groupedArtifacts.resultBundles.map(formatArtifact), + testProducts: groupedArtifacts.testProducts.map(formatArtifact), + }); + } catch (error) { + return errorResponse(error); + } + }, + ); +} + +function buildLookupSchema() { + return { + buildRunId: z.string().optional(), + workflowId: z.string().optional(), + buildNumber: z.number().int().positive().optional(), + buildSelector: z.enum(['latest', 'latestFailing']).optional(), + }; +} + +function formatArtifact(artifact: CiArtifact) { + return { + id: artifact.id, + fileName: artifact.attributes.fileName, + fileSize: artifact.attributes.fileSize, + downloadUrl: artifact.attributes.downloadUrl, + }; +} + +async function downloadLogTexts( + client: AppStoreConnectClient, + artifacts: CiArtifact[], +): Promise { + const parsedLogTexts: string[] = []; + + for (const artifact of artifacts) { + const downloadUrl = artifact.attributes.downloadUrl; + + if (!downloadUrl) { + continue; + } + + try { + const artifactBytes = await client.artifacts.downloadArtifact(downloadUrl); + const extractedText = extractTextFromArtifact( + artifact.attributes.fileName, + artifactBytes, + ); + + if (extractedText) { + parsedLogTexts.push(extractedText); + } + } catch { + continue; + } + } + + return parsedLogTexts; +} diff --git a/src/utils/build-locator.ts b/src/utils/build-locator.ts new file mode 100644 index 0000000..8b46b6b --- /dev/null +++ b/src/utils/build-locator.ts @@ -0,0 +1,131 @@ +import type { AppStoreConnectClient } from '../api/client.js'; +import type { CiBuildRun } from '../api/types.js'; +import { parseIdentifier } from './identifiers.js'; + +export type BuildSelector = 'latest' | 'latestFailing'; + +export interface BuildLocatorInput { + buildRunId?: string; + workflowId?: string; + buildNumber?: number; + buildSelector?: BuildSelector; +} + +/** + * Validate the allowed build locator combinations. + */ +export function validateBuildLocator(input: BuildLocatorInput): BuildLocatorInput { + const hasBuildRunId = input.buildRunId !== undefined; + const hasWorkflowId = input.workflowId !== undefined; + const hasBuildNumber = input.buildNumber !== undefined; + const hasBuildSelector = input.buildSelector !== undefined; + + if (hasBuildRunId) { + if (hasWorkflowId || hasBuildNumber || hasBuildSelector) { + throw new Error( + 'Provide either buildRunId or workflowId with buildNumber/buildSelector, not both.', + ); + } + + return { + buildRunId: parseIdentifier(input.buildRunId!, 'build-run'), + }; + } + + if (!hasWorkflowId) { + throw new Error( + 'Provide buildRunId, or workflowId with buildNumber/buildSelector.', + ); + } + + if (hasBuildNumber === hasBuildSelector) { + throw new Error( + 'Provide exactly one of buildNumber or buildSelector when workflowId is used.', + ); + } + + return { + workflowId: parseIdentifier(input.workflowId!, 'workflow'), + ...(hasBuildNumber ? { buildNumber: input.buildNumber } : {}), + ...(hasBuildSelector ? { buildSelector: input.buildSelector } : {}), + }; +} + +/** + * Resolve a build locator into a concrete build run. + */ +export async function resolveBuildLocator( + client: AppStoreConnectClient, + input: BuildLocatorInput, +): Promise { + const locator = validateBuildLocator(input); + + if (locator.buildRunId) { + return client.builds.getById(locator.buildRunId); + } + + const buildRuns = sortBuildRuns( + await client.builds.listForWorkflow(locator.workflowId!, 100), + ); + + if (locator.buildNumber !== undefined) { + const matchingBuildRun = buildRuns.find( + (buildRun) => buildRun.attributes.number === locator.buildNumber, + ); + + if (!matchingBuildRun) { + throw new Error( + `No build run found for workflow ${locator.workflowId} with build number ${locator.buildNumber}.`, + ); + } + + return matchingBuildRun; + } + + if (locator.buildSelector === 'latestFailing') { + const latestFailingBuildRun = buildRuns.find((buildRun) => + isFailureStatus(buildRun.attributes.completionStatus), + ); + + if (!latestFailingBuildRun) { + throw new Error( + `No failing build runs found for workflow ${locator.workflowId}.`, + ); + } + + return latestFailingBuildRun; + } + + const latestBuildRun = buildRuns[0]; + + if (!latestBuildRun) { + throw new Error(`No build runs found for workflow ${locator.workflowId}.`); + } + + return latestBuildRun; +} + +/** + * Sort build runs from newest to oldest. + */ +export function sortBuildRuns(buildRuns: CiBuildRun[]): CiBuildRun[] { + return [...buildRuns].sort((leftBuildRun, rightBuildRun) => { + if (leftBuildRun.attributes.number !== rightBuildRun.attributes.number) { + return rightBuildRun.attributes.number - leftBuildRun.attributes.number; + } + + return ( + new Date(rightBuildRun.attributes.createdDate).getTime() - + new Date(leftBuildRun.attributes.createdDate).getTime() + ); + }); +} + +/** + * Return true when a completion status should be treated as failing. + */ +export function isFailureStatus( + status: CiBuildRun['attributes']['completionStatus'], +): boolean { + return status === 'FAILED' || status === 'ERRORED'; +} diff --git a/src/utils/identifiers.ts b/src/utils/identifiers.ts new file mode 100644 index 0000000..51b056c --- /dev/null +++ b/src/utils/identifiers.ts @@ -0,0 +1,15 @@ +/** + * Parse an identifier that may be a bare resource id or a xcode-cloud URI. + */ +export function parseIdentifier( + value: string, + prefix: 'product' | 'workflow' | 'build-run', +): string { + const uriPrefix = `xcode-cloud://${prefix}/`; + + if (value.startsWith(uriPrefix)) { + return value.slice(uriPrefix.length); + } + + return value; +} diff --git a/src/utils/log-analysis.ts b/src/utils/log-analysis.ts new file mode 100644 index 0000000..c40546d --- /dev/null +++ b/src/utils/log-analysis.ts @@ -0,0 +1,161 @@ +import { gunzipSync } from 'node:zlib'; +import { unzipSync } from 'fflate'; + +export interface LogSummary { + summary: { + parsedArtifactCount: number; + errorHighlightCount: number; + warningHighlightCount: number; + }; + highlights: string[]; + excerpt: string; +} + +/** + * Extract text from an artifact buffer when the artifact is text-like. + */ +export function extractTextFromArtifact( + fileName: string, + data: Uint8Array, +): string | null { + if (data.length === 0) { + return null; + } + + const lowercasedFileName = fileName.toLowerCase(); + + if (lowercasedFileName.endsWith('.gz')) { + return decodeTextBuffer(gunzipSync(data)); + } + + if (lowercasedFileName.endsWith('.zip')) { + const archiveEntries = unzipSync(data); + const extractedSections: string[] = []; + + for (const [entryName, entryData] of Object.entries(archiveEntries)) { + if (!isTextLikeFile(entryName) && !isProbablyText(entryData)) { + continue; + } + + const decodedEntry = decodeTextBuffer(entryData); + + if (!decodedEntry) { + continue; + } + + extractedSections.push(`===== ${entryName} =====\n${decodedEntry}`); + } + + return extractedSections.length > 0 ? extractedSections.join('\n\n') : null; + } + + if (!isTextLikeFile(lowercasedFileName) && !isProbablyText(data)) { + return null; + } + + return decodeTextBuffer(data); +} + +/** + * Summarize parsed log texts into highlights and an excerpt. + */ +export function summarizeLogTexts( + parsedLogTexts: string[], + maxCharacters: number, +): LogSummary { + const normalizedMaxCharacters = Math.max(500, maxCharacters); + const highlightSet = new Set(); + let warningHighlightCount = 0; + let errorHighlightCount = 0; + + for (const parsedLogText of parsedLogTexts) { + for (const line of parsedLogText.split(/\r?\n/)) { + const normalizedLine = line.trim(); + + if (!normalizedLine) { + continue; + } + + if (isErrorLine(normalizedLine)) { + errorHighlightCount += 1; + if (highlightSet.size < 20) { + highlightSet.add(normalizedLine); + } + continue; + } + + if (isWarningLine(normalizedLine)) { + warningHighlightCount += 1; + if (highlightSet.size < 20) { + highlightSet.add(normalizedLine); + } + } + } + } + + const combinedText = parsedLogTexts.join('\n\n'); + const excerpt = combinedText.slice(0, normalizedMaxCharacters); + + return { + summary: { + parsedArtifactCount: parsedLogTexts.length, + errorHighlightCount, + warningHighlightCount, + }, + highlights: [...highlightSet], + excerpt, + }; +} + +function decodeTextBuffer(buffer: Uint8Array): string | null { + try { + const decodedText = new TextDecoder('utf-8', { fatal: false }).decode(buffer); + const normalizedText = decodedText.replace(/\0/g, '').trim(); + return normalizedText.length > 0 ? normalizedText : null; + } catch { + return null; + } +} + +function isTextLikeFile(fileName: string): boolean { + return [ + '.log', + '.txt', + '.json', + '.xml', + '.xcresultsummary', + '.html', + '.md', + '.yml', + '.yaml', + ].some((extension) => fileName.endsWith(extension)); +} + +function isProbablyText(buffer: Uint8Array): boolean { + const inspectedBuffer = buffer.slice(0, 2048); + + if (inspectedBuffer.length === 0) { + return false; + } + + let suspiciousByteCount = 0; + + for (const value of inspectedBuffer) { + const isAllowedControlCharacter = value === 9 || value === 10 || value === 13; + const isPrintableCharacter = value >= 32 && value <= 126; + + if (!isAllowedControlCharacter && !isPrintableCharacter) { + suspiciousByteCount += 1; + } + } + + return suspiciousByteCount / inspectedBuffer.length < 0.15; +} + +function isErrorLine(line: string): boolean { + return /error:|fatal error|failed\b|test case .* failed|uncaught/i.test(line); +} + +function isWarningLine(line: string): boolean { + return /warning:/i.test(line); +} diff --git a/src/utils/tool-response.ts b/src/utils/tool-response.ts new file mode 100644 index 0000000..c3c46eb --- /dev/null +++ b/src/utils/tool-response.ts @@ -0,0 +1,30 @@ +/** + * Wrap a JSON payload into an MCP text response. + */ +export function jsonResponse(payload: unknown) { + return { + content: [ + { + type: 'text' as const, + text: JSON.stringify(payload, null, 2), + }, + ], + }; +} + +/** + * Wrap an error message into an MCP error response. + */ +export function errorResponse(error: unknown) { + const message = error instanceof Error ? error.message : String(error); + + return { + content: [ + { + type: 'text' as const, + text: `Error: ${message}`, + }, + ], + isError: true, + }; +} diff --git a/tsconfig.json b/tsconfig.json new file mode 100644 index 0000000..3da715d --- /dev/null +++ b/tsconfig.json @@ -0,0 +1,27 @@ +{ + "compilerOptions": { + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", + "outDir": "dist", + "rootDir": "src", + "strict": true, + "declaration": true, + "sourceMap": true, + "esModuleInterop": true, + "forceConsistentCasingInFileNames": true, + "skipLibCheck": true, + "noUncheckedIndexedAccess": true, + "noImplicitOverride": true, + "lib": [ + "ES2022", + "DOM" + ], + "types": [ + "node" + ] + }, + "include": [ + "src/**/*.ts" + ] +} From 82df18d7c7cff149fc6cf13685f76fbdb93ac29e Mon Sep 17 00:00:00 2001 From: Fernando Fernandes Date: Mon, 30 Mar 2026 17:41:21 +0200 Subject: [PATCH 2/3] Add tests and CI workflows --- .github/workflows/ci.yml | 34 +++++++ .github/workflows/nightly.yml | 32 +++++++ tests/artifacts.test.ts | 37 ++++++++ tests/build-locator.test.ts | 131 ++++++++++++++++++++++++++ tests/env.test.ts | 49 ++++++++++ tests/log-analysis.test.ts | 50 ++++++++++ tests/smoke.test.ts | 45 +++++++++ tests/tools.test.ts | 168 ++++++++++++++++++++++++++++++++++ 8 files changed, 546 insertions(+) create mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/nightly.yml create mode 100644 tests/artifacts.test.ts create mode 100644 tests/build-locator.test.ts create mode 100644 tests/env.test.ts create mode 100644 tests/log-analysis.test.ts create mode 100644 tests/smoke.test.ts create mode 100644 tests/tools.test.ts diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..0dc1823 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,34 @@ +--- +name: CI + +on: + push: + branches: + - main + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + name: Test + runs-on: [self-hosted, macOS] + steps: + - name: Checkout Repository + uses: actions/checkout@v6 + with: + clean: true + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install Dependencies + run: npm ci + + - name: Run Tests + run: npm test diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml new file mode 100644 index 0000000..de7f808 --- /dev/null +++ b/.github/workflows/nightly.yml @@ -0,0 +1,32 @@ +--- +name: Nightly Tests + +on: + schedule: + - cron: '0 4 * * *' + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + nightly_tests: + name: Nightly Tests + runs-on: [self-hosted, macOS] + steps: + - name: Checkout Repository + uses: actions/checkout@v6 + with: + clean: true + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 22 + cache: npm + + - name: Install Dependencies + run: npm ci + + - name: Run Tests + run: npm test diff --git a/tests/artifacts.test.ts b/tests/artifacts.test.ts new file mode 100644 index 0000000..fe27485 --- /dev/null +++ b/tests/artifacts.test.ts @@ -0,0 +1,37 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { groupArtifactsByType } from '../src/api/resources/artifacts.js'; +import type { CiArtifact } from '../src/api/types.js'; + +test('groupArtifactsByType classifies known artifact types', () => { + const groupedArtifacts = groupArtifactsByType([ + createArtifact('1', 'LOG'), + createArtifact('2', 'SCREENSHOT'), + createArtifact('3', 'VIDEO'), + createArtifact('4', 'RESULT_BUNDLE'), + createArtifact('5', 'TEST_PRODUCTS'), + createArtifact('6', 'ARCHIVE'), + ]); + + assert.equal(groupedArtifacts.logs.length, 1); + assert.equal(groupedArtifacts.screenshots.length, 1); + assert.equal(groupedArtifacts.videos.length, 1); + assert.equal(groupedArtifacts.resultBundles.length, 1); + assert.equal(groupedArtifacts.testProducts.length, 1); + assert.equal(groupedArtifacts.archives.length, 1); +}); + +function createArtifact( + id: string, + fileType: CiArtifact['attributes']['fileType'], +): CiArtifact { + return { + id, + type: 'ciArtifacts', + attributes: { + fileName: `${id}.txt`, + fileType, + downloadUrl: `https://example.com/${id}`, + }, + }; +} diff --git a/tests/build-locator.test.ts b/tests/build-locator.test.ts new file mode 100644 index 0000000..4b23961 --- /dev/null +++ b/tests/build-locator.test.ts @@ -0,0 +1,131 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { + isFailureStatus, + resolveBuildLocator, + sortBuildRuns, + validateBuildLocator, +} from '../src/utils/build-locator.js'; +import type { AppStoreConnectClient } from '../src/api/client.js'; +import type { CiBuildRun } from '../src/api/types.js'; + +const buildRuns: CiBuildRun[] = [ + createBuildRun('run-1', 1, 'SUCCEEDED', '2026-03-30T09:00:00Z'), + createBuildRun('run-2', 2, 'FAILED', '2026-03-30T10:00:00Z'), + createBuildRun('run-3', 3, 'ERRORED', '2026-03-30T11:00:00Z'), +]; + +test('validateBuildLocator accepts buildRunId only', () => { + const locator = validateBuildLocator({ + buildRunId: 'xcode-cloud://build-run/run-123', + }); + + assert.deepEqual(locator, { + buildRunId: 'run-123', + }); +}); + +test('validateBuildLocator accepts workflowId with build number', () => { + const locator = validateBuildLocator({ + workflowId: 'xcode-cloud://workflow/wf-1', + buildNumber: 42, + }); + + assert.deepEqual(locator, { + workflowId: 'wf-1', + buildNumber: 42, + }); +}); + +test('validateBuildLocator rejects mixed lookup modes', () => { + assert.throws( + () => + validateBuildLocator({ + buildRunId: 'run-1', + workflowId: 'wf-1', + }), + { + message: + 'Provide either buildRunId or workflowId with buildNumber/buildSelector, not both.', + }, + ); +}); + +test('sortBuildRuns returns newest build first', () => { + assert.deepEqual( + sortBuildRuns(buildRuns).map((buildRun) => buildRun.id), + ['run-3', 'run-2', 'run-1'], + ); +}); + +test('resolveBuildLocator resolves a concrete build number', async () => { + const client = createClientMock(); + + const buildRun = await resolveBuildLocator(client, { + workflowId: 'wf-1', + buildNumber: 2, + }); + + assert.equal(buildRun.id, 'run-2'); +}); + +test('resolveBuildLocator resolves latest failing build', async () => { + const client = createClientMock(); + + const buildRun = await resolveBuildLocator(client, { + workflowId: 'wf-1', + buildSelector: 'latestFailing', + }); + + assert.equal(buildRun.id, 'run-3'); +}); + +test('isFailureStatus matches failed and errored runs only', () => { + assert.equal(isFailureStatus('FAILED'), true); + assert.equal(isFailureStatus('ERRORED'), true); + assert.equal(isFailureStatus('SUCCEEDED'), false); + assert.equal(isFailureStatus('CANCELED'), false); +}); + +function createClientMock(): AppStoreConnectClient { + return { + builds: { + getById: async (buildRunId: string) => + buildRuns.find((buildRun) => buildRun.id === buildRunId)!, + listForWorkflow: async () => buildRuns, + }, + } as unknown as AppStoreConnectClient; +} + +function createBuildRun( + id: string, + number: number, + completionStatus: CiBuildRun['attributes']['completionStatus'], + createdDate: string, +): CiBuildRun { + return { + id, + type: 'ciBuildRuns', + attributes: { + number, + createdDate, + executionProgress: 'COMPLETE', + completionStatus, + isPullRequestBuild: false, + issueCounts: { + analyzerWarnings: 0, + errors: completionStatus === 'SUCCEEDED' ? 0 : 1, + testFailures: completionStatus === 'SUCCEEDED' ? 0 : 2, + warnings: 1, + }, + }, + relationships: { + workflow: { + data: { + type: 'ciWorkflows', + id: 'wf-1', + }, + }, + }, + }; +} diff --git a/tests/env.test.ts b/tests/env.test.ts new file mode 100644 index 0000000..ea1111b --- /dev/null +++ b/tests/env.test.ts @@ -0,0 +1,49 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { loadEnvironment } from '../src/env.js'; + +test('loadEnvironment reads primary env names', () => { + const environment = loadEnvironment({ + APPSTORE_CONNECT_API_KEY_ID: 'key-id', + APPSTORE_CONNECT_API_ISSUER_ID: 'issuer-id', + APPSTORE_CONNECT_API_KEY_CONTENT: '"line-one\\nline-two"', + }); + + assert.equal(environment.keyId, 'key-id'); + assert.equal(environment.issuerId, 'issuer-id'); + assert.equal(environment.privateKey, 'line-one\nline-two'); +}); + +test('loadEnvironment falls back to alias names', () => { + const environment = loadEnvironment({ + APP_STORE_KEY_ID: 'alias-key', + APP_STORE_ISSUER_ID: 'alias-issuer', + APP_STORE_PRIVATE_KEY: 'alias-private-key', + }); + + assert.equal(environment.keyId, 'alias-key'); + assert.equal(environment.issuerId, 'alias-issuer'); + assert.equal(environment.privateKey, 'alias-private-key'); +}); + +test('loadEnvironment prefers primary values over aliases', () => { + const environment = loadEnvironment({ + APPSTORE_CONNECT_API_KEY_ID: 'primary-key', + APP_STORE_KEY_ID: 'alias-key', + APPSTORE_CONNECT_API_ISSUER_ID: 'primary-issuer', + APP_STORE_ISSUER_ID: 'alias-issuer', + APPSTORE_CONNECT_API_KEY_CONTENT: 'primary-key-content', + APP_STORE_PRIVATE_KEY: 'alias-key-content', + }); + + assert.equal(environment.keyId, 'primary-key'); + assert.equal(environment.issuerId, 'primary-issuer'); + assert.equal(environment.privateKey, 'primary-key-content'); +}); + +test('loadEnvironment throws a clear error when values are missing', () => { + assert.throws(() => loadEnvironment({}), { + message: + 'Missing required environment variables: APPSTORE_CONNECT_API_KEY_ID or APP_STORE_KEY_ID, APPSTORE_CONNECT_API_ISSUER_ID or APP_STORE_ISSUER_ID, APPSTORE_CONNECT_API_KEY_CONTENT or APP_STORE_PRIVATE_KEY', + }); +}); diff --git a/tests/log-analysis.test.ts b/tests/log-analysis.test.ts new file mode 100644 index 0000000..85b9293 --- /dev/null +++ b/tests/log-analysis.test.ts @@ -0,0 +1,50 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { gzipSync } from 'node:zlib'; +import { zipSync } from 'fflate'; +import { + extractTextFromArtifact, + summarizeLogTexts, +} from '../src/utils/log-analysis.js'; + +test('extractTextFromArtifact reads plain text', () => { + const text = extractTextFromArtifact( + 'build.log', + new TextEncoder().encode('warning: something\nerror: broken'), + ); + + assert.equal(text, 'warning: something\nerror: broken'); +}); + +test('extractTextFromArtifact reads gzip content', () => { + const text = extractTextFromArtifact( + 'build.log.gz', + gzipSync('warning: compressed'), + ); + + assert.equal(text, 'warning: compressed'); +}); + +test('extractTextFromArtifact reads zip content', () => { + const text = extractTextFromArtifact( + 'logs.zip', + zipSync({ + 'a.log': new TextEncoder().encode('error: zipped failure'), + 'b.bin': new Uint8Array([0, 1, 2, 3]), + }), + ); + + assert.match(text ?? '', /error: zipped failure/); +}); + +test('summarizeLogTexts counts warnings and errors', () => { + const summary = summarizeLogTexts( + ['warning: watch out\nerror: broken\ntest case Example failed'], + 2000, + ); + + assert.equal(summary.summary.parsedArtifactCount, 1); + assert.equal(summary.summary.warningHighlightCount, 1); + assert.equal(summary.summary.errorHighlightCount, 2); + assert.match(summary.excerpt, /warning: watch out/); +}); diff --git a/tests/smoke.test.ts b/tests/smoke.test.ts new file mode 100644 index 0000000..366b0c0 --- /dev/null +++ b/tests/smoke.test.ts @@ -0,0 +1,45 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import { Client } from '@modelcontextprotocol/sdk/client/index.js'; +import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js'; + +test('server starts over stdio and exposes the expected tools', async () => { + const transport = new StdioClientTransport({ + command: 'node', + args: ['--import', 'tsx', 'src/index.ts'], + cwd: process.cwd(), + env: { + ...process.env, + APPSTORE_CONNECT_API_KEY_ID: 'dummy-key-id', + APPSTORE_CONNECT_API_ISSUER_ID: 'dummy-issuer-id', + APPSTORE_CONNECT_API_KEY_CONTENT: + '-----BEGIN PRIVATE KEY-----\\ndummy\\n-----END PRIVATE KEY-----', + }, + }); + + const client = new Client( + { + name: 'xcode-cloud-mcp-smoke-test', + version: '0.1.0', + }, + { + capabilities: {}, + }, + ); + + await client.connect(transport); + const tools = await client.listTools(); + const toolNames = tools.tools.map((tool) => tool.name).sort(); + + assert.deepEqual(toolNames, [ + 'get_build_issues', + 'get_build_logs', + 'get_test_artifacts', + 'get_test_results', + 'list_build_runs', + 'list_products', + 'list_workflows', + ]); + + await client.close(); +}); diff --git a/tests/tools.test.ts b/tests/tools.test.ts new file mode 100644 index 0000000..4dfee39 --- /dev/null +++ b/tests/tools.test.ts @@ -0,0 +1,168 @@ +import test from 'node:test'; +import assert from 'node:assert/strict'; +import type { AppStoreConnectClient } from '../src/api/client.js'; +import type { CiArtifact, CiBuildRun, CiProduct, CiWorkflow } from '../src/api/types.js'; +import { registerBuildRunTools } from '../src/tools/build-runs.js'; +import { registerDiscoveryTools } from '../src/tools/discovery.js'; +import { registerResultTools } from '../src/tools/results.js'; +import { registerTestTools } from '../src/tools/tests.js'; + +type ToolHandler = ( + arguments_: Record, +) => Promise<{ + content: Array<{ type: string; text: string }>; + isError?: boolean; +}>; + +test('registered tools expose product, workflow, and build data', async () => { + const registry = new Map(); + const server = { + registerTool: ( + name: string, + _config: unknown, + callback: ToolHandler, + ): void => { + registry.set(name, callback); + }, + }; + + const product: CiProduct = { + id: 'product-1', + type: 'ciProducts', + attributes: { + name: 'Demo App', + createdDate: '2026-03-30T10:00:00Z', + productType: 'APP', + }, + }; + + const workflow: CiWorkflow = { + id: 'workflow-1', + type: 'ciWorkflows', + attributes: { + name: 'CI', + description: 'Build and test', + isEnabled: true, + clean: false, + containerFilePath: 'Demo.xcodeproj', + lastModifiedDate: '2026-03-30T11:00:00Z', + }, + }; + + const buildRun: CiBuildRun = { + id: 'build-1', + type: 'ciBuildRuns', + attributes: { + number: 42, + createdDate: '2026-03-30T12:00:00Z', + executionProgress: 'COMPLETE', + completionStatus: 'FAILED', + isPullRequestBuild: false, + issueCounts: { + analyzerWarnings: 0, + errors: 1, + testFailures: 2, + warnings: 1, + }, + }, + relationships: { + workflow: { + data: { + type: 'ciWorkflows', + id: 'workflow-1', + }, + }, + }, + }; + + const logArtifact = createArtifact('artifact-1', 'build.log', 'LOG'); + const screenshotArtifact = createArtifact( + 'artifact-2', + 'screenshot.png', + 'SCREENSHOT', + ); + + const client = { + products: { + list: async () => [product], + }, + workflows: { + listForProduct: async () => [workflow], + }, + builds: { + getById: async () => buildRun, + listForWorkflow: async () => [buildRun], + }, + artifacts: { + listForBuildRun: async () => ({ + logs: [logArtifact], + archives: [], + screenshots: [screenshotArtifact], + videos: [], + resultBundles: [], + testProducts: [], + other: [], + }), + downloadArtifact: async () => + new TextEncoder().encode('warning: watch out\nerror: broken'), + }, + } as unknown as AppStoreConnectClient; + + registerDiscoveryTools(server as never, client); + registerBuildRunTools(server as never, client); + registerResultTools(server as never, client); + registerTestTools(server as never, client); + + const listProducts = registry.get('list_products'); + const listBuildRuns = registry.get('list_build_runs'); + const getBuildLogs = registry.get('get_build_logs'); + const getTestArtifacts = registry.get('get_test_artifacts'); + + assert.ok(listProducts); + assert.ok(listBuildRuns); + assert.ok(getBuildLogs); + assert.ok(getTestArtifacts); + + const productsPayload = parsePayload(await listProducts!({})); + const buildsPayload = parsePayload( + await listBuildRuns!({ workflowId: 'workflow-1' }), + ); + const logsPayload = parsePayload( + await getBuildLogs!({ workflowId: 'workflow-1', buildSelector: 'latest' }), + ); + const artifactsPayload = parsePayload( + await getTestArtifacts!({ + workflowId: 'workflow-1', + buildSelector: 'latest', + }), + ); + + assert.equal(productsPayload.products[0].id, 'product-1'); + assert.equal(buildsPayload.buildRuns[0].number, 42); + assert.equal(logsPayload.summary.errorHighlightCount, 1); + assert.equal(artifactsPayload.screenshots[0].id, 'artifact-2'); +}); + +function parsePayload(result: { + content: Array<{ type: string; text: string }>; +}): any { + assert.equal(result.content[0]?.type, 'text'); + return JSON.parse(result.content[0]!.text); +} + +function createArtifact( + id: string, + fileName: string, + fileType: CiArtifact['attributes']['fileType'], +): CiArtifact { + return { + id, + type: 'ciArtifacts', + attributes: { + fileName, + fileType, + downloadUrl: `https://example.com/${id}`, + fileSize: 100, + }, + }; +} From 2d3d1ef8cb8f1158aabbc5dfb59dfe817ffa90a3 Mon Sep 17 00:00:00 2001 From: Fernando Fernandes Date: Mon, 30 Mar 2026 17:41:30 +0200 Subject: [PATCH 3/3] Document Claude and Codex setup --- README.md | 112 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 111 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 1818bcb..5c249f1 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,112 @@ +

+ Claude + Codex + License + CI + Nightly +

+ # xcode-cloud-mcp -MCP server for working with Apple's Xcode Cloud. ☁️ + +Minimal MCP server for discovering Xcode Cloud products and workflows, then retrieving build issues, logs, test summaries, and UI test artifacts through the App Store Connect API. + +## Features + +- Discover Xcode Cloud products with `list_products`. +- Discover workflows for a product with `list_workflows`. +- List recent workflow runs with `list_build_runs`. +- Retrieve build issue counts with `get_build_issues`. +- Retrieve and summarize text-like build logs with `get_build_logs`. +- Retrieve test summaries with `get_test_results`. +- Retrieve screenshots, videos, result bundles, and test products with `get_test_artifacts`. + +Build lookup is workflow-scoped. Retrieval tools accept a direct `buildRunId`, or a `workflowId` plus `buildNumber`, or a `workflowId` plus `buildSelector: "latest" | "latestFailing"`. + +## Requirements + +- Node.js `20+` +- App Store Connect API credentials with access to Xcode Cloud + +## Environment Variables + +Primary names: + +- `APPSTORE_CONNECT_API_KEY_ID` +- `APPSTORE_CONNECT_API_ISSUER_ID` +- `APPSTORE_CONNECT_API_KEY_CONTENT` + +Compatibility aliases: + +- `APP_STORE_KEY_ID` +- `APP_STORE_ISSUER_ID` +- `APP_STORE_PRIVATE_KEY` + +The private key can be passed as literal multi-line PEM content or as a string with escaped `\n`. + +## Claude Setup + +```bash +claude mcp add xcode-cloud \ + --env APPSTORE_CONNECT_API_KEY_ID="$APPSTORE_CONNECT_API_KEY_ID" \ + --env APPSTORE_CONNECT_API_ISSUER_ID="$APPSTORE_CONNECT_API_ISSUER_ID" \ + --env APPSTORE_CONNECT_API_KEY_CONTENT="$APPSTORE_CONNECT_API_KEY_CONTENT" \ + -- npx -y @thatfactory/xcode-cloud-mcp +``` + +## Codex Setup + +```bash +codex mcp add xcode-cloud \ + --env APPSTORE_CONNECT_API_KEY_ID="$APPSTORE_CONNECT_API_KEY_ID" \ + --env APPSTORE_CONNECT_API_ISSUER_ID="$APPSTORE_CONNECT_API_ISSUER_ID" \ + --env APPSTORE_CONNECT_API_KEY_CONTENT="$APPSTORE_CONNECT_API_KEY_CONTENT" \ + -- npx -y @thatfactory/xcode-cloud-mcp +``` + +## Available Tools + +- `list_products(limit?)` +- `list_workflows(productId, limit?)` +- `list_build_runs(workflowId, limit?, status?)` +- `get_build_issues(buildRunId? workflowId? buildNumber? buildSelector?)` +- `get_build_logs(buildRunId? workflowId? buildNumber? buildSelector?, maxCharacters?)` +- `get_test_results(buildRunId? workflowId? buildNumber? buildSelector?)` +- `get_test_artifacts(buildRunId? workflowId? buildNumber? buildSelector?)` + +## Example Prompts + +```text +Retrieve logs of the latest failing build for workflow abc123. +``` + +```text +Retrieve logs of build number 42 for workflow abc123. +``` + +```text +Show me the latest failing UI test artifacts for workflow abc123. +``` + +```text +List the workflows for product def456 and then summarize the latest build. +``` + +## Local Development + +Install dependencies: + +```bash +npm install +``` + +Run tests: + +```bash +npm test +``` + +Build the package: + +```bash +npm run build +```