AgentHub

AI Agent Tool Access Control: Beyond Allow-All or Block-All

·6 min read

When teams first expose MCP servers to AI agents, they tend to pick one of two extremes: allow everything (because productivity) or block everything (because security). Both are wrong — and both fail in production.

The Allow-All Trap

Allow-all is the default because it is the path of least resistance. You connect a server, all its tools are available, and the agent has maximum capability. This works great until it does not:

  • An agent running a database migration tool accidentally DROPs a column on production
  • A prompt injection tricks the agent into calling a destructive filesystem tool
  • A compromised API key gives an attacker access to every MCP server in the workspace

The problem is not the agent. It is that the tool had no guardrail. An agent with unrestricted tool access is like giving a junior engineer root on every server — most of the time it is fine, and then it is not.

The Block-All Trap

Block-all is the reaction to allow-all. You deny every tool by default and grant access on a case-by-case basis. This is safer, but it creates operational friction:

  • Every new tool requires a policy change, slowing down development
  • Agents fail silently when a tool is blocked, producing confusing output
  • Teams bypass the system by running MCP servers locally instead of through the gateway
  • The approval queue becomes a bottleneck — every tool call requires human sign-off

Block-all treats all tools as equally dangerous, which they are not. A tool that reads weather data and a tool that runs arbitrary SQL should not have the same default.

A Practical Framework: Four Access Levels

A better approach assigns each tool one of four access levels, reflecting its actual risk:

Level 1: Allow

Tools that are read-only by nature and operate on non-sensitive data. Examples: a tool that searches documentation, a tool that lists available API endpoints, a tool that retrieves public reference data. These tools need no oversight.

Level 2: Readonly (Auto-Detect)

Tools that are mostly read-only but could accept write arguments. The gateway inspects each call: if the arguments contain write keywords (INSERT, UPDATE, DROP, DELETE, PUT, POST, PATCH), the call is blocked. Everything else passes through. This is the right default for database query tools and file readers.

Level 3: Require Approval

Tools that perform irreversible or high-cost operations. Examples: deploying code, modifying IAM roles, dropping database tables, sending mass emails, executing shell commands. These operations queue for human approval via Slack. If no one responds within the timeout, the request is automatically rejected.

Level 4: Block

Tools that should never be called by an AI agent. Examples: a tool that resets all user passwords, a tool that deletes infrastructure, a tool that bypasses audit logging. These are denied with a clear error message returned to the agent.

Why This Works in Practice

The four-level model works because it maps to how teams actually think about risk. Read operations are low risk. Write operations are medium risk. Destructive operations are high risk. By encoding this in the gateway, you get:

  • No friction for low-risk operations. Read queries flow through without any human delay.
  • Automatic protection for medium-risk operations. The readonly level catches mistakes without requiring humans in the loop.
  • Controlled gates for high-risk operations. Destructive tool calls get the human oversight they deserve, but the default is not block-everything.
  • Clear error feedback. When a tool is blocked or requires approval, the agent receives a structured error it can surface to the user.

Getting Started

A practical migration path:

  1. Start with all tools set to readonly — this is safe for most servers out of the box
  2. Promote obviously-safe tools to allow (read-only data fetches, list operations, etc.)
  3. Demote destructive tools to require-approval (deploy, write, delete, etc.)
  4. Block tools that should never be called by agents
  5. Review the policy once a week as new tools are added

In AgentHub, this is configured per workspace through a simple UI or API. Each MCP server has its own set of tool policies, and you can override policies for specific tools within a server. Changes take effect immediately — no server restart required.