Skip to main content
Glama
README.md
# patchfort

A safe, scoped, stateless MCP server for GitHub issue and pull-request triage.

## Overview

**patchfort** is an MCP (Model Context Protocol) server that enables AI assistants like Claude to safely triage GitHub issues and review pull requests with comprehensive security controls.

### Key Features

- ๐Ÿ”’ **Security-first design** - Assumes the AI model may be compromised via prompt injection
- ๐ŸŽฏ **Capability tiers** - Granular control: `read` < `triage` < `write`
- ๐Ÿ›ก๏ธ **Two-step mutations** - Propose โ†’ review โ†’ commit workflow with signed handles
- ๐Ÿ“‹ **Repository allowlist** - Strict control over which repos can be accessed
- ๐Ÿ” **Untrusted content handling** - All third-party text is sanitized and wrapped
- ๐Ÿ“Š **Audit logging** - Complete accountability trail of all operations
- ๐Ÿšซ **No destructive actions** - Cannot delete, close, or merge anything
- โšก **Stateless architecture** - Follows MCP spec revision 2026-07-28

## Status

๐Ÿšง **In Development** - This project is currently being built according to the BUILD_SPEC.md specification.

## Installation

```bash
# Install via uv (recommended)
uv pip install patchfort

# Or via pip
pip install patchfort
```

## Quick Start

### Configuration

Set environment variables or create a `.env` file:

```bash
# Required
GHTRIAGE_GITHUB_TOKEN=your_github_token_here
GHTRIAGE_ALLOWED_REPOS=owner/repo1,owner/repo2

# Optional - enable triage/write capabilities
GHTRIAGE_TIERS=read,triage,write
GHTRIAGE_HANDLE_SECRET=$(openssl rand -hex 32)
```

### Running the Server

```bash
# Stdio mode (for local MCP clients like Claude Desktop)
patchfort

# HTTP mode (for remote access)
GHTRIAGE_TRANSPORT=http GHTRIAGE_HTTP_BEARER_TOKENS=your_secret_token patchfort
```

### MCP Client Configuration

Add to your MCP client configuration (e.g., Claude Desktop):

```json
{
  "mcpServers": {
    "patchfort": {
      "command": "patchfort",
      "env": {
        "GHTRIAGE_GITHUB_TOKEN": "your_token_here",
        "GHTRIAGE_TIERS": "read,triage",
        "GHTRIAGE_ALLOWED_REPOS": "owner/repo"
      }
    }
  }
}
```

## Documentation

- [Architecture](docs/ARCHITECTURE.md)
- [Security Model & Threat Model](docs/THREAT_MODEL.md)
- [Configuration Reference](docs/CONFIGURATION.md)
- [Build Specification](BUILD_SPEC.md)
- [Human Tasks Checklist](docs/TODO_HUMAN.md)

## Security

This project implements comprehensive security controls:

- **S1-S12**: Complete security control suite (see BUILD_SPEC.md ยง6)
- Prompt injection defenses
- HMAC-signed, expiring, single-use handles
- Secret redaction throughout
- Rate limiting per principal
- Strict input validation

See [SECURITY.md](SECURITY.md) for security policy and responsible disclosure.

## Development

```bash
# Clone and set up
git clone https://github.com/yourusername/patchfort.git
cd patchfort
uv venv
source .venv/bin/activate  # or .venv\Scripts\activate on Windows
uv pip install -e ".[dev]"

# Run checks
make check  # lint, format, type-check, test, coverage
```

## License

MIT License - see [LICENSE](LICENSE) file for details.

## Contributing

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## Acknowledgments

Built following the Model Context Protocol specification and designed for safe AI-assisted GitHub triage workflows.