MCP server for GitHub Copilot CLI to automate NPM package publishing with Git integration
npm install copilot-npm-publisherbash
Clone the repository
git clone https://github.com/GiDanis/copilot-npm-publisher.git
cd copilot-npm-publisher
Install dependencies
npm install
Run setup wizard
npm run setup
`
$3
Once configured, use natural language commands:
`bash
gh copilot chat
Then ask:
"Check if my package is ready to publish"
"Bump the version to a minor release"
"Publish my package to NPM"
"Run the complete publish workflow with a patch version"
`
$3
`bash
Validate package
npm-publisher validate
Bump version
npm-publisher bump patch
Publish to NPM
npm-publisher publish --access public
Complete workflow
npm-publisher workflow minor
Check status
npm-publisher status
`
MCP Tools
The server provides these tools to GitHub Copilot:
| Tool | Description |
|------|-------------|
| npm_validate | Validate package.json and check prerequisites |
| npm_login_status | Check NPM authentication status |
| npm_version_bump | Bump package version (patch/minor/major) |
| npm_check_published | Check if version exists on NPM |
| npm_publish | Publish package to NPM registry |
| git_status | Check Git repository status |
| git_create_tag | Create Git tags for releases |
| git_commit_and_push | Commit and push changes |
| publish_workflow | Complete automated workflow |
Documentation
- š Installation Guide
- šÆ Usage Guide
- š§ API Reference
- š Security
- š¤ Contributing
Requirements
- Node.js: >= 16.0.0
- NPM Account: With publishing permissions
- Git: Installed and configured
- GitHub Copilot CLI: (Optional) For natural language interface
Configuration
$3
`bash
Login to NPM
npm login
Or set NPM_TOKEN environment variable
export NPM_TOKEN="your_npm_token_here"
`
$3
The setup wizard automatically configures Copilot CLI, or manually add to ~/.config/github-copilot/apps.json:
`json
{
"mcpServers": {
"npm-publisher": {
"command": "node",
"args": ["/path/to/copilot-npm-publisher/src/index.js"],
"env": {
"NPM_TOKEN": "optional_token_here"
}
}
}
}
`
Examples
$3
`bash
Using CLI
npm-publisher workflow patch
Using Copilot
gh copilot chat
> "Run a complete publish workflow with a patch version bump"
`
This will:
1. ā
Check for uncommitted changes
2. š¦ Bump version (1.0.0 ā 1.0.1)
3. š¾ Commit changes to Git
4. š·ļø Create version tag (v1.0.1)
5. ā¬ļø Push to remote repository
6. š Publish to NPM
$3
`bash
Bump to prerelease
npm-publisher bump prepatch --preid beta
Publish with beta tag
npm-publisher publish --tag beta --access public
`
$3
Test without making changes:
`bash
npm-publisher publish --dry-run
`
Workflow Examples
$3
`bash
1. Validate
npm-publisher validate
2. Run workflow
npm-publisher workflow patch
Package is now published! š
`
$3
`bash
npm version prepatch --preid alpha --no-git-tag-version
git add package.json
git commit -m "chore: bump to alpha"
git push
npm publish --tag alpha
`
Project Structure
`
copilot-npm-publisher/
āāā src/
ā āāā index.js # MCP server implementation
ā āāā cli.js # Standalone CLI
āāā setup/
ā āāā config-wizard.js # Interactive setup
āāā docs/
ā āāā installation.md # Installation guide
ā āāā usage.md # Usage guide
ā āāā api.md # API reference
āāā .github/
ā āāā workflows/
ā āāā ci.yml # CI pipeline
ā āāā publish.yml # Auto-publish on tags
āāā package.json
āāā README.md
āāā LICENSE
āāā SECURITY.md
āāā CONTRIBUTING.md
`
Troubleshooting
$3
`bash
npm login
Or set NPM_TOKEN environment variable
`
$3
`bash
git status
git add .
git commit -m "Your changes"
Or use git stash
`
$3
Bump the version first:
`bash
npm-publisher bump patch
`
$3
`bash
git remote add origin https://github.com/username/repo.git
`
Security
- Never commit .npmrc files containing authentication tokens
- Use environment variables for sensitive data
- Review changes before publishing
- Use --dry-run` to test without publishing