--- title: PrestaShop MCP Server emoji: 🔧 colorFrom: blue colorTo: purple sdk: docker app_port: 8081 pinned: false license: mit tags: - mcp - prestashop - ecommerce - api - tools short_description: Model Context Protocol server for PrestaShop integration --- # PrestaShop MCP Server A Model Context Protocol (MCP) server that provides tools for accessing PrestaShop data. This server exposes PrestaShop functionality through standardized MCP tools that can be used by AI assistants and other MCP clients. ## 🚀 Features - **Standard MCP Protocol**: Implements Model Context Protocol specification - **PrestaShop Integration**: Direct access to PrestaShop product data - **HTTP API**: RESTful interface for easy integration - **Multiple Tools**: Product details, features, images, and search - **Type Safety**: Full type validation with Pydantic - **Error Handling**: Comprehensive error management ## 🔧 Available Tools ### `get_product_details` Get detailed information about a PrestaShop product. **Parameters:** - `product_id` (integer, required): Product ID - `lang_id` (integer, optional): Language ID (default: 1) ### `get_product_features` Get product features from PrestaShop. **Parameters:** - `product_id` (integer, required): Product ID ### `get_product_images` Get product images from PrestaShop. **Parameters:** - `product_id` (integer, required): Product ID ### `search_products` Search for products in PrestaShop catalog. **Parameters:** - `query` (string, required): Search query - `limit` (integer, optional): Max results (default: 10) ## 📡 API Endpoints ### MCP Endpoints #### `POST /` Main MCP JSON-RPC endpoint **Tools List Request:** ```json { "jsonrpc": "2.0", "method": "tools/list", "id": "1" } ``` **Tool Call Request:** ```json { "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "get_product_details", "arguments": {"product_id": 123} }, "id": "2" } ``` #### `GET /health` Health check endpoint ```json { "status": "healthy", "service": "prestashop-mcp-server" } ``` ## 🛠️ Usage ### Direct HTTP Calls ```bash # List available tools curl -X POST https://your-space.hf.space/ \ -H "Content-Type: application/json" \ -d '{"jsonrpc": "2.0", "method": "tools/list", "id": "1"}' # Get product details curl -X POST https://your-space.hf.space/ \ -H "Content-Type: application/json" \ -d '{ "jsonrpc": "2.0", "method": "tools/call", "params": { "name": "get_product_details", "arguments": {"product_id": 123} }, "id": "2" }' ``` ### MCP Client Integration This server can be used with any MCP-compatible client: ```python import requests # Configure MCP client to use this server mcp_server_url = "https://your-space.hf.space/" # List tools response = requests.post(mcp_server_url, json={ "jsonrpc": "2.0", "method": "tools/list", "id": "1" }) ``` ## 🔗 PrestaShop Configuration The server connects to PrestaShop via the ambaiagent API module. Configure your PrestaShop installation: 1. Install the ambaiagent module 2. Configure API endpoints in the module settings 3. Ensure proper permissions for API access ## 📊 Performance - **Response Time**: 1-5 seconds (depending on PrestaShop response) - **Concurrent Requests**: Supports multiple simultaneous requests - **Error Handling**: Graceful degradation with proper error messages - **Caching**: Can be configured for improved performance ## 🚀 Deployment ### Hugging Face Spaces This server is designed to run on Hugging Face Spaces: 1. Create a new Space with Docker SDK 2. Upload all files from the `mcp_server` directory 3. Set app_port to 8081 4. Deploy and access via the Space URL ### Local Development ```bash # Install dependencies pip install -r requirements.txt # Start the server python run_server.py --host 0.0.0.0 --port 8081 # Test the server curl http://localhost:8081/health ``` ## 🔧 Architecture ``` MCP Client → HTTP Request → MCP Server → PrestaShop API → Response ``` 1. **MCP Client** sends JSON-RPC request 2. **MCP Server** validates and processes request 3. **PrestaShop API** provides product data 4. **Response** formatted as MCP standard ## 📝 License MIT License - Feel free to use and modify for your projects. --- 🛒 **Ready for Production**: This MCP server is production-ready for e-commerce applications.