Skip to content

Commit 468b7ca

Browse files
committed
Update docs for vscode extension
1 parent 70dd490 commit 468b7ca

6 files changed

Lines changed: 129 additions & 6 deletions

File tree

docs/getting-started.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,17 @@ This guide covers installation, configuration, and usage of the CodeQL Developme
1010

1111
## Installation
1212

13-
### From npm (recommended)
13+
### VS Code Extension (recommended)
14+
15+
The easiest way to get started is the **VS Code extension**, which automates
16+
installation, configuration, and CodeQL CLI discovery.
17+
See the [VS Code Extension guide](./vscode/extension.md) for details.
18+
19+
The `.vsix` can be downloaded from
20+
[GitHub Releases](https://github.com/advanced-security/codeql-development-mcp-server/releases)
21+
or built from source (`npm run package:vscode` at the repository root).
22+
23+
### From npm
1424

1525
The package is published to the [public npm registry](https://www.npmjs.com/package/codeql-development-mcp-server). No authentication or special configuration is needed:
1626

docs/vscode/extension.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,34 @@ to do by hand.
1515

1616
## Installation
1717

18-
Install from the VS Code Marketplace:
18+
### From `.vsix` (GitHub Releases)
19+
20+
Download `codeql-development-mcp-server.vsix` from the latest
21+
[GitHub Release](https://github.com/advanced-security/codeql-development-mcp-server/releases),
22+
then install:
23+
24+
```bash
25+
code --install-extension codeql-development-mcp-server.vsix
26+
```
27+
28+
Or in VS Code: **Extensions** sidebar → `` menu → **Install from VSIX…** → select the file.
29+
30+
### From VS Code Marketplace
1931

2032
1. Open VS Code
2133
2. Go to Extensions (`Ctrl+Shift+X` / `Cmd+Shift+X`)
2234
3. Search **"CodeQL Development MCP Server"**
2335
4. Click **Install**
2436

37+
### From Source
38+
39+
From the repository root:
40+
41+
```bash
42+
npm run package:vscode
43+
code --install-extension extensions/vscode/codeql-development-mcp-server.vsix
44+
```
45+
2546
The extension requires the [CodeQL extension](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-codeql) (`GitHub.vscode-codeql`) and will prompt you to install it if missing.
2647

2748
## What it does

extensions/vscode/README.md

Lines changed: 93 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,94 @@
1-
# VS Code Extension for `codeql-development-mcp-server`
1+
# CodeQL Development MCP Server — VS Code Extension
22

3-
TODO
3+
A VS Code extension that automatically installs, configures, and manages the [CodeQL Development MCP Server](https://github.com/advanced-security/codeql-development-mcp-server). It bridges the [`GitHub.vscode-codeql`](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-codeql) extension with AI assistants by exposing CodeQL databases, query results, and MRVA results to the MCP server.
4+
5+
## Prerequisites
6+
7+
- **VS Code** `^1.109.0`
8+
- **Node.js** `>=24.13.0`
9+
- **[CodeQL for VS Code](https://marketplace.visualstudio.com/items?itemName=GitHub.vscode-codeql)** — declared as an `extensionDependency` and must be installed first.
10+
11+
## Installation
12+
13+
### From `.vsix`
14+
15+
```bash
16+
code --install-extension codeql-development-mcp-server.vsix
17+
```
18+
19+
Or in VS Code: **Extensions** sidebar → `` menu → **Install from VSIX…** → select the file.
20+
21+
### From Source
22+
23+
```bash
24+
cd extensions/vscode
25+
npm run package
26+
code --install-extension codeql-development-mcp-server.vsix
27+
```
28+
29+
## What It Does
30+
31+
On activation (`onStartupFinished`), the extension:
32+
33+
1. **Auto-installs** the `codeql-development-mcp-server` npm package (unless `codeql-mcp.autoInstall` is `false`).
34+
2. **Registers an MCP server definition** (`ql-mcp`) so VS Code's Copilot/MCP integration can discover and launch it.
35+
3. **Watches** the CodeQL extension's storage paths for databases, query results, and MRVA results, passing them to the MCP server as environment variables.
36+
37+
## Configuration
38+
39+
All settings are under the `codeql-mcp` namespace in VS Code settings:
40+
41+
| Setting | Default | Description |
42+
| ------------------------------------------ | ---------- | ------------------------------------------------------------------- |
43+
| `codeql-mcp.autoInstall` | `true` | Auto-install/update the MCP server on activation. |
44+
| `codeql-mcp.serverVersion` | `"latest"` | npm version to install (`"latest"` for most recent). |
45+
| `codeql-mcp.serverCommand` | `"node"` | Command to launch the server. Override to `"npx"` or a custom path. |
46+
| `codeql-mcp.serverArgs` | `[]` | Custom args. When empty, the bundled entry point is used. |
47+
| `codeql-mcp.watchCodeqlExtension` | `true` | Watch for databases and results from the CodeQL extension. |
48+
| `codeql-mcp.additionalEnv` | `{}` | Extra environment variables passed to the server process. |
49+
| `codeql-mcp.additionalDatabaseDirs` | `[]` | Additional directories to search for CodeQL databases. |
50+
| `codeql-mcp.additionalMrvaRunResultsDirs` | `[]` | Additional directories containing MRVA run results. |
51+
| `codeql-mcp.additionalQueryRunResultsDirs` | `[]` | Additional directories containing query run results. |
52+
53+
## Commands
54+
55+
Available from the Command Palette (`Cmd+Shift+P` / `Ctrl+Shift+P`):
56+
57+
| Command | Description |
58+
| ------------------------------------------------- | ----------------------------------------------- |
59+
| **CodeQL MCP: Reinstall MCP Server** | Re-download and install the server package. |
60+
| **CodeQL MCP: Reinstall CodeQL Tool Query Packs** | Re-install the bundled CodeQL tool query packs. |
61+
| **CodeQL MCP: Show Status** | Display current server status. |
62+
| **CodeQL MCP: Show Logs** | Open the server log output. |
63+
64+
## Development
65+
66+
### npm Scripts
67+
68+
| Script | What it does | When to use |
69+
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------ | ------------------------------------- |
70+
| `npm run package` | **Builds everything and produces the `.vsix`**. Internally runs `vscode:prepublish` (clean → lint → bundle → bundle:server) then `vsce package`. | **Building a distributable `.vsix`.** |
71+
| `npm run build` | `clean``lint``bundle` (extension only, no server). | Development builds without packaging. |
72+
| `npm run bundle` | esbuild the extension (no lint, no clean). | Fast iteration during development. |
73+
| `npm run watch` | Rebuild the extension on file changes. | Active development. |
74+
| `npm run test` | Run unit tests with Vitest. | Validating changes. |
75+
| `npm run test:coverage` | Run unit tests with coverage. | CI / pre-merge validation. |
76+
| `npm run lint` | Run ESLint on `src/` and `test/`. | Checking code style. |
77+
78+
> **Note:** `vscode:prepublish` is a lifecycle hook invoked automatically by `vsce package` — you should not need to run it directly.
79+
80+
### Project Structure
81+
82+
```text
83+
extensions/vscode/
84+
├── src/
85+
│ ├── extension.ts # Extension entry point (activate/deactivate)
86+
│ ├── bridge/ # Watches CodeQL extension storage paths
87+
│ ├── codeql/ # CodeQL CLI resolution
88+
│ ├── common/ # Shared utilities
89+
│ └── server/ # MCP server lifecycle management
90+
├── test/ # Vitest unit tests
91+
├── esbuild.config.js # Extension bundler config
92+
├── scripts/bundle-server.js # Copies MCP server into the extension
93+
└── package.json
94+
```

extensions/vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
"url": "https://github.com/advanced-security/codeql-development-mcp-server/issues"
1616
},
1717
"engines": {
18-
"vscode": "^1.99.0",
18+
"vscode": "^1.109.0",
1919
"node": ">=24.13.0"
2020
},
2121
"categories": [

package-lock.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"test:client": "npm run test:integration:default -w client",
4848
"test:server": "npm run test -w server",
4949
"test:vscode": "npm run test -w extensions/vscode",
50+
"package:vscode": "npm run package -w extensions/vscode",
5051
"tidy": "npm run lint:fix && npm run format",
5152
"tidy:check": "npm run lint && npm run format:check",
5253
"upgrade": "npm run upgrade:node",

0 commit comments

Comments
 (0)