feat: make MCP server publishable as standalone npm package#212
Merged
Conversation
Enable the MCP server to be published as a standalone npm package (css-noop-checker-mcp) runnable via npx. Bundle workspace imports (rules engine, e2e helpers) into a self-contained dist/index.js while keeping runtime deps external. - Add tsup.config.ts with noExternal for workspace paths - Remove "private: true", add bin/exports/files/engines fields - Add prepublishOnly script to prevent publishing without build - Inject package version at build time via define
Prepare the MCP server entry point for npx execution outside the monorepo with better error handling and lifecycle management. - Detect missing Playwright browser and show install instructions - Add shutdown guard in getBrowser() to prevent resource leaks - Inject version from package.json via __PKG_VERSION__ define - Consolidate SIGINT/SIGTERM handlers to reduce duplication - Skip grace period in shutdown when browser was never launched - Move shuttingDown declaration above functions that reference it
Add comprehensive documentation for standalone npx usage including Claude Code and Cursor setup instructions. Include root build script integration so pnpm build from the monorepo also builds the MCP server. - Add Prerequisites, Quick Start, and IDE setup sections - Explain stdio server behavior for users new to MCP - Chain MCP server build into root build script
Match the root package version since both share the same rules engine.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dist/index.jswhile keeping runtime deps (playwright,@modelcontextprotocol/sdk,zod) externalpackage.jsonfor npm publish:bin,exports,files,engines,prepublishOnlydefineCloses #208
Verification
pnpm build(root)pnpm testpnpm lint/pnpm fmtversion: "0.0.1"correctly injectedlist_rulestool callnpm pack --dry-runregisterRulecalls, 44 rule IDs confirmedTest plan
pnpm buildfrom root builds both extension and MCP servernode mcp-server/dist/index.jsstarts and responds to MCP initializelist_rulesreturns all registered rulesnpm pack --dry-runinmcp-server/shows onlydist/,README.md,package.jsonnpx playwright install chromiummessage appears when browser is missing