-
Notifications
You must be signed in to change notification settings - Fork 2
Rewrite ql-mcp-client in Go as a gh CLI extension for Code Scanning SARIF management #207
Copy link
Copy link
Open
0 / 40 of 4 issues completedOpen
0 / 40 of 4 issues completed
Copy link
Labels
enhancementNew feature or requestNew feature or request
Description
Problem
The current ql-mcp-client is a JavaScript/Node.js implementation (client/src/ql-mcp-client.js) that serves primarily as an integration testing harness for the MCP server. It has several limitations:
- No GitHub API integration — cannot authenticate to GitHub or call REST APIs (Code Scanning, etc.) without external tooling
- Not distributable as a
ghextension — requires Node.js runtime and npm workspace setup to run - No SARIF download/upload capability — cannot fetch Code Scanning analyses or alerts from GitHub, making it impossible to use
ql-mcpserver SARIF tools against production data - No LLM integration path — cannot leverage the Copilot SDK for alert validation workflows
- Tightly coupled to npm workspaces — the
client/directory is an npm workspace with its ownpackage.json,eslint.config.mjs, and JS-specific tooling
Desired State
Go CLI binary (gh-ql-mcp-client)
Replace the JS client with a Go binary that serves as both a standalone CLI and a gh CLI extension:
- Go module at
client/with Cobra CLI framework,go-ghfor GitHub API auth,mcp-gofor MCP server communication, andcopilot-sdk/gofor LLM sessions code-scanningsubcommands for interacting with the GitHub Code Scanning REST API:list-analyses— list SARIF analyses for a repolist-alerts— list alerts with state/severity/tool filtersdownload-analysis— download SARIF viaAccept: application/sarif+jsondownload-alerts— download alert details with instancesdismiss alerts— batch dismiss with--from-filemanifest supportreopen alerts— batch reopen dismissed alerts
sarifsubcommands that delegate toql-mcpserver tools:compare alerts— callsarif_compare_alertsincluding fingerprint modecompare analyses— callsarif_diff_runsdeduplicate— orchestrate multi-step dedup workflow producing a dismiss manifestvalidate alert— LLM-driven TP/FP assessment via Copilot SDKvalidate analysis— batch validation across all alerts
- Integration test runner — Go port of the JS test runner that discovers and runs all fixtures in
client/integration-tests/, calls MCP tools via stdio or HTTP transport, and checks tool availability at runtime ghextension packaging — cross-compiled binaries for darwin/linux/windows, installable viagh extension install
Server enhancements
New and enhanced ql-mcp server tools to support the client's Code Scanning workflows:
sarif_storetool — ingest SARIF content (from file or inline JSON string) into the session cache; return acacheKeyfor consumption by existingsarif_*toolssarif_deduplicate_rulestool — pairwise rule comparison across two SARIF files using fingerprint-first, full-path-fallback overlap analysisfingerprintoverlap mode insarif_compare_alerts— comparepartialFingerprintshashes with automatic fallback tofull-pathmode when fingerprints are absent (thepartialFingerprintsfield is already parsed inSarifResultSchemabut unused today)
Infrastructure
- Remove
client/from npm workspaces; rootpackage.jsonscripts invokemake -C clienttargets (build, test, lint, clean) client-integration-tests.ymlworkflow needsactions/setup-go, annotation tools enabled by default, andmake-based test invocationlint-and-format.ymlworkflow needsactions/setup-gosincenpm run lintwill invokego vetrun-integration-tests.shbuilds the Go binary, extracts test databases, and runs the Go integration test runnernpm run build-and-testmust pass end-to-end across server, client, and VS Code extension
Testing approach
- TDD methodology throughout — write Go unit tests before implementing each subcommand and internal package
- Client integration tests — all 82+ existing fixtures in
client/integration-tests/primitives/tools/must pass with the Go runner - Annotation tools enabled by default — audit, annotation, SARIF, and cache tools are core to the client's workflows and must be exercised in CI
- Monitoring/session tools deprecated — skip
session_*andsessions_*tool tests - Tool availability enforcement — if a non-deprecated tool's test fixture exists but the tool is not registered on the server, the test must fail (not silently skip)
Use cases enabled
- Alert deduplication after query changes — download SARIF from two analyses (before/after a CodeQL query pack upgrade), use
sarif_deduplicate_rulesto identify overlapping alerts, produce a dismiss manifest, and bulk-dismiss duplicates - LLM-driven alert triage — download alerts and source code, create a Copilot SDK session with MCP tools as custom tools, send assessment prompts, and produce structured TP/FP verdicts with confidence scores
- Cross-analysis comparison — download SARIF from different branches, CodeQL versions, or repos, and use
sarif_diff_runsandsarif_compare_alertsto detect behavioral regressions or new coverage - Alert lifecycle management — read, assess, clean up, and restore the approved set of Code Scanning alerts for a repository
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request