← All guides

Agents

Engineer MCP tool trust boundaries beyond the prompt

Design per-request authorization, tool admission, downstream identity and consequential-action approval for remote MCP integrations with Microsoft Foundry.

MCPFoundryauthorizationtool securityapproval
Untrusted tool discovery is separated from application authorization and the target service that executes an action.
Bind consequential-action approval to the exact destination, operation and arguments; verify the real side effects.View full-size diagram

An MCP connection exposes capabilities to an agent; it does not establish that every suggested call is authorized. A useful security design follows the authority from the signed-in caller through the MCP server to the destination service, and checks the actual operation at every boundary. The model’s explanation is evidence of its reasoning, not proof that those checks occurred.

Scope and prerequisites

This guide covers remote HTTP MCP tools connected to Microsoft Foundry agents, with controls implemented by the application, MCP server and destination service. It uses the 2026-07-28 MCP specification. HTTP authorization is optional in the protocol itself, so require it explicitly for protected services. The HTTP authorization flow does not apply unchanged to local stdio servers. Protocol scope.

The current Foundry integration supports remote endpoints, project connections and approval responses. Its documentation separately marks long-running MCP operations in background mode as preview, and the .NET SDK as preview. Do not infer that every transport, SDK or asynchronous path has the same release status. Record the exact runtime and SDK version being assessed. Creating/testing agents requires the documented project role; creating an authentication connection additionally needs project-management permission. Foundry integration and limitations.

Before connecting a server, identify its operator, endpoint, authentication method, admitted tools, downstream services and data classification. Obtain an authorized test environment with two users or workloads having different permissions. Keep an inventory of connection credentials and revocation owners. A publicly reachable demonstration server is unsuitable for validating confidential-data behavior.

Threat model the complete call

Consider four adversaries: an authenticated caller requesting another user’s resource; a compromised tool server returning hostile text; an external document influencing the next tool call; and a developer who can change a trusted server’s tool definitions. Their objective may be data disclosure, unauthorized changes, credential theft or repeated expensive execution.

Write one concrete invariant per protected operation. For example: “An agent may create a draft ticket in project A; it cannot publish externally, select project B or change the recipient without a new authorization decision.” Inventory reads as carefully as writes: a read tool can disclose a secret, and an apparently harmless URL parameter can select an attacker-controlled destination.

The following is a design contract, not a built-in Foundry guarantee:

Boundary Required decision Evidence retained
Client to MCP server Is this token for this server and this permitted caller? Validated principal, issuer, audience and decision
Tool invocation May this principal use this tool with these arguments? Tool/version, target scope and policy result
MCP server to service Which identity performs the downstream operation? Credential reference and destination request ID
Consequential action Does current approval cover the exact side effect? Approval ID, argument digest, expiry and consumption

Authenticate each request, then authorize its target

Use established token-validation middleware. Validate issuer, signature, validity and intended audience before dispatching protected calls. OAuth clients must request tokens for the intended resource; the MCP server must reject tokens intended for a different API. Forwarding the incoming bearer token to an upstream service is prohibited by the MCP security requirements: acquire a separate token issued for that upstream resource. Audience binding and token separation.

A service credential authenticates the server, not necessarily the end user. If it can read all projects, enforce the caller’s permitted project/resource scope before using it. Do not turn a model-supplied username into trusted identity. Prefer an explicit resource identifier resolved inside the authorized tenant rather than a free-form destination URL. Validate object ownership after resolution, not merely the spelling of the identifier.

Keep authentication context request-scoped. A connection, session handle or previously successful call must not preserve another caller’s authority. Tool discovery can be filtered by the request’s authorization, but hiding a tool from discovery does not authorize or deny a direct invocation by itself. Enforce the same policy at invocation. The tools specification requires input validation and access controls independently of the client interface. Tools and per-request behavior.

Admit tools and distrust their output

Maintain a reviewed manifest containing server identity, tool name, input schema, destination classes and expected effects. Compare changes during deployment and on discovery; send material changes through review. Treat descriptions and annotations as hints from the server, not as your security policy. A tool named “preview” can still cause a write if its implementation changes.

For each tool, constrain argument ranges, resource scope, payload size and network destinations. Validate returned structures before placing them into the model context. Never interpret text inside a result as a new user approval, trusted policy or credential request. Keep untrusted content visibly attributable to its source in diagnostic traces. These controls implement the specification’s separation between server input/access checks and client result validation. Tool security responsibilities.

A proxy adds another risk: when one static OAuth client represents multiple dynamically registered MCP clients, existing consent can be misapplied to a different client. Follow the specification’s per-client consent mitigation. Validate authorization metadata and redirect destinations; arbitrary discovery URLs can create server-side request forgery. Review state handles as sensitive references bound to the caller, rather than assuming possession alone authorizes access. Proxy, discovery and state-handle risks.

Make approval specific, fresh and consumable

Foundry exposes approval requests and matching responses; its documented default requires approval unless configured otherwise. Avoid globally disabling approval for a mixed read/write server. Configure a narrow reviewed exception only where the operation’s risk and argument bounds justify it. Approval configuration.

For consequential operations, add an application-owned approval record binding the authenticated approver, server/tool version, canonical arguments, destination, expiry and one-time operation identifier. Display the actual recipient, data and effect. Reauthorize immediately before execution. If the model revises the target, a retry changes arguments, or a permission is revoked, obtain a new decision. This binding is a recommended application control; an approval response alone does not prove that your backend implements it.

Use idempotency at the destination where supported. A timeout after a successful write must trigger status reconciliation, not blind execution. Long-running preview behavior needs explicit cancellation and recovery testing before adoption.

Acceptance matrix and operational evidence

Run these cases only against authorized test resources, recording both the agent response and actual service state:

Case Required result Evidence
Valid identity, allowed resource Intended operation succeeds once Caller, target and service request ID
Token for another audience Rejected before tool execution Authentication rejection; no backend call
User A requests user B’s object Denied even when server credential can read it Resource authorization decision
Tool result asks for unrelated export No new authority or approval inferred Proposed call and policy rejection
Approved target changed afterward Old approval cannot authorize the new call Argument/version comparison
Same approval replayed No duplicate consequential effect Consumed approval and idempotency result
Role revoked during a session Next protected action follows current access policy Revocation and subsequent denial
Write succeeds but response times out Reconcile outcome before retry Destination state and retry decision

If a call unexpectedly succeeds, inspect the downstream identity first: a shared application credential often explains why caller-level restrictions vanished. For a denied legitimate request, separate token audience, project connection, tool policy and backend RBAC errors. Log identifiers and decisions, never bearer tokens or unnecessary tool payloads. Keep a kill switch that disables the connection and revokes downstream authority; removing a prompt instruction is not containment.

This guide was checked against documentation, not executed against a tenant. Retain the manifest, policy revision, negative-test evidence and recovery owner with the release record, then repeat the relevant cases when the server, credentials, runtime or admitted tools change.

Go to the source

References & further reading

  1. Microsoft Learn — Connect Foundry agents to MCP servers
  2. MCP 2026-07-28 — Authorization
  3. MCP 2026-07-28 — Authorization security considerations
  4. MCP 2026-07-28 — Security best practices
  5. MCP 2026-07-28 — Tools