artemkdr/mcp-server-catalog-with-api
If you are the rightful owner of mcp-server-catalog-with-api and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol (MCP) server that provides catalog functionality through a REST API layer.
search_products
Search for products with filters and pagination.
get_product_details
Get detailed product information.
get_categories
Get product categories with hierarchy.
get_product_recommendations
Get product recommendations.
check_product_availability
Check product availability and stock.
get_popular_products
Get popular products by rating.
get_price_range
Get price range information for categories.
MCP Server Catalog with API
A Model Context Protocol (MCP) server that provides catalog functionality through a REST API layer. This project demonstrates a proper architecture where the MCP server acts as a client to a catalog API, rather than directly accessing data.
Architecture
Claude/MCP Client → MCP Server → REST API Server → Mock Data
- MCP Server (
src/index.ts
): MCP protocol server that consumes the REST API - API Client (
src/api-client.ts
): HTTP client for communicating with the REST API - REST API Server (
src/server-example/api-server.ts
): Standard catalog API with endpoints for products, - Mock Data (
src/server-example/mock-data.ts
): Sample product and category data categories, search, etc.
Features
MCP Tools
search_products
- Search for products with filters and paginationget_product_details
- Get detailed product informationget_categories
- Get product categories with hierarchyget_product_recommendations
- Get product recommendationscheck_product_availability
- Check product availability and stockget_popular_products
- Get popular products by ratingget_price_range
- Get price range information for categories
REST API Endpoints
GET /api/v1/products
- List products with filtering and paginationGET /api/v1/products/search
- Search products with facetsGET /api/v1/products/:id
- Get product detailsGET /api/v1/products/:id/recommendations
- Get product recommendationsGET /api/v1/products/:id/availability
- Check product availabilityGET /api/v1/products/popular
- Get popular productsGET /api/v1/categories
- List categories with hierarchyGET /api/v1/categories/:id
- Get category detailsGET /api/v1/categories/:id/products
- Get products in categoryGET /api/v1/categories/:id/price-range
- Get price range for category
Getting Started
Prerequisites
- Bun runtime
Installation
bun install
Running the System
- Start the API Server (Terminal 1):
bun api-server
This starts the REST API server on http://localhost:3001
- Start the MCP Server (Terminal 2):
bun mcp-server
This starts the MCP server that connects to the API server
Development
- API Server with hot reload:
bun api-server
- Run linting:
bun lint
bun lint:fix
Testing the API
You can test the REST API directly:
# Get all products
curl "http://localhost:3001/api/v1/products"
# Search products
curl "http://localhost:3001/api/v1/products/search?q=laptop"
# Get product details
curl "http://localhost:3001/api/v1/products/1"
# Get categories
curl "http://localhost:3001/api/v1/categories"
Health Check
Check if the API server is running:
curl "http://localhost:3001/health"
Configuration
API Server
- Port:
3001
(configurable viaPORT
environment variable) - CORS: Enabled for all origins
- Request logging: Enabled
MCP Server
- Protocol: stdio transport
- API client base URL:
http://localhost:3001
Example Usage
Once both servers are running, you can use the MCP server with Claude or other MCP clients to:
- Search for products: "Find laptops under $1000"
- Get recommendations: "Show me products similar to product ID 1"
- Check availability: "Is product 5 in stock?"
- Browse categories: "What product categories are available?"
- Find popular items: "Show me the most popular electronics"