MCP: Model Context ProtocolBeginnerModule 02 — MCP architecture and components

How should an MCP host divide consent, context and execution responsibilities with servers?

Question 17 of 43 · Updated

On this page

Direct answer#

An MCP host should own the user-facing decision to permit an interaction, the selection and disclosure of context, and the coordination of approved operations. An MCP server should independently authorize the authenticated actor, validate the requested operation and resource, enforce business constraints, execute its capability through the authoritative service, and return an accurate outcome. The MCP client carries the appropriate protocol messages between them.

These responsibilities overlap intentionally at trust boundaries. The host should not send an action that its policy forbids, even if the server would accept it. The server should not execute an unauthorized action merely because the host says that a user approved it. Neither component should rely on a model's assertion of permission or successful execution.

A useful rule is: the host controls the request and the disclosure; the server controls its capability and resource; the authoritative business system controls the actual state change.

Learning continuity: Q16–18 introduced the architectural roles and Q21 established separate connection scopes. This lesson focuses on the handoff of authority and evidence across those roles. It builds on the earlier LangChain security and context lessons rather than repeating OAuth configuration, credential storage, routing implementation or context ranking. Dedicated approval-system implementation, fine-grained authorization and reconciliation lessons follow later in the roadmap.

Verification scope: Prepared under the authorized offline research and changelog exceptions. The historical MCP 2025-06-18 specification is the reference baseline, not a claim about the latest revision. Official links were not checked live. The Python 3.13.5 standard-library example was syntax-compiled and executed locally; all 13 checks passed. It is an in-memory teaching fixture for responsibility separation, not a production approval mechanism or MCP implementation. The MCP SDK and Mermaid CLI were unavailable locally; real SDK integration, security enforcement across processes, and Mermaid parsing/frontend rendering remain unverified.

1. Start with an action that changes real state#

Consider the retailer's support assistant. A customer asks: "Can you cancel my order A12?"

There are several separate questions that must be answered before the application reports success.

QuestionResponsible boundary
What does the customer mean by cancellation?Host interaction and task interpretation
Has the customer actually confirmed the intended action, if required?Trusted host consent flow
Does the current user have permission to cancel A12?Server and resource-owning service
Is the order still cancellable?Authoritative order service
Was the cancellation actually committed?Authoritative operation result
Which details may be shown to the model or user?Host disclosure policy, constrained by server access and disclosure rules

The model may help interpret the request, but it cannot establish that the user owns the order or that a cancellation has occurred. A correctly formed tool call is only a proposed action until the required checks and execution have completed.

This example uses an explicit confirmation requirement for illustration. Whether a particular operation requires interactive confirmation depends on its consequences, the application's established policy, the user's authorization and the deployment. Some narrowly scoped operations may have valid standing authorization; others require a fresh user decision.

2. The responsibility map: three gates and one result#

Loading diagram…

The diagram is a conceptual decision flow, not a universal protocol sequence. Transport-level authentication may happen before discovery. A server can request additional information or approval using supported application or protocol mechanisms. The precise order and message format depend on the integration.

There are three separate gates: host admission, server authorization and authoritative business validation. There is also a separate result-verification and disclosure step.

A refusal by any required gate prevents the operation from proceeding through that path. Passing one gate does not bypass the others.

The host is closest to the user interaction. It knows the current task, the selected account and the action being proposed. It can present an intelligible explanation of the consequences before transmitting the request.

For a cancellation, the host should establish the intended order and distinguish cancelling an order from asking about the cancellation policy. It should not assume that a request to inspect eligibility authorizes a write.

A confirmation should be specific enough for the user to understand what will happen. For example, the host might show the selected order and explain that cancellation may affect shipment and refund processing. It should not say simply "Allow tool?" when the operation has important consequences.

When confirmation is required, bind it to the intended action. A decision to cancel A12 must not silently become permission to cancel B34. Material changes to parameters, identity, destination or consequences should invalidate or trigger reevaluation of approval.

The host must distinguish a trusted UI decision from a model-generated boolean. A model may propose an action but cannot manufacture a genuine confirmation. The server's tool description may inform the host about behavior but cannot independently authorize the host to bypass consent.

Declining an approval must stop that proposed action. The host should not attempt a different tool to achieve the same denied effect without appropriate permission.

4. Server responsibility: independently enforce authorization#

User consent and server authorization answer different questions.

ControlMeaningExample
AuthenticationEstablish the actor's identityVerified customer session
AuthorizationDetermine whether the actor may perform the operation on the resourceAlice can cancel her own eligible order
Consent or approvalConfirm that the authorized actor wants this particular actionAlice approves cancelling A12
Business validationDetermine whether the action is currently validA12 has not shipped
Outcome verificationEstablish what actually happenedCancellation receipt and current order status

A customer may explicitly ask to cancel another customer's order. Their consent does not create authority over that record. Conversely, a customer may be allowed to cancel their own order but have asked only to see its delivery status. Server permission does not imply that the host may execute a different action.

The MCP server should use identity derived from a validated authorization context, not from arbitrary tool arguments such as user_id or tenant_id chosen by the model. It checks the actual operation and resource using its own trusted policy.

The historical MCP authorization framework provides an approach for applicable HTTP deployments. It does not define the business permission rules for every retailer, database or internal service. Local transports also need suitable identity and access controls.

A server should enforce approval requirements that belong to its own business or security contract. If it requires evidence of an external approval, the integration must define a trusted, verifiable mechanism. A generic approved=true value sent by an untrusted client is not sufficient evidence. MCP does not supply one universal approval-token format for arbitrary tools.

If the server cannot verify required authority or approval, it should refuse the operation. Host policy is defense in depth, not a substitute for resource authorization.

5. Divide context responsibility by data owner and destination#

The server decides which data it can legitimately return to an authorized caller. The host decides which portions of that result can be supplied to the current workflow, another server, a model provider or the user.

For the order example, a server might internally use a customer address, payment reference and shipping state. The model may need only the order identifier and the verified cancellation outcome.

A good server response is already minimized to the capability's contract. It should not expose internal credentials, unrelated customer records or unnecessary backend diagnostics. Returning fewer fields reduces the opportunity for accidental disclosure downstream.

The host then applies destination-specific disclosure rules. It may transform a verified result into a small, model-facing data object rather than forward the entire response.

JSON
{ "order": "A12", "outcome": "cancelled" }

This is a fictional application-level context object, not an MCP wire message or standardized tool result schema.

A successful read from one service does not authorize sharing its contents with every other integration. For example, an approved shipping lookup does not automatically allow the host to send the customer's address to an unrelated search service.

Keep credentials, sensitive internal state and approval evidence outside model-visible context unless a narrowly justified and explicitly supported design requires otherwise. A model does not need a cancellation authorization token to explain the verified outcome.

Treat retrieved text as untrusted content. A returned document may contain instructions that try to alter the task or trigger new actions. Such instructions do not gain authority because the data came through MCP. The host's policy and the server's independent execution checks remain necessary.

6. Execution ownership and the authoritative state#

Once host and server gates permit an operation, the actual business service must enforce its domain rules at execution time.

Consider the interval between reading an order and cancelling it. At the time of discovery, A12 may be open. By the time the user confirms cancellation, the order may already have shipped.

The host can present the last known state and confirm the intended action, but it cannot guarantee that the state remains unchanged. The resource-owning service needs to enforce the transition atomically or with an appropriate concurrency-control mechanism.

For a cancellation, the service may check ownership, current order status, business policy and whether another cancellation is already in progress. It then commits the valid state change or returns a controlled rejection.

This is an example of a time-of-check/time-of-use problem: an earlier check does not necessarily remain true later. The authoritative validation belongs at the boundary where the actual state changes.

MCP standardizes access to the capability. It does not turn a read followed by a write into an atomic transaction. It also does not automatically guarantee that a repeated call produces exactly one business effect.

Business idempotency, transaction semantics and recovery must be implemented by the responsible service and workflow. A JSON-RPC request identifier is not automatically a durable idempotency key.

Loading diagram…

The diagram assumes a valid connection and applicable authentication, and illustrates the business-eligible and business-ineligible cases. If the user declines or host approval checks fail, the invocation never occurs. If server authorization fails, the request does not proceed to the order service. These additional denial paths are shown in the responsibility flowchart above.

An interrupted response introduces another outcome: uncertainty. If the service may have committed a cancellation but the host cannot verify its receipt, the host should not tell the user that the order was definitely cancelled or definitely unchanged. It should obtain authoritative status when possible.

The confirmation shown here is an application interaction. It is not a claim that every MCP tool invocation has a built-in universal confirmation dialog or standardized approval message.

8. Result verification: trust the outcome, not the wording#

A tool response can carry several layers of status. A transport may succeed, a JSON-RPC response may be valid, and a tool may still report that the business operation was rejected.

For example, the order service might return that A12 is already shipped. The protocol exchange worked correctly, yet the requested cancellation did not happen.

The host must preserve the distinction.

EvidenceAppropriate interpretation
Valid committed receipt matching the intended actionReport confirmed outcome after required verification
Definitive business rejectionReport that the requested action was not completed
Tool or protocol failureExplain the relevant failure without inventing business state
Missing or mismatched receiptTreat the requested outcome as unverified
Interrupted response after possible writeReconcile authoritative state before asserting a final outcome

A receipt should carry enough trusted information to identify the operation, resource and result. The host checks that it corresponds to the requested action and is appropriate for the current user. For important writes, an authoritative status query may be required, especially after errors or inconsistent responses.

A model-generated sentence saying "Your order is cancelled" does not verify anything. The host should either provide the verified result directly or constrain model-generated explanations to that evidence.

Server error handling also matters: avoid exposing raw stack traces and private data while preserving enough structured information for the host to respond correctly. Detailed wire-level error distinctions and result mapping are covered in later modules.

9. Tested Python example: separate the approval and execution gates#

This standard-library program demonstrates a host checking an approved intent, an independent order service enforcing identity and permission, an authoritative state check, and a minimal model-facing outcome.

It is deliberately not a real MCP server, SDK integration or production security implementation. The immutable Intent object represents a trusted application decision, not a cryptographic approval artifact. The authenticated_actor and can_cancel parameters stand in for independently validated server-side identity and authorization context. In a real deployment, these values cannot simply be accepted from untrusted tool arguments. The service combines the server and business-service responsibilities for the exercise.

Save as mcp_q22.py:

PYTHON
from dataclasses import dataclass, replace @dataclass(frozen=True) class Intent: actor: str order: str action: str = 'cancel' @dataclass(frozen=True) class Receipt: intent: Intent status: str reference: str class Orders: def __init__(self): self.rows = {'A12': ('alice', 'open'), 'B34': ('bob', 'open'), 'C56': ('alice', 'shipped')} self.writes = 0 def execute(self, intent, authenticated_actor, can_cancel): if intent.actor != authenticated_actor or not can_cancel: raise PermissionError('Operation not permitted') if intent.action != 'cancel': raise ValueError('Unsupported operation') row = self.rows.get(intent.order) if row is None or row[0] != authenticated_actor: raise PermissionError('Record unavailable') if row[1] != 'open': return Receipt(intent, 'rejected', '') self.rows[intent.order] = (row[0], 'cancelled') self.writes += 1 return Receipt(intent, 'committed', f'cancel-{self.writes}') def host_execute(intent, actor, approval, service, can_cancel): if intent.actor != actor or approval != intent: raise PermissionError('Missing matching approval') return service.execute(intent, actor, can_cancel) def report(intent, receipt): if receipt is None or receipt.intent != intent: return 'unverified' if receipt.status == 'committed' and receipt.reference: return 'cancelled' if receipt.status == 'rejected': return 'rejected' return 'unverified' def model_context(intent, receipt): return {'order': intent.order, 'outcome': report(intent, receipt)} def rejects(fn, error): try: fn() except error: return raise AssertionError('Expected rejection') if __name__ == '__main__': orders = Orders() a = Intent('alice', 'A12') rejects(lambda: host_execute(a, 'alice', None, orders, True), PermissionError) rejects(lambda: host_execute(a, 'alice', replace(a, order='B34'), orders, True), PermissionError) rejects(lambda: host_execute(a, 'bob', a, orders, True), PermissionError) rejects(lambda: host_execute(a, 'alice', a, orders, False), PermissionError) b = replace(a, order='B34') rejects(lambda: host_execute(b, 'alice', b, orders, True), PermissionError) assert orders.writes == 0 shipped = replace(a, order='C56') assert report(shipped, host_execute(shipped, 'alice', shipped, orders, True)) == 'rejected' receipt = host_execute(a, 'alice', a, orders, True) assert report(a, receipt) == 'cancelled' and orders.writes == 1 assert report(a, host_execute(a, 'alice', a, orders, True)) == 'rejected' and orders.writes == 1 assert report(a, None) == 'unverified' assert report(b, receipt) == 'unverified' assert report(a, replace(receipt, reference='')) == 'unverified' assert model_context(a, receipt) == {'order': 'A12', 'outcome': 'cancelled'} print('13 boundary checks passed')

Run:

BASH
python -m py_compile mcp_q22.py python mcp_q22.py

Actual local output on Python 3.13.5:

13 boundary checks passed

The five rejection checks cover missing approval, approval for a different order, a mismatched actor, a denied server permission and another actor's record. The next assertion confirms that those attempts did not mutate the fixture. A shipped order is rejected by the business-state rule even when the host approval and permission checks pass. The successful cancellation increments the write counter once; a subsequent attempt is rejected because the order is no longer open. Three checks reject missing, mismatched and incomplete receipts. The final check verifies the exact minimized model-facing context object.

Notice that approval matching and business authorization are separate functions. The host can approve an intent that the server rejects. This is intentional: the service does not trust the host's consent decision as proof of ownership.

Deliberate limitations: The matching Intent is not a secure approval token. It has no expiration, nonce, signature, trusted UI provenance or replay protection. The second cancellation is rejected by this particular state transition, not by a general idempotency mechanism. The code uses an in-memory dictionary and is neither thread-safe nor transactional. It assumes correctly typed trusted inputs, a trusted receipt source and an approved model destination. The report function checks receipt fields but does not independently authenticate the receipt or query external state. The model_context function demonstrates field minimization, not a comprehensive disclosure policy. No real order was changed. A production implementation must enforce the relevant approval, identity, resource, transaction, receipt integrity and disclosure guarantees using appropriate trusted systems. The local checks establish only the fixture's behavior.

10. Defense in depth: what if a layer fails?#

A robust architecture does not assume that every other layer is correct. Consider several failure scenarios.

FailureIndependent protection
Model fabricates an approvalHost requires a trusted application decision
Host mistakenly exposes a forbidden toolServer independently denies unauthorized operations
User confirms a changed or unrelated orderHost binds consent to the actual intended parameters; server checks the resource
Earlier eligibility read is staleAuthoritative service validates state at the time of execution
Server returns unrelated private fieldsHost applies disclosure policy and sends only necessary information onward
Communication fails after a possible writeHost reconciles with authoritative state before reporting success or retrying

These controls address different failure modes. They are not interchangeable. For example, a correct server authorization policy may allow a cancellation that the user did not intend. The host consent gate is therefore still important. A perfect confirmation interface cannot compensate for a server that grants access to other users' records.

Some integrations are within one trust domain; others cross independently operated systems. The exact controls and evidence exchanged must reflect that distinction. Do not rely on an approval object merely because its JSON structure looks correct.

11. Shared responsibilities and operational handoffs#

Security and correctness require agreement between the host and server teams. Define the capability's behavior and error contract before relying on it in a model-driven workflow.

The parties should agree on:

  • The trusted identity and authorization mechanism for the connection.
  • The required scope and resource-level permission for the operation.
  • Which approvals are enforced by the host and which are independently required by the server.
  • The input contract, side effects and current-state constraints.
  • The authoritative result and how uncertain outcomes can be reconciled.
  • The data that may be returned and disclosed to approved destinations.
  • The operational owners for failures, revocation, audit and support.

This does not imply that MCP defines a universal contract for all of these application details. The protocol provides the common capability-access boundary; the application must define additional business and security contracts.

Audit evidence should identify the operation, actor, relevant approval decision, policy result and authoritative outcome without unnecessarily storing sensitive payloads or credentials. Host and server records may need a common correlation mechanism to investigate a disputed action.

For testing, separately exercise host refusal, direct invocation without authorization, resource permission changes, stale business state, malformed or missing receipts and unauthorized disclosures. Then test the actual integration across compatible clients and servers. A passing unit test of the host is not sufficient evidence of server security.

12. Practical design scenarios#

Read-only product availability#

The host should select the relevant stock capability and enforce its context policy. The server verifies access and returns an appropriate observation. Interactive approval may be unnecessary for an ordinary authorized lookup, but confidential records still require appropriate access and disclosure controls.

Order cancellation#

The host establishes the user's intended order and obtains the required confirmation. The server independently validates the actor and ownership. The order service enforces the current cancellation policy. The host reports the verified outcome rather than the model's expectation.

Sharing customer information with another integration#

The host must decide whether that destination is authorized to receive the necessary data. The source server should already minimize the information it returns. The destination service must independently enforce permissions for any resulting action. A read authorization does not automatically grant an onward-disclosure authorization.

Model-backed server features#

Where a server requests supported sampling or user input, the host mediates the request according to negotiated capabilities and application policy. It does not automatically grant access to unrelated context, model capabilities or user information. Dedicated later lessons cover sampling and elicitation in detail.

Interview-ready answer#

The MCP host owns user-facing consent, task policy, model integration, context selection and the decision to invoke approved capabilities. The client manages protocol communication. The server independently authenticates and authorizes the actor, validates the operation and resource, executes through authoritative business logic and returns accurate results. Consent is not authorization, a valid schema is not business validity, and protocol success is not proof of a committed business outcome. The host must verify the result and control what information is disclosed, while the server and downstream service enforce their own access and execution boundaries. Defense in depth means that a mistake or compromised decision at one layer should not automatically become an unauthorized action at another.

Next lesson: Q23 examines how MCP servers interact with downstream APIs and databases, including the adapter boundary that turns an approved capability request into an authoritative business operation.

References

  1. 1.
  2. 2.
    MCP architecturemodelcontextprotocol.io
  3. 3.
    MCP toolsmodelcontextprotocol.io
  4. 4.
    MCP authorizationmodelcontextprotocol.io
  5. 5.
    MCP security best practicesmodelcontextprotocol.io
  6. 6.
    MCP samplingmodelcontextprotocol.io
  7. 7.
    OWASP Authorization Cheat Sheetcheatsheetseries.owasp.org
  8. 8.
  9. 9.

Related questions

Explore other topics:Forward Deployed EngineeringAI AgentsLarge Language ModelsRetrieval-Augmented Generation