preloop
Supports human-in-the-loop safety by providing a mobile app for users to receive and respond to operation approval requests.
Integrates with GitHub Issues to allow AI agents to search, retrieve, create, and update issues with continuous synchronization.
Enables integration with GitLab Issues for automated issue tracking, indexing, and management of sensitive operations.
Supports human-in-the-loop safety via iOS and Apple Watch apps for receiving and managing operation approval notifications.
Provides integration with Jira Cloud and Server to manage issue lifecycles, perform vector searches, and evaluate issue compliance.
Provides notification integration for Enterprise users to route intercepted operation approval requests to Mattermost.
Provides notification integration for Enterprise users to route intercepted operation approval requests to Slack.
Preloop: The Policy Engine for AI Agents
Preloop is a comprehensive MCP firewall that gives you complete control over what AI agents can do. Define access policies, approval workflows, and audit trails. Allow, deny, or require approval based on conditions.
Preloop is also evolving into an AI workforce control plane for managed runtimes. Flows can now route model traffic through a Preloop-owned OpenAI-compatible gateway so usage, spend, runtime identity, and budgets can be enforced centrally.
Works with OpenClaw, Claude Code, Cursor, Codex, and any MCP-compatible agent.
Read the official documentation: Full guides and tutorials are available at docs.preloop.ai.
Why Preloop?
AI agents like Claude Code, Cursor, and OpenClaw are transforming how we work. But with great power comes great risk:
Accidental deletions. One wrong command and your production database is gone.
Leaked secrets. API keys pushed to public repos before anyone notices.
Runaway costs. Agents spinning up expensive resources without limits.
Breaking changes. Untested deployments to production at 3am.
Most teams face an impossible choice: give AI full access and move fast (but dangerously), or lock everything down and lose the productivity gains.
Preloop solves this. Define policies that allow safe operations, deny dangerous ones, and require human approval for everything in between. You stay in control. AI handles the routine work.
Core Capabilities
Access Policies
Define fine-grained access controls for any AI tool or operation:
Tools support multiple ordered access rules (not just simple approval/deny)
Rules are evaluated in priority order; first matching rule wins
Each rule has an action (allow/deny/require_approval), optional CEL condition, and optional denial message
Rules can be reordered via drag-and-drop in the UI
Approval Workflows
When AI attempts a protected operation, Preloop pauses and notifies you:
Instant notifications via mobile app, email, Slack, or Mattermost
One-tap approvals from your phone, watch, or desktop
Async approval mode — tool returns immediately with a polling handle; the agent polls
get_approval_statusuntil approved, then receives the tool result (Enterprise)Per-tool justification — require or optionally request agents to explain why a tool is being called before approval (Enterprise)
Team-based approvals with quorum requirements (Enterprise)
Escalation policies for time-sensitive operations (Enterprise)
Policy-as-Code
Define policies in YAML, manage via CLI or API:
# Example: Require approval for production deployments
version: "1.0"
metadata:
name: "Production Safeguards"
description: "Require approval before deploying to production"
tags: [security, production]
approval_workflows:
- name: "deploy-approval"
timeout_seconds: 600
required_approvals: 1
async_approval: true # Agent polls instead of blocking
tools:
- name: "bash"
source: mcp
approval_workflow: "deploy-approval"
justification: required # Agent must explain the call
conditions:
- expression: "args.command.contains('deploy') && args.command.contains('production')"
action: require_approval
description: "Production deployments require approval"Version control your policies alongside your code
GitOps workflows for policy changes
CLI management for automation and scripting
API access for programmatic policy management
Complete Audit Trail
Every AI action is logged with full context:
What was attempted (tool, parameters, context)
Which policy matched and why
Who approved or rejected (and when)
Execution result and duration
Essential for security reviews, compliance, and debugging.
AI Model Gateway
Preloop can terminate model traffic on behalf of managed runtimes instead of handing provider credentials directly to agent containers:
OpenAI-compatible gateway endpoints:
GET /openai/v1/models,POST /openai/v1/chat/completions,POST /openai/v1/responsesAnthropic-compatible gateway endpoint:
POST /anthropic/v1/messagesSSE streaming support for chat completions and responses
Per-request attribution to account, flow, flow execution, API key, and runtime principal
Token and estimated-cost accounting persisted to the gateway usage ledger
Account-level and flow-level budget enforcement with soft-limit annotations and hard stops
Product-facing usage summary endpoints for account and flow monitoring
Account-scoped runtime session explorer endpoints for browsing managed sessions beyond flows
Execution-scoped gateway event inspection via
GET /api/v1/flows/executions/{execution_id}/gateway-eventsConsole surfaces for browsing recent runtime sessions and searching captured gateway interactions
Secret Custody
Preloop now stores AI model credentials behind a provider-agnostic secret abstraction:
Built-in
local_encryptedbackend for simple self-hosted deploymentsHash-only runtime API tokens for flow executions
Optional external secret backend path for Vault/OpenBao-compatible KV v2 stores
Agent runtimes can receive short-lived Preloop gateway tokens instead of provider secrets
Comparison with AWS Agent Core
Feature | Preloop | AWS Agent Core |
Open source | ✅ | ❌ |
Self-hosted option | ✅ | ❌ |
Policy-as-code (YAML) | ✅ | Limited |
MCP native | ✅ | ❌ |
Works with any agent | ✅ | AWS-focused |
Human approval workflows | ✅ | ✅ |
Audit trail | ✅ | ✅ |
CLI management | ✅ | AWS CLI |
GitOps-friendly | ✅ | Limited |
Mobile app approvals | ✅ | ❌ |
Team-based approvals | ✅ (Enterprise) | ✅ |
Preloop is the open-source alternative to AWS Agent Core for teams who want vendor-neutral, self-hosted AI governance.
AI Agent -> Preloop -> [Policy check] -> Allow / Deny / Require Approval -> ExecuteHow it works:
Define policies for each tool: allow, deny, or require approval
Policies can be fine-grained, checking parameter values and context
AI agents call tools through Preloop's MCP proxy
Actions are allowed, denied, or paused for approval based on your policies
Full audit trail of every action and decision
Key Features
Safety & Control
Policy Engine. Define allow, deny, and approval workflows for any tool or action.
Access Rules. Multiple ordered rules per tool with allow/deny/require approval actions.
Drag-and-Drop Priority. Reorder rule evaluation priority visually.
Fine-Grained Rules. Policies can check tool names, parameter values, and context.
Instant Notifications. Get alerts on mobile, email, Slack, or Mattermost.
One-Tap Approvals. Approve or reject from your phone, watch, or desktop.
Full Audit Trail. Complete log of every AI action and policy decision.
Async Approval Mode. Non-blocking approval: tool returns immediately, agent polls
get_approval_statusuntil the human decides.Per-Tool Justification. Require agents to provide a reason for each tool call. Mode:
required(blocks without it) oroptional(agent may provide one).Flexible Conditions. Use CEL expressions for context-aware rules (Enterprise).
AI Approval (Enterprise). AI-driven approval with configurable model, prompt, confidence threshold, and fallback behavior.
Team Approvals. Require quorum from multiple team members for critical ops (Enterprise).
Integration & Compatibility
MCP Proxy. Works with any Model Context Protocol-compatible AI agent.
Zero Infrastructure Changes. Drop-in solution, no code modifications needed.
Built-in Tools. 11 tools for issue and PR/MR management included.
External MCP Servers. Proxy any external MCP server through Preloop's safety layer.
Issue Tracker Sync. Connect Jira, GitHub, GitLab for full context.
Automation Platform
Agentic Flows. Build event-driven workflows triggered by webhooks, schedules, or tracker events.
Gateway-Routed Model Access. Managed flows can use a Preloop-owned model gateway for centralized cost controls, telemetry, and key custody.
Vector Search. Intelligent similarity search using embeddings.
Duplicate Detection. Automatically identify overlapping issues.
Compliance Metrics. Evaluate and improve issue quality.
Web UI. Modern interface built with Lit, Vite, and Shoelace.
Looking for Enterprise features? Preloop Enterprise Edition adds RBAC, team-based approvals, advanced audit logging, and more. See Enterprise Features below.
Open Source vs Enterprise (important)
Open Source: single-user approvals with email, mobile app, Slack, and Mattermost notifications.
Enterprise: adds advanced conditions (CEL), team-based approvals (quorum), and escalation.
Mobile & Watch apps: the iOS/Watch and Android apps can be used with self-hosted / open-source Preloop deployments.
Supported Issue Trackers
Jira Cloud and Server
GitHub Issues
GitLab Issues
(More to be added in future releases, including Azure DevOps and Linear)
Architecture
Preloop features a modular architecture designed to provide a secure control plane for AI agents, separating the core API server, database models, backend synchronization services, and the web frontend console.
For a complete conceptual overview of the system components, data flows, and infrastructure, please see the Architecture Document.
Frontend & CLI
Preloop Console (Frontend): Located in the
frontenddirectory, the web interface gives you governance controls, tool management, and dashboard visibility. See frontend/README.md for details.Preloop CLI: Manage policies and system state from the command line. See cli/README.md for usage.
Installation
Prerequisites
Python 3.11+
PostgreSQL 14+
PGVector extension for PostgreSQL (for vector search capabilities)
Local Setup
# Clone the repository
git clone https://github.com/preloop/preloop.git
cd preloop
# Create and activate a virtual environment
python -m venv .venv
source .venv/bin/activate # On Windows: .venv\Scripts\activate
# Install dependencies
pip install -e ".[dev]"
# Set up the database
# Configure your environment
cp .env.example .env
# Edit .env with your settingsConfiguration
Environment Variables
Preloop is configured via environment variables. Copy .env.example to .env and customize as needed.
Core Settings
Variable | Default | Description |
|
| PostgreSQL connection string |
| (required) | Secret key for JWT tokens |
|
| Environment (development, production) |
|
| Log level (DEBUG, INFO, WARNING, ERROR) |
|
| Root logger verbosity level |
Model Gateway & Secrets
Variable | Default | Description |
|
| Default gateway URL injected into gateway-enabled runtimes |
|
| Include truncated content previews in emitted model-call events |
|
| Max characters retained when content capture is enabled |
|
| Enable the optional Vault/OpenBao-compatible KV v2 secret backend |
| unset | Base URL for the external secret backend |
| unset | Access token for the external secret backend |
| unset | Optional namespace header for Vault/OpenBao |
|
| KV v2 mount name |
| unset | Optional path prefix applied to external secret references |
Feature Flags
Variable | Default | Description |
|
| Enable self-registration. Set to |
Disabling Self-Registration
For private deployments where you want to control who can access the system:
# In your .env file or Docker environment
REGISTRATION_ENABLED=falseWhen registration is disabled:
The "Sign Up" button is hidden from the UI
The
/registerpage redirects to/loginThe
/api/v1/auth/registerAPI endpoint returns 403 Forbidden - preventing direct API registration attemptsNew users must be invited by an administrator
Security Note: With REGISTRATION_ENABLED=false, the backend API enforces the restriction at the endpoint level. Any attempt to register via the API (including scripts or direct HTTP requests) will be rejected with a 403 status code.
To invite users when registration is disabled, use the admin API or CLI (Enterprise Edition includes a full admin dashboard for user management).
GitHub App (Optional)
For enhanced GitHub integration including PR status checks and bot reactions:
Variable | Default | Description |
| GitHub App ID (from app settings page) | |
| GitHub App slug (the URL-friendly name) | |
| Base64-encoded private key from GitHub App | |
| OAuth client ID for user authentication | |
| OAuth client secret | |
| Secret for verifying webhook payloads |
These are optional and only needed if you're using a GitHub App for authentication or advanced features like reaction management on PRs.
OAuth Sign-In (Enterprise)
Enable OAuth sign-in/sign-up via GitHub, Google, and/or GitLab. Users can authenticate with their existing provider accounts instead of creating a Preloop-specific password.
Variable | Default | Description |
| Google OAuth 2.0 client ID | |
| Google OAuth 2.0 client secret | |
| GitLab OAuth client ID | |
| GitLab OAuth client secret | |
|
| GitLab instance URL (for self-hosted) |
GitHub OAuth sign-in reuses the GitHub App credentials above. Enable via Helm values:
mcpOauth:
enabled: true
googleOauth:
enabled: true
clientId: "your-google-client-id"
clientSecret: "your-google-client-secret"
gitlabOauth:
enabled: true
clientId: "your-gitlab-client-id"
clientSecret: "your-gitlab-client-secret"Supported flows:
GitHub: Sign-in + automatic tracker setup prompt
Google: Sign-in only (no tracker created)
GitLab: Sign-in + automatic tracker setup prompt
MCP OAuth 2.1 Server
Preloop includes a built-in OAuth 2.1 Authorization Server for MCP client authentication (e.g., Claude Desktop). This is enabled automatically when mcpOauth.enabled=true.
Variable | Default | Description |
|
| Public URL of your Preloop instance (used for OAuth discovery endpoints) |
Discovery endpoints:
GET /.well-known/oauth-authorization-server— RFC 8414 metadataGET /.well-known/oauth-protected-resource— RFC 9728 metadata
OAuth endpoints:
POST /oauth/register— Dynamic Client Registration (RFC 7591)GET /oauth/authorize— Authorization endpoint (redirects to consent page)POST /oauth/token— Token exchange (Authorization Code + PKCE for MCP, JWT for CLI)POST /oauth/revoke— Token revocation
Docker Setup
# Clone the repository
git clone https://github.com/preloop/preloop.git
cd preloop
# Run the full development stack (backend + workers + frontend with HMR)
docker compose up
# Run with tagged release images (production)
PRELOOP_VERSION=0.8.0 SECRET_KEY=$(openssl rand -hex 32) \
docker compose -f docker-compose.release.yaml up -dQuick installers are also available:
# Install the standalone CLI
curl -fsSL https://preloop.ai/install/cli | sh
# Install the OSS stack
curl -fsSL https://preloop.ai/install/oss | shSet PRELOOP_VERSION=0.8.0 before either command to pin a specific release, or use https://preloop.ai/install/?version=0.8.0`.
The default docker compose up command uses docker-compose.override.yml for local development, so source changes in backend/ and frontend/ are mounted directly into the containers. The frontend runs via Vite on http://localhost:5173, while the backend API stays on http://localhost:8000.
See docker-compose.release.yaml for full configuration and required environment variables.
Release Management
Use the release script to prepare a new version across the main release surfaces:
./scripts/release.sh 0.8.0The script can also optionally commit the release prep, create and push v<version>, and watch the GitHub Release workflow with gh.
See RELEASING.md for the full checklist and scripts/release.sh for the release prep helper.
Kubernetes Setup
Preloop can be deployed to Kubernetes using the provided Helm chart:
# Add the Spacecode Helm repository (if available)
# helm repo add spacecode https://charts.spacecode.ai
# helm repo update
# Install from the local chart
helm install preloop ./helm/preloop
# Or install the packaged chart from a GitHub release
# helm install preloop https://github.com/preloop/preloop/releases/download/v0.8.0-beta.3/preloop-0.8.0-beta.3.tgz
# Or install with custom values
helm install preloop ./helm/preloop --values custom-values.yamlFor more details about the Helm chart, see the chart README.
Usage
Starting the Server
Set Environment Variables: Ensure you have a
.envfile configured with the necessary environment variables (see.env.example). Key variables include database connection details, API keys, etc.Start Preloop API: Use the provided script to start the main API server:
./start.shThis script typically handles activating the virtual environment and running the server (e.g.,
python -m preloop.server).Start Preloop Sync Service: In a separate terminal, start the synchronization service to begin indexing data from your configured trackers:
# Activate the virtual environment if not already active # source .venv/bin/activate preloop-sync scan allThis command tells Preloop Sync to scan all configured trackers and update the database.
API Documentation
When running, the API documentation is available at:
http://localhost:8000/docsThe OpenAPI specification is also available at:
http://localhost:8000/openapi.jsonUsing the REST API
Preloop provides a RESTful HTTP API:
import requests
import json
# Base URL for the Preloop API
base_url = "http://localhost:8000/api/v1"
# Authenticate and get a token
auth_response = requests.post(
f"{base_url}/auth/token",
json={"username": "your-username", "password": "your-password"}
)
token = auth_response.json()["access_token"]
headers = {"Authorization": f"Bearer {token}"}
# Test a tracker connection
connection = requests.post(
f"{base_url}/projects/test-connection",
headers=headers,
json={
"organization": "spacecode",
"project": "astrobot"
}
)
print(json.dumps(connection.json(), indent=2))
# Search for issues related to authentication
results = requests.get(
f"{base_url}/issues/search",
headers=headers,
params={
"organization": "spacecode",
"project": "astrobot",
"query": "authentication problems",
"limit": 5
}
)
print(json.dumps(results.json(), indent=2))
# Create a new issue
issue = requests.post(
f"{base_url}/issues",
headers=headers,
json={
"organization": "spacecode",
"project": "astrobot",
"title": "Improve login error messages",
"description": "Current error messages are not clear enough...",
"labels": ["enhancement", "authentication"],
"priority": "High"
}
)
print(json.dumps(issue.json(), indent=2))API Endpoints
Preloop provides a comprehensive REST API for authentication, tool management, approval workflows, policy generation, and integrations.
For the complete REST API reference, including interactive Swagger endpoints, please see the official API documentation.
Unified WebSocket
Preloop uses a unified WebSocket connection for real-time updates across the application:
Connection: ws://localhost:8000/api/v1/ws/unified
Message Routing:
Flow execution updates (
flow_executionstopic)Approval request notifications (
approvalstopic)System activity updates (
activitytopic)Session events (
systemtopic)
Features:
Automatic reconnection with exponential backoff
Pub/sub message routing to subscribers
Topic-based filtering for efficient message delivery
Session management with activity tracking
Heartbeat monitoring
Usage in Frontend:
import { unifiedWebSocketManager } from './services/unified-websocket-manager';
// Subscribe to flow execution updates
const unsubscribe = unifiedWebSocketManager.subscribe(
'flow_executions',
(message) => console.log('Flow update:', message),
(message) => message.execution_id === myExecutionId // Optional filter
);
// Clean up when done
unsubscribe();Using MCP Tools via API
The Preloop API includes integrated MCP tool endpoints with dynamic tool filtering, allowing any HTTP-based MCP client to connect directly.
Read the MCP Integration Guide in docs.preloop.ai for details on authenticating clients like Claude Code, Cursor, and Windsurf, and setting up workflows or timeouts.
Mobile Push Notifications (iOS/Android)
Open-source users can enable mobile push notifications by proxying requests through the production Preloop server at https://preloop.ai.
Setup Steps:
Create an account at https://preloop.ai
Generate an API key with
push_proxyscope from the Settings pageConfigure your instance with these environment variables:
# Push notification proxy configuration
PUSH_PROXY_URL=https://preloop.ai/api/v1/push/proxy
PUSH_PROXY_API_KEY=your-api-key-hereEnable push notifications in the Notification Preferences page in your Preloop Console
Register your mobile device by scanning the QR code shown in Notification Preferences
Once configured, approval requests will trigger push notifications on your registered iOS or Android devices.
Note: The mobile apps (iOS/Watch and Android) are designed to work with self-hosted Preloop instances. They connect to your server URL extracted from the QR code.
Version Checking & Updates
By default, Preloop checks for version updates by contacting https://preloop.ai on startup and once daily. This helps you stay informed about new releases and security updates.
Privacy: Only instance UUID, version number, and IP address are sent. No user data is transmitted.
Opt-out: Set PRELOOP_DISABLE_TELEMETRY=true or DISABLE_VERSION_CHECK=true to disable version checking and telemetry entirely.
For detailed architecture, see ARCHITECTURE.md.
Testing
Preloop uses pytest for unit and integration testing. The test suite covers API endpoints, database models, and tracker integrations.
Running Tests
To run all tests:
# Run all tests
pytest
# Run with verbose output
pytest -v
# Run a specific test file
pytest tests/endpoints/test_webhooks.py
# Run a specific test case
pytest tests/endpoints/test_webhooks.py::TestWebhooksEndpoint::test_github_webhook_valid_signatureTest Structure
Unit Tests: Located in
tests/directory, testing individual components in isolationIntegration Tests: Test the interaction between components
Endpoint Tests: Test API endpoints with mocked database sessions
Testing Webhooks
The webhook endpoint tests (tests/endpoints/test_webhooks.py) validate:
Authentication via signatures/tokens for GitHub and GitLab webhooks
Error handling for invalid signatures, missing tokens, etc.
Organization identifier resolution
Database updates (last_webhook_update timestamp)
Error handling for database failures
These tests use mocking to isolate the webhook handling logic from external dependencies.
Roadmap
Preloop is evolving into a comprehensive control plane for AI agents. Here's what's coming:
🔜 Agent Registry — Register, credential, and manage AI agents as first-class entities
🔜 AI Model Gateway — Unified model proxy with cost tracking, rate limits, and usage analytics
🔜 Agent Monitoring — Real-time visibility into agent activity, spending, and health
🔜 Budget Controls — Per-agent spending caps with alerts and enforcement
Star the repo and watch for updates!
Enterprise Features
Preloop Enterprise Edition extends the open-source core with additional features for teams and organizations:
Feature | Open Source | Enterprise |
MCP Server with 11 built-in tools | ✅ | ✅ |
Basic approval workflows | ✅ | ✅ |
Email notifications | ✅ | ✅ |
Mobile app notifications (iOS/Watch; Android) | ✅ | ✅ |
Issue tracker integration | ✅ | ✅ |
Vector search & duplicate detection | ✅ | ✅ |
Agentic flows | ✅ | ✅ |
Web UI | ✅ | ✅ |
Role-Based Access Control (RBAC) | ❌ | ✅ |
Team management | ❌ | ✅ |
CEL conditional approval workflows | ❌ | ✅ |
Access rules with CEL conditions | Basic (single condition) | Advanced (multiple conditions, AND/OR, CEL editor) |
AI-driven approval workflows | ❌ | ✅ |
Team-based approvals with quorum | ❌ | ✅ |
Async approval mode | ✅ | ✅ |
Per-tool justification settings | ✅ | ✅ |
Approval escalation | ❌ | ✅ |
Slack notifications | ✅ | ✅ |
Mattermost notifications | ✅ | ✅ |
Admin dashboard | ❌ | ✅ |
Audit logging & impersonation tracking | ❌ | ✅ |
Billing & subscription management | ❌ | ✅ |
Priority support | ❌ | ✅ |
Contact sales@preloop.ai for Enterprise Edition licensing.
Contributing
Contributions are welcome! Please see our Contributing Guidelines for details on how to get started.
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add some amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
License
Preloop is open source software licensed under the Apache License 2.0.
Copyright (c) 2026 Spacecode AI Inc.
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/preloop/preloop'
If you have feedback or need assistance with the MCP directory API, please join our Discord server