Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: project validation not working on windows #21

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

EvitanRelta
Copy link

Fix ESM path handling on Windows

Issue:
ERR_UNSUPPORTED_ESM_URL_SCHEME error occurs on Windows when validating MCP projects due to non-URL file paths in dynamic import().

Cause:
Windows absolute paths (e.g., C:\...) aren't valid ESM URLs. At https://github.com/QuantGeekDev/mcp-framework/blob/eb3a7bf/src/cli/utils/validate-project.ts#L9-L11, the original code used:

await import(packageJsonPath)

which fails on Windows because ESM requires file:// URLs.

Fix:
Use fs.readFile + JSON.parse instead of dynamic import:

const package_json = JSON.parse(await readFile(packageJsonPath, "utf-8"));

@QuantGeekDev
Copy link
Owner

@EvitanRelta Hey, sorry I missed this! This is great, thanks. Can you add me on Discord to walk through this? Here's our server invite link: https://discord.gg/RMCFtcEuYd

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants