Skip to content
Back to Studio
FeaturedStudio project

AgentGuard — MCP Permission Gateway

Nov 9, 2026 · Updated 1 week ago

AgentGuard_ Secure AI Agent Workflow.png

AgentGuard is an open-source, local-first permission gateway for Model Context Protocol (MCP) tools. It helps developers control AI agent tool execution through deterministic YAML policies, human-in-the-loop approvals, and local metadata-only audit logging. Built and maintained by Belfeki.tn.

Tech Stack

PythonMCP Python SDKPydanticYAMLSQLitePytestRuffGitHub Actions

Overview

AgentGuard is an open-source, local-first permission gateway for Model Context Protocol (MCP) tools. It sits between an MCP client and one trusted stdio server, evaluates every handled tool call against deterministic YAML policy, blocks denied calls, and waits for a one-time local approval when policy requires it. SQLite records metadata-only audit events.

AgentGuard is developed and maintained by Belfeki.tn and released under Apache-2.0. It is an early implementation (v0.1.0a1), not a production security assurance.

Problem

AI agents can call powerful external tools. Developers need predictable, reviewable control over which calls run, which are blocked, and which require a human decision — without relying solely on the model's own judgment. A deterministic local policy boundary with an auditable trail is the gap AgentGuard addresses.

Solution

  • Deny-by-default policy evaluation with exact, case-sensitive server.tool matching.

  • Allow, deny, and human-approval decisions, with conflicts resolved as deny > approve > allow.

  • Single-use approvals bound to the exact tool, arguments, server, and execution context.

  • Local SQLite audit metadata that excludes tool arguments, credentials, results, and raw exception messages.

  • CLI diagnostics (agentguard doctor) and offline policy simulation (agentguard policy test).

Architecture

MCP client → AgentGuard stdio server → guarded tool handler → policy engine
                                           ↕          ↓ allow / consumed approval
                                 approvals + audit   SDK client → trusted upstream

The policy engine is pure and independent of MCP. The operator configures the server ID; client arguments cannot override it, and unmatched tools are denied.

Core features

  • Strict YAML policy schema with default denial and first-rule tie-breaking.

  • Single-upstream stdio adapter built on the official MCP Python SDK.

  • Exact-request approvals with expiration and atomic single use (POSIX/same-UID trust boundary).

  • Metadata-only SQLite audit log (local and unencrypted).

  • Doctor preflight checks and offline policy simulation with JSON output.

Not implemented: dashboard, HTTP gateway, cloud service, multiple-upstream orchestration, sandboxing, argument safety analysis, and a cross-account approval broker.

Technology stack

  • Python 3.11+; CI targets Python 3.11–3.14 on Linux and macOS. Windows proxy/approval support is not implemented.

  • Official MCP Python SDK, Pydantic, PyYAML, Typer, Rich, and AnyIO.

  • SQLite for local audit metadata.

  • pytest, Hypothesis, Ruff, and GitHub Actions for validation.

Security considerations

  • AgentGuard governs only tool calls routed through it. It is not a sandbox.

  • Same-UID processes are trusted by the approval interface.

  • Upstream servers can act during startup and during allowed calls; run them with least-privilege OS access and credentials.

  • Cancellation cannot undo submitted side effects, and an interrupted request may have an unknown outcome. AgentGuard never retries automatically.

  • SQLite audit is local, unencrypted, and not a tamper-proof ledger. Live approval output shows exact arguments to the operator, so terminal scrollback must be protected.

  • Doctor checks local prerequisites without launching the upstream; it does not certify MCP compatibility or safe tool behavior.

Developer's role

Belfeki.tn develops and maintains AgentGuard. The public repository documents the policy engine, MCP stdio proxy, approval workflow, audit logging, CLI, and release process. Individual contribution history is available in the repository's commit history.

Release and repository

  • Source repository — README, quickstart, policy semantics, proxy architecture, approval workflow, audit logging, and security limits.

  • GitHub release v0.1.0a1 — a source release; no public PyPI release is assumed. This is not a hosted or deployed application.

Status

Early implementation. Only calls routed through AgentGuard are governed, and the project is not a production security assurance. See the repository's SECURITY.md before routing real tools.

Need something similar?

Tell us what you want to build and we'll map out the next step — scope, timeline, and a transparent quote.