From 7341884dba8d530d16497b0cfcd6578ae284617c Mon Sep 17 00:00:00 2001 From: Matt Cromwell Date: Wed, 18 Feb 2026 15:20:43 +0100 Subject: [PATCH] Windows fix in source MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit File: drip-mcp-server/src/index.js Import: pathToFileURL is now imported from 'url' along with fileURLToPath. Startup check (bottom of file): Replaced the direct import.meta.url === \file://${process.argv[1]}\`` check with a Windows-safe comparison: // Start the server if run directly (Windows-safe: normalize argv[1] to file URL for comparison)const entryUrl = process.argv[1] ? pathToFileURL(path.resolve(process.argv[1])).href : '';if (entryUrl && import.meta.url === entryUrl) { const server = new DripMCPServer(); server.run().catch(console.error);} Why this works: On Windows, process.argv[1] can be a path like C:\path\to\index.js, so file://${process.argv[1]} is not a valid file:// URL and never matches import.meta.url. Using pathToFileURL(path.resolve(process.argv[1])).href normalizes the script path to the same file:// form as import.meta.url, so the “run directly” check works on Windows (and still works on macOS/Linux). 3. Quick test npm install and node src/index.js were run from c:\CLIENTS\castos\drip-mcp-server with dummy env; the process printed “Drip MCP server running on stdio” and stayed running, so the fix is active. --- src/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index 95fcf18..588b1e1 100644 --- a/src/index.js +++ b/src/index.js @@ -8,7 +8,7 @@ import { } from '@modelcontextprotocol/sdk/types.js'; import dotenv from 'dotenv'; import path from 'path'; -import { fileURLToPath } from 'url'; +import { fileURLToPath, pathToFileURL } from 'url'; import { DripClient } from './drip-client.js'; // Get the directory name @@ -886,8 +886,9 @@ export class DripMCPServer { } } -// Start the server if run directly -if (import.meta.url === `file://${process.argv[1]}`) { +// Start the server if run directly (Windows-safe: normalize argv[1] to file URL for comparison) +const entryUrl = process.argv[1] ? pathToFileURL(path.resolve(process.argv[1])).href : ''; +if (entryUrl && import.meta.url === entryUrl) { const server = new DripMCPServer(); server.run().catch(console.error); }