Set up and use Managed MCP Servers with AI agents.
The following guide demonstrates how to set up and use Managed MCP Servers with AI agents. It is split into two sections:
- Create the MCP Server: covers creating an MCP Server configuration and retrieving the MCP Server URL.
- Use the MCP Server with a client: covers connecting this MCP Server to a client.
Create the MCP Server
Create an API Client and get a bearer token
manage_mcp_servers:{projectKey} scope. You can create the API Client in the Merchant Center or by using the API Clients API.{projectKey} with your Project key:{
"name": "mcp-server-test",
"scope": "manage_mcp_servers:{projectKey}"
}
id, secret, and scope values. Use these values to get a bearer token using the Client credentials flow.Create an MCP Server configuration
When you create a Managed MCP Server configuration, you define which tools the AI agent can use. This example creates an MCP Server that can read Category and Product information.
all.{
"key": "my-mcp-server",
"state": "Enabled",
"mcpServer": {
"type": "CommerceMCP",
"majorVersion": "v4",
"tools": ["read_categories", "read_products"]
}
}
Disabled unless you set state to Enabled. A Disabled MCP Server rejects all tool requests. You can enable it later with the Set State update action.authenticationMode field defaults to ClientCredentials. To let each user sign in with their Identity account instead, set authenticationMode to CommercetoolsIdentity. For a comparison of both modes, see authentication modes.{
"key": "my-identity-mcp-server",
"state": "Enabled",
"authenticationMode": "CommercetoolsIdentity",
"mcpServer": {
"type": "CommerceMCP",
"majorVersion": "v4",
"tools": ["read_categories", "read_products"]
}
}
mcpServer.url. Note this URL, because you need it to connect your AI agent to the MCP Server.Use the MCP Server with a client
authenticationMode of the MCP Server. Three paths are available:- Static bearer token: fetch an access token yourself, then paste it into the client configuration.
This path requires
ClientCredentialsand an API Client. Use this option if your client does not support OAuth 2.0 discovery. See Authenticate with a static bearer token. - OAuth 2.0 client credentials discovery: your MCP client handles token exchange automatically.
This path requires
ClientCredentials, an API Client, and client support for the OAuth Client Credentials Extension. The API Clientidis used as the OAuthclient_id, and the API Clientsecretis used as the OAuthclient_secret. See Authenticate with OAuth 2.0 discovery. - Identity account: each user signs in with their own account, so there is no API Client to create.
This path requires
CommercetoolsIdentityand client support for OAuth 2.0 authorization code discovery. See Authenticate with an Identity account.
Create an API Client for the MCP Server
mcp:{projectKey}:{mcpServerKey}.accessTokenValiditySeconds. The maximum validity for MCP Servers is 30 days (2592000 seconds).{projectKey} with your Project key and {mcpServerKey} with your MCP Server key:{
"name": "mcp-server-client",
"scope": "mcp:{projectKey}:{mcpServerKey}",
"accessTokenValiditySeconds": 604800
}
In this example, the token validity is set to seven days (604800 seconds).
id, secret, and scope values.Authenticate with a static bearer token
accessTokenValiditySeconds value set when creating the API Client (maximum 30 days, or 2592000 seconds). To maintain connectivity after it expires, generate a new token using the same API Client credentials.The scope allows only machine-to-machine interaction; it doesn't allow access to the Merchant Center or a specific Store.
Connect to Claude Code
.mcp.json in the root of your repository with the following content:{
"mcpServers": {
"managed-mcp-servers": {
"type": "http",
"url": "<your-mcp-server-url>",
"headers": {
"Authorization": "Bearer <your-ctp-token>"
}
}
}
}
Restart Claude Code and your MCP Server will be available.
Connect to Cursor
{
"mcpServers": {
"managed-mcp-servers": {
"type": "http",
"url": "<your-mcp-server-url>",
"headers": {
"Authorization": "Bearer <your-ctp-token>"
}
}
}
}
Restart Cursor and your MCP Server will be available.
Connect to n8n
- In n8n, create a Bearer Auth credential with your API Client token.
- Download the n8n-example-categories.json example workflow file.
- Create a new workflow, then in the top right select ... > Import from file to import the workflow file.
- In the Fetch Categories node, assign the credential and replace the endpoint URL with your MCP Server URL.
https://<your-n8n-instance>/webhook/commerce-summary. You should see a list of categories from your Project.Authenticate with OAuth 2.0 discovery
Configure your client with the MCP Server URL and the API Client credentials:
- The API Client
idis the OAuthclient_id. - The API Client
secretis the OAuthclient_secret.
Authenticate with an Identity account
CommercetoolsIdentity authentication mode, each user signs in with their own Identity account, the same account they use for the Merchant Center. You don't need an API Client, and there are no credentials to create or paste.Configure your client with the MCP Server URL. The client discovers the authorization server from the MCP Server and opens a browser window, where the user signs in.
Your client must support OAuth 2.0 authorization code discovery. A client that only supports a static bearer token or the client credentials flow can't connect to an MCP Server in this mode.