What you will be able to do
- Place a capability as a direct client tool, an MCP server, or a handoff to another agent, based on where the code runs and who else needs it
- Decide between a local stdio MCP server and a remote streamable HTTP MCP server when the task depends on live state or on each user's own identity
- Spot when an agent-to-agent handoff adds latency and token cost, or loses state, so that it does not fit the constraints
Key concept
Connection mechanism — This is the path a capability takes to reach the model. It can be a tool your own process runs, a protocol server that any compatible client can reach, or another agent that does the work and reports back. Each path puts the code, the credentials and the state in a different place, so latency, security and statefulness decide which one fits.
1.Three ways to connect a capability to Claude
When Claude needs to reach a ticketing system, a database or a web page, the integration can take one of three shapes. Which one you pick decides where the code runs, who holds the credentials and what survives between calls. No shape is best in general. Each one wins under a particular mix of latency, security and statefulness constraints.
A direct API tool call is the simplest. You declare a tool in the Messages request. Claude replies with a tool_use block, and your own code does the work. Client tools run in your application: Claude stops with stop_reason: "tool_use", your code runs the operation and sends back a tool_result. Nothing sits between the model and your code except the round trip you already make.
An MCP server puts the capability behind a protocol instead of inside one application. MCP exists because every pairing of an agent with a tool used to need its own custom integration. With MCP, a team builds one server and any MCP-capable client can use it. The server either runs locally as a subprocess or is hosted remotely behind an HTTP endpoint, and that choice matters a great deal for state and for identity.
An agent-to-agent handoff passes a whole subtask to another model instance. That agent has its own context and its own tools, and it sends back a result. The capability is the other agent's reasoning, not a single function call.
| Mechanism | Where the code runs | What crosses the boundary |
|---|---|---|
| Client tool (direct API) | In your application process | A tool_use block out, a tool_result back |
| MCP server | A client-launched subprocess (stdio) or a remote endpoint (streamable HTTP) | JSON-RPC messages between MCP client and server |
| Agent handoff | Another model instance with its own context and tools | A task out, a condensed final message back |
Checkpoint 1 of 9· Match them up
Match each connection mechanism to where its code runs and what crosses the boundary
Tap a term, then the definition that fits it.
Each mechanism puts the code in a different place. A client tool runs in your own process. An MCP server runs as a local subprocess (stdio) or as a remote endpoint (streamable HTTP). A handoff sends the whole task to another agent, and only that agent's final message comes back.
“intermediate tool calls and results stay inside the subagent; only its final message returns to the parent.”Source: code.claude.com
2.When a direct client tool wins: one consumer, low latency, credentials already local
The direct client tool is the default when one application owns the capability. The service declares the tool with an input_schema. When Claude returns tool_use, the service makes the HTTP call with the credentials it already holds and sends the result back as a tool_result block. The secret never leaves the process, and no new component has to be deployed, secured or watched. The general advice is to start with the LLM APIs directly, because many patterns take only a few lines of code.
Each alternative adds cost that this scenario never pays back. An MCP server adds a process and a protocol hop for a tool that will only ever have one client. Its tool definitions also take up context, which raises response time and cost. A subagent adds a whole extra model turn just to run one HTTP request. Giving the model a bash tool and letting it call the endpoint with curl swaps one narrow, declared operation for general code execution. Running agent-generated code needs a secure environment with sandboxing, resource limits and monitoring, which is overhead that direct tool calls avoid.
Checkpoint 2 of 9· Check yourself
A teammate suggests a different setup for the same single-consumer lookup: give Claude a bash tool and let it call the internal endpoint with curl, instead of declaring a narrow client tool. What is the main drawback of the teammate's approach?
A bash tool replaces one narrow, declared operation with general code execution. That code has to run in a secure environment with sandboxing, resource limits and monitoring, which a client tool running inside the service does not need. The other options confuse bash with MCP or a subagent, or reverse the roles of tool_use and tool_result.
“Running agent-generated code requires a secure execution environment with appropriate sandboxing, resource limits, and monitoring.”Source: www.anthropic.com
Checkpoint 3 of 9· Exam question
You are the architect for a Python backend service that calls the Claude Messages API to answer support questions. The service needs exactly one tool: a lookup against an internal REST endpoint your team owns. Only this service will ever use the tool, the call must add as little latency as possible, and the endpoint credentials already sit in the service's own secret store. Which connection mechanism do these constraints favor?
Correct answer: A — Declare the lookup as a client tool in the Messages request, execute the HTTP call in the service process, and send the result back as a tool_result block.
- A. Correct. A client tool is declared in the request and executed by the service's own process, which already has the credentials. The call needs no extra server, no discovery step and no additional model turn. With one tool and one consumer, this is the lowest-latency mechanism.
- B. Incorrect. MCP is worth its cost when several clients share tools or tool discovery needs to be standardized. Here one service uses one tool, so a dedicated MCP server is another component to build and operate. Every lookup also goes through an extra network hop, which works against the latency goal.
- C. Incorrect. A subagent runs its own model loop before it returns anything, which adds model calls and delay to what is a single deterministic REST lookup. Nothing in the scenario calls for a separately owned agent, and the credentials already sit with the service, so the handoff only adds latency.
- D. Incorrect. A shell tool makes the model write the curl and jq commands, then pays for subprocess startup and an extra model turn to read the output. That is slower than a fixed, typed tool call and leaves the request shape to model-generated commands instead of code your team controls.
3.When a remote MCP server wins: many clients, per-user identity, a changing tool set
The constraints flip when several different clients need the same capability. Suppose Claude Code users, a Claude Desktop pilot group and a custom Agent SDK bot all need the ticketing system. If each one gets its own direct integration, every tool change has to be coded three times. MCP is built for this case: write the integration once as a server, and every MCP-capable client gets the same tools. When the tool set changes often, the change ships once.
The remote HTTP transport is also what makes per-user identity possible. The MCP authorization spec applies to HTTP-based transports, and its authorization servers must implement OAuth 2.1. MCP clients find the right authorization server through OAuth 2.0 Protected Resource Metadata. That lets each person authorize as themselves, so ticket operations run under that person's own permissions rather than a shared service account. Stdio servers work differently: they do not use this flow and read their credentials from the environment.
claude mcp add --transport http example https://mcp.example.com/mcpIn Claude Code, the form of the configuration tells you which kind of server you have. A URL such as https://mcp.example.com/mcp points to a remote server. A launch command such as npx -y @example/mcp-server runs the server on your machine. OAuth authentication works with HTTP servers. When a client secret is used, it is stored in the system keychain or a credentials file, not in the config. A remote server still has to protect itself: servers must validate the Origin header to prevent DNS rebinding, and should authenticate every connection.
Two things remote MCP does not give you are easy to assume by mistake. First, MCP does not remove credentials from the picture. OAuth issues tokens to each user, and those tokens have to be handled correctly. That trade-off between per-user and shared credentials is the subject of authentication posture. Second, connecting through MCP does not make a tool's output trustworthy. How to treat tool results as untrusted input belongs to prompt injection controls.
Checkpoint 4 of 9· Check yourself
Claude Code users, a Claude Desktop pilot group and a custom Agent SDK bot all need the same ticketing tools. The tool set changes often, and each ticket operation must run under the permissions of the person who asked for it. Which setup fits these constraints?
With several clients, one MCP server means each tool change ships once. Per-user OAuth is defined for HTTP-based transports, so a remote server lets each person act under their own permissions. A stdio server reads its credentials from the environment and does not use the OAuth flow. Client tools with a shared service account repeat the integration in each app and lose per-user identity.
“Implementations using an STDIO transport SHOULD NOT follow this specification, and instead retrieve credentials from the environment.”Source: modelcontextprotocol.io
Checkpoint 5 of 9· Exam question
Your platform team maintains a ticketing-system integration that Claude Code users, a Claude Desktop pilot group and a custom Agent SDK triage bot all need. Each person must act with their own ticketing permissions, and the tool set will change often. Which two characteristics of a remote MCP server (streamable HTTP with OAuth) make it the mechanism these constraints favor? Choose two.(Select 2)
Correct answers: A, B — One server implementation exposes the same tools to every MCP-capable client, so a tool change ships once instead of being re-coded per application.; The server can authorize each user through OAuth, so ticket operations run under that individual's permissions instead of one shared service account.
- A. Correct. MCP is a shared protocol, so one server serves Claude Code, Claude Desktop and Agent SDK clients, and changes to the tool set are made in a single place.
- B. Correct. Remote MCP servers support OAuth-based authorization, which lets each user's own grant drive the ticketing calls and satisfies the per-person permission requirement.
- C. Incorrect. Something still has to hold credentials and call the ticketing system; the model does not remove that need, and the claim would also contradict the per-user permission constraint.
- D. Incorrect. MCP carries no trust guarantee on tool output; results from servers can contain untrusted content and must still be treated that way, so this is not a benefit of the mechanism.
- E. Incorrect. Embedding the client in every application duplicates the integration code and a shared API key defeats per-user permissions, which are the two constraints the scenario stresses.
4.Statefulness: what survives between calls on each transport
The two MCP transports handle state very differently, and that difference decides any task where each step depends on live state from the step before. Streamable HTTP sends every message as an HTTP POST to a single endpoint. Each reply is either one JSON object or an SSE stream scoped to that request, and the spec has removed protocol-level sessions. Stdio exchanges messages over the standard streams of a subprocess that the client launches, and that one process keeps running and answers every call in the session.
| Transport | How messages travel | Consequence for multi-step state |
|---|---|---|
| stdio | Newline-delimited messages over the standard streams of a client-launched subprocess | The same process answers every call, so in-memory state such as an open page stays available |
| Streamable HTTP | Each message is an HTTP POST to a single MCP endpoint; replies are JSON or a request-scoped SSE stream | No protocol-level session links calls, so state must be rebuilt or stored outside the protocol |
Take a legacy admin portal. The workflow logs in once, moves through a dozen pages and keeps a half-filled form open until the final submit. A local stdio server can launch one browser when it starts and expose one tool per step, with every tool acting on the same open page. Every other option rebuilds the state on each step. A remote server that opens a new headless browser for each call has to reload the form values every time. A separate script per step has to restore cookies and reopen the page. Handing each page to its own subagent passes only a summary forward, because a subagent's intermediate tool calls stay inside it and only its final message returns. A summary of a form is not a live session.
A local stdio server has its own security defaults. It reads credentials from its environment rather than through OAuth. Any local HTTP server should bind to 127.0.0.1 and not to all network interfaces.
Checkpoint 6 of 9· Check yourself
An agent has to log in to a legacy admin portal once, move through a dozen pages, and keep a half-filled form open until the final submit. Which setup keeps that live page available from one tool call to the next?
A stdio server is one subprocess that the client launches, and that same process answers every call, so the open browser and the half-filled form stay in memory. Streamable HTTP has no protocol-level sessions. Subagents pass on only a summary. Per-step scripts rebuild the state every time instead of keeping it.
“stdio: newline-delimited messages over the standard streams of a client-launched subprocess.”Source: modelcontextprotocol.io
Checkpoint 7 of 9· Exam question
A Claude Code workflow must drive a legacy admin portal: log in once, move across a dozen pages and keep a partly filled multi-step form until the final submit. Every step depends on the live session state left by the previous step. Which connection mechanism does the statefulness constraint favor?
Correct answer: A — Run a local stdio MCP server that launches one browser at startup and exposes a tool per step, each tool acting on that same open page.
- A. Correct. A stdio MCP server is a process that lives for the whole Claude Code session, so it can hold one browser instance in memory. Each step-level tool call then works on the page the previous call left, including the half-completed form.
- B. Incorrect. A storage-state file restores cookies and local storage, which covers authentication, but each Bash script launches a new browser and page. Unsubmitted form input and the current position in the flow live in that page and are lost between steps.
- C. Incorrect. A subagent starts with its own context, and a handoff summary only passes text. It does not carry over a live browser page, so each subagent must rebuild the partly filled form from a description rather than continue the existing session.
- D. Incorrect. A remote server that opens a new browser per call has no live page between calls. It can only replay recorded form values, which is reconstruction and not continuation of the session, and it is fragile when the portal keeps hidden state.
5.When an agent-to-agent handoff fits, and what it costs
A handoff is the right mechanism when the capability you need is reasoning in a separate context, not a single function call. Subagents keep context isolated: a research subagent can read dozens of files, and the parent receives only a short summary. Independent subagents run at the same time, so the work finishes in the time of the slowest one rather than the sum of all of them. Each subagent can also be limited to specific tools. For example, a reviewer that has only Read and Grep can analyse files but never change them.
# Get only what's needed, not full history
order_summary = OrderLookupAgent().lookup_order(order_id)
# Inject compact summary, not full context
context = f"Order {order_id}: {order_summary['status']}, purchased {order_summary['date']}"Handoffs are expensive, which is why they lose on latency-bound tasks. Multi-agent implementations typically use 3 to 10 times more tokens than one agent doing the same task. They also often take longer overall, because the total amount of computation goes up. Parallel agents give more thorough coverage, not more speed. Teams that split planning, execution and review into separate agents have found lost context at every handoff and more tokens spent coordinating than doing the work.
How much state a handoff keeps depends on the runtime. In the Agent SDK, a subagent starts a fresh conversation unless it is a fork, and only its final message comes back to the parent. In Claude Managed Agents, a subagent's thread persists, so the coordinating agent can send follow-ups and the subagent retains everything from its earlier turns. All agents in a session share the same sandbox, filesystem and vault credentials. Delegation is one level deep, and a session can have at most 25 child threads at a time. Threads in a dynamic workflow run cannot receive follow-ups and are archived when the run ends. Persistent conversation history is still not the same as a live tool session, so it does not replace a stdio server that holds an open resource.
Checkpoint 8 of 9· Fill the gap
In this handoff, the support agent gets order details from a separate lookup agent. Which word completes the comment about what gets injected into the main agent's context?
# Get only what's needed, not full history
order_summary = OrderLookupAgent().lookup_order(order_id)
# Inject compact ? , not full context
context = f"Order {order_id}: {order_summary['status']}, purchased {order_summary['date']}"The lookup agent does its work in its own context and returns only a short summary of status and date. The main agent's context stays clean. That isolation is why a handoff fits work that would otherwise fill the parent's context.
Source: claude.comCheckpoint 9 of 9· Check yourself
An incident dashboard has a strict response-time budget. An engineer proposes splitting each query across five parallel subagents to answer sooner. Compared with one agent doing the same task, what should the team expect?
Multi-agent setups typically use 3 to 10 times more tokens. They often take longer overall because the total amount of computation goes up. Parallelism buys thoroughness, not speed, so a handoff loses on a latency-bound task.
“The primary benefit of parallelization is thoroughness, not speed.”Source: claude.com
Sources
(10)
Every claim above is drawn from one of these pages, quoted as it was written on the date shown.
- 1.
“Client tools (including user-defined tools and tools with Anthropic-defined schemas, such as bash and text_editor) run in your application.”
↩︎ Three ways to connect a capability to Claude“Your code runs the operation and sends back a tool_result.”
↩︎ When a direct client tool wins: one consumer, low latency, credentials already local“It then returns a structured call that your application runs (client tools) or that Anthropic runs (server tools).”
↩︎ Key concept - 2.https://www.anthropic.com/engineering/code-execution-with-mcpSecondary source
“Connecting agents to tools and data traditionally requires a custom integration for each pairing”
↩︎ Three ways to connect a capability to Claude“Tool descriptions occupy more context window space, increasing response time and costs.”
↩︎ When a direct client tool wins: one consumer, low latency, credentials already local“Running agent-generated code requires a secure execution environment with appropriate sandboxing, resource limits, and monitoring.”
↩︎ When a direct client tool wins: one consumer, low latency, credentials already local“developers implement MCP once in their agent and it unlocks an entire ecosystem of integrations.”
↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set“Tool descriptions occupy more context window space, increasing response time and costs.”
↩︎ Exam trap 1 - 3.
“stdio: newline-delimited messages over the standard streams of a client-launched subprocess.”
↩︎ Three ways to connect a capability to Claude“stdio: newline-delimited messages over the standard streams of a client-launched subprocess.”
↩︎ Statefulness: what survives between calls on each transport - 4.https://www.anthropic.com/engineering/building-effective-agentsSecondary source
“We suggest that developers start by using LLM APIs directly: many patterns can be implemented in a few lines of code.”
↩︎ When a direct client tool wins: one consumer, low latency, credentials already local - 5.
“Implementations using an HTTP-based transport SHOULD conform to this specification.”
↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set“Authorization servers MUST implement OAuth 2.1 with appropriate security measures for both confidential and public clients.”
↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set“MCP clients MUST use OAuth 2.0 Protected Resource Metadata for authorization server discovery.”
↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set“Implementations using an STDIO transport SHOULD NOT follow this specification, and instead retrieve credentials from the environment.”
↩︎ Exam trap 4“Implementations using an STDIO transport SHOULD NOT follow this specification, and instead retrieve credentials from the environment.”
↩︎ Checkpoint - 6.https://code.claude.com/docs/en/mcpOfficial docs
“OAuth authentication works with HTTP servers”
↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set“A launch command such as npx -y @example/mcp-server: the server runs on your machine.”
↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set“The client secret is stored securely in your system keychain (macOS) or a credentials file, not in your config”
↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set - 7.https://modelcontextprotocol.io/specification/2026-07-28/basic/transports/streamable-httpOfficial docs
“Servers MUST validate the Origin header on all incoming connections to prevent DNS rebinding attacks.”
↩︎ When a remote MCP server wins: many clients, per-user identity, a changing tool set“Removal of protocol-level sessions.”
↩︎ Statefulness: what survives between calls on each transport“The client sends every JSON-RPC request or notification as its own HTTP POST.”
↩︎ Statefulness: what survives between calls on each transport“When running locally, servers SHOULD bind only to localhost (127.0.0.1) rather than all network interfaces (0.0.0.0).”
↩︎ Statefulness: what survives between calls on each transport“Removal of protocol-level sessions.”
↩︎ Exam trap 2 - 8.https://code.claude.com/docs/en/agent-sdk/subagentsOfficial docs
“intermediate tool calls and results stay inside the subagent; only its final message returns to the parent.”
↩︎ Statefulness: what survives between calls on each transport“independent subtasks finish in the time of the slowest one rather than the sum of all of them”
↩︎ When an agent-to-agent handoff fits, and what it costs“subagents can be limited to specific tools, reducing the risk of unintended actions.”
↩︎ When an agent-to-agent handoff fits, and what it costs“intermediate tool calls and results stay inside the subagent; only its final message returns to the parent.”
↩︎ Checkpoint - 9.
“multi-agent implementations typically use 3-10x more tokens than single-agent approaches for equivalent tasks.”
↩︎ When an agent-to-agent handoff fits, and what it costs“The primary benefit of parallelization is thoroughness, not speed.”
↩︎ When an agent-to-agent handoff fits, and what it costs“they suffered from lost context at each handoff and spent more tokens coordinating than executing.”
↩︎ When an agent-to-agent handoff fits, and what it costs“multi-agent systems often take longer overall than single-agent systems because of the sheer increase in total computation.”
↩︎ Exam trap 3 - 10.
“that subagent retains everything from its previous turns.”
↩︎ When an agent-to-agent handoff fits, and what it costs“All agents share the same sandbox, filesystem, and vault credentials, but each agent runs in its own session thread”
↩︎ When an agent-to-agent handoff fits, and what it costs“Delegation is one level deep, and a session can have at most 25 child threads at a time, idle ones included.”
↩︎ When an agent-to-agent handoff fits, and what it costs“The agent can’t send follow-up messages to a run’s threads, and the server archives each one by the end of its run.”
↩︎ When an agent-to-agent handoff fits, and what it costs