@atlassian-dc-mcp/bitbucket 0.2.0 → 0.3.4
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.
- package/CHANGELOG.md +19 -0
- package/README.md +128 -0
- package/build/bitbucket-service.d.ts +26 -66
- package/build/bitbucket-service.d.ts.map +1 -1
- package/build/bitbucket-service.js +13 -82
- package/build/bitbucket-service.js.map +1 -1
- package/package.json +3 -3
- package/src/bitbucket-service.ts +24 -73
- package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,25 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [0.3.4](https://github.com/b1ff/atlassian-dc-mcp/compare/v0.3.3...v0.3.4) (2025-03-08)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @atlassian-dc-mcp/bitbucket
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [0.3.0](https://github.com/b1ff/atlassian-dc-mcp/compare/v0.2.1...v0.3.0) (2025-03-03)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
* improve error details for confluence and bitbucket so the LLM is able to correct itself based on the error. ([96f469f](https://github.com/b1ff/atlassian-dc-mcp/commit/96f469f6562c38f7460a4e13096b7f55d45acc1c))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
6
25
|
# [0.2.0](https://github.com/b1ff/atlassian-dc-mcp/compare/v0.1.6...v0.2.0) (2025-03-02)
|
|
7
26
|
|
|
8
27
|
**Note:** Version bump only for package @atlassian-dc-mcp/bitbucket
|
package/README.md
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
# Atlassian Bitbucket Data Center MCP
|
|
2
|
+
|
|
3
|
+
This package provides a Machine Comprehension Protocol (MCP) server for interacting with Atlassian Bitbucket Data Center edition.
|
|
4
|
+
|
|
5
|
+
## Claude Desktop Configuration
|
|
6
|
+
|
|
7
|
+
To use this MCP connector with Claude Desktop, add the following to your Claude Desktop configuration:
|
|
8
|
+
|
|
9
|
+
macOS:
|
|
10
|
+
```
|
|
11
|
+
~/Library/Application Support/Claude/claude_desktop_config.json
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Windows:
|
|
15
|
+
```
|
|
16
|
+
%APPDATA%\Claude\claude_desktop_config.json
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"mcpServers": {
|
|
22
|
+
"atlassian-bitbucket-dc": {
|
|
23
|
+
"command": "npx",
|
|
24
|
+
"args": ["-y", "@atlassian-dc-mcp/bitbucket"],
|
|
25
|
+
"env": {
|
|
26
|
+
"BITBUCKET_HOST": "your-bitbucket-host",
|
|
27
|
+
"BITBUCKET_API_TOKEN": "your-token"
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
Note: Set `BITBUCKET_HOST` variable only to domain + port without protocol (e.g., `your-instance.atlassian.net`). The https protocol is assumed.
|
|
35
|
+
|
|
36
|
+
## Features
|
|
37
|
+
|
|
38
|
+
- Access repository information
|
|
39
|
+
- Get file contents
|
|
40
|
+
- Browse branches and commits
|
|
41
|
+
- Get pull request information
|
|
42
|
+
- Search and filter repositories
|
|
43
|
+
|
|
44
|
+
## Setup
|
|
45
|
+
|
|
46
|
+
1. Install dependencies:
|
|
47
|
+
```
|
|
48
|
+
npm install
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
2. Create a `.env` file in the packages/bitbucket directory with the following variables:
|
|
52
|
+
```
|
|
53
|
+
BITBUCKET_HOST=your-bitbucket-instance.atlassian.net
|
|
54
|
+
BITBUCKET_API_TOKEN=your-personal-access-token
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
To create a personal access token:
|
|
58
|
+
- In Bitbucket, select your profile picture at the bottom left
|
|
59
|
+
- Select **Manage Account** > **HTTP access tokens**
|
|
60
|
+
- Select **Create token** and give it a name
|
|
61
|
+
- Set appropriate permissions for the token
|
|
62
|
+
- Copy the token and store it securely (you won't be able to see it again)
|
|
63
|
+
|
|
64
|
+
## Usage
|
|
65
|
+
|
|
66
|
+
Start the MCP server:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
npm run build
|
|
70
|
+
npm start
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Or for development with auto-reload:
|
|
74
|
+
|
|
75
|
+
```
|
|
76
|
+
npm run dev
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
### Available Tools
|
|
80
|
+
|
|
81
|
+
#### 1. bitbucket_getRepositories
|
|
82
|
+
|
|
83
|
+
Get a list of repositories from the Bitbucket Data Center instance.
|
|
84
|
+
|
|
85
|
+
Parameters:
|
|
86
|
+
- `projectKey` (string, optional): Filter repositories by project key
|
|
87
|
+
- `limit` (number, optional): Maximum number of results to return
|
|
88
|
+
- `start` (number, optional): Starting index for pagination
|
|
89
|
+
|
|
90
|
+
#### 2. bitbucket_getRepository
|
|
91
|
+
|
|
92
|
+
Get details of a specific repository from the Bitbucket Data Center instance.
|
|
93
|
+
|
|
94
|
+
Parameters:
|
|
95
|
+
- `projectKey` (string, required): The project key (e.g., "PROJECT")
|
|
96
|
+
- `repositorySlug` (string, required): The repository slug (e.g., "repo-name")
|
|
97
|
+
|
|
98
|
+
#### 3. bitbucket_getBranches
|
|
99
|
+
|
|
100
|
+
Get branches for a repository from the Bitbucket Data Center instance.
|
|
101
|
+
|
|
102
|
+
Parameters:
|
|
103
|
+
- `projectKey` (string, required): The project key
|
|
104
|
+
- `repositorySlug` (string, required): The repository slug
|
|
105
|
+
- `filterText` (string, optional): Filter branches by name
|
|
106
|
+
- `limit` (number, optional): Maximum number of results to return
|
|
107
|
+
- `start` (number, optional): Starting index for pagination
|
|
108
|
+
|
|
109
|
+
#### 4. bitbucket_getFileContent
|
|
110
|
+
|
|
111
|
+
Get the content of a file from a repository in the Bitbucket Data Center instance.
|
|
112
|
+
|
|
113
|
+
Parameters:
|
|
114
|
+
- `projectKey` (string, required): The project key
|
|
115
|
+
- `repositorySlug` (string, required): The repository slug
|
|
116
|
+
- `path` (string, required): Path to the file in the repository
|
|
117
|
+
- `at` (string, optional): Commit or branch to get the file from (defaults to main/master branch)
|
|
118
|
+
|
|
119
|
+
#### 5. bitbucket_getPullRequests
|
|
120
|
+
|
|
121
|
+
Get pull requests for a repository from the Bitbucket Data Center instance.
|
|
122
|
+
|
|
123
|
+
Parameters:
|
|
124
|
+
- `projectKey` (string, required): The project key
|
|
125
|
+
- `repositorySlug` (string, required): The repository slug
|
|
126
|
+
- `state` (string, optional): Filter by PR state (OPEN, MERGED, DECLINED)
|
|
127
|
+
- `limit` (number, optional): Maximum number of results to return
|
|
128
|
+
- `start` (number, optional): Starting index for pagination
|
|
@@ -11,22 +11,14 @@ export declare class BitbucketService {
|
|
|
11
11
|
* @param limit Optional pagination limit (default: 25)
|
|
12
12
|
* @returns Promise with commits data
|
|
13
13
|
*/
|
|
14
|
-
getCommits(projectKey: string, repositorySlug: string, path?: string, since?: string, until?: string, limit?: number): Promise<{
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
values?: Array<import("./bitbucket-client/index.js").RestCommit>;
|
|
23
|
-
};
|
|
24
|
-
} | {
|
|
25
|
-
success: boolean;
|
|
26
|
-
data: {
|
|
27
|
-
message: string;
|
|
28
|
-
};
|
|
29
|
-
}>;
|
|
14
|
+
getCommits(projectKey: string, repositorySlug: string, path?: string, since?: string, until?: string, limit?: number): Promise<import("@atlassian-dc-mcp/common").ApiErrorResponse<{
|
|
15
|
+
isLastPage?: boolean;
|
|
16
|
+
limit?: number;
|
|
17
|
+
nextPageStart?: number;
|
|
18
|
+
size?: number;
|
|
19
|
+
start?: number;
|
|
20
|
+
values?: Array<import("./bitbucket-client/index.js").RestCommit>;
|
|
21
|
+
}>>;
|
|
30
22
|
/**
|
|
31
23
|
* Get a list of projects
|
|
32
24
|
* @param name Optional filter by project name
|
|
@@ -35,36 +27,20 @@ export declare class BitbucketService {
|
|
|
35
27
|
* @param limit Optional pagination limit (default: 25)
|
|
36
28
|
* @returns Promise with projects data
|
|
37
29
|
*/
|
|
38
|
-
getProjects(name?: string, permission?: string, start?: number, limit?: number): Promise<{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
values?: Array<import("./bitbucket-client/index.js").RestProject>;
|
|
47
|
-
};
|
|
48
|
-
} | {
|
|
49
|
-
success: boolean;
|
|
50
|
-
data: {
|
|
51
|
-
message: string;
|
|
52
|
-
};
|
|
53
|
-
}>;
|
|
30
|
+
getProjects(name?: string, permission?: string, start?: number, limit?: number): Promise<import("@atlassian-dc-mcp/common").ApiErrorResponse<{
|
|
31
|
+
isLastPage?: boolean;
|
|
32
|
+
limit?: number;
|
|
33
|
+
nextPageStart?: number;
|
|
34
|
+
size?: number;
|
|
35
|
+
start?: number;
|
|
36
|
+
values?: Array<import("./bitbucket-client/index.js").RestProject>;
|
|
37
|
+
}>>;
|
|
54
38
|
/**
|
|
55
39
|
* Get a specific project by key
|
|
56
40
|
* @param projectKey The project key
|
|
57
41
|
* @returns Promise with project data
|
|
58
42
|
*/
|
|
59
|
-
getProject(projectKey: string): Promise<
|
|
60
|
-
success: boolean;
|
|
61
|
-
data: import("./bitbucket-client/index.js").RestProject;
|
|
62
|
-
} | {
|
|
63
|
-
success: boolean;
|
|
64
|
-
data: {
|
|
65
|
-
message: string;
|
|
66
|
-
};
|
|
67
|
-
}>;
|
|
43
|
+
getProject(projectKey: string): Promise<import("@atlassian-dc-mcp/common").ApiErrorResponse<import("./bitbucket-client/index.js").RestProject>>;
|
|
68
44
|
/**
|
|
69
45
|
* Get repositories for a project
|
|
70
46
|
* @param projectKey The project key
|
|
@@ -72,37 +48,21 @@ export declare class BitbucketService {
|
|
|
72
48
|
* @param limit Optional pagination limit (default: 25)
|
|
73
49
|
* @returns Promise with repositories data
|
|
74
50
|
*/
|
|
75
|
-
getRepositories(projectKey: string, start?: number, limit?: number): Promise<{
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
values?: Array<import("./bitbucket-client/index.js").RestRepository>;
|
|
84
|
-
};
|
|
85
|
-
} | {
|
|
86
|
-
success: boolean;
|
|
87
|
-
data: {
|
|
88
|
-
message: string;
|
|
89
|
-
};
|
|
90
|
-
}>;
|
|
51
|
+
getRepositories(projectKey: string, start?: number, limit?: number): Promise<import("@atlassian-dc-mcp/common").ApiErrorResponse<{
|
|
52
|
+
isLastPage?: boolean;
|
|
53
|
+
limit?: number;
|
|
54
|
+
nextPageStart?: number;
|
|
55
|
+
size?: number;
|
|
56
|
+
start?: number;
|
|
57
|
+
values?: Array<import("./bitbucket-client/index.js").RestRepository>;
|
|
58
|
+
}>>;
|
|
91
59
|
/**
|
|
92
60
|
* Get a specific repository
|
|
93
61
|
* @param projectKey The project key
|
|
94
62
|
* @param repositorySlug The repository slug
|
|
95
63
|
* @returns Promise with repository data
|
|
96
64
|
*/
|
|
97
|
-
getRepository(projectKey: string, repositorySlug: string): Promise<
|
|
98
|
-
success: boolean;
|
|
99
|
-
data: import("./bitbucket-client/index.js").RestRepository;
|
|
100
|
-
} | {
|
|
101
|
-
success: boolean;
|
|
102
|
-
data: {
|
|
103
|
-
message: string;
|
|
104
|
-
};
|
|
105
|
-
}>;
|
|
65
|
+
getRepository(projectKey: string, repositorySlug: string): Promise<import("@atlassian-dc-mcp/common").ApiErrorResponse<import("./bitbucket-client/index.js").RestRepository>>;
|
|
106
66
|
static validateConfig(): string[];
|
|
107
67
|
}
|
|
108
68
|
export declare const bitbucketToolSchemas: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket-service.d.ts","sourceRoot":"","sources":["../src/bitbucket-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"bitbucket-service.d.ts","sourceRoot":"","sources":["../src/bitbucket-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,qBAAa,gBAAgB;gBACf,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAOvC;;;;;;;;;OASG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW;;;;;;;;IAqB9H;;;;;;;OAOG;IACG,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW;;;;;;;;IAOxF;;;;OAIG;IACG,UAAU,CAAC,UAAU,EAAE,MAAM;IAOnC;;;;;;OAMG;IACG,eAAe,CAAC,UAAU,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,EAAE,KAAK,GAAE,MAAW;;;;;;;;IAO5E;;;;;OAKG;IACG,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM;IAO9D,MAAM,CAAC,cAAc,IAAI,MAAM,EAAE;CAIlC;AAED,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;CA2BhC,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OpenAPI, ProjectService, RepositoryService } from './bitbucket-client/index.js';
|
|
3
|
+
import { handleApiOperation } from '@atlassian-dc-mcp/common';
|
|
3
4
|
export class BitbucketService {
|
|
4
5
|
constructor(host, token) {
|
|
5
6
|
// Configure the OpenAPI client
|
|
@@ -18,28 +19,14 @@ export class BitbucketService {
|
|
|
18
19
|
* @returns Promise with commits data
|
|
19
20
|
*/
|
|
20
21
|
async getCommits(projectKey, repositorySlug, path, since, until, limit = 25) {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
limit);
|
|
30
|
-
return {
|
|
31
|
-
success: true,
|
|
32
|
-
data: response
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
catch (error) {
|
|
36
|
-
return {
|
|
37
|
-
success: false,
|
|
38
|
-
data: {
|
|
39
|
-
message: `Error fetching commits: ${error instanceof Error ? error.message : String(error)}`
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
22
|
+
return handleApiOperation(() => RepositoryService.getCommits(projectKey, repositorySlug, undefined, // avatarScheme
|
|
23
|
+
path, undefined, // withCounts
|
|
24
|
+
undefined, // followRenames
|
|
25
|
+
until, undefined, // avatarSize
|
|
26
|
+
since, undefined, // merges
|
|
27
|
+
undefined, // ignoreMissing
|
|
28
|
+
0, // start
|
|
29
|
+
limit), 'Error fetching commits');
|
|
43
30
|
}
|
|
44
31
|
/**
|
|
45
32
|
* Get a list of projects
|
|
@@ -50,21 +37,7 @@ export class BitbucketService {
|
|
|
50
37
|
* @returns Promise with projects data
|
|
51
38
|
*/
|
|
52
39
|
async getProjects(name, permission, start, limit = 25) {
|
|
53
|
-
|
|
54
|
-
const response = await ProjectService.getProjects(name, permission, start, limit);
|
|
55
|
-
return {
|
|
56
|
-
success: true,
|
|
57
|
-
data: response
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
catch (error) {
|
|
61
|
-
return {
|
|
62
|
-
success: false,
|
|
63
|
-
data: {
|
|
64
|
-
message: `Error fetching projects: ${error instanceof Error ? error.message : String(error)}`
|
|
65
|
-
}
|
|
66
|
-
};
|
|
67
|
-
}
|
|
40
|
+
return handleApiOperation(() => ProjectService.getProjects(name, permission, start, limit), 'Error fetching projects');
|
|
68
41
|
}
|
|
69
42
|
/**
|
|
70
43
|
* Get a specific project by key
|
|
@@ -72,21 +45,7 @@ export class BitbucketService {
|
|
|
72
45
|
* @returns Promise with project data
|
|
73
46
|
*/
|
|
74
47
|
async getProject(projectKey) {
|
|
75
|
-
|
|
76
|
-
const response = await ProjectService.getProject(projectKey);
|
|
77
|
-
return {
|
|
78
|
-
success: true,
|
|
79
|
-
data: response
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
catch (error) {
|
|
83
|
-
return {
|
|
84
|
-
success: false,
|
|
85
|
-
data: {
|
|
86
|
-
message: `Error fetching project: ${error instanceof Error ? error.message : String(error)}`
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
}
|
|
48
|
+
return handleApiOperation(() => ProjectService.getProject(projectKey), 'Error fetching project');
|
|
90
49
|
}
|
|
91
50
|
/**
|
|
92
51
|
* Get repositories for a project
|
|
@@ -96,21 +55,7 @@ export class BitbucketService {
|
|
|
96
55
|
* @returns Promise with repositories data
|
|
97
56
|
*/
|
|
98
57
|
async getRepositories(projectKey, start, limit = 25) {
|
|
99
|
-
|
|
100
|
-
const response = await ProjectService.getRepositories(projectKey, start, limit);
|
|
101
|
-
return {
|
|
102
|
-
success: true,
|
|
103
|
-
data: response
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
catch (error) {
|
|
107
|
-
return {
|
|
108
|
-
success: false,
|
|
109
|
-
data: {
|
|
110
|
-
message: `Error fetching repositories: ${error instanceof Error ? error.message : String(error)}`
|
|
111
|
-
}
|
|
112
|
-
};
|
|
113
|
-
}
|
|
58
|
+
return handleApiOperation(() => ProjectService.getRepositories(projectKey, start, limit), 'Error fetching repositories');
|
|
114
59
|
}
|
|
115
60
|
/**
|
|
116
61
|
* Get a specific repository
|
|
@@ -119,21 +64,7 @@ export class BitbucketService {
|
|
|
119
64
|
* @returns Promise with repository data
|
|
120
65
|
*/
|
|
121
66
|
async getRepository(projectKey, repositorySlug) {
|
|
122
|
-
|
|
123
|
-
const response = await ProjectService.getRepository(projectKey, repositorySlug);
|
|
124
|
-
return {
|
|
125
|
-
success: true,
|
|
126
|
-
data: response
|
|
127
|
-
};
|
|
128
|
-
}
|
|
129
|
-
catch (error) {
|
|
130
|
-
return {
|
|
131
|
-
success: false,
|
|
132
|
-
data: {
|
|
133
|
-
message: `Error fetching repository: ${error instanceof Error ? error.message : String(error)}`
|
|
134
|
-
}
|
|
135
|
-
};
|
|
136
|
-
}
|
|
67
|
+
return handleApiOperation(() => ProjectService.getRepository(projectKey, repositorySlug), 'Error fetching repository');
|
|
137
68
|
}
|
|
138
69
|
static validateConfig() {
|
|
139
70
|
const requiredEnvVars = ['BITBUCKET_HOST', 'BITBUCKET_API_TOKEN'];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bitbucket-service.js","sourceRoot":"","sources":["../src/bitbucket-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"bitbucket-service.js","sourceRoot":"","sources":["../src/bitbucket-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AACzF,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAE9D,MAAM,OAAO,gBAAgB;IAC3B,YAAY,IAAY,EAAE,KAAa;QACrC,+BAA+B;QAC/B,OAAO,CAAC,IAAI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AAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KAC/E;IACD,aAAa,EAAE;QACb,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAClD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;KAC3D;IACD,UAAU,EAAE;QACV,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,iBAAiB,CAAC;QAClD,cAAc,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QAC1D,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;QAC1E,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,uDAAuD,CAAC;QAC9F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;QAC/F,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,QAAQ,CAAC,2BAA2B,CAAC;KAC/E;CACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlassian-dc-mcp/bitbucket",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.4",
|
|
4
4
|
"main": "build/index.js",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": "./bin/run.js",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"test": "jest"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@atlassian-dc-mcp/common": "^0.
|
|
17
|
+
"@atlassian-dc-mcp/common": "^0.3.0",
|
|
18
18
|
"@modelcontextprotocol/sdk": "^1.5.0",
|
|
19
19
|
"dotenv": "^16.4.7",
|
|
20
20
|
"node-fetch": "^3.3.2",
|
|
@@ -29,5 +29,5 @@
|
|
|
29
29
|
"publishConfig": {
|
|
30
30
|
"access": "public"
|
|
31
31
|
},
|
|
32
|
-
"gitHead": "
|
|
32
|
+
"gitHead": "c376e231e47a6877a981b2601d8a3d4812f21868"
|
|
33
33
|
}
|
package/src/bitbucket-service.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
import { OpenAPI, ProjectService, RepositoryService } from './bitbucket-client/index.js';
|
|
3
|
+
import { handleApiOperation } from '@atlassian-dc-mcp/common';
|
|
3
4
|
|
|
4
5
|
export class BitbucketService {
|
|
5
6
|
constructor(host: string, token: string) {
|
|
@@ -20,10 +21,10 @@ export class BitbucketService {
|
|
|
20
21
|
* @returns Promise with commits data
|
|
21
22
|
*/
|
|
22
23
|
async getCommits(projectKey: string, repositorySlug: string, path?: string, since?: string, until?: string, limit: number = 25) {
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
projectKey,
|
|
26
|
-
repositorySlug,
|
|
24
|
+
return handleApiOperation(
|
|
25
|
+
() => RepositoryService.getCommits(
|
|
26
|
+
projectKey,
|
|
27
|
+
repositorySlug,
|
|
27
28
|
undefined, // avatarScheme
|
|
28
29
|
path,
|
|
29
30
|
undefined, // withCounts
|
|
@@ -35,19 +36,9 @@ export class BitbucketService {
|
|
|
35
36
|
undefined, // ignoreMissing
|
|
36
37
|
0, // start
|
|
37
38
|
limit
|
|
38
|
-
)
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
data: response
|
|
42
|
-
};
|
|
43
|
-
} catch (error) {
|
|
44
|
-
return {
|
|
45
|
-
success: false,
|
|
46
|
-
data: {
|
|
47
|
-
message: `Error fetching commits: ${error instanceof Error ? error.message : String(error)}`
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
39
|
+
),
|
|
40
|
+
'Error fetching commits'
|
|
41
|
+
);
|
|
51
42
|
}
|
|
52
43
|
|
|
53
44
|
/**
|
|
@@ -59,20 +50,10 @@ export class BitbucketService {
|
|
|
59
50
|
* @returns Promise with projects data
|
|
60
51
|
*/
|
|
61
52
|
async getProjects(name?: string, permission?: string, start?: number, limit: number = 25) {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
data: response
|
|
67
|
-
};
|
|
68
|
-
} catch (error) {
|
|
69
|
-
return {
|
|
70
|
-
success: false,
|
|
71
|
-
data: {
|
|
72
|
-
message: `Error fetching projects: ${error instanceof Error ? error.message : String(error)}`
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
}
|
|
53
|
+
return handleApiOperation(
|
|
54
|
+
() => ProjectService.getProjects(name, permission, start, limit),
|
|
55
|
+
'Error fetching projects'
|
|
56
|
+
);
|
|
76
57
|
}
|
|
77
58
|
|
|
78
59
|
/**
|
|
@@ -81,20 +62,10 @@ export class BitbucketService {
|
|
|
81
62
|
* @returns Promise with project data
|
|
82
63
|
*/
|
|
83
64
|
async getProject(projectKey: string) {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
data: response
|
|
89
|
-
};
|
|
90
|
-
} catch (error) {
|
|
91
|
-
return {
|
|
92
|
-
success: false,
|
|
93
|
-
data: {
|
|
94
|
-
message: `Error fetching project: ${error instanceof Error ? error.message : String(error)}`
|
|
95
|
-
}
|
|
96
|
-
};
|
|
97
|
-
}
|
|
65
|
+
return handleApiOperation(
|
|
66
|
+
() => ProjectService.getProject(projectKey),
|
|
67
|
+
'Error fetching project'
|
|
68
|
+
);
|
|
98
69
|
}
|
|
99
70
|
|
|
100
71
|
/**
|
|
@@ -105,20 +76,10 @@ export class BitbucketService {
|
|
|
105
76
|
* @returns Promise with repositories data
|
|
106
77
|
*/
|
|
107
78
|
async getRepositories(projectKey: string, start?: number, limit: number = 25) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
data: response
|
|
113
|
-
};
|
|
114
|
-
} catch (error) {
|
|
115
|
-
return {
|
|
116
|
-
success: false,
|
|
117
|
-
data: {
|
|
118
|
-
message: `Error fetching repositories: ${error instanceof Error ? error.message : String(error)}`
|
|
119
|
-
}
|
|
120
|
-
};
|
|
121
|
-
}
|
|
79
|
+
return handleApiOperation(
|
|
80
|
+
() => ProjectService.getRepositories(projectKey, start, limit),
|
|
81
|
+
'Error fetching repositories'
|
|
82
|
+
);
|
|
122
83
|
}
|
|
123
84
|
|
|
124
85
|
/**
|
|
@@ -128,20 +89,10 @@ export class BitbucketService {
|
|
|
128
89
|
* @returns Promise with repository data
|
|
129
90
|
*/
|
|
130
91
|
async getRepository(projectKey: string, repositorySlug: string) {
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
data: response
|
|
136
|
-
};
|
|
137
|
-
} catch (error) {
|
|
138
|
-
return {
|
|
139
|
-
success: false,
|
|
140
|
-
data: {
|
|
141
|
-
message: `Error fetching repository: ${error instanceof Error ? error.message : String(error)}`
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
}
|
|
92
|
+
return handleApiOperation(
|
|
93
|
+
() => ProjectService.getRepository(projectKey, repositorySlug),
|
|
94
|
+
'Error fetching repository'
|
|
95
|
+
);
|
|
145
96
|
}
|
|
146
97
|
|
|
147
98
|
static validateConfig(): string[] {
|