咖啡菜单数据服务

一个提供For Five Coffee菜单数据访问的Model Context Protocol (MCP)服务器,支持Claude Desktop、Cursor等MCP客户端,并提供REST API。

  • by Kong
  • JavaScript
  • 本地部署
  • 更新于
在 GitHub 查看 Kong/for-five-mcp

使用说明

五咖啡MCP服务器

一种模型上下文协议(MCP)服务器,提供对以下内容的访问 五杯咖啡 菜单数据。与Claude Desktop、Cursor和其他MCP客户端配合使用,并提供REST API。

快速开始

git clone https://github.com/Kong/for-five-mcp.git
cd for-five-mcp
npm install
npm start

这从两个方面开始:

  • MCP服务器 (stdio)-用于AI助手
  • HTTP API (端口3000)-用于web应用程序

MCP客户端设置

克劳德桌面版

添加到 claude_desktop_config.json:

{
  "mcpServers": {
    "for-five-coffee": {
      "command": "node",
      "args": ["/path/to/for-five-mcp/server.js"]
    }
  }
}

光标

选项1:让Cursor启动服务器 添加到 ~/.cursor/mcp.json:

{
  "mcpServers": {
    "for-five-coffee": {
      "command": "node",
      "args": ["/path/to/for-five-mcp/server.js"],
      "env": {
        "PORT": "3000"
      }
    }
  }
}

选项2:连接到已运行的服务器 如果你在跑步 npm start 另外,将此添加到 ~/.cursor/mcp.json:

{
  "mcpServers": {
    "for-five-coffee": {
      "url": "http://localhost:3000/mcp",
      "transport": "http"
    }
  }
}

这将通过HTTP JSON-RPC 2.0传输将Cursor连接到正在运行的MCP服务器。

使用示例

询问你的AI助手

  • “For Five coffee有什么咖啡饮料?”
  • “在菜单上搜索糕点”
  • “最便宜的咖啡是什么?”
  • “给我看看所有的茶品种”

使用HTTP API

# Get full menu
curl http://localhost:3000/api/menu

# Search for items
curl "http://localhost:3000/api/menu/search?q=latte"

# Get categories
curl http://localhost:3000/api/menu/categories

在您的代码中

// Fetch menu data
const response = await fetch('http://localhost:3000/api/menu');
const menu = await response.json();

// Search items
const search = await fetch('http://localhost:3000/api/menu/search?q=coffee');
const results = await search.json();
import requests

# Get menu
menu = requests.get('http://localhost:3000/api/menu').json()

# Search
results = requests.get('http://localhost:3000/api/menu/search', 
                      params={'q': 'latte'}).json()

可用端点

端点 描述
GET / 服务器信息
GET /health 健康检查
GET /api/menu 完整菜单
GET /api/menu/search?q={query} 搜索项目
GET /api/menu/categories 所有类别
GET /api/menu/category/{name} 按类别列出的项目
POST /mcp MCP JSON-RPC 2.0端点

MCP工具

  • get_full_menu -获取完整菜单
  • search_menu_items -按查询搜索
  • get_menu_categories -列出类别
  • get_items_by_category -按类别筛选

发展

npm run dev          # Start with auto-restart
npm test             # Run all tests
npm run test:unit    # Unit tests only
npm run test:http    # HTTP API tests only  
npm run test:mcp     # MCP transport tests only
npm run test:integration # Integration tests only
npm run lint         # Check code style

故障排除

MCP不工作?

  • 检查到的绝对路径 server.js 在您的配置中
  • 配置更改后重新启动MCP客户端
  • 跑 npm start 手动测试

HTTP API没有响应?

  • 确保服务器正在运行: npm start
  • 检查端口3000是否未使用: lsof -i :3000
  • 测试: curl http://localhost:3000/health

没有菜单数据?

  • 检查互联网连接
  • 服务器自动处理SSL问题
  • 网站结构可能已经改变(包括回退)

许可证

Apache 2.0