Skip to main content
Glama
regscale-mcp

regscale-mcp

by dgwhited
README.md
# regscale-mcp

An MCP (Model Context Protocol) server that exposes RegScale GRC platform APIs as tools for AI assistants. Built with [FastMCP](https://github.com/jlowin/fastmcp) and packaged as a container image.

## Tools

26 tools across 4 API domains:

| Domain | Tools | Description |
|--------|-------|-------------|
| **Security Plans** | `list_security_plans`, `get_security_plan`, `filter_security_plans`, `create_security_plan`, `update_security_plan`, `delete_security_plan` | Full CRUD for SSP records |
| **Catalogs** | `list_catalogs`, `get_catalog`, `get_catalog_with_details`, `filter_catalogs`, `get_catalog_count` | Browse compliance frameworks (NIST, CMMC, FedRAMP, etc.) |
| **Security Controls** | `list_security_controls`, `get_security_control`, `filter_security_controls`, `get_controls_by_family`, `get_control_status_by_family`, `create_security_control`, `update_security_control` | Manage controls within catalogs |
| **Control Implementations** | `list_control_implementations`, `get_control_implementation`, `get_control_implementation_details`, `filter_control_implementations`, `filter_scorecard`, `create_control_implementation`, `update_control_implementation`, `delete_control_implementation` | Track how controls are implemented in plans |

## Prerequisites

- [Podman](https://podman.io/) or [Docker](https://www.docker.com/)
- A RegScale instance with API access
- A RegScale JWT token (obtain from the RegScale UI or authentication API)

## Quick Start

### 1. Build the container image

```bash
podman build -t regscale-mcp:latest .
```

### 2. Configure environment variables

Copy the example env file and fill in your values:

```bash
cp .env.example .env
```

Edit `.env`:

```
REGSCALE_URL=https://your-regscale-instance.com
REGSCALE_TOKEN=your-jwt-token-here
```

### 3. Test the server

```bash
podman run -i --rm \
  -e REGSCALE_URL=https://your-regscale-instance.com \
  -e REGSCALE_TOKEN=your-jwt-token \
  regscale-mcp:latest
```

The server communicates over stdio using the MCP protocol. Send a JSON-RPC `initialize` request to verify it's working.

## MCP Client Configuration

### Claude Code

Add to `~/.claude/mcp-servers/.mcp.json`:

```json
{
  "mcpServers": {
    "regscale": {
      "command": "podman",
      "args": ["run", "-i", "--rm", "-e", "REGSCALE_URL", "-e", "REGSCALE_TOKEN", "regscale-mcp:latest"],
      "env": {
        "REGSCALE_URL": "https://your-regscale-instance.com",
        "REGSCALE_TOKEN": "your-jwt-token"
      }
    }
  }
}
```

### Claude Desktop

Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):

```json
{
  "mcpServers": {
    "regscale": {
      "command": "podman",
      "args": ["run", "-i", "--rm", "-e", "REGSCALE_URL", "-e", "REGSCALE_TOKEN", "regscale-mcp:latest"],
      "env": {
        "REGSCALE_URL": "https://your-regscale-instance.com",
        "REGSCALE_TOKEN": "your-jwt-token"
      }
    }
  }
}
```

### OpenCode

Add to `opencode.json` in your project root:

```json
{
  "$schema": "https://opencode.ai/config.json",
  "mcp": {
    "regscale": {
      "type": "local",
      "command": ["podman", "run", "-i", "--rm", "-e", "REGSCALE_URL", "-e", "REGSCALE_TOKEN", "regscale-mcp:latest"],
      "environment": {
        "REGSCALE_URL": "https://your-regscale-instance.com",
        "REGSCALE_TOKEN": "your-jwt-token"
      },
      "enabled": true
    }
  }
}
```

## Architecture

```
src/regscale_mcp/
├── server.py          # FastMCP entry point, registers all tools
├── client.py          # Async HTTP client with Bearer token auth
└── tools/
    ├── security_plans.py
    ├── catalogs.py
    ├── security_controls.py
    └── control_implementations.py
```

- **Transport**: stdio (designed to run as a subprocess of the MCP client)
- **Auth**: Bearer JWT token via `REGSCALE_TOKEN` environment variable
- **HTTP client**: async httpx with 60s timeout
- **Update pattern**: fetch-merge-put (GET current record, merge changes, PUT back) to avoid clearing unset fields
- **Search/filter**: Uses RegScale's `SearchModel` body with `simpleSearch`, pagination, and sorting

## Development

### Install locally (without container)

```bash
pip install -e .
regscale-mcp
```

### Build with docker-compose / podman-compose

```bash
podman-compose build
```

## License

[Apache License 2.0](LICENSE)