Skip to main content

CLI and MCP server for Pretorin Compliance API

Project description

Pretorin

AI Compliance tools for developers.

PyPI version License: MIT Tests MCP Compatible Python 3.10+


We believe that compliance should be easy for developers. We now have AI machines the can write the detailed security documents that used to rob developers of their time and focus. We are building the tool kit to make this a reality. To that end, this is a CLI and MCP server for the Pretorin Compliance Platform API. It makes it easy to bring high quality compliance context into your favorite AI tool. Access enriched compliance framework data, control families, and control details from NIST 800-53, NIST 800-171, FedRAMP, CMMC, and many more to come

Installation

Stable (PyPI)

pip install pretorin

We recommend using uv or pipx for isolated installation:

uv tool install pretorin
pipx install pretorin

Latest (GitHub)

Install the latest development version directly from GitHub:

pip install git+https://github.com/pretorin-ai/pretorin-cli.git

Or with uv:

uv tool install git+https://github.com/pretorin-ai/pretorin-cli.git

Updating

Check for updates and upgrade:

pretorin update

Quick Start

Get your API key from https://platform.pretorin.com/, then authenticate:

pretorin login

Verify your authentication:

pretorin whoami

MCP Integration

Rome-bot

The Pretorin CLI includes an MCP (Model Context Protocol) server that enables AI assistants to access compliance framework data directly during conversations.

Why MCP?

  • Real-time data — Query the latest compliance frameworks and controls
  • Reduce hallucination — Work with authoritative compliance data instead of training knowledge
  • Streamline workflows — No copy-pasting between tools

Setup

Install and authenticate first:

uv tool install pretorin
pretorin login

Then add Pretorin to your AI tool of choice:

Claude Desktop

Add to your Claude Desktop configuration file:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "pretorin": {
      "command": "pretorin",
      "args": ["mcp-serve"]
    }
  }
}

Restart Claude Desktop after saving.

Claude Code

Quick setup — run a single command:

claude mcp add --transport stdio pretorin -- pretorin mcp-serve

This registers the server for your current project. To make it available across all your projects, add --scope user.

Team setup — add a .mcp.json file to your project root so every team member gets the server automatically:

{
  "mcpServers": {
    "pretorin": {
      "type": "stdio",
      "command": "pretorin",
      "args": ["mcp-serve"]
    }
  }
}

Claude Code will detect the file automatically.

Cursor

Add to ~/.cursor/mcp.json:

{
  "mcpServers": {
    "pretorin": {
      "command": "pretorin",
      "args": ["mcp-serve"]
    }
  }
}

Restart Cursor after saving.

OpenAI Codex CLI

Add to ~/.codex/config.toml:

[mcp_servers.pretorin]
command = "pretorin"
args = ["mcp-serve"]
Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "pretorin": {
      "command": "pretorin",
      "args": ["mcp-serve"]
    }
  }
}

Restart Windsurf after saving.

Available Tools

Tool Description
pretorin_list_frameworks List all compliance frameworks
pretorin_get_framework Get framework metadata
pretorin_list_control_families List control families for a framework
pretorin_list_controls List controls (with optional family filter)
pretorin_get_control Get detailed control information
pretorin_get_control_references Get control guidance and references
pretorin_get_document_requirements Get document requirements for a framework

Resources

Resource URI Description
analysis://schema Compliance artifact JSON schema
analysis://guide/{framework_id} Framework analysis guide
analysis://control/{control_id} Control analysis guidance

Example Prompts

Try asking your AI assistant:

  • "What compliance frameworks are available for government systems?"
  • "What are the Account Management requirements for FedRAMP Moderate?"
  • "What documents do I need for NIST 800-171 compliance?"
  • "Show me all Audit controls in NIST 800-53"

For comprehensive MCP documentation, see docs/MCP.md.

CLI Reference

For comprehensive documentation with real terminal output examples, see docs/CLI.md.

Quick Examples

# List all frameworks
pretorin frameworks list

# Get framework details
pretorin frameworks get fedramp-moderate

# List control families (IDs are slugs like "access-control", not "ac")
pretorin frameworks families nist-800-53-r5

# List controls filtered by family
pretorin frameworks controls nist-800-53-r5 --family access-control --limit 10

# Get control details (IDs are zero-padded: "ac-01", not "ac-1")
pretorin frameworks control nist-800-53-r5 ac-02

# Get full control details with statement, guidance, and related controls
pretorin frameworks control nist-800-53-r5 ac-02 --references

All Commands

Command Description
pretorin login Authenticate with the Pretorin API
pretorin logout Clear stored credentials
pretorin whoami Display current authentication status
pretorin frameworks list List all compliance frameworks
pretorin frameworks get <id> Get framework details
pretorin frameworks families <id> List control families
pretorin frameworks controls <id> List controls (--family, --limit)
pretorin frameworks control <framework> <control> Get control details (--references)
pretorin frameworks documents <id> Get document requirements
pretorin config list List all configuration
pretorin config get <key> Get a config value
pretorin config set <key> <value> Set a config value
pretorin config path Show config file path
pretorin version Show CLI version
pretorin update Update to latest version
pretorin mcp-serve Start the MCP server

Configuration

Credentials are stored in ~/.pretorin/config.json.

Environment Variables

Variable Description
PRETORIN_API_KEY API key (overrides stored config)
PRETORIN_API_BASE_URL Custom API URL (default: https://platform.pretorin.com/api/v1)

Supported Frameworks

The initial public release includes these Government Core frameworks:

  • NIST SP 800-53 Rev 5
  • NIST SP 800-171 Rev 2
  • FedRAMP (Low, Moderate, High)
  • CMMC Level 1, 2, and 3

Additional frameworks are available on the platform. See platform.pretorin.com/api/docs for the full list.

Development

Setup

git clone https://github.com/pretorin-ai/pretorin-cli.git
cd pretorin-cli
uv pip install -e ".[dev]"

Or with pip:

pip install -e ".[dev]"

Running Tests

pytest

With coverage:

pytest --cov=pretorin --cov-report=term-missing

Docker Testing

# Run all tests
docker-compose run --rm test

# Run linter
docker-compose run --rm lint

# Run type checker
docker-compose run --rm typecheck

# Or use the convenience script
./scripts/docker-test.sh all

Type Checking

mypy src/pretorin

Linting

ruff check src/pretorin
ruff format --check src/pretorin

Contributing

Contributions are welcome! Please see our Contributing Guide for details.

License

MIT License - see LICENSE for details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pretorin-0.2.0.tar.gz (283.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pretorin-0.2.0-py3-none-any.whl (37.9 kB view details)

Uploaded Python 3

File details

Details for the file pretorin-0.2.0.tar.gz.

File metadata

  • Download URL: pretorin-0.2.0.tar.gz
  • Upload date:
  • Size: 283.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pretorin-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ecd1ce7e6990f39c3c5ff7d8e9c782729b4e3934233dd6d9e6e6a94c895e326d
MD5 4c9b936badb7d590ed4b7155286f20cf
BLAKE2b-256 a7c0b3a4b699fa7654c9b2a8a06092cd108ff1cd9262b6c2eb54237166a05e34

See more details on using hashes here.

Provenance

The following attestation bundles were made for pretorin-0.2.0.tar.gz:

Publisher: publish.yml on pretorin-ai/pretorin-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file pretorin-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pretorin-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 37.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pretorin-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b65da9625bf77bfb90cac9d3374e69409000ecee2c38e7d177f47a1a924f6a92
MD5 a31037f5007d5ca27b379e6c7dadeb35
BLAKE2b-256 320665ced7aa1789413c83886d48089ef2fe0fc8afac662a14385cb450bee769

See more details on using hashes here.

Provenance

The following attestation bundles were made for pretorin-0.2.0-py3-none-any.whl:

Publisher: publish.yml on pretorin-ai/pretorin-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page