@@ -48,6 +48,8 @@ export interface McpServeArgs {
4848 readonly jobTtlMs ?: number ;
4949 /** Override default 1-hour checkpoint TTL in ms (--checkpoint-ttl <ms>). */
5050 readonly jobCheckpointTtlMs ?: number ;
51+ /** Persist async job registry to a SQLite database (--job-db <path>). */
52+ readonly jobDb ?: string ;
5153 /** Use Streamable HTTP transport instead of stdio (--http). */
5254 readonly http ?: boolean ;
5355 /** HTTP port (--port <n>, required with --http). */
@@ -90,6 +92,7 @@ export function parseMcpServeArgs(argv: readonly string[]): McpServeArgs {
9092 let asyncMode : boolean | undefined = undefined ;
9193 let jobTtlMs : number | undefined = undefined ;
9294 let jobCheckpointTtlMs : number | undefined = undefined ;
95+ let jobDb : string | undefined = undefined ;
9396 let httpMode : boolean | undefined = undefined ;
9497 let httpPort : number | undefined = undefined ;
9598 let httpHost : string | undefined = undefined ;
@@ -215,6 +218,15 @@ export function parseMcpServeArgs(argv: readonly string[]): McpServeArgs {
215218 break ;
216219 }
217220
221+ case "--job-db" : {
222+ const val = args [ ++ i ] ;
223+ if ( val === undefined || val . startsWith ( "-" ) ) {
224+ throw new Error ( "--job-db requires a path argument" ) ;
225+ }
226+ jobDb = val ;
227+ break ;
228+ }
229+
218230 case "--http" :
219231 httpMode = true ;
220232 break ;
@@ -259,9 +271,11 @@ export function parseMcpServeArgs(argv: readonly string[]): McpServeArgs {
259271
260272 if (
261273 asyncMode !== true &&
262- ( jobTtlMs !== undefined || jobCheckpointTtlMs !== undefined )
274+ ( jobTtlMs !== undefined ||
275+ jobCheckpointTtlMs !== undefined ||
276+ jobDb !== undefined )
263277 ) {
264- throw new Error ( "--job-ttl / --checkpoint-ttl requires --async" ) ;
278+ throw new Error ( "--job-ttl / --checkpoint-ttl / --job-db requires --async" ) ;
265279 }
266280
267281 if ( httpPort !== undefined && httpMode !== true ) {
@@ -302,6 +316,7 @@ export function parseMcpServeArgs(argv: readonly string[]): McpServeArgs {
302316 ...( asyncMode !== undefined ? { async : asyncMode } : { } ) ,
303317 ...( jobTtlMs !== undefined ? { jobTtlMs } : { } ) ,
304318 ...( jobCheckpointTtlMs !== undefined ? { jobCheckpointTtlMs } : { } ) ,
319+ ...( jobDb !== undefined ? { jobDb } : { } ) ,
305320 ...( httpMode !== undefined ? { http : httpMode } : { } ) ,
306321 ...( httpPort !== undefined ? { port : httpPort } : { } ) ,
307322 ...( httpHost !== undefined ? { httpHost } : { } ) ,
@@ -381,6 +396,7 @@ async function runMcpServe(rawArgv: string[]): Promise<void> {
381396 ...( parsed . jobCheckpointTtlMs !== undefined
382397 ? { jobCheckpointTtlMs : parsed . jobCheckpointTtlMs }
383398 : { } ) ,
399+ ...( parsed . jobDb !== undefined ? { jobDbPath : parsed . jobDb } : { } ) ,
384400 } ) ;
385401
386402 if ( parsed . http === true ) {
@@ -464,6 +480,7 @@ export function registerMcpCommand(program: Command): void {
464480 " --async enable async job mode (5 extra tools)\n" +
465481 " --job-ttl <ms> job TTL in ms (default: 1800000, requires --async)\n" +
466482 " --checkpoint-ttl <ms> checkpoint TTL in ms (default: 3600000, requires --async)\n" +
483+ " --job-db <path> persist async job registry to SQLite (requires --async)\n" +
467484 " --http use Streamable HTTP transport instead of stdio\n" +
468485 " --port <n> HTTP port (required with --http)\n" +
469486 " --host <addr> HTTP bind address (default: 127.0.0.1, requires --http)\n" +
0 commit comments