DeepKeep

AI Gateway Security: From Model Routing to Agent and MCP Protection

Ofer Rotberg
•
November 23, 2026

Enterprise AI infrastructure is getting complicated. Organizations are connecting applications to multiple model providers, deploying autonomous agents, integrating external tools, and managing increasingly complex workflows.

Every new connection brings operational challenges: credentials, costs, availability, monitoring, access policies, and security.

AI gateways help organizations manage this complexity through a centralized infrastructure layer. Originally focused on model connectivity, they are evolving to support tools, agents, and broader governance requirements.

As their responsibilities expand, they are also becoming valuable enforcement points for enterprise AI security.

AI Gateways Do Much More Than Model Routing

An AI gateway provides a common interface between applications and AI models, simplifying integration across different providers.

But model routing is only part of its value.

Cost Control and Optimization

Gateways can track token consumption, attribute spending to teams or applications, enforce budgets, and route workloads to more cost-effective models.

For organizations managing numerous AI applications, centralized cost visibility can be as valuable as centralized connectivity.

Reliability, Performance, and Observability

Automatic failover, retries, and load balancing help maintain service availability when providers experience outages or reach capacity limits. Caching and latency-aware routing can also improve response times and reduce unnecessary model calls.

At the same time, centralized logs, usage metrics, and request traces give engineering teams visibility into application performance, while quotas, credential management, and model access policies simplify operational governance.

These capabilities explain why AI gateways are becoming essential enterprise infrastructure.

Platforms such as TrueFoundry, LiteLLM, and Mozilla.ai's Otari illustrate different approaches. TrueFoundry combines model connectivity with enterprise governance and agentic infrastructure. LiteLLM provides a multi-provider proxy with routing, cost tracking, and access controls. Otari offers an open-source, OpenAI-compatible LLM gateway with virtual keys, budgets, usage tracking, and optional MCP tooling.

The implementations differ, but the objective is consistent: make enterprise AI infrastructure easier to operate, monitor, and govern.

From LLM Gateways to MCP and Agent Gateways

Agentic AI is expanding what enterprises need from gateway infrastructure.

Traditional LLM gateways manage requests and responses between applications and models. AI agents introduce additional interactions, connecting to external tools, executing operations, and communicating with other agents.

This creates three increasingly important gateway functions:

  • LLM Gateway: Manages model access, routing, requests, responses, and operational policies.
  • MCP Gateway: Centralizes access to MCP servers and tools, including discovery, authentication, authorization, and tool invocation.
  • Agent Gateway: Manages agent-to-agent communication, including identity, routing, permissions, and interactions using protocols such as Agent2Agent (A2A).

TrueFoundry and LiteLLM support these functions within their broader gateway offerings, although their implementations differ.

The distinction matters because model requests, tool invocations, and agent-to-agent communication introduce different security requirements.

A gateway may support all three traffic types without applying identical security controls to each. Organizations need to understand which interactions are inspected, which policies are enforced, and where those enforcement points operate.

Identity and Authorization: Who Can Access What?

One of the most immediate security benefits of an AI gateway is centralized access management.

Rather than distributing provider credentials across applications, organizations can manage identities, permissions, and usage restrictions through a common infrastructure layer.

For agentic systems, this becomes particularly important.

An agent may be authorized to retrieve customer information from a CRM but not modify account records. Another may have permission to access a GitHub repository without being allowed to delete branches or change production configurations.

MCP gateways can extend authorization to individual tools and operations.

However, there is an important distinction between an authorized action and a safe action.

Authentication establishes who is making a request. Authorization determines what that identity is permitted to access.

Neither necessarily determines whether an otherwise permitted interaction contains malicious instructions.

An agent can have legitimate access to a tool and still be manipulated into misusing it.

AI-Specific Security: Understanding the Interaction

Traditional API security protects against familiar threats such as unauthorized access, abusive traffic, and malformed requests.

AI applications introduce risks that require understanding the content and context of interactions.

A prompt injection can arrive through a retrieved document. A malicious instruction can be embedded in a tool response. An apparently legitimate request can attempt to extract confidential information or redirect an agent away from its intended task.

These threats may pass conventional authentication and authorization checks.

What AI-Specific Security Adds

AI-specific security introduces additional protections:

  • Prompt injection and jailbreak detection: Identifying attempts to manipulate model behavior or override intended instructions.
  • Sensitive-data protection: Detecting and preventing unauthorized disclosure of personal, confidential, or regulated information.
  • Context-aware policy enforcement: Evaluating interactions against application-specific rules and business requirements.
  • Multilingual and multimodal protection: Inspecting threats across languages and content types.
  • Agent and tool-call inspection: Evaluating suspicious instructions and tool interactions within an agent's workflow.

Integrating Security at the Gateway

Modern AI gateways can integrate these capabilities through built-in guardrails, external security providers, and configurable enforcement points.

The gateway provides the connectivity and enforcement infrastructure. Specialized AI security services contribute additional detection and contextual analysis.

This allows organizations to apply consistent protection across supported gateway traffic instead of requiring every application team to implement its own security controls.

MCP Security: When AI Can Take Action

Agentic AI raises the stakes because security failures can trigger actions rather than simply produce inappropriate responses.

Consider an agent connected to a financial system through an MCP server. It is authorized to retrieve invoices and prepare payment recommendations.

An attacker embeds malicious instructions in an invoice, attempting to convince the agent to initiate an unauthorized transaction.

The agent's identity is legitimate. Its access to the financial system may be permitted. Yet the action it is being manipulated into performing is not.

This illustrates why different security controls must work together.

An MCP gateway can authenticate the agent, restrict accessible tools, and enforce permissions. Where supported, integrated AI security services can inspect tool requests for suspicious behavior and analyze returned content for malicious instructions.

Agent-to-agent communication introduces similar challenges. Delegated tasks and exchanged information can carry malicious instructions across trust boundaries, making identity, authorization, and contextual security relevant beyond individual model calls.

Pre-Execution vs. Post-Execution Security

The timing of enforcement matters.

A security check performed before a tool executes may prevent an unauthorized action. A check performed afterward may identify suspicious behavior or prevent malicious content from influencing subsequent decisions, but it cannot reverse an action that has already occurred.

Fail-Open vs. Fail-Closed Enforcement

Availability policies matter too. If a security service becomes unreachable, a fail-open configuration allows traffic to continue, prioritizing availability. A fail-closed configuration blocks affected traffic, prioritizing enforcement.

Organizations should choose deliberately based on the consequences of a missed security check.

Centralized Governance and Visibility

AI gateways can provide a common view of model usage, tool access, policy decisions, and suspicious interactions. Centralized logging and SIEM integrations can help security teams investigate incidents and enforce consistent organizational policies.

For regulated enterprises, these capabilities support auditability and governance. However, compliance and data sovereignty still depend on the broader deployment architecture, data flows, providers, and operational controls.

The Gateway's Security Boundary: What It Cannot See

Centralized enforcement is valuable, but it does not eliminate the rest of the AI attack surface.

Gateway-based security only protects interactions that pass through its relevant enforcement points.

Applications connecting directly to model providers can bypass gateway policies. Agents invoking unmanaged MCP servers may operate outside centralized authorization. Local coding agents can read files, execute shell commands, and interact with tools without routing those actions through an AI gateway.

Extending Protection Beyond the Gateway

Addressing these gaps requires complementary controls, including network restrictions, discovery of unmanaged AI usage, and security mechanisms closer to where agents execute.

For example, DeepKeep's AI Lens provides visibility and usage controls across employee and developer AI environments, including activity that may fall outside centralized gateway traffic.

The objective is not to force every security function into the gateway. It is to establish clear enforcement boundaries and protect the interactions that fall outside them.

Bringing Specialized AI Security into the Gateway

AI gateways and specialized AI security platforms address complementary requirements.

The gateway provides centralized connectivity, access management, routing, observability, and enforcement infrastructure. AI-specific security adds contextual threat detection and protection against attacks that conventional infrastructure controls may not recognize.

DeepKeep and TrueFoundry: AI Security Through Gateway Integration

DeepKeep's partnership with TrueFoundry demonstrates this approach.

Through DeepKeep's integration with the TrueFoundry AI Gateway, organizations can configure DeepKeep's AI Firewall as a custom guardrail for supported gateway traffic.

The integration uses a self-hosted wrapper service that connects TrueFoundry's guardrail interface to DeepKeep's security APIs. DeepKeep evaluates the content submitted for inspection, and TrueFoundry enforces the resulting allow, block, or redact decision. Alert-only policies are also supported.

This enables request-time security enforcement for covered requests and responses without requiring each application to implement its own AI security integration.

Understanding Integration Coverage

The documented integration has a defined scope.

It supports OpenAI Chat Completions requests and completed, non-streaming responses. Input inspection covers the latest user message, while output inspection covers the completed response content. The documented integration does not inspect MCP tool calls, earlier conversation turns, or streaming responses.

Its wrapper also defaults to fail-open when DeepKeep is unreachable. Organizations should review how failure handling is configured to ensure that enforcement behavior matches their security requirements. These are characteristics of the documented TrueFoundry integration, not necessarily limitations of DeepKeep's AI Firewall itself.

DeepKeep's broader AI Firewall capabilities include context-aware runtime protection, multilingual and multimodal analysis, sensitive-data protection, and inspection of agent tool calls. Which capabilities can be enforced through a particular gateway depends on the integration's supported interfaces and traffic coverage.

The principle remains straightforward: specialized AI security should strengthen the gateway's existing capabilities, not duplicate or replace them.

From AI Connectivity to AI Security

AI gateways are becoming essential infrastructure for managing enterprise AI. They simplify model access, control costs, improve reliability, centralize observability, and increasingly govern connections between models, tools, and agents. Their expanding role makes them valuable security enforcement points.

But effective protection requires more than routing traffic through a common endpoint. Organizations need identity and authorization, AI-specific threat detection, appropriate enforcement mechanisms, and visibility into activity beyond the gateway. Controlling which models and tools an AI system can access is important. Controlling what that system is allowed to do with them is where security starts.

‍