Skip to content

Commit 9ea4b14

Browse files
committed
Add VS Code extension and discovery tools
Introduce a VS Code extension (extensions/vscode/) that automatically installs, configures, and manages the MCP server. It bridges with vscode-codeql to watch databases and query run results, resolves the CodeQL CLI, and provides an MCP server definition provider. Add two new MCP server tools: - list_codeql_databases: discovers databases in configured base dirs - list_query_run_results: discovers per-run result directories Supporting changes: - Add discovery-config module for env-var-based directory parsing - Set timeout: 0 for fresh-process CodeQL commands in cli-executor - Add .vscode workspace configuration (launch, tasks, mcp) - Add root tsconfig project reference for the extension - Add integration test fixtures for the new tools
1 parent 55addfd commit 9ea4b14

Some content is hidden

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

61 files changed

+5583
-347
lines changed

.vscode/launch.json

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Run Extension",
6+
"type": "extensionHost",
7+
"request": "launch",
8+
"args": [
9+
"--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode"
10+
],
11+
"outFiles": [
12+
"${workspaceFolder}/extensions/vscode/dist/**/*.js",
13+
"${workspaceFolder}/extensions/vscode/dist/**/*.cjs"
14+
],
15+
"preLaunchTask": "npm: bundle - extensions/vscode",
16+
"sourceMaps": true
17+
},
18+
{
19+
"name": "Extension Tests",
20+
"type": "extensionHost",
21+
"request": "launch",
22+
"args": [
23+
"--extensionDevelopmentPath=${workspaceFolder}/extensions/vscode",
24+
"--extensionTestsPath=${workspaceFolder}/extensions/vscode/dist/test/suite/index.cjs"
25+
],
26+
"outFiles": [
27+
"${workspaceFolder}/extensions/vscode/dist/**/*.js",
28+
"${workspaceFolder}/extensions/vscode/dist/**/*.cjs"
29+
],
30+
"preLaunchTask": "npm: bundle - extensions/vscode",
31+
"sourceMaps": true
32+
}
33+
]
34+
}

.vscode/mcp.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"servers": {
3+
"ql-mcp": {
4+
"type": "stdio",
5+
"command": "node",
6+
"args": [
7+
"/Users/data-douser/Git/advanced-security/codeql-development-mcp-server/server/dist/codeql-development-mcp-server.js"
8+
]
9+
}
10+
},
11+
"inputs": []
12+
}

.vscode/tasks.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"version": "2.0.0",
3+
"tasks": [
4+
{
5+
"type": "npm",
6+
"script": "build",
7+
"path": "extensions/vscode",
8+
"label": "npm: build - extensions/vscode",
9+
"group": "build",
10+
"problemMatcher": [],
11+
"detail": "Clean, lint, and bundle the VS Code extension"
12+
},
13+
{
14+
"type": "npm",
15+
"script": "bundle",
16+
"path": "extensions/vscode",
17+
"label": "npm: bundle - extensions/vscode",
18+
"group": "build",
19+
"problemMatcher": [],
20+
"detail": "Bundle the VS Code extension (no lint)"
21+
},
22+
{
23+
"type": "npm",
24+
"script": "watch",
25+
"path": "extensions/vscode",
26+
"label": "npm: watch - extensions/vscode",
27+
"group": "build",
28+
"isBackground": true,
29+
"problemMatcher": [],
30+
"detail": "Watch and rebuild the VS Code extension on changes"
31+
},
32+
{
33+
"type": "npm",
34+
"script": "test",
35+
"path": "extensions/vscode",
36+
"label": "npm: test - extensions/vscode",
37+
"group": "test",
38+
"problemMatcher": [],
39+
"detail": "Run unit tests for the VS Code extension"
40+
},
41+
{
42+
"type": "npm",
43+
"script": "build",
44+
"path": "server",
45+
"label": "npm: build - server",
46+
"group": "build",
47+
"problemMatcher": [],
48+
"detail": "Build the MCP server"
49+
}
50+
]
51+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# `list_codeql_databases` - no_dirs_configured
2+
3+
## Purpose
4+
5+
Tests the `list_codeql_databases` tool when `CODEQL_DATABASES_BASE_DIRS` is not set.
6+
The tool should return a helpful message explaining how to configure it.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"sessions": [
3+
{
4+
"id": "integration_test_session",
5+
"calls": [
6+
{
7+
"tool": "list_codeql_databases",
8+
"timestamp": "2025-09-25T16:06:00.000Z",
9+
"status": "success"
10+
}
11+
]
12+
}
13+
]
14+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"sessions": [],
3+
"parameters": {}
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"toolName": "list_codeql_databases",
3+
"arguments": {}
4+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# `list_query_run_results` - no_dirs_configured
2+
3+
## Purpose
4+
5+
Tests the `list_query_run_results` tool when `CODEQL_QUERY_RUN_RESULTS_DIRS` is not set.
6+
The tool should return a helpful message explaining how to configure it.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"sessions": [
3+
{
4+
"id": "integration_test_session",
5+
"calls": [
6+
{
7+
"tool": "list_query_run_results",
8+
"timestamp": "2025-09-25T16:06:00.000Z",
9+
"status": "success"
10+
}
11+
]
12+
}
13+
]
14+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"sessions": [],
3+
"parameters": {}
4+
}

0 commit comments

Comments
 (0)