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
This commit is contained in:
+4
-2
@@ -4,6 +4,8 @@
|
|||||||
process.env.NODE_DISABLE_COLORS = '1';
|
process.env.NODE_DISABLE_COLORS = '1';
|
||||||
process.env.NO_COLOR = '1';
|
process.env.NO_COLOR = '1';
|
||||||
|
|
||||||
|
import { fileURLToPath } from "url";
|
||||||
|
|
||||||
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
||||||
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
||||||
import {
|
import {
|
||||||
@@ -1016,11 +1018,11 @@ if (process.env.DEBUG === 'true') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start the server if this file is run directly
|
// 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 => {
|
runServer().catch(error => {
|
||||||
logger.error('Failed to start server:', error);
|
logger.error('Failed to start server:', error);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export default runServer;
|
export default runServer;
|
||||||
|
|||||||
Reference in New Issue
Block a user