我的第一个 MCP 项目
该项目演示了如何使用 MCP(模型上下文协议)服务器从DummyJSON API 检索数据。使用 Cursor IDE 和默认代理构建。
目录
特征
产品 API 工具
获取产品
描述:获取具有可选过滤和分页功能的产品列表
参数:
id(字符串,可选):按 ID 过滤产品q(字符串,可选):按标题过滤产品category(字符串,可选):按类别过滤产品brand(字符串,可选):按品牌过滤产品price(数字,可选):按价格过滤产品rating(数字,可选):按评级过滤产品skip(数字,可选,默认值:0):要跳过的产品数量limit(数字,可选,默认值:10):返回的最大产品数量
返回:符合指定条件的产品列表
数据来源:DummyJSON API( https://dummyjson.com/products )
安装和使用
先决条件
Node.js(版本 23 或更高版本)
Docker 和 Docker Compose
WSL2(如果使用 Windows)
游标配置
要使用 Cursor 配置此 MCP 服务器:
打开游标
按:
Windows/Linux:
Ctrl + Shift + PmacOS:
Cmd + Shift + P
输入“配置 MCP 服务器”并选择它
根据您的设置添加适当的配置:
对于 Windows(不带 WSL)或 Linux:
{
"mcpServers": {
"postgres": {
"command": "node",
"args": ["ABSOLUTE_PATH_TO_PROJECT/src/index.ts"]
}
}
}
对于 WSL 用户:
{
"mcpServers": {
"postgres": {
"command": "wsl.exe",
"args": [
"-e",
"ABSOLUTE_PATH_TO_NODE/.nvm/versions/node/v23.11.0/bin/node",
"ABSOLUTE_PATH_TO_PROJECT/src/index.ts"
]
}
}
}
要查找您的 Node.js 路径,请运行:
which node
执照
该项目已获得 MIT 许可。
Related MCP Servers
- -securityAlicense-qualityThis MCP server connects clients with Shopify store data, enabling retrieval of product and customer information via exposed tools.Last updated -5MIT License
- AsecurityAlicenseAqualityMCP server that integrates with Shopify API, allowing Claude Desktop users to retrieve and manipulate product information from Shopify stores.Last updated -52MIT License
- -securityFlicense-qualityAn MCP Server that provides access to the Jumpseller e-commerce platform API, allowing users to interact with Jumpseller's functionality through natural language commands.Last updated -
- -securityFlicense-qualityAn MCP server that enables large language models to directly access and analyze Amazon product information, including product details, variants, and reviews.Last updated -