Skip to main content
Glama
mcp-approval-server

mcp-approval-server

by byte-haseeb

mcp-approval-server

ci

An MCP tool server where the agent can read whatever it needs, but every change waits for a named person to approve it.

I've built operations copilots that work like this for clients. That code is under NDA, so this is a small version written from scratch to show the pattern. The "system" here is a toy ticket store.

The rule

Tool

Kind

What happens

list_tickets, get_ticket

read

Answers straight away.

close_ticket, assign_ticket

write

Creates a request and changes nothing.

request_status

read

Pending, approved, denied, executed or expired.

execute_request

write

Runs the request only if a person approved it, it hasn't expired, and it hasn't been used.

There is no "approve" tool. The agent can't approve its own request. Approval sits behind your own UI and calls gate.approve(id, "name"), and an approver called "agent" or left blank is refused.

A few more guarantees, all covered by tests:

  • execute_request runs the stored arguments, so the agent can't get "close T-101" approved and then run "close T-102".

  • Requests expire after 15 minutes by default.

  • Each request runs once.

  • Every step (proposed, approved, denied, executed, rejected) goes into an audit log with who did it.

  • Write tools check the ticket exists before creating a request, so people aren't asked to approve something impossible.

  • Input is validated with zod before it reaches a handler.

Related MCP server: agent-mcp-workflow-platform

Demo

npm install
npm run demo

The demo plays the agent through a real MCP client, over an in-memory transport:

> agent calls close_ticket {"id":"T-101","reason":"fixed by raising the gateway timeout"}
  status: pending_approval ...
> agent calls execute_request {...}  [refused]
  request is pending, not approved
[person] sara (on-call) approved: Close T-101 (reason: fixed by raising the gateway timeout)
> agent calls execute_request {...}
  status: executed ...
> agent calls execute_request {...}  [refused]
  request is executed, not approved

followed by the audit log.

Tests

npm test          # vitest: gate rules, plus the full flow over MCP
npm run typecheck

CI runs both, plus the demo, on every push.

Layout

  • src/approval.ts: the approval gate (requests, expiry, argument hashing, audit log)

  • src/tools.ts: tool handlers as plain functions, easy to test

  • src/server.ts: MCP wiring with @modelcontextprotocol/sdk

  • src/tickets.ts: the toy ticket store

  • src/demo.ts: the end-to-end walk-through

License

MIT

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables approval-gated access to Jobber data, with read-only reporting tools and optional allowlisted write tools for records, scheduling, and communications, all requiring confirmation and auditing.
      16
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables database-connected assistants to run reads immediately while holding data-changing and schema-changing calls until a separate supervisor approves them through a hosted page or push notification, after which the exact call executes once.
      277 npm
      MIT