Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 7 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

138,269 changes: 133,655 additions & 4,614 deletions server/dist/codeql-development-mcp-server.js

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions server/dist/codeql-development-mcp-server.js.map

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions server/esbuild.config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { build } from 'esbuild';
import { chmod, mkdir } from 'fs/promises';
import { existsSync } from 'fs';
import { fileURLToPath } from 'url';

const distDir = 'dist';
const entryFile = 'src/codeql-development-mcp-server.ts';
Expand Down Expand Up @@ -33,6 +34,14 @@ const config = {
'const require = __bundled_createRequire__(import.meta.url);',
].join('\n'),
},
// sql.js ships a `./dist/*` wildcard subpath export that esbuild 0.x
// cannot resolve. Map the specifier to its absolute on-disk path so
// esbuild bundles the asm.js build inline into the single output file.
alias: {
'sql.js/dist/sql-asm.js': fileURLToPath(
import.meta.resolve('sql.js/dist/sql-asm.js'),
),
},
// Only generate the bundled JS file and source map
write: true,
metafile: false,
Expand Down
2 changes: 1 addition & 1 deletion server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
"dotenv": "^17.3.1",
"express": "^5.2.1",
"js-yaml": "^4.1.1",
"lowdb": "^7.0.1",
"sql.js": "^1.14.1",
"zod": "^3.25.76"
},
"devDependencies": {
Expand Down
12 changes: 12 additions & 0 deletions server/src/codeql-development-mcp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ import { registerLSPTools } from './tools/lsp';
import { registerLanguageResources } from './resources/language-resources';
import { registerWorkflowPrompts } from './prompts/workflow-prompts';
import { registerMonitoringTools } from './tools/monitoring-tools';
import { registerAnnotationTools } from './tools/annotation-tools';
import { registerAuditTools } from './tools/audit-tools';
import { registerCacheTools } from './tools/cache-tools';
import { sessionDataManager } from './lib/session-data-manager';
import { resolveCodeQLBinary, validateCodeQLBinaryReachable } from './lib/cli-executor';
import { initServerManager, shutdownServerManager } from './lib/server-manager';
Expand Down Expand Up @@ -74,6 +77,15 @@ export async function startServer(mode: 'stdio' | 'http' = 'stdio'): Promise<Mcp
// Register monitoring and reporting tools
registerMonitoringTools(server);

// Register annotation tools (general-purpose notes/bookmarks)
registerAnnotationTools(server);

// Register audit tools (security audit state tracking)
registerAuditTools(server);

// Register query results cache tools
registerCacheTools(server);

// Initialize session data manager
await sessionDataManager.initialize();

Expand Down
20 changes: 16 additions & 4 deletions server/src/lib/cli-executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ import { basename, delimiter, dirname, isAbsolute, join } from 'path';
import { homedir } from 'os';
import { promisify } from 'util';
import { logger } from '../utils/logger';
import { setActualCodeqlVersion, warnOnVersionMismatch } from './codeql-version';

// Re-export version functions so existing callers don't break
export { getActualCodeqlVersion, getTargetCodeqlVersion } from './codeql-version';

const execFileAsync = promisify(execFile);

Expand Down Expand Up @@ -370,9 +374,9 @@ export function resetResolvedCodeQLBinary(): void {
* Validate that the resolved CodeQL binary is actually callable.
*
* Runs `codeql version --format=terse` and verifies the process exits
* successfully. This catches the case where `CODEQL_PATH` is unset and
* `codeql` is not on PATH — the server would otherwise start normally
* but every tool invocation would fail.
* successfully. Stores the actual version for later retrieval via
* getActualCodeqlVersion(). Warns (but does not fail) if the actual
* version differs from the target version in .codeql-version.
*
* @returns The version string reported by the CodeQL CLI.
* @throws Error if the binary is not reachable or returns a non-zero exit code.
Expand All @@ -389,7 +393,15 @@ export async function validateCodeQLBinaryReachable(): Promise<string> {
env,
timeout: 15_000,
});
return stdout.trim();
const version = stdout.trim();

// Store the actual CLI version for cache keys and diagnostics
setActualCodeqlVersion(version);

// Compare with target version and warn on mismatch
warnOnVersionMismatch(version);

return version;
} catch (err: unknown) {
const message = err instanceof Error ? err.message : String(err);
throw new Error(
Expand Down
Loading
Loading