The Model Context Protocol (MCP) is a standard for connecting AI agents to tools and data sources. An MCP server exposes capabilities like file access, database queries, API calls, and shell execution. An MCP client (usually an AI agent) connects to the server and calls these tools.
The problem: MCP servers have no built-in authorization. Any connected client can call any tool with any arguments. There is no policy layer, no approval workflow, and no audit trail.
Research has found that 32% of MCP servers have critical vulnerabilities. Common issues include:
These are not theoretical risks. When you connect Claude Desktop, Cursor, or any other MCP client to a filesystem server, that agent can read any file the server has access to. If a prompt injection attack succeeds, the agent will use those tools on behalf of the attacker.
An MCP Gateway is a transparent proxy that sits between the MCP client and the MCP server. Every tool call passes through the gateway, which evaluates it against a policy before forwarding it to the server.
Agent (MCP Client) -> MCP Gateway -> MCP Server -> Real World
The gateway intercepts every tools/call request, wraps it in an authorization envelope, evaluates it against your policy, and either forwards it or blocks it. From the agent's perspective, it is talking to a normal MCP server. From the real MCP server's perspective, it is receiving normal tool calls. The gateway is invisible to both sides.
With Authensor, you configure the gateway in your MCP client config:
{
"mcpServers": {
"authensor-gateway": {
"command": "npx",
"args": [
"@authensor/mcp-server",
"--gateway",
"--upstream", "npx @modelcontextprotocol/server-filesystem /tmp"
]
}
}
}
This wraps the filesystem MCP server with the Authensor gateway. Every file operation now goes through policy evaluation.
Policies define what tools can be called and under what conditions:
version: "1"
default: deny
rules:
- tool: "read_file"
action: allow
constraints:
allowedPaths: ["/tmp/", "/home/user/projects/"]
- tool: "write_file"
action: escalate
reason: "File writes require approval"
- tool: "execute_command"
action: deny
reason: "Shell execution is not permitted"
This policy allows file reads within specific directories, requires human approval for file writes, and blocks shell execution entirely. The default: deny means any tool not explicitly mentioned is blocked.
Authensor's MCP Gateway implements the MCP SEP (Safety Extension Protocol) with three message types:
Every decision is logged with a SHA-256 hash chain, creating a tamper-evident record of all tool usage.
Default deny - Start with everything blocked and explicitly allow what is needed. This is the opposite of most MCP server configurations, which allow everything by default.
Least privilege - Give agents access to only the tools they need for their specific task. A summarization agent does not need shell access.
Constrain arguments - Do not just allow or deny tools. Constrain their arguments. Allow read_file but only for specific directories. Allow http_request but only for specific domains.
Require approval for writes - Any tool that modifies state (writes files, sends emails, makes API calls) should require human approval until you have high confidence in the agent's behavior.
Monitor patterns - Use behavioral monitoring to detect unusual tool usage. A sudden spike in file reads or a tool being called that has never been called before could indicate an attack.
Explore more guides on AI agent safety, prompt injection, and building secure systems.
View All Guides