Skip to content

Commit e65e499

Browse files
authored
Merge pull request #11 from timelfrink/feature/search-and-file-content
2 parents 4cf5ccb + 968ce34 commit e65e499

File tree

2 files changed

+453
-5
lines changed

2 files changed

+453
-5
lines changed

README.md

Lines changed: 113 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ MCP (Model Context Protocol) server for Bitbucket Server Pull Request management
77

88
## ✨ New Features
99

10+
- **🔍 Advanced Search**: Search code and files across repositories with project/repository filtering using the `search` tool
11+
- **📄 File Operations**: Read file contents and browse repository directories with `get_file_content` and `browse_repository`
12+
- **💬 Comment Management**: Extract and filter PR comments with `get_comments` tool
1013
- **🔍 Project Discovery**: List all accessible Bitbucket projects with `list_projects`
1114
- **📁 Repository Browsing**: Explore repositories across projects with `list_repositories`
1215
- **🔧 Flexible Project Support**: Make the default project optional - specify per command or use `BITBUCKET_DEFAULT_PROJECT`
@@ -206,6 +209,85 @@ Parameters:
206209
- See approval and review history
207210
- Understand the full PR lifecycle
208211

212+
Parameters:
213+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
214+
- `repository` (required): Repository slug
215+
- `prId` (required): Pull request ID
216+
217+
### `get_comments`
218+
219+
**Extract PR comments only**: Filters pull request activities to return only the comments, making it easier to focus on discussion content without reviews or other activities.
220+
221+
**Use cases:**
222+
- Read PR discussion threads
223+
- Extract feedback and questions
224+
- Focus on comment content without noise
225+
- Analyze conversation flow
226+
227+
Parameters:
228+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
229+
- `repository` (required): Repository slug
230+
- `prId` (required): Pull request ID
231+
232+
### `search`
233+
234+
**Advanced code and file search**: Search across repositories using the Bitbucket search API with support for project/repository filtering and query optimization. Searches both file contents and filenames. **Note**: Search only works on the default branch of repositories.
235+
236+
**Use cases:**
237+
- Find specific code patterns across projects
238+
- Locate files by name or content
239+
- Search within specific projects or repositories
240+
- Filter by file extensions
241+
242+
Parameters:
243+
- `query` (required): Search query string
244+
- `project`: Bitbucket project key to limit search scope
245+
- `repository`: Repository slug for repository-specific search
246+
- `type`: Query optimization - "file" (wraps query in quotes for exact filename matching) or "code" (default search behavior)
247+
- `limit`: Number of results to return (default: 25, max: 100)
248+
- `start`: Start index for pagination (default: 0)
249+
250+
**Query syntax examples:**
251+
- `"README.md"` - Find exact filename
252+
- `config ext:yml` - Find config in YAML files
253+
- `function project:MYPROJECT` - Search for "function" in specific project
254+
- `bug fix repo:PROJ/my-repo` - Search in specific repository
255+
256+
### `get_file_content`
257+
258+
**Read file contents with pagination**: Retrieve the content of specific files from repositories with support for large files through pagination.
259+
260+
**Use cases:**
261+
- Read source code files
262+
- View configuration files
263+
- Extract documentation content
264+
- Inspect specific file versions
265+
266+
Parameters:
267+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
268+
- `repository` (required): Repository slug
269+
- `filePath` (required): Path to the file in the repository
270+
- `branch`: Branch or commit hash (optional, defaults to main/master)
271+
- `limit`: Maximum lines per request (default: 100, max: 1000)
272+
- `start`: Starting line number for pagination (default: 0)
273+
274+
### `browse_repository`
275+
276+
**Explore repository structure**: Browse files and directories in repositories to understand project organization and locate specific files.
277+
278+
**Use cases:**
279+
- Explore repository structure
280+
- Navigate directory trees
281+
- Find files and folders
282+
- Understand project organization
283+
284+
Parameters:
285+
- `project`: Bitbucket project key (optional, uses BITBUCKET_DEFAULT_PROJECT if not provided)
286+
- `repository` (required): Repository slug
287+
- `path`: Directory path to browse (optional, defaults to root)
288+
- `branch`: Branch or commit hash (optional, defaults to main/master)
289+
- `limit`: Maximum items to return (default: 50)
290+
209291
## Usage Examples
210292

211293
### Listing Projects and Repositories
@@ -224,6 +306,31 @@ list_repositories --project "MYPROJECT"
224306
list_projects --limit 10 --start 0
225307
```
226308

309+
### Search and File Operations
310+
311+
```bash
312+
# Search for README files across all projects
313+
search --query "README" --type "file" --limit 10
314+
315+
# Search for specific code patterns in a project
316+
search --query "function getUserData" --type "code" --project "MYPROJECT"
317+
318+
# Search with file extension filter
319+
search --query "config ext:yml" --project "MYPROJECT"
320+
321+
# Browse repository structure
322+
browse_repository --project "MYPROJECT" --repository "my-repo"
323+
324+
# Browse specific directory
325+
browse_repository --project "MYPROJECT" --repository "my-repo" --path "src/components"
326+
327+
# Read file contents
328+
get_file_content --project "MYPROJECT" --repository "my-repo" --filePath "package.json" --limit 20
329+
330+
# Read specific lines from a large file
331+
get_file_content --project "MYPROJECT" --repository "my-repo" --filePath "docs/CHANGELOG.md" --start 100 --limit 50
332+
```
333+
227334
### Working with Pull Requests
228335

229336
```bash
@@ -236,16 +343,17 @@ create_pull_request --project "MYPROJECT" --repository "my-repo" --title "Bugfix
236343
# Get pull request details
237344
get_pull_request --repository "my-repo" --prId 123
238345

239-
# Merge a pull request with squash strategy
240-
merge_pull_request --repository "my-repo" --prId 123 --strategy "squash" --message "Feature: New functionality (#123)"
346+
# Get only comments from a PR (no reviews/commits)
347+
get_comments --project "MYPROJECT" --repository "my-repo" --prId 123
241348

242-
# Get pull request activities (comments, reviews, commits, etc.)
349+
# Get full PR activity timeline
243350
get_activities --repository "my-repo" --prId 123
244351

245-
# Get activities for a specific project
246-
get_activities --project "MYPROJECT" --repository "my-repo" --prId 123
352+
# Merge a pull request with squash strategy
353+
merge_pull_request --repository "my-repo" --prId 123 --strategy "squash" --message "Feature: New functionality (#123)"
247354
```
248355

356+
249357
## Dependencies
250358

251359
- `@modelcontextprotocol/sdk` - SDK for MCP protocol implementation

0 commit comments

Comments
 (0)