MCP Gateway: How Snap Checks Both the Person and the Agent
Snap's MCP Gateway tackles the complex problem of managing AI agent access and identity within large internal systems. It ensures that when an agent acts on behalf of a human, both identities are correctly propagated and authorized across over a thousand internal tools. This deep dive into their solution, including Agent Attestation Tokens and granular RBAC, appeals to HN's interest in robust, scalable infrastructure for emerging AI workflows.
The Lowdown
Snap's engineering blog details the creation and implementation of their Model Context Protocol (MCP) Gateway, a critical piece of infrastructure designed to manage how AI agents interact with internal tools and services. The core challenge addressed is that traditional internal systems assume a human user, an assumption broken by AI agents, leading to identity and authorization failures. Snap's solution ensures that when an AI agent acts on behalf of a person, both the agent's and the person's identities are correctly authenticated and authorized throughout the call chain.
- The Problem: AI agents, like Snap's Casper, break the traditional assumption that a human user is directly interacting with internal services, leading to issues where the agent's identity overwrites the human's, or permissions are incorrectly applied.
- The Solution: MCP Gateway: Snap developed a central gateway that fronts over 60 MCPs and 1,100+ internal tools, processing millions of calls weekly from both human-agent interactions and automated service accounts.
- Dual Identity Principle: A fundamental rule established is that any call made by an agent on behalf of a person must carry and validate both the person's and the agent's identities.
- Agent Attestation Tokens (AATs): To propagate identity reliably, Snap built an AAT system. These tokens carry the original requester's identity (person or agent) and the calling agent's identity, ensuring downstream services know who initiated the action.
- Granular Authorization: The gateway performs authorization checks against both the person's and the agent's permissions for restricted tools, ensuring an agent cannot access more than its own grants, nor more than the person's access.
- Centralized Credential Management: Instead of building new credential storage, the gateway leverages Snap's existing Auth Translation Service (ATS) for managing third-party OAuth tokens, improving security and reducing friction.
- Security by Design: The system incorporates layers of security, including platform defaults, security team reviews, and service owner approvals for agent tool grants, with read/write classification and flags for destructive operations.
- Distributed Ownership: While a central team provides the gateway platform, individual teams are responsible for building and maintaining their own MCP servers, fostering scalability and alignment.
By creating the MCP Gateway and its supporting identity and authorization mechanisms, Snap has built a robust framework for safely integrating AI agents into its internal developer workflows. This infrastructure not only solves critical security and identity challenges but also paves the way for seamless, scalable AI-driven automation across its engineering organization.