Essentials MCP

Enable AI agents and assistants to integrate seamlessly with Composable Commerce through standardized function calling.

With Essentials MCP, agents can retrieve product information, manage carts and orders, handle customer data, and execute other Composable Commerce workflows. The toolkit supports both read-only access for safe operations and full CRUD functionality for advanced use cases.

Placeholder values

This guide uses the following placeholders in examples. You should replace these placeholders with the following values.

If you do not have an API Client, follow our Get your API Client guide.
PlaceholderReplace withFrom
{PROJECT_KEY}project_keyyour API Client
{CLIENT_ID}client_idyour API Client
{CLIENT_SECRET}secretyour API Client
{ACCESS_TOKEN}access_tokenan existing access token (when using auth_token authentication type)
{AUTH_URL}your Authorization URLRequest an access token using the Composable Commerce OAuth 2.0 service
{API_URL}your API URLHosts

Authentication Types

Essentials MCP supports two authentication types:

  • client_credentials: uses client ID and client secret to obtain an access token.
  • auth_token: uses an existing access token.

Choose the authentication type that best fits your use case and provide the corresponding credentials.

The following examples use client_credentials authentication. You can alternatively use auth_token authentication by:
  • Setting --authType=auth_token (or type: 'auth_token' in TypeScript)
  • Replacing --clientId and --clientSecret with --accessToken=ACCESS_TOKEN

Setup STDIO Transport MCP Server

Installation

To run Essentials MCP using npx, use one of the following commands depending on the tools you need.
Set up all available toolsbash
npx -y @commercetools/mcp-essentials \
  --tools=all \
  --authType=client_credentials \
  --clientId=CLIENT_ID \
  --clientSecret=CLIENT_SECRET \
  --projectKey=PROJECT_KEY \
  --authUrl=AUTH_URL \
  --apiUrl=API_URL
Set up all read-only toolsbash
npx -y @commercetools/mcp-essentials \
  --tools=all.read \
  --authType=client_credentials \
  --clientId=CLIENT_ID \
  --clientSecret=CLIENT_SECRET \
  --projectKey=PROJECT_KEY \
  --authUrl=AUTH_URL \
  --apiUrl=API_URL
Configure a specific tool (products.read and products.create)bash
# To set up specific tools
npx -y @commercetools/mcp-essentials \
  --tools=products.read,products.create \
  --authType=client_credentials \
  --clientId=CLIENT_ID \
  --clientSecret=CLIENT_SECRET \
  --projectKey=PROJECT_KEY \
  --authUrl=AUTH_URL \
  --apiUrl=API_URL

Using auth_token authentication

Set up all available tools with auth_tokenbash
npx -y @commercetools/mcp-essentials \
  --tools=all \
  --authType=auth_token \
  --accessToken=ACCESS_TOKEN \
  --projectKey=PROJECT_KEY \
  --authUrl=AUTH_URL \
  --apiUrl=API_URL

Use with Claude Desktop

{
  "mcpServers": {
    "commercetools": {
      "command": "npx",
      "args": [
        "-y",
        "@commercetools/mcp-essentials@latest",
        "--tools=all",
        "--isAdmin=true",
        "--authType=client_credentials",
        "--clientId=CLIENT_ID",
        "--clientSecret=CLIENT_SECRET",
        "--authUrl=AUTH_URL",
        "--projectKey=PROJECT_KEY",
        "--apiUrl=API_URL"
      ]
    }
  }
}
This example uses the --isAdmin=true flag, which provides full access to all commercetools resources, settings, and operations. This is useful for development and testing purposes, but should be used with caution in production environments. If not required, use --isAdmin=false to restrict access to only the tools specified in the --tools option.
To use only read-only tools, replace "--tools=all" with "--tools=all.read".

Setup Streamable HTTP Transport MCP Server

The Essentials MCP server, in addition to local STDIO server, also supports Streamable HTTP transport.

Installation

To be able to run Essentials MCP server in remote mode, use the following command:

Set up all available tools for Streamable HTTP serverbash
npx -y @commercetools/mcp-essentials \
  --tools=all \
  --authType=client_credentials \
  --clientId=CLIENT_ID \
  --clientSecret=CLIENT_SECRET \
  --projectKey=PROJECT_KEY \
  --authUrl=AUTH_URL \
  --apiUrl=API_URL \
  --remote=true \
  --stateless=true \
  --port=8888
See Available tools for a list of values for tools.

Use with Claude Desktop

At this point, Essentials MCP server is running on the specified port (8888). Now you can configure Claude Desktop with the following:
{
  "mcpServers": {
    "commercetools": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:8888/mcp"]
    }
  }
}

Available tools

Special Tool Options

ToolDescription
allEnable all available tools, including read, create, and update operations.
all.readEnable all read-only tools.

Individual Tools

ToolDescription
bulk.createCreate entities in bulk
bulk.updateUpdate entities in bulk
business-unit.createCreate business unit
business-unit.readRead business unit
business-unit.updateUpdate business unit
cart.createCreate cart
cart.readRead cart information
cart.updateUpdate cart information
cart-discount.createCreate cart discount
cart-discount.readRead cart discount
cart-discount.updateUpdate cart discount
category.createCreate category
category.readRead category information
category.updateUpdate category
channel.createCreate channel
channel.readRead channel information
channel.updateUpdate channel information
customer.createCreate customer
customer.readRead customer information
customer.updateUpdate customer information
customer-group.createCreate customer group
customer-group.readRead customer group
customer-group.updateUpdate customer group
discount-code.createCreate discount code
discount-code.readRead discount code information
discount-code.updateUpdate discount code information
inventory.createCreate inventory
inventory.readRead inventory information
inventory.updateUpdate inventory information
order.createCreate order (from cart, quote, import)
order.readRead order information
order.updateUpdate order information
product-discount.createCreate product discount
product-discount.readRead product discount
product-discount.updateUpdate product discount
product-search.readSearch products
product-selection.createCreate product selection
product-selection.readRead product selection
product-selection.updateUpdate product selection
product-type.createCreate product type
product-type.readRead product type
product-type.updateUpdate product type
products.createCreate product information
products.readRead product information
products.updateUpdate product information
project.readRead project information
quote.createCreate quote
quote.readRead quote information
quote.updateUpdate quote information
quote-request.createCreate quote request
quote-request.readRead quote request
quote-request.updateUpdate quote request
staged-quote.createCreate staged quote
staged-quote.readRead staged quote
staged-quote.updateUpdate staged quote
standalone-price.createCreate standalone price
standalone-price.readRead standalone price
standalone-price.updateUpdate standalone price
store.createCreate store
store.readRead store
store.updateUpdate store

Agent Essentials

Agent Essentials allows agent frameworks to interact with Composable Commerce through function calling. It supports a subset of the commercetools API using the TypeScript SDK.
Agent Essentials requires Node 18 (or later). To get started, install @commercetools/agent-essentials:
npm install @commercetools/agent-essentials

Usage

Configure Agent Essentials with your API Client credentials. Your API Client must include scopes for each enabled action. For example, to enable products.read, the API Client must have the view_products scope.
The following examples use environment variables to load the credentials, which you can save after creating your API Client.
Additionally, you can define the actions available using the toolkit in configuration.
import { CommercetoolsAgentEssentials } from '@commercetools/agent-essentials/langchain';

const commercetoolsAgentEssentials = new CommercetoolsAgentEssentials({
  authConfig: {
    type: 'client_credentials',
    clientId: process.env.CLIENT_ID!,
    clientSecret: process.env.CLIENT_SECRET!,
    projectKey: process.env.PROJECT_KEY!,
    authUrl: process.env.AUTH_URL!,
    apiUrl: process.env.API_URL!,
  },
  configuration: {
    actions: {
      products: {
        read: true,
        create: true,
        update: true,
      },
      project: {
        read: true,
      },
    },
  },
});

Tools

The toolkit integrates with LangChain and AI SDK by Vercel. Pass the tools to your agent executor:

import { AgentExecutor, createStructuredChatAgent } from 'langchain/agents';

const tools = commercetoolsAgentEssentials.getTools();

const agent = await createStructuredChatAgent({
  llm,
  tools,
  prompt,
});

const agentExecutor = new AgentExecutor({
  agent,
  tools,
});

Set up an MCP server

You can also expose your own MCP server using CommercetoolsAgentEssentials:
import { CommercetoolsAgentEssentials } from '@commercetools/agent-essentials/modelcontextprotocol';
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';

const server = new CommercetoolsAgentEssentials({
  authConfig: {
    type: 'client_credentials',
    clientId: process.env.CLIENT_ID!,
    clientSecret: process.env.CLIENT_SECRET!,
    projectKey: process.env.PROJECT_KEY!,
    authUrl: process.env.AUTH_URL!,
    apiUrl: process.env.API_URL!,
  },
  configuration: {
    actions: {
      products: {
        read: true,
      },
      cart: {
        read: true,
        create: true,
        update: true,
      },
    },
  },
});

async function main() {
  const transport = new StdioServerTransport();
  await server.connect(transport);
  console.error('My custom commercetools MCP Server running on stdio');
}

main().catch((error) => {
  console.error('Fatal error in main():', error);
  process.exit(1);
});

getTools()

The getTools() method returns the list of tools available to your agent.
const tools = commercetoolsAgentEssentials.getTools();

You can also use the Streamable HTTP server with the Agent Essentials like an SDK and develop on it.

import {
  CommercetoolsAgentEssentials,
  CommercetoolsAgentEssentialsStreamable,
} from '@commercetools/agent-essentials/modelcontextprotocol';
import express from 'express';

const expressApp = express();

const agentServer = new CommercetoolsAgentEssentials({
  authConfig: {
    type: 'client_credentials',
    clientId: process.env.CLIENT_ID!,
    clientSecret: process.env.CLIENT_SECRET!,
    projectKey: process.env.PROJECT_KEY!,
    authUrl: process.env.AUTH_URL!,
    apiUrl: process.env.API_URL!,
  },
  configuration: {
    actions: {
      products: {
        read: true,
      },
      cart: {
        read: true,
        create: true,
        update: true,
      },
    },
  },
});

const serverStreamable = new CommercetoolsAgentEssentialsStreamable({
  stateless: false, // make the MCP server stateless/stateful
  streamableHttpOptions: {
    sessionIdGenerator: undefined,
  },
  server: agentServer,
  app: expressApp, // optional express app instance
});

serverStreamable.listen(8888, function () {
  console.log('listening on 8888');
});
Without using the CommercetoolsAgentEssentials, you can directly use only the CommercetoolsAgentEssentialsStreamable class.
import { CommercetoolsAgentEssentialsStreamable } from '@commercetools/agent-essentials/modelcontextprotocol';
import express from 'express';

const expressApp = express();

const server = new CommercetoolsAgentEssentialsStreamable({
  authConfig: {
    type: 'client_credentials',
    clientId: process.env.CLIENT_ID!,
    clientSecret: process.env.CLIENT_SECRET!,
    projectKey: process.env.PROJECT_KEY!,
    authUrl: process.env.AUTH_URL!,
    apiUrl: process.env.API_URL!,
  },
  configuration: {
    actions: {
      project: {
        read: true,
      },
      // other tools can go here
    },
  },

  stateless: false,
  streamableHttpOptions: {
    sessionIdGenerator: undefined,
  },
  app: expressApp,
});

server.listen(8888, function () {
  console.log('listening on 8888');
});
When developing locally, do not commit linked packages in package.json to your repository.