KoreaDevKNOWLEDGE SHARING

Content typeLearn

AI SOFTWARE DEVELOPMENT · 04 / 10

Connecting AI systems with MCP

Splits the problem of connecting each agent in its own way into host, client, and server contracts, and designs tools, resources, prompts, and security.

Difficulty
Practical
Structure
Lessons 8 · Labs 2 · Assessment

CORE UNIT 1 / 1

Connecting AI systems with MCP

Splits the problem of connecting each agent in its own way into host, client, and server contracts, and designs tools, resources, prompts, and security.

Difficulty
Practical
Structure
Lessons 8 · Labs 2 · Assessment

Diagrams and tables: composed by the author using each lesson's official primary sources. Find the originals and review dates at the end of that lesson.

NEW HIRE ONBOARDING

Start in the order you would receive your first assignment

So that even a new hire with no prior IT background can follow along, we start with the situation, the task, the evidence, and when to report, before difficult definitions.

  1. 01

    Read the situation in one sentence

    A single search tool uses the same administrator token to access full document text, HR records, and deletion functionality.

  2. 02

    Today's assignment

    Explain the roles of the MCP host and client server and the boundaries of trust.

  3. 03

    Evidence that shows the work is complete

    Test downstream execution with separate fixtures for injected instructions, denied access, empty results, and missing schema fields.

  4. 04

    When to stop and ask a senior colleague

    It requires versioning for the new protocol layer, server trust, and ecosystem supply-chain management.

Unpack unfamiliar terms first

The integration problem that led to MCP
MCP does not merge every API into one; it standardizes the integration surface between AI applications and context providers.
Host, client, and server trust boundaries
The host owns user experience and policy and manages client connections, while servers provide limited capabilities.
Tools·resources·prompts
A primitive is not a naming convenience for the model but a contract that separates the responsibilities of reading, executing, and providing.

Questions for this course

Why did it change, and what must be verified?

Do not merely memorize a technology's advantages; check the conditions under which they hold and the new failure boundaries they introduce.

OBSERVABLE OUTCOMES

What you can do after this course

  1. Explain the roles of the MCP host and client server and the boundaries of trust.
  2. Distinguish tools, resources, and prompts by side effects and ownership.
  3. Design least-privilege connections with authentication, authorization, user consent, and audit records.

PREREQUISITE CHECK

Three things to check before reading

This is not a test of memorized answers. Think about each question first, then open the explanation to review the foundational concepts used in this course.

1Why is MCP needed when APIs already exist?

Rather than replacing APIs, MCP provides a common protocol and lifecycle for an AI host to discover and invoke server capabilities. The server can continue using existing APIs internally.

2Are authentication and authorization the same?

Authentication verifies who the subject is; authorization determines whether that subject may access a particular resource and perform an action.

3How do tools, resources, and prompts differ?

These are the primitives: a tool is a call that can perform computation or side effects, a resource provides context to read, and a prompt provides a reusable conversation template.

TEXTBOOK GUIDE

Main text that covers each concept from its background to the criteria for judging it

We explain the material section by section so readers new to IT can connect causes and effects without memorizing terms.

CONCEPT FLOW

How the chapters connect

The chapters are not isolated short answers to memorize. Follow them from left to right to see how each chapter's concepts support the next decision.

  1. 1.The integration problem that led to MCP
  2. 2.Host, client, and server trust boundaries
  3. 3.Tools·resources·prompts
  4. 4.Lifecycle · Errors · Retries
  5. 5.Authentication · Authorization · Consent · Audit
  6. 6.Verify capability changes after a successful connection
  7. 7.Do not forward tokens intended for another resource
  8. 8.Distinguish tool-result data from instructions
Connecting AI systems with MCP: the overall map. If you lose track while reading the detailed explanations and chapters below, return to this sequence.
Figure 4-1. Connecting AI systems with MCP: concept developmentShows how each chapter’s choices and limits lead to the problems of the next chapter.
  1. 1
    The integration problem that led to MCP

    MCP does not merge every API into one; it standardizes the integration surface between AI applications and context providers.

  2. 2
    Host, client, and server trust boundaries

    The host owns user experience and policy and manages client connections, while servers provide limited capabilities.

  3. 3
    Tools·resources·prompts

    A primitive is not a naming convenience for the model but a contract that separates the responsibilities of reading, executing, and providing.

  4. 4
    Lifecycle · Errors · Retries

    A successful protocol connection and a successful business action are different states, and errors must state whether a retry is possible.

  5. 5
    Authentication · Authorization · Consent · Audit

    Securing AI connections is not a one-time login; it means restricting token audience and per-action permissions among the user, client, and resource server.

  6. 6
    Verify capability changes after a successful connection

    Check connection health separately from compatibility of the tool contract needed for the task.

  7. 7
    Do not forward tokens intended for another resource

    Even for an authenticated user, separately verify that the presented token is intended for this server.

  8. 8
    Distinguish tool-result data from instructions

    A tool result is an observation for the task, not authority to rewrite system policy.

CONTROLLED EXPLANATION

Two authorization boundaries for inventory lookup

Current state: Receive token

Two authorization boundaries for inventory lookup

A teaching flow that checks tenant and object permissions even after validating the intended recipient.

Check recipientMismatchSeparate matching fixtureDomain checks pass1Receive token2Validate recipient3Reject before execution4Domain authorization5Scoped lookup
  1. Receive token

    Token for resource B

  2. Validate recipient

    Compare with server A

  3. Reject before execution

    Wrong audience

  4. Domain authorization

    Only valid A tokens enter

  5. Scoped lookup

    Preserve tenant and object scope

1 → 2
Check recipient
2 → 3
Mismatch
2 → 4
Separate matching fixture
4 → 5
Domain checks pass

Connection, signature, audience and object permissions are non-interchangeable checks.

CONCRETE CASES

Selection criteria for all courses

TABLE 4-1

Selection criteria for all courses

Compare the technology in each chapter by how it works, the new costs it adds, and the evidence to check, not by its name.

Table 4-1. Connecting AI systems with MCP: design decision criteria
.Core mechanismCosts to watchEvidence to check
1. The integration problem that led to MCPA common client-server protocol makes capability discovery and invocation formats reusable.It requires versioning for the new protocol layer, server trust, and ecosystem supply-chain management.Compare the domain API contract and the MCP exposure contract for the same function side by side.
2. Host, client, and server trust boundariesSession negotiation agrees on supported features and the protocol version, and structured messages are then exchanged.More connections complicate lifecycle management, reconnection, timeouts, and credential scope.Show who owns identity, consent, timeout, and audit at each boundary.
3. Tools·resources·promptsDifferent primitives separate discovery, invocation, and user-control methods.Misclassification lets a seemingly read-only feature create side effects or lets prompts execute implicitly.Classify each capability as read, compute, or state change, and add preview and approval information to state changes.
4. Lifecycle · Errors · RetriesCorrelation IDs and structured errors separate transport failures from domain failures.Retries and reconnects can create hidden duplicate actions or stale session state.Inject a lost response, then recover the result without duplication by querying the same operation ID.
5. Authentication · Authorization · Consent · AuditOAuth-based tokens and per-call policies connect identity to a limited capability.Consent fatigue, token leakage, and excessive scope introduce new risks.Contract-test that tokens for other audiences, expired tokens, and calls without the required scope are rejected.
6. Verify capability changes after a successful connectionCompare discovered capabilities with versioned real request/response contracts.Schema conversion carries semantic-mapping and maintenance costs and cannot be approved on matching names alone.Use fixtures with changed required arguments and missing required outputs to verify that the host blocks invalid downstream actions.
7. Do not forward tokens intended for another resourceValidate token recipients and domain-object permissions at distinct boundaries.Separating credentials by resource adds issuance, expiration and rotation operations.Test wrong audiences and cross-tenant objects separately, and verify that the incoming token is not passed upstream.
8. Distinguish tool-result data from instructionsSeparate response schemas, error classification and execution policy so data cannot become authority.Excessive raw logging creates exposure, while flattened errors lose diagnostic distinctions.Test downstream execution with separate fixtures for injected instructions, denied access, empty results, and missing schema fields.

CHAPTER 1 / 8

The integration problem that led to MCP

MCP does not merge every API into one; it standardizes the integration surface between AI applications and context providers.

Why this concept became necessary

When every agent product builds a separate connector for each file system, database, and SaaS, authentication, discovery, error handling, and updates are duplicated. MCP lets the host handle server capabilities through consistent messages and a consistent lifecycle.

A server can act as an adapter in front of existing internal APIs or databases. Domain APIs and authorization remain necessary; protocol compatibility alone does not make data semantics or business permissions equivalent.

Figure 4-2. The integration problem that led to MCP: decision flowThe chain from the problem conditions through the working principle to verification evidence.
Problems and selection criteria

MCP does not merge every API into one; it standardizes the integration surface between AI applications and context providers.

How it works

A common client-server protocol makes capability discovery and invocation formats reusable.

Verification evidence

Compare the domain API contract and the MCP exposure contract for the same function side by side.

Follow it through a concrete system

If an AI host connects calendars, issue trackers, and file systems through separate proprietary plugins, each product reimplements discovery, schemas, permissions, and error handling. MCP standardizes the messages and capability representations exchanged over these connections, making it easier to combine hosts and servers. Actual scheduling rules and issue permissions remain owned by each domain service.

The success criteria for adopting MCP therefore go beyond having fewer connectors. Even when the server revision changes, the host must negotiate capabilities, unauthorized resources must stay invisible, and tool failures must reach the user in a recoverable state. Continuing to use existing REST APIs and queues inside the server is also a normal design; keep the protocol boundary distinct from the domain boundary.

Selection criteria and failure boundaries

It requires versioning for the new protocol layer, server trust, and ecosystem supply-chain management.

Misconceptions to avoid: MCP does not replace REST, databases, and API gateways.

Verify it yourself

Compare the domain API contract and the MCP exposure contract for the same function side by side.

What to judgeA common client-server protocol makes capability discovery and invocation formats reusable.

To summarize this chapter

MCP does not merge every API into one; it standardizes the integration surface between AI applications and context providers.

Official sources for this chapter

The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.

  1. Microsoft, 「TypeScript HandbookReview date 2026-08-28 · Scope Latest official documentation
  2. Python Software Foundation, 「asyncio — Asynchronous I/OReview date 2026-08-28 · Scope Python 3.14 documentation
  3. The Go Authors, 「Effective GoReview date 2026-08-28 · Scope Go official documentation
  4. The Rust Project, 「What Is Ownership?Review date 2026-08-28 · Scope The Rust Programming Language

CHAPTER 2 / 8

Host, client, and server trust boundaries

The host owns user experience and policy and manages client connections, while servers provide limited capabilities.

Why this concept became necessary

The host coordinates user requests, the model, approval UI, and multiple clients. Each client maintains a session with a specific server and handles capability negotiation and message transport.

Network and credential risks differ depending on whether the server is a local process or a remote service. Treat descriptions and metadata sent by the server as untrusted input, and let host policy and user intent control final execution.

Figure 4-3. Host, client, and server trust boundaries: decision flowThe chain from the problem conditions through the working principle to verification evidence.
Problems and selection criteria

The host owns user experience and policy and manages client connections, while servers provide limited capabilities.

How it works

Session negotiation agrees on supported features and the protocol version, and structured messages are then exchanged.

Verification evidence

Show who owns identity, consent, timeout, and audit at each boundary.

Follow it through a concrete system

When a desktop host connects to a local file server and a remote CRM server, those servers have different trust levels. A local process's installation package may also be tampered with, while remote servers pose network and token-leakage risks. The host must check the server's tool descriptions against the targets and actions the user allowed, rather than treating those descriptions as trusted policy.

The client manages more than a simple network socket. It must bind the negotiated protocol version, supported capabilities, outstanding requests, and cancellation signals to the session. After a disconnect, a new session may not know whether an earlier request actually ran, so state-changing tools must allow results to be queried again using an operation identity issued by the server.

Selection criteria and failure boundaries

More connections complicate lifecycle management, reconnection, timeouts, and credential scope.

Misconceptions to avoid: It is incorrect to assume that a host can automatically run a tool safely just because a server advertises it.

Verify it yourself

Show who owns identity, consent, timeout, and audit at each boundary.

What to judgeSession negotiation agrees on supported features and the protocol version, and structured messages are then exchanged.

To summarize this chapter

The host owns user experience and policy and manages client connections, while servers provide limited capabilities.

Official sources for this chapter

The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.

  1. Model Context Protocol, 「ArchitectureReview date 2026-08-28 · Scope MCP 2025-06-18

CHAPTER 3 / 8

Tools·resources·prompts

A primitive is not a naming convenience for the model but a contract that separates the responsibilities of reading, executing, and providing.

Why this concept became necessary

A resource exposes content that the application reads and selects as context, such as documents or schemas, through URIs and metadata. A prompt is a conversation template that the user can explicitly select, and a tool is an executable capability that the model can propose calling.

The tool input schema constrains parameters but does not guarantee semantic authorization. Even if the record ID for deleteRecord matches the schema, the server and upstream system must still verify that the current user is allowed to delete it.

Figure 4-4. Tools·resources·prompts: decision flowThe chain from the problem conditions through the working principle to verification evidence.
Problems and selection criteria

A primitive is not a naming convenience for the model but a contract that separates the responsibilities of reading, executing, and providing.

How it works

Different primitives separate discovery, invocation, and user-control methods.

Verification evidence

Classify each capability as read, compute, or state change, and add preview and approval information to state changes.

Follow it through a concrete system

Internal policy documents can be provided as resources so the host selects the parts it needs, while a weekly-report format can be a user-selected prompt. Creating an actual ticket is a tool action. Distinguishing these three lets information to read, actions to execute, and templates explicitly started by users have different consent mechanisms and UIs.

Classifying by name alone is risky. If calling `previewInvoice` increments a view counter or creates a temporary row, treat it as a tool with side effects. Resource URIs must also respect the current user's tenant and permissions, and prompt instructions may contain untrusted external text. Verify each primitive's data sources and execution effects with contract tests.

Selection criteria and failure boundaries

Misclassification lets a seemingly read-only feature create side effects or lets prompts execute implicitly.

Misconceptions to avoid: A valid JSON schema does not make business authorization valid.

Verify it yourself

Classify each capability as read, compute, or state change, and add preview and approval information to state changes.

What to judgeDifferent primitives separate discovery, invocation, and user-control methods.

To summarize this chapter

A primitive is not a naming convenience for the model but a contract that separates the responsibilities of reading, executing, and providing.

Official sources for this chapter

The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.

  1. Model Context Protocol, 「ArchitectureReview date 2026-08-28 · Scope MCP 2025-06-18
  2. Model Context Protocol, 「Server FeaturesReview date 2026-08-28 · Scope MCP 2025-06-18

CHAPTER 4 / 8

Lifecycle · Errors · Retries

A successful protocol connection and a successful business action are different states, and errors must state whether a retry is possible.

Why this concept became necessary

Initialization negotiates version and capabilities, after which responses are matched by request ID. Distinguishing transport disconnects, protocol errors, and tool domain errors lets the host decide whether to reconnect, fix the input, or ask the user.

Unconditionally retrying a state-changing tool after a timeout can duplicate an action when the first request succeeded but its response was lost. The recovery contract must include an idempotency key, an operation-status query, and a clear timeout budget.

Figure 4-5. Lifecycle · Errors · Retries: decision flowThe chain from the problem conditions through the working principle to verification evidence.
Problems and selection criteria

A successful protocol connection and a successful business action are different states, and errors must state whether a retry is possible.

How it works

Correlation IDs and structured errors separate transport failures from domain failures.

Verification evidence

Inject a lost response, then recover the result without duplication by querying the same operation ID.

Follow it through a concrete system

The next action depends on whether the transport disconnected, the JSON message was invalid, or the tool input violated business rules. In the first case, recover the same session or query the result; in the second, check client and server versions; in the third, the user must correct the input. A single “failure” string leaves these decisions to model guesswork.

State-changing requests such as payments or deletions, in particular, must not treat a timeout as a failure, because the server may commit the change and lose only the response. Reusing the client-generated idempotency key for the same business operation and checking the final result through a status endpoint resolves the uncertainty without duplicate execution.

Selection criteria and failure boundaries

Retries and reconnects can create hidden duplicate actions or stale session state.

Misconceptions to avoid: It is incorrect to assume that a timeout means execution failed and the same request can simply be sent again.

Verify it yourself

Inject a lost response, then recover the result without duplication by querying the same operation ID.

What to judgeCorrelation IDs and structured errors separate transport failures from domain failures.

To summarize this chapter

A successful protocol connection and a successful business action are different states, and errors must state whether a retry is possible.

Official sources for this chapter

The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.

  1. Model Context Protocol, 「ArchitectureReview date 2026-08-28 · Scope MCP 2025-06-18
  2. Model Context Protocol, 「Server FeaturesReview date 2026-08-28 · Scope MCP 2025-06-18

CHAPTER 5 / 8

Authentication · Authorization · Consent · Audit

Securing AI connections is not a one-time login; it means restricting token audience and per-action permissions among the user, client, and resource server.

Why this concept became necessary

Remote MCP authorization defines the flow for discovering protected resource metadata and the authorization server, then obtaining an appropriate token. Tokens must be bound to the target server and scope, and token passthrough, which forwards a token unchanged to other downstream services, must be avoided.

A user consent screen should show the actual target, the state that will change, and the scope of data transfer rather than the tool name. The server checks the subject and scope on every call and records in the audit log, with sensitive values masked, who ran which tool revision with which input.

Figure 4-6. Authentication · Authorization · Consent · Audit: decision flowThe chain from the problem conditions through the working principle to verification evidence.
Problems and selection criteria

Securing AI connections is not a one-time login; it means restricting token audience and per-action permissions among the user, client, and resource server.

How it works

OAuth-based tokens and per-call policies connect identity to a limited capability.

Verification evidence

Contract-test that tokens for other audiences, expired tokens, and calls without the required scope are rejected.

Follow it through a concrete system

A token must be evidence of delegated authority with a specific audience, scope, and expiry, not a master key copying all of a user's permissions. If an MCP server passes a token it received directly to another service, that token can be used on resources it was never intended for. The server must separately exchange tokens for the downstream services it needs and recheck the subject-resource relationship on every call.

Instead of indiscriminately storing the entire prompt, record who acted, which client and tool revision they used, the target, approval and policy results, and the state change produced. Link sensitive inputs through hashes or de-identified identifiers and control access to the originals separately. This structure lets you reconstruct actions during an incident while limiting personal-data retention.

Selection criteria and failure boundaries

Consent fatigue, token leakage, and excessive scope introduce new risks.

Misconceptions to avoid: An authenticated client is not automatically allowed to run every tool.

Verify it yourself

Contract-test that tokens for other audiences, expired tokens, and calls without the required scope are rejected.

What to judgeOAuth-based tokens and per-call policies connect identity to a limited capability.

To summarize this chapter

Securing AI connections is not a one-time login; it means restricting token audience and per-action permissions among the user, client, and resource server.

Official sources for this chapter

The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.

  1. Model Context Protocol, 「AuthorizationReview date 2026-08-28 · Scope MCP 2025-11-25

CHAPTER 6 / 8

Verify capability changes after a successful connection

Check connection health separately from compatibility of the tool contract needed for the task.

Why this concept became necessary

An open MCP connection does not make a task executable if a required tool is missing or its input schema changed. The host must compare discovered capabilities with task requirements rather than equating connectivity with full approval.

Record the client and server protocol revisions and apply the lifecycle and capability rules for those revisions. Mixing examples from different revisions can invoke unsupported features or omit required initialization.

The same tool name can conceal changed units, required arguments or return formats. Compare real request fixtures and expected responses, not just tool-name lists.

Do not let the model guess a similarly named tool for an unsupported capability. The host should hold the task or use a previously verified alternative and clearly identify the missing feature.

Figure 4-7. Verify capability changes after a successful connection: decision flowThe chain from the problem conditions through the working principle to verification evidence.
Problems and selection criteria

Check connection health separately from compatibility of the tool contract needed for the task.

How it works

Compare discovered capabilities with versioned real request/response contracts.

Verification evidence

Use fixtures with changed required arguments and missing required outputs to verify that the host blocks invalid downstream actions.

Follow it through a concrete system

A fictional inventory server changes a required lookup argument from productId to sku. Connection and discovery succeed, but the existing client call no longer matches the schema. Include an existing client with cached old schemas. An updated server list does not guarantee that an already-running task knows the new contract.

Separate fixtures for the original request and a converted request. If conversion is needed, record ownership and ID-mapping rules rather than assuming that renaming a field preserves meaning. Check whether product IDs and SKUs map one-to-one or vary by variant. Unconvertible inputs need explicit errors, not guesses that could retrieve the wrong product.

Automatically replacing a missing inventory count with an empty string or zero can falsely imply out-of-stock. Treat a missing required field as a contract failure and stop it before purchase decisions. Also include a legitimate zero-quantity result. Distinguishing an explicit zero from an absent field supports different actions for out-of-stock and contract failure.

Keep protocol revision, discovered schemas, converter version and fixture results in the approval record. Rerun the bundle after server updates to detect failures invisible to connectivity checks. Record a review reason when discovered schemas differ from approved ones. Distinguish optional additions from required semantic changes to avoid unnecessary total shutdown.

Selection criteria and failure boundaries

Schema conversion carries semantic-mapping and maintenance costs and cannot be approved on matching names alone.

Misconceptions to avoid: A successful MCP connection does not prove every tool call is compatible.

Verify it yourself

Use fixtures with changed required arguments and missing required outputs to verify that the host blocks invalid downstream actions.

What to judgeCompare discovered capabilities with versioned real request/response contracts.

To summarize this chapter

Check connection health separately from compatibility of the tool contract needed for the task.

Official sources for this chapter

The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.

  1. Model Context Protocol, 「ArchitectureReview date 2026-08-28 · Scope MCP 2025-06-18
  2. Model Context Protocol, 「Server FeaturesReview date 2026-08-28 · Scope MCP 2025-06-18

CHAPTER 7 / 8

Do not forward tokens intended for another resource

Even for an authenticated user, separately verify that the presented token is intended for this server.

Why this concept became necessary

For a remote MCP server, an access token’s intended resource matters as well as its subject. Accepting a token for another API can expand authenticated identity into unintended service access.

MCP authorization revision 2025-11-25 requires servers to verify that tokens were issued for them. Check client resource identification and server recipient validation together without logging raw tokens.

An MCP server must not simply forward its incoming token to an upstream business API. The cited specification prohibits token passthrough; the upstream resource needs a separately issued credential contract.

A valid token audience does not settle domain authorization. Business APIs and policy must still decide whether an order-read scope permits access to another tenant’s order; OAuth success does not authorize every row.

Figure 4-8. Do not forward tokens intended for another resource: decision flowThe chain from the problem conditions through the working principle to verification evidence.
Problems and selection criteria

Even for an authenticated user, separately verify that the presented token is intended for this server.

How it works

Validate token recipients and domain-object permissions at distinct boundaries.

Verification evidence

Test wrong audiences and cross-tenant objects separately, and verify that the incoming token is not passed upstream.

Follow it through a concrete system

A teaching fixture supplies a token with the same user and a valid signature but a different intended resource. The MCP server must reject it before tool execution rather than accepting it because the username matches. Verify that the underlying tool was never called after rejection. A correct error status is insufficient if data was queried before the access check.

A second fixture uses the correct resource token to request another tenant’s order. Token audience and domain-object ownership are separate checks; passing only one must not return the data. Separate fixtures prevent mistaking audience validation for complete authorization. Record which user, scope or ownership value changed.

Record rejection-reason categories, resource identifiers, and policy revisions in the audit log. This makes it possible to identify which boundary rejected a request without copying raw tokens or personal order data. Use rejection codes that operators can reproduce and anonymous request IDs. Retaining credential bodies that are not needed to diagnose a failure turns diagnostic data into another credential store.

This section concerns remote authorization boundaries. Do not assume local stdio and remote HTTP use identical credential handling; check the documentation for the selected transport and protocol revision. Record the actual transport in deployment documents rather than inheriting another example’s security assumptions. Recheck trusted actors and credential lifetimes when the connection context changes.

Selection criteria and failure boundaries

Separating credentials by resource adds issuance, expiration and rotation operations.

Misconceptions to avoid: A valid signature and matching username do not make one token usable at every API.

Verify it yourself

Test wrong audiences and cross-tenant objects separately, and verify that the incoming token is not passed upstream.

What to judgeValidate token recipients and domain-object permissions at distinct boundaries.

To summarize this chapter

Even for an authenticated user, separately verify that the presented token is intended for this server.

Official sources for this chapter

The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.

  1. Model Context Protocol, 「AuthorizationReview date 2026-08-28 · Scope MCP 2025-11-25

CHAPTER 8 / 8

Distinguish tool-result data from instructions

A tool result is an observation for the task, not authority to rewrite system policy.

Why this concept became necessary

A document-retrieval tool may return text instructing the agent to send another file. Correct protocol delivery does not make instructions inside the content trustworthy.

The host preserves result provenance and request scope and treats natural-language content as untrusted data. Any next action proposed by the model still requires executor checks against the original user goal and allowed capabilities.

Connection errors, schema violations and business denials need different recovery. Converting them all to empty results confuses missing documents with denied access, so preserve internal error classes and appropriate user explanations.

User-facing errors should explain necessary action without exposing secrets or detailed permission structure. Prefer limited traces identifying the failing boundary over storing entire raw responses for convenience.

Figure 4-9. Distinguish tool-result data from instructions: decision flowThe chain from the problem conditions through the working principle to verification evidence.
Problems and selection criteria

A tool result is an observation for the task, not authority to rewrite system policy.

How it works

Separate response schemas, error classification and execution policy so data cannot become authority.

Verification evidence

Test downstream execution with separate fixtures for injected instructions, denied access, empty results, and missing schema fields.

Follow it through a concrete system

Place a valid paragraph and an external-transmission instruction together in a fictional document-tool result. The pass condition is that the valid paragraph may support an answer, but the transmission instruction does not authorize any new tool execution. Even when using a safe evidence paragraph, link its source ID in the answer. Rejecting the injected instruction does not automatically verify the accuracy or freshness of the remaining paragraphs.

One fixture returns permission denied and another returns genuinely zero search results. Check distinct guidance and retry policies to detect empty-array conversions that hide errors. Check that permission denial does not trigger an automatically broader search. Seeking inaccessible material through another tool still needs separate authorization.

Remove a required field from a normal result and verify that host validation stops processing. Fluent guesses for missing values merely disguise the error; they do not restore the task contract. Test responses containing valid values alongside responses containing empty strings. A property name alone does not establish a usable value; distinguish structural success from semantic failure.

The final trace links the requested tool, validated result type, rejected follow-up action, and state reported to the user. This record explains how the connection layer can succeed while business judgment fails. After policy changes, rerun old attack fixtures and normal document fixtures together. A higher rejection rate does not satisfy the integration's functional requirements if the material needed for normal questions is also blocked.

Selection criteria and failure boundaries

Excessive raw logging creates exposure, while flattened errors lose diagnostic distinctions.

Misconceptions to avoid: It is incorrect to assume that all content delivered in the official MCP format is a trusted instruction.

Verify it yourself

Test downstream execution with separate fixtures for injected instructions, denied access, empty results, and missing schema fields.

What to judgeSeparate response schemas, error classification and execution policy so data cannot become authority.

To summarize this chapter

A tool result is an observation for the task, not authority to rewrite system policy.

Official sources for this chapter

The technical facts in the text were reviewed against the following primary sources. The author reconstructed the diagrams and comparisons using these materials.

  1. Model Context Protocol, 「ArchitectureReview date 2026-08-28 · Scope MCP 2025-06-18
  2. Model Context Protocol, 「Server FeaturesReview date 2026-08-28 · Scope MCP 2025-06-18
  3. Anthropic, 「Effective Context Engineering for AI AgentsReview date 2026-08-28 · Scope Latest official documentation

INTERACTIVE LAB 1 / 2

Lab 1 · Reducing the permissions of an internal search MCP server

A single search tool uses the same administrator token to access full document text, HR records, and deletion functionality.

Choose a design that meets search requirements while limiting the scope of a breach.

Choose an answer

Correct answer A

A. Separates read-only search from management tools, applies user document permissions before the query, and restricts token audience, scope, and audit.A decision that accounts for conditions, working principles, and failure boundaries together.

B. Write “Do not look at confidential documents” in the tool description.It considers only some benefits and omits prerequisites or newly introduced failure boundaries.

C. Distribute the same administrator token to all employees.It treats the responsibilities of different layers as one and misses the actual verification points.

D. Let the model hide search results on its own.It relies on technology names or trends, with no observable evidence from the current requirements.

INTERACTIVE LAB 2 / 2

Lab 2 · A connected server with the wrong token audience

An inventory MCP server receives a token for another business API. Its signature and user are valid, but the inventory server is not its intended recipient.

Choose the verdict required before tool execution.

Choose an answer

Correct answer A

A. Reject the token and use authorization for the correct resource.User authentication and validation of a token’s intended recipient are different conditions.

B. Allow lookup because the user matches.Being the same principal does not mean a token can be reused for other resources.

C. Forward the received token unchanged to the backend API.This violates the MCP prohibition on token passthrough and the resource boundary.

D. Ask the model whether the token is safe.The server must validate intended recipients; natural-language judgment is not a substitute.

KEY TERMS

Key terms in this unit

The integration problem that led to MCP
A common client-server protocol makes capability discovery and invocation formats reusable.
Host, client, and server trust boundaries
Session negotiation agrees on supported features and the protocol version, and structured messages are then exchanged.
Tools·resources·prompts
Different primitives separate discovery, invocation, and user-control methods.
Lifecycle · Errors · Retries
Correlation IDs and structured errors separate transport failures from domain failures.
Authentication · Authorization · Consent · Audit
OAuth-based tokens and per-call policies connect identity to a limited capability.
Verify capability changes after a successful connection
Compare discovered capabilities with versioned real request/response contracts.
Do not forward tokens intended for another resource
Validate token recipients and domain-object permissions at distinct boundaries.
Distinguish tool-result data from instructions
Separate response schemas, error classification and execution policy so data cannot become authority.

UNIT WORKBOOK

Exercises and worksheets for applying concepts to new situations

Start by checking basic principles, then expand to practical workplace decisions. After submitting an answer, you can see why every option is correct or incorrect, not just the correct answer.

THREE-LEVEL ASSESSMENT

From basic principles to operational decisions

After you submit an answer, you can see not only the correct answer but also why each option is right or wrong.

Basic Question 1

What is the core responsibility of the MCP host?

Choose an answer

Correct answer D

A. Storing every database row directly.It considers only some benefits and omits prerequisites or newly introduced failure boundaries.

B. Making every server use the same implementation language.It treats the responsibilities of different layers as one and misses the actual verification points.

C. Retiring the REST API.It relies on technology names or trends, with no observable evidence from the current requirements.

D. Coordinate user intent, the model, client connections, approval, and security policies.A decision that accounts for conditions, working principles, and failure boundaries together.

Apply Question 2

What is the safe action after a state-changing tool times out?

Choose an answer

Correct answer A

A. Look up the result using the same operation ID and retry according to the idempotency contract.A decision that accounts for conditions, working principles, and failure boundaries together.

B. Retry indefinitely with a new ID.It considers only some benefits and omits prerequisites or newly introduced failure boundaries.

C. Assume success and delete the audit record.It treats the responsibilities of different layers as one and misses the actual verification points.

D. Remove the tool schema.It relies on technology names or trends, with no observable evidence from the current requirements.

Capstone Question 3

What evidence verifies least privilege for remote MCP?

Choose an answer

Correct answer B

A. Whether the Model said it was safe.It relies on technology names or trends, with no observable evidence from the current requirements.

B. A test showing that the server rejects calls with the wrong audience, insufficient scope, or unauthorized resources, and records those rejections in the audit trail.A decision that accounts for conditions, working principles, and failure boundaries together.

C. The color of the login screen.It considers only some benefits and omits prerequisites or newly introduced failure boundaries.

D. Whether the server name contains “secure”.It treats the responsibilities of different layers as one and misses the actual verification points.

PRIMARY SOURCES

Course references

This list collects the sources for each chapter. The text and author-created diagrams were prepared by directly reviewing the originals below.

PERSONAL WORKSHEET

A learning worksheet you adapt to your own environment

Your input remains only on the current browser screen and is not stored or transmitted externally. Use categories and pseudonyms instead of actual sensitive information.

OFFICIAL SOURCES

Verify against official sources

Technical, compatibility, and model information reviewed: August 2026

LEARNING RECORD

Have you reviewed the text, decision activities, and all explanations?

Completion status is stored only in this browser.