NPM Publishing Guide
December 12, 2025 · View on GitHub
This guide covers the complete process for publishing the MCP ACS Debugger Server packages to NPM, including setup, manual publishing, and automated workflows.
Table of Contents
- Prerequisites
- Initial Setup
- Manual Publishing
- Automated Publishing
- Version Management
- Publishing Checklist
- Troubleshooting
- Post-Publishing
Prerequisites
Before publishing to NPM, ensure you have:
- NPM Account: Create an account at npmjs.com
- Organization Access: Request access to the
@ai-capabilities-suiteorganization (or create your own) - Two-Factor Authentication: Enable 2FA on your NPM account for security
- Node.js: Version 18.0.0 or higher installed
- Repository Access: Write access to the GitHub repository
Initial Setup
1. NPM Account Configuration
Create NPM Account
# If you don't have an account, create one
npm adduser
Login to NPM
# Login to your NPM account
npm login
# Verify you're logged in
npm whoami
Enable Two-Factor Authentication
- Go to npmjs.com/settings/profile
- Navigate to "Two-Factor Authentication"
- Enable 2FA for "Authorization and Publishing"
- Save your recovery codes in a secure location
2. Generate NPM Access Token
For automated publishing via GitHub Actions, you need an access token:
- Go to npmjs.com/settings/tokens
- Click "Generate New Token" → "Classic Token"
- Select "Automation" type (for CI/CD)
- Set permissions:
- ✅ Read and write packages
- ✅ Read and write to the registry
- Copy the token (you won't see it again!)
3. Configure GitHub Secrets
Add the NPM token to your GitHub repository:
- Go to your GitHub repository
- Navigate to Settings → Secrets and variables → Actions
- Click "New repository secret"
- Name:
NPM_TOKEN - Value: Paste your NPM access token
- Click "Add secret"
4. Verify Package Configuration
Check that package.json is properly configured:
{
"name": "@ai-capabilities-suite/mcp-debugger-server",
"version": "1.0.0",
"publishConfig": {
"access": "public",
"registry": "https://registry.npmjs.org/"
},
"files": [
"dist",
"README.md",
"LICENSE",
"API.md",
"TOOL-REFERENCE.md",
"AI-AGENT-INTEGRATION.md",
"VSCODE-INTEGRATION.md"
]
}
Manual Publishing
Pre-Publishing Steps
-
Update Version Number
# Update version in package.json cd packages/mcp-debugger-server npm version patch # or minor, or major -
Clean and Build
# From repository root yarn clean yarn install yarn build -
Run Tests
# Run full test suite yarn test # Run E2E tests yarn test:e2e -
Verify Package Contents
# Dry run to see what will be published cd packages/mcp-debugger-server npm pack --dry-run # Or create actual tarball to inspect npm pack tar -tzf ai-capabilities-suite-mcp-debugger-server-*.tgz
Publishing to NPM
Important: Publishing Order
The MCP ACS Debugger consists of two packages that must be published in order:
- mcp-debugger-core - Core debugging engine (dependency)
- mcp-debugger-server - MCP server (depends on core)
Always publish the core package first, then the server package.
First-Time Publishing
For the first publish, use the --access public flag:
# From repository root - publish both packages
npm run publish:debugger
# Or manually:
# 1. Publish core first
cd packages/mcp-debugger-core
npm publish --access public
# 2. Then publish server
cd ../mcp-debugger-server
npm publish --access public
Subsequent Publishing
# From repository root - publish both packages
npm run publish:debugger
# Or manually:
# 1. Publish core first
cd packages/mcp-debugger-core
npm publish
# 2. Then publish server
cd ../mcp-debugger-server
npm publish
Publish with Build and Test
# From repository root - build, test, then publish
npm run publish:debugger:check
Publishing with Tags
Use tags for pre-release versions:
# Beta release
npm publish --tag beta
# Next/canary release
npm publish --tag next
# Latest (default)
npm publish --tag latest
Verify Publication
After publishing, verify the package:
# Check package info
npm info @ai-capabilities-suite/mcp-debugger-server
# Install in a test directory
mkdir test-install && cd test-install
npm init -y
npm install @ai-capabilities-suite/mcp-debugger-server
# Test the CLI
npx ts-mcp-server --version
Automated Publishing
The repository includes a GitHub Actions workflow for automated publishing.
Workflow Triggers
The workflow can be triggered in two ways:
1. GitHub Release (Recommended)
When you create a GitHub release, the workflow automatically publishes:
# Create and push a tag
git tag v1.0.0
git push origin v1.0.0
# Then create a release on GitHub:
# 1. Go to Releases → Draft a new release
# 2. Choose the tag (v1.0.0)
# 3. Generate release notes
# 4. Publish release
2. Manual Workflow Dispatch
Trigger the workflow manually from GitHub Actions:
- Go to Actions → "Publish to NPM"
- Click "Run workflow"
- Select options:
- Package: Choose which package to publish
- Tag: Choose NPM dist-tag (latest, beta, next)
- Click "Run workflow"
Workflow Configuration
The workflow (.github/workflows/npm-publish.yml) performs:
- ✅ Checkout code
- ✅ Setup Node.js 20
- ✅ Install dependencies
- ✅ Build packages
- ✅ Run tests
- ✅ Publish to NPM with provenance
- ✅ Comment on release with install instructions
Monitoring Workflow
Monitor the publishing workflow:
- Go to Actions tab in GitHub
- Click on the "Publish to NPM" workflow run
- Check each step for success/failure
- Review logs if there are errors
Version Management
Semantic Versioning
Follow Semantic Versioning (SemVer):
- MAJOR (1.0.0 → 2.0.0): Breaking changes
- MINOR (1.0.0 → 1.1.0): New features, backward compatible
- PATCH (1.0.0 → 1.0.1): Bug fixes, backward compatible
Version Update Commands
# Patch version (1.0.0 → 1.0.1)
npm version patch
# Minor version (1.0.0 → 1.1.0)
npm version minor
# Major version (1.0.0 → 2.0.0)
npm version major
# Pre-release versions
npm version prerelease --preid=beta # 1.0.0 → 1.0.1-beta.0
npm version prerelease --preid=alpha # 1.0.0 → 1.0.1-alpha.0
Updating Multiple Packages
When publishing both core and server packages, keep versions synchronized:
# Update mcp-debugger-core
cd packages/mcp-debugger-core
npm version patch # 1.0.0 → 1.0.1
# Update mcp-debugger-server (same version)
cd ../mcp-debugger-server
npm version patch # 1.0.0 → 1.0.1
# Commit version changes
git add .
git commit -m "chore: bump version to 1.0.1"
git push
# Publish both packages
cd ../..
npm run publish:debugger
Note: While the packages can have different versions, it's recommended to keep them synchronized for easier maintenance and user understanding.
Publishing Checklist
Use this checklist before each publish:
Pre-Publish Checklist
- All tests passing (
yarn test) - E2E tests passing (
yarn test:e2e) - Code coverage meets requirements (>90%)
- Documentation updated (README, API docs)
- CHANGELOG.md updated with changes
- Version number updated in package.json
- No uncommitted changes (
git status) - On main/master branch
- Latest code pulled (
git pull) - Dependencies up to date
- Build successful (
yarn build) - Package contents verified (
npm pack --dry-run)
Post-Publish Checklist
- Package visible on npmjs.com
- Installation works (
npm install @ai-capabilities-suite/mcp-debugger-server) - CLI executable works (
npx ts-mcp-server --version) - Documentation links work
- GitHub release created (if applicable)
- Release notes published
- Announcement made (if major release)
- Dependencies updated in dependent projects
Troubleshooting
Common Issues
Issue: "You must be logged in to publish packages"
Solution:
npm login
npm whoami # Verify login
Issue: "You do not have permission to publish"
Causes:
- Not a member of the
@ai-capabilities-suiteorganization - Package name already taken
- 2FA not configured
Solutions:
# Check organization membership
npm org ls @ai-capabilities-suite
# Request access from organization owner
# Or publish under your own scope: @yourusername/package-name
Issue: "Version already exists"
Solution:
# Increment version
npm version patch
# Or manually edit package.json and update version
Issue: "npm ERR! 403 Forbidden"
Causes:
- Invalid NPM token
- Token expired
- Insufficient permissions
Solutions:
- Generate new NPM token
- Update GitHub secret
NPM_TOKEN - Verify token has publish permissions
Issue: "Package size too large"
Solution:
# Check what's being included
npm pack --dry-run
# Update .npmignore to exclude unnecessary files
echo "test/" >> .npmignore
echo "*.spec.ts" >> .npmignore
echo "coverage/" >> .npmignore
Issue: "Build fails in CI"
Solutions:
- Run build locally:
yarn build - Check Node.js version matches CI (18+)
- Verify all dependencies installed
- Check for platform-specific issues
Debugging Failed Publishes
# Enable verbose logging
npm publish --verbose
# Check package contents
npm pack
tar -tzf *.tgz | less
# Verify package.json
cat package.json | jq .
# Test installation locally
npm install ./ai-capabilities-suite-mcp-debugger-server-*.tgz
Post-Publishing
Verify Installation
Test the published package:
# Create test directory
mkdir /tmp/test-mcp-debugger && cd /tmp/test-mcp-debugger
# Initialize project
npm init -y
# Install published package
npm install @ai-capabilities-suite/mcp-debugger-server
# Test CLI
npx ts-mcp-server --version
# Test programmatic usage
node -e "const mcp = require('@ai-capabilities-suite/mcp-debugger-server'); console.log('Success!');"
Update Documentation
After publishing:
-
Update README badges (if using shields.io):
  -
Update installation instructions in README.md
-
Create GitHub release with:
- Version tag (v1.0.0)
- Release notes
- Breaking changes (if any)
- Migration guide (if needed)
-
Announce release:
- GitHub Discussions
- Twitter/Social media
- Discord/Slack communities
- Blog post (for major releases)
Monitor Package Health
After publishing, monitor:
-
NPM Package Page: Check for issues
-
Download Stats: Track adoption
npm info @ai-capabilities-suite/mcp-debugger-server -
GitHub Issues: Watch for bug reports
-
Security Alerts: Monitor for vulnerabilities
npm audit
Best Practices
Security
- Never commit NPM tokens to version control
- Use automation tokens for CI/CD (not personal tokens)
- Enable 2FA on NPM account
- Rotate tokens periodically (every 90 days)
- Use provenance for supply chain security
Quality
- Always run tests before publishing
- Maintain high code coverage (>90%)
- Update documentation with each release
- Follow semantic versioning strictly
- Keep dependencies updated
Process
- Use feature branches for development
- Create pull requests for review
- Tag releases in git
- Maintain CHANGELOG.md
- Automate where possible
Additional Resources
- NPM Publishing Documentation
- Semantic Versioning
- NPM Provenance
- GitHub Actions for NPM
- Package.json Documentation
Support
For publishing issues:
- Check this guide first
- Review NPM documentation
- Open an issue on GitHub
- Contact package maintainers
Last Updated: 2024 Maintainer: Digital Defiance Package: @ai-capabilities-suite/mcp-debugger-server