Skip to main content
Glama
approval-gated-mcp

approval-gated-mcp

by qcwebworks

approval-gated-mcp

A small, working MCP server that shows the pattern I use in production AI agents: the model can read freely, but every write becomes a plan that a person approves. Budget caps are checked when a plan is made and again when it's applied. A stale plan is refused rather than applied, undo is itself a plan, and everything lands in an audit log.

There is deliberately no approve tool. Approval happens outside the model, so the model can't approve its own plans. In this repo a person approves with a CLI. In production it's a dashboard.

▶ Watch the 2-minute walkthrough of the production version (MegaMCP)

Why

Letting an LLM change a live system (an ad budget, a CRM record, an email send) is only safe if:

  1. writes can't happen without a human decision,

  2. the decision is made against an exact diff,

  3. the world can't have changed between approval and execution without being noticed,

  4. mistakes can be reversed, and

  5. every step is recorded.

This repo implements those five rules in about 300 lines of TypeScript, against a sandbox ad account.

Related MCP server: mcp-policy-gateway

Try it

npm install
npm test          # 6 tests: approval gate, budget cap, drift refusal, undo, audit, MCP surface
npm run build

Add it to Claude Desktop, Claude Code or any MCP client (stdio):

{
  "mcpServers": {
    "approval-gated": {
      "command": "node",
      "args": ["/path/to/approval-gated-mcp/dist/server.js"],
      "env": { "AGM_DATA_DIR": "/path/to/approval-gated-mcp/data", "AGM_CLIENT_NAME": "claude" }
    }
  }
}

Then ask Claude to "raise the Brand – US budget to $65/day". You get a pending plan back:

Plan 3f2c…: Set budget to $65.00/day
Status: pending

  ~ Budget for "Brand – US": $40.00 → $65.00/day

Waiting for a person to approve: npm run review -- approve 3f2c…

Review and decide as the human:

AGM_DATA_DIR=./data npm run review                  # list pending plans with diffs
AGM_DATA_DIR=./data npm run review -- approve <id>  # apply (re-checks caps and drift)
AGM_DATA_DIR=./data npm run review -- reject <id>

Tools

Tool

Kind

What it does

list_campaigns

read

Campaigns with status, budget, spend and conversions

propose_budget_change

write → plan

New daily budget, blocked above the cap

propose_status_change

write → plan

Pause or enable a campaign

propose_undo

write → plan

Reverse an applied plan (needs approval too)

get_plan / list_plans

read

Diff and status

Server instructions tell the model that account data is untrusted content, never instructions, and that a change isn't live until get_plan says it's applied.

Where this comes from

I'm Austin Drake. I build production AI agents and MCP servers.

  • MegaMCP: a hosted MCP server and dashboard that connects Claude, ChatGPT and Cursor to Google Ads, Meta, Microsoft Ads, GA4, Search Console, Tag Manager, WordPress and HubSpot through 170+ tools. It runs this same pattern at production scale: an OAuth 2.1 authorization server for MCP clients, an AES-256-GCM credential vault, budget "bumpers", drift detection on every executor, undo, and a flight recorder. Walkthrough video.

  • Toolcaise: supervision for AI agents in production, covering cost per run, budget stops, human approval of sensitive tool calls, and incidents when scheduled work goes missing.

The production codebases are private. This repo is an open, minimal reference implementation of the core idea.

MegaMCP architecture

License

MIT

Available Tools

6 tools
get_planB
Read-only

Show a plan's diff and status.

Inputs: plan_id (required).

list_campaignsA
Read-only

List campaigns with status, daily budget, 30-day spend and conversions.

Inputs: no named parameters.

list_plansA
Read-only

List plans, newest first, with their status.

Inputs: no named parameters.

propose_budget_changeA

Propose a new daily budget for a campaign. Returns a pending plan with a diff; a person must approve it.

Inputs: campaign_id (required), daily_budget (required).

propose_status_changeA

Propose pausing or enabling a campaign. Returns a pending plan; a person must approve it.

Inputs: status (required), campaign_id (required).

propose_undoA

Propose reversing an applied plan. The undo is itself a plan that needs approval.

Inputs: plan_id (required).

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A3.8/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct resource or action: listing campaigns vs. plans, proposing budget/status/undo changes, and fetching a single plan. There is no meaningful overlap or confusing boundary between tools.

    Naming Consistency5/5

    All names use snake_case with a small set of predictable verb prefixes (list_, propose_, get_). The pattern is consistent throughout, including propose_budget_change, propose_status_change, and propose_undo.

    Tool Count5/5

    Six tools is well-scoped for an approval-gated campaign change server. Each tool covers a necessary read or propose operation, and none feels redundant or missing at the count level.

    Completeness4/5

    The surface covers listing campaigns, proposing budget/status changes, proposing undos, and inspecting plans. It is strong, but if the server is meant to support broader campaign changes, other proposal types (e.g., creative or targeting) would be needed.

    Maintenance

    ActivitySlowing
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      C
      maintenance
      An MCP server that extends the official Google Ads MCP with safe, confirmed campaign administration across manager accounts, featuring immutable mutation plans, multi-step approvals, and post-write verification.
      8
      Apache 2.0
    • A
      license
      A
      quality
      C
      maintenance
      Enables policy-governed MCP interactions with deterministic authorization, tenant isolation, minimized PII exposure, and human approval gates for sensitive mutations, while producing structured audit events.
      3
      MIT
    • A
      license
      C
      quality
      B
      maintenance
      Enables MCP clients to inspect operational status and channels, lint human-reviewed plans, search and query ledger data, and run queue-based writes with dry-run defaults and safeguards against unverified or unapproved campaigns.
      48
      2
      MIT
    • A
      license
      B
      quality
      B
      maintenance
      Enables MCP clients to read Snapchat Ads campaigns and performance and to prepare preview-first changes for selected ad accounts, with opt-in write tools and explicit confirmation before applying updates.
      21
      131 npm
      Apache 2.0