Skip to content
Master’s thesis and engineering research

Secure MCP Governance

Research and engineering into governance middleware for agentic systems that use the Model Context Protocol (MCP).

Role
Researcher and engineer
Sector
Master’s thesis and engineering research
Period
Ongoing

Context and problem

Agents that call tools can cause real side effects, yet most tool calls reach their targets without independent checks.

Agentic systems act through tools. A manipulated or mistaken tool call can reach files, services, or data that the user never intended.

The thesis explores a layer that sits between agent and tool, so that calls can be validated, assessed, and approved before they run.

My role and responsibilities

Designed and built governance middleware that validates, assesses, and gates tool calls, and tested it against prompt injection.

  • Designed the governance middleware architecture.
  • Implemented tool-call validation and risk assessment.
  • Built policy evaluation for allow, deny, and escalate decisions.
  • Added human approval workflows for higher-risk calls.
  • Implemented auditability of every decision.
  • Compared deterministic and LLM-assisted classification.
  • Tested the system against prompt-injection scenarios.

Approach

  • Validate, then assess

    Every tool call is checked for structure first, then scored for risk.

  • Policy decides

    Explicit policies map risk to an outcome, so behaviour is predictable and explainable.

  • Humans for the hard cases

    Calls above a risk threshold wait for human approval instead of running automatically.

Architecture

  1. 01 · Agent

    • LLM agent
    • Tool call
  2. 02 · Governance middleware

    • Validation
    • Risk assessment
    • Policy evaluation
  3. 03 · Decision

    • Allow
    • Block
    • Human approval
  4. 04 · Tools and audit

    • MCP tool
    • Audit log
An agent sends a tool call to the governance middleware. The middleware validates the call, assesses risk, evaluates policy, and either allows it, blocks it, or asks a human to approve it. Allowed calls reach the MCP tool, and every decision is written to an audit log.

Key decisions

  • Deterministic first, LLM-assisted second

    Classification compares deterministic rules with LLM-assisted approaches, since the trade-off between predictability and coverage matters for security controls.

  • Audit every decision

    A complete decision record makes behaviour reviewable after the fact.

Quality, security and reliability

  • Prompt-injection testing against the middleware.
  • Explicit policies that can be reviewed and tested.
  • Auditable records of allow, block, and approval decisions.

Outcome

  • Added stronger validation and governance controls to the tool-call path.
  • Produced a reference architecture for governed agentic systems.

Technologies

  • MCP
  • LLMs
  • Python
  • Policy evaluation
  • Prompt-injection testing

Lessons learned

  • Security controls for agents need to be explicit, testable, and independent of the model.
  • Human approval is a design feature, not a fallback.