Skip to content

chore: provides dedicated cli and library entrypoints - MCP-6 #325

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

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

himanshusinghs
Copy link
Collaborator

Proposed changes

Important changes in this PR are summarised here:

  1. CLI entry point has been moved from src/index.ts to src/cli.ts. The same has been reflected in package json's entry as well under bin
  2. A new entry point (src/lib.ts) has been added for exporting entities to be used by other projects (vscode). For now it exports only the entities necessary for a server creation as per the following commit.
  3. MCP server is now bundled as CommonJS module, using webpack, for both cli and lib entrypoints.
    • Decision to bundle instead of emitting a CommonJS code was taken after several trial and error approaches of trying tsc to emit files such that they could be imported in vscode (which is using classic module resolution) without having import errors and errors in dependency resolution during runtime. So far only bundling approach worked out.
    • Types are emitted using tsc and also referenced in package.json for type resolution in other projects.
  4. We were shipping our entire repo code as the package which was, I suppose, accidental. Added the files entry in package.json to fix this.

All the existing tests pass. What this PR lacks and would be great to have is some type of CLI tests for running the MCP server, possibly also doing some basic e2e. This would give more confidence in doing these bundling changes.

Checklist

Additionally this commit moves the cli entry point from src/index.ts to
src/cli.ts and adds a lib entrypoint in src/lib.ts to export required
entities in vscode extension

tsconfig.build.json has been updated to account for the fact that the
environment for module resolution will be bundler.
node-machine-id is a commonjs module and module.exports from a commonjs
module should be imported using namespace imports as it cannot be
guaranteed that for those exports a synthetic default export will be
created or not.
@himanshusinghs himanshusinghs force-pushed the chore/MCP-6-cjs-bundle branch from be35dfa to 0fcc9f0 Compare June 26, 2025 14:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
1 participant