Skip to content

Commit 8c98a4e

Browse files
authored
fix: call startMcpServer explicitly from CLI to fix npx bundling issue (#237)
1 parent 484a996 commit 8c98a4e

2 files changed

Lines changed: 8 additions & 3 deletions

File tree

packages/cli/src/index.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ if (args.length === 0) {
1919
// No arguments, start MCP server
2020
const isLocal = existsSync(join(__dirname, '../../mcp-server/dist/index.js'));
2121
if (isLocal) {
22-
import('../../mcp-server/dist/index.js');
22+
const { startMcpServer } = await import('../../mcp-server/dist/index.js');
23+
await startMcpServer();
2324
} else {
2425
// Use string literal to avoid TypeScript resolution issues
2526
const mcpServerModule = '@codemcp/workflows-server';
26-
import(mcpServerModule);
27+
const { startMcpServer } = await import(mcpServerModule);
28+
await startMcpServer();
2729
}
2830
} else {
2931
// Any arguments, run CLI

packages/mcp-server/src/index.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,11 +78,14 @@ async function main() {
7878
}
7979
}
8080

81+
// Export for explicit invocation by the CLI wrapper
82+
export { main as startMcpServer };
83+
8184
// Start the server if this file is run directly
8285
// More robust check that works with npx and direct execution
8386
const isMainModule =
8487
import.meta.url === `file://${process.argv[1]}` ||
85-
process.argv[1]?.endsWith('@codemcp/workflows-server') ||
88+
process.argv[1]?.endsWith('ade-workflows-server') ||
8689
process.argv[1]?.endsWith('index.js');
8790

8891
if (isMainModule) {

0 commit comments

Comments
 (0)