返回资讯中心
外部精选
软件工程
#开发者实时流

MCP Gateway: How Snap Checks Both the Person and the Agent

MCP Gateway: How Snap Checks Both the Person and the Agent

Hacker News 最新Kaedon2026/11/23 · 今天30 分钟阅读

以下正文同步自 Hacker News 最新,版权归原站所有,已转换为易读排版。

MCP Gateway: How Snap Checks Both the Person and the Agent

This post describes Snap’s MCP Gateway, the shared path through which Snap employees and their AI agents reach internal tools. When an agent acts on behalf of a person, a request to a restricted tool must be allowed for both.

AI agents call tools through Model Context Protocol (MCP) servers. One of the first MCP servers we tested worked fine locally. When we hooked it up to a central MCP gateway, the call failed as forbidden. The receiving service's logs showed why: the caller was the MCP's service account, not the engineer. In another test, an agent on a remote machine opened a PR for an engineer, but the PR looked as though the agent's GitHub app had opened it instead of the engineer. Identity didn't make it all the way through the call chain.

Most internal systems assume a human sits at a browser with valid credentials, using the service's UI. Agents break those assumptions. If you can no longer assume a human is on the other end of an interaction, a lot has to change.

At Snap, we've built out a central MCP Gateway for employees and their agents. It fronts more than 60 MCPs and over 1,100 tools, with more coming online every week. In the week ending October 11, 2026, people and Casper made about 1.6 million tool calls through it. On top of that, automated workloads running as service accounts make several million more calls a week.

We settled on an initial rule. When an agent acts for a person, the call has to pass as both the person and the agent. As we added MCP support, we built only the parts Snap needs to make that work, like identity, credentials and policy.

Through the MCP Gateway, employees use Casper to triage Jira tickets, check A/B experiments, analyze data and summarize documents. This summer, a data platform team created a new MCP, had it live on the gateway within a week, and got Casper access alongside it. Once a new MCP is on the gateway and its owner opts in, Casper can use it on a person's behalf without per-agent integration work. Casper is still limited by both that person’s access and its own tool grants.

In November 2025, we demoed a workflow that took a Jira ticket and opened a GitHub pull request, all without leaving the IDE, in about 7 minutes. It sounds a little quaint now, but people previously did all of those steps by hand. An engineer went into a ticket, copied out context, pasted it into their AI agent window, and cut a PR via the UI or CLI.

The first version was built for people, not agents, and that was on purpose. We didn't have many agents yet, and we wanted MCP to be as convenient as possible for the people using it. Even making it work for people was tricky, because we had to pass the person's identity all the way down.

Initially, we made approved MCPs available via a local proxy, which we called MCP Proxy, that knew how to authenticate to internal Snap services. At the time, most MCPs also had to run as local Docker containers. Logins for OAuth-backed MCPs like Jira and Slack expired about daily.

While this worked well for a small set of MCPs, it got more difficult as we reached 10+. No one wanted to run or manage that many containers for day-to-day work, and onboarding could be difficult for folks who were less comfortable with the command line.

We wanted to move to a hosted model where we could front all the MCPs through a central API, ship updates continually, and get better visibility into and control over what agents could do. We also expected that people would want to run agents in the cloud, and those agents would need a deployed surface.

We considered building our own, adopting an open-source service, finding a vendor, or extracting MCP Proxy into a central service. Of the options, Docker MCP Enterprise Gateway felt closest to what we had in mind. We met with Docker, became design partners, and started figuring out how to integrate the MCP Gateway they were building into Snap's service mesh, the internal network layer that handles identity and routing between our services. Docker built the gateway core.

Calls carry the identity of whoever started them

Once the gateway was deployed, we needed to know who was calling and what they could do. Authentication internally operates on a service-to-service basis. If Service A calls Service B, which calls Service C, C can see that B called it, but C does not know anything about A. Service-to-service auth loses the person who started the call, and it's easy to discover that when something that worked locally now fails as forbidden.

When a person called from their own machine, the gateway knew it was them and could pass that down. An agent adds one more hop, and we had no trusted way to convey it. The caller became one agent identity standing in for everyone using that agent, and that wasn't the person performing the action.

Each agent has its own machine identity, a service account registered as that agent. A registered agent starts with a set of read-only default permissions. Anything more comes from grants. Granting an agent a destructive tool takes approval from both the agent's own team and the tool's owner.

Agents act as themselves unless given permission to act on a person's behalf, as with Casper and a small set of allowlisted agents.

Developer Productivity partnered with Snap Security to build an Agent Attestation Token (AAT) system. An AAT carries the original requester, whether a person or another agent, and the agent making the call. Only a few trusted services, such as Casper, can get a token that names someone else as the requester, and each one checks who the requester is first. For a request that starts in Slack, for example, we verify Slack's signature on the message and look up who sent it before the token is minted. The gateway reads the token, attributes the call to the original requester, and forwards it.

When the MCP Gateway receives a call, it uses our internal authorization service to check access for the caller. If a person is calling through an agent, it checks both for restricted tools. For example, an agent may have permission to call an MCP restricted to one team, but if the person using that agent is not on that team, the call is denied. It works the other way too. An agent can't use everything the person can, only the tools it was granted.

The gateway provides a central place to audit. We record tool calls, authorizations and denials so we can trace what happened.

In the original design, we considered keeping OAuth tokens in the gateway or in our secrets store. Security proposed building per-user OAuth into a pre-existing token management service, the Auth Translation Service (ATS). For servers behind the gateway, third-party credentials live in ATS, owned by Security, instead of in the gateway itself or in the MCP servers.

Keeping tokens in the gateway would also have meant building a separate credential system, with its own OAuth integrations and token rotation. ATS already did that. Users authenticate once, and ATS refreshes credentials on their behalf where the provider allows it.

Write access is earned one tool at a time

How do you safely support read and write operations for agents? It takes layers. The platform should do the right thing by default, Security reviews the most sensitive services, and service owners make the final call on what agents may do with their service.

Early on, the GitHub MCP was read-only for code, issues and pull requests. Our first write-capable MCP was the open-source Jira server. GitHub pull request writes and Slack posting followed.

Reads need care too. Prompt injection isn't fully solved, and text an agent reads from one tool can steer what it does with the next. An agent that could read everything its person can read would be an attractive target. So an agent doesn't simply inherit the person's access. It gets the tools it was granted, the person's own access still caps what it can reach when it acts for that person, and the audit record shows what it did. A tool nobody has classified can't be granted.

Even within an MCP, we may want to segment some tools as more sensitive. If a service exposes a get, a create and a delete API, maybe most people can have the get. Maybe the create needs more control, or the delete shouldn't be exposed at all. We needed role-based access control (RBAC) for each tool. We classify each tool as read or write, flag destructive writes, and decide per MCP how sensitive its data is.

For people, MCP access mostly mirrors what they can already do, because the service behind an MCP still applies its own per-user checks.

For agents, service owners grant permissions through a PR-driven system. If someone wants their agent to call tools X, Y, and Z, they create a pull request (PR), and an approver listed for those tools must approve it. Once it merges, the agent can access the new tools.

For example, when one team's on-call agent needed A/B data for a weekly report, its PR added six read-only tools and nothing else. Since the first agent grant in August 2026, we've granted over 60 agents tools beyond their default permissions.

So why not just give every agent its own API keys? An on-call agent might need logs, metrics, source code and tickets. Setting up a separate relationship with each of those services is a burden most teams won't take on, and the next agent would have to do it again. Through the gateway, the agent's owner asks once in a PR, and each service owner approves their own tools. The agent never gets the keys or secrets those services need.

At first, we tried to build the MCP servers centrally. That did not scale. Beyond the question of ownership (should someone else be exposing a tool for your service?), maintenance and incentives weren't aligned and created a bottleneck.

A central platform team manages service provisioning, service account creation, deploy pipelines and shared libraries. MCP owners are responsible for their tool code and, ultimately, the operation of their MCP. Today, most MCPs belong to the team that runs the corresponding receiving service.

The same tools everywhere. We're making the MCP Gateway the default. A workflow that works on your machine should work the same everywhere.

A person in the loop for riskier operations. On top of today’s grant approvals, some actions might need to pause and ask the human to confirm before they run ("are you sure you want to do that?"). MCP elicitation offers a way to do that, and the latest MCP spec supports it without needing stateful requests.

Checks on combinations of capabilities. If an agent can access two non-sensitive MCPs and wants access to a sensitive one, that combination of permissions may be too risky. Central enforcement could look at the combination, not just each tool.

The call that failed as forbidden was our first sign that internal systems assumed a person on the other end. Most of what we built since then answers two questions on every call: who is asking, and through which agent.

Build identity early. The plumbing that made the gateway work for an individual, like one endpoint, central credentials and identity passed all the way down, is still what an agent needs.

Plan for people outside engineering. If they need MCP, and they probably will, think about their ergonomics early. They may become some of your biggest users.

Carry the agent's identity as well as the person's. You want to know both who was on the other end and which agent they were working with.

Keep user tokens out of the gateway and the MCP servers. If you already have a token service, use it, and keep the friction for users low.

Let owners build their own servers. A central team can't build every one.

Every tool costs context. Agents pay for each tool's description in the model's

正文由 探How 从来源站点 RSS 同步,内容未经改写;遇到排版缺失或需要图片、视频时请以原文为准。

打开原文
去社区讨论 →