---
title: Your company wants to let internal agents use third-party MCP servers through a central gateway. The 2026-07-28 MCP…
url: https://gurkanozkan.ai/learn/questions/recent-b-security-03/
markdown: https://gurkanozkan.ai/learn/questions/recent-b-security-03.md
kind: question
role: Applied LLM
stage: System design
difficulty: Hard
json: https://gurkanozkan.ai/api/learn/questions/recent-b-security-03.json
robots: noindex
---

# Your company wants to let internal agents use third-party MCP servers through a central gateway. The 2026-07-28 MCP specification made the protocol stateless and deprecated dynamic client registration. Design the gateway's security controls and say which threats each addresses.

Applied LLM · System design · Hard

## Answer

*Model answer, written in a candidate's voice*

### In short

- Allowlist and pin approved servers; review and hash tool descriptions, re-approve on any change
- Issue tokens for the gateway's audience only; per-client consent with exact redirect matching
- Treat state handles as server-side, user-bound references, never credentials; validate issuers; trust client ID metadata documents by domain policy
- Egress proxy blocks private ranges and cloud metadata endpoints; sandbox local servers
- Least-privilege scopes with step-up, logging of tool calls and elevation events, per-server kill switches

### In full

The core design is a gateway that treats every third-party MCP server as untrusted until proven otherwise: only allowlisted, pinned servers are reachable, each is reviewed at onboarding, and the gateway hashes tool descriptions so any change triggers re-approval rather than silent drift. Tokens are issued for the gateway's audience only, never passed through to the server, and OAuth uses per-client consent with exact redirect matching so a server cannot ride a user's session or redirect to an attacker-controlled endpoint. Because the protocol is stateless and dynamic client registration is deprecated, any state handle is a server-side reference bound to the authenticated user, never a credential, and the gateway validates issuers and applies domain trust policies to client ID metadata documents rather than trusting self-declared identity. Network controls sit in front of everything: an egress proxy blocks private ranges and cloud metadata endpoints during metadata discovery, and local servers run sandboxed so they cannot reach the host network or other tenants. Finally, scopes are least-privilege with step-up for sensitive tools, tool calls and elevation events are logged, and each server has a kill switch so a compromised or misbehaving server can be disabled without touching the rest of the fleet.

*Checked against sources by an independent AI reviewer.*

## What a strong answer covers

- Threats: tool poisoning via descriptions, servers changing after approval, token passthrough, confused-deputy OAuth, SSRF during metadata discovery, state-handle hijacking, authorisation-server mix-up, malicious local servers
- Controls: allowlisted and pinned servers with review, hashing of tool descriptions and re-approval on change, tokens issued for the gateway's audience only, per-client consent and exact redirect matching
- Stateless specifics: state handles bound server-side to the authenticated user, never treated as credentials; issuer validation; client ID metadata documents with domain trust policies
- Network controls: egress proxy blocking private ranges and cloud metadata endpoints; sandboxed local servers
- Least-privilege scopes with step-up, logging of tool calls and elevation events, and kill switches per server

## Common mistakes

- Treating MCP servers as trusted because they come from a marketplace or were approved once

## Follow-ups

- How does the OWASP Agentic Top 10 change your threat model compared with the LLM Top 10?

## Topic guides

- [Agents and tool use](https://gurkanozkan.ai/learn/topics/agents.md)
- [ML and LLM system design](https://gurkanozkan.ai/learn/topics/system-design.md)
- [Security for LLM applications and agents](https://gurkanozkan.ai/learn/topics/security.md)
---

*Study material compiled with AI: drafted by a local model (Inkling 2 Mini) from public sources, then checked against those sources by independent AI reviewers (Claude) in November 2026. Not reviewed line by line by a person.*
