commercetools Commerce MCP
Enables AI agents to interact with commercetools APIs to manage products, categories, orders, carts, and customer data. It provides a comprehensive set of tools for both read-only and full-access operations through secure authentication methods.
README
License and Scope of Use for Commerce MCP
Commerce MCP is provided under a dual-tier usage model based on the highly permissive MIT License with specific limitations on commercial use.
Permitted Use
Access to and use of Commerce MCP is governed by the following terms:
- Non-Commercial Use (No Charge): The use of Commerce MCP is permitted for development, evaluation, and testing purposes at no charge. This non-commercial use is subject to a hard cap of 1,000,000 (one million) total tool invocations.
- Commercial/Production Use (Required License): Any use of Commerce MCP in a production environment or for any other commercial purpose requires a paid license or subscription.
License Enforcement
While the underlying code adheres to the principles of the MIT License, the terms above constitute the binding agreement for utilizing Commerce MCP. commercetools reserves the right to review how customers are using Commerce MCP and to restrict or terminate access for unlicensed production use or for any non-commercial use that exceeds the stated 1,000,000 invocation limit.
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=all.read --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=products.read,products.create --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=all.read --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 |
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=all.read"
Available tools
Special Tool Options
| Tool | Description |
|---|---|
all |
Enable all available tools (read, create, and update operations) |
all.read |
Enable all read-only tools (safe for read-only access) |
Individual Tools
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", "..."]
}
}
}
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
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");
});
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。