Home | Blog | vaikora-guard-mcp: An Open-Source Python Package That Enforces Policy Before MCP Tool Calls Run

vaikora-guard-mcp: An Open-Source Python Package That Enforces Policy Before MCP Tool Calls Run

When an AI agent calls a tool through the Model Context Protocol, the tool runs. There is no built-in checkpoint that inspects the call against a policy and decides whether it should be allowed, blocked, modified, or held for approval before execution. vaikora-guard-mcp is a small, MIT-licensed Python package published on PyPI that adds exactly that checkpoint.

This post explains what the package does mechanically, how to run it, and what you get from the audit trail it produces.

What Problem It Solves

MCP gives AI agents a standard way to call external tools: file systems, APIs, databases, code interpreters, anything a server exposes. That standardization is useful for interoperability, but it means an agent can fire off a destructive or policy-violating action the same way it fires off a benign one. The protocol itself carries no policy layer.

A policy check that runs after a tool executes is too late if the tool wrote to a database, deleted a file, or posted to an external endpoint. The check has to run inline, before execution, with enough authority to stop or modify the call.

What vaikora-guard-mcp Does

vaikora-guard-mcp sits as a proxy between the MCP client (the agent) and the MCP server (the tool host). Every tool call passes through it. For each call, the proxy applies a deterministic policy evaluation: the same input always produces the same decision. The decision is one of four outcomes: allow, block, modify, or require-approval.

  • Allow: the call passes through unchanged.
  • Block: the call is stopped; the agent receives a structured rejection rather than the tool’s response.
  • Modify: the proxy rewrites specific parameters before forwarding the call. Useful for stripping sensitive fields or enforcing safe defaults.
  • Require-approval: the call is held until a human or downstream system releases or rejects it.

The proxy writes every decision to a SHA-256 hash-chained audit log. Each entry is signed into the chain, so the log is tamper-evident: you can verify that no entries were deleted or altered after the fact.

Installing and Running It

The package is on PyPI:

“`
pip install vaikora-guard-mcp
“`

It is written in Python and self-hosted. You run it in your own environment; nothing leaves your infrastructure by default. The open-source package is the enforcement proxy. The optional Vaikora Control Plane, hosted by Data443, adds centralized policy management, dashboards, and SIEM integrations, but you do not need it to run the proxy.

A minimal configuration points the proxy at your MCP server and loads a policy file. The policy file defines rules against tool names, parameter values, calling context, or combinations of those. For example, a rule might block any call to a `file_delete` tool where the target path falls outside an approved directory prefix, and log the attempt with full call detail.

A Concrete Scenario

Suppose you have an AI coding agent connected to a tool server that exposes shell execution. The agent is allowed to run test commands but should never call tools that modify deployment configuration files.

Without a proxy, the agent can call any tool the server exposes. With vaikora-guard-mcp, you write a policy rule that matches tool calls where the tool name is `shell_exec` and the command string contains paths under `/etc/deploy/`. The proxy blocks those calls before they reach the shell, logs the attempt with the full parameters and a timestamp, and returns a structured error to the agent. The agent can surface that to its orchestrator or log it, but the command never ran.

The audit log entry for that blocked call is chained to every entry before and after it. If someone later claims the call was never attempted, the log says otherwise and the chain proves the entry was not inserted after the fact.

Compliance Presets

The package ships with presets for SOC 2, HIPAA, GDPR, PCI DSS, and ISO 27001. Each preset is a policy bundle that reflects the data-handling controls relevant to that framework. You can load a preset as a base and layer additional rules on top of it, or write rules entirely from scratch.

What You Get From the Audit Trail

Every enforcement decision in the log is an auditable record of what the agent attempted, what policy applied, and what happened. For security operations teams, that means you can reconstruct exactly what an agent did during an incident window. For compliance purposes, it means you have a continuous, ordered, tamper-evident record of AI agent activity against policy, not a summary report generated after the fact.

Next Steps

The source is on PyPI as `vaikora-guard-mcp`. Start by installing the package, pointing it at a test MCP server, and writing a single block rule. Then check whether the audit log entry for the blocked call contains the fields your investigation workflow needs. The Vaikora documentation covers policy syntax, preset configuration, and how to connect the proxy to the enterprise control plane if you need centralized management across multiple agents.