From b3cb84473004f48922e95487299c3010a7f519ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 14:24:05 -0400 Subject: [PATCH 01/13] Run the CLI tests in CI Right now, the inspector has a CLI feature as well as a series of tests. However, they're not currently run in CI. For the moment, they are only triggered on file changes in the CLI folder, as AFAICT it is currently a separate code base. --- .github/workflows/cli_tests.yml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 .github/workflows/cli_tests.yml diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml new file mode 100644 index 00000000..d61e5a4a --- /dev/null +++ b/.github/workflows/cli_tests.yml @@ -0,0 +1,26 @@ +name: CLI Tests + +on: + push: + paths: + - 'cli/**' + +jobs: + test: + runs-on: ubuntu-latest + defaults: + run: + working-directory: ./cli + steps: + - uses: actions/checkout@v2 + + - name: Set up Node.js + uses: actions/setup-node@v2 + with: + node-version: '14' + + - name: Install dependencies + run: npm install + + - name: Run tests + run: npm test From 1842063ce701e0156cdbbf637d1bd58d89ecdb37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 14:29:04 -0400 Subject: [PATCH 02/13] Remove unused import This commit is mostly so that we can see whether the CI triggers a check of the CLI tests when files are touched within the CLI folder. --- cli/scripts/cli-tests.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/scripts/cli-tests.js b/cli/scripts/cli-tests.js index 51bda553..50cf03c9 100755 --- a/cli/scripts/cli-tests.js +++ b/cli/scripts/cli-tests.js @@ -12,7 +12,7 @@ const colors = { import fs from "fs"; import path from "path"; -import { execSync, spawn } from "child_process"; +import { spawn } from "child_process"; import os from "os"; import { fileURLToPath } from "url"; From f49f97f585fa082e6ed2323b3b5f7c5665fdda01 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 22:06:20 -0400 Subject: [PATCH 03/13] Run prettier --- .github/workflows/cli_tests.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index d61e5a4a..4e7be19c 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -3,7 +3,7 @@ name: CLI Tests on: push: paths: - - 'cli/**' + - "cli/**" jobs: test: @@ -17,7 +17,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v2 with: - node-version: '14' + node-version: "14" - name: Install dependencies run: npm install From ea6177b552063c371ef81e9f322117d06657bb32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 22:11:37 -0400 Subject: [PATCH 04/13] Run in both pull requests and push events --- .github/workflows/cli_tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index 4e7be19c..c70823be 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -4,6 +4,9 @@ on: push: paths: - "cli/**" + pull_request: + paths: + - "cli/**" jobs: test: From ace91a81ad71b599238f66d04fc9cb0cfddf278c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 22:25:47 -0400 Subject: [PATCH 05/13] Use Node version defined in cli/package.json --- .github/workflows/cli_tests.yml | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index c70823be..eb18a2c6 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -15,15 +15,19 @@ jobs: run: working-directory: ./cli steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - name: Set up Node.js - uses: actions/setup-node@v2 + uses: actions/setup-node@v4 with: - node-version: "14" + node-version-file: package.json + cache: npm - - name: Install dependencies - run: npm install + # Working around https://github.com/npm/cli/issues/4828 + - run: npm install --no-package-lock + + - name: Build CLI + run: npm run build - name: Run tests run: npm test From 718e61d492b071e1be656465aca3ed22162e3c85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 22:36:00 -0400 Subject: [PATCH 06/13] Use simpler install method? --- .github/workflows/cli_tests.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index eb18a2c6..51b64c1c 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -23,8 +23,7 @@ jobs: node-version-file: package.json cache: npm - # Working around https://github.com/npm/cli/issues/4828 - - run: npm install --no-package-lock + - run: npm install - name: Build CLI run: npm run build From 9adcc0dd7739ff95146423e7e44aa4e543abd26c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 23:10:56 -0400 Subject: [PATCH 07/13] Add logging for pwd --- .github/workflows/cli_tests.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index 51b64c1c..678941fc 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -23,7 +23,11 @@ jobs: node-version-file: package.json cache: npm - - run: npm install + - name: Current directory + run: pwd + + - name: Install dependencies + run: npm install - name: Build CLI run: npm run build From f10b76b0ae9c65319d03c4d8ef216c60d0d3907d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 23:17:06 -0400 Subject: [PATCH 08/13] Run commands from root dir instead --- .github/workflows/cli_tests.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index 678941fc..a393c79a 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -11,26 +11,20 @@ on: jobs: test: runs-on: ubuntu-latest - defaults: - run: - working-directory: ./cli steps: - uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version-file: package.json + node-version-file: cli/package.json cache: npm - - name: Current directory - run: pwd - - name: Install dependencies - run: npm install + run: npm install --workspace=cli - name: Build CLI - run: npm run build + run: npm run build --workspace=cli - name: Run tests - run: npm test + run: npm run test --workspace=cli From c1ab2a52d28de558170d56036b2f60bc9be61a46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 23:19:05 -0400 Subject: [PATCH 09/13] Stay in cli/ but ignore scripts? --- .github/workflows/cli_tests.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index a393c79a..4a975b38 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -11,6 +11,9 @@ on: jobs: test: runs-on: ubuntu-latest + defaults: + run: + working-directory: ./cli steps: - uses: actions/checkout@v4 @@ -21,10 +24,10 @@ jobs: cache: npm - name: Install dependencies - run: npm install --workspace=cli + run: npm install --ignore-scripts - name: Build CLI - run: npm run build --workspace=cli + run: npm run build - name: Run tests - run: npm run test --workspace=cli + run: npm test From b6a4aa40cbe02a522eb5af7a18fd1c22cfb47dff Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 23:21:15 -0400 Subject: [PATCH 10/13] Install more, but stay put --- .github/workflows/cli_tests.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index 4a975b38..46431b46 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -24,7 +24,9 @@ jobs: cache: npm - name: Install dependencies - run: npm install --ignore-scripts + run: | + cd .. + npm ci --ignore-scripts - name: Build CLI run: npm run build From 616ef0d04c62591d47a75b81339ab08a1be8da20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 23:22:47 -0400 Subject: [PATCH 11/13] Use the node version in root package.json --- .github/workflows/cli_tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index 46431b46..3ea0f0e7 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version-file: cli/package.json + node-version-file: package.json cache: npm - name: Install dependencies From ff2d932904b8dd2ef5d5f8cd18b25440db5fe472 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 23:27:58 -0400 Subject: [PATCH 12/13] Add await to runCli call --- .github/workflows/cli_tests.yml | 3 +++ cli/src/cli.ts | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index 3ea0f0e7..6f199518 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -31,5 +31,8 @@ jobs: - name: Build CLI run: npm run build + - name: Explicitly pre-install test dependencies + run: npx -y @modelcontextprotocol/server-everything --help || true + - name: Run tests run: npm test diff --git a/cli/src/cli.ts b/cli/src/cli.ts index de0153b0..f29743ab 100644 --- a/cli/src/cli.ts +++ b/cli/src/cli.ts @@ -233,7 +233,7 @@ async function main(): Promise { const args = parseArgs(); if (args.cli) { - runCli(args); + await runCli(args); } else { await runWebClient(args); } From b84e5271f49a623de377f9b0b116d7e8ec9114cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fran=C3=A7ois=20Leblanc?= Date: Mon, 14 Jul 2025 23:35:52 -0400 Subject: [PATCH 13/13] Explicitly exit process for CI --- .github/workflows/cli_tests.yml | 3 +++ cli/src/index.ts | 2 ++ 2 files changed, 5 insertions(+) diff --git a/.github/workflows/cli_tests.yml b/.github/workflows/cli_tests.yml index 6f199518..8bd3bb8e 100644 --- a/.github/workflows/cli_tests.yml +++ b/.github/workflows/cli_tests.yml @@ -36,3 +36,6 @@ jobs: - name: Run tests run: npm test + env: + NPM_CONFIG_YES: true + CI: true diff --git a/cli/src/index.ts b/cli/src/index.ts index 5d5dcf8b..2b0c4f53 100644 --- a/cli/src/index.ts +++ b/cli/src/index.ts @@ -287,6 +287,8 @@ async function main(): Promise { try { const args = parseArgs(); await callMethod(args); + // Explicitly exit to ensure process terminates in CI + process.exit(0); } catch (error) { handleError(error); }