NPM Publishing Guide
This document explains how to publish the MCP ADR Analysis Server to npmjs.com using the automated GitHub Actions workflow.
๐ Quick Startโ
Automatic Publishing (Recommended)โ
-
Create a version tag:
git tag v1.0.1
git push origin v1.0.1 -
The GitHub Actions workflow will automatically:
- Run all tests and linting
- Build the project
- Test MCP server functionality
- Publish to npmjs.com
- Create a GitHub release
Manual Publishingโ
-
Test the package locally:
npm run test:package -
Publish manually:
npm publish
๐ Prerequisitesโ
NPM Token Setupโ
-
Create an NPM account at https://www.npmjs.com/
-
Generate an access token:
- Go to https://www.npmjs.com/settings/tokens
- Click "Generate New Token"
- Choose "Automation" type
- Copy the token
-
Add token to GitHub Secrets:
- Go to your repository settings
- Navigate to "Secrets and variables" โ "Actions"
- Add a new secret named
NPM_TOKEN - Paste your NPM token as the value
๐ง Publishing Workflow Featuresโ
Automated Quality Checksโ
- โ ESLint code quality validation
- โ Jest test suite execution
- โ TypeScript compilation verification
- โ MCP server functionality testing
- โ Package structure validation
Version Managementโ
- Tag-based publishing: Push a version tag to trigger publishing
- Manual versioning: Use workflow dispatch with version input
- Automatic version updates: Updates package.json version
Package Optimizationโ
- Selective file inclusion: Only includes necessary files
- Size optimization: ~173 KB optimized package
- Binary setup: Includes CLI binary for global installation
๐ฆ Package Informationโ
Installationโ
# Global installation
npm install -g mcp-adr-analysis-server
# Local installation
npm install mcp-adr-analysis-server
Usageโ
# Run as CLI tool
mcp-adr-analysis-server
# Or use as Node.js module
node node_modules/mcp-adr-analysis-server/dist/src/index.js
Package Contentsโ
- Main entry:
dist/src/index.js - Binary:
mcp-adr-analysis-servercommand - Documentation: README.md and ../../LICENSE
- Type definitions: Full TypeScript support
๐ Version Managementโ
Semantic Versioningโ
- Patch (1.0.1): Bug fixes and minor updates
- Minor (1.1.0): New features, backward compatible
- Major (2.0.0): Breaking changes
Publishing Commandsโ
# Patch version (1.0.0 โ 1.0.1)
git tag v1.0.1 && git push origin v1.0.1
# Minor version (1.0.0 โ 1.1.0)
git tag v1.1.0 && git push origin v1.1.0
# Major version (1.0.0 โ 2.0.0)
git tag v2.0.0 && git push origin v2.0.0
Manual Workflow Dispatchโ
You can also trigger publishing manually:
- Go to GitHub Actions tab
- Select "Publish to NPM" workflow
- Click "Run workflow"
- Choose version type (patch/minor/major/prerelease)
๐ก๏ธ Security & Best Practicesโ
Token Securityโ
- โ NPM token stored as GitHub secret
- โ Token only accessible to authorized workflows
- โ Automatic token rotation recommended
Quality Gatesโ
- โ All tests must pass before publishing
- โ Linting must pass before publishing
- โ Build must succeed before publishing
- โ MCP server functionality verified
Package Integrityโ
- โ Package contents verified before publishing
- โ Main entry point validated
- โ Binary accessibility confirmed
- โ Size optimization applied
๐ Monitoring & Maintenanceโ
NPM Package Statsโ
- Package page: https://www.npmjs.com/package/mcp-adr-analysis-server
- Download stats: Available on NPM package page
- Version history: Tracked in NPM registry
GitHub Releasesโ
- Automatic releases: Created for each published version
- Release notes: Generated with feature highlights
- Asset downloads: Package tarballs available
๐ง Troubleshootingโ
Common Issuesโ
-
NPM Token Invalid
- Regenerate token on npmjs.com
- Update GitHub secret
-
Tests Failing
- Check test output in GitHub Actions
- Fix issues locally and push
-
Package Size Too Large
- Review .npmignore file
- Remove unnecessary files
-
Binary Not Working
- Verify package.json bin configuration
- Test locally with
npm run test:package
Supportโ
For issues with the publishing process, check:
- GitHub Actions logs
- NPM package page
- Repository issues section