Skip to content

Commit 57c569d

Browse files
committed
Changes for initial public release readiness
This commit makes the following changes as part of the overall effort to prepare this 'advanced-security/codeql-development-mcp-server' to be fully ready for initial public release: - Rename entry point to codeql-development-mcp-server.ts - Scope all codeql-pack.yml with advanced-security/ prefix - Add npm publishConfig for GitHub Packages - Add CODEQL_PATH env var with PATH-prepend strategy - New package-paths.ts module for npm-install-safe path resolution - Logger writes all output to stderr (stdout reserved for MCP protocol) - Fix process.cwd() usages in language-resources, language-server-eval, temp-dir, and session-data-manager - Fix relative cwd/test paths resolved against workspaceRootDir - Language server spawn() honors CODEQL_PATH via PATH prepend - Use path.delimiter for Windows portability - Relax engines to node >=22.0.0 - Fix VERSION constant from 1.0.0 to 2.23.9 - Update server/README.md env vars and file listing - Updates unit tests to cover source code changes - Adds 'docs/public.md' documentation of intended public features
1 parent b69e7c6 commit 57c569d

File tree

64 files changed

+1912
-322
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+1912
-322
lines changed

.github/ISSUE_TEMPLATE/mcp-server-primitive-create.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ body:
1919
2020
1. **Repository Context**: Begin by reading these critical reference files:
2121
- **Repository Structure**: `README.md` - Overview of MCP server architecture and capabilities
22-
- **Server Implementation**: `server/src/ql-mcp-server.ts` - Main server implementation
22+
- **Server Implementation**: `server/src/codeql-development-mcp-server.ts` - Main server implementation
2323
- **Existing Tools**: `server/src/tools/codeql-tools.ts` - Current tool implementations
2424
- **Existing Resources**: `server/src/tools/codeql-resources.ts` - Current resource implementations
2525

.github/ISSUE_TEMPLATE/mcp-server-primitive-update.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ body:
1919
2020
1. **Repository Context**: Begin by reading these critical reference files:
2121
- **Repository Structure**: `README.md` - Overview of MCP server architecture
22-
- **Server Implementation**: `server/src/ql-mcp-server.ts` - Main server implementation
22+
- **Server Implementation**: `server/src/codeql-development-mcp-server.ts` - Main server implementation
2323
- **Current Tools**: `server/src/tools/codeql-tools.ts` - Tool implementations to update
2424
- **Current Resources**: `server/src/tools/codeql-resources.ts` - Resource implementations to update
2525

.github/agents/mcp-enabled-ql-query-developer.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
---
22
name: mcp-enabled-ql-query-developer
33
description: An agent enabled with QL MCP Server tools for developing CodeQL queries using test-driven development (TDD).
4-
model: Claude Opus 4.5 (copilot)
5-
tools: ['agent', 'codeql-dev-mcp-server/*', 'edit', 'read', 'search', 'todo', 'web', 'vscode']
4+
model: Claude Opus 4.6 (1M context) (copilot)
5+
tools: ['agent', 'ql-mcp/*', 'edit', 'read', 'search', 'todo', 'web', 'vscode']
66
handoffs:
77
- agent: ql-mcp-tool-developer
88
label: Fix MCP Tool Issue
@@ -18,7 +18,7 @@ handoffs:
1818

1919
My `mcp-enabled-ql-query-developer` agent:
2020

21-
- Uses the QL MCP Server tools (`codeql-dev-mcp-server/*`) to develop, test, and validate CodeQL queries, libraries, and tests.
21+
- Uses the QL MCP Server tools (`ql-mcp/*`) to develop, test, and validate CodeQL queries, libraries, and tests.
2222
- Follows test-driven development (TDD) practices: write tests first, then implement queries to pass those tests.
2323
- Leverages the `codeql` CLI for all CodeQL operations.
2424
- ALWAYS uses verbose help (`codeql <subcommand> -h -vv`) when learning about `codeql` CLI commands.

.github/agents/mcp-enabled-ql-workshop-developer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
name: mcp-enabled-ql-workshop-developer
33
description: An agent that creates CodeQL query development workshops from production queries using the QL MCP Server tools. Use this agent to generate guided learning materials that teach developers how to build CodeQL queries incrementally.
4-
model: Claude Opus 4.5 (copilot)
4+
model: Claude Opus 4.6 (1M context) (copilot)
55
handoffs:
66
- agent: ql-mcp-tool-tester
77
label: Validate Solution Stage
@@ -35,7 +35,7 @@ My `mcp-enabled-ql-workshop-developer` agent:
3535

3636
## Core Capabilities
3737

38-
- Uses the QL MCP Server tools (`codeql-dev-mcp-server/*`) to create comprehensive CodeQL query development workshops.
38+
- Uses the QL MCP Server tools (`ql-mcp/*`) to create comprehensive CodeQL query development workshops.
3939
- Follows the [`create-codeql-query-development-workshop`](../skills/create-codeql-query-development-workshop/SKILL.md) skill to generate workshops from production-grade queries.
4040
- Validates AST/CFG tools queries using the [`validate-ql-mcp-server-tools-queries`](../skills/validate-ql-mcp-server-tools-queries/SKILL.md) skill to ensure non-empty output.
4141
- Leverages the `codeql` CLI for all CodeQL operations.

.github/agents/ql-agent-skills-developer.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: ql-agent-skills-developer
33
description: Develops and improves Agent Skills for the CodeQL Development MCP Server.
44
argument-hint: 'Provide the name(s) of the Agent Skill(s) to be created or improved under the .github/skills/ directory, along with specific requirements where available.'
5-
model: Claude Opus 4.5 (copilot)
5+
model: Claude Opus 4.6 (1M context) (copilot)
66
handoffs:
77
- label: Validate a newly created workshop
88
agent: ql-mcp-tool-tester

.github/agents/ql-mcp-tool-developer.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: ql-mcp-tool-developer
33
description: An agent for developing new tools and/or improving existing tools for the QL MCP Server.
44
argument-hint: 'Provide the name(s) of the CodeQL Development MCP Server tool(s) to be created or improved, along with specific requirements where available.'
5-
model: Claude Opus 4.5 (copilot)
5+
model: Claude Opus 4.6 (1M context) (copilot)
66
handoffs:
77
- label: Test the CodeQL MCP Server tools via workshop
88
agent: ql-mcp-tool-tester
@@ -38,7 +38,7 @@ My `ql-mcp-tool-developer` agent:
3838
- Runs unit tests: `npm test --workspace=server`.
3939
- Runs integration tests: `client/scripts/run-integration-tests.sh`.
4040
- Manually validates tools using: `client/src/ql-mcp-client.js`.
41-
- Verifies server startup/shutdown: `server/dist/ql-mcp-server.js`.
41+
- Verifies server startup/shutdown: `server/dist/codeql-development-mcp-server.js`.
4242
- Maintains server documentation:
4343
- Keeps `server/QL-MCP-SERVER.md` synchronized with tool changes.
4444
- Updates the mermaid architecture diagram for structural changes.

.github/agents/ql-mcp-tool-tester.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name: ql-mcp-tool-tester
33
description: An agent for testing and validating tools for the latest QL Development MCP Server.
44
argument-hint: 'Provide the name(s) of the CodeQL Development MCP Server tool(s) to be tested and validated, along with specific testing requirements, where available.'
5-
model: Claude Opus 4.5 (copilot)
5+
model: Claude Opus 4.6 (1M context) (copilot)
66
---
77

88
# `ql-mcp-tool-tester` Agent

.github/prompts/ql-mcp-server-fix-build-and-test.prompt.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
name: ql-mcp-server-fix-build-and-test
33
description: A prompt for fixing build issues for the QL MCP Server and ensuring extensive testing of the server functionality.
44
agent: ql-mcp-tool-developer
5-
model: Claude Opus 4.5 (copilot)
6-
tools: [agent, edit, execute, memory, read, search, todo, 'codeql-dev-mcp-server/*']
5+
model: Claude Opus 4.6 (copilot)
76
---
87

98
# `ql-mcp-server-fix-build-and-test` Prompt

.github/skills/add-mcp-support-for-new-language/SKILL.md

Lines changed: 29 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,24 +37,27 @@ This skill includes automation scripts to accelerate implementation:
3737

3838
## Quick Reference: Files to Modify
3939

40-
| Category | File Path | Change |
41-
| ----------------- | -------------------------------------------------------------- | --------------------------------------- |
42-
| **TypeScript** | `server/src/prompts/workflow-prompts.ts` | Add to `SUPPORTED_LANGUAGES` |
43-
| | `server/src/lib/query-file-finder.ts` | Add to `LANGUAGE_EXTENSIONS` |
44-
| | `server/src/lib/cli-tool-registry.ts` | Update error message strings |
45-
| **Query Packs** | `server/ql/{language}/tools/src/` | Create 4 tool queries |
46-
| | `server/ql/{language}/tools/test/` | Create test cases |
47-
| **Scripts** | `server/scripts/install-packs.sh` | Add to `VALID_LANGUAGES` + install call |
48-
| | `server/scripts/extract-test-databases.sh` | Add to `VALID_LANGUAGES` |
49-
| | `server/scripts/run-query-unit-tests.sh` | Add to `VALID_LANGUAGES` |
50-
| **Documentation** | `server/ql/README.md` | Add language to list |
51-
| | `server/src/prompts/tools-query-workflow.prompt.md` | Add to supported languages |
52-
| | `server/src/prompts/explain-codeql-query.prompt.md` | Add to language list |
53-
| | `server/src/prompts/document-codeql-query.prompt.md` | Add to language list |
54-
| **Skills** | `.github/skills/create-codeql-query-tdd-generic/SKILL.md` | Add to supported languages |
55-
| | `.github/skills/validate-ql-mcp-server-tools-queries/SKILL.md` | Add to language table |
56-
| **CI/CD** | `.github/workflows/query-unit-tests.yml` | Add to matrix (standard) |
57-
| | `.github/workflows/query-unit-tests-{lang}.yml` | Create if special OS needed |
40+
| Category | File Path | Change |
41+
| ----------------- | -------------------------------------------------------------- | ----------------------------------------------- |
42+
| **TypeScript** | `server/src/prompts/workflow-prompts.ts` | Add to `SUPPORTED_LANGUAGES` |
43+
| | `server/src/lib/query-file-finder.ts` | Add to `LANGUAGE_EXTENSIONS` |
44+
| | `server/src/lib/cli-tool-registry.ts` | Update error message strings |
45+
| **Query Packs** | `server/ql/{language}/tools/src/` | Create 4 tool queries |
46+
| | `server/ql/{language}/tools/test/` | Create test cases |
47+
| **npm Package** | `server/package.json` | Add `ql/{language}/tools/src/` to `files` array |
48+
| **Scripts** | `server/scripts/install-packs.sh` | Add to `VALID_LANGUAGES` + install call |
49+
| | `server/scripts/extract-test-databases.sh` | Add to `VALID_LANGUAGES` |
50+
| | `server/scripts/run-query-unit-tests.sh` | Add to `VALID_LANGUAGES` |
51+
| **Documentation** | `server/ql/README.md` | Add language to list |
52+
| | `server/src/prompts/tools-query-workflow.prompt.md` | Add to supported languages |
53+
| | `server/src/prompts/explain-codeql-query.prompt.md` | Add to language list |
54+
| | `server/src/prompts/document-codeql-query.prompt.md` | Add to language list |
55+
| | `docs/public.md` | Add to Supported Languages table |
56+
| **Skills** | `.github/skills/create-codeql-query-tdd-generic/SKILL.md` | Add to supported languages |
57+
| | `.github/skills/validate-ql-mcp-server-tools-queries/SKILL.md` | Add to language table |
58+
| **CI/CD** | `.github/workflows/query-unit-tests.yml` | Add to matrix (standard) |
59+
| | `.github/workflows/query-unit-tests-{lang}.yml` | Create if special OS needed |
60+
| | `.github/workflows/release.yml` | Add to `LANGUAGES` list in pack publish step |
5861

5962
## Phase 1: Create Query Pack Structure
6063

@@ -97,7 +100,7 @@ server/ql/{language}/tools/
97100
Create `server/ql/{language}/tools/src/codeql-pack.yml`:
98101

99102
```yaml
100-
name: ql-mcp-{language}-tools-src
103+
name: advanced-security/ql-mcp-{language}-tools-src
101104
version: 0.0.1
102105
library: false
103106
dependencies:
@@ -109,11 +112,11 @@ dependencies:
109112
Create `server/ql/{language}/tools/test/codeql-pack.yml`:
110113

111114
```yaml
112-
name: ql-mcp-{language}-tools-test
115+
name: advanced-security/ql-mcp-{language}-tools-test
113116
version: 0.0.1
114117
dependencies:
115118
codeql/{language}-queries: '*'
116-
ql-mcp-{language}-tools-src: '*'
119+
advanced-security/ql-mcp-{language}-tools-src: ${workspace}
117120
extractor: { language }
118121
```
119122

@@ -545,12 +548,16 @@ Before submitting the PR:
545548
- [ ] Pack lock files generated (`codeql-pack.lock.yml`)
546549
- [ ] TypeScript source updated and builds successfully
547550
- [ ] All scripts updated with new language
551+
- [ ] `server/package.json` `files` array includes `ql/{language}/tools/src/`
552+
- [ ] `.github/workflows/release.yml` `LANGUAGES` list includes new language
553+
- [ ] `docs/public.md` Supported Languages table updated
548554
- [ ] Documentation updated (4+ files)
549555
- [ ] Skills updated (2+ files)
550556
- [ ] CI workflow configured (matrix or dedicated)
551-
- [ ] Server bundle rebuilt (`server/dist/ql-mcp-server.js`)
557+
- [ ] Server bundle rebuilt (`server/dist/codeql-development-mcp-server.js`)
552558
- [ ] All existing tests still pass
553559
- [ ] New language tests pass
560+
- [ ] `npm pack --dry-run` (from `server/`) includes the new language's `.ql`, `.md`, and `codeql-pack.yml` files
554561

555562
## Success Criteria
556563

.github/skills/upgrade-codeql-cli-and-packs/SKILL.md

Lines changed: 57 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -129,15 +129,15 @@ Then re-verify the `cliVersion` is compatible.
129129

130130
All `codeql-pack.yml` files under `server/ql/*/tools/`:
131131

132-
| Pack Type | Location | Fields to Update |
133-
| --------- | --------------------------------------------- | ------------------------------------ |
134-
| Source | `server/ql/{lang}/tools/src/codeql-pack.yml` | `version`, `codeql/{lang}-all` |
135-
| Test | `server/ql/{lang}/tools/test/codeql-pack.yml` | `version`, `ql-mcp-{lang}-tools-src` |
132+
| Pack Type | Location | Fields to Update |
133+
| --------- | --------------------------------------------- | ------------------------------------------------------ |
134+
| Source | `server/ql/{lang}/tools/src/codeql-pack.yml` | `version`, `codeql/{lang}-all` |
135+
| Test | `server/ql/{lang}/tools/test/codeql-pack.yml` | `version`, `advanced-security/ql-mcp-{lang}-tools-src` |
136136

137137
#### 3.2 Source Pack Template
138138

139139
```yaml
140-
name: ql-mcp-{language}-tools-src
140+
name: advanced-security/ql-mcp-{language}-tools-src
141141
version: X.XX.Y # CLI version without 'v' prefix
142142
library: false
143143
dependencies:
@@ -147,10 +147,10 @@ dependencies:
147147
#### 3.3 Test Pack Template
148148
149149
```yaml
150-
name: ql-mcp-{language}-tools-test
150+
name: advanced-security/ql-mcp-{language}-tools-test
151151
version: X.XX.Y # CLI version without 'v' prefix
152152
dependencies:
153-
ql-mcp-{language}-tools-src: X.XX.Y # Same as version field
153+
advanced-security/ql-mcp-{language}-tools-src: ${workspace}
154154
extractor: { language }
155155
```
156156
@@ -194,17 +194,17 @@ Some library version upgrades cause non-deterministic output ordering changes. I
194194

195195
## Quick Reference: Languages and Pack Names
196196

197-
| Language | Source Pack | Library Dependency |
198-
| ---------- | --------------------------- | --------------------- |
199-
| actions | ql-mcp-actions-tools-src | codeql/actions-all |
200-
| cpp | ql-mcp-cpp-tools-src | codeql/cpp-all |
201-
| csharp | ql-mcp-csharp-tools-src | codeql/csharp-all |
202-
| go | ql-mcp-go-tools-src | codeql/go-all |
203-
| java | ql-mcp-java-tools-src | codeql/java-all |
204-
| javascript | ql-mcp-javascript-tools-src | codeql/javascript-all |
205-
| python | ql-mcp-python-tools-src | codeql/python-all |
206-
| ruby | ql-mcp-ruby-tools-src | codeql/ruby-all |
207-
| swift | ql-mcp-swift-tools-src | codeql/swift-all |
197+
| Language | Source Pack | Library Dependency |
198+
| ---------- | --------------------------------------------- | --------------------- |
199+
| actions | advanced-security/ql-mcp-actions-tools-src | codeql/actions-all |
200+
| cpp | advanced-security/ql-mcp-cpp-tools-src | codeql/cpp-all |
201+
| csharp | advanced-security/ql-mcp-csharp-tools-src | codeql/csharp-all |
202+
| go | advanced-security/ql-mcp-go-tools-src | codeql/go-all |
203+
| java | advanced-security/ql-mcp-java-tools-src | codeql/java-all |
204+
| javascript | advanced-security/ql-mcp-javascript-tools-src | codeql/javascript-all |
205+
| python | advanced-security/ql-mcp-python-tools-src | codeql/python-all |
206+
| ruby | advanced-security/ql-mcp-ruby-tools-src | codeql/ruby-all |
207+
| swift | advanced-security/ql-mcp-swift-tools-src | codeql/swift-all |
208208

209209
## Lessons Learned
210210

@@ -232,6 +232,45 @@ dependencies:
232232

233233
Library upgrades can cause non-deterministic ordering changes in query output. These are cosmetic differences - update `.expected` files when the logic is unchanged but output order differs.
234234

235+
### npm Package `files` Field Limitations
236+
237+
npm's `files` field does **not** support intermediate wildcard patterns like `ql/*/tools/src/`. Each language directory must be listed explicitly:
238+
239+
```json
240+
"files": [
241+
"dist/",
242+
"ql/actions/tools/src/",
243+
"ql/cpp/tools/src/",
244+
"ql/csharp/tools/src/",
245+
...
246+
]
247+
```
248+
249+
When adding a new language, add its `ql/{language}/tools/src/` entry to `server/package.json` `files`.
250+
251+
### Exclude `.qlx` Files from npm
252+
253+
`server/.npmignore` must contain `*.qlx` to prevent compiled CodeQL query bytecode (which is OS/architecture-specific) from being included in the npm package.
254+
255+
### Server Logger Writes to stderr Only
256+
257+
All `logger.info/warn/error/debug` methods write to `stderr` via `console.error`. This is **required** because in stdio transport mode, stdout is reserved exclusively for the MCP JSON-RPC protocol. Any non-protocol bytes on stdout corrupt the message stream.
258+
259+
### CODEQL_PATH Environment Variable
260+
261+
The server resolves the CodeQL CLI binary at startup via `resolveCodeQLBinary()` in `cli-executor.ts`. The `CODEQL_PATH` env var takes an **absolute path** to the `codeql` binary, bypassing PATH lookup. This is critical for users who have multiple CodeQL CLI versions installed.
262+
263+
### Publishing: `codeql pack publish`
264+
265+
- Use `--threads=-1` (leave 1 core unused) for parallel compilation
266+
- `GITHUB_TOKEN` env var is recognized automatically — no need for `--github-auth-stdin`
267+
- Precompilation is enabled by default (only `--no-precompile` opt-out exists)
268+
- The `codeql pack install` subcommand does **not** have a `--threads` flag
269+
270+
### LICENSE File Name
271+
272+
The actual license file is `LICENSE` (no `.md` extension). Workflow steps and documentation must reference `LICENSE`, not `LICENSE.md`.
273+
235274
## Helper Script
236275

237276
See [verify-pack-compatibility.sh](verify-pack-compatibility.sh) for automated compatibility checking.

0 commit comments

Comments
 (0)