Metadata-Version: 2.4
Name: bitbucket-review-mcp
Version: 0.1.0
Summary: An MCP server for interactive Bitbucket Cloud pull-request review with Claude.
Project-URL: Homepage, https://github.com/fahidnibu/pr_mcp
Project-URL: Repository, https://github.com/fahidnibu/pr_mcp
Project-URL: Issues, https://github.com/fahidnibu/pr_mcp/issues
Author: fahidnibu
License: MIT
License-File: LICENSE
Keywords: bitbucket,claude,code-review,llm,mcp,pull-request
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Requires-Dist: httpx>=0.27.0
Requires-Dist: mcp<2.0,>=1.2.0
Requires-Dist: python-dotenv>=1.0.0
Description-Content-Type: text/markdown

# bitbucket-review-mcp

An [MCP](https://modelcontextprotocol.io) server for **interactive Bitbucket
Cloud pull-request review** with Claude. Claude reads the PR, its diff and the
surrounding source code, analyses design/data-flow, proposes per-module test
cases and best practices, and — only when you confirm — posts findings back as
inline + summary comments.

## Tools exposed

| Tool | Purpose |
| --- | --- |
| `list_open_prs` | List open pull requests. |
| `get_pr` | PR metadata: title, description, branches, commit hashes. |
| `get_pr_diff` | The raw unified diff for a PR. |
| `get_pr_files` | Changed files with per-file added/removed line counts. |
| `get_file_content` | Read a file's full contents at a commit/branch. |
| `post_inline_comment` | Post an inline comment on a line in the diff. |
| `post_summary_comment` | Post a top-level summary comment on the PR. |

## Installation

Install from PyPI:

```bash
pip install bitbucket-review-mcp
```

This installs a console command, `bitbucket-review-mcp`, that runs the MCP
server over stdio.

### Install from source

```bash
git clone https://github.com/fahidnibu/pr_mcp.git
cd pr_mcp
pip install .
```

## Configuration

The server reads credentials from environment variables (or a `.env` file in the
directory it is launched from). Copy `.env.example` to `.env` and fill it in:

```bash
# Prefer an access token (Bitbucket → Workspace/Repo settings → Access tokens).
# Scopes needed: pullrequest (read) and pullrequest:write (to post comments).
BITBUCKET_ACCESS_TOKEN=

# Fallback auth if you don't use an access token (app passwords are being
# phased out by Atlassian):
BITBUCKET_USERNAME=
BITBUCKET_APP_PASSWORD=

# Optional defaults so you can review by PR id alone:
BITBUCKET_WORKSPACE=
BITBUCKET_REPO_SLUG=
```

## Register with Claude Code

Add the server to your `.mcp.json` (this repo ships one already):

```json
{
  "mcpServers": {
    "bitbucket": {
      "command": "bitbucket-review-mcp"
    }
  }
}
```

Restart Claude Code so it picks up `.mcp.json`, approve the `bitbucket` server
when prompted, and verify with `/mcp`.

> If the `bitbucket-review-mcp` command isn't on your PATH (e.g. it's installed
> in a virtualenv), use the interpreter form instead:
>
> ```json
> {
>   "mcpServers": {
>     "bitbucket": {
>       "command": "python",
>       "args": ["-m", "bitbucket_review_mcp.server"]
>     }
>   }
> }
> ```

## Usage

Just ask Claude, e.g.:

- "Review PR 412"
- "Review PR 88 in repo web-app"
- "List open PRs, then review the newest one"

Claude presents the full review in chat first and always asks before posting
anything to Bitbucket.

## Development & publishing to PyPI

Build the distribution artifacts (wheel + sdist):

```bash
pip install --upgrade build twine
python -m build
```

This produces `dist/*.whl` and `dist/*.tar.gz`. Check and upload them:

```bash
twine check dist/*

# Upload to TestPyPI first (recommended):
twine upload --repository testpypi dist/*

# Then the real index:
twine upload dist/*
```

You'll be prompted for credentials — use a
[PyPI API token](https://pypi.org/help/#apitoken) (username `__token__`,
password = the token). Bump `version` in both `pyproject.toml` and
`src/bitbucket_review_mcp/__init__.py` before each release; PyPI rejects
re-uploads of an existing version.

> **Note:** `bitbucket-review-mcp` is the distribution name declared in
> `pyproject.toml`. If that name is already taken on PyPI, change `name` in
> `pyproject.toml` (the import package `bitbucket_review_mcp` can stay).

## License

[MIT](LICENSE)
