From webmcp-setup
Guides npm publishing for @mcp-b monorepo packages using changesets: validate build/test/typecheck, create/apply changesets for version bumps and CHangelogs, NPM_TOKEN auth, pnpm publish -r in topological order.
npx claudepluginhub webmcp-org/npm-packagesThis skill uses the workspace's default tool permissions.
Publish packages from this monorepo to npm using **changesets** and `pnpm publish -r`.
Automates npm package releases: bumps versions, updates changelogs from commit logs, commits/pushes to git, publishes via npm or bun, rotates auth tokens via browser.
Automates npm release workflows using changesets: creates patch changeset, fixes lint/test/typecheck/format issues, commits/pushes, monitors CI, merges Version PR, watches publish completion.
Bumps versions in package.json per semantic versioning, updates CHANGELOG.md from git diffs/PRs (skips for betas), formats via justfile if present, commits changes, and creates git tags. Handles monorepos, explicit versions, beta releases, dry-runs.
Share bugs, ideas, or general feedback.
Publish packages from this monorepo to npm using changesets and pnpm publish -r.
NEVER manually edit package.json versions. Manual bumps skip CHANGELOG generation, which means published versions have no record of what changed. This has happened before and must not happen again.
The ONLY exception is beta/canary releases (see below), which use throwaway versions.
Follow these steps in order. Do not skip steps.
pnpm build && pnpm typecheck && pnpm check && pnpm test:unit
Stop if anything fails. Fix it first.
pnpm changeset
This is interactive. It will ask:
This creates a .changeset/<random-name>.md file. You can create multiple changesets
for different changes before releasing.
Fixed versioning note: You only select packages that actually changed. Changesets
automatically bumps ALL packages in the fixed group to the same new version. This is
configured in .changeset/config.json.
pnpm changeset version
This does three things:
version in all package.json files (fixed — all get the same version)CHANGELOG.md entries from the changeset summaries.changeset/*.md files# Check version bumps
git diff packages/*/package.json
# Check generated changelogs
git diff packages/*/CHANGELOG.md
Verify the CHANGELOGs look correct before proceeding.
export $(grep -v '^#' .env | xargs)
The NPM_TOKEN is stored in .env at the repo root (gitignored). If you see
"Access token expired or revoked", the user needs to regenerate their npm token
at https://www.npmjs.com/settings/tokens.
pnpm publish -r --access public --no-git-checks
This publishes ALL packages whose local version doesn't yet exist on npm, in topological order (dependencies before dependents).
Never use npm publish — only pnpm resolves workspace:* and catalog: protocols.
# Quick check: all published versions match local
for pkg in webmcp-types webmcp-polyfill webmcp-ts-sdk transports global mcp-iframe extension-tools react-webmcp smart-dom-reader webmcp-local-relay chrome-devtools-mcp agent-skills; do
LOCAL=$(node -p "require('./packages/$pkg/package.json').version" 2>/dev/null)
NPM=$(npm view @mcp-b/$pkg version 2>/dev/null)
echo "@mcp-b/$pkg: local=$LOCAL npm=$NPM"
done
echo "usewebmcp: local=$(node -p "require('./packages/usewebmcp/package.json').version") npm=$(npm view usewebmcp version 2>/dev/null)"
echo "agent-skills-ts-sdk: local=$(node -p "require('./packages/agent-skills/package.json').version") npm=$(npm view agent-skills-ts-sdk version 2>/dev/null)"
With fixed versioning, ALL versions should be the SAME number.
git add .
git commit -m "chore(release): version packages"
git push origin main
VERSION=$(node -p "require('./packages/global/package.json').version")
gh release create "v$VERSION" --title "v$VERSION" --generate-notes --target main
To attach an MCPB bundle for webmcp-local-relay:
cd packages/webmcp-local-relay && pnpm run build:mcpb && cd ../..
gh release upload "v$VERSION" packages/webmcp-local-relay/webmcp-local-relay-$VERSION.mcpb
Instead of publishing locally, let CI handle it:
pnpm changeset — create changeset locallygit add .changeset/ && git commit -m "chore: add changeset" && git pushpnpm ci:publish (pnpm publish -r --access public) automaticallyBeta releases use throwaway versions and do NOT go through changesets. Do NOT commit the version change — revert it after publishing.
# 1. Generate timestamp version
TIMESTAMP=$(date +%Y%m%d%H%M%S)
# 2. Bump to beta version (do NOT commit this)
npm version 0.0.0-beta-$TIMESTAMP --no-git-tag-version --prefix packages/<package-name>
# 3. Build
pnpm --filter @mcp-b/<package-name> build
# 4. Publish with beta tag
export $(grep -v '^#' .env | xargs)
pnpm publish --filter @mcp-b/<package-name> --access public --no-git-checks --tag beta
# 5. REVERT the version change
git checkout packages/<package-name>/package.json
Install beta versions: pnpm add @mcp-b/<package-name>@beta
pnpm changeset version --snapshot canary
pnpm publish -r --access public --tag canary --no-git-checks
# Revert: git checkout .
All packages share the same version number. This is enforced by the "fixed" setting
in .changeset/config.json. When any package changes, ALL packages bump together.
Benefits:
global@2.0.5 depends on transports@2.0.4, something's wrongpnpm publish -r WorksAll internal dependencies use "workspace:*" in package.json. When pnpm publish runs,
it resolves workspace:* to the current local version. pnpm publish -r publishes in
topological order automatically and skips versions that already exist on npm.
Tier 0 (no internal deps):
@mcp-b/webmcp-types, @mcp-b/smart-dom-reader
Tier 1 (← Tier 0):
@mcp-b/webmcp-polyfill
Tier 2 (← Tier 1):
@mcp-b/webmcp-ts-sdk
Tier 3 (← Tier 2):
@mcp-b/transports
Tier 4 (← Tier 3):
@mcp-b/extension-tools, @mcp-b/mcp-iframe, @mcp-b/global
Tier 5 (← Tier 4):
@mcp-b/react-webmcp, usewebmcp
Independent (no internal deps):
@mcp-b/webmcp-local-relay, @mcp-b/chrome-devtools-mcp, agent-skills-ts-sdk
@mcp-b/webmcp-types (no internal deps)
@mcp-b/smart-dom-reader (no internal deps)
@mcp-b/webmcp-local-relay (no internal deps)
@mcp-b/chrome-devtools-mcp (no internal deps)
agent-skills-ts-sdk (no internal deps)
@mcp-b/webmcp-polyfill → webmcp-types
@mcp-b/webmcp-ts-sdk → webmcp-polyfill, webmcp-types
@mcp-b/transports → webmcp-ts-sdk
@mcp-b/extension-tools → smart-dom-reader, webmcp-ts-sdk
@mcp-b/mcp-iframe → transports, webmcp-ts-sdk, webmcp-types
@mcp-b/global → transports, webmcp-polyfill, webmcp-ts-sdk, webmcp-types
@mcp-b/react-webmcp → global, transports, webmcp-polyfill, webmcp-ts-sdk, webmcp-types
usewebmcp → webmcp-polyfill, webmcp-types
If you discover a stale dependency after publishing:
pnpm changesetpnpm changeset version to bumppnpm publish -r --access public --no-git-checks| Package | Notes |
|---|---|
@mcp-b/webmcp-types | Foundational types. Almost everything depends on this. |
@mcp-b/global | Dual build (ESM + IIFE). Most internal deps. Most vulnerable to chain issues. |
@mcp-b/chrome-devtools-mcp | Complex build — always rm -rf build/ before building. |
usewebmcp | Standalone package. NOT an alias for react-webmcp. |
agent-skills-ts-sdk | Published as agent-skills-ts-sdk (NOT @mcp-b/agent-skills). |
# In repo root .env (gitignored)
NPM_TOKEN=npm_YOUR_TOKEN_HERE
Load before publishing:
export $(grep -v '^#' .env | xargs)
Set via gh secret set NPM_TOKEN.
| Issue | Fix |
|---|---|
workspace:* or catalog: in published package.json | Use pnpm publish, not npm publish |
ERR_PNPM_GIT_UNCLEAN | Add --no-git-checks flag |
| Build files missing from tarball | Check prepublishOnly includes build step |
| Version already exists on npm | Bump to the next patch via pnpm changeset |
| npm view shows old version | Wait 30-60 seconds for propagation |
| No CHANGELOG entries for a version | Version was bumped manually — use changesets next time |
| File | Purpose |
|---|---|
.changeset/config.json | Changesets config (includes fixed versioning groups) |
.npmrc | pnpm registry & auth config |
.env | Local NPM_TOKEN (gitignored) |
scripts/validate-publish.js | Prevents accidental npm (non-pnpm) publish |
.github/workflows/changesets.yml | CI release workflow |
.github/workflows/release-canary.yml | CI canary release workflow |