You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: .github/agents/ql-mcp-tool-tester.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -15,7 +15,7 @@ My `ql-mcp-tool-tester` agent:
15
15
- Focuses specifically on validating the functionality of the tools/primitives of the latest (developer) version of the CodeQL Development MCP Server, using actual CodeQL packs, queries, and query unit tests.
16
16
- Utilizes the environment provided by `.github/workflows/copilot-setup-steps.yml` with pre-installed `codeql` CLI.
17
17
- Understands how to:
18
-
- Use the CodeQL Development MCP **Client**located at `client/src/ql-mcp-client.js` to interact with the MCP server (e.g. start/stop the server, list available tools, list available prompts, list available resources, etc.).
18
+
- Use the Go MCP **Client**(`gh-ql-mcp-client`) to interact with the MCP server (e.g. run integration tests, connect over stdio or HTTP).
19
19
- Use the Agent Skills defined under `.github/skills/**` for creating, updating, and testing custom CodeQL queries using the tools of the CodeQL Development MCP Server.
20
20
-**Validate AST/CFG tools queries** using the [`validate-ql-mcp-server-tools-queries`](../skills/validate-ql-mcp-server-tools-queries/SKILL.md) skill to ensure `PrintAST`, `PrintCFG`, `CallGraphFrom`, and `CallGraphTo` queries return **non-empty, meaningful output**.
21
21
- Serially test the "exercises" and/or "solutions" from a given CodeQL development workshop, as long as the workshop uses a directory and file structure compatible with the [`create-codeql-query-development-workshop`](../skills/create-codeql-query-development-workshop/) skill, with the goal of using a known good (e.g. example) workshop to validate MCP tool functionality in complex development scenarios using real CodeQL packs, queries, and query unit tests.
description: 'Instructions for MCP client Go source code files.'
4
+
---
5
+
6
+
# Copilot Instructions for `client/**/*.go` code files
7
+
8
+
## PURPOSE
9
+
10
+
The `client/` directory implements `gh-ql-mcp-client`, a Go CLI that combines GitHub Code Scanning REST API operations (via `go-gh`) with the CodeQL Development MCP Server's SARIF analysis tools (via `mcp-go`). It serves as both a standalone CLI / `gh` extension for Code Scanning alert lifecycle management and as an integration test runner for MCP server primitives.
11
+
12
+
## REQUIREMENTS
13
+
14
+
- ALWAYS use modern Go idioms and standard library conventions.
15
+
- ALWAYS follow best practices for implementing secure Go code.
16
+
- ALWAYS order imports with standard library first, then external packages, then internal packages.
17
+
- ALWAYS follow a test-driven development (TDD) approach — write Go tests before implementing new functionality.
18
+
-**ALWAYS run `npm run build-and-test` from the repo root directory and ensure it passes completely before committing any changes. This is MANDATORY and must be verified before every commit.**
19
+
- ALWAYS fix lint issues by running `make -C client lint` before committing changes.
20
+
-**ALWAYS run `make -C client test-unit` and ensure all Go unit tests pass before committing changes to client code.**
21
+
- ALWAYS reference the [client_integration_tests.instructions.md](./client_integration_tests.instructions.md) and [client/integration-tests/README.md](../../client/integration-tests/README.md) files when implementing or modifying integration tests for MCP server primitives.
22
+
23
+
## PREFERENCES
24
+
25
+
- PREFER using Cobra subcommands for CLI structure (`client/cmd/`).
26
+
- PREFER keeping each command in its own file (e.g., `client/cmd/code_scanning_list_alerts.go`).
27
+
- PREFER the `internal/` package layout for non-exported packages (`github/`, `mcp/`, `testing/`).
28
+
- PREFER table-driven tests with `t.Run` subtests.
29
+
- PREFER simple integration tests with `test-config.json` fixtures over complex programmatic setup.
30
+
- PREFER building on the existing integration test approach rather than implementing a new approach.
31
+
32
+
## CONSTRAINTS
33
+
34
+
- NEVER leave any trailing whitespace on any line.
35
+
- NEVER guess at what an MCP server primitive is supposed to do; instead, look up its source code in `server/src/**/*.ts` files.
36
+
- NEVER use `os.TempDir()`, `/tmp`, or any OS-level temporary directory — use the project-local `.tmp/` directory via `{{tmpdir}}` in test fixtures.
Copy file name to clipboardExpand all lines: .github/instructions/client_integration_tests.instructions.md
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,14 +9,14 @@ description: 'Instructions for working with client-side integration tests for th
9
9
10
10
This file contains instructions for working with test files in the `client/integration-tests/` directory of the `codeql-development-mcp-client` repository.
11
11
12
-
The purpose of the entire `client/**` implementation is to provide integration tests for the MCP server primitives, as implemented in `server/src/**/*.ts` files. The `client/integration-tests/**` directory contains a directory structur that reflects the endpoints of the MCP server primitives under test, where a given parent test directory should contain child/leaf test subdirectories for expected contents of some file(s) "before" versus "after" calling the MCP server primitive (e.g. MCP server tool) under test.
12
+
The purpose of the entire `client/**` implementation is to provide integration tests for the MCP server primitives, as implemented in `server/src/**/*.ts` files, and to serve as a Go CLI (`gh-ql-mcp-client`) for Code Scanning alert lifecycle management. The `client/integration-tests/**` directory contains a directory structure that reflects the endpoints of the MCP server primitives under test, where a given parent test directory should contain child/leaf test subdirectories for expected contents of some file(s) "before" versus "after" calling the MCP server primitive (e.g. MCP server tool) under test.
13
13
14
14
## REQUIREMENTS
15
15
16
16
-**ALWAYS run `npm run build-and-test` from the repo root directory and ensure it passes completely before committing any changes. This is MANDATORY and must be verified before every commit.**
17
-
-**ALWAYS run `npm test` from the `client/`directory and ensure all integration tests pass before committing changes to integration tests.**
17
+
-**ALWAYS run `make -C client test` from the repo root directory and ensure all Go unit tests and integration tests pass before committing changes to integration tests.**
18
18
- ALWAYS fix lint errors by running `npm run lint:fix` from the repo root directory before committing changes.
19
-
- ALWAYS define "before" and "after" files for `monitoring-state.json`, plus any other files used as integration test inputs (before) and outputs (after). If a file is used as an input but is not modified by the MCP server tool under test, then `ex_tool/ex_test/before/example_file.ex` should have identical contents to `ex_tool/ex_test/after/example_file.ex`.
19
+
- ALWAYS define `test-config.json` or `before/monitoring-state.json` (with embedded `parameters`) for each test case to supply tool arguments to the Go test runner.
20
20
- ALWAYS follow the structure for integration tests as described in the [client/integration-tests/README.md](../../client/integration-tests/README.md) file.
21
21
- ALWAYS obey the `Requirements for Integration Tests` as described in the [client/integration-tests/README.md](../../client/integration-tests/README.md) file.
description: 'Instructions for MCP client JavaScript source code files.'
2
+
applyTo: 'client/**/*.go'
3
+
description: 'Instructions for MCP client Go source code files.'
4
4
---
5
5
6
-
# Copilot Instructions for `client/src/**/*.js` code files
6
+
# Copilot Instructions for `client/**/*.go` code files
7
7
8
8
## PURPOSE
9
9
10
-
The purpose of the entire `client/**` implementation is to provide integration tests for the MCP `server/**` implementation. Accordingly, the client is implemented in JavaScript (only) and is not intended to be a production-quality MCP client library.
10
+
The `client/` directory implements `gh-ql-mcp-client`, a Go CLI that combines GitHub Code Scanning REST API operations (via `go-gh`) with the CodeQL Development MCP Server's SARIF analysis tools (via `mcp-go`). It serves as both a standalone CLI / `gh` extension for Code Scanning alert lifecycle management and as an integration test runner for MCP server primitives.
11
11
12
12
## REQUIREMENTS
13
13
14
-
- ALWAYS use modern JavaScript syntax and features.
15
-
- ALWAYS follow best practices for implementing secure JavaScript code.
16
-
- ALWAYS order imports, definitions, static lists, and similar constructs alphabetically.
14
+
- ALWAYS use modern Go idioms and standard library conventions.
15
+
- ALWAYS follow best practices for implementing secure Go code.
16
+
- ALWAYS order imports with standard library first, then external packages, then internal packages.
17
+
- ALWAYS follow a test-driven development (TDD) approach — write Go tests before implementing new functionality.
17
18
-**ALWAYS run `npm run build-and-test` from the repo root directory and ensure it passes completely before committing any changes. This is MANDATORY and must be verified before every commit.**
18
-
- ALWAYS fix lint errors by running `npm run lint:fix` from the repo root directory before committing changes.
19
-
-**ALWAYS run `npm test` from the `client/` directory and ensure all integration tests pass before committing changes to client code.**
19
+
- ALWAYS fix lint issues by running `make -C client lint` before committing changes.
20
+
-**ALWAYS run `make -C client test-unit`and ensure all Go unit tests pass before committing changes to client code.**
20
21
- ALWAYS reference the [client_integration_tests.instructions.md](./client_integration_tests.instructions.md) and [client/integration-tests/README.md](../../client/integration-tests/README.md) files when implementing or modifying integration tests for MCP server primitives.
21
22
22
-
## PREFERNCES
23
+
## PREFERENCES
23
24
24
-
- PREFER keeping the `client/src/ql-mcp-client.js` entrypoint simple and focused on high-level logic.
25
-
- PREFER creating client helper modules with `client/src/<module>/*.js` files that are focused on a single concern.
26
-
- PREFER simple integration tests with "before" and "after" states over complex programmatic setup.
27
-
- PREFER building on the existing integration test approach and framework rather than implementing a new approach.
25
+
- PREFER using Cobra subcommands for CLI structure (`client/cmd/`).
26
+
- PREFER keeping each command in its own file (e.g., `client/cmd/code_scanning_list_alerts.go`).
27
+
- PREFER the `internal/` package layout for non-exported packages (`github/`, `mcp/`, `testing/`).
28
+
- PREFER table-driven tests with `t.Run` subtests.
29
+
- PREFER simple integration tests with `test-config.json` fixtures over complex programmatic setup.
30
+
- PREFER building on the existing integration test approach rather than implementing a new approach.
28
31
29
-
## CONTRAINTS
32
+
## CONSTRAINTS
30
33
31
34
- NEVER leave any trailing whitespace on any line.
32
-
- NEVER guess at what an MCP server primitive is supposed do; instead, look up its source code in `server/src/**/*.ts` files.
35
+
- NEVER guess at what an MCP server primitive is supposed to do; instead, look up its source code in `server/src/**/*.ts` files.
36
+
- NEVER use `os.TempDir()`, `/tmp`, or any OS-level temporary directory — use the project-local `.tmp/` directory via `{{tmpdir}}` in test fixtures.
Copy file name to clipboardExpand all lines: .github/prompts/ql-mcp-server-fix-build-and-test.prompt.md
+22-18Lines changed: 22 additions & 18 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -58,49 +58,53 @@ npm run test
58
58
59
59
#### Starting and Stopping the QL MCP Server for Client Integration Tests
60
60
61
-
QL MCP Client integration tests require the QL MCP Server to be running. You can start the server in a separate terminal window using:
61
+
For HTTP mode integration tests, the QL MCP Server must be running. You can start the server using the shell scripts:
62
62
63
63
```bash
64
-
## From the `client/` directory use `npm run server:start && npm run server:wait`.
65
-
## From the root of the repository use:
66
-
npm run server:start -w client && npm run server:wait -w client
64
+
client/scripts/start-server.sh
65
+
client/scripts/wait-for-server.sh
67
66
```
68
67
69
-
To stop the server after running the integration tests, use:
68
+
To stop the server after running the integration tests:
70
69
71
70
```bash
72
-
## From the `client/` directory use `npm run server:stop`.
73
-
## From the root of the repository use:
74
-
npm run server:stop -w client
71
+
client/scripts/stop-server.sh
75
72
```
76
73
74
+
For stdio mode, the Go client spawns the server automatically — no manual start/stop is needed.
75
+
77
76
#### Fixing Client Integration Tests for the QL MCP Server
78
77
79
-
Client integration tests are executed via the `client/src/ql-mcp-client.js` script.
78
+
Client integration tests are executed via the Go binary `gh-ql-mcp-client`.
80
79
81
-
To get help on using the MCP Client script, including help for the `integration-tests` subcommand, run:
80
+
To get help on using the MCP Client binary, including help for the `integration-tests` subcommand, run:
82
81
83
82
```bash
84
-
node src/ql-mcp-client.js --help
83
+
gh-ql-mcp-client --help
85
84
```
86
85
87
-
When focusing specifically on fixing client integration tests, it makes more sense to change directories to `cd client/` and then run the integration tests directly using `node src/ql-mcp-client.js integration-tests`.
86
+
When focusing specifically on fixing client integration tests, build the binary and run the integration tests directly:
-[`package.json`](../../package.json) - The main `package.json` file that defines the `scripts` for building and testing the MCP Server, with references to the `server/` and `client/` workspaces.
108
+
-[`package.json`](../../package.json) - The main `package.json` file that defines the `scripts` for building and testing the MCP Server, with references to the `server/`workspace and `make -C client` targets.
105
109
-[`server/package.json`](../../server/package.json) - The `package.json` file in the `server/` workspace that defines the build and test scripts specific to the MCP Server.
106
-
-[`client/package.json`](../../client/package.json) - The `package.json` file in the `client/`workspace that defines the integration test scripts for the MCP Client.
110
+
-[`client/Makefile`](../../client/Makefile) - The Makefile in the `client/`directory that defines build, test, lint, and cross-compile targets for the Go CLI.
0 commit comments