ql-mcp-client rewrite : Phases 1 & 2 : Replace ql-mcp-client.js with Go implementation#223
ql-mcp-client rewrite : Phases 1 & 2 : Replace ql-mcp-client.js with Go implementation#223data-douser wants to merge 20 commits intomainfrom
ql-mcp-client rewrite : Phases 1 & 2 : Replace ql-mcp-client.js with Go implementation#223Conversation
Dependency ReviewThe following issues were found:
Snapshot WarningsEnsure that dependencies are being submitted on PR branches and consider enabling retry-on-snapshot-warnings. See the documentation for more information and troubleshooting advice. License Issuesclient/go.mod
OpenSSF Scorecard
Scanned Files
|
There was a problem hiding this comment.
Pull request overview
This PR updates the repository’s tooling, CI, and documentation to transition the client/ from the legacy Node.js ql-mcp-client.js workflow to a Go-based gh-ql-mcp-client workflow (including using make -C client ... targets for build/test/lint).
Changes:
- Updated root npm scripts to delegate client build/test/lint/clean to
make -C client. - Updated CI workflows to set up Go and run client integration tests via
make -C client test-integration. - Rewrote multiple docs/instructions to describe the new Go client CLI and Go-based integration test runner.
Show a summary per file
| File | Description |
|---|---|
| package.json | Switches client build/test/lint/clean scripts from npm workspace to make -C client targets and removes client from workspaces. |
| package-lock.json | Removes client from workspace list but retains an extraneous client package entry. |
| docs/testing.md | Updates testing strategy docs to describe Go client-based integration tests and make commands. |
| client/README.md | Rewrites client README to describe gh-ql-mcp-client usage, commands, and Go module structure. |
| client/CLI-USAGE.md | Rewrites CLI usage guide to describe Go CLI subcommands and flags. |
| client/integration-tests/README.md | Updates integration test docs to describe Go runner parameter resolution and invocation. |
| client/Makefile | Adds a Makefile defining build/test/lint targets for the (intended) Go client. |
| client/.gitignore | Updates ignores for Go build artifacts and SARIF downloads. |
| .github/workflows/lint-and-format.yml | Adds actions/setup-go using client/go.mod. |
| .github/workflows/client-integration-tests.yml | Adds Go setup and switches test execution to make -C client test-integration. |
| .github/prompts/ql-mcp-server-fix-build-and-test.prompt.md | Updates prompt guidance to use Go client and shell scripts for server management. |
| .github/instructions/client_go.instructions.md | Adds new Go client Copilot instruction file. |
| .github/instructions/client_src_js.instructions.md | Retargets the old JS instructions file to Go. |
| .github/instructions/client_integration_tests.instructions.md | Updates integration test instructions to reference the Go-based workflow. |
| .github/agents/ql-mcp-tool-*.md / ql-agent-skills-developer.md | Updates agent docs to reference Go client usage. |
Copilot's findings
Comments suppressed due to low confidence (1)
.github/workflows/client-integration-tests.yml:120
make -C client test-integrationcan currently succeed without running any tests because the Makefile treats missinggo.modas “skip integration tests” and exits 0. In CI this can produce false-green runs. Prefer failing fast when Go sources aren’t present (or ensure go.mod is committed as part of this PR).
## Run integration tests. This script builds the server bundle and runs tests.
## We do NOT use 'npm run build-and-test' as it runs query unit tests which
## have a dedicated workflow (query-unit-tests.yml).
- name: MCP Integration Tests - Run integration tests
shell: bash
run: make -C client test-integration
- Files reviewed: 52/54 changed files
- Comments generated: 10
There was a problem hiding this comment.
Pull request overview
This PR replaces the legacy JavaScript ql-mcp-client (previously used mainly as an MCP integration test harness) with a new Go-based CLI binary (gh-ql-mcp-client) and updates repo scripts, CI workflows, and docs to build/test via make -C client.
Changes:
- Remove the Node.js
client/workspace (package, ESLint config, andclient/src/**implementation) and introduce a new Go module + Cobra CLI underclient/. - Port the integration test runner to Go and switch root scripts/CI to invoke
make -C client .... - Update documentation/instructions/agents/prompts to reference the Go client and new test workflows.
Show a summary per file
| File | Description |
|---|---|
| package.json | Removes client workspace usage; routes build/test/lint through make -C client. |
| package-lock.json | Removes client from workspace list; still contains legacy client package metadata marked extraneous. |
| docs/testing.md | Updates testing layer docs and commands to reference Go client + Make targets. |
| client/scripts/run-integration-tests.sh | Builds Go client binary and runs integration tests via gh-ql-mcp-client instead of Node. |
| client/README.md | Rewrites client README around gh-ql-mcp-client and new workflows. |
| client/CLI-USAGE.md | Rewrites CLI usage docs for the Go client. |
| client/.gitignore | Replaces JS-era ignores with Go build artifacts + SARIF downloads; keeps node_modules ignored. |
| client/Makefile | Adds standardized Go build/test/lint targets and cross-compile support. |
| client/main.go | Adds Go entrypoint calling Cobra cmd.Execute(). |
| client/go.mod | Introduces Go module and dependencies (cobra, mcp-go). |
| client/go.sum | Locks Go dependencies for the new module. |
| client/cmd/root.go | Adds Cobra root command and persistent flags (--mode, --host, --port, --format). |
| client/cmd/root_test.go | Adds unit tests for root command help/version/default flags. |
| client/cmd/helpers.go | Adds helper parseRepo for future NWO parsing. |
| client/cmd/helpers_test.go | Adds unit tests for parseRepo. |
| client/cmd/integration_tests.go | Adds integration-tests command wiring to the Go runner. |
| client/internal/mcp/client.go | Adds MCP client wrapper (stdio/http) with tool timeout policy. |
| client/internal/mcp/client_test.go | Adds unit tests for MCP client timeout behavior/constants. |
| client/internal/testing/runner.go | Adds Go integration test discovery/execution logic. |
| client/internal/testing/runner_test.go | Adds unit tests for runner utilities and mock execution. |
| client/internal/testing/params.go | Adds parameter resolution logic (test-config / monitoring-state / defaults). |
| client/internal/testing/params_test.go | Adds unit tests for param resolution helpers. |
| client/integration-tests/README.md | Updates integration test fixture docs to Go runner conventions and param precedence. |
| client/integration-tests/primitives/tools/codeql_query_run/custom_log_directory/test-config.json | Updates fixture logDir target path for Go-based runner. |
| client/integration-tests/primitives/tools/codeql_test_run/custom_log_directory/test-config.json | Updates fixture logDir target path for Go-based runner. |
| .github/workflows/lint-and-format.yml | Adds Go toolchain setup for lint/format workflow. |
| .github/workflows/client-integration-tests.yml | Adds Go toolchain setup; switches integration tests to make -C client test-integration. |
| .github/prompts/ql-mcp-server-fix-build-and-test.prompt.md | Updates troubleshooting/build/test guidance to use Go client + Make. |
| .github/instructions/client_src_js.instructions.md | Repurposes instructions file to Go (applyTo client/**/*.go). |
| .github/instructions/client_integration_tests.instructions.md | Updates integration test instructions for Go runner/Make-based workflow. |
| .github/instructions/client_go.instructions.md | Adds new Go-specific Copilot instructions for client/**/*.go. |
| .github/agents/ql-mcp-tool-tester.md | Updates agent guidance from JS client to Go client usage. |
| .github/agents/ql-mcp-tool-developer.md | Updates tool developer testing guidance to Make/Go client. |
| .github/agents/ql-agent-skills-developer.md | Updates command example to use gh-ql-mcp-client. |
| client/package.json | Removes client npm package/workspace definition. |
| client/eslint.config.mjs | Removes JS lint config for the deleted Node client. |
| client/src/ql-mcp-client.js | Removes legacy Node CLI entrypoint. |
| client/src/lib/validate-source-root.js | Removes JS helper module (client rewrite). |
| client/src/lib/test-logger.js | Removes JS helper module (client rewrite). |
| client/src/lib/server-manager.js | Removes JS helper module (client rewrite). |
| client/src/lib/resolve-all-queries.js | Removes JS helper module (client rewrite). |
| client/src/lib/queries-filter-metadata.js | Removes JS helper module (client rewrite). |
| client/src/lib/process-query-metadata.js | Removes JS helper module (client rewrite). |
| client/src/lib/monitoring-integration-test-runner.js | Removes JS monitoring runner (client rewrite). |
| client/src/lib/mcp-test-suite.js | Removes JS MCP connectivity test suite (client rewrite). |
| client/src/lib/mcp-client-utils.js | Removes JS helper module (client rewrite). |
| client/src/lib/file-utils.js | Removes JS helper module (client rewrite). |
| client/src/lib/commands/query-commands.js | Removes JS command implementation (client rewrite). |
| client/src/lib/commands/metadata-commands.js | Removes JS command implementation (client rewrite). |
| client/src/lib/commands/basic-commands.js | Removes JS command implementation (client rewrite). |
| client/src/lib/command-handler.js | Removes JS CLI command router (client rewrite). |
| client/src/lib/cli-parser.js | Removes JS CLI parsing/validation (client rewrite). |
| client/src/lib/aggregate-query-metadata.js | Removes JS helper module (client rewrite). |
Copilot's findings
Comments suppressed due to low confidence (3)
client/internal/testing/params.go:168
- For
codeql_database_create, the generated params use anoutputkey, but the server tool schema expectsdatabase(the database path/name to create). This default parameter logic likely won’t work if a fixture relies on runner defaults for this tool; align the key name with the tool’s input schema.
case "codeql_database_create":
params["language"] = "javascript"
params["source-root"] = filepath.Join(staticPath, "test", "ExampleQuery1")
params["output"] = filepath.Join(repoRoot, ".tmp", "test-db-create")
client/README.md:64
- The README documents
code-scanningandsarifcommand groups (and related files likecmd/code_scanning.go,cmd/sarif.go), but the currentclient/cmd/only implementsintegration-tests. This makes the usage/architecture documentation inaccurate for the code in this PR. Recommend either implementing the documented commands/files or trimming the README to only describe what’s implemented in Phase 2.
### Commands
#### `code-scanning` (alias: `cs`)
Interact with the GitHub Code Scanning REST API.
```bash
# List analyses for a repository
gh-ql-mcp-client code-scanning list-analyses --repo owner/repo
# List alerts with filters
gh-ql-mcp-client code-scanning list-alerts --repo owner/repo --state open --severity high
# Download a SARIF analysis
gh-ql-mcp-client code-scanning download-analysis --repo owner/repo --analysis-id 12345
sarif
SARIF analysis and alert comparison tools (delegates to MCP server tools).
gh-ql-mcp-client sarif --help**client/CLI-USAGE.md:135**
* The global flags table lists `--mode` default as `http`, but `cmd/root.go` sets the default to `stdio`. The doc also suggests environment variables like `MCP_MODE` control transport, but the CLI currently relies on flags only. Update defaults/config docs (or implement env var binding) to avoid misleading users.
Global Flags
These flags are available on all commands:
| Flag | Default | Description |
|---|---|---|
--mode |
http |
MCP server transport (stdio/http) |
--host |
localhost |
MCP server host (http mode) |
--port |
3000 |
MCP server port (http mode) |
--format |
text |
Output format (text/json) |
</details>
- **Files reviewed:** 52/54 changed files
- **Comments generated:** 7
...nt/integration-tests/primitives/tools/codeql_query_run/custom_log_directory/test-config.json
Outdated
Show resolved
Hide resolved
client/integration-tests/primitives/tools/codeql_test_run/custom_log_directory/test-config.json
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Pull request overview
This PR completes Phases 1 & 2 of the ql-mcp-client rewrite by removing the legacy Node.js-based client/src/ql-mcp-client.js integration test CLI and replacing it with a Go-based gh-ql-mcp-client binary (also usable as a gh extension), along with updated build/test workflows, CI wiring, and documentation across the repo.
Changes:
- Replaces the JS client + npm workspace with a Go module (
client/) implementing an MCP client wrapper and a Go integration test runner. - Switches root/CI workflows from
npm -w client ...tomake -C client ...for build/lint/test (including integration tests). - Updates docs/instructions/prompts/agents to reference the Go client and new test runner conventions (including
test-config.jsonusage and{{tmpdir}}).
Show a summary per file
| File | Description |
|---|---|
| package.json | Removes client from workspaces; routes build/lint/test to make -C client .... |
| package-lock.json | Removes workspace listing but still retains an extraneous client package entry. |
| docs/testing.md | Updates integration test layer to reference Go client and new commands. |
| client/src/ql-mcp-client.js | Deletes legacy JS CLI entrypoint. |
| client/src/lib/validate-source-root.js | Deletes legacy JS helper. |
| client/src/lib/test-logger.js | Deletes legacy JS helper. |
| client/src/lib/server-manager.js | Deletes legacy JS helper. |
| client/src/lib/resolve-all-queries.js | Deletes legacy JS helper. |
| client/src/lib/queries-filter-metadata.js | Deletes legacy JS helper. |
| client/src/lib/process-query-metadata.js | Deletes legacy JS helper. |
| client/src/lib/monitoring-integration-test-runner.js | Deletes legacy JS monitoring test runner. |
| client/src/lib/mcp-test-suite.js | Deletes legacy JS MCP connectivity suite. |
| client/src/lib/mcp-client-utils.js | Deletes legacy JS helper. |
| client/src/lib/file-utils.js | Deletes legacy JS helper. |
| client/src/lib/commands/query-commands.js | Deletes legacy JS query command implementation. |
| client/src/lib/commands/metadata-commands.js | Deletes legacy JS metadata command implementation. |
| client/src/lib/commands/basic-commands.js | Deletes legacy JS basic command implementation. |
| client/src/lib/command-handler.js | Deletes legacy JS CLI dispatcher. |
| client/src/lib/cli-parser.js | Deletes legacy JS arg parsing/validation. |
| client/src/lib/aggregate-query-metadata.js | Deletes legacy JS metadata aggregation utility. |
| client/scripts/run-integration-tests.sh | Builds Go binary and runs integration tests via gh-ql-mcp-client. |
| client/README.md | Rewrites client README for Go binary usage, flags, and testing. |
| client/package.json | Deletes the client npm workspace package. |
| client/Makefile | Adds Make targets for build/lint/test/unit/integration/cross-compile. |
| client/main.go | Adds Go CLI entrypoint. |
| client/internal/testing/runner.go | Adds Go integration test runner (fixture discovery + tool calls). |
| client/internal/testing/runner_test.go | Adds unit tests for runner helpers. |
| client/internal/testing/params.go | Adds parameter resolution logic (test-config → monitoring params → defaults). |
| client/internal/testing/params_test.go | Adds unit tests for parameter resolution helpers. |
| client/internal/mcp/client.go | Adds Go MCP client wrapper for stdio/HTTP. |
| client/internal/mcp/client_test.go | Adds unit tests for MCP client utilities/timeouts. |
| client/integration-tests/README.md | Updates integration test fixture requirements for Go runner. |
| client/integration-tests/primitives/tools/codeql_test_run/custom_log_directory/test-config.json | Switches logDir to {{tmpdir}} for runtime-safe temp output. |
| client/integration-tests/primitives/tools/codeql_query_run/custom_log_directory/test-config.json | Switches logDir to {{tmpdir}} for runtime-safe temp output. |
| client/go.mod | Introduces Go module + dependencies (cobra, mcp-go). |
| client/go.sum | Adds Go dependency lockfile. |
| client/eslint.config.mjs | Deletes JS lint config (client no longer JS). |
| client/cmd/root.go | Adds Cobra root command and persistent flags. |
| client/cmd/root_test.go | Adds unit tests for root command help/defaults/version. |
| client/cmd/integration_tests.go | Adds integration-tests Cobra subcommand wiring. |
| client/cmd/helpers.go | Adds CLI helper(s). |
| client/cmd/helpers_test.go | Adds tests for CLI helper(s). |
| client/CLI-USAGE.md | Rewrites CLI usage docs for Go CLI and new commands. |
| client/.gitignore | Updates ignore rules for Go artifacts and SARIF downloads. |
| .github/workflows/lint-and-format.yml | Adds Go setup step for lint/format workflow. |
| .github/workflows/client-integration-tests.yml | Uses make -C client test-integration; adds Go toolchain setup and env. |
| .github/prompts/ql-mcp-server-fix-build-and-test.prompt.md | Updates prompt guidance to use Go client + Make targets. |
| .github/instructions/client_src_js.instructions.md | Removes JS client instructions (client/src is deleted). |
| .github/instructions/client_integration_tests.instructions.md | Updates integration-test instructions for Go runner + Make usage. |
| .github/instructions/client_go.instructions.md | Adds new Go client instruction file for client/**/*.go. |
| .github/agents/ql-mcp-tool-tester.md | Updates agent guidance to use Go client for testing. |
| .github/agents/ql-mcp-tool-developer.md | Updates developer agent guidance to use Go client + Make integration tests. |
| .github/agents/ql-agent-skills-developer.md | Updates tool listing command to use Go client. |
Copilot's findings
Comments suppressed due to low confidence (1)
client/internal/testing/runner.go:289
resolvePathPlaceholdersonly replaces{{tmpdir}}in top-level string values. Tool params can include nested maps (e.g.,alertA/alertB) and arrays (e.g.,tests,files) where placeholders may appear, which would currently not be rewritten. Consider making placeholder resolution recursive over maps/slices so fixtures can safely use{{tmpdir}}anywhere in the parameter structure.
// resolvePathPlaceholders replaces {{tmpdir}} in parameter values.
func resolvePathPlaceholders(params map[string]any, tmpBase string) map[string]any {
if err := os.MkdirAll(tmpBase, 0o750); err != nil {
fmt.Fprintf(os.Stderr, "warning: cannot create tmp dir %s: %v\n", tmpBase, err)
}
result := make(map[string]any, len(params))
for k, v := range params {
if s, ok := v.(string); ok && strings.Contains(s, "{{tmpdir}}") {
result[k] = strings.ReplaceAll(s, "{{tmpdir}}", tmpBase)
} else {
result[k] = v
}
}
return result
- Files reviewed: 52/54 changed files
- Comments generated: 4
There was a problem hiding this comment.
Pull request overview
This PR migrates the repository’s client integration test harness from the legacy Node.js client/src/ql-mcp-client.js implementation to a new Go-based CLI (gh-ql-mcp-client), and updates build/test workflows, CI, and documentation accordingly.
Changes:
- Replace root npm workspace usage of
client/withmake -C client ...targets, and update CI to set up Go and run Go-based client integration tests. - Add a new Go module under
client/implementing an MCP client wrapper + integration test runner. - Remove the legacy JavaScript client sources and client workspace package configuration, and update docs/instructions to reference the Go client.
Show a summary per file
| File | Description |
|---|---|
| package.json | Switch client build/lint/test scripts from npm workspace to make -C client. |
| package-lock.json | Remove client from workspace list, but still retains an extraneous client package entry. |
| docs/testing.md | Update testing-layer documentation to reference the Go client runner. |
| .github/workflows/lint-and-format.yml | Add Go toolchain setup for lint/format workflow. |
| .github/workflows/client-integration-tests.yml | Add Go toolchain setup, update integration test invocation, and set annotation tools env. |
| .github/prompts/ql-mcp-server-fix-build-and-test.prompt.md | Update prompt guidance to use the Go client and make-based workflows. |
| .github/instructions/client_integration_tests.instructions.md | Update Copilot instructions to reflect Go-based test running for integration tests. |
| .github/instructions/client_go.instructions.md | Add new Copilot instructions for Go client code in client/**/*.go. |
| .github/instructions/client_src_js.instructions.md | Remove deprecated JS client instructions file. |
| .github/agents/ql-mcp-tool-tester.md | Update agent documentation to reference the Go client. |
| .github/agents/ql-mcp-tool-developer.md | Update agent documentation to reference Go client integration tests. |
| .github/agents/ql-agent-skills-developer.md | Update agent documentation to reference Go client CLI usage. |
| client/Makefile | Add make-based Go build/test/lint targets for the new client. |
| client/go.mod | Introduce Go module definition for the Go client. |
| client/go.sum | Add Go dependency checksums. |
| client/main.go | Add Go entry point invoking Cobra command execution. |
| client/cmd/root.go | Add Cobra root command and global flags. |
| client/cmd/root_test.go | Add unit tests for root command help/version/default flags. |
| client/cmd/helpers.go | Add CLI helper (repo parsing). |
| client/cmd/helpers_test.go | Add tests for CLI helper. |
| client/cmd/integration_tests.go | Add integration-tests Cobra command wiring + MCP client adapter. |
| client/internal/mcp/client.go | Add Go MCP client wrapper (stdio/http connect, tool calls, list calls). |
| client/internal/mcp/client_test.go | Add unit tests for MCP client timeouts/constants/config. |
| client/internal/testing/runner.go | Add Go integration test runner (fixture discovery, tool availability enforcement). |
| client/internal/testing/runner_test.go | Add unit tests for runner behavior and helper functions. |
| client/internal/testing/params.go | Add parameter resolution logic (test-config.json, monitoring-state.json, tool defaults). |
| client/internal/testing/params_test.go | Add unit tests for parameter resolution and SARIF injection behavior. |
| client/scripts/run-integration-tests.sh | Update integration test script to build Go binary and execute Go CLI. |
| client/README.md | Rewrite client README to describe gh-ql-mcp-client usage and workflows. |
| client/CLI-USAGE.md | Rewrite CLI usage guide to reference the Go CLI. |
| client/integration-tests/README.md | Update integration test fixture documentation for Go runner parameter resolution. |
| client/.gitignore | Update ignores for Go artifacts and SARIF downloads; keep legacy node_modules/dist ignores. |
| client/integration-tests/primitives/tools/codeql_test_run/custom_log_directory/test-config.json | Update fixture to use {{tmpdir}}-based log directory. |
| client/integration-tests/primitives/tools/codeql_query_run/custom_log_directory/test-config.json | Update fixture to use {{tmpdir}}-based log directory. |
| client/package.json | Remove the legacy client npm workspace package. |
| client/eslint.config.mjs | Remove legacy client ESLint config. |
| client/src/ql-mcp-client.js | Remove legacy JS CLI entrypoint. |
| client/src/lib/validate-source-root.js | Remove legacy JS helper. |
| client/src/lib/test-logger.js | Remove legacy JS helper. |
| client/src/lib/server-manager.js | Remove legacy JS helper. |
| client/src/lib/resolve-all-queries.js | Remove legacy JS helper. |
| client/src/lib/queries-filter-metadata.js | Remove legacy JS helper. |
| client/src/lib/process-query-metadata.js | Remove legacy JS helper. |
| client/src/lib/monitoring-integration-test-runner.js | Remove legacy JS helper. |
| client/src/lib/mcp-test-suite.js | Remove legacy JS helper. |
| client/src/lib/mcp-client-utils.js | Remove legacy JS helper. |
| client/src/lib/file-utils.js | Remove legacy JS helper. |
| client/src/lib/commands/query-commands.js | Remove legacy JS command module. |
| client/src/lib/commands/metadata-commands.js | Remove legacy JS command module. |
| client/src/lib/commands/basic-commands.js | Remove legacy JS command module. |
| client/src/lib/command-handler.js | Remove legacy JS command module. |
| client/src/lib/cli-parser.js | Remove legacy JS CLI parser. |
| client/src/lib/aggregate-query-metadata.js | Remove legacy JS helper. |
Copilot's findings
Comments suppressed due to low confidence (4)
docs/testing.md:45
- Docs say transport mode is controlled by
--modeorMCP_MODE, but the Go CLI currently only reads the--modeflag (no env binding forMCP_MODE). Either wireMCP_MODEinto the flag default or update the docs to avoid implying env var support.
client/README.md:101 - The environment variable table lists
MCP_MODEas supported, but earlier the README states the CLI does not readMCP_MODE. Either remove/clarifyMCP_MODEhere as unsupported, or implement env var binding so behavior matches the documentation.
| `MCP_SERVER_URL` | Override MCP server URL (http mode) | `http://localhost:3000/mcp` |
| `MCP_SERVER_PATH` | Override path to MCP server JS entry point (stdio mode) | Auto-detected from repo root |
| `MCP_MODE` | Transport mode (`stdio`/`http`) | `http` |
| `HTTP_HOST` | Server host | `localhost` |
| `HTTP_PORT` | Server port | `3000` |
client/CLI-USAGE.md:160
- The environment variable table lists
MCP_MODE, but the Go CLI currently does not readMCP_MODE(mode is only set via--mode). Either removeMCP_MODEhere or implement env var binding so the documentation matches behavior.
| `MCP_SERVER_URL` | Override MCP server URL (http mode) | `http://localhost:3000/mcp` |
| `MCP_SERVER_PATH` | Override path to MCP server JS entry point (stdio mode) | Auto-detected from repo root |
| `MCP_MODE` | Transport mode (`stdio`/`http`) | `http` |
| `HTTP_HOST` | Server host | `localhost` |
| `HTTP_PORT` | Server port | `3000` |
client/README.md:112
- The architecture tree lists
cmd/code_scanning.go/cmd/code_scanning_*.go, but those files aren’t present in this PR. Please update the tree to match the current implementation, or add the missing command stubs so the documented layout is accurate.
│ ├── root.go # Root command + global flags
│ ├── code_scanning.go # code-scanning subcommand group
│ ├── code_scanning_*.go # Individual code-scanning subcommands
│ ├── sarif.go # sarif subcommand group
- Files reviewed: 52/54 changed files
- Comments generated: 10
There was a problem hiding this comment.
Pull request overview
Migrates the repository’s MCP client + integration test runner from the legacy JavaScript implementation to a new Go-based CLI (gh-ql-mcp-client), updating build/test orchestration (Make + scripts), CI workflows, and related documentation to match the new client architecture.
Changes:
- Replaces the JS client workspace with a Go module + Cobra CLI and ports the integration test runner to Go.
- Updates build/test entrypoints (
package.json,client/Makefile,client/scripts/run-integration-tests.sh) and CI workflows to build/run the Go client. - Refreshes docs/instructions/agent guides to reference the Go client and updated integration test configuration patterns.
Show a summary per file
| File | Description |
|---|---|
| package.json | Switches client build/lint/test to make -C client … and removes client workspace. |
| package-lock.json | Updates workspaces metadata after removing client workspace (still contains stale client package entry). |
| docs/testing.md | Updates testing layer docs to reference Go client and new commands. |
| client/.gitignore | Updates ignore rules for Go binaries/coverage and SARIF downloads. |
| client/CLI-USAGE.md | Rewrites CLI usage for Go client (currently documents commands not implemented in this PR). |
| client/Makefile | Adds Make targets for building/testing/linting the Go client and running integration tests. |
| client/README.md | Rewrites README for Go CLI (currently documents commands/files not implemented in this PR). |
| client/main.go | Adds Go CLI entrypoint. |
| client/go.mod | Introduces Go module for the client. |
| client/go.sum | Adds dependency lockfile for Go module. |
| client/scripts/run-integration-tests.sh | Updates integration test orchestration to build/run Go binary (and extract test DBs). |
| client/cmd/root.go | Adds Cobra root command + persistent flags. |
| client/cmd/root_test.go | Unit tests for root command help/version/default flags. |
| client/cmd/helpers.go | Adds small CLI helper(s) (e.g., parsing owner/repo). |
| client/cmd/helpers_test.go | Unit tests for helpers. |
| client/cmd/integration_tests.go | Adds integration-tests Cobra command wiring to Go runner + MCP client. |
| client/internal/mcp/client.go | Adds MCP client wrapper using mcp-go for stdio/HTTP. |
| client/internal/mcp/client_test.go | Unit tests for MCP client helper logic (timeouts/constants). |
| client/internal/testing/runner.go | Implements Go integration test runner (fixture discovery + tool calls). |
| client/internal/testing/runner_test.go | Unit tests for runner utilities/behaviors. |
| client/internal/testing/params.go | Implements fixture parameter resolution (test-config → monitoring params → defaults). |
| client/internal/testing/params_test.go | Unit tests for parameter resolution utilities. |
| client/integration-tests/README.md | Updates integration test authoring docs for Go runner + test-config.json preference. |
| client/integration-tests/primitives/tools/codeql_test_run/custom_log_directory/test-config.json | Switches logDir to {{tmpdir}} placeholder for Go runner. |
| client/integration-tests/primitives/tools/codeql_query_run/custom_log_directory/test-config.json | Switches logDir to {{tmpdir}} placeholder for Go runner. |
| .github/workflows/lint-and-format.yml | Adds Go toolchain setup for repo lint/format workflow. |
| .github/workflows/client-integration-tests.yml | Adds Go toolchain setup and switches integration tests to make -C client test-integration. |
| .github/prompts/ql-mcp-server-fix-build-and-test.prompt.md | Updates build/test guidance to Go client + Make targets. |
| .github/instructions/client_integration_tests.instructions.md | Updates integration test contribution guidance to Go-based workflow. |
| .github/instructions/client_go.instructions.md | Adds new Go-specific Copilot instructions for client/**/*.go. |
| .github/agents/ql-mcp-tool-tester.md | Updates agent guidance to use Go client for integration tests. |
| .github/agents/ql-mcp-tool-developer.md | Updates agent guidance for running integration tests with Go client/Make. |
| .github/agents/ql-agent-skills-developer.md | Updates tool discovery example to Go client (but references an unimplemented command). |
| client/package.json | Removes legacy JS client workspace package definition. |
| client/eslint.config.mjs | Removes legacy JS client lint config. |
| .github/instructions/client_src_js.instructions.md | Removes JS-client Copilot instructions. |
| client/src/lib/validate-source-root.js | Removes legacy JS client code. |
| client/src/lib/test-logger.js | Removes legacy JS client code. |
| client/src/lib/server-manager.js | Removes legacy JS client code. |
| client/src/lib/resolve-all-queries.js | Removes legacy JS client code. |
| client/src/lib/queries-filter-metadata.js | Removes legacy JS client code. |
| client/src/lib/process-query-metadata.js | Removes legacy JS client code. |
| client/src/lib/monitoring-integration-test-runner.js | Removes legacy JS client code. |
| client/src/lib/mcp-test-suite.js | Removes legacy JS client code. |
| client/src/lib/mcp-client-utils.js | Removes legacy JS client code. |
| client/src/lib/file-utils.js | Removes legacy JS client code. |
| client/src/lib/commands/query-commands.js | Removes legacy JS client code. |
| client/src/lib/commands/metadata-commands.js | Removes legacy JS client code. |
| client/src/lib/commands/basic-commands.js | Removes legacy JS client code. |
| client/src/lib/command-handler.js | Removes legacy JS client code. |
| client/src/lib/cli-parser.js | Removes legacy JS client code. |
| client/src/lib/aggregate-query-metadata.js | Removes legacy JS client code. |
Copilot's findings
Comments suppressed due to low confidence (1)
.github/workflows/client-integration-tests.yml:43
- The workflow sets
ENABLE_ANNOTATION_TOOLS: 'true', butclient/scripts/run-integration-tests.shinterprets this as “annotation tools ONLY” and skips the default integration test suite. If the intent is to run default + annotation coverage in CI, avoid setting this env var globally (or adjust the script to separate “enable tools” from “select mode”).
env:
ENABLE_ANNOTATION_TOOLS: 'true'
HTTP_HOST: 'localhost'
HTTP_PORT: '3000'
MCP_MODE: ${{ matrix.mcp-mode }}
TIMEOUT_SECONDS: '30'
- Files reviewed: 52/54 changed files
- Comments generated: 3
There was a problem hiding this comment.
Pull request overview
This PR completes Phases 1 & 2 of the client rewrite by replacing the legacy Node.js client/src/ql-mcp-client.js integration-test CLI with a Go-based gh-ql-mcp-client (Cobra + mcp-go), and updating repo scripts/CI/docs to build and run the Go client.
Changes:
- Remove the
client/npm workspace + JS client implementation and switch root scripts tomake -C client .... - Add the Go CLI, MCP client wrapper, and a Go integration test runner that discovers fixtures under
client/integration-tests/. - Update documentation, prompts, and GitHub Actions workflows to reflect the new Go client and invocation paths.
Show a summary per file
| File | Description |
|---|---|
| package.json | Switch root build/lint/test scripts from -w client to make -C client ...; remove client workspace. |
| package-lock.json | Update workspace list (but still retains an extraneous client package entry). |
| docs/testing.md | Update testing layer docs and commands to reference the Go client. |
| client/scripts/run-integration-tests.sh | Build Go binary, extract test DBs, and run tests via gh-ql-mcp-client with updated mode selection. |
| client/README.md | Rewrite client README for gh-ql-mcp-client usage, build, and test commands. |
| client/CLI-USAGE.md | Rewrite CLI usage docs for the Go command structure. |
| client/integration-tests/README.md | Update integration test fixture guidance and runner parameter resolution behavior. |
| client/integration-tests/primitives/tools/codeql_test_run/custom_log_directory/test-config.json | Move logDir to {{tmpdir}}-based location. |
| client/integration-tests/primitives/tools/codeql_query_run/custom_log_directory/test-config.json | Move logDir to {{tmpdir}}-based location. |
| client/.gitignore | Replace JS-era ignores with Go build artifacts and related outputs. |
| .github/workflows/lint-and-format.yml | Add Go toolchain setup for workflows that run client linting. |
| .github/workflows/client-integration-tests.yml | Add Go toolchain setup; run integration tests via make -C client test-integration. |
| .github/prompts/ql-mcp-server-fix-build-and-test.prompt.md | Update instructions to use the Go client + scripts for server start/stop. |
| .github/instructions/client_integration_tests.instructions.md | Update integration test contribution guidance for Go runner and Make targets. |
| .github/instructions/client_go.instructions.md | New Copilot instructions for Go client code under client/**/*.go. |
| .github/instructions/client_src_js.instructions.md | Remove deprecated JS-client Copilot instructions (since JS client is removed). |
| .github/agents/ql-mcp-tool-tester.md | Update agent docs to reference Go client usage. |
| .github/agents/ql-mcp-tool-developer.md | Update tool developer docs to run integration tests via Go client/Make targets. |
| .github/agents/ql-agent-skills-developer.md | Update agent docs to use gh-ql-mcp-client list ... commands. |
| client/Makefile | New Make targets for building/testing/linting the Go client. |
| client/go.mod | New Go module for the client implementation. |
| client/go.sum | Dependency lockfile for Go module. |
| client/main.go | Go entrypoint wiring to Cobra commands. |
| client/cmd/root.go | Root Cobra command + global flags and version. |
| client/cmd/root_test.go | Unit tests for root command help/version/default flags. |
| client/cmd/list.go | Implement list tools/prompts/resources commands. |
| client/cmd/list_test.go | Unit tests ensuring list commands appear in help output. |
| client/cmd/integration_tests.go | integration-tests command wiring (filters, timeout flag, runner invocation). |
| client/cmd/helpers.go | Shared CLI helper(s) (e.g., owner/repo parsing). |
| client/cmd/helpers_test.go | Unit tests for helper(s). |
| client/internal/mcp/client.go | MCP client wrapper supporting stdio + HTTP transports and tool calls. |
| client/internal/mcp/client_test.go | Unit tests for timeouts/constants and basic client behavior. |
| client/internal/testing/runner.go | Go integration test runner (fixture discovery + tool execution + assertions). |
| client/internal/testing/runner_test.go | Unit tests for runner utilities and basic runner behavior. |
| client/internal/testing/params.go | Fixture parameter resolution logic (test-config.json / monitoring-state / defaults). |
| client/internal/testing/params_test.go | Unit tests for parameter resolution logic. |
| client/package.json | Remove the client npm package. |
| client/eslint.config.mjs | Remove client-specific ESLint config for JS implementation. |
| client/src/lib/validate-source-root.js | Remove legacy JS client source. |
| client/src/lib/test-logger.js | Remove legacy JS client source. |
| client/src/lib/server-manager.js | Remove legacy JS client source. |
| client/src/lib/resolve-all-queries.js | Remove legacy JS client source. |
| client/src/lib/queries-filter-metadata.js | Remove legacy JS client source. |
| client/src/lib/process-query-metadata.js | Remove legacy JS client source. |
| client/src/lib/monitoring-integration-test-runner.js | Remove legacy JS client source. |
| client/src/lib/mcp-test-suite.js | Remove legacy JS client source. |
| client/src/lib/mcp-client-utils.js | Remove legacy JS client source. |
| client/src/lib/file-utils.js | Remove legacy JS client source. |
| client/src/lib/commands/query-commands.js | Remove legacy JS client source. |
| client/src/lib/commands/metadata-commands.js | Remove legacy JS client source. |
| client/src/lib/commands/basic-commands.js | Remove legacy JS client source. |
| client/src/lib/command-handler.js | Remove legacy JS client source. |
| client/src/lib/cli-parser.js | Remove legacy JS client source. |
| client/src/lib/aggregate-query-metadata.js | Remove legacy JS client source. |
Copilot's findings
- Files reviewed: 54/56 changed files
- Comments generated: 3
There was a problem hiding this comment.
Pull request overview
This PR advances the ql-mcp-client migration by replacing the legacy Node.js client/integration test runner with a Go-based CLI (gh-ql-mcp-client), updating build/test workflows accordingly, and changing annotation-related server tools to be registered by default.
Changes:
- Added a Go CLI client (
gh-ql-mcp-client) with MCP connectivity plus integration-test discovery/execution; removed the legacyclient/src/**JavaScript implementation. - Updated repo scripts, docs, and CI workflows to build/lint/test the Go client via
make -C client .... - Changed annotation/audit/cache/SARIF tool enablement defaults (server + extension tests/docs updated to match).
Show a summary per file
| File | Description |
|---|---|
| server/test/src/tools/sarif-tools.test.ts | Updates SARIF tool registration tests to assume default registration. |
| server/test/src/tools/cache-tools.test.ts | Updates cache tool registration tests to assume default registration. |
| server/test/src/tools/audit-tools.test.ts | Updates audit tool registration tests to assume default registration. |
| server/test/src/tools/annotation-tools.test.ts | Updates annotation tool registration tests to assume default registration. |
| server/src/tools/sarif-tools.ts | Removes opt-in gate and updates header comment for SARIF tools. |
| server/src/tools/cache-tools.ts | Removes opt-in gate and updates header comment for cache tools. |
| server/src/tools/audit-tools.ts | Removes opt-in gate and updates header comment for audit tools. |
| server/src/tools/annotation-tools.ts | Removes opt-in gate and updates header comment for annotation tools. |
| server/src/lib/session-data-manager.ts | Defaults ENABLE_ANNOTATION_TOOLS to true. |
| server/src/lib/log-directory-manager.ts | Makes log-directory base-path validation portable via path.sep. |
| server/dist/codeql-development-mcp-server.js | Regenerated bundled output reflecting server source changes. |
| package.json | Switches client scripts from npm workspace to make -C client ...; removes client workspace. |
| package-lock.json | Updates lockfile after workspace change (still contains an extraneous client package entry). |
| extensions/vscode/test/suite/mcp-tool-e2e.integration.test.ts | Updates e2e test expectation: annotation/audit/cache tools appear by default. |
| extensions/vscode/test/bridge/environment-builder.test.ts | Updates tests to reflect server default enablement (no explicit ENABLE_ANNOTATION_TOOLS set). |
| extensions/vscode/src/bridge/environment-builder.ts | Stops explicitly setting ENABLE_ANNOTATION_TOOLS; still sets MONITORING_STORAGE_LOCATION. |
| docs/testing.md | Updates testing docs to reference Go client runner and make -C client targets. |
| client/scripts/start-server.sh | Aligns server tmp base with Go runner {{tmpdir}} expectations in HTTP mode. |
| client/scripts/run-integration-tests.sh | Reworks orchestration for Go binary build + test DB extraction + updated mode semantics. |
| client/README.md | Rewrites client README for Go CLI usage and Makefile workflows. |
| client/Makefile | Adds Go build/test/lint/cross-compile targets and integration test wrapper. |
| client/main.go | Adds Go CLI entrypoint. |
| client/cmd/root.go | Adds Cobra root command and persistent transport/output flags. |
| client/cmd/root_test.go | Adds unit tests for root command help/version/default flags. |
| client/cmd/list.go | Implements list tools/prompts/resources commands. |
| client/cmd/list_test.go | Adds unit tests verifying list commands are present in help. |
| client/cmd/integration_tests.go | Implements integration-tests command wiring to the Go runner + MCP client. |
| client/cmd/helpers.go | Adds shared helper(s) (e.g., repo parsing). |
| client/cmd/helpers_test.go | Adds unit tests for helpers. |
| client/internal/mcp/client.go | Adds MCP client wrapper for stdio/HTTP, timeouts, and server path resolution. |
| client/internal/mcp/client_test.go | Adds unit tests for MCP client constants/timeout selection. |
| client/internal/testing/runner.go | Adds Go integration test runner (fixture discovery, tool calls, assertions). |
| client/internal/testing/runner_test.go | Adds unit tests for runner utilities and assertion logic. |
| client/internal/testing/params.go | Adds Go param resolution logic for fixtures and tool-specific defaults. |
| client/internal/testing/params_test.go | Adds unit tests for param resolution logic. |
| client/integration-tests/README.md | Updates integration test fixture documentation for Go runner param resolution. |
| client/integration-tests/primitives/tools/codeql_test_run/custom_log_directory/test-config.json | Updates fixture to use {{tmpdir}} for logDir. |
| client/integration-tests/primitives/tools/codeql_query_run/custom_log_directory/test-config.json | Updates fixture to use {{tmpdir}} for logDir. |
| client/go.mod | Introduces Go module definition and dependencies. |
| client/go.sum | Adds Go dependency checksums. |
| client/.gitignore | Updates ignores for Go artifacts and removes legacy JS coverage ignores. |
| .github/workflows/lint-and-format.yml | Adds Go toolchain setup to lint/format workflow. |
| .github/workflows/client-integration-tests.yml | Updates CI to set up Go and run make -C client test-integration. |
| .github/prompts/ql-mcp-server-fix-build-and-test.prompt.md | Updates prompt guidance to use Go client + new scripts/commands. |
| .github/instructions/client_integration_tests.instructions.md | Updates integration test instructions to Go make -C client test. |
| .github/instructions/client_go.instructions.md | Adds new Copilot instructions for client/**/*.go. |
| .github/instructions/client_src_js.instructions.md | Removes JS client Copilot instructions (client JS removed). |
| .github/agents/ql-mcp-tool-tester.md | Updates agent doc to reference Go client usage. |
| .github/agents/ql-mcp-tool-developer.md | Updates agent doc to reference Go client + make-based integration tests. |
| .github/agents/ql-agent-skills-developer.md | Updates agent doc to use Go client for tool/prompt/resource listing. |
| CHANGELOG.md | Documents Go client rewrite and updated default enablement behavior in Unreleased highlights. |
| client/package.json | Removes legacy JS client package definition (deleted). |
| client/eslint.config.mjs | Removes JS lint config (deleted). |
| client/src/ql-mcp-client.js | Removes legacy JS client entrypoint (deleted). |
| client/src/lib/** | Removes legacy JS client library modules (deleted). |
Copilot's findings
- Files reviewed: 69/73 changed files
- Comments generated: 7
Update all .github config files, documentation, workflows, and package.json to reflect the intended Go-based ql-mcp-client architecture. No Go source code is introduced — only documentation, config, and a stub Makefile. - Create .github/instructions/client_go.instructions.md for Go conventions - Update client_src_js.instructions.md to Go guidance - Update client_integration_tests.instructions.md for Go test runner - Update agent files to reference Go client instead of JS client - Update ql-mcp-server-fix-build-and-test.prompt.md with make commands - Add actions/setup-go to CI workflows - Rewrite client/README.md and CLI-USAGE.md for gh-ql-mcp-client - Update client/integration-tests/README.md for Go test runner - Update docs/testing.md to describe Go MCP client - Update package.json to use make -C client targets, remove client workspace - Add stub client/Makefile with go.mod-conditional targets Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/f5595942-48af-4847-8d28-fba34a17ba76 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
…221) * Initial plan * Replace JavaScript client with Go binary and integration test runner - Remove client/src/ directory with all JS files (ql-mcp-client.js and 14 library modules) - Remove client/package.json and client/eslint.config.mjs - Add Go module (go.mod, go.sum) with cobra and mcp-go dependencies - Add CLI entry point (main.go) and root Cobra command (cmd/root.go) - Add CLI helpers (cmd/helpers.go) and integration test command (cmd/integration_tests.go) - Add MCP client library (internal/mcp/client.go) with stdio and HTTP transport - Add integration test runner (internal/testing/runner.go, params.go) - Add comprehensive unit tests for all packages (16 tests, all passing) - Update Makefile to remove go.mod guards (Go source now available) - Update run-integration-tests.sh to build and use Go binary - Update test-config.json logDir paths for custom_log_directory tests Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/8c006672-cf7e-4045-9488-f6d97fafe2f2 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * Final validation complete Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/8c006672-cf7e-4045-9488-f6d97fafe2f2 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * Revert unrelated go.mod changes in server/ql/go/tools/test/ Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/8c006672-cf7e-4045-9488-f6d97fafe2f2 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> * Replace actual repo reference with placeholder in helpers_test.go Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/86c1cb26-2977-409f-ace0-aabc4fc9cee7 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Nathan Randall <70299490+data-douser@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Nathan Randall <70299490+data-douser@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> Signed-off-by: Nathan Randall <70299490+data-douser@users.noreply.github.com>
11f8a1f to
a24247b
Compare
There was a problem hiding this comment.
Pull request overview
This PR completes Phases 1 & 2 of the ql-mcp-client rewrite by removing the legacy Node.js client and replacing it with a Go-based CLI (gh-ql-mcp-client) that runs the existing integration-test fixture suite, while also updating docs/CI to use the new Go workflows. In support of the integration tests and intended default UX, the server-side annotation/audit/cache/SARIF tool families are changed to be registered by default (no longer gated behind ENABLE_ANNOTATION_TOOLS).
Changes:
- Replace the JS client and integration test runner with a Go CLI + Go-based integration test runner and Makefile workflows.
- Update CI, scripts, and documentation to build/test via
make -C client ...and thegh-ql-mcp-clientbinary. - Register annotation/audit/cache/SARIF tools by default and align server/extension tests with that behavior.
Show a summary per file
| File | Description |
|---|---|
| server/test/src/tools/sarif-tools.test.ts | Updates SARIF tool registration tests for “always registered” behavior. |
| server/test/src/tools/cache-tools.test.ts | Updates cache tool registration tests for “always registered” behavior. |
| server/test/src/tools/audit-tools.test.ts | Updates audit tool registration tests for “always registered” behavior. |
| server/test/src/tools/annotation-tools.test.ts | Updates annotation tool tests to assert registration regardless of config flag. |
| server/src/types/monitoring.ts | Re-documents enableAnnotationTools as controlling auto-caching rather than tool registration. |
| server/src/tools/sarif-tools.ts | Removes opt-in gating for SARIF tool registration. |
| server/src/tools/cache-tools.ts | Removes opt-in gating for cache tool registration. |
| server/src/tools/audit-tools.ts | Removes opt-in gating for audit tool registration. |
| server/src/tools/annotation-tools.ts | Removes opt-in gating for annotation tool registration. |
| server/src/lib/session-data-manager.ts | Changes default ENABLE_ANNOTATION_TOOLS parsing to default true. |
| server/src/lib/log-directory-manager.ts | Makes log-directory base containment check cross-platform via path.sep. |
| server/dist/codeql-development-mcp-server.js | Bundled output updated to reflect server source changes. |
| package.json | Switches client build/lint/test scripts from npm workspace to make -C client ...; removes client workspace entry. |
| package-lock.json | Updates lockfile after workspace removal (but still includes a stale client package entry). |
| extensions/vscode/test/suite/mcp-tool-e2e.integration.test.ts | Updates e2e expectation: annotation/audit/cache tools appear by default. |
| extensions/vscode/test/bridge/environment-builder.test.ts | Updates env-builder tests to stop forcing ENABLE_ANNOTATION_TOOLS defaults. |
| extensions/vscode/src/bridge/environment-builder.ts | Stops setting ENABLE_ANNOTATION_TOOLS; continues defaulting MONITORING_STORAGE_LOCATION. |
| docs/testing.md | Updates testing docs to describe the Go client and Make targets for integration tests. |
| client/src/lib/validate-source-root.js | Removes legacy JS client module. |
| client/src/lib/test-logger.js | Removes legacy JS client module. |
| client/src/lib/server-manager.js | Removes legacy JS client module. |
| client/src/lib/resolve-all-queries.js | Removes legacy JS client module. |
| client/src/lib/queries-filter-metadata.js | Removes legacy JS client module. |
| client/src/lib/process-query-metadata.js | Removes legacy JS client module. |
| client/src/lib/mcp-test-suite.js | Removes legacy JS client module. |
| client/src/lib/mcp-client-utils.js | Removes legacy JS client module. |
| client/src/lib/file-utils.js | Removes legacy JS client module. |
| client/src/lib/commands/query-commands.js | Removes legacy JS client module. |
| client/src/lib/commands/metadata-commands.js | Removes legacy JS client module. |
| client/src/lib/commands/basic-commands.js | Removes legacy JS client module. |
| client/src/lib/command-handler.js | Removes legacy JS client module. |
| client/src/lib/cli-parser.js | Removes legacy JS client module. |
| client/src/lib/aggregate-query-metadata.js | Removes legacy JS client module. |
| client/scripts/start-server.sh | Aligns server tmp base with Go runner {{tmpdir}} usage for HTTP mode. |
| client/scripts/run-integration-tests.sh | Reworks orchestration to build Go binary, extract DBs, and run default + optional monitoring modes. |
| client/README.md | Rewrites client README for gh-ql-mcp-client usage, Make targets, and architecture. |
| client/package.json | Removes legacy npm workspace manifest for the JS client. |
| client/Makefile | Adds Go build/test/lint/clean/install and cross-compile targets. |
| client/main.go | Adds Go CLI entrypoint. |
| client/internal/testing/runner.go | Adds Go integration-test fixture runner and assertion validation. |
| client/internal/testing/runner_test.go | Adds unit tests for runner behavior and helpers. |
| client/internal/testing/params.go | Adds tool parameter resolution logic (test-config.json, monitoring-state.json params, tool defaults). |
| client/internal/testing/params_test.go | Adds unit tests for parameter resolution logic. |
| client/internal/mcp/client.go | Adds Go MCP client wrapper supporting stdio and HTTP transports. |
| client/internal/mcp/client_test.go | Adds unit tests for MCP client constants and timeout selection. |
| client/integration-tests/README.md | Updates fixture docs to describe Go runner param resolution and run commands. |
| client/integration-tests/primitives/tools/codeql_test_run/custom_log_directory/test-config.json | Switches logDir to {{tmpdir}}-based path. |
| client/integration-tests/primitives/tools/codeql_query_run/custom_log_directory/test-config.json | Switches logDir to {{tmpdir}}-based path. |
| client/go.sum | Adds Go dependency lockfile for the new Go module. |
| client/go.mod | Adds Go module definition and dependencies. |
| client/eslint.config.mjs | Removes JS lint config for deleted JS client. |
| client/cmd/root.go | Adds Cobra root command + global flags. |
| client/cmd/root_test.go | Adds unit tests for root command help/version/default flags. |
| client/cmd/list.go | Adds list tools/prompts/resources commands with text/json output. |
| client/cmd/list_test.go | Adds unit tests ensuring list commands appear in help. |
| client/cmd/integration_tests.go | Adds integration-tests command wiring for the Go fixture runner. |
| client/cmd/helpers.go | Adds shared CLI helper(s). |
| client/cmd/helpers_test.go | Adds unit tests for helper(s). |
| client/.gitignore | Updates ignore rules for Go artifacts and keeps legacy JS ignores where needed. |
| CHANGELOG.md | Updates [Unreleased] highlights to include the Go client rewrite and default tool enablement. |
| .github/workflows/lint-and-format.yml | Adds Go toolchain setup for workflows that now lint Go. |
| .github/workflows/client-integration-tests.yml | Adds Go setup and switches integration test execution to make -C client test-integration. |
| .github/prompts/ql-mcp-server-fix-build-and-test.prompt.md | Updates prompt instructions to use Go client + Make workflows. |
| .github/instructions/client_src_js.instructions.md | Removes JS-client-specific Copilot instructions (client JS code removed). |
| .github/instructions/client_integration_tests.instructions.md | Updates integration test instructions for Go/Make workflows and test-config.json. |
| .github/instructions/client_go.instructions.md | Adds Go-client-specific Copilot instructions. |
| .github/agents/ql-mcp-tool-tester.md | Updates agent guidance to use the Go client. |
| .github/agents/ql-mcp-tool-developer.md | Updates agent guidance to use the Go client for integration tests. |
| .github/agents/ql-agent-skills-developer.md | Updates tool/prompt/resource listing guidance to use the Go client. |
Copilot's findings
- Files reviewed: 70/74 changed files
- Comments generated: 5
|
@copilot Use TDD methodology to detect the current problems and apply changes for the comments in this thread |
…Tools setting, record skipped results, fix schema default, clarify changelog Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/a90a53a5-b2ad-4775-8b61-f11d16b33749 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
…egration-with-packs for explicit pack setup Agent-Logs-Url: https://github.com/advanced-security/codeql-development-mcp-server/sessions/a90a53a5-b2ad-4775-8b61-f11d16b33749 Co-authored-by: data-douser <70299490+data-douser@users.noreply.github.com>
Addressed in commits
|
Purpose
Replaces the JavaScript-based
ql-mcp-client.jsCLI with a Go implementation ofql-mcp-clientthat can be used as an extension for theghCLI. Intended to support follow-up work as part of parent issue #207.Summary of Changes
This pull request migrates the client for the
ql-mcpserver (aka client only), including the client integration test infrastructure from a JavaScript-based implementation to a new Go-based CLI (gh-ql-mcp-client). It introduces Go-specific build and test workflows, updates documentation and instructions throughout the repository, and adapts CI workflows and ignore files for the new Go client. The changes ensure a smoother developer experience, improved test reliability, and modern Go best practices for the client codebase.In addition, review feedback has been addressed to correct subprocess lifecycle management, skipped-test reporting, VS Code extension settings, server schema defaults, and changelog accuracy.
Outline of Changes
Key changes include:
Migration to Go-based Client and Integration Test Runner
Replaces references to the legacy JS client (
client/src/ql-mcp-client.js) with the Go client (gh-ql-mcp-client) in all developer documentation, agent skill guides, and integration test instructions. This includes updating usage examples, validation steps, and test execution commands.Adds a new
client/Makefilewith targets for building, testing (unit and integration), linting, cleaning, and cross-compiling the Go CLI, standardizing developer workflows for the Go client.make test-integrationskips pack installation by default (--no-install-packs) to keep the default test cycle fast.make test-integration-with-packsis the explicit target for dev environments where CodeQL pack dependencies need to be installed.Updates
.gitignoreto include Go build artifacts, SARIF downloads, and removes legacy JS/coverage exclusions.Go Client Subprocess Lifecycle Fix
innerClientinterface (satisfied by*mcpclient.Client) to decouple theClose()timeout path from the concrete mcp-go type, enabling unit testing without a live server.serverCmd *exec.Cmdfield toClient, populated viatransport.WithCommandFunc()inconnectStdio(), so the spawned process handle is always retained.Close()to callserverCmd.Process.Kill()after the 3-second timeout, actually terminating the stuck subprocess instead of only returning an error.TestClose_KillsSubprocessOnTimeoutusing ahangCloserstub and a realsleep 60subprocess; verifies the process is force-killed viaproc.Wait().Integration Test Runner Accuracy Fix
runToolTests()now records an explicitTestResultwith askipped:prefix for both--no-install-packsand deprecated-tool skips, soprintSummary()correctly reports the skipped count (previously always showed0 skipped).VS Code Extension Setting Removal
codeql-mcp.enableAnnotationToolssetting fromextensions/vscode/package.json— annotation, audit, cache, and SARIF tools are always registered and the setting was a no-op.ENABLE_ANNOTATION_TOOLS: 'true'env var from the spawned server and corrected the test and suite names to reflect that tools are always available.Server Schema and Changelog Corrections
MonitoringConfigSchema.enableAnnotationToolsdefault fromfalsetotrueto match the actualparseBoolEnv(..., true)server default; the flag now only controls auto-caching behaviour, not tool registration.ENABLE_ANNOTATION_TOOLSno longer gates tool availability — when set tofalseit only disables auto-caching in result processing.Documentation and Instruction Updates
.github/instructions/client_go.instructions.mdfor Go client development, specifying requirements, preferences, and constraints for contributing toclient/**/*.go.Continuous Integration Workflow Modernization
make -C client test-integrationinstead of npm scripts.These changes collectively move the project to a modern, Go-based client and integration test runner, correct several bugs identified in review (subprocess kill-on-timeout, skipped result tracking, defunct VS Code setting, schema default mismatch, changelog inaccuracy), and streamline the developer experience for building, testing, and validating MCP server tools.
📝 Update Information
Primitive Details
gh-ql-mcp-clientGo CLI,MonitoringConfigSchema, VS Code extension settings✅ ALLOWED FILES:
server/src/**/*.ts)server/src/tools/*.ts)server/test/**/*.ts,client/internal/**/*_test.go)README.md,CHANGELOG.md, server docs)server/src/types/*.ts)client/internal/**/*.go,client/cmd/**/*.go)extensions/vscode/package.json,client/Makefile)🚫 FORBIDDEN FILES:
🛑 MANDATORY PR VALIDATION CHECKLIST
Update Metadata
🎯 Changes Description
Current Behavior
Close()on the Go MCP client returned a timeout error after 3 seconds but left the Node.js subprocess running.printSummary()always reported0 skippedregardless of how many tools were skipped.codeql-mcp.enableAnnotationToolsVS Code setting was documented but was a no-op (tools are always registered).MonitoringConfigSchema.enableAnnotationToolsdefaulted tofalsewhile the server defaulted it totruevia env var.ENABLE_ANNOTATION_TOOLS=falsedisables tool registration.make test-integrationalways skipped pack installation with no opt-in path.Updated Behavior
Close()now callsserverCmd.Process.Kill()after the 3-second timeout, force-terminating the subprocess.printSummary()correctly counts skipped tests (recorded with askipped:prefix error).codeql-mcp.enableAnnotationToolssetting removed frompackage.json; extension no longer exposes a no-op setting.MonitoringConfigSchema.enableAnnotationToolsdefaults totrue, matching actual server behaviour.ENABLE_ANNOTATION_TOOLSonly affects auto-caching, not tool registration.make test-integrationskips packs by default (fast);make test-integration-with-packsinstalls packs explicitly.Motivation
Review feedback identified a subprocess leak, inaccurate test summary counts, a defunct VS Code setting, a schema default mismatch, and misleading documentation. All have been corrected.
🔄 Before vs. After Comparison
Functionality Changes
API Changes
Output Format Changes
🧪 Testing & Validation
Test Coverage Updates
TestClose_KillsSubprocessOnTimeout(TDD) verifies subprocess is force-killed viaproc.Wait();TestRunnerNoInstallPacksupdated to verify skipped result is recordedhangCloserstub prevents regression of the subprocess leakinnerguard onClose()Validation Scenarios
hangCloserstub + realsleep 60subprocess;proc.Wait()must return within 2 s afterClose()returns the timeout error.codeql_pack_install;NoInstallPacks=true; asserts 1 skipped result with correct reason string.MonitoringConfigSchema.parse({})now returnsenableAnnotationTools: true.package.jsonno longer contributescodeql-mcp.enableAnnotationTools.Test Results
📋 Implementation Details
Files Modified
client/internal/mcp/client.go,client/internal/mcp/client_test.goclient/internal/testing/runner.go,client/internal/testing/runner_test.goclient/Makefileserver/src/types/monitoring.tsserver/test/src/tools/annotation-tools.test.tsextensions/vscode/package.json,extensions/vscode/test/suite/mcp-tool-e2e.integration.test.tsCHANGELOG.mdCode Changes Summary
Close()timeoutskipped:prefixinnerClientinterface decouplesClientfrom concrete*mcpclient.ClientprintSummary()accurately reflects skipped countDependencies
🔍 Quality Improvements
Bug Fixes
Issue:
Close()left the Node.js subprocess running after a 3-second timeoutRoot Cause: No reference to the spawned
*exec.Cmdwas retained afterconnectStdio()returnedSolution: Capture
*exec.Cmdviatransport.WithCommandFunc(); callProcess.Kill()on timeoutPrevention: TDD test
TestClose_KillsSubprocessOnTimeoutguards against regressionIssue:
printSummary()always reported0 skippedRoot Cause:
runToolTests()returned early for skipped tools without recording aTestResultSolution: Record a
TestResultwithskipped:error prefix before returningPrevention: Updated
TestRunnerNoInstallPacksverifies the skipped countCode Quality Enhancements
innerClientinterface clarifies what the Go client actually uses from mcp-gotest-integrationvstest-integration-with-packsmake intent explicitinnerClientinterface enables stub injection without a live MCP serverhangCloserstub reusable for future timeout-path tests🔗 References
Related Issues/PRs
ql-mcp-clientin Go as aghCLI extension for Code Scanning SARIF management #207 (parent),ql-mcp-clientPhase 1: Update documentation and GitHub config for Go-based client #216,ql-mcp-clientPhase 2: Replace JavaScript client with Go binary and integration test runner #217🚀 Compatibility & Migration
Backward Compatibility
API Evolution
printSummary()now reports accurate skipped counts👥 Review Guidelines
For Reviewers
Please verify:
Close()timeout; skipped count accurateinnerClientinterface improves testabilityTesting Instructions
📊 Impact Assessment
Server Impact
Close()timeout eliminatedAI Assistant Impact