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.
Placeholder | Replace with | From |
---|---|---|
{PROJECT_KEY} | project_key | your API Client |
{CLIENT_ID} | client_id | your API Client |
{CLIENT_SECRET} | secret | your API Client |
{ACCESS_TOKEN} | access_token | an existing access token (when using auth_token authentication type) |
{AUTH_URL} | your Authorization URL | Request an access token using the Composable Commerce OAuth 2.0 service |
{API_URL} | your API URL | Hosts |
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.
client_credentials
authentication. You can alternatively use auth_token
authentication by:- Setting
--authType=auth_token
(ortype: 'auth_token'
in TypeScript) - Replacing
--clientId
and--clientSecret
with--accessToken=ACCESS_TOKEN
Setup STDIO Transport MCP Server
Installation
npx
, use one of the following commands depending on the tools you need.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
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
# 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
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
claude_desktop_config.json
. For setup instructions, see the For Claude Desktop Users quickstart guide.{
"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"
]
}
}
}
--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."--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:
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
tools
.Use with Claude Desktop
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
Tool | Description |
---|---|
all | Enable all available tools, including read, create, and update operations. |
all.read | Enable all read-only tools. |
Individual Tools
Agent Essentials
@commercetools/agent-essentials
:npm install @commercetools/agent-essentials
Usage
products.read
, the API Client must have the view_products
scope.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
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()
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');
});
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');
});
package.json
to your repository.