Skip to content

Commit 2cb68f0

Browse files
authored
Merge pull request #8 from jhonymiler/feature/project-discovery-and-enhanced-descriptions
2 parents f716fee + e324630 commit 2cb68f0

File tree

3 files changed

+435
-100
lines changed

3 files changed

+435
-100
lines changed

README.md

Lines changed: 151 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ MCP (Model Context Protocol) server for Bitbucket Server Pull Request management
55
[![smithery badge](https://smithery.ai/badge/@garc33/bitbucket-server-mcp-server)](https://smithery.ai/server/@garc33/bitbucket-server-mcp-server)
66
<a href="https://glama.ai/mcp/servers/jskr5c1zq3"><img width="380" height="200" src="https://glama.ai/mcp/servers/jskr5c1zq3/badge" alt="Bitbucket Server MCP server" /></a>
77

8+
## ✨ New Features
9+
10+
- **🔍 Project Discovery**: List all accessible Bitbucket projects with `list_projects`
11+
- **📁 Repository Browsing**: Explore repositories across projects with `list_repositories`
12+
- **🔧 Flexible Project Support**: Make the default project optional - specify per command or use `BITBUCKET_DEFAULT_PROJECT`
13+
- **📖 Enhanced Documentation**: Improved README with usage examples and better configuration guidance
14+
815
## Requirements
916

1017
- Node.js >= 16
@@ -20,6 +27,7 @@ npx -y @smithery/cli install @garc33/bitbucket-server-mcp-server --client claude
2027
```
2128

2229
### Manual Installation
30+
2331
```bash
2432
npm install
2533
```
@@ -32,90 +40,194 @@ npm run build
3240

3341
## Features
3442

35-
The server provides the following tools for Bitbucket Server integration:
43+
The server provides the following tools for comprehensive Bitbucket Server integration:
44+
45+
### `list_projects`
46+
47+
**Discover and explore Bitbucket projects**: Lists all accessible projects with their details. Essential for project discovery and finding the correct project keys to use in other operations.
48+
49+
**Use cases:**
50+
51+
- Find available projects when you don't know the exact project key
52+
- Explore project structure and permissions
53+
- Discover new projects you have access to
54+
55+
Parameters:
56+
57+
- `limit`: Number of projects to return (default: 25, max: 1000)
58+
- `start`: Start index for pagination (default: 0)
59+
60+
### `list_repositories`
61+
62+
**Browse and discover repositories**: Explore repositories within specific projects or across all accessible projects. Returns comprehensive repository information including clone URLs and metadata.
63+
64+
**Use cases:**
65+
- Find repository slugs for other operations
66+
- Explore codebase structure across projects
67+
- Discover repositories you have access to
68+
- Browse a specific project's repositories
69+
70+
Parameters:
71+
72+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
73+
- `limit`: Number of repositories to return (default: 25, max: 1000)
74+
- `start`: Start index for pagination (default: 0)
3675

3776
### `create_pull_request`
3877

39-
Creates a new pull request.
78+
**Propose code changes for review**: Creates a new pull request to submit code changes, request reviews, or merge feature branches. Automatically handles branch references and reviewer assignments.
79+
80+
**Use cases:**
81+
- Submit feature development for review
82+
- Propose bug fixes
83+
- Request code integration from feature branches
84+
- Collaborate on code changes
4085

4186
Parameters:
4287

43-
- `project`: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)
88+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
4489
- `repository` (required): Repository slug
45-
- `title` (required): PR title
46-
- `description`: PR description
47-
- `sourceBranch` (required): Source branch name
48-
- `targetBranch` (required): Target branch name
90+
- `title` (required): Clear, descriptive PR title
91+
- `description`: Detailed description with context (supports Markdown)
92+
- `sourceBranch` (required): Source branch containing changes
93+
- `targetBranch` (required): Target branch for merging
4994
- `reviewers`: Array of reviewer usernames
5095

5196
### `get_pull_request`
5297

53-
Retrieves detailed information about a specific pull request.
98+
**Comprehensive PR information**: Retrieves detailed pull request information including status, reviewers, commits, and all metadata. Essential for understanding PR state before taking actions.
99+
100+
**Use cases:**
101+
- Check PR approval status
102+
- Review PR details and progress
103+
- Understand changes before merging
104+
- Monitor PR status
54105

55106
Parameters:
56107

57-
- `project`: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)
108+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
58109
- `repository` (required): Repository slug
59110
- `prId` (required): Pull request ID
60111

61112
### `merge_pull_request`
62113

63-
Merges a pull request.
114+
**Integrate approved changes**: Merges an approved pull request into the target branch. Supports different merge strategies based on your workflow preferences.
115+
116+
**Use cases:**
117+
- Complete the code review process
118+
- Integrate approved features
119+
- Apply bug fixes to main branches
120+
- Release code changes
64121

65122
Parameters:
66123

67-
- `project`: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)
124+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
68125
- `repository` (required): Repository slug
69126
- `prId` (required): Pull request ID
70-
- `message`: Merge commit message
71-
- `strategy`: One of:
72-
- `merge-commit` (default)
73-
- `squash`
74-
- `fast-forward`
127+
- `message`: Custom merge commit message
128+
- `strategy`: Merge strategy:
129+
- `merge-commit` (default): Creates merge commit preserving history
130+
- `squash`: Combines all commits into one
131+
- `fast-forward`: Moves branch pointer without merge commit
75132

76133
### `decline_pull_request`
77134

78-
Declines a pull request.
135+
**Reject unsuitable changes**: Declines a pull request that should not be merged, providing feedback to the author.
136+
137+
**Use cases:**
138+
- Reject changes that don't meet standards
139+
- Close PRs that conflict with project direction
140+
- Request significant rework
141+
- Prevent unwanted code integration
79142

80143
Parameters:
81144

82-
- `project`: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)
145+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
83146
- `repository` (required): Repository slug
84147
- `prId` (required): Pull request ID
85-
- `message`: Reason for declining
148+
- `message`: Reason for declining (helpful for author feedback)
86149

87150
### `add_comment`
88151

89-
Adds a comment to a pull request.
152+
**Participate in code review**: Adds comments to pull requests for review feedback, discussions, and collaboration. Supports threaded conversations.
153+
154+
**Use cases:**
155+
- Provide code review feedback
156+
- Ask questions about specific changes
157+
- Suggest improvements
158+
- Participate in technical discussions
159+
- Document review decisions
90160

91161
Parameters:
92162

93-
- `project`: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)
163+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
94164
- `repository` (required): Repository slug
95165
- `prId` (required): Pull request ID
96-
- `text` (required): Comment text
97-
- `parentId`: Parent comment ID for replies
166+
- `text` (required): Comment content (supports Markdown)
167+
- `parentId`: Parent comment ID for threaded replies
98168

99169
### `get_diff`
100170

101-
Retrieves the diff for a pull request.
171+
**Analyze code changes**: Retrieves the code differences showing exactly what was added, removed, or modified in the pull request.
172+
173+
**Use cases:**
174+
- Review specific code changes
175+
- Understand scope of modifications
176+
- Analyze impact before merging
177+
- Inspect implementation details
178+
- Code quality assessment
102179

103180
Parameters:
104181

105-
- `project`: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)
182+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
106183
- `repository` (required): Repository slug
107184
- `prId` (required): Pull request ID
108-
- `contextLines`: Number of context lines (default: 10)
185+
- `contextLines`: Context lines around changes (default: 10)
109186

110187
### `get_reviews`
111188

112-
Fetches the review history of a pull request, including approvals and reviews.
189+
**Track review progress**: Fetches review history, approval status, and reviewer feedback to understand the review state.
113190

114-
Parameters:
191+
**Use cases:**
192+
- Check if PR is ready for merging
193+
- See who has reviewed the changes
194+
- Understand review feedback
195+
- Monitor approval requirements
196+
- Track review progress
115197

116-
- `project`: Bitbucket project key (defaults to BITBUCKET_DEFAULT_PROJECT if set)
117-
- `repository` (required): Repository slug
118-
- `prId` (required): Pull request ID
198+
## Usage Examples
199+
200+
### Listing Projects and Repositories
201+
202+
```bash
203+
# List all accessible projects
204+
list_projects
205+
206+
# List repositories in the default project (if BITBUCKET_DEFAULT_PROJECT is set)
207+
list_repositories
208+
209+
# List repositories in a specific project
210+
list_repositories --project "MYPROJECT"
211+
212+
# List projects with pagination
213+
list_projects --limit 10 --start 0
214+
```
215+
216+
### Working with Pull Requests
217+
218+
```bash
219+
# Create a pull request (using default project)
220+
create_pull_request --repository "my-repo" --title "Feature: New functionality" --sourceBranch "feature/new-feature" --targetBranch "main"
221+
222+
# Create a pull request with specific project
223+
create_pull_request --project "MYPROJECT" --repository "my-repo" --title "Bugfix: Critical issue" --sourceBranch "bugfix/critical" --targetBranch "develop" --description "Fixes critical issue #123"
224+
225+
# Get pull request details
226+
get_pull_request --repository "my-repo" --prId 123
227+
228+
# Merge a pull request with squash strategy
229+
merge_pull_request --repository "my-repo" --prId 123 --strategy "squash" --message "Feature: New functionality (#123)"
230+
```
119231

120232
## Dependencies
121233

@@ -155,7 +267,14 @@ The server requires configuration in the VSCode MCP settings file. Here's a samp
155267
- Authentication (one of the following is required):
156268
- `BITBUCKET_TOKEN`: Personal access token
157269
- `BITBUCKET_USERNAME` and `BITBUCKET_PASSWORD`: Basic authentication credentials
158-
- `BITBUCKET_DEFAULT_PROJECT`: Default project key to use when not specified in tool calls
270+
- `BITBUCKET_DEFAULT_PROJECT` (optional): Default project key to use when not specified in tool calls
271+
272+
**Note**: With the new optional project support, you can now:
273+
274+
- Set `BITBUCKET_DEFAULT_PROJECT` to work with a specific project by default
275+
- Use `list_projects` to discover available projects
276+
- Use `list_repositories` to browse repositories across projects
277+
- Override the default project by specifying the `project` parameter in any tool call
159278

160279
## Logging
161280

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
},
1111
"scripts": {
1212
"build": "tsc && node -e \"if (process.platform !== 'win32') require('child_process').execSync('chmod +x build/index.js')\"",
13-
"postinstall": "node -e \"if (process.platform !== 'win32') require('child_process').execSync('chmod +x build/index.js')\"",
13+
"postinstall": "node -e \"const fs=require('fs'); if (process.platform !== 'win32' && fs.existsSync('build/index.js')) require('child_process').execSync('chmod +x build/index.js')\"",
1414
"start": "node build/index.js",
1515
"dev": "tsc -w",
1616
"dev:server": "npm run build && npx @modelcontextprotocol/inspector -e DEBUG=true node build/index.js",
@@ -41,4 +41,4 @@
4141
"engines": {
4242
"node": ">=18"
4343
}
44-
}
44+
}

0 commit comments

Comments
 (0)