Ana içeriğe geç

MCP Call Policy

General Information​

Policy Types​

Two variants share the same inline server definition and differ only in who chooses the tool.

ai-mcp-call-llm
ai-mcp-call-fixed
TypeWho picks the tool
ai-mcp-call-llmThe model picks it from its own tool-use response. The policy may narrow the choice with an allow-list.
ai-mcp-call-fixedYou pin one tool by name and supply an argument template.
Renamed in 2026.04

The wire values were renamed so they state who picks the target. The former values ai-mcp-tool-call and ai-mcp-tool-invoke are still accepted on import, so packages exported before the rename keep working.

Endpoints​

List Policies​

GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/

Add Policy​

POST /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Update Policy​

PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Delete Policy​

DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

The Inline MCP Server​

mcpServer is the only way to define the backend MCP server, and a non-blank endpoint is required. There is no reference to a separate, shared connection object: an MCP server is not a standalone resource, and the endpoints that used to manage one are retired. A policy that omits mcpServer, or supplies one with a blank endpoint, is rejected with 400.

Why inline

Because the definition travels with the policy, exporting or importing the policy carries its server with it, and two policies pointing at the same URL stay independent — rotating a credential on one never disturbs the other. See MCP Gateway for the full picture.

Fields​

FieldTypeRequiredDescription
endpointstringYesBase URL of the MCP server. Must be non-blank.
transportstringNoHTTP_SSE (default) or STDIO.
mcpProtocolVersionstringNoProtocol version advertised on initialize. Left empty, the server's own version is accepted.
allowPrivateNetworkEgressbooleanNoPermits the endpoint to resolve to any address, including private, loopback and cloud metadata addresses, and allows plain http. Off by default (https only, private and reserved ranges blocked).
authSchemestringNoNONE (default), BEARER, OAUTH2_CLIENT_CREDENTIALS, OAUTH2_TOKEN_EXCHANGE, MTLS, API_KEY or BASIC. See Backend Authentication.
bearerTokenstringConditionalRequired for BEARER. Write-only, see Secret fields.
credentialRefstringNoName of a stored credential to use instead of an inline token.
tokenEndpointstringConditionalRequired for OAUTH2_CLIENT_CREDENTIALS and OAUTH2_TOKEN_EXCHANGE.
clientIdstringConditionalRequired for OAUTH2_CLIENT_CREDENTIALS and OAUTH2_TOKEN_EXCHANGE.
clientSecretstringConditionalRequired for OAUTH2_CLIENT_CREDENTIALS and OAUTH2_TOKEN_EXCHANGE. Write-only, see Secret fields.
scopestringNoSpace-separated scopes requested for OAUTH2_CLIENT_CREDENTIALS and OAUTH2_TOKEN_EXCHANGE.
tokenExchangeAudiencestringNoAudience requested for OAUTH2_TOKEN_EXCHANGE. Empty uses the default of the authorization server.
apiKeyHeaderNamestringConditionalRequired for API_KEY. Name of the header that carries the key.
apiKeystringConditionalRequired for API_KEY. Write-only, see Secret fields.
basicUsernamestringConditionalRequired for BASIC. Cannot contain a colon.
basicPasswordstringConditionalRequired for BASIC. Write-only, see Secret fields.
mTLSSettingsobjectConditionalClient certificate settings, required for MTLS.
capabilityCacheEnabledbooleanNoCaches the discovered tool catalog. Enabled by default.
capabilityCacheTtlSecondsintegerNoCatalog cache lifetime in seconds. Default 300.
driftPolicystringNoWARN_ONLY or FAIL_CLOSED. Decides what happens when the server's tool catalog changes after discovery.
credentialMappingRefstringNoName of a credential mapping used to forward the caller's own identity to the server.

Secret fields​

bearerToken, clientSecret, apiKey and basicPassword follow the platform's standard secret handling.

  • On a GET or list response they are always masked as null. Read-only booleans report whether a value is stored: mcpServerBearerTokenSet, mcpServerClientSecretSet, mcpServerApiKeySet and mcpServerBasicPasswordSet. They are ignored if you send them on a write.
  • On POST or PUT, omit the field entirely to keep the stored value. Send a plaintext value only when the secret genuinely changes. Sending null or an empty string clears it.

Server-managed fields​

The discovered catalog, health state and drift state belong to the platform. Any value submitted for them is discarded on write and the persisted state is kept:

discoveredTools toolsParsedAt
healthStatus lastHealthCheckAt healthMessage
pinnedCatalogHash driftDetected driftMessage

driftPolicy is not in this group — it is your setting and is honoured as sent.

To inspect a server's catalog without persisting anything, use Discover MCP Policy Tools.

Allow-list behaviour​

Dispatch is fail-closed: a tool runs only when something explicitly vetted it. The discovered catalog and allowedToolNames are combined as follows.

Discovered catalogallowedToolNamesResult
Empty or unavailableEmptyDenied. Nothing has vetted the name, so no call is dispatched.
Non-emptyEmptyAllowed if the tool is in the discovered catalog. Discovery alone governs.
Non-emptyNon-emptyAllowed only if the tool is in both. The policy list narrows the catalog and can never widen it.
Empty or unavailableNon-emptyAllowed if the tool is in allowedToolNames. A server that cannot be discovered is still usable through an explicit list.
Warning

An empty allowedToolNames is not a blanket "allow everything" — it defers to discovery. If discovery has never succeeded, every call is denied.


List Policies​

Endpoint​

GET /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}
Content-Typeapplication/json

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name

Response​

Success Response (200 OK)​

{
"status": "SUCCESS",
"resultList": [
{
"apiProxy": {
"name": "MyAiProxy",
"requestPolicyList": [
{
"type": "ai-mcp-call-llm",
"name": "crm-tools",
"description": "CRM tool calls for the support assistant",
"active": true,
"enabled": true,
"mcpServer": {
"endpoint": "https://mcp.internal.example.com/sse",
"transport": "HTTP_SSE",
"authScheme": "BEARER",
"bearerToken": null,
"capabilityCacheEnabled": true,
"capabilityCacheTtlSeconds": 300,
"driftPolicy": "WARN_ONLY"
},
"mcpServerBearerTokenSet": true,
"mcpServerClientSecretSet": false,
"toolCallTimeoutMs": 30000,
"parallelToolCalls": true,
"allowedToolNames": ["search_customer", "create_ticket"]
}
],
"responsePolicyList": [],
"errorPolicyList": []
}
}
],
"resultCount": 1
}
Masked secrets in a read

bearerToken comes back as null while mcpServerBearerTokenSet reports true — the secret is stored, it is simply never returned.

cURL Example​

curl -X GET \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAiProxy/policies/" \
-H "Authorization: Bearer YOUR_TOKEN"

Add Policy​

Endpoint​

POST /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}
Content-Typeapplication/json

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name
policyNamestringYesPolicy name

Request Body​

Full JSON Body Example — Model Picks the Tool​
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "ai-mcp-call-llm",
"description": "CRM tool calls for the support assistant",
"active": true,
"enabled": true,
"mcpServer": {
"endpoint": "https://mcp.internal.example.com/sse",
"transport": "HTTP_SSE",
"authScheme": "BEARER",
"bearerToken": "PLAINTEXT_TOKEN",
"allowPrivateNetworkEgress": false,
"capabilityCacheEnabled": true,
"capabilityCacheTtlSeconds": 300,
"driftPolicy": "WARN_ONLY"
},
"toolCallTimeoutMs": 30000,
"parallelToolCalls": true,
"allowedToolNames": ["search_customer", "create_ticket"],
"argumentConstraints": [
{
"argumentPath": "customer.email",
"ruleType": "REGEX",
"value": "^[^@]+@example\\.com$"
}
]
}
}
Full JSON Body Example — Pinned Tool​
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 2
},
"policy": {
"type": "ai-mcp-call-fixed",
"description": "Always enrich the request with the customer record",
"active": true,
"enabled": true,
"mcpServer": {
"endpoint": "https://mcp.internal.example.com/sse",
"transport": "HTTP_SSE",
"authScheme": "OAUTH2_CLIENT_CREDENTIALS",
"tokenEndpoint": "https://idp.example.com/oauth2/token",
"clientId": "apinizer-gateway",
"clientSecret": "PLAINTEXT_SECRET",
"scope": "mcp.read mcp.write"
},
"targetToolName": "search_customer",
"argumentsTemplate": "{\"email\": \"${request.header.x-customer-email}\"}",
"waitMode": "SYNC_TO_VARIABLE",
"outputVariableName": "customerRecord",
"callTimeoutMs": 30000
}
}

Common Body Fields​

FieldTypeRequiredDescription
typestringYesai-mcp-call-llm or ai-mcp-call-fixed.
descriptionstringNoFree-text description.
activebooleanNoWhether the policy takes part in the pipeline.
enabledbooleanNoWhether the tool call itself is enabled. Default true.
mcpServerobjectYesInline server definition. See The Inline MCP Server.
identityAclarrayNoIdentity access rows. Each row names a principal (principalType, principalName) and its allow and deny lists. If the list has rows, a call is allowed only when a row allows the caller's identity. An empty list means no identity check. A write replaces the whole list: an omitted identityAcl is stored as an empty list.
tokenForwardSettingsobjectNoForwards the client's own token to the backend: token source, audience allow-list and whether to strip the gateway credential. null means not configured.
argumentConstraintsarrayNoValidation rules applied to the resolved tool-call arguments before dispatch. Each entry carries an argumentPath in dot notation, a ruleType of REGEX, MAX_LENGTH, ENUM or REQUIRED, and its value. Empty means no validation.

Fields for ai-mcp-call-llm​

FieldTypeRequiredDescription
toolCallTimeoutMsintegerNoPer-tool-call HTTP timeout in milliseconds. Default 30000.
parallelToolCallsbooleanNoDispatches several tool calls at once. Default true.
allowedToolNamesarrayNoAllow-list narrowing what the model may call, as a subset of the discovered catalog. See Allow-list behaviour — an empty list is not the same as "allow everything".

Fields for ai-mcp-call-fixed​

FieldTypeRequiredDescription
targetToolNamestringYesName of the single tool to invoke. Must be non-blank.
argumentsTemplatestringNoJSON template for the tool arguments. Variables are resolved at request time.
waitModestringNoFIRE_AND_FORGET (default) returns without waiting; SYNC_TO_VARIABLE waits and stores the result.
outputVariableNamestringNoName of the variable that receives the result. Only meaningful under SYNC_TO_VARIABLE; it is not enforced, so a SYNC_TO_VARIABLE policy without it is accepted and simply stores nothing.
callTimeoutMsintegerNoCall timeout in milliseconds. Default 30000.

Response​

Success Response (200 OK)​

{
"status": "SUCCESS",
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}

Error Responses​

CodeReason
400Blank name; missing mcpServer; mcpServer.endpoint blank; targetToolName blank on ai-mcp-call-fixed; proxy not found.
401Missing or invalid token.
403The token's account lacks permission on the project.

cURL Example​

curl -X POST \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAiProxy/policies/crm-tools/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "ai-mcp-call-llm",
"description": "CRM tool calls",
"active": true,
"mcpServer": {
"endpoint": "https://mcp.internal.example.com/sse",
"transport": "HTTP_SSE",
"authScheme": "BEARER",
"bearerToken": "PLAINTEXT_TOKEN"
},
"allowedToolNames": ["search_customer"]
}
}'

Update Policy​

Endpoint​

PUT /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Request​

The body is the same shape as Add Policy. The update replaces the policy, so send the fields you want to keep.

Keeping a stored secret

Omit bearerToken and clientSecret to preserve what is already stored. A read response masks them as null, so echoing a response back unchanged would clear them. Check mcpServerBearerTokenSet, mcpServerClientSecretSet, mcpServerApiKeySet and mcpServerBasicPasswordSet to see whether a value exists.

Full JSON Body Example — Widening the Allow-List​
{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"],
"order": 1
},
"policy": {
"type": "ai-mcp-call-llm",
"description": "CRM tool calls for the support assistant",
"active": true,
"mcpServer": {
"endpoint": "https://mcp.internal.example.com/sse",
"transport": "HTTP_SSE",
"authScheme": "BEARER",
"capabilityCacheTtlSeconds": 600,
"driftPolicy": "FAIL_CLOSED"
},
"allowedToolNames": ["search_customer", "create_ticket", "close_ticket"]
}
}

Response​

Success Response (200 OK)​

{
"status": "SUCCESS",
"deploymentResult": {
"success": true,
"deploymentResults": [
{
"environmentName": "production",
"success": true,
"message": "Deployment successful"
}
]
}
}

cURL Example​

curl -X PUT \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAiProxy/policies/crm-tools/" \
-H "Authorization: Bearer YOUR_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"operationMetadata": {
"targetScope": "ALL",
"targetPipeline": "REQUEST",
"deploy": true,
"deployTargetEnvironmentNameList": ["production"]
},
"policy": {
"type": "ai-mcp-call-llm",
"active": true,
"mcpServer": {
"endpoint": "https://mcp.internal.example.com/sse",
"authScheme": "BEARER",
"driftPolicy": "FAIL_CLOSED"
},
"allowedToolNames": ["search_customer", "create_ticket", "close_ticket"]
}
}'

Delete Policy​

Endpoint​

DELETE /apiops/projects/{projectName}/apiProxies/{apiProxyName}/policies/{policyName}/

Request​

Headers​

HeaderValue
AuthorizationBearer {token}

Path Parameters​

ParameterTypeRequiredDescription
projectNamestringYesProject name
apiProxyNamestringYesAPI Proxy name
policyNamestringYesPolicy name

Response​

Success Response (200 OK)​

{
"status": "SUCCESS"
}

cURL Example​

curl -X DELETE \
"https://demo.apinizer.com/apiops/projects/MyProject/apiProxies/MyAiProxy/policies/crm-tools/" \
-H "Authorization: Bearer YOUR_TOKEN"

Notes and Warnings​

  • The inline server is the only target. There is no field that points at a shared, standalone MCP server, and the endpoints that used to manage one are retired. A configuration created before this change is migrated automatically: the server it referenced is copied into the policy on upgrade.
  • Shared servers become independent copies. If several policies referenced the same server before the migration, each now owns its own copy, credential included. Rotating that credential is a per-policy operation.
  • An empty allow-list defers to discovery, it does not open the door. With no discovered catalog and no allowedToolNames, every call is denied. See Allow-list behaviour.
  • Egress to private addresses is refused by default. Set allowPrivateNetworkEgress deliberately, and only for a server you control. When on, no address class is blocked, including the cloud metadata address.
  • A drift policy of FAIL_CLOSED stops calls when the catalog changes. Prefer it for regulated traffic; prefer WARN_ONLY while a server is still evolving.