@atercates/bitbucket-mcp 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +347 -0
  3. package/dist/client.d.ts +16 -0
  4. package/dist/client.js +35 -0
  5. package/dist/client.js.map +1 -0
  6. package/dist/config.d.ts +11 -0
  7. package/dist/config.js +54 -0
  8. package/dist/config.js.map +1 -0
  9. package/dist/handlers/branching-model.d.ts +2 -0
  10. package/dist/handlers/branching-model.js +324 -0
  11. package/dist/handlers/branching-model.js.map +1 -0
  12. package/dist/handlers/commits.d.ts +2 -0
  13. package/dist/handlers/commits.js +78 -0
  14. package/dist/handlers/commits.js.map +1 -0
  15. package/dist/handlers/index.d.ts +17 -0
  16. package/dist/handlers/index.js +29 -0
  17. package/dist/handlers/index.js.map +1 -0
  18. package/dist/handlers/pipelines.d.ts +2 -0
  19. package/dist/handlers/pipelines.js +538 -0
  20. package/dist/handlers/pipelines.js.map +1 -0
  21. package/dist/handlers/pr-comments.d.ts +2 -0
  22. package/dist/handlers/pr-comments.js +509 -0
  23. package/dist/handlers/pr-comments.js.map +1 -0
  24. package/dist/handlers/pr-content.d.ts +2 -0
  25. package/dist/handlers/pr-content.js +332 -0
  26. package/dist/handlers/pr-content.js.map +1 -0
  27. package/dist/handlers/pr-tasks.d.ts +2 -0
  28. package/dist/handlers/pr-tasks.js +275 -0
  29. package/dist/handlers/pr-tasks.js.map +1 -0
  30. package/dist/handlers/pull-requests.d.ts +2 -0
  31. package/dist/handlers/pull-requests.js +902 -0
  32. package/dist/handlers/pull-requests.js.map +1 -0
  33. package/dist/handlers/refs.d.ts +2 -0
  34. package/dist/handlers/refs.js +225 -0
  35. package/dist/handlers/refs.js.map +1 -0
  36. package/dist/handlers/repositories.d.ts +2 -0
  37. package/dist/handlers/repositories.js +131 -0
  38. package/dist/handlers/repositories.js.map +1 -0
  39. package/dist/handlers/source.d.ts +2 -0
  40. package/dist/handlers/source.js +35 -0
  41. package/dist/handlers/source.js.map +1 -0
  42. package/dist/handlers/types.d.ts +42 -0
  43. package/dist/handlers/types.js +2 -0
  44. package/dist/handlers/types.js.map +1 -0
  45. package/dist/handlers/users.d.ts +2 -0
  46. package/dist/handlers/users.js +38 -0
  47. package/dist/handlers/users.js.map +1 -0
  48. package/dist/index.d.ts +2 -0
  49. package/dist/index.js +4 -0
  50. package/dist/index.js.map +1 -0
  51. package/dist/logger.d.ts +3 -0
  52. package/dist/logger.js +60 -0
  53. package/dist/logger.js.map +1 -0
  54. package/dist/pagination.d.ts +32 -0
  55. package/dist/pagination.js +116 -0
  56. package/dist/pagination.js.map +1 -0
  57. package/dist/schemas.d.ts +21 -0
  58. package/dist/schemas.js +23 -0
  59. package/dist/schemas.js.map +1 -0
  60. package/dist/server.d.ts +33 -0
  61. package/dist/server.js +124 -0
  62. package/dist/server.js.map +1 -0
  63. package/dist/types.d.ts +296 -0
  64. package/dist/types.js +3 -0
  65. package/dist/types.js.map +1 -0
  66. package/dist/utils.d.ts +18 -0
  67. package/dist/utils.js +17 -0
  68. package/dist/utils.js.map +1 -0
  69. package/docs/README.md +216 -0
  70. package/docs/TOOLS.md +464 -0
  71. package/docs/architecture/ARCHITECTURE.md +302 -0
  72. package/docs/guides/ENVIRONMENT_VARIABLES.md +306 -0
  73. package/docs/guides/GETTING_STARTED.md +267 -0
  74. package/docs/guides/GITHUB_ACTIONS_SETUP.md +148 -0
  75. package/docs/guides/NPM_DEPLOYMENT.md +266 -0
  76. package/docs/guides/PROJECT_STRUCTURE.md +317 -0
  77. package/package.json +84 -0
@@ -0,0 +1,267 @@
1
+ # Getting Started with Bitbucket MCP
2
+
3
+ This guide will help you set up and use the Bitbucket MCP server.
4
+
5
+ ## Prerequisites
6
+
7
+ - Node.js 18+
8
+ - Bitbucket Cloud account with API access
9
+ - An MCP client (Claude, Cursor, etc.)
10
+
11
+ ## Installation
12
+
13
+ ### Option 1: From NPM (Recommended)
14
+
15
+ ```bash
16
+ npm install -g bitbucket-mcp
17
+ # or
18
+ pnpm add -g bitbucket-mcp
19
+ ```
20
+
21
+ Then run:
22
+ ```bash
23
+ bitbucket-mcp
24
+ ```
25
+
26
+ ### Option 2: NPX
27
+
28
+ ```bash
29
+ npx -y bitbucket-mcp@latest
30
+ ```
31
+
32
+ ### Option 3: Local Development
33
+
34
+ ```bash
35
+ git clone https://github.com/atercates/bitbucket-mcp.git
36
+ cd bitbucket-mcp
37
+ pnpm install
38
+ pnpm build
39
+ pnpm start
40
+ ```
41
+
42
+ ## Configuration
43
+
44
+ The server uses environment variables for configuration. Create a `.env` file or set these in your shell:
45
+
46
+ ### Required
47
+ ```bash
48
+ # One of these authentication methods:
49
+
50
+ # Option 1: Token Authentication (Recommended)
51
+ BITBUCKET_TOKEN=your_app_password_here
52
+
53
+ # Option 2: Basic Authentication
54
+ BITBUCKET_USERNAME=your_email@example.com
55
+ BITBUCKET_PASSWORD=your_app_password_here
56
+ ```
57
+
58
+ ### Optional
59
+ ```bash
60
+ # API Configuration
61
+ BITBUCKET_URL=https://api.bitbucket.org/2.0 # Default URL
62
+ BITBUCKET_WORKSPACE=my-workspace # Default workspace (auto-detected if not set)
63
+
64
+ # Security
65
+ BITBUCKET_ALLOW_DANGEROUS=true # Allow delete operations (default: false)
66
+
67
+ # Logging
68
+ BITBUCKET_LOG_DISABLE=false # Disable file logging
69
+ BITBUCKET_LOG_FILE=/path/to/custom.log # Custom log file path
70
+ BITBUCKET_LOG_DIR=/path/to/logs # Custom log directory
71
+ BITBUCKET_LOG_PER_CWD=true # Create per-directory logs
72
+ ```
73
+
74
+ ## Getting Bitbucket Credentials
75
+
76
+ ### Create an App Password
77
+
78
+ 1. Go to https://bitbucket.org/account/settings/app-passwords/
79
+ 2. Click "Create app password"
80
+ 3. Give it a name (e.g., "MCP Server")
81
+ 4. Select required permissions:
82
+ - Pipelines: Read
83
+ - Repositories: Read, Write (for PR operations)
84
+ - Pull requests: Read, Write (for PR operations)
85
+ 5. Copy the generated password
86
+ 6. Set `BITBUCKET_TOKEN` to this password
87
+
88
+ ### Find Your Workspace
89
+
90
+ 1. Go to your Bitbucket workspace
91
+ 2. The workspace name is in the URL: `https://bitbucket.org/{workspace}`
92
+ 3. Or set `BITBUCKET_WORKSPACE` environment variable
93
+
94
+ ## Using with Claude/Cursor
95
+
96
+ Add to your MCP configuration file (`.mcp.json` or similar):
97
+
98
+ ```json
99
+ {
100
+ "mcpServers": {
101
+ "bitbucket": {
102
+ "command": "bitbucket-mcp",
103
+ "env": {
104
+ "BITBUCKET_TOKEN": "${BITBUCKET_TOKEN}",
105
+ "BITBUCKET_WORKSPACE": "my-workspace"
106
+ }
107
+ }
108
+ }
109
+ }
110
+ ```
111
+
112
+ Or with npx:
113
+
114
+ ```json
115
+ {
116
+ "mcpServers": {
117
+ "bitbucket": {
118
+ "command": "npx",
119
+ "args": ["-y", "bitbucket-mcp@latest"],
120
+ "env": {
121
+ "BITBUCKET_TOKEN": "${BITBUCKET_TOKEN}",
122
+ "BITBUCKET_WORKSPACE": "my-workspace"
123
+ }
124
+ }
125
+ }
126
+ }
127
+ ```
128
+
129
+ ## Basic Operations
130
+
131
+ ### List Repositories
132
+
133
+ ```
134
+ Tool: listRepositories
135
+ Args: {
136
+ "workspace": "my-workspace",
137
+ "pagelen": 20
138
+ }
139
+ ```
140
+
141
+ ### Create a Pull Request
142
+
143
+ ```
144
+ Tool: createPullRequest
145
+ Args: {
146
+ "workspace": "my-workspace",
147
+ "repo_slug": "my-repo",
148
+ "title": "Add new feature",
149
+ "description": "This PR adds support for X",
150
+ "sourceBranch": "feature/new-feature",
151
+ "targetBranch": "main",
152
+ "reviewers": ["uuid1", "uuid2"]
153
+ }
154
+ ```
155
+
156
+ ### Approve a Pull Request
157
+
158
+ ```
159
+ Tool: approvePullRequest
160
+ Args: {
161
+ "workspace": "my-workspace",
162
+ "repo_slug": "my-repo",
163
+ "pull_request_id": "123"
164
+ }
165
+ ```
166
+
167
+ ### List Branches
168
+
169
+ ```
170
+ Tool: listBranches
171
+ Args: {
172
+ "workspace": "my-workspace",
173
+ "repo_slug": "my-repo"
174
+ }
175
+ ```
176
+
177
+ ### Run a Pipeline
178
+
179
+ ```
180
+ Tool: runPipeline
181
+ Args: {
182
+ "workspace": "my-workspace",
183
+ "repo_slug": "my-repo",
184
+ "target": {
185
+ "ref_type": "branch",
186
+ "ref_name": "main"
187
+ }
188
+ }
189
+ ```
190
+
191
+ ## Debugging
192
+
193
+ ### View Logs
194
+
195
+ Logs are stored in platform-specific directories:
196
+
197
+ **macOS:**
198
+ ```bash
199
+ tail -f ~/Library/Logs/bitbucket-mcp/bitbucket.log
200
+ ```
201
+
202
+ **Linux:**
203
+ ```bash
204
+ tail -f ~/.local/state/bitbucket-mcp/bitbucket.log
205
+ ```
206
+
207
+ **Windows:**
208
+ ```bash
209
+ Get-Content -Path "$env:LOCALAPPDATA\bitbucket-mcp\bitbucket.log" -Tail 50 -Wait
210
+ ```
211
+
212
+ ### Enable Verbose Logging
213
+
214
+ ```bash
215
+ BITBUCKET_LOG_DISABLE=false bitbucket-mcp
216
+ ```
217
+
218
+ ### Test Connection
219
+
220
+ ```bash
221
+ curl -X GET https://api.bitbucket.org/2.0/user \
222
+ -u username:app_password
223
+ ```
224
+
225
+ ## Troubleshooting
226
+
227
+ ### "Invalid credentials" error
228
+ - Verify `BITBUCKET_TOKEN` or `BITBUCKET_USERNAME`/`BITBUCKET_PASSWORD` are correct
229
+ - Check that app password has required permissions
230
+ - Ensure workspace name is correct
231
+
232
+ ### "Workspace not found"
233
+ - Set `BITBUCKET_WORKSPACE` explicitly
234
+ - Or provide `workspace` parameter in every tool call
235
+ - Check workspace name is correct (case-sensitive)
236
+
237
+ ### "Dangerous operation not allowed"
238
+ - Set `BITBUCKET_ALLOW_DANGEROUS=true` to enable delete operations
239
+ - This is intentionally restrictive for safety
240
+
241
+ ### Pagination issues
242
+ - Use `pagelen` parameter to control page size (1-100)
243
+ - Use `all: true` to fetch all results automatically
244
+ - Check rate limits with `x-ratelimit-*` headers in logs
245
+
246
+ ## FAQ
247
+
248
+ **Q: Can I use this with Bitbucket Server (self-hosted)?**
249
+ A: Yes! Set `BITBUCKET_URL` to your server URL:
250
+ ```bash
251
+ BITBUCKET_URL=https://bitbucket.mycompany.com/rest/api/2.0
252
+ ```
253
+
254
+ **Q: How do I use with multiple workspaces?**
255
+ A: Provide `workspace` parameter in each tool call, or run multiple instances with different `BITBUCKET_WORKSPACE` values.
256
+
257
+ **Q: Is it safe to enable dangerous operations?**
258
+ A: Yes, but be careful. These operations (delete branch/tag) cannot be undone. Only enable in trusted environments.
259
+
260
+ **Q: How do I contribute?**
261
+ A: See [CONTRIBUTING.md](../CONTRIBUTING.md) in the docs.
262
+
263
+ ## Next Steps
264
+
265
+ - Read [TOOLS.md](../TOOLS.md) for complete tool reference
266
+ - Check [ARCHITECTURE.md](./architecture/ARCHITECTURE.md) for technical details
267
+ - See [examples/](./examples/) for common use cases
@@ -0,0 +1,148 @@
1
+ # GitHub Actions Setup for Auto-Publishing to NPM
2
+
3
+ This guide explains how to set up automatic publishing to NPM with every push to main.
4
+
5
+ ## What the Workflow Does
6
+
7
+ The `auto-publish.yml` workflow:
8
+ 1. ✅ Runs on every push to `main` or `master`
9
+ 2. ✅ Lints, tests, and builds the code
10
+ 3. ✅ Detects if source code changed since last release
11
+ 4. ✅ Automatically bumps patch version (5.0.6 → 5.0.7)
12
+ 5. ✅ Publishes to NPM
13
+ 6. ✅ Creates a GitHub release
14
+ 7. ✅ Skips publishing if only docs changed
15
+
16
+ ## What You Need to Do
17
+
18
+ ### 1. Create an NPM Token
19
+
20
+ 1. Go to https://npmjs.com/settings/atercates/tokens/new
21
+ 2. Select **Granular Access Token**
22
+ 3. Configure:
23
+ - **Token Name**: `github-actions`
24
+ - **Expiration**: 1 year
25
+ - **Permissions**:
26
+ - Read and write access to `bitbucket-mcp`
27
+ 4. Copy the token (you won't see it again)
28
+
29
+ ### 2. Add NPM_TOKEN to GitHub Secrets
30
+
31
+ 1. Go to your repository on GitHub
32
+ 2. Click **Settings** → **Secrets and variables** → **Actions**
33
+ 3. Click **New repository secret**
34
+ - **Name**: `NPM_TOKEN`
35
+ - **Value**: Paste your token from Step 1
36
+ 4. Click **Add secret**
37
+
38
+ That's it! The workflow will automatically run on your next push to main.
39
+
40
+ ## GitHub Token (Automatic)
41
+
42
+ The workflow uses `secrets.GITHUB_TOKEN` which is **automatically provided** by GitHub Actions. No manual setup needed.
43
+
44
+ ## How to Trigger a Release
45
+
46
+ Simply push code to `main`:
47
+
48
+ ```bash
49
+ git commit -m "feat: add new feature"
50
+ git push origin main
51
+ ```
52
+
53
+ The workflow will:
54
+ - ✅ Run tests and lint checks
55
+ - ✅ Auto-bump version (patch)
56
+ - ✅ Publish to NPM
57
+ - ✅ Create GitHub release
58
+
59
+ To see the progress:
60
+ 1. Go to your repo on GitHub
61
+ 2. Click **Actions**
62
+ 3. Find **Build, Test & Auto-Publish**
63
+ 4. Watch the workflow run (takes 2-5 minutes)
64
+
65
+ ## Manual Version Control
66
+
67
+ By default, the workflow bumps **patch** versions (5.0.6 → 5.0.7).
68
+
69
+ To bump **minor** or **major** versions:
70
+ 1. Edit `package.json` manually
71
+ - `5.0.6` → `5.1.0` (minor)
72
+ - `5.0.6` → `6.0.0` (major)
73
+ 2. Commit and push to main
74
+ 3. Workflow will detect and publish
75
+
76
+ ## Troubleshooting
77
+
78
+ ### Workflow doesn't trigger
79
+ - ✅ Check: Did you push to `main` or `master`?
80
+ - ✅ Check: Did you change files in `src/`, `__tests__/`, or `package.json`?
81
+ - ✅ If still not triggering: Go to **Actions** tab → **Build, Test & Auto-Publish** → **Run workflow** → Select branch
82
+
83
+ ### NPM publish fails
84
+ **Cause**: `NPM_TOKEN` not set or expired
85
+ **Fix**: Follow Step 1-2 above, ensure token is still valid
86
+
87
+ **Cause**: Package name already published
88
+ **Fix**: Check https://npmjs.com/package/bitbucket-mcp
89
+
90
+ ### Tests fail
91
+ The workflow will fail and not publish. Fix errors locally:
92
+ ```bash
93
+ pnpm lint
94
+ pnpm test
95
+ pnpm build
96
+ ```
97
+
98
+ ## What NOT to Do
99
+
100
+ ❌ Don't manually edit `server.json` version (auto-synced)
101
+ ❌ Don't manually tag releases (auto-created)
102
+ ❌ Don't commit directly with `git push --force`
103
+ ❌ Don't expose `NPM_TOKEN` in code or logs
104
+
105
+ ## Environment Variables for Users
106
+
107
+ When users install the MCP server, they need these environment variables:
108
+
109
+ ```bash
110
+ # Required (choose one)
111
+ export BITBUCKET_TOKEN="app_password" # Recommended
112
+ # OR
113
+ export BITBUCKET_USERNAME="user@example.com"
114
+ export BITBUCKET_PASSWORD="app_password"
115
+
116
+ # Optional
117
+ export BITBUCKET_WORKSPACE="my-workspace"
118
+ export BITBUCKET_ALLOW_DANGEROUS=true # Enable deletes
119
+ ```
120
+
121
+ See [ENVIRONMENT_VARIABLES.md](ENVIRONMENT_VARIABLES.md) for details.
122
+
123
+ ## Files Modified by the Workflow
124
+
125
+ The workflow modifies these files automatically:
126
+ - `package.json` - Version bumped
127
+ - `server.json` - Version synced
128
+ - Git history - New commit and tag created
129
+
130
+ You don't need to manually update these.
131
+
132
+ ## Verify Setup is Working
133
+
134
+ 1. Make a small change to `src/` (e.g., update a comment)
135
+ 2. Commit and push: `git push origin main`
136
+ 3. Go to GitHub → **Actions** tab
137
+ 4. Watch **Build, Test & Auto-Publish** workflow
138
+ 5. When complete, check:
139
+ - NPM: https://npmjs.com/package/bitbucket-mcp
140
+ - GitHub: **Releases** tab (new release should appear)
141
+
142
+ ## Support
143
+
144
+ For issues:
145
+ - Check the Actions log on GitHub for error details
146
+ - Verify `NPM_TOKEN` is set in Settings → Secrets
147
+ - Ensure local build works: `pnpm build && pnpm test`
148
+
@@ -0,0 +1,266 @@
1
+ # Deploying to NPM
2
+
3
+ This guide explains how to deploy the Bitbucket MCP server to npm.
4
+
5
+ ## Prerequisites
6
+
7
+ - npm account at https://www.npmjs.com/
8
+ - Local npm authentication (`npm login`)
9
+ - Git repository with version control
10
+ - Access to bump version numbers
11
+
12
+ ## Setup
13
+
14
+ ### 1. Create NPM Account
15
+
16
+ If you don't have an npm account:
17
+ 1. Go to https://www.npmjs.com/signup
18
+ 2. Create your account
19
+ 3. Verify your email
20
+
21
+ ### 2. Local npm Login
22
+
23
+ ```bash
24
+ npm login
25
+ ```
26
+
27
+ This will prompt for:
28
+ - **Username**: Your npm username
29
+ - **Password**: Your npm password
30
+ - **Email**: Email associated with your account
31
+ - **Two-Factor Authentication** (2FA): If enabled, provide your 2FA code
32
+
33
+ Your credentials are saved to `~/.npmrc` (do not commit this file).
34
+
35
+ ### 3. Verify Ownership
36
+
37
+ Ensure you own the `bitbucket-mcp` package on npm. If not, you'll need to:
38
+ - Contact the current owner for permissions, or
39
+ - Use a different package name
40
+
41
+ ## Deployment Process
42
+
43
+ ### Option 1: Automated Script (Recommended)
44
+
45
+ Use the npm version scripts in `package.json`:
46
+
47
+ ```bash
48
+ # Patch version bump (5.0.6 → 5.0.7)
49
+ pnpm publish:patch
50
+
51
+ # Minor version bump (5.0.6 → 5.1.0)
52
+ pnpm publish:minor
53
+
54
+ # Major version bump (5.0.6 → 6.0.0)
55
+ pnpm publish:major
56
+
57
+ # Alias for patch
58
+ pnpm release
59
+ ```
60
+
61
+ This will:
62
+ 1. Build the project
63
+ 2. Bump the version in package.json
64
+ 3. Commit the version change
65
+ 4. Tag the commit with git
66
+ 5. Publish to npm
67
+ 6. Push changes and tags to GitHub
68
+
69
+ ### Option 2: Manual Process
70
+
71
+ If you prefer more control:
72
+
73
+ ```bash
74
+ # 1. Build the project
75
+ pnpm build
76
+
77
+ # 2. Manually bump version (edit package.json)
78
+ # Change: "version": "5.0.6" → "5.0.7"
79
+
80
+ # 3. Commit the change
81
+ git add package.json
82
+ git commit -m "chore: bump version to 5.0.7"
83
+ git tag v5.0.7
84
+
85
+ # 4. Publish to npm
86
+ pnpm publish
87
+
88
+ # 5. Push changes to GitHub
89
+ git push origin master --tags
90
+ ```
91
+
92
+ ## Environment Variables for CI/CD
93
+
94
+ If deploying from CI/CD (GitHub Actions, GitLab CI, etc.), set:
95
+
96
+ ```bash
97
+ # GitHub Actions example
98
+ NPM_TOKEN=your_npm_access_token
99
+ ```
100
+
101
+ Configure in your repository secrets or CI/CD provider.
102
+
103
+ ### Getting NPM Access Token
104
+
105
+ 1. Go to https://www.npmjs.com/settings/~/tokens
106
+ 2. Click "Generate New Token"
107
+ 3. Select token type:
108
+ - **Automation** - For CI/CD deployments (recommended)
109
+ - **Publish** - For publishing packages
110
+ 4. Copy the token
111
+ 5. Add to GitHub Secrets as `NPM_TOKEN`
112
+
113
+ ### GitHub Actions Workflow
114
+
115
+ Example `.github/workflows/publish.yml`:
116
+
117
+ ```yaml
118
+ name: Publish to npm
119
+
120
+ on:
121
+ push:
122
+ tags:
123
+ - 'v*'
124
+
125
+ jobs:
126
+ publish:
127
+ runs-on: ubuntu-latest
128
+ steps:
129
+ - uses: actions/checkout@v3
130
+
131
+ - uses: pnpm/action-setup@v2
132
+ with:
133
+ version: 8
134
+
135
+ - uses: actions/setup-node@v3
136
+ with:
137
+ node-version: '18'
138
+ registry-url: 'https://registry.npmjs.org'
139
+ cache: 'pnpm'
140
+
141
+ - run: pnpm install
142
+ - run: pnpm build
143
+ - run: pnpm publish
144
+ env:
145
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
146
+ ```
147
+
148
+ ## Pre-Deployment Checklist
149
+
150
+ Before deploying, verify:
151
+
152
+ - ✅ All tests pass: `pnpm test`
153
+ - ✅ Linting is clean: `pnpm lint`
154
+ - ✅ Code is formatted: `pnpm format`
155
+ - ✅ Build succeeds: `pnpm build`
156
+ - ✅ README is updated
157
+ - ✅ CHANGELOG.md is updated
158
+ - ✅ Version number is bumped correctly
159
+ - ✅ No sensitive data in code
160
+ - ✅ package.json has correct metadata
161
+ - ✅ .npmignore is configured properly
162
+
163
+ ## Verification After Deployment
164
+
165
+ After publishing:
166
+
167
+ 1. **Check npm package page:**
168
+ ```
169
+ https://www.npmjs.com/package/bitbucket-mcp
170
+ ```
171
+
172
+ 2. **Install and test locally:**
173
+ ```bash
174
+ npm install -g bitbucket-mcp
175
+ bitbucket-mcp --version
176
+ ```
177
+
178
+ 3. **Verify with npx:**
179
+ ```bash
180
+ npx -y bitbucket-mcp@latest
181
+ ```
182
+
183
+ 4. **Check GitHub release:**
184
+ - Tag is created
185
+ - Release notes are visible
186
+
187
+ ## Troubleshooting
188
+
189
+ ### "403 Forbidden" Error
190
+
191
+ **Problem:** Cannot publish to npm
192
+
193
+ **Solutions:**
194
+ - Verify npm login: `npm whoami`
195
+ - Check package name is available (or you own it)
196
+ - Verify credentials in `~/.npmrc`
197
+ - Check 2FA is configured correctly
198
+
199
+ ### "ENEEDAUTH" Error
200
+
201
+ **Problem:** Not authenticated with npm
202
+
203
+ **Solution:**
204
+ ```bash
205
+ npm logout
206
+ npm login
207
+ ```
208
+
209
+ ### "Version already published"
210
+
211
+ **Problem:** Cannot publish duplicate version
212
+
213
+ **Solution:**
214
+ ```bash
215
+ # Bump version and try again
216
+ pnpm publish:patch
217
+ ```
218
+
219
+ ### Package not appearing on npm
220
+
221
+ **Problem:** Published but not visible
222
+
223
+ **Solutions:**
224
+ - Wait 2-5 minutes for npm CDN to sync
225
+ - Clear npm cache: `npm cache clean --force`
226
+ - Check https://www.npmjs.com/package/bitbucket-mcp for latest version
227
+ - Verify you're logged in as correct user: `npm whoami`
228
+
229
+ ## Best Practices
230
+
231
+ 1. **Version Numbering** - Use semantic versioning (MAJOR.MINOR.PATCH)
232
+ 2. **Changelog** - Update CHANGELOG.md before each release
233
+ 3. **Tags** - Always use git tags matching version (v5.0.7)
234
+ 4. **Testing** - Run full test suite before publishing
235
+ 5. **2FA** - Enable 2FA on npm account for security
236
+ 6. **Access Tokens** - Use granular tokens in CI/CD
237
+ 7. **Documentation** - Keep README and docs up to date
238
+
239
+ ## Rolling Back a Release
240
+
241
+ If you accidentally publish a bad version:
242
+
243
+ ```bash
244
+ npm unpublish bitbucket-mcp@5.0.7
245
+ ```
246
+
247
+ Then:
248
+ 1. Fix the issue
249
+ 2. Test thoroughly
250
+ 3. Bump to a new version
251
+ 4. Publish again
252
+
253
+ Note: npm has restrictions on unpublishing after 72 hours.
254
+
255
+ ## Monitoring Package Health
256
+
257
+ - **Package page:** https://www.npmjs.com/package/bitbucket-mcp
258
+ - **Weekly downloads:** Visible on package page
259
+ - **Issues:** GitHub Issues section
260
+ - **Quality score:** npm calculates based on tests, docs, links, etc.
261
+
262
+ ## Contact
263
+
264
+ For npm support:
265
+ - npm Help: https://docs.npmjs.com/
266
+ - npm Support: support@npmjs.com