AI & Software Architecture

Beyond the MCP Demo: How to Secure AI Agents Connecting to Enterprise Systems

A practical architecture guide to identity, authorisation, tool governance and runtime controls for production AI integrations

Executive summary

Model Context Protocol (MCP) is becoming a practical way to connect AI applications with tools, data sources and business services. That makes it useful—but also makes the integration boundary more consequential. An assistant that can explain a sales order has a different risk profile from one that can read customer records, update an order, issue a refund or trigger a workflow.

The common mistake is to treat MCP security as a single authentication problem. Authentication establishes who is calling. Production security must also establish what that caller may do, on which records, under which conditions, with what evidence, and how the system behaves when the model is manipulated or uncertain.

This article presents a layered approach: keep identity and policy outside the model; enforce permissions at invocation time; separate read and write capabilities; treat tool definitions as governed software interfaces; validate data at every boundary; control outbound network access; and record a traceable account of decisions and actions. MCP can standardise how capabilities are exposed, but it does not replace application security, business rules or operational ownership.

Central AI Agent connects through Identity, Policy Enforcement and Audit checkpoints within the MCP Layer to ERP, CRM, Finance and Documents.

Why this topic matters now

The MCP specification released on 28 July 2026 introduced changes intended to improve scalability and operational behaviour, including a stateless protocol core, header-based routing, cache hints and authorisation hardening. These are meaningful infrastructure developments, but protocol improvements do not automatically make a deployment secure. A scalable path to a tool is still a path to a tool with real permissions.

The important shift is from experimentation to operational integration. As agents connect to ERP, CRM, ticketing, finance, document repositories and internal APIs, organisations need to govern not only the model but also the capabilities it can discover and invoke.

1. MCP is an integration boundary—not a security boundary by itself

MCP provides a standardised way for an AI client to discover and call tools or access resources exposed by a server. In an enterprise design, that server may sit in front of an internal API, a database-backed service or a third-party system. The protocol helps standardise communication; it does not decide whether a particular employee should see a customer’s credit status or whether an agent may cancel an order.

A useful mental model is to treat an MCP server as an adapter with production-grade responsibilities. It translates a model-facing capability into a controlled application operation. If that adapter simply forwards requests using a broad service credential, the architecture has standardised the connection without adequately constraining the authority behind it.

Keep four questions separate

These controls are related, but they are not interchangeable. A valid token should not be treated as proof that every tool exposed by a server is appropriate for the caller.

2. The confused-deputy problem: when an agent borrows too much authority

A common pattern is to put an MCP server in front of an internal API and let the server use a service account. This can be convenient: the model does not need direct access to the business system. But if the server uses a highly privileged credential for every caller, it may become a confused deputy—a component that uses its own authority to carry out an action the requesting user is not entitled to perform.

Imagine a support agent helping a customer-service representative. The representative may view an order and request a replacement, but cannot issue a refund above a set amount. If the MCP server can issue refunds with an unrestricted credential and checks only whether the caller is signed in, the agent may trigger an operation beyond the representative’s authority.

The model should never be the final authority for permissions. It can propose an action; deterministic policy code and the target application must decide whether that action is allowed.

A safer authorisation sequence

  1. Validate the caller’s identity and token issuer, audience, expiry and required scopes.
  2. Resolve the user or service principal and the tenant or organisation boundary.
  3. Check permission for the specific tool and resource—not just access to the MCP server.
  4. Apply business constraints, thresholds and state-transition rules in the application service.
  5. Execute with the narrowest suitable credential and record the decision and outcome.

3. Design permissions around actions, records and conditions

Least privilege is often discussed as a matter of assigning fewer scopes. For agentic systems, it needs to be more granular. A user may be allowed to read a customer record but not export all records; update a delivery note but not change a bank account; draft a refund but not approve it; or operate within one tenant but not another.

Build authorisation around three dimensions: action, resource and context. The action describes what is being attempted; the resource identifies the specific object; context includes the caller, tenant, amount, workflow state, time or approval status.

DimensionExampleControl question
Actionread_order vs cancel_orderIs this operation allowed for this identity?
ResourceOrder SO-4821 in tenant ADoes the caller have access to this record?
ContextRefund of £1,800; order already dispatchedDo amount, state and approval rules permit it now?

Where possible, enforce rules in the existing domain service or policy layer rather than duplicating a weaker version inside an MCP adapter. The adapter can perform an early check, but the authoritative business operation must revalidate permissions and state at execution time.

4. Tool discovery is not authorisation

A server may expose a list of available tools, and a client may use that list to decide what the model can call. This is useful for capability discovery, but it is not an enforcement mechanism. A custom client can attempt to call a tool by name even if it was hidden from the model. A model may also infer a tool’s existence from instructions or prior context.

Apply two separate controls: filter what a caller is shown, and enforce access again when a tool is invoked. Discovery filtering improves usability and reduces unnecessary exposure; invocation-time authorisation is the security control.

5. Treat tool definitions like versioned APIs

An MCP tool is more than a name and a description. Its input schema, side effects, output shape and downstream implementation form a contract between the model-facing layer and the business system. If that contract changes after security review, the original approval may no longer be meaningful.

A tool originally designed to retrieve one invoice might later accept a list of invoice IDs or a broader filter. A seemingly minor schema change can substantially increase the data accessible through the same integration.

Descriptions matter because the model uses them to interpret capabilities. Vague descriptions can encourage unsafe or unintended calls. But a precise description is not a substitute for server-side validation: the contract should be clear for the model and strict for the implementation.

6. Prompt injection is a data-flow problem

Prompt injection becomes especially important when an agent can act. Instructions may arrive through a user prompt, email, support ticket, webpage, document or database field. Some content may be attacker-controlled. If the agent treats retrieved text as trusted instruction, it may attempt to use legitimate tools for an illegitimate purpose.

The practical response is not to rely on a stronger system prompt alone. Treat external content as untrusted data, separate data from policy, and make the execution layer enforce limits even if the model follows hostile instructions.

A secure system assumes that the model can be persuaded to request an action it should not perform. The architecture must make that request fail safely.

7. Token handling: do not turn a gateway into a credential-forwarding tunnel

A token issued for one resource should not be forwarded to a different upstream service simply because the MCP server can reach it. The server should validate credentials intended for itself and, when calling an upstream API, use a separate credential or delegated token issued for that upstream resource.

MCP authorisation guidance highlights token audience validation, secure token storage, short-lived access tokens where appropriate, PKCE for authorisation-code flows and protections against authorisation-server mix-up. Implementations should follow the applicable specification and OAuth security requirements rather than inventing a custom shortcut.

The right design depends on the client, identity provider, MCP transport and upstream system. Security review should verify the complete credential path—not just the login screen.

8. Read and write tools should have different risk profiles

A common design error is to package many capabilities into one broad tool because it is easier for the model to understand. A tool such as manage_customer_record may search, update, merge and delete records. That reduces the number of tool names, but makes permissions and side effects harder to reason about.

Prefer narrow, purpose-specific capabilities:

This may use more tools, but it makes authority explicit. It also lets the application require human approval for high-impact actions without slowing every low-risk lookup.

9. Make consequential actions safe under retries and partial failure

Enterprise systems fail in ordinary ways: timeouts, network interruptions, expired credentials, upstream throttling and duplicate requests. An agent may retry after a timeout even when the first request succeeded. If a tool sends a refund, creates a shipment or changes a purchase order, a retry can duplicate the business effect unless the operation is designed to handle it.

These are distributed-systems concerns as much as AI concerns. The model should not infer whether a timed-out payment or order update actually happened. The workflow service should track that state.

10. Audit the action chain, not just the conversation

A transcript may show what the user asked and what the model answered, but not which tool version ran, which identity was used, what policy decision was made, which downstream request was sent or whether the business record changed.

For each consequential tool call, capture a traceable event containing as appropriate:

Avoid recording secrets or unnecessary personal data in the name of observability. Logs need access controls, retention rules and redaction. The objective is reconstructability with data minimisation—not indiscriminate collection.

11. Reference architecture: place controls where they can be enforced

A practical enterprise pattern separates model reasoning from deterministic controls and business execution:

This is a logical pattern, not a requirement to deploy seven separate products. Smaller systems may combine components. The design principle is that identity, authorisation, business invariants and audit remain enforceable even when the model behaves unexpectedly.

12. Example: an AI agent connected to an ERP order workflow

Suppose a UK distributor wants an AI service-desk assistant to answer questions about orders and help resolve delivery problems. The assistant can query order status, draft a delivery-change request and submit an exception for approval.

User requestUnsafe shortcutSafer design
“Show me this customer’s order status.”Query ERP with a broad service account and return all matches.Resolve caller and tenant; authorise the specific order; return only required fields.
“Change delivery to tomorrow.”Let the model call a generic update-order tool directly.Validate dispatch state and carrier constraints; draft change; confirm material details; execute through a controlled workflow.
“Refund the customer because the email says the parcel was lost.”Treat email content as proof and invoke refund.Treat email as untrusted evidence; check shipment status and refund policy; route exceptions for approval.
Tool call times out after submission.Retry immediately and risk duplicate action.Check operation ID and upstream state; retry only if safe and idempotent.

The value of the agent is not reduced by these controls. They let the organisation delegate useful work without granting the model unrestricted authority over the ERP.

13. Production-readiness checklist

14. Common anti-patterns to avoid

“The gateway authenticates, so the tools are secure.” A gateway is one control point; the server and target application still need resource-level authorisation and business validation.

“The model will know which tools it may use.” Model behaviour is not access control. Enforce policy on every invocation.

“The tool is hidden, so nobody can call it.” Discovery is not enforcement. Assume a caller can attempt direct invocation.

“One service account is simpler.” A broad credential can collapse user-level permissions into the integration’s authority.

“A successful HTTP response means the business operation completed.” The upstream result and final business state may differ during timeouts and partial failures.

“We can add auditing later.” Without correlated events and operation IDs, incident reconstruction becomes guesswork.

Conclusion: standardise the connection, govern the authority

MCP can make it easier for AI applications to discover and use enterprise capabilities. That is precisely why the security model must extend beyond the protocol. The important question is not simply whether an agent can connect to an ERP or CRM. It is whether the organisation can constrain, observe and recover every meaningful action the agent is allowed to attempt.

A production-ready implementation combines identity-aware access, least privilege, invocation-time authorisation, governed tool contracts, untrusted-data handling, safe workflow execution and auditable outcomes. The model can propose the next step; deterministic controls should decide whether it is permitted, and the business system should remain authoritative about what actually happened.

The principle is straightforward: make capabilities easy to connect, but make authority difficult to misuse.

FAQ

MCP security is the set of identity, authorisation, validation, isolation, monitoring and operational controls used to protect AI clients and the tools or data exposed through Model Context Protocol servers.
MCP can be used in enterprise architectures, but security depends on the implementation and surrounding controls. Authentication alone is insufficient; each tool call needs appropriate authorisation, input validation, data protection and audit.
No. A gateway can enforce transport, identity, routing and policy controls, but prompt injection can influence a model’s proposed actions. Tool implementations and downstream services must reject unauthorised actions independently.
Sometimes, but the credential must be narrowly scoped and the server must preserve caller context and enforce permissions. A broad service account used for every caller can bypass user-level access boundaries.
No. Approval should be risk-based. Read-only queries and low-impact reversible actions may be automated; high-impact, irreversible or policy-sensitive actions may require confirmation or a separate approver.
Test allowed and denied paths, resource-level access, tenant isolation, schema changes, token audience validation, prompt injection, tool misuse, retries, timeouts, duplicate execution and audit completeness.