Skip to main content
Glama
commercetools

commercetools Commerce MCP

Official

commercetools Commerce MCP

This repository contains both an MCP server (which you can integrate with many MCP clients) and commerce agent that can be used from within agent frameworks.

commercetools Model Context Protocol

Setup

To run the commercetools MCP server using npx, use the following command:

Client Credentials Authentication (Default)

# To set up all available tools (authType is optional, defaults to client_credentials)
npx -y @commercetools/commerce-mcp --tools=all --clientId=CLIENT_ID --clientSecret=CLIENT_SECRET --projectKey=PROJECT_KEY --authUrl=AUTH_URL --apiUrl=API_URL

# Explicitly specify client_credentials (optional)
npx -y @commercetools/commerce-mcp --tools=all --authType=client_credentials --clientId=CLIENT_ID --clientSecret=CLIENT_SECRET --projectKey=PROJECT_KEY --authUrl=AUTH_URL --apiUrl=API_URL

# To set up all read-only tools
npx -y @commercetools/commerce-mcp --tools=read_all --clientId=CLIENT_ID --clientSecret=CLIENT_SECRET --projectKey=PROJECT_KEY --authUrl=AUTH_URL --apiUrl=API_URL
# To set up specific tools
npx -y @commercetools/commerce-mcp --tools=read_products,create_products --clientId=CLIENT_ID --clientSecret=CLIENT_SECRET --projectKey=PROJECT_KEY --authUrl=AUTH_URL --apiUrl=API_URL

Access Token Authentication

# To set up all available tools with access token
npx -y @commercetools/commerce-mcp --tools=all --authType=auth_token --accessToken=ACCESS_TOKEN --projectKey=PROJECT_KEY --authUrl=AUTH_URL --apiUrl=API_URL

# To set up all read-only tools with access token
npx -y @commercetools/commerce-mcp --tools=read_all --authType=auth_token --accessToken=ACCESS_TOKEN --projectKey=PROJECT_KEY --authUrl=AUTH_URL --apiUrl=API_URL

Make sure to replace CLIENT_ID, CLIENT_SECRET, PROJECT_KEY, AUTH_URL, API_URL, and ACCESS_TOKEN with your actual values. If using the customerId parameter, replace CUSTOMER_ID with the actual customer ID. Alternatively, you could set the API_KEY in your environment variables.

Authentication Options

The MCP server supports two authentication methods:

Authentication Type

Required Arguments

Description

client_credentials (default)

--clientId, --clientSecret

Uses API client credentials for authentication. --authType=client_credentials is optional since this is the default

auth_token

--accessToken, (optional --clientId, --clientSecret)

Uses a pre-existing access token for authentication. Requires --authType=auth_token and optional --clientId and --clientSecret

Customer context

Pass --customerId=CUSTOMER_ID to run the server in customer self-service mode. When set, tools for customer-owned resources are automatically scoped to that customer and limited to safe operations:

  • customers — only the customer's own profile can be read.

  • orders, carts, recurring-orders — queries are restricted to the customer's records; look-ups by id/key are ownership-checked.

  • quotes, quote-requests, shopping-lists — restricted to the customer's own records; carts and shopping lists created this way are owned by the customer, and updates verify ownership. Quote updates are limited to customer-permitted actions (accept/decline, request renegotiation).

Resources that are not customer-owned (for example products or categories) are unaffected. Combine --customerId with --businessUnitKey to operate as a B2B associate within a Business Unit instead.

Usage with Claude Desktop

Add the following to your claude_desktop_config.json. See here for more details.

Client Credentials Authentication

{
  "mcpServers": {
    "commercetools": {
      "command": "npx",
      "args": [
        "-y",
        "@commercetools/commerce-mcp@latest",
        "--tools=all",
        "--clientId=CLIENT_ID",
        "--clientSecret=CLIENT_SECRET",
        "--authUrl=AUTH_URL",
        "--projectKey=PROJECT_KEY",
        "--apiUrl=API_URL",
        "--dynamicToolLoadingThreshold=30"
      ]
    }
  }
}

Note: You can optionally add "--authType=client_credentials" to be explicit, but it's not required since this is the default.

Access Token Authentication

{
  "mcpServers": {
    "commercetools": {
      "command": "npx",
      "args": [
        "-y",
        "@commercetools/commerce-mcp@latest",
        "--tools=all",
        "--authType=auth_token",
        "--accessToken=ACCESS_TOKEN",
        "--authUrl=AUTH_URL",
        "--projectKey=PROJECT_KEY",
        "--apiUrl=API_URL"
      ]
    }
  }
}

Alternative: To use only read-only tools, replace "--tools=all" with "--tools=read_all"

Related MCP server: Agentic Shopping MCP

Available tools

Special Tool Options

Tool

Description

all

Enable all available tools (read, create, and update operations)

read_all

Enable all read-only tools (safe for read-only access)

Individual Tools

Tool

Description

read_approval_flows

Read Approval Flow

update_approval_flows

Update Approval Flow

read_approval_rules

Read Approval Rule

create_approval_rules

Create Approval Rule

update_approval_rules

Update Approval Rule

read_associate_roles

Read Associate Role

create_associate_roles

Create Associate Role

update_associate_roles

Update Associate Role

read_order_edits

Read Order Edit

create_order_edits

Create Order Edit

update_order_edits

Update or Apply Order Edit

read_product_selection_assignments

Read Products in Product Selection

read_recurrence_policies

Read Recurrence Policy

create_recurrence_policies

Create Recurrence Policy

update_recurrence_policies

Update Recurrence Policy

read_states

Read State

create_states

Create State

update_states

Update State

read_products

Read product information

create_products

Create product information

update_products

Update product information

read_project

Read project information

read_product_search

Search products

read_categories

Read category information

create_categories

Create category

update_categories

Update category

read_channels

Read channel information

create_channels

Create channel

update_channels

Update channel information

read_product_selections

Read product selection

create_product_selections

Create product selection

update_product_selections

Update product selection

read_orders

Read order information

create_orders

Create order (from cart, quote, import)

update_orders

Update order information

read_carts

Read cart information

create_carts

Create cart

update_carts

Update cart information

read_customers

Read customer information

create_customers

Create customer

update_customers

Update customer information

read_customer_groups

Read customer group

create_customer_groups

Create customer group

update_customer_groups

Update customer group

read_quotes

Read quote information

create_quotes

Create quote

update_quotes

Update quote information

read_quote_requests

Read quote request

create_quote_requests

Create quote request

update_quote_requests

Update quote request

read_staged_quotes

Read staged quote

create_staged_quotes

Create staged quote

update_staged_quotes

Update staged quote

read_standalone_prices

Read standalone price

create_standalone_prices

Create standalone price

update_standalone_prices

Update standalone price

read_product_discounts

Read product discount

create_product_discounts

Create product discount

update_product_discounts

Update product discount

read_cart_discounts

Read cart discount

create_cart_discounts

Create cart discount

update_cart_discounts

Update cart discount

read_discount_codes

Read discount code information

create_discount_codes

Create discount code

update_discount_codes

Update discount code information

read_product_types

Read product type

create_product_types

Create product type

update_product_types

Update product type

create_bulk

Create entities in bulk

update_bulk

Update entities in bulk

read_inventory

Read inventory information

create_inventory

Create inventory

update_inventory

Update inventory information

read_stores

Read store

create_stores

Create store

update_stores

Update store

read_business_units

Read business unit

create_business_units

Create business unit

update_business_units

Update business unit

read_payments

Read payment information

create_payments

Create payment

update_payments

Update payment information

read_tax_categories

Read tax category information

create_tax_categories

Create tax category

update_tax_categories

Update tax category information

read_shipping_methods

Read shipping method information

create_shipping_methods

Create shipping method

update_shipping_methods

Update shipping method information

read_zones

Read zone information

create_zones

Create zone

update_zones

Update zone information

read_recurring_orders

Read recurring order information

create_recurring_orders

Create recurring order

update_recurring_orders

Update recurring order information

read_shopping_lists

Read shopping list information

create_shopping_lists

Create shopping list

update_shopping_lists

Update shopping list information

read_extensions

Read extension information

create_extensions

Create extension

update_extensions

Update extension information

read_subscriptions

Read subscription information

create_subscriptions

Create subscription

update_subscriptions

Update subscription information

read_payment_methods

Read payment method information

create_payment_methods

Create payment method

update_payment_methods

Update payment method information

read_product_tailoring

Read product tailoring information

create_product_tailoring

Create product tailoring

update_product_tailoring

Update product tailoring information

read_custom_objects

Read custom object information

create_custom_objects

Create custom object

update_custom_objects

Update custom object information

read_types

Read type information

create_types

Create type

update_types

Update type information

To view information on how to develop the MCP server, see this README.

Dynamic Tool Loading

The MCP server includes a dynamic tool loading feature that automatically switches to a more efficient loading strategy when the number of enabled tools exceeds a configurable threshold. This helps optimize performance and reduce context usage when working with large numbers of tools.

How it works

  • Default threshold: 30 tools

  • Behavior: When the number of enabled tools exceeds the threshold, the server switches to dynamic tool loading

Configuration

You can configure the dynamic tool loading threshold in two ways:

Command Line Argument

npx -y @commercetools/commerce-mcp --tools=all --dynamicToolLoadingThreshold=50 --clientId=CLIENT_ID --clientSecret=CLIENT_SECRET --projectKey=PROJECT_KEY --authUrl=AUTH_URL --apiUrl=API_URL

Environment Variable

export DYNAMIC_TOOL_LOADING_THRESHOLD=50
npx -y @commercetools/commerce-mcp --tools=all --clientId=CLIENT_ID --clientSecret=CLIENT_SECRET --projectKey=PROJECT_KEY --authUrl=AUTH_URL --apiUrl=API_URL

Example with Claude Desktop

{
  "mcpServers": {
    "commercetools": {
      "command": "npx",
      "args": [
        "-y",
        "@commercetools/commerce-mcp@latest",
        "--tools=all",
        "--clientId=CLIENT_ID",
        "--clientSecret=CLIENT_SECRET",
        "--authUrl=AUTH_URL",
        "--projectKey=PROJECT_KEY",
        "--apiUrl=API_URL",
        "--dynamicToolLoadingThreshold=25"
      ]
    }
  }
}

Commerce MCP

The commercetools Commerce MCP enables popular agent frameworks including LangChain, Vercel's AI SDK, and Model Context Protocol (MCP) to integrate with APIs through function calling. The library is not exhaustive of the entire commercetools API. It includes support for TypeScript and is built directly on top of the [Node][node-sdk] SDK.

Included below are basic instructions, but refer to the TypeScript package for more information.

TypeScript

Installation

You don't need this source code unless you want to modify the package. If you just want to use the package run:

npm install @commercetools/commerce-agent

Requirements

  • Node 18+

Usage

The library needs to be configured with your commercetools project credentials which are available in your Merchant center. Important: Ensure that the API client credentials have the necessary scopes aligned with the actions you configure in the commerce agent. For example, if you configure products: { read: true }, your API client must have the view_products scope. Additionally, configuration enables you to specify the types of actions that can be taken using the commerce agent.

Client Credentials Authentication (Default)

import { CommercetoolsCommerceAgent } from "@commercetools/commerce-agent/langchain";

const commercetoolsCommerceAgent = await CommercetoolsCommerceAgent.create({
  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,
      },
    },
  },
});

Access Token Authentication

import { CommercetoolsCommerceAgent } from "@commercetools/commerce-agent/langchain";

const commercetoolsCommerceAgent = await CommercetoolsCommerceAgent.create({
  authConfig: {
    type: "auth_token",
    accessToken: process.env.ACCESS_TOKEN!,
    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 commerce agent works with LangChain and Vercel's AI SDK and can be passed as a list of tools. For example:

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

const tools = commercetoolsCommerceAgent.getTools();

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

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

Model Context Protocol

The commercetools Commerce MCP also supports setting up your own MCP server. For example:

import { CommercetoolsCommerceAgent } from "@commercetools/commerce-agent/modelcontextprotocol";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = await CommercetoolsCommerceAgent.create({
  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()

Returns the current set of available tools that can be used with LangChain, AI SDK, or other agent frameworks:

const tools = commercetoolsCommerceAgent.getTools();

Custom Tools

The self managed @commercetools/commerce-agent includes supports for custom tools. A list of custom tools implementations can be passed over and registered at runtime by the bootstrapping MCP server. This is especially useful when the intended tool is not yet implemented into the Commerce MCP or to give users complete control and customization of their tools behaviour and how it interact with the underlying LLM.

usage

import { CommercetoolsCommerceAgent } from "@commercetools/commerce-agent/modelcontextprotocol";
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";

const server = await CommercetoolsCommerceAgent.create({
  authConfig: {...},
  configuration: {
    customTools: [
      {
        name: "Get Project",
        method: "get_project",
        description: `This tool will fetch information about a commercetools project.\n\n
           This tool will accept a project and fetch information about the provided key. \n\n
          `, // It is important that this description is well details and explicitly descripts what this tool does and the paramenters it receieves/
        parameters: z.object({
          projectKey: z
            .string()
            .optional()
            .describe(
              "The key of the project to read. If not provided, the current project will be used."
            ),
        }),
        actions: {},
        execute: async (args: { projectKey: string }, api: ApiRoot) => {
          // already existing functions can be used here e.g const response = await import('ctService').getProject('demo-project-key-a7fc1182');
          const response = await api.withProjectKey(args).get().execute();
          return JSON.stringify(response);
        },
      },
      ...
    ],
    actions: {...},
  },
});
...

Streamable HTTP MCP server

As of version v2.0.0 of the @commercetools/commerce-mcp MCP server now supports Streamable HTTP (remote) server.

npx -y @commercetools/commerce-mcp \
  --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

You can connect to the running remote server using Claude by specifying the below in the claude_desktop_config.json file.

{
  "mcpServers": {
    "commercetools": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "http://localhost:8888/mcp",
        "--header",
        "Authorization: Bearer ${CTP_ACCESS_TOKEN}"
      ]
    }
  }
}

🔒 Authentication is required for the remote server. Every HTTP request to /mcp must include a valid Authorization: Bearer <commercetools-access-token> header. The token is forwarded directly to the commercetools API, so it must be a valid commercetools OAuth access token with the scopes you want the caller to have. Requests with a missing or malformed header are rejected with 401 Unauthorized.

The credentials provided to the server at startup (--clientId/--clientSecret or --accessToken) are not used to serve network requests — they only satisfy the CLI's startup validation. This prevents an unauthenticated network caller from inheriting the server's configured credentials.

Advanced embedders who perform their own authentication can opt out of this check by passing enforceAuthHeader: false to CommercetoolsCommerceAgentStreamable (see the SDK usage below). This is not recommended for network-exposed deployments.

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

import express from "express";
import {
  CommercetoolsCommerceAgent,
  CommercetoolsCommerceAgentStreamable,
} from "@commercetools/commerce-agent/modelcontextprotocol";

const expressApp = express();

const getAgentServer = async () => {
  return CommercetoolsCommerceAgent.create({
    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 CommercetoolsCommerceAgentStreamable({
  stateless: false, // make the MCP server stateless/stateful
  server: getAgentServer,
  app: expressApp, // optional express app instance
  // By default every request must send an `Authorization: Bearer <token>`
  // header (otherwise it is rejected with 401). If your `getAgentServer`
  // factory already handles authentication, set this to false to opt out.
  // enforceAuthHeader: false,
  streamableHttpOptions: {
    sessionIdGenerator: undefined,
  },
});

serverStreamable.listen(8888, function () {
  console.log("listening on 8888");
});

Without using the CommercetoolsCommerceAgent, you can directly use only the CommercetoolsCommerceAgentStreamable class and the agent server will be bootstrapped internally.

import { CommercetoolsCommerceAgentStreamable } from "@commercetools/commerce-agent/modelcontextprotocol";
import express from "express";

const expressApp = express();

const server = new CommercetoolsCommerceAgentStreamable({
  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,
  app: expressApp,
  streamableHttpOptions: {
    sessionIdGenerator: undefined,
  },
});

server.listen(8888, function () {
  console.log("listening on 8888");
});
A
license - permissive license
-
quality - not tested
A
maintenance

Maintenance

Maintainers
10dResponse time
2wRelease cycle
16Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • F
    license
    -
    quality
    D
    maintenance
    Enables AI agents to perform e-commerce operations including product search, budget-constrained shopping recommendations, and sustainability analysis. Includes a secure HTTP bridge with OAuth integration and observability features for production deployment.
  • A
    license
    -
    quality
    D
    maintenance
    Enables AI assistants to manage BareCommerceCore e-commerce stores through 46 tools covering products, orders, customers, categories, pages, media, webhooks, and analytics. Uses secure OAuth authentication without requiring API keys in chat.
    10
    MIT

View all related MCP servers

Related MCP Connectors

  • Manage your NanoCart store from any AI agent: products, orders, coupons, subscribers, reports.

  • 100+ MCP tools for AI agents: content metadata, trade intelligence, business-expertise analysis.

  • Gateway between LLM agents and world data through eight tools and a bundled endpoint catalog.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/commercetools/commerce-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server