Module 2 · Integration · Chapter 4 · Free
Design the MCP gateway: one front door for tools, auth and audit
- Atlas is Northgate's MCP gateway: one front door between agents and systems.
- It owns authentication, per-tool permissions, rate limiting against the EHR cap, audit logging and tool versioning.
- Direct connections from every agent to every server multiply credentials, policies and blind spots.
The picture: one staffed front desk in a hospital, instead of every visitor wandering to every ward.
Domain: Integration (21 percent of the exam, the heaviest domain). You should be able to:
- Explain what an MCP gateway centralises, and what breaks without one.
- Namespace tools by system, so names stay unique and ownership stays clear.
- Apply least privilege per agent: each agent gets only the tools its job needs.
- Price a gateway honestly: added latency and audit volume, with the arithmetic shown.
- In the first sketch, Relay connects directly to three MCP servers. Each keeps its own logs, in its own format, or none.
- The EHR credentials sit in Relay's own config. Rotating them means redeploying the agent.
- Nothing anywhere counts calls against the 600 per minute EHR cap from Chapter 3.
- What breaks when every agent connects to every server directly.
- A tool call's journey through Atlas, check by check.
- The honest costs: latency per call and audit rows per month.
- The lab: write Atlas's config and policy, then judge gateway decisions.
Next: why direct connections fail as the agent count grows.
Step 1: One front door, or a corridor of open doors
Think of a hospital front desk. Visitors check in once, get a badge for the wards they may enter, and the desk keeps the visitor log. Without a desk, every ward checks badges its own way, and nobody holds the full log.
MCP basics live in Foundations: see MCP in Claude Code for servers, tools and .mcp.json. This chapter is the level up: what happens when several agents share several servers in production.
With direct connections, each new agent repeats the same work and the same mistakes:
- Credentials everywhere: every agent holds every server's keys, so one leak or one rotation touches every deployment.
- Policy in many places: who may call
book_appointmentis decided per agent, and the answers drift apart. - No shared counter: each agent sees only its own calls, so nobody can enforce a shared cap like the EHR's 600 per minute.
- Audit in fragments: answering Priya's question means merging logs that were never designed to merge.
- Version chaos: a server ships new tool shapes, and every agent must upgrade on the vendor's schedule, or quietly break.
None of these failures needs a careless team. They are what the shape produces: many agents times many servers means many copies of every control, and copies drift.
Atlas fixes this by being the only path. Agents connect to Atlas; Atlas connects to the servers.
Next: a single tool call, followed through every check.
Step 2: A tool call travels through Atlas
Atlas does five jobs in one place: authentication, per-tool permissions, rate limiting, audit logging and tool versioning. Tools are namespaced by system, so ehr.get_patient_summary and scheduling.lookup_appointment can never collide or be confused.
Least privilege is per agent. Relay gets drafting tools: ehr.get_patient_summary, scheduling.lookup_appointment, relay.draft_reply, scheduling.book_appointment, desk.escalate_to_clinician. Chartwise gets documentation tools instead, and no booking tool at all.
Press Next to follow one call from the portal to the EHR.
- Relay decides it needs the patient summary and calls ehr.get_patient_summary through Atlas.
- Atlas verifies Relay's identity. The EHR credentials live in Atlas, never in the agent.
- Atlas checks Relay's allowlist. get_patient_summary is on it. A booking call from Chartwise would stop here.
- Atlas counts all EHR calls this minute against 600. Under the cap, the call goes through.
- Every call, allowed or denied, writes one audit row: agent, tool, time, decision.
Where the picture breaks down:
- Atlas is also a single point of failure. If it stops, every agent stops. That tradeoff is priced in Step 3 and Chapter 6.
- The audit row records the call, not the reasoning. Priya still needs Relay's own draft record beside it.
Next: the honest arithmetic, latency and audit volume.
Step 3: Worked example, what the front door costs
Worked example. Atlas is not free. Price it before Priya does. All figures in this box are made up, except the pilot volume and the budget.
Latency: assume Atlas adds 40 ms per call (made up). Relay makes 4 calls per draft: 4 × 40 = 160 ms added per message.
Against the 3 second end-to-end budget (made up target): 160 ÷ 3,000 = about 5 percent. The checks buy cap enforcement and a full audit trail for 5 percent of the budget.
Audit volume at pilot: 18,000 messages a month × 4 calls = 72,000 audit rows a month.
At full volume: 260,000 × 4 = 1,040,000 rows a month. At a made-up 1 KB per row, that is about 1 GB a month to store and keep searchable.
Versioning rides along: when the EHR server ships tool version 2, Atlas can route Relay to version 1 until its prompts are retested, instead of every agent upgrading at once.
Her cold-open question was about a draft that was produced, which means allowed calls. An audit log of denials only cannot answer it. Storage is priced in the worked example instead: about 1 GB a month at full volume.
Denials are data too. A spike in denied calls usually means a prompt changed, a tool was renamed, or an agent is asking for something its job never needed. Because Atlas writes denied calls to the same log as allowed ones, Ruth can spot that pattern in one query instead of hearing about it in an incident review.
Next: allowlists, and the call that must never pass.
Step 4: Least privilege, written as lists
An allowlist is a short, reviewable sentence: this agent, these tools, nothing else. Anything not listed is denied by default.
- Relay: summary, appointment lookup, drafting, booking, escalation. It drafts and books, but a human still sends every message: that rule stays in code, not in a prompt.
- Chartwise: transcript and documentation tools for visit notes. No booking, no escalation, no portal tools.
- A new agent starts with an empty list and earns tools one review at a time.
Namespacing makes the lists readable in review: ehr., scheduling., desk. and relay. prefixes say who owns each tool and which cap applies.
Version pins sit in the same policy. When a server ships a new tool version, Atlas keeps each agent on its pinned version until that agent's prompts have been retested against the new shapes. The pin is one line in one file, reviewed like any other policy change, and Elena's steering group can see exactly which agent runs which version at any moment. If a policy needs a paragraph of explanation per agent, the lists themselves are probably doing too much.
Next: the lab, where you write the gateway design note.
Hands-on lab: the MCP gateway design note
Part A: build it locally
Lab: Atlas is Northgate's MCP gateway: the one front door between agents and the EHR, scheduling and desk systems. This lab runs in your browser and needs JavaScript enabled.
What to notice: every path writes an audit row, and only one path is a plain allow. Deny, throttle and escalate are designed outcomes, not errors.
Next: mix-ups and the quiz.
Mix-ups to avoid
- "A gateway is just a proxy." No. A proxy forwards. Atlas decides: auth, permission, rate and audit on every call.
- "Permissions in the prompt are enough." No. A prompt is a request. The allowlist in Atlas is the enforcement.
- "Audit only the failures." No. Reviews ask about calls that succeeded and produced output.
- "Give every agent every tool, it is simpler." No. Simpler to configure, harder to defend, and the blast radius is the whole surface.
- "The gateway adds latency, so skip it." No. Priced honestly, 160 ms per message buys cap enforcement and one audit trail.
Chapter quiz
Five questions in the exam's style. Score 70% or more to finish.
Review this chapter in 5 minutes
Watch the whole chapter recapped: why direct connections break, Atlas's five jobs, least-privilege allowlists, and pricing the latency and audit costs.
- Atlas's five jobs: authentication, per-tool permissions, rate limiting, audit logging, tool versioning.
- Direct connections break: credentials multiply, policies drift, nobody holds the shared cap count, audit fragments.
- Least privilege: Relay gets drafting and booking tools; Chartwise gets documentation tools only. Default is deny.
- Costs, made up: 40 ms per call, 160 ms per message, about 5 percent of a 3 second budget. Audit: 72,000 rows a month at pilot, 1,040,000 at full volume.
Decision rule: if a control must hold across every agent, it lives in the gateway, not in each agent. One front door, one counter, one log.
Independent exam preparation. Not affiliated with or endorsed by Anthropic.
Review
Glossary
- MCP gateway
- A single service between agents and MCP servers that enforces policy on every call. Example: Atlas at Northgate.
- Namespacing
- Prefixing tool names with their owning system. Example: ehr.get_patient_summary versus scheduling.lookup_appointment.
- Allowlist
- The explicit list of tools an agent may call; anything else is denied. Example: Chartwise's two documentation tools.
- Least privilege
- Giving each agent only the tools its job needs. Example: no booking tool for a documentation assistant.
- Audit log
- One record per call: agent, tool, time, decision. Example: 72,000 rows a month at pilot volume.
- Throttle
- Slowing or queueing calls to respect a cap. Example: deferring a routine summary read to the next minute.
- Tool versioning
- Running more than one version of a tool and routing agents deliberately. Example: Relay pinned to EHR tools v1.
Next: "Connect legacy systems: wrap, sync or stream, and what each choice costs".