Create Authentication Policy

Configure an MCP policy to secure your MCP Server with authentication and authorization.

Enable the Policies Snap Pack

MCP policies are available in your Org when you subscribe to the APIM feature and the Policies Snap Pack. Despite its name, the Policies Snap Pack does not contain Snaps, but it functions like other Snap Packs. You can configure the Snap Pack to use one of the following two distributions:

  • Stable: Contains policies that have been available for a few releases. This distribution is updated on the quarterly release.
  • Latest: Contains the newest policies and policy features. This distribution is typically updated every month.

The distributions are determined by the Snaplex version updates, which coincide with the monthly and quarterly releases. For more information, see:

MCP Servers use policies for authentication. MCP uses the same policy builder that APIM 3.0 does. The policy builder contains a suite of authentication, authorization, validation, traffic shaping, and transformation rules. These rules compose the policy. You can use existing rules or policies created for APIM Services or create new ones specifically for MCP. This topic covers creating policies for MCP Server authentication.

Available authentication methods for MCP:

  • MCP OAuth2 Client Credentials Policy: For application-to-application authentication
  • MCP OAuth2 JWT Validator Policy: For validating JWT tokens from identity providers
  • API Key Authenticator: Simple token-based authentication
  • Anonymous Authenticator: No authentication (development only)
  • MCP Token Exchange rule: Exchanges the caller's inbound bearer token for a per-tool scoped token via RFC 8693 OAuth 2.0 Token Exchange. Applied under the Transform tab after authentication. Use this to scope credentials to each tool's target system without building token-exchange logic into individual tool pipelines.
  1. Open the Policy Catalog.
    1. Click the Waffle menu in the top right corner, then click APIM.
      The API Management home page opens.
    2. On the left navigation pane, click Policy Catalog.
      The Policy Manager UI opens.
    3. Click Create Policy to create a new policy.


    4. Enter a Name for the policy (such as MCP OAuth2 Policy).
    5. Enter a Description describing the policy's purpose.
  2. Add Rules.
    1. Click Add Rule to add authentication rules to the policy.
    2. Select the rule type based on your authentication method:
      MCP OAuth2 Client Credentials Validates OAuth2 tokens using the client credentials flow. Configure with your authorization server's token endpoint and client credentials.
      MCP OAuth2 JWT Validator Validates JWT tokens against an authorization server's JWKS endpoint. Set the Auth domain to your authorization server URL; the rule discovers the JWKS endpoint by appending .well-known/openid-configuration to the URL (OpenID Connect), falling back to .well-known/oauth-authorization-server (OAuth 2.0 Authorization Server Metadata, RFC 8414).
      API Key Authenticator Validates API keys passed in headers or query parameters. Configure the expected key name and valid keys.
      Anonymous Authenticator Allows unauthenticated access. Use only for development or internal testing.
      Authorize by Role Used with Anonymous Authenticator. Defines user roles.
      MCP Token Exchange Found under the Transform tab. Exchanges the inbound bearer token for a tool-specific token using RFC 8693. Configure the STS endpoint, client credentials, exchange mode (Impersonation or Delegation), and optional per-tool routing via Tool Mappings. See MCP Token Exchange rule for full settings reference.
    3. Add additional rules as needed:

      Common rules for MCP Servers:

      • IP Restriction: Limit access to specific IP addresses or ranges
      • Client Throttling: Rate limit requests per client
      • Request Size Limit: Limit the size of incoming requests
      • CORS Restriction: Configure cross-origin resource sharing


  3. Configure MCP Policy using OAuth2 Client Credentials
    1. In the MCP OAuth2 Client Credentials rule, configure the following fields:
      • Token Endpoint URL: Your authorization server's token endpoint
      • Client ID: The OAuth2 client identifier
      • Client Secret: The OAuth2 client secret
      • Scope: Required OAuth2 scopes
      • Auth Domain: The domain URL for fetching authorization endpoint URLs
      • Extract Keys from URL: URL to dynamically fetch signing keys for token validation
      • Extract User Info:
        • User ID Expression: Expression that returns the user ID from the token claims
        • Roles Expression: Expression that returns the roles from the token claims

    2. For the Authorize by Role rule, add the following Roles and Conditions:
      Role Condition
      mcp:access true
      read:data true
      write:data true

  4. Configure an MCP Policy to generate a JSON Web Token for Authentication
    1. In the MCP OAuth2 JWT Validator rule, configure the following fields:
      • Auth Domain: The domain URL for fetching authorization endpoint URLs
      • Extract Keys from URL: URL to dynamically fetch signing keys for token validation
      • Extract User Info:
        • User ID Expression: Expression that returns the user ID from the JWT token claims
        • Roles Expression: Expression that returns the roles from the JWT token claims

    2. For the Authorize by Role rule, add the following Roles and Conditions:
      Role Condition
      oauth

  5. Configure an MCP Token Exchange rule
    1. In the Transform tab, select the MCP Token Exchange rule and configure the following required fields:
      • Token Endpoint: The STS token endpoint URL.
      • Client ID and Client Secret: Credentials the policy uses to authenticate the exchange request.
      • Exchange Mode: Select IMPERSONATION (default) or DELEGATION. Delegation adds an act claim recording the gateway identity and requires additional IdP setup.
      • Audience, Scope, Resource: Target parameters for the exchanged token. Configure at the policy level for a uniform token, or override per tool using Tool Mappings.
    2. Optionally, add rows to Tool Mappings to route different tools to different STS endpoints or audiences.

      Each row specifies a boolean Match Condition expression (for example, $toolName == 'get_weather' or $toolName.startsWith('salesforce_')). The first matching row's overrides apply; unmatched tools fall back to the global values.

    For complete field descriptions, see MCP Token Exchange rule.

  6. Configure an MCP Policy for Anonymous Authentication
    1. For Anonymous Authenticator, in the Role field, add anonymous.

    2. For Authorize by Role, configure the following fields.
      • Role: The role for the authorized user. For anonymous authenticator, add anonymous.
      • Condition: Add a condition, if any, as an expression.

  7. Save the Policy.
    1. Review the policy configuration.
    2. Click Save to save the policy.

      The policy is now available for use with MCP Servers.

Your authentication policy is now created and can be selected when configuring MCP Servers.

Note: Not all APIM rules are compatible with MCP Server. When selecting a policy in the MCP Server configuration, incompatible rules are marked with a red cross.

After creating the policy, return to Register MCP Server to select this policy for your MCP Server.