Skip to main content
Glama

Python 3.10+ License: MIT CI Protocol: MCP

IMPORTANT

Honest boundary: this project evaluates and records intended actions. It does not magically intercept every MCP call. Enforce decisions with the Python wrapper, or make check_action a required step in your tool host.

One useful job, end to end: name a capability such as fs.write_report, get allow, approval_required, or deny, and leave a locally verifiable audit event. No policy daemon, account, or cloud relay is required.

# Quickstart β€” run the three decisions without cloning (requires uv)
uvx --from git+https://github.com/IamOumarIbrahim/governed-agent-mcp-stack governed-agent demo

Expected decisions:

signal.read_file        allow
fs.write_report         approval_required
shell.execute           deny
{
  "mcpServers": {
    "governed-agent-gate": {
      "command": "uvx",
      "args": [
        "--from",
        "git+https://github.com/IamOumarIbrahim/governed-agent-mcp-stack",
        "governed-agent-mcp"
      ]
    }
  }
}

πŸ“– Table of Contents


Related MCP server: sionna-mcp

πŸ’‘ What is Governed Agent MCP Stack?

Agent tools often jump from harmless reads to file writes, shell execution, or CAD mutations with scattered if statementsβ€”or no check at all. This project provides a small gate that can be called from Python, a shell pipeline, or an MCP client before the risky function executes.

Instead of starting with a policy platform, you get:

  • A useful starter policy: read-only and in-memory work is allowed, writes require approval, and destructive or unknown capabilities are denied.

  • One enforcement API: Gatekeeper.enforce() raises before the wrapped function body runs.

  • Evidence you can inspect: every decision is appended to SQLite with a SHA-256 hash chained to the previous event.

The best fit is an MCP server author or agent-platform engineer who needs a reviewable local safety layer today and may graduate to a larger policy system later.


✨ Key Features

  • πŸ”’ Fail closed: unmatched capabilities use default_action: deny.

  • 🧩 Exact and glob rules: express fs.read_file or families such as fs.write_* in plain YAML.

  • 🐍 Real enforcement: use a Python decorator or enforce() before a tool body; denied and approval-required calls raise distinct exceptions.

  • πŸ”Œ Real MCP server: check_action, recent_decisions, and verify_audit_chain run over local stdio with FastMCP.

  • 🧾 Tamper-evident audit: changed or reordered SQLite rows fail chain verification. Context stays local and must be JSON serializable.

  • πŸ€– Automation-friendly CLI: JSON output and stable exit codes let CI, shell scripts, and tool hosts gate actions.

  • πŸ§ͺ Useful examples, labeled honestly: offline DSP helpers and a best-effort process scanner remain as optional workloads, not product claims.


βš™οΈ System Architecture

The gate belongs immediately before the code that can cause a side effect.

flowchart LR
    Agent["Agent or MCP client"] --> Intent["Capability + JSON context"]
    Intent --> Gate["Policy gate"]
    Policy["YAML policy"] --> Gate
    Gate -->|"allow"| Tool["Wrapped tool function"]
    Gate -->|"approval_required"| Review["Your approval workflow"]
    Gate -->|"deny"| Stop["Stop"]
    Gate --> Audit[("Local SQLite hash chain")]

    classDef default fill:#0f172a,stroke:#3b82f6,stroke-width:2px,color:#fff;
    classDef gate fill:#1e1b4b,stroke:#a855f7,stroke-width:2px,color:#fff;
    class Gate gate;
NOTE

Approval is a decision, not an approval system. This repository signals approval_required; your product must collect and validate human approval before retrying the protected action.


πŸš€ Setup & Installation

Option A: Run from GitHub with uv

uvx --from git+https://github.com/IamOumarIbrahim/governed-agent-mcp-stack governed-agent demo

uvx runs the command in an isolated environment. Use this path to evaluate the project without changing your current Python environment.

Option B: Clone for development

git clone https://github.com/IamOumarIbrahim/governed-agent-mcp-stack.git
cd governed-agent-mcp-stack
python -m venv .venv
# Windows: .venv\Scripts\activate
# macOS/Linux: source .venv/bin/activate
python -m pip install -e ".[all,dev]"
governed-agent doctor

Windows users can run .\setup.ps1 to create .venv, install the development extras, run tests, and print the MCP client config. The script does not edit client settings.

πŸ” Verification command:

governed-agent doctor
python -m pytest -q
python -m ruff check .

Expected test summary for this revision: 22 passed.


πŸ”Œ Connecting to AI Clients

The zero-edit config near the top uses the packaged starter policy. For a policy you own:

  1. Create a local policy:

    governed-agent init --output ./my-policy.yaml
  2. Print a config containing the current Python executable and absolute paths:

    governed-agent config --policy ./my-policy.yaml
  3. Merge the printed mcpServers entry into your client's configuration and restart the client.

The server exposes:

MCP tool

What it does

check_action

Evaluates and audits one capability plus optional context

recent_decisions

Returns recent local decisions, newest first

verify_audit_chain

Detects modified or reordered audit rows

FastMCP uses stdio by default for local servers, so the client owns the server process lifecycle and no HTTP port is opened.


πŸ–₯️ How to Use

Gate one action from a shell

governed-agent check fs.write_report \
  --context '{"path":"reports/result.json"}'

The JSON response includes the decision, matched rule, reason, policy source, and audit event hash.

Enforce before a Python function runs

from interlock import Gatekeeper

gate = Gatekeeper(
    policy_path="interlock.policy.yaml",
    audit_path=".interlock/audit.db",
)

@gate.protect(
    "fs.write_report",
    context_factory=lambda path, content: {"path": path, "bytes": len(content)},
)
def write_report(path: str, content: str) -> None:
    with open(path, "w", encoding="utf-8") as report:
        report.write(content)

With the starter policy, write_report() raises ApprovalRequired before opening the file. Unknown capabilities raise ActionDenied.

Write a policy

version: 1
default_action: deny

capabilities:
  "workspace.read_*":
    mode: allow
    reason: Read-only workspace tools are safe for this host.

  "workspace.write_*":
    mode: approval_required
    reason: A human must review workspace mutations.

  "shell.execute":
    mode: deny
    reason: This host never delegates arbitrary shell execution.

Exact rules win over globs. When multiple globs match, the most specific pattern wins.


πŸ“Š CLI Reference

Command

Purpose

Exit behavior

governed-agent demo

Run one allow, approval, and deny example

0

governed-agent check CAPABILITY

Evaluate and optionally audit one action

0 allow, 10 approval, 20 deny

governed-agent doctor

Validate policy and audit-chain integrity

0 healthy

governed-agent audit list

Print recent events as JSON

0

governed-agent audit verify

Verify the event hash chain

0 valid, 1 invalid

governed-agent init

Copy the packaged starter policy

0

governed-agent config

Print MCP client JSON; never edits settings

0

governed-agent serve

Run the stdio MCP server

Until client disconnects

Policy or input errors return 64.


βš–οΈ Comparison

Option

Strong fit

Trade-off

Scattered checks in tool code

One tiny application

Hard to audit and easy to apply inconsistently

This project

Local Python/MCP prototypes that need a working gate now

Single-process, YAML rules, no identity-aware authorization

General policy engines such as OPA or Cedar

Multi-service authorization with a dedicated policy model

More infrastructure and integration work than this starter gate

This project is a stepping stone, not a claim that a small Python library replaces a mature organization-wide authorization system.


πŸ”¬ Scope & Limitations

  • No transparent interception: an MCP client can ignore the gate. Use the Python wrapper or enforce the call order in the host you control.

  • No built-in approval UI: approval_required must feed an approval flow outside this package.

  • Tamper-evident, not tamper-proof: the hash chain detects changed or reordered rows, but an attacker with filesystem access can delete the whole database or truncate its tail. Anchor hashes externally for stronger proof.

  • Local identity only: rules do not model users, organizations, OAuth scopes, or remote multi-tenant authorization.

  • Context is stored: do not pass secrets in decision context.

  • Optional examples are examples: spectramcp/ implements offline numeric helpers; agentpulse/ performs best-effort process-name scanning. Neither is a production hardware adapter or transcript telemetry platform.


πŸ“ File Structure

governed-agent-mcp-stack/
β”œβ”€β”€ interlock/
β”‚   β”œβ”€β”€ gate.py                # Enforcement API and decorator
β”‚   β”œβ”€β”€ policy.py              # Validated exact/glob policy engine
β”‚   β”œβ”€β”€ audit.py               # SQLite SHA-256 event chain
β”‚   β”œβ”€β”€ cli.py                 # JSON CLI, doctor, config, audit commands
β”‚   β”œβ”€β”€ server.py              # Three-tool FastMCP stdio server
β”‚   └── default_policy.yaml    # Packaged fail-closed starter policy
β”œβ”€β”€ spectramcp/                # Optional offline DSP example helpers
β”œβ”€β”€ agentpulse/                # Optional local process-scanner example
β”œβ”€β”€ tests/                     # Unit, CLI, and in-process MCP tests
β”œβ”€β”€ interlock.policy.yaml      # Editable repository policy
β”œβ”€β”€ GATES.md                   # Product and release gate checklist
└── pyproject.toml             # Package metadata and console scripts

🩹 Troubleshooting

Issue

Root Cause

Resolution

uvx is not found

uv is not installed

Use the clone/venv path or install uv from its official documentation

Everything returns deny

No capability rule matched

Run governed-agent check ... and inspect rule; add a narrow YAML rule

Command exits with 10

The rule requires approval

Stop; complete your external approval flow before calling the protected tool

Client cannot start the server

Client environment cannot find the command or policy

Run governed-agent config and use its absolute Python and file paths

Audit verification fails

A stored row changed or was reordered

Preserve the DB for investigation; start a new DB only after review

DSP imports fail

Optional NumPy extra is absent

Install .[dsp] or .[all]


🧩 Contributing

The highest-value contributions are host adapters that make the gate unskippable, approval-flow examples, and adversarial tests for policy or audit edge cases. Start with CONTRIBUTING.md; every pull request must pass the gates in GATES.md.


πŸ“„ License

MIT Β© 2026 Oumar Ibrahim

πŸ™ Powered By

FastMCP Β· PyYAML Β· SQLite Β· NumPy

If this saved you from rebuilding the same policy gateβ€”or one risky agent writeβ€”a ⭐ helps other MCP builders find it.

Available Tools

3 tools
check_actionD

Evaluate and audit an intended tool capability.

ParametersJSON Schema
NameRequiredDescriptionDefault
contextNo
capabilityYes

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

D1.6/5.0
Behavior1/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description must disclose behavioral traits, but it only states that the tool 'evaluates and audits.' It does not mention whether it is read-only, what side effects it may have, what inputs are expected, or what the output schema contains. This is a minimal, non-informative description that fails to convey behavior.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness2/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single short sentence, which is concise in length but under-specified. It does not provide useful detail, so it is not effectively structured to aid an agent. The succinctness is not a virtue here because it omits essential information.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness1/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Despite having an output schema, the description does not explain what the tool returns or how the output should be interpreted. With only 2 parameters, no parameter documentation, and no annotations, the description is far from complete for safe and correct use.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 0% description coverage, and the description does not mention the 'capability' parameter (required) or 'context' parameter at all. The agent receives no explanation of what values to supply for these parameters or what they mean, making correct invocation difficult.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description uses the verbs 'evaluate and audit' with the object 'intended tool capability', which gives a general sense of verifying a capability. However, the phrase is vague and does not clearly define what 'capability' means or how it is audited, making it difficult to distinguish from sibling tools beyond the name.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines1/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives like recent_decisions or verify_audit_chain. The description offers no context, prerequisites, or exclusions, leaving the agent without direction on appropriate scenarios.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

recent_decisionsC

Return recent local policy decisions, newest first.

ParametersJSON Schema
NameRequiredDescriptionDefault
limitNo

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

C2.9/5.0
Behavior2/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations provided, the description carries the full burden of behavioral disclosure, but it only mentions result ordering. It does not explicitly state that the operation is read-only, nor does it describe permissions, side effects, or rate limits.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no unnecessary words. It clearly conveys the core purpose and an important ordering detail.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness2/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The description is sparse and omits key usage details, particularly the 'limit' parameter's effect. Although an output schema exists, the lack of parameter explanation and behavioral context leaves the description incomplete for an agent.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters1/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The schema has one parameter, 'limit', with no description, and the tool description does not mention it. Since schema coverage is 0%, the description fails to compensate by explaining how to control the number of results.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool returns recent local policy decisions with newest first ordering. The verb 'return' and resource 'local policy decisions' are specific, and the ordering distinguishes it from sibling tools like check_action and verify_audit_chain.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides no guidance on when to use this tool versus alternatives. It does not mention any exclusions, prerequisites, or relationships to sibling tools.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

verify_audit_chainA

Check the local audit log for modified or reordered rows.

ParametersJSON Schema
NameRequiredDescriptionDefault

No parameters

Output Schema

ParametersJSON Schema
NameRequiredDescription

No output parameters

TDQS

A3.8/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are present, so the description carries the full burden. It discloses the action ('check') and what it detects, but does not explicitly state whether it is read-only, what it returns, or any side effects. The verb 'check' implies non-mutating behavior, but this is implicit.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is a single, front-loaded sentence with no redundant wording. Every word contributes to understanding the tool's purpose.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a tool with no parameters and an output schema, the description sufficiently conveys the core purpose. It lacks details about detection methodology, but that is likely covered by the output schema.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The tool has zero parameters and the schema is complete, so the baseline 4 applies. There is no need for the description to explain parameters.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool checks the local audit log for modified or reordered rows, providing a specific verb and resource. It distinguishes itself from sibling tools like check_action and recent_decisions by focusing on audit log integrity.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No guidance is provided about when to use this tool versus alternatives. It does not mention prerequisites, exclusions, or alternative tool recommendations.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.

  1. 3 tool updatesv2.0.0
    • First observedcheck_action
    • First observedrecent_decisions
    • First observedverify_audit_chain

TDQS

B3/5.0
Disambiguation5/5

Each tool targets a distinct aspect of the audit workflow: check_action evaluates an intended capability, recent_decisions lists past decisions, and verify_audit_chain checks log integrity. No two tools overlap in purpose, so an agent can easily select the right one.

Naming Consistency4/5

Two tools follow the verb_noun pattern (check_action, verify_audit_chain), but recent_decisions uses an adjective_noun pattern, which is a minor deviation. The names are still descriptive and predictable.

Tool Count5/5

With only 3 tools, the set is well-scoped for a focused audit and policy-decision utility. Each tool serves a clear and necessary function, and the count is within the ideal 3-15 range.

Completeness4/5

The core audit lifecycle is covered: evaluate an action, list decisions, and verify integrity. Minor gaps exist, such as no way to fetch a single decision by ID or perform detailed historical queries, but these are workable limitations.

Maintenance

ActivityMaintained
ResponsivenessSyncing

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables control of Software Defined Radios and decoding of radio protocols through an AI-friendly Model Context Protocol interface, supporting RTL-SDR and HackRF hardware for signal analysis and protocol decoding.
    22
    MIT
  • F
    license
    Not graded
    quality
    B
    maintenance
    Exposes NVIDIA Sionna RT ray-tracing as 15 structured tools for AI agents, enabling wireless channel simulation (scene loading, antenna array setup, ray tracing, CSI extraction) through MCP.
    -
  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables natural language control of a live GNU Radio SDR flowgraph, allowing users to tune frequencies, adjust gain, capture IQ samples, analyze spectra, and detect signals through an MCP-compatible client.
    1
    MIT

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/IamOumarIbrahim/governed-agent-mcp-stack'

If you have feedback or need assistance with the MCP directory API, please join our Discord server