The Bitbucket Server MCP server enables interaction with Bitbucket Server's Pull Request management features through the Model Context Protocol. This server provides tools to create, retrieve, merge, and comment on pull requests via a standardized interface.
Install the Bitbucket Server MCP server automatically with Smithery:
npx -y @smithery/cli install @garc33/bitbucket-server-mcp-server --client claude
For manual installation:
npm install
npm run build
The server requires configuration in the VSCode MCP settings file:
{
"mcpServers": {
"bitbucket": {
"command": "node",
"args": ["/path/to/bitbucket-server/build/index.js"],
"env": {
"BITBUCKET_URL": "https://your-bitbucket-server.com",
// Authentication (choose one option):
// Option 1: Personal Access Token
"BITBUCKET_TOKEN": "your-access-token",
// Option 2: Username/Password
"BITBUCKET_USERNAME": "your-username",
"BITBUCKET_PASSWORD": "your-password",
// Optional: Default project
"BITBUCKET_DEFAULT_PROJECT": "your-default-project"
}
}
}
}
BITBUCKET_URL
: Base URL of your Bitbucket Server instanceBITBUCKET_TOKEN
: Personal access tokenBITBUCKET_USERNAME
and BITBUCKET_PASSWORD
: Basic authentication credentialsBITBUCKET_DEFAULT_PROJECT
: Default project key to use when not specified in requestsCreate a new pull request:
{
"project": "PROJECT_KEY", // Optional if BITBUCKET_DEFAULT_PROJECT is set
"repository": "repo-slug", // Required
"title": "My new feature", // Required
"description": "This PR implements...",
"sourceBranch": "feature/my-feature", // Required
"targetBranch": "main", // Required
"reviewers": ["user1", "user2"] // Optional
}
Retrieve information about a specific pull request:
{
"project": "PROJECT_KEY", // Optional if BITBUCKET_DEFAULT_PROJECT is set
"repository": "repo-slug", // Required
"prId": 123 // Required
}
Merge an existing pull request:
{
"project": "PROJECT_KEY", // Optional if BITBUCKET_DEFAULT_PROJECT is set
"repository": "repo-slug", // Required
"prId": 123, // Required
"message": "Merging feature X", // Optional
"strategy": "merge-commit" // Optional, defaults to "merge-commit"
}
Available merge strategies:
merge-commit
(default)squash
fast-forward
Decline a pull request:
{
"project": "PROJECT_KEY", // Optional if BITBUCKET_DEFAULT_PROJECT is set
"repository": "repo-slug", // Required
"prId": 123, // Required
"message": "Not needed anymore" // Optional
}
Add a comment to a pull request:
{
"project": "PROJECT_KEY", // Optional if BITBUCKET_DEFAULT_PROJECT is set
"repository": "repo-slug", // Required
"prId": 123, // Required
"text": "Please fix the failing tests", // Required
"parentId": 456 // Optional, for replies
}
Retrieve the diff for a pull request:
{
"project": "PROJECT_KEY", // Optional if BITBUCKET_DEFAULT_PROJECT is set
"repository": "repo-slug", // Required
"prId": 123, // Required
"contextLines": 5 // Optional, defaults to 10
}
Get review history of a pull request:
{
"project": "PROJECT_KEY", // Optional if BITBUCKET_DEFAULT_PROJECT is set
"repository": "repo-slug", // Required
"prId": 123 // Required
}
The server logs all operations to bitbucket.log
for debugging purposes.
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.