Architecting Custom MCP Servers for Enterprise SSO from Day One

Shrihanshu Mishra

June 25, 2026

11 Mins

The rise of MCPs has redefined what AI agents can do, enabling seamless access to applications, databases, and business processes at scale. 

Most teams bolt SSO onto their custom MCP servers after launch. By the time they realise the mistake, they have already inherited identity debt that takes months to untangle: re-scoping tokens, re-testing every tool call, and fielding uncomfortable questions from security auditors about why AI-initiated actions had no audit trail.

The Model Context Protocol is moving fast. According to Anthropic's MCP specification, adoption across enterprise AI deployments has accelerated significantly as teams race to wire Claude and other AI models into internal tooling via MCP gateways. Speed is fine. Skipping the auth architecture is not.

TL;DR: SSO on a custom MCP server is not a configuration task you can schedule for Sprint 6. It is an architecture decision that touches the transport layer, the tool call boundary, and the connector model simultaneously. Get it right at the start, or spend 6 to 12 weeks retrofitting it under compliance pressure.

Planning a Custom MCP Server Deployment?

If your team is scoping a custom MCP server deployment and SSO is still an open item, Frugal Testing can help you design the auth layer before a single line of MCP server code is committed.

Why SSO Architecture Must Be a Day-One Decision for Custom MCP Servers

A senior security engineer at a mid-size SaaS company described their MCP auth situation to us like this: "We shipped in 6 weeks. Auth was service accounts and a promise to fix it later. Later is now, and it is 14 weeks of remediation." That pattern is more common than anyone publicly admits.

The cost delta between building enterprise controls into the transport layer from the start versus retrofitting post-launch is not marginal. According to NIST SP 800-63, inadequate identity and access controls are among the highest-risk categories in enterprise software deployments, and remediation costs routinely exceed initial implementation costs by a factor of three to five. In MCP deployments specifically, the problem compounds because there are multiple auth surfaces, not one.

The three failure modes we see repeatedly across enterprise MCP rollouts:

  • Unauthenticated tool calls reaching sensitive enterprise data - the MCP server validates the client connection, but not per-tool execution identity.
  • Token sprawl across MCP connectors - each connector running under a different service account with no centralised audit trail.
  • Missing audit trails for AI agent actions - a critical gap for SOC 2 Type II, incident response investigations, and FedRAMP obligations.

The Auth Surface Area Most Teams Miss in MCP Server Deployments.

Custom MCP server deployments have four distinct auth layers, and most teams protect only one:

  • Transport Layer - Secure how data moves between client and server (stdio vs Streamable HTTP) or every layer behind it is exposed.
  • Tool Call Execution - Authenticate each tool call independently to prevent misconfigured connectors from triggering unintended actions.
  • Resource Access - Files, databases, and APIs need their own access controls; one shared policy means one breach unlocks everything.
  • Session Management - Isolate and time-bound sessions; a hijacked session becomes a persistent backdoor into your AI workflows.

Each layer needs a separate auth policy. That is not over-engineering. That is the minimum viable security model for any enterprise AI system connecting to production data.

The MCP Architecture Stack for Enterprise Deployments

The canonical Model Context Protocol architecture has four components: the host (typically Claude or an enterprise AI platform), the MCP client embedded in the host, one or more MCP servers, and the transport layer connecting them. What most tutorials omit is the identity and access management fabric that enterprise deployments require across all four layers.

In a production deployment, a custom MCP server does not sit in isolation. It sits inside an existing service mesh, behind an API gateway, and downstream of an identity provider. The MCP server auth model must integrate with that fabric. Architectures such as the Tetrate Agent Router Enterprise and patterns described under Enterprise MCP Patterns in the broader AI agent ecosystem assume exactly this kind of layered identity model.

Enterprise MCP Architecture

How MCP Clients and Hosts Authenticate to Custom MCP Servers

The MCP host initiates the connection. The MCP client presents credentials to the MCP server. The server validates them. In enterprise practice, what "credentials" means depends on whether you are dealing with machine-to-machine auth (service accounts, M2M tokens) or user-delegated auth where a human's identity flows through an OAuth 2.0 authorisation code exchange.

Most enterprise MCP deployments need both. Background AI workflows run under service accounts. Interactive Claude sessions with user context require user-delegated tokens so the audit log captures who actually initiated the AI action, not which service account the MCP server runs under. This distinction matters directly for incident response: when something goes wrong, "the MCP server did it" is not a sufficient audit trail.

Critically, API keys should never serve as the long-term auth mechanism for production MCP servers. They do not carry user identity, they do not expire cleanly, and they create exactly the token sprawl problem that security reviews flag first.

MCP Transport Layer: stdio vs Streamable HTTP and Their Auth Implications

stdio transport is in-process. Lower attack surface, suitable for local and single-user deployments.

Streamable HTTP transport is network-exposed. Every enterprise multi-user MCP deployment that runs the server remotely follows this path, which means TLS termination, bearer token validation at the API gateway, and rate limiting are mandatory entry points before the server handles any request. Resource Indicators (RFC 8707) and Protected Resource Metadata allow MCP servers to declare their token requirements explicitly, making Client ID Metadata Documents and JWT validation at the gateway boundary automatable rather than manually configured per deployment.

Integrating Enterprise SSO with Custom MCP Servers: Protocol-Level Decisions

Two protocols dominate enterprise SSO for MCP server auth: SAML 2.0 for legacy IdP integrations and OIDC/OAuth 2.0 for modern cloud-native deployments. OIDC maps more cleanly to the token-based auth model that MCP servers use natively, and it supports Passwordless Authentication flows that enterprises are increasingly mandating as part of their zero-trust architecture programmes.

The token flow we implement: IdP issues an auth code, MCP client exchanges for an access token, the token carries JWT claims that the MCP server validates, claims map to per-tool scope authorisation before any tool call executes. No exceptions for "internal" tools. No wildcard scopes at the server level.

Self-Service SSO and Custom Domain support are worth building into the MCP server auth layer from the start, particularly for multi-tenant deployments where Enterprise Connection configuration per tenant is a recurring operational requirement rather than a one-time setup.

OIDC and OAuth 2.0 authentication flow
OpenID Connect
End User
OAuth Client
OAuth Server
Initiate Request Authorization Authenticate & Authorize Authorization Code Authorization Code Authorization Code Access Token + ID Token UserInfo API User ID etc.

OAuth 2.0 Scopes and Token Binding for MCP Tool Call Authorisation

Per-tool OAuth scopes become manageable with a scope taxonomy: resource-level scopes that map to tool groups. For example, mcp:read:crm covers all CRM read tools; mcp:write:db covers all database write tools. Fewer than 20 scopes cover most deployments while maintaining least-privilege enforcement at the tool call boundary. Tool Output Schemas should be validated against the token's scope claims at execution time, not assumed to be safe because the connection was authenticated.

Multi-Factor Authentication enforcement should be confirmed at the IdP level for all MCP server access paths. MFA gaps are consistently the first finding in security reviews of enterprise AI system deployments.

SAML 2.0 and OIDC for Enterprise IdP Integration

Connecting Okta, Azure Active Directory, or Ping Identity as the upstream IdP for a custom MCP server is largely a configuration exercise. The IdP exposes an OIDC endpoint; the MCP server's auth middleware validates the JWT against the IdP's JWKS endpoint. The common failure point is SAML assertion mapping: teams map the wrong claims, the MCP server receives an incomplete identity context, and Tenant isolation breaks during re-auth events, exposing one tenant's context to another's session.

Verify claim mapping in staging with a realistic IdP configuration before any production traffic touches the server.

Our Take: OIDC is the right choice for new MCP server deployments. SAML is valid where IdP constraints require it. Do not run both simultaneously on the same MCP server without an abstraction layer between them. The mapping complexity surfaces at the worst possible time, typically during an incident response exercise when audit trails need to be reconstructed quickly.

Need Help Validating MCP SSO Before Production?

Frugal Testing helps engineering teams validate OIDC, SAML claim mapping, IdP integration, and tenant isolation before custom MCP servers go live.

AWS MCP Server Architecture: Auth Patterns for IAM-Integrated Deployments

AWS-hosted custom MCP servers have a native auth path that many teams underuse. AWS IAM roles, instance profiles, and STS AssumeRole handle machine-to-machine auth without exposing long-lived credentials or API keys. For an ECS task or Lambda function running an MCP server, the IAM role attached to the compute resource is the service identity.

For external access with user-delegated identity, the architecture adds an API Gateway with a Lambda Authoriser or Cognito in front of the MCP server's Streamable HTTP endpoint. According to AWS IAM Identity Center documentation, IAM Identity Centre federated with Okta or Azure AD is the recommended pattern for enterprises that need both cloud-native IAM and user-delegated identity. Standalone AWS IAM without an external IdP does not carry an auditable user context for interactive AI agent sessions.

AWS hosted MCP server architecture using IAM

AWS IAM Role Design for Custom MCP Servers

One IAM role per MCP server with broad resource permissions is the anti-pattern that security reviews flag without exception. The correct pattern: one IAM role per logical tool group, scoped to specific AWS resources via resource-based policies and condition keys.

This matters beyond compliance. The Merge Agent Handler pattern, used in multi-agent MCP deployments where one AI agent orchestrates others, relies on each agent having a correctly scoped identity. If the orchestrating agent's IAM role has excessive permissions, lateral movement across AI workflows becomes trivial the moment any tool call boundary is misconfigured.

For enterprises connecting MCP servers to Google Workspace or other SaaS platforms, analytics access and enterprise data permissions should be scoped at the connector level, not inherited from the MCP server's root identity. Vendor lock-in risk also concentrates here: connectors that bind directly to a single IdP without an abstraction layer make future IdP migration significantly more expensive.

Identity Management Architecture: Choosing the Right Approach

Approach Best For Auth Overhead Compliance Fit Complexity
Centralised IdP (Okta/Azure AD) Single-tenant enterprise Low SOC 2, HIPAA Medium
Federated Mesh Multi-tenant / multi-cloud Medium FedRAMP, PCI DSS High
Embedded Auth Service Greenfield AI platforms High Custom Very High
AWS IAM Identity Centre AWS-native deployments Low to Medium SOC 2, FedRAMP Medium

The centralised IdP approach is right for most US enterprise teams. It reuses existing IdP investment, produces a clean audit trail, and integrates with MCP server auth middleware without bespoke engineering. Federated mesh is the correct choice for organisations running AI agents across multiple cloud environments with different identity fabrics.

Which approach fits your team?

  1. Single-tenant, SOC 2 obligations, existing Okta or Azure AD investment? Centralised IdP.
  2. Multi-tenant SaaS product with per-customer Enterprise Connection requirements? Federated mesh.
  3. Greenfield AI platform, full control over identity stack? Embedded auth service.
  4. AWS-native deployment, IAM already in use? AWS IAM Identity Centre with external IdP federation.

Key Takeaways

  • SSO on custom MCP servers must be architected at the transport, tool call, and connector layer simultaneously. Doing one without the others leaves exploitable gaps in AI workflows.
  • OIDC/OAuth 2.0 with JWT validation and per-tool scope mapping is the right protocol choice for most enterprise MCP deployments.
  • API keys should never be the long-term auth mechanism for production MCP servers; they do not carry user identity and create token sprawl that fails incident response investigations.
  • Tenant isolation, Multi-Factor Authentication enforcement, and Passwordless Authentication support are not future enhancements; they are baseline requirements for enterprise AI systems today.
  • A day-one SSO implementation takes 2 to 4 weeks. A retrofit after launch takes 6 to 12 weeks once scope re-mapping, re-testing, and audit trail remediation are factored in

How Frugal Testing Architects Custom MCP Servers with Enterprise SSO

Two sprints from launch, with auth still running on hardcoded service accounts, is the most common trigger for the conversations we have with enterprise engineering teams.

We audit the existing identity stack, design the MCP-specific auth layer, including Tenant isolation and Self-Service SSO where required, implement it in the client's environment, and validate every tool call boundary with automated security tests. Engineering teams we have worked with have shipped MCP servers with SSO-ready auth in under three weeks and passed their first SOC 2 evidence review without auth-related findings.

For security testing for enterprise software and QA for AI applications and agent tooling, the auth layer is not a separate workstream. It is part of the delivery from commit one.

Will Your MCP Auth Design Pass Security Reviews?

We have helped engineering teams at US enterprises design and validate MCP server auth from the first sprint. If SSO is still an open item in your MCP build, talk to the Frugal Testing team.

Conclusion

The Model Context Protocol has moved enterprise AI infrastructure from experimental to production faster than most security teams anticipated. Custom MCP servers built with enterprise SSO from day one are more secure, more auditable, and faster to compliance sign-off than those that treat auth as a Phase 2 item. The architecture decisions are not complicated once made correctly at the start: OIDC over SAML where possible, JWT validation at the transport boundary, per-tool scope mapping, Tenant isolation for multi-tenant deployments, and connector auth passthrough verification before any AI agent touches production data.

What makes it hard is not technical complexity. It is the organisational habit of shipping first and securing later. MCP deployments, more than most AI systems, cannot afford that habit.

If your team is scoping a custom MCP server build and SSO is still an open item, this is the right time to close it.

People Also Ask (FAQs)

Q1. Can we use our existing Okta or Azure AD deployment as the IdP for a custom MCP server without rebuilding our identity stack?

Ans: Yes. Both expose OIDC endpoints that map cleanly to MCP server auth requirements via OAuth 2.0 authorisation code flow and JWT validation. It is configuration work, not re-architecture.

Q2. Is AWS IAM sufficient for enterprise SSO on AWS-hosted custom MCP servers, or do we need an external IdP?

Ans: AWS IAM covers machine-to-machine auth adequately, but user-delegated access with auditable identity context requires IAM Identity Centre federated with an external IdP like Okta or Azure AD.

Q3. How do we scope OAuth tokens per the MCP tool without managing hundreds of individual scopes?

Ans: Use a resource-level scope taxonomy mapping to tool groups, such as mcp:read:crm or mcp:write:db, and validate Tool Output Schemas against those scopes at execution time. Most deployments need fewer than 20 scopes.

Q4. Does Anthropic's MCP spec mandate a specific auth protocol, or can we bring our own?

Ans: The MCP spec defines transport and message format only; auth is the implementer's responsibility. That flexibility is an advantage, but it also means every MCP server ships without security unless the implementer builds the auth layer in deliberately.

Q5. What compliance frameworks apply to the enterprise MCP server SSO?

Ans: SOC 2 Type II is the baseline, covering access control and audit logging. HIPAA applies if health data flows through the MCP tool calls. FedRAMP applies to federal deployments. Layer SOC 2 first, then add framework-specific controls per your regulatory obligations.

Shrihanshu Mishra

Rupesh Garg

Founder and principal architect at Frugal Testing, a SaaS startup in the field of performance testing and scalability. Possess almost 2 decades of diverse technical and management experience with top Consulting Companies (in the US, UK, and India) in Test Tools implementation, Advisory services, and Delivery. I have end-to-end experience in owning and building a business, from setting up an office to hiring the best talent and ensuring the growth of employees and business.

Our blog

Latest blog posts

Discover the latest in software testing: expert analysis, innovative strategies, and industry forecasts
Software Architecture

Architecting Custom MCP Servers for Enterprise SSO from Day One

Shrihanshu Mishra
June 25, 2026
5 min read
Automation Testing

The Ultimate Guide to Selenium Test Script Generation with Claude

Mayank Gahlot
June 25, 2026
5 min read