mcp-demo-server
The MCP Product Reviews Server is a Model Context Protocol server that offers product review data and search functionalities. It includes resources for accessing product lists and reviews, and tools for searching by product ID, rating, and keywords.
MCP Product Reviews Server
A Model Context Protocol (MCP) server that provides product review data and search functionality.
Features
- Exposes product list as resources
- Provides tools for searching reviews by product ID, rating, and keywords
- Mock API based on AWS Lambda functions in
/product-api/functions/
- Designed to be used with CLINE as an SSE server
Installation
This project uses uv for dependency management.
# Install dependencies
uv pip install "mcp[cli]"
Usage
Running the MCP Server
# Run the server directly
python product_mcp_server.py
# Or use the MCP CLI
mcp run product_mcp_server.py
Development Mode
For testing and debugging:
mcp dev product_mcp_server.py
在本地部署
- transport 选择
stdio
, MCP Client 与 Server 之间通过本地标准 I/O通信
mcp.run(transport='stdio')
如果 server 在本地,配置启动命令, CLINE 会通过mcp run
/ uv run mcp run
/ unx
等命令启动这个 server, CLINE 集成了 MCP Client 代码,可以与server 通信
2. transport 选择 sse
, MCP Client 与 Server 之间通过本地标准 I/O通信
mcp.run(transport='sse')
如果 server 在远端部署,无论是通过配置 /etc/systemd/system/mcp-server.service
使用 systemctl start mcp-server
命令启动,还是通过mcp run
/ uv run mcp run
/ unx
等命令启动,都可以通过{host}:{port}/sse
访问,在 CLINE中配置如下进行使用
"{server name}": {
"url": "http://{host}:{port}:8000/sse",
"disabled": false,
"autoApprove": []
}
Integration with CLINE
To use this server with CLINE:
-
Start the MCP server:
python product_mcp_server.py
-
Configure CLINE to connect to the server (refer to CLINE documentation for specific steps)
Available Resources
products://all
- Get a list of all productsproducts://{product_id}
- Get details for a specific productreviews://{product_id}
- Get reviews for a specific product
Available Tools
get_products()
- Get a list of all available productsget_product_reviews(product_id)
- Get reviews for a specific productsearch_reviews_by_rating(min_rating)
- Search for reviews with a minimum ratingsearch_reviews_by_keyword(keyword)
- Search for reviews containing a specific keyword
AWS Lambda Functions
The server includes mock implementations of AWS Lambda functions found in /product-api/functions/
:
get_products.py
- Returns a list of productsget_product_reviews.py
- Returns reviews for a specific product
License
This project is licensed under the MIT License - see the LICENSE file for details.