MCP Servers

A collection of Model Context Protocol servers, templates, tools and more.

MCP server by RexySaragih

Created 1/14/2026
Updated about 15 hours ago
Repository documentation and setup instructions

Bitbucket MCP Server

A TypeScript MCP server that enables Cursor to interact with Bitbucket Cloud repositories, pull requests, and branches.

Features

Repository Operations

| Tool | Description | |------|-------------| | read_repository | Get repository info (name, description, default branch, permissions), list branches, tags, and recent commits | | read_branch | Get branch details (name, latest commit, author, date), compare branch with main/master, list files changed | | read_commit | Get commit details (message, author, date, diff), get commit files changed, parse commit message for Jira ticket references | | read_file | Read file content from any branch/tag, get file history, check if file exists | | search_code | Search across repositories, search by file path, content, or extension, filter by branch |

Pull Request Operations

| Tool | Description | |------|-------------| | list_pull_requests | List PRs by status (open, merged, declined), filter by repository, author, or Jira ticket | | read_pull_request | Get PR details (title, description, status, reviewers), get PR diff/files changed, get PR comments and approvals, extract linked Jira tickets | | create_pull_request | Create PR with title, description, source/target branches, auto-generate description from commits, auto-link to Jira ticket if mentioned, set reviewers | | update_pull_request | Update PR title, description, or status, add/remove reviewers, add comments (general or inline line-specific), merge PR (with merge strategy option) |

Branch Operations

| Tool | Description | |------|-------------| | create_branch | Create branch from source branch, auto-name from Jira ticket: feature/PROJ-123-description, validate branch name format | | delete_branch | Delete branch (with safety checks), clean up merged feature branches |

Prerequisites

  • Node.js 18+ (uses built-in fetch)
  • Bitbucket Cloud account (uses https://api.bitbucket.org/2.0 - no URL configuration needed)
  • Authentication: Atlassian API token (same as Confluence/Jira MCP servers)
    • Email - your Atlassian account email
    • API Token - generated from https://id.atlassian.com/manage-profile/security/api-tokens

Setup

1. Install dependencies

npm install

2. Configure environment

Create a .env file in the project root:

ATLASSIAN_EMAIL=your-email@example.com
ATLASSIAN_API_TOKEN=your-api-token
BITBUCKET_WORKSPACE=your-workspace
BITBUCKET_REPOSITORY=your-repository

Authentication:

  • ATLASSIAN_EMAIL - Your Atlassian account email address
  • ATLASSIAN_API_TOKEN - API token from https://id.atlassian.com/manage-profile/security/api-tokens

Default Workspace/Repository (Optional):

  • BITBUCKET_WORKSPACE - Default workspace name (can be omitted if provided in each tool call)
  • BITBUCKET_REPOSITORY - Default repository name (can be omitted if provided in each tool call)

If you set BITBUCKET_WORKSPACE and BITBUCKET_REPOSITORY, you can omit these parameters from tool calls and they'll be used automatically.

3. Build

npm run build

4. Run (stdio MCP)

npm start

You should see: Bitbucket MCP server ready (stdio).

Cursor Configuration

Add the following to ~/.cursor/mcp.json:

Option 1: Inline environment variables

{
  "mcpServers": {
    "bitbucket": {
      "command": "node",
      "args": ["/path/to/bitbucket-mcp-server/dist/index.js"],
      "env": {
        "ATLASSIAN_EMAIL": "your-email@example.com",
        "ATLASSIAN_API_TOKEN": "your-api-token",
        "BITBUCKET_WORKSPACE": "your-workspace",
        "BITBUCKET_REPOSITORY": "your-repository"
      }
    }
  }
}

Option 2: Using .env file

If you prefer to keep credentials in a .env file (created during setup), you can omit the env block. The server automatically loads .env from the project root:

{
  "mcpServers": {
    "bitbucket": {
      "command": "node",
      "args": ["/path/to/bitbucket-mcp-server/dist/index.js"]
    }
  }
}

Make sure your .env file exists in the project root:

ATLASSIAN_EMAIL=your-email@example.com
ATLASSIAN_API_TOKEN=your-api-token
BITBUCKET_WORKSPACE=your-workspace
BITBUCKET_REPOSITORY=your-repository

Note: Replace /path/to/bitbucket-mcp-server with the actual path to this project. Environment variables in mcp.json take precedence over .env if both are provided.

Tool Usage Examples

read_repository

{
  "workspace": "myworkspace",
  "repository": "myrepo"
}

Note: workspace and repository are optional if BITBUCKET_WORKSPACE and BITBUCKET_REPOSITORY are set in environment variables.

read_branch

{
  "branch": "feature/new-feature",
  "compareWithMain": true
}

Note: workspace and repository are optional if set in environment variables.

read_commit

{
  "commitHash": "abc123def456",
  "includeDiff": true
}

Note: workspace and repository are optional if set in environment variables.

read_file

{
  "filePath": "src/index.ts",
  "ref": "main"
}

Note: workspace and repository are optional if set in environment variables.

search_code

{
  "query": "function myFunction",
  "filePath": "*.ts",
  "branch": "main"
}

Note: workspace and repository are optional if set in environment variables.

list_pull_requests

{
  "state": "OPEN",
  "author": "username"
}

Note: workspace and repository are optional if set in environment variables.

read_pull_request

{
  "pullRequestId": 123,
  "includeDiff": true,
  "includeComments": true
}

Note: workspace and repository are optional if set in environment variables.

create_pull_request

{
  "title": "Add new feature",
  "description": "Implements PROJ-123",
  "sourceBranch": "feature/new-feature",
  "destinationBranch": "main",
  "reviewers": ["reviewer1", "reviewer2"],
  "autoGenerateDescription": true
}

Note: workspace and repository are optional if set in environment variables.

update_pull_request

General comment:

{
  "pullRequestId": 123,
  "comment": "Great work!"
}

Inline comment on specific line:

{
  "pullRequestId": 123,
  "comment": "Consider adding error handling here",
  "commentFilePath": "src/models/trex/BiFastDetail.ts",
  "commentLineNumber": 42
}

Update PR and merge:

{
  "pullRequestId": 123,
  "title": "Updated title",
  "state": "MERGED",
  "mergeStrategy": "squash"
}

Note: workspace and repository are optional if BITBUCKET_WORKSPACE and BITBUCKET_REPOSITORY are set in environment variables.

create_branch

From Jira ticket:

{
  "fromJiraTicket": "PROJ-123",
  "description": "implement new feature",
  "sourceBranch": "main"
}

With explicit name:

{
  "name": "feature/my-branch",
  "sourceBranch": "main"
}

Note: workspace and repository are optional if set in environment variables.

delete_branch

{
  "branchName": "feature/old-feature",
  "onlyIfMerged": true
}

Note: workspace and repository are optional if set in environment variables.

Scripts

| Command | Description | |---------|-------------| | npm run build | Compile TypeScript to dist/ | | npm start | Run the compiled MCP server | | npm run dev | Run directly with ts-node (development) |

Notes

  • API Endpoint: The server uses Bitbucket Cloud API at https://api.bitbucket.org/2.0 (hardcoded, no configuration needed)
  • Authentication: Uses ATLASSIAN_EMAIL + ATLASSIAN_API_TOKEN with Basic auth (same pattern as Confluence/Jira MCP servers)
  • Default Workspace/Repository: Set BITBUCKET_WORKSPACE and BITBUCKET_REPOSITORY in environment to make them optional in tool calls
  • Inline Comments: Use commentFilePath and commentLineNumber together with comment to create line-specific PR comments
  • Server uses stdio transport only; no HTTP port is opened
  • Branch names are automatically validated according to Bitbucket rules
  • Jira ticket references (e.g., PROJ-123) are automatically extracted from commit messages and PR descriptions
  • Protected branches (main, master, develop, dev) cannot be deleted
Quick Setup
Installation guide for this server

Install Package (if required)

npx @modelcontextprotocol/server-mcp-bitbucket

Cursor configuration (mcp.json)

{ "mcpServers": { "rexysaragih-mcp-bitbucket": { "command": "npx", "args": [ "rexysaragih-mcp-bitbucket" ] } } }