Skip to content

Conversation

paoloricciuti
Copy link
Member

This sets up the project for the stdio transport...is still missing the db setup, but I'm actually questioning if we should bundle the db in the cli instead of downloading it when the user runs npx @sveltejs/mcp setup, especially because we would find the right place where to put the db, have conditional configurations for drizzle for minimal gains (we can publish a new version every now and then with the updated DB to get the cli users the updated documentation, we might even automate it).

There's some bit of weirdness going on, specifically, we need to install eslint as a dependency because the bundler doesn't touch the require('eslint/use-at-your-own-risk'); in eslint-plugin-svelte...by having it as a dependency, we guarantee that eslint will be available at runtime and can be installed.

It also makes the actual file a tad lighter (currently sits at 12MB, it was 17MB 🤯).

Copy link

vercel bot commented Sep 24, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
mcp Ready Ready Preview Comment Sep 24, 2025 8:47am

"type": "git",
"url": "git+https://github.com/sveltejs/mcp.git"
},
"author": "Author Name <author.name@mail.com>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

needs an update?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ugh yeah i meant to remove it

"files": [
"dist"
],
"main": "./dist/index.js",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer exports map over main

main and bin being the same seems odd as well. does this export anything or is it cli only? maybe just remove main and not have an exports map?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Uh I was sure i removed it...fixing now

platform: 'node',
define: {
// some eslint-plugin-svelte code expects __filename to exists but in an ESM environment it does not.
__filename: '""',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doesn't that risk breaking stuff if something actually uses __filename ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I checked and it doesn't seem to be used by anything we use really...maybe we can define it with the actual current filename using import.meta.url?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually scratch that we can replace it with import.meta.filename

// some eslint-plugin-svelte code expects __filename to exists but in an ESM environment it does not.
__filename: '""',
},
// we need eslint at runtime but the bundler doesn't bundle `require`'s which `eslint-plugin-svelte` uses to require
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where does eslint-plugin-svelte come from? i don't see it in dependencies

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a dependency of @sveltejs/mcp-server

@paoloricciuti paoloricciuti merged commit a7041a4 into main Sep 24, 2025
5 checks passed
@paoloricciuti paoloricciuti deleted the setup-cli-project branch September 24, 2025 13:04
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