Skip to main content
Glama
hungryweb

CS-Cart MCP Server

by hungryweb

create_product

Add new products to your CS-Cart store by specifying name, price, categories, and inventory details to expand your online catalog.

Instructions

Create a new product in the CS-Cart store

Input Schema

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

Implementation Reference

  • The main handler function for the 'create_product' tool. It makes a POST request to the CS-Cart API endpoint '/products' using the provided arguments and returns the formatted API response.
    async createProduct(args) { const result = await this.makeRequest('POST', '/products', args); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; }
  • Input schema defining the parameters, types, descriptions, defaults, and required fields for the 'create_product' tool.
    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:394-395 (registration)
    Registration/dispatch in the CallToolRequest handler switch statement that routes calls to the createProduct handler method.
    case 'create_product': return await this.createProduct(args);
  • src/index.js:89-138 (registration)
    Tool registration in the ListToolsRequest response, including name, description, and reference to input schema.
    { 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'], }, },
  • Shared helper method used by createProduct (and other tools) to make authenticated API requests to the CS-Cart server.
    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; }

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