NEW! Data443 Acquires Vaikora – Real-Time AI Runtime Control & Enforcement for AI Agent

Home | Blog | A Minimal MCP Server That Blocks Tool Calls: How the Policy Gate Works Before Execution

A Minimal MCP Server That Blocks Tool Calls: How the Policy Gate Works Before Execution

Twelve lines of Python are enough to add a policy check between an AI agent and the tools it calls. That is the practical starting point for vaikora-guard-mcp, an open-source MCP-compatible proxy that enforces an allow, block, modify, or require-approval decision on every tool call before it runs.

The package is MIT-licensed, written in Python, and published on PyPI as `vaikora-guard-mcp`. You self-host it. Nothing phones home.

Why a Separate Server for This

Most MCP implementations trust the tool call once the model produces it. The agent asks to write a file, query a database, or call an external API. The MCP host runs it. Policy checks, if they exist at all, happen in application code written by whoever built the agent, which means they vary by team, get skipped under deadline pressure, and leave no auditable record.

A dedicated policy server breaks that pattern. The gate sits inline. Every call passes through it. Identical input always produces an identical decision because the enforcement logic is deterministic, not conditional on how a particular developer wrote their agent.

That matters operationally. If a tool call to a secrets manager is blocked, the block exists in the audit log regardless of which agent triggered it or which developer wrote that agent.

What the Server Actually Does

When an MCP-compatible agent issues a tool call, `vaikora-guard-mcp` intercepts it before the underlying tool executes. It runs the call parameters through the configured policy rules and returns one of four verdicts:

  • allow: the call proceeds unchanged
  • block: the call is rejected and the agent receives an error response
  • modify: the call parameters are rewritten before forwarding (for example, stripping a sensitive field)
  • require-approval: the call is held until a human approves or denies it

The server writes every decision to a SHA-256 hash-chained, tamper-evident audit log. That chain means you can verify after the fact that no decisions were deleted or altered, which is what regulators and auditors actually need from an AI governance record.

A Concrete Scenario

Suppose an agent has access to a file-write tool and a customer database query tool. Without a policy gate, the agent can write to any path the hosting process can reach and query any table it has credentials for. If the agent is compromised through a prompt injection attack, the attacker inherits those permissions in full.

With `vaikora-guard-mcp` in front:

  • A policy rule can block any file-write call targeting paths outside `/tmp/agent-workspace/`
  • A rule can require human approval for any query that includes a column name matching a PII pattern
  • A rule can modify calls that include raw API keys in parameters, replacing them before the call forwards

The agent never knows the difference for allowed calls. For blocked or modified calls, the decision is logged before the tool ever runs.

Installing and Running It

“`bash
pip install vaikora-guard-mcp
“`

From there, you configure policy rules in a local YAML file and point your MCP-compatible agent at the proxy endpoint instead of directly at its tools. No SDK migration is required. The proxy supports the major hosted model APIs and ships MCP support by default.

The open-source component is the enforcement gateway. The Vaikora Control Plane, the commercial product hosted by Data443, adds a management interface, compliance presets for HIPAA, PCI-DSS, GDPR, SOC 2, and ISO 27001, and integrations with Microsoft Sentinel, CrowdStrike Falcon, SentinelOne, and AWS Security Hub. But the gateway itself runs independently.

What Open Source Actually Gives You Here

Publishing the enforcement logic under MIT means you can read every line of code that makes a policy decision. You can confirm that the verdict logic is what the documentation says it is. You can extend it, fork it, or integrate it into an internal platform without a commercial agreement.

For security teams evaluating whether to put a policy gate in a production AI pipeline, that auditability of the tool itself is not a minor point. You are trusting this component to block calls. Knowing exactly how it works is part of the trust calculus.

What to Check Next

If you are running MCP-compatible agents in any environment where tool calls touch sensitive data or external systems, install `vaikora-guard-mcp` from PyPI and trace one real agent session through it. Look at the audit log output for that session. Check whether the logged decisions match what you expected the policy to produce. That exercise will show you faster than any documentation where your policy gaps are.

The source is on PyPI. Start with a single tool, one policy rule, and one session. Expand from there once you can see what the log actually captures.