Rubric
Contents — domains, guide and mocks

Choosing MCP, API/CLI or agent-to-agent

CCAR-P 3.714 min read · checked 21 September 2026

Task statementEvaluate connection protocols and select the appropriate integration mechanism (MCP, API/CLI, agent-to-agent)

One agent, four kinds of connection

Your Claude agentdecides what to call next
  • Direct API toolyour code wraps one service
  • CLI via shellgh, aws, kubectl
  • MCP serverstandard, reusable tools and data
  • Remote agent (A2A)delegate a task, get artifacts
The first three give the agent a capability it controls step by step. The fourth hands a whole goal to another agent that plans and reasons for itself.

What each mechanism actually is

A direct API tool is a tool definition you write in your own application. Claude asks for it by name, your code calls the service (REST, SQL, a queue) and returns the result. You own the schema, the auth and the error handling. Nothing about it is reusable outside your app unless you make it so.

A CLI integration means the agent has a shell and runs existing command-line tools. The Claude Code best-practices page calls CLI tools the most context-efficient way to reach external services, and recommends telling Claude to use tools like gh, aws, gcloud and sentry-cli. Claude already knows many of them and can learn others from their --help output. The cost is that you now need a shell, which needs permissions and sandboxing.

MCP (Model Context Protocol) is an open standard for exposing tools, data and prompt templates to any AI application that speaks it. You build the server once and every MCP host can use it: Claude Code, Claude Desktop, an IDE, your own agent. A2A (Agent2Agent), now governed by the Linux Foundation, is a standard for one agent to discover another agent and delegate work to it. The A2A docs draw the line cleanly: MCP is for agent-to-tool communication, A2A for agent-to-agent.

Direct API toolCLIMCPA2A
Other end is…A service you callA program on the hostA tool or data serverAn agent that reasons
Interface defined byYou, per appThe CLI’s own flagsThe MCP specThe A2A spec + Agent Card
Reuse across appsLowAny agent with a shellHigh — any MCP hostHigh — any A2A client
Who plans the stepsYour agentYour agentYour agentThe remote agent
Typical unit of workOne callOne commandOne tool callA task with a lifecycle
Main riskDuplicate glue codeShell accessContext bloat, server trustOpaque behaviour, latency

MCP: hosts, clients, servers and the transports

In MCP the host is the AI application. It creates one client per server it connects to, and each client keeps a dedicated connection. Servers offer three features: tools the model can execute, resources that supply context and data, and prompts that act as templates for users. Messages are JSON-RPC 2.0 over one of two standard transports. stdio launches the server as a local subprocess and talks over its standard streams; it usually serves one client. Streamable HTTP sends each message as an HTTP POST to a single endpoint; it is how remote servers serve many clients, and it supports ordinary HTTP authentication, with OAuth recommended.

That transport choice is an architecture decision in itself. A stdio server runs with the user’s own permissions on their own machine: good for a filesystem or a local database, awkward to govern across a company. A remote Streamable HTTP server is deployed once, patched once, sits behind your identity provider and logs every call centrally. For an enterprise integration used by hundreds of people, that usually wins.

When MCP is right, and when it is overhead

MCP earns its place when the same capability is needed by more than one application or team, when a vendor already publishes an MCP server, or when you want the host (Claude Code, Claude Desktop, an IDE) to handle discovery and user consent for you. It is overhead when one application needs one internal call: a direct tool definition is less code, one less process to run, and one less network hop.

Two costs deserve scrutiny. First, context: every connected server’s tool definitions compete for the context window, and Anthropic’s code-execution post describes agents connected to hundreds or thousands of tools paying heavily for definitions up front (3.8 covers the remedy, loading them on demand). Second, trust: the spec asks hosts to treat tool descriptions and annotations as untrusted unless the server is trusted, and to get user consent before invoking tools. A third-party MCP server is code you are choosing to let your agent call.

Reaching a remote MCP server straight from the Messages APIpython
# The MCP connector is a beta feature: check the current header in the docs.
response = client.beta.messages.create(
    model=MODEL,
    max_tokens=2048,
    betas=["mcp-client-2025-11-20"],
    mcp_servers=[{
        "type": "url",                       # remote servers only; no stdio
        "url": "https://mcp.example-crm.com/mcp",
        "name": "crm",
        "authorization_token": crm_token,    # OAuth bearer token you obtained
    }],
    tools=[{
        "type": "mcp_toolset",
        "mcp_server_name": "crm",
        "default_config": {"enabled": False},        # allowlist pattern:
        "configs": {"search_accounts": {"enabled": True},
                    "get_account": {"enabled": True}},  # read-only tools only
    }],
    messages=[{"role": "user", "content": question}],
)

The connector saves you writing an MCP client, but read its limits before choosing it. It supports only the tools part of MCP, not resources or prompts. It can reach only publicly exposed HTTP servers, not local stdio ones. And it is not eligible for zero data retention, because tool definitions and results are retained under the standard policy. In a regulated setting, that last point can decide the design.

CLI and code execution: the context-efficient path

When the agent already has a sandboxed shell, a mature CLI is often better than any wrapper. gh pr list --json number,title --limit 20 returns exactly the fields asked for; the model composes commands, pipes output through jq or grep, and only the filtered result enters context. Anthropic’s code-execution post generalises this to MCP itself: present MCP servers to the agent as code APIs in a filesystem, let the agent write code that calls them, and filter data before it reaches the model. Its worked example drops from about 150,000 tokens to about 2,000. The post is equally clear about the price: you need a secure sandbox with resource limits and monitoring, which direct tool calls avoid.

Which mechanism fits this connection?

What is on the other end, and who needs it?
  • One service, one app
    Direct API toolleast moving parts
  • Mature CLI, sandboxed shell
    CLI via Bashcompact, composable output
  • Many apps or teams reuse it
    MCP serverbuild once, any host
  • Another team’s reasoning agent
    A2A delegationhand off a task

Agent-to-agent: delegating to something that thinks

A2A is for when the thing on the other end is itself an agent: it reasons, plans, keeps state and may need a multi-turn conversation. Its core objects are the Agent Card, a JSON document describing an agent’s identity, endpoint, skills and authentication (published at /.well-known/agent-card.json); the Task, a stateful unit of work with an ID and lifecycle; Messages made of Parts; and Artifacts, the outputs. Clients can poll, stream updates over SSE, or receive push notifications to a webhook, which suits jobs that take minutes or hours. Version 1.0 defines JSON-RPC, gRPC and HTTP+JSON bindings, and adds cryptographic signing of Agent Cards.

The design principle to remember is opacity: agents collaborate without sharing their internal memory, tools or logic. That is the feature and the cost. You cannot see or constrain how the remote agent reaches its answer. You evaluate it by its outputs and its contract, the way you would a subcontractor. Task states such as input-required and auth-required tell you the remote agent can pause and ask for more, so your side must handle that, not just success or failure.

A2A on the outside, MCP on the inside

Buyer’s agent
Supplier agent
Supplier’s MCP tools
Step 1: Buyer’s agent to Supplier agent: Fetch Agent Card, check skills
Step 2: Buyer’s agent to Supplier agent: Send task: quote 400 units
Step 3: Supplier agent to Supplier’s MCP tools: Check stock and lead times
Step 4: Supplier’s MCP tools to Supplier agent: Stock + dates
Step 5: Supplier agent to Buyer’s agent: Status: input required (grade?)
Step 6: Buyer’s agent to Supplier agent: Reply: grade 316 steel
Step 7: Supplier agent to Buyer’s agent: Completed + quote artifact
The A2A docs describe the two as layers: A2A connects agents across organisations, and each agent uses MCP (or plain tools) internally. The buyer never sees the supplier’s tools.

Traps the wrong answers are built from

Tempting but wrongDo this instead
Standardising on MCP for every integration, including one-off internal callsUse a direct tool for a single-app integration; build an MCP server when reuse across apps or hosts is real.
Exposing a stateless function (scoring, lookup, conversion) as an A2A agentKeep it a tool; reserve A2A for delegating goals to agents that plan and keep state.
Building a custom wrapper when a mature CLI and a sandboxed shell already existLet the agent use the CLI and filter output before it reaches context.
Choosing the MCP connector without reading its limitsCheck it supports what you need: tools only, remote HTTP servers only, and not zero-data-retention eligible.
Treating a third-party MCP server’s tool descriptions as trustworthy by defaultVet the server, scope its tools, and require consent or permissions before tool calls.

You should now be able to

  • Describe what sits on the other end of direct API tools, CLIs, MCP servers and A2A agents.
  • Choose between stdio and Streamable HTTP MCP transports for local versus shared, governed deployments.
  • Justify MCP by reuse across applications and hosts, and reject it where a direct tool is simpler.
  • Recognise when a CLI or code execution is the most context-efficient path, and what sandboxing it requires.
  • Identify when a partner system should be reached as an A2A agent, and handle its task lifecycle.
  • Spot where the current MCP specification differs from older, stateful descriptions.

Practice questions

Original questions written for this lesson, in the exam’s style. Answer first, then open the reasoning — every option is explained, including why the wrong ones are tempting.

  1. Question 1

    A bank’s platform team wants one way for five internal AI assistants — built on Claude Code, an IDE extension and two custom agents — to search its internal knowledge base with the user’s own permissions.

    Which integration approach fits best?

    1. AEach assistant team writes its own direct API tool for the search service.
    2. BA remote MCP server over Streamable HTTP, behind the bank’s SSO.
    3. CA local stdio MCP server installed on every employee laptop.
    4. DWrap the search service as an A2A agent with an Agent Card.
    Show answer and reasoning
    1. AIncorrect. It works, but five teams duplicate the same glue, auth handling and fixes. Reuse across hosts is exactly what a shared protocol is for.
    2. BCorrect. Many hosts, one capability: build it once as a remote MCP server, authenticate with OAuth, and govern and log it centrally.
    3. CIncorrect. stdio servers are per-machine processes. Rolling out, patching and auditing them across the bank is much harder than one remote server.
    4. DIncorrect. Search is a structured, stateless function, which makes it a tool. A2A adds a task lifecycle nothing here needs.
  2. Question 2

    A logistics company’s agent must book customs clearance through a broker. The broker runs its own agent that gathers documents, may ask follow-up questions about goods classification, and can take hours to finish. It will not expose its internal systems.

    What is the most appropriate mechanism?

    1. AAsk the broker to publish its internal tools as an MCP server.
    2. BCall the broker’s agent once through a synchronous REST tool and wait.
    3. CScrape the broker’s web portal with a browser-automation tool.
    4. DDelegate a task over A2A and handle its input-required and completed states.
    Show answer and reasoning
    1. AIncorrect. The broker has said it won’t expose internals, and your agent would then have to run a customs process it doesn’t own.
    2. BIncorrect. An hours-long, multi-turn task doesn’t fit a single blocking call; follow-up questions would have nowhere to go.
    3. CIncorrect. This is brittle and bypasses the broker’s intended interface and auth. It is a workaround, not an integration.
    4. DCorrect. The other end is an opaque, stateful agent with a long-running, multi-turn process. That is what A2A tasks, streaming and push notifications are designed for.
  3. Question 3

    A team plans to call a vendor’s remote MCP server using the Claude API’s MCP connector. Which two constraints should they check before committing? (Select 2.)

    1. AOnly MCP tool calls are supported; resources and prompts are not.
    2. BThe server must be reachable over HTTP; local stdio servers cannot be connected.
    3. CThe connector requires every tool to be loaded; there is no allowlist.
    4. DThe connector requires the vendor to publish an Agent Card.
    5. EThe connector works only with Claude Code, not the Messages API.
    Show answer and reasoning
    1. ACorrect. The connector covers tools only. If the design relies on resources or prompts, you need a client-side MCP client instead.
    2. BCorrect. The connector reaches publicly exposed HTTP servers only, so a stdio server would need to be redeployed remotely.
    3. CIncorrect. The mcp_toolset config supports allowlists and denylists per tool.
    4. DIncorrect. Agent Cards belong to A2A, not MCP.
    5. EIncorrect. It is a Messages API feature; Claude Code has its own MCP configuration.
  4. Question 4

    A DevOps agent runs in a sandboxed container with a shell. It needs to list recent failed deployments and read their logs. A colleague proposes building a new MCP server wrapping the deployment platform’s API, which already ships a mature, well-documented CLI.

    What is the strongest recommendation?

    1. ABuild the MCP server; MCP is the standard for connecting agents to tools.
    2. BLet the agent use the existing CLI and filter output before it enters context.
    3. CExpose the deployment platform as an A2A agent so it can plan the investigation.
    4. DPaste the platform’s full API reference into the system prompt instead.
    Show answer and reasoning
    1. AIncorrect. A standard is not a requirement. With a sandboxed shell and a mature CLI already in place, the wrapper adds code to maintain and saves nothing.
    2. BCorrect. Claude Code’s guidance calls CLIs the most context-efficient route to external services. The sandbox is already there, so no new server is needed.
    3. CIncorrect. The platform doesn’t reason; it answers queries. Delegating to it as an agent adds opacity without adding judgement.
    4. DIncorrect. That spends a lot of context on every request and still leaves the agent without a way to call anything.

Sources

Drafted with AI assistance and checked against the sources above; expert review is in progress. Spotted an error? Tell us and it gets fixed, dated and listed on how this is written.