Skip to content

ql-mcp-client rewrite : Phases 1 & 2 : Replace ql-mcp-client.js with Go implementation#223

Draft
data-douser wants to merge 20 commits intomainfrom
dd/ql-mcp-client/2
Draft

ql-mcp-client rewrite : Phases 1 & 2 : Replace ql-mcp-client.js with Go implementation#223
data-douser wants to merge 20 commits intomainfrom
dd/ql-mcp-client/2

Conversation

@data-douser
Copy link
Copy Markdown
Collaborator

@data-douser data-douser commented Apr 6, 2026

Purpose

Replaces the JavaScript-based ql-mcp-client.js CLI with a Go implementation of ql-mcp-client that can be used as an extension for the gh CLI. Intended to support follow-up work as part of parent issue #207.

Summary of Changes

This pull request migrates the client for the ql-mcp server (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/Makefile with targets for building, testing (unit and integration), linting, cleaning, and cross-compiling the Go CLI, standardizing developer workflows for the Go client.

    • make test-integration skips pack installation by default (--no-install-packs) to keep the default test cycle fast.
    • make test-integration-with-packs is the explicit target for dev environments where CodeQL pack dependencies need to be installed.
  • Updates .gitignore to include Go build artifacts, SARIF downloads, and removes legacy JS/coverage exclusions.

Go Client Subprocess Lifecycle Fix

  • Introduced an innerClient interface (satisfied by *mcpclient.Client) to decouple the Close() timeout path from the concrete mcp-go type, enabling unit testing without a live server.
  • Added a serverCmd *exec.Cmd field to Client, populated via transport.WithCommandFunc() in connectStdio(), so the spawned process handle is always retained.
  • Fixed Close() to call serverCmd.Process.Kill() after the 3-second timeout, actually terminating the stuck subprocess instead of only returning an error.
  • Added TDD test TestClose_KillsSubprocessOnTimeout using a hangCloser stub and a real sleep 60 subprocess; verifies the process is force-killed via proc.Wait().

Integration Test Runner Accuracy Fix

  • runToolTests() now records an explicit TestResult with a skipped: prefix for both --no-install-packs and deprecated-tool skips, so printSummary() correctly reports the skipped count (previously always showed 0 skipped).

VS Code Extension Setting Removal

  • Removed the now-defunct codeql-mcp.enableAnnotationTools setting from extensions/vscode/package.json — annotation, audit, cache, and SARIF tools are always registered and the setting was a no-op.
  • Updated the annotation/audit tool integration test suite: removed the unnecessary 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

  • Aligned MonitoringConfigSchema.enableAnnotationTools default from false to true to match the actual parseBoolEnv(..., true) server default; the flag now only controls auto-caching behaviour, not tool registration.
  • Corrected CHANGELOG wording: ENABLE_ANNOTATION_TOOLS no longer gates tool availability — when set to false it only disables auto-caching in result processing.

Documentation and Instruction Updates

  • Introduces .github/instructions/client_go.instructions.md for Go client development, specifying requirements, preferences, and constraints for contributing to client/**/*.go.
  • Updates integration test instructions to reflect the Go client, new test configuration patterns, and updated commands.

Continuous Integration Workflow Modernization

  • Modifies GitHub Actions workflows to set up the Go environment, install dependencies, and run integration tests using make -C client test-integration instead 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

  • Type: Both
  • Name: gh-ql-mcp-client Go CLI, MonitoringConfigSchema, VS Code extension settings
  • Update Category: Bug Fix, Feature Enhancement

⚠️ CRITICAL: PR SCOPE VALIDATION

ALLOWED FILES:

  • Server implementation files (server/src/**/*.ts)
  • Modified registration files (server/src/tools/*.ts)
  • Updated or new test files (server/test/**/*.ts, client/internal/**/*_test.go)
  • Documentation updates (README.md, CHANGELOG.md, server docs)
  • Updated type definitions (server/src/types/*.ts)
  • Go client implementation (client/internal/**/*.go, client/cmd/**/*.go)
  • Configuration updates (extensions/vscode/package.json, client/Makefile)

🚫 FORBIDDEN FILES:

  • Files unrelated to the primitive update
  • Temporary or test output files
  • IDE configuration files
  • Log files or debug output

🛑 MANDATORY PR VALIDATION CHECKLIST

  • ONLY server implementation files are included
  • NO temporary or output files are included
  • NO unrelated configuration files are included
  • ALL existing tests continue to pass
  • NEW functionality is properly tested

  • Impact Scope: Moderate

Update Metadata

  • Breaking Changes: No
  • API Compatibility: Maintained
  • Performance Impact: Neutral

🎯 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 reported 0 skipped regardless of how many tools were skipped.
  • codeql-mcp.enableAnnotationTools VS Code setting was documented but was a no-op (tools are always registered).
  • MonitoringConfigSchema.enableAnnotationTools defaulted to false while the server defaulted it to true via env var.
  • CHANGELOG incorrectly stated that setting ENABLE_ANNOTATION_TOOLS=false disables tool registration.
  • make test-integration always skipped pack installation with no opt-in path.

Updated Behavior

  • Close() now calls serverCmd.Process.Kill() after the 3-second timeout, force-terminating the subprocess.
  • printSummary() correctly counts skipped tests (recorded with a skipped: prefix error).
  • codeql-mcp.enableAnnotationTools setting removed from package.json; extension no longer exposes a no-op setting.
  • MonitoringConfigSchema.enableAnnotationTools defaults to true, matching actual server behaviour.
  • CHANGELOG correctly states ENABLE_ANNOTATION_TOOLS only affects auto-caching, not tool registration.
  • make test-integration skips packs by default (fast); make test-integration-with-packs installs 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

// BEFORE: Close() timed out but left subprocess running
case <-time.After(3 * time.Second):
    return fmt.Errorf("%s", CloseTimeoutErr)

// AFTER: Close() force-kills the subprocess on timeout
case <-time.After(3 * time.Second):
    if c.serverCmd != nil && c.serverCmd.Process != nil {
        _ = c.serverCmd.Process.Kill()
    }
    return fmt.Errorf("%s", CloseTimeoutErr)

API Changes

// BEFORE: inner was a concrete *mcpclient.Client
type Client struct {
    inner  *mcpclient.Client
    config Config
}

// AFTER: inner is an interface; serverCmd retains the subprocess handle
type Client struct {
    inner     innerClient
    config    Config
    serverCmd *exec.Cmd
}

Output Format Changes

// BEFORE: printSummary always showed 0 skipped
Results: 5 passed, 0 failed, 0 skipped (of 5 total)

// AFTER: skipped tools are counted correctly
Results: 4 passed, 0 failed, 1 skipped (of 5 total)

🧪 Testing & Validation

Test Coverage Updates

  • Existing Tests: All existing tests continue to pass (1297 server TS tests; all Go unit tests)
  • New Test Cases: TestClose_KillsSubprocessOnTimeout (TDD) verifies subprocess is force-killed via proc.Wait(); TestRunnerNoInstallPacks updated to verify skipped result is recorded
  • Regression Tests: hangCloser stub prevents regression of the subprocess leak
  • Edge Case Tests: Timeout boundary, nil process guard, nil inner guard on Close()

Validation Scenarios

  1. Subprocess kill on timeout: hangCloser stub + real sleep 60 subprocess; proc.Wait() must return within 2 s after Close() returns the timeout error.
  2. Skipped result recording: fixture dir with codeql_pack_install; NoInstallPacks=true; asserts 1 skipped result with correct reason string.
  3. Schema default alignment: MonitoringConfigSchema.parse({}) now returns enableAnnotationTools: true.
  4. VS Code setting removal: package.json no longer contributes codeql-mcp.enableAnnotationTools.

Test Results

  • Unit Tests: All pass (1297 TS / all Go)
  • Integration Tests: Validated via CI workflow
  • Manual Testing: Validated with real scenarios
  • Performance Testing: No regressions detected

📋 Implementation Details

Files Modified

  • Go client core: client/internal/mcp/client.go, client/internal/mcp/client_test.go
  • Go integration runner: client/internal/testing/runner.go, client/internal/testing/runner_test.go
  • Build orchestration: client/Makefile
  • Type Definitions: server/src/types/monitoring.ts
  • Tests: server/test/src/tools/annotation-tools.test.ts
  • VS Code extension: extensions/vscode/package.json, extensions/vscode/test/suite/mcp-tool-e2e.integration.test.ts
  • Documentation: CHANGELOG.md

Code Changes Summary

  • Algorithm Improvements: Subprocess force-kill on Close() timeout
  • Error Handling: Skipped tests now recorded with skipped: prefix
  • Type Safety: innerClient interface decouples Client from concrete *mcpclient.Client
  • Input Validation: Schema default aligned with runtime default
  • Output Format: printSummary() accurately reflects skipped count

Dependencies

  • No New Dependencies: Update uses existing dependencies only

🔍 Quality Improvements

Bug Fixes

  • Issue: Close() left the Node.js subprocess running after a 3-second timeout

  • Root Cause: No reference to the spawned *exec.Cmd was retained after connectStdio() returned

  • Solution: Capture *exec.Cmd via transport.WithCommandFunc(); call Process.Kill() on timeout

  • Prevention: TDD test TestClose_KillsSubprocessOnTimeout guards against regression

  • Issue: printSummary() always reported 0 skipped

  • Root Cause: runToolTests() returned early for skipped tools without recording a TestResult

  • Solution: Record a TestResult with skipped: error prefix before returning

  • Prevention: Updated TestRunnerNoInstallPacks verifies the skipped count

Code Quality Enhancements

  • Readability: innerClient interface clarifies what the Go client actually uses from mcp-go
  • Maintainability: test-integration vs test-integration-with-packs make intent explicit
  • Testability: innerClient interface enables stub injection without a live MCP server
  • Reusability: hangCloser stub reusable for future timeout-path tests

🔗 References

Related Issues/PRs

🚀 Compatibility & Migration

Backward Compatibility

  • Fully Compatible: No breaking changes to MCP server API or tool contracts

API Evolution

  • Maintained Contracts: Core API contracts preserved
  • Better Error Messages: printSummary() now reports accurate skipped counts

👥 Review Guidelines

For Reviewers

Please verify:

  • ⚠️ SCOPE COMPLIANCE: PR contains only server implementation, Go client, and extension files
  • ⚠️ NO UNRELATED FILES: No temporary, output, or unrelated files
  • ⚠️ BACKWARD COMPATIBILITY: Existing functionality preserved
  • Functionality: Subprocess force-killed on Close() timeout; skipped count accurate
  • Test Coverage: All existing tests pass; new TDD test covers the subprocess kill path
  • Performance: No performance regressions
  • Code Quality: innerClient interface improves testability
  • Documentation: CHANGELOG, schema comment, and VS Code setting accurately reflect behaviour

Testing Instructions

# Full server test suite
npm install
npm run build
npm test --workspace=server

# Go client unit tests (includes TestClose_KillsSubprocessOnTimeout)
cd client && go test ./... -timeout 30s

# Integration tests (pack install skipped by default)
make -C client test-integration

# Integration tests WITH pack installation
make -C client test-integration-with-packs

# Lint
npm run lint

📊 Impact Assessment

Server Impact

  • Startup Time: No significant impact on server startup
  • Runtime Stability: Subprocess leak on Close() timeout eliminated
  • Resource Usage: Reasonable resource consumption
  • Concurrent Usage: Safe for concurrent access

AI Assistant Impact

  • Improved Reliability: More reliable subprocess cleanup in stdio mode
  • Enhanced User Experience: Accurate test summary output in CI logs

@data-douser data-douser self-assigned this Apr 6, 2026
@data-douser data-douser added documentation Improvements or additions to documentation enhancement New feature or request dependencies Pull requests that update a dependency file labels Apr 6, 2026
Copilot AI review requested due to automatic review settings April 6, 2026 16:41
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 6, 2026

Dependency Review

The following issues were found:
  • ✅ 0 vulnerable package(s)
  • ✅ 0 package(s) with incompatible licenses
  • ✅ 0 package(s) with invalid SPDX license definitions
  • ⚠️ 6 package(s) with unknown licenses.
  • ⚠️ 1 packages with OpenSSF Scorecard issues.
See the Details below.

Snapshot Warnings

⚠️: No snapshots were found for the head SHA 056a2b2.
Ensure 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 Issues

client/go.mod

PackageVersionLicenseIssue Type
github.com/google/uuid1.6.0NullUnknown License
github.com/inconshreveable/mousetrap1.1.0NullUnknown License
github.com/mark3labs/mcp-go0.47.0NullUnknown License
github.com/spf13/cast1.7.1NullUnknown License
github.com/spf13/cobra1.10.2NullUnknown License
github.com/spf13/pflag1.0.9NullUnknown License

OpenSSF Scorecard

PackageVersionScoreDetails
actions/actions/setup-go 40f1582b2485089dde7abd97c1529aa768e1baff 🟢 6.1
Details
CheckScoreReason
Maintained🟢 1012 commit(s) and 1 issue activity found in the last 90 days -- score normalized to 10
Code-Review🟢 10all changesets reviewed
Packaging⚠️ -1packaging workflow not detected
Binary-Artifacts🟢 10no binaries found in the repo
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Dangerous-Workflow🟢 10no dangerous workflow patterns detected
Token-Permissions⚠️ 0detected GitHub workflow tokens with excessive permissions
Pinned-Dependencies⚠️ 0dependency not pinned by hash detected -- score normalized to 0
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Security-Policy🟢 9security policy file detected
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
SAST🟢 9SAST tool is not run on all commits -- score normalized to 9
gomod/github.com/google/jsonschema-go 0.4.2 UnknownUnknown
gomod/github.com/google/uuid 1.6.0 UnknownUnknown
gomod/github.com/inconshreveable/mousetrap 1.1.0 UnknownUnknown
gomod/github.com/mark3labs/mcp-go 0.47.0 UnknownUnknown
gomod/github.com/spf13/cast 1.7.1 UnknownUnknown
gomod/github.com/spf13/cobra 1.10.2 UnknownUnknown
gomod/github.com/spf13/pflag 1.0.9 UnknownUnknown
gomod/github.com/yosida95/uritemplate/v3 3.0.2 ⚠️ 2.6
Details
CheckScoreReason
Dangerous-Workflow⚠️ -1no workflows found
Packaging⚠️ -1packaging workflow not detected
Code-Review🟢 4Found 9/19 approved changesets -- score normalized to 4
Token-Permissions⚠️ -1No tokens found
Binary-Artifacts🟢 10no binaries found in the repo
Maintained⚠️ 00 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Pinned-Dependencies⚠️ -1no dependencies found
CII-Best-Practices⚠️ 0no effort to earn an OpenSSF best practices badge detected
Security-Policy⚠️ 0security policy file not detected
Fuzzing⚠️ 0project is not fuzzed
License🟢 10license file detected
Signed-Releases⚠️ -1no releases found
Branch-Protection⚠️ 0branch protection not enabled on development/release branches
SAST⚠️ 0SAST tool is not run on all commits -- score normalized to 0

Scanned Files

  • .github/workflows/lint-and-format.yml
  • client/go.mod
  • client/package.json

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-integration can currently succeed without running any tests because the Makefile treats missing go.mod as “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

Copilot AI review requested due to automatic review settings April 6, 2026 16:49
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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, and client/src/** implementation) and introduce a new Go module + Cobra CLI under client/.
  • 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 an output key, but the server tool schema expects database (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-scanning and sarif command groups (and related files like cmd/code_scanning.go, cmd/sarif.go), but the current client/cmd/ only implements integration-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


Copilot AI review requested due to automatic review settings April 6, 2026 17:15
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 ... to make -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.json usage 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

  • resolvePathPlaceholders only 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

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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/ with make -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 --mode or MCP_MODE, but the Go CLI currently only reads the --mode flag (no env binding for MCP_MODE). Either wire MCP_MODE into the flag default or update the docs to avoid implying env var support.
    client/README.md:101
  • The environment variable table lists MCP_MODE as supported, but earlier the README states the CLI does not read MCP_MODE. Either remove/clarify MCP_MODE here 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 read MCP_MODE (mode is only set via --mode). Either remove MCP_MODE here 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

Copilot AI review requested due to automatic review settings April 6, 2026 18:20
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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', but client/scripts/run-integration-tests.sh interprets 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

Copilot AI review requested due to automatic review settings April 6, 2026 18:54
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 to make -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

Copilot AI review requested due to automatic review settings April 6, 2026 23:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 legacy client/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

Copilot AI and others added 3 commits April 6, 2026 21:23
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>
Copilot AI and others added 14 commits April 6, 2026 21:23
…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>
Copilot AI review requested due to automatic review settings April 7, 2026 03:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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 the gh-ql-mcp-client binary.
  • 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

@data-douser
Copy link
Copy Markdown
Collaborator Author

@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>
Copilot AI review requested due to automatic review settings April 7, 2026 04:56
@data-douser data-douser review requested due to automatic review settings April 7, 2026 04:56
…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>
Copilot AI review requested due to automatic review settings April 7, 2026 04:57
@data-douser data-douser review requested due to automatic review settings April 7, 2026 04:57
Copy link
Copy Markdown
Contributor

Copilot AI commented Apr 7, 2026

@copilot Use TDD methodology to detect the current problems and apply changes for the comments in [this thread](#223 (comment)...

Addressed in commits 0092f97 and 056a2b2:

  • client/internal/mcp/client.goClose() now force-kills the subprocess on timeout (TDD-verified with TestClose_KillsSubprocessOnTimeout)
  • client/internal/testing/runner.go — skipped tools now record a TestResult with skipped: prefix so printSummary() reports the correct skipped count
  • extensions/vscode/package.json — removed codeql-mcp.enableAnnotationTools setting
  • server/src/types/monitoring.tsMonitoringConfigSchema.enableAnnotationTools default changed from false to true to match actual server behaviour
  • CHANGELOG.md — wording clarified: ENABLE_ANNOTATION_TOOLS no longer gates tool registration, only auto-caching
  • client/Makefiletest-integration skips pack install by default (--no-install-packs); test-integration-with-packs is the explicit target for dev environments where packs need installing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies Pull requests that update a dependency file documentation Improvements or additions to documentation enhancement New feature or request testing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants