Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

create_product

Add new products to your CS-Cart store with required details like product name, price, categories, description, stock quantity, and shipping cost. Manage product status and enhance inventory efficiently.

Instructions

Create a new product in the CS-Cart store

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
amountNoProduct quantity in stock
category_idsNoArray of category IDs
descriptionNoProduct description
full_descriptionNoFull product description
priceYesProduct price
productYesProduct name
shipping_freightNoShipping cost
statusNoProduct status (A=Active, D=Disabled, H=Hidden)A
weightNoProduct weight

Implementation Reference

  • The handler function that executes the create_product tool by making a POST request to the CS-Cart API /products endpoint with the provided args and returning the response as formatted JSON text content.
    async createProduct(args) { const result = await this.makeRequest('POST', '/products', args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • Input schema for the create_product tool, defining the expected object structure with properties like product name, price (required), optional category_ids, descriptions, status, stock amount, weight, and shipping freight.
    inputSchema: { type: 'object', properties: { product: { type: 'string', description: 'Product name', }, price: { type: 'number', description: 'Product price', }, category_ids: { type: 'array', items: { type: 'number' }, description: 'Array of category IDs', }, description: { type: 'string', description: 'Product description', }, full_description: { type: 'string', description: 'Full product description', }, status: { type: 'string', description: 'Product status (A=Active, D=Disabled, H=Hidden)', enum: ['A', 'D', 'H'], default: 'A', }, amount: { type: 'number', description: 'Product quantity in stock', default: 0, }, weight: { type: 'number', description: 'Product weight', }, shipping_freight: { type: 'number', description: 'Shipping cost', }, }, required: ['product', 'price'], },
  • src/index.js:89-138 (registration)
    The tool registration object in the setTools array, specifying the name 'create_product', description, and linking to the input schema for MCP tool discovery.
    { name: 'create_product', description: 'Create a new product in the CS-Cart store', inputSchema: { type: 'object', properties: { product: { type: 'string', description: 'Product name', }, price: { type: 'number', description: 'Product price', }, category_ids: { type: 'array', items: { type: 'number' }, description: 'Array of category IDs', }, description: { type: 'string', description: 'Product description', }, full_description: { type: 'string', description: 'Full product description', }, status: { type: 'string', description: 'Product status (A=Active, D=Disabled, H=Hidden)', enum: ['A', 'D', 'H'], default: 'A', }, amount: { type: 'number', description: 'Product quantity in stock', default: 0, }, weight: { type: 'number', description: 'Product weight', }, shipping_freight: { type: 'number', description: 'Shipping cost', }, }, required: ['product', 'price'], }, },
  • Supporting helper method used by the create_product handler (and others) to perform authenticated HTTP requests to the CS-Cart API endpoints.
    async makeRequest(method, endpoint, data = null) { const config = { method, url: `${process.env.CSCART_API_URL}${endpoint}`, headers: { 'Content-Type': 'application/json', 'Authorization': `Basic ${Buffer.from(`${process.env.CSCART_API_EMAIL}:${process.env.CSCART_API_KEY}`).toString('base64')}`, }, }; if (data) { config.data = data; } const response = await axios(config); return response.data; }
  • src/index.js:394-395 (registration)
    Dispatcher switch case in the CallToolRequestHandler that routes calls to the create_product handler method.
    case 'create_product': return await this.createProduct(args);

Other Tools

Related Tools

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/hungryweb/cscart-mcp'

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