From 03a381274a21e6698872878b6a9d60020fa1b8d5 Mon Sep 17 00:00:00 2001 From: Thomas Payne Date: Tue, 15 Jul 2025 23:33:39 -0400 Subject: [PATCH] Support windows This fix made it work on windows for me. based on https://stackoverflow.com/questions/34842738/if-name-main-equivalent-in-javascript-es6-modules/63193714#63193714 --- src/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index 1b2f835..53249a3 100755 --- a/src/index.js +++ b/src/index.js @@ -4,6 +4,8 @@ process.env.NODE_DISABLE_COLORS = '1'; process.env.NO_COLOR = '1'; +import { fileURLToPath } from "url"; + import { Server } from '@modelcontextprotocol/sdk/server/index.js'; import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'; import { @@ -1016,11 +1018,11 @@ if (process.env.DEBUG === 'true') { } // Start the server if this file is run directly -if (import.meta.url === `file://${process.argv[1]}`) { +if (fileURLToPath(import.meta.url) === process.argv[1]) { runServer().catch(error => { logger.error('Failed to start server:', error); process.exit(1); }); } -export default runServer; \ No newline at end of file +export default runServer;