MCP security wrapper with policy tiers, approvals, backup, and audit.
Project description
ai-runtime-guard
Your agent can say anything. It can only do what policy allows.
AI agents with filesystem and shell access can delete files, leak credentials, or execute destructive commands, often without the user realizing it until it is too late.
ai-runtime-guard is an MCP server that sits between your AI agent and your system, enforcing a policy layer before any file or shell action takes effect. No retraining, no prompt engineering, no changes to your agent or workflow, just install, configure once, and your agent operates within the boundaries you set.
What it does
- Blocks dangerous operations:
rm -rf, sensitive file access, privilege escalation, and more are denied before execution. - Gates risky commands behind human approval (optional): configurable commands require explicit operator sign-off via a web GUI before the agent can proceed.
- Simulates blast radius: wildcard operations like
rm *.tmpare evaluated against real files before running, and blocked if they exceed a safe threshold. - Controls network behavior: configure command-level network policy with monitor-only mode, domain allowlist/denylist, and optional unknown-domain blocking.
- Supports multi-agent policy isolation: apply per-agent policy overrides keyed by
AIRG_AGENT_IDwhile keeping shared runtime controls. - Backs up before it acts: destructive or overwrite operations create automatic backups with full restore support.
- Provides robust logging and reporting: all allowed/blocked actions are logged to
activity.logand indexed intoreports.dbfor dashboard/log views.
Current state
- Policy management is available in the local GUI (commands, paths, extensions, network, advanced policy).
- Agent management is available in the GUI (
Settings -> Agents), including profile-based MCP config generation. - Per-agent policy overrides are supported and enforced by
AIRG_AGENT_ID. - Full runtime visibility is available through
activity.logand reports/dashboard views (reports.db). - Stable release notes are tracked in
CHANGELOG.md, with in-progress work indocs/CHANGELOG_DEV.md.
Who it is for
Developers and power users running AI agents (Claude Desktop, Cursor, Codex, or any MCP-compatible client) who want guardrails on what the agent can actually do to their system.
Known boundary
- AIRG enforces policy only for actions that pass through AIRG MCP tools.
- Native client tools outside MCP (for example Claude Code
Glob,Read,Write,Edit,Bash) are outside AIRG enforcement and can bypass workspace/path restrictions. - For AIRG policy boundaries to be effective, operators must disable native shell/file tools in the client using official configuration methods.
- Treat this as a deployment requirement, not optional hardening.
- For Claude Code, an MCP-only sample skill is provided at
docs/mcp-only.mdand can be saved to<workspace>/.claude/skills/mcp-only.md.
Design scope
- AIRG is designed to reduce accidental damage from AI agent mistakes or hallucinations.
- AIRG is not positioned as a full malicious-actor containment system.
- Core controls:
- block high-risk destructive/exfiltration commands and paths
- enforce workspace boundaries
- gate mass/wildcard actions with simulation and budget limits
- optionally require human approval for selected risky actions
- automatically back up destructive/overwrite targets before applying changes
- log allowed/blocked actions and operator decisions to an audit trail
How it works
- Python MCP server with policy-driven enforcement loaded from
policy.json - Default profile is basic protection: severe actions blocked, everything else allowed
- Advanced controls available for opt-in: simulation gating, human approval workflows, cumulative budget limits, and shell workspace containment modes (
off/monitor/enforce) - Local web GUI for policy editing, approval management, and audit log review
Requirements
Python:
- Required: Python
>=3.10(project package metadata enforces this). - Recommended on macOS: Python
3.12+(Homebrew or python.org install). - macOS system Python
3.9is often too old and may fail dependency install.
How to run
Quick start (package install):
python3 -m venv .venv-airg && source .venv-airg/bin/activatepython -m pip install --upgrade pippython -m pip install ai-runtime-guardairg-setup(guided) orairg-setup --defaults --yes(unattended defaults)airg-doctor
For source-clone setup, TestPyPI flow, and advanced options, see docs/INSTALL.md.
What is optional
- Web GUI is optional, but strongly recommended for policy operations, approvals, agent profile management, and reporting.
- GUI background service (
airg-service) is optional;airg-uican run manually. airg-initis optional and low-level;airg-setupis the recommended onboarding path.
Web GUI (optional)
A local web interface is available for:
- Policy editing and per-agent overrides.
- Approval management.
- Agent profile/config management (
Settings -> Agents). - Reports dashboard and event log.
Prebuilt UI assets are shipped for normal installs, so no frontend build is required unless you are modifying UI source.
Start it with:
airg-ui
Open http://127.0.0.1:5001
For persistent background run:
airg-service install --workspace /absolute/path/to/airg-workspace
airg-service start
See INSTALL.md for advanced setup, service management, and frontend rebuild instructions.
MCP client configuration (example)
Use generated profile config from GUI Settings -> Agents whenever possible.
That view generates client-ready JSON/CLI snippets with your runtime paths, workspace, and agent ID.
If you configure manually, use an absolute server command path (not a bare airg-server unless PATH is guaranteed):
{
"mcpServers": {
"ai-runtime-guard": {
"command": "/absolute/path/to/airg-server",
"args": [],
"env": {
"AIRG_AGENT_ID": "claude-desktop",
"AIRG_WORKSPACE": "/absolute/path/to/agent-workspace",
"AIRG_POLICY_PATH": "/absolute/path/to/policy.json",
"AIRG_APPROVAL_DB_PATH": "/absolute/path/to/approvals.db",
"AIRG_APPROVAL_HMAC_KEY_PATH": "/absolute/path/to/approvals.db.hmac.key",
"AIRG_LOG_PATH": "/absolute/path/to/activity.log",
"AIRG_REPORTS_DB_PATH": "/absolute/path/to/reports.db",
"AIRG_SERVER_COMMAND": "/absolute/path/to/airg-server"
}
}
}
}
Best practice:
- Run
airg-setup, then open GUISettings -> Agentsand copy generated config for your profile. - Keep explicit
AIRG_*paths in client config so launches are deterministic across restarts.
AIRG_WORKSPACE (important)
AIRG_WORKSPACE is the default project root for agent operations.
In unattended defaults mode, AIRG creates/uses ~/airg-workspace unless you set another path.
How it works:
execute_commandstarts fromAIRG_WORKSPACEas its working directory.- File tools (
read_file,write_file,delete_file,list_directory) enforce workspace/path policy relative to this root. - Traversal attempts outside this root are blocked by policy checks.
Workspace model:
- You can use an existing folder as workspace.
- Multiple workspaces are supported.
- You can run multiple agents against the same workspace or separate workspaces per agent profile.
- Each agent profile should set workspace explicitly in generated MCP config.
Deployment model FAQ
- Do I need to run
source scripts/setup_runtime_env.sh?- If you use packaged flow with
airg-setup, no. Setup initializes secure default paths and files. - If you run directly from source (
PYTHONPATH=src python -m server,PYTHONPATH=src python -m ui.backend_flask), yes, it is recommended.
- If you use packaged flow with
- What folders are involved?
- Install folder (
airg-install): where the code/package lives. - Runtime state folder: where
policy.json,approvals.db, HMAC key, logs, reports DB, and backups live. - Workspace folder (
AIRG_WORKSPACE, oftenairg-workspace): where agent actions are intended to run.
- Install folder (
- Does the agent only work inside one workspace?
- By default, yes, it is anchored to
AIRG_WORKSPACE. - Additional allowed roots can be configured with
policy.allowed.paths_whitelist.
- By default, yes, it is anchored to
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ai_runtime_guard-1.5.0.tar.gz.
File metadata
- Download URL: ai_runtime_guard-1.5.0.tar.gz
- Upload date:
- Size: 139.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64111ceff19dc33aad104d2a4f3aebffbeb8fbceef0ea387d73c4af1280cab2c
|
|
| MD5 |
ca53b6ac86787b5229dc5bd7cc1d94a5
|
|
| BLAKE2b-256 |
636fdbe64c7c3df17d80b9b4c05e3f3c6f2f212f3a4ddc4b38e0fcd44fd34e6f
|
Provenance
The following attestation bundles were made for ai_runtime_guard-1.5.0.tar.gz:
Publisher:
publish-pypi.yml on jimmyracheta/ai-runtime-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_runtime_guard-1.5.0.tar.gz -
Subject digest:
64111ceff19dc33aad104d2a4f3aebffbeb8fbceef0ea387d73c4af1280cab2c - Sigstore transparency entry: 1059806630
- Sigstore integration time:
-
Permalink:
jimmyracheta/ai-runtime-guard@2e6d082c6b36c0096d2cb94de7dad81c4ad48b70 -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/jimmyracheta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2e6d082c6b36c0096d2cb94de7dad81c4ad48b70 -
Trigger Event:
push
-
Statement type:
File details
Details for the file ai_runtime_guard-1.5.0-py3-none-any.whl.
File metadata
- Download URL: ai_runtime_guard-1.5.0-py3-none-any.whl
- Upload date:
- Size: 137.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8dae71379bd3efcbf20c04056aa5f2916617ecc9e16ffcba834967abe365a2fd
|
|
| MD5 |
82678685ac79d6162542deba4dfacc84
|
|
| BLAKE2b-256 |
e00de01fb2ec65aa3b7def8724c31e7c6d78cec90836e64b3e5e811cfaf8aa02
|
Provenance
The following attestation bundles were made for ai_runtime_guard-1.5.0-py3-none-any.whl:
Publisher:
publish-pypi.yml on jimmyracheta/ai-runtime-guard
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ai_runtime_guard-1.5.0-py3-none-any.whl -
Subject digest:
8dae71379bd3efcbf20c04056aa5f2916617ecc9e16ffcba834967abe365a2fd - Sigstore transparency entry: 1059806635
- Sigstore integration time:
-
Permalink:
jimmyracheta/ai-runtime-guard@2e6d082c6b36c0096d2cb94de7dad81c4ad48b70 -
Branch / Tag:
refs/tags/v1.5.0 - Owner: https://github.com/jimmyracheta
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@2e6d082c6b36c0096d2cb94de7dad81c4ad48b70 -
Trigger Event:
push
-
Statement type: