From b94dfe36e68bede138c228724f1534558c4b0773 Mon Sep 17 00:00:00 2001 From: Jonathan Haas Date: Sat, 23 May 2026 23:16:47 -0700 Subject: [PATCH 1/2] Add MCP Inspector CI smoke --- .github/workflows/ci.yml | 27 +++++++++++++++++++++++++++ package.json | 3 ++- test-workflow.ts | 3 ++- 3 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..c404519 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,27 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + +permissions: + contents: read + +jobs: + test: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [20, 22] + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + cache: npm + - run: npm ci + - run: npm run build + - run: npm test + - run: npm run mcp:inspect diff --git a/package.json b/package.json index cc3c991..0b1a6cd 100644 --- a/package.json +++ b/package.json @@ -8,7 +8,8 @@ "start": "node dist/server.js", "dev": "ts-node src/server.ts", "test": "ts-node test-workflow.ts", - "test-workflow": "ts-node test-workflow.ts" + "test-workflow": "ts-node test-workflow.ts", + "mcp:inspect": "npx -y @modelcontextprotocol/inspector@0.15.0 --cli node dist/server.js --method tools/list" }, "keywords": [], "author": "", diff --git a/test-workflow.ts b/test-workflow.ts index 5f44534..9704080 100644 --- a/test-workflow.ts +++ b/test-workflow.ts @@ -365,8 +365,9 @@ async function main(): Promise { client.cleanup(); process.exit(1); } + client.cleanup(); } if (require.main === module) { main(); -} \ No newline at end of file +} From 04de869d2fb5bffd28dc8fc370a697ec371f0a10 Mon Sep 17 00:00:00 2001 From: Jonathan Haas Date: Sat, 23 May 2026 23:35:42 -0700 Subject: [PATCH 2/2] Ensure workflow test shuts down server --- test-workflow.ts | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/test-workflow.ts b/test-workflow.ts index 9704080..101fb85 100644 --- a/test-workflow.ts +++ b/test-workflow.ts @@ -37,7 +37,7 @@ class MCPTestClient { console.log('šŸš€ Starting Shared Memory MCP Test Workflow\n'); // Start the MCP server - this.server = spawn('npm', ['run', 'dev'], { + this.server = spawn(process.execPath, ['-r', 'ts-node/register', 'src/server.ts'], { stdio: ['pipe', 'pipe', 'pipe'] }); @@ -341,10 +341,26 @@ class MCPTestClient { }); } - cleanup(): void { - if (this.server) { - this.server.kill(); + async cleanup(): Promise { + if (!this.server) { + return; } + + const server = this.server; + this.server = null; + + if (server.exitCode !== null || server.signalCode !== null) { + return; + } + + await new Promise(resolve => { + const timeout = setTimeout(resolve, 2000); + server.once('exit', () => { + clearTimeout(timeout); + resolve(); + }); + server.kill('SIGTERM'); + }); } } @@ -354,18 +370,17 @@ async function main(): Promise { process.on('SIGINT', () => { console.log('\nšŸ›‘ Shutting down...'); - client.cleanup(); - process.exit(0); + void client.cleanup().finally(() => process.exit(0)); }); try { await client.start(); } catch (error: any) { console.error('āŒ Test failed:', error.message); - client.cleanup(); + await client.cleanup(); process.exit(1); } - client.cleanup(); + await client.cleanup(); } if (require.main === module) {