
MCP-Canteen-Server
3 years
Works with Finder
0
Github Watches
0
Github Forks
0
Github Stars
餐厅数据 MCP Server
本服务用于查询职工餐厅就餐人数数据,提供指定日期范围内的早餐和午餐就餐人数统计。
docs: https://modelcontextprotocol.io/quickstart/server
安装
通过 pip 安装
pip install mcp-server-canteen
通过 uv 安装
uv pip install mcp-server-canteen
开发环境安装
git clone https://github.com/wrdan/mcp-server-canteen.git
cd mcp-server-canteen
uv pip install -e .
环境变量配置
在使用服务之前,需要配置以下环境变量:
-
CANTEEN_API_TOKEN
: API认证令牌 -
CANTEEN_API_BASE
: API基础URL
环境变量获取方式
- 联系系统管理员获取 API 认证令牌
- API基础URL通常由系统管理员提供
设置环境变量
Windows
set CANTEEN_API_TOKEN=your_token
set CANTEEN_API_BASE=your_base_url
Linux/Mac
export CANTEEN_API_TOKEN=your_token
export CANTEEN_API_BASE=your_base_url
服务运行
使用 uv 运行
uv run mcp-server-canteen
使用 Python 运行
python -m mcp_server_canteen.server
功能说明
服务提供以下功能:
-
get_canteen_data
: 查询指定日期范围内的餐厅就餐人数数据- 参数:
-
start_date
: 开始日期,格式为YYYYMMDD(如20250331) -
end_date
: 结束日期,格式为YYYYMMDD(如20250331) -
period
: 相对时间范围,可选值:-
today
: 今天 -
yesterday
: 昨天 -
day_before_yesterday
: 前天 -
this_week
: 本周 -
last_week
: 上周 -
this_month
: 本月 -
last_month
: 上月
-
-
- 返回: 包含早餐人数、午餐人数和总计人数的文本统计
- 参数:
使用 Claude for Desktop 作为客户端测试
配置
打开并编辑文件: ~/Library/Application\ Support/Claude/claude_desktop_config.json,内容如下:
使用 uvx
"mcpServers": {
"canteen": {
"command": "uvx",
"args": ["mcp-server-canteen"],
"env": {
"CANTEEN_API_TOKEN": "CANTEEN_API_TOKEN",
"CANTEEN_API_BASE": "ANTEEN_API_BASE"
}
}
}
使用 uv
"mcpServers": {
"canteen": {
"command": "uv",
"args": ["run", "mcp-server-canteen"],
"env": {
"CANTEEN_API_TOKEN": "CANTEEN_API_TOKEN",
"CANTEEN_API_BASE": "ANTEEN_API_BASE"
}
}
}
本地测试
"mcpServers": {
"canteen": {
"command": "python",
"args": ["-m", "mcp-server-canteen.server"],
"env": {
"CANTEEN_API_TOKEN": "CANTEEN_API_TOKEN",
"CANTEEN_API_BASE": "ANTEEN_API_BASE"
}
}
}
重启 Claude for Desktop
重启不报错,且有锤子
图标显示可用的 MCP Tool,即为成功;否则,查看日志排查
错误处理
常见错误及解决方案
-
环境变量未设置
- 错误信息:
缺少必要的环境变量配置
- 解决方案:确保已正确设置所有必需的环境变量
- 错误信息:
-
日期格式错误
- 错误信息:
日期格式不正确,请使用YYYYMMDD格式
- 解决方案:检查日期格式是否正确,例如:20240321
- 错误信息:
-
API请求失败
- 错误信息:
HTTP请求失败
或API返回错误
- 解决方案:
- 检查网络连接
- 验证API令牌是否正确
- 确认API基础URL是否正确
- 错误信息:
-
服务器连接失败
- 错误信息:
无法连接到MCP服务器
- 解决方案:
- 确保服务器正在运行
- 检查端口是否被占用
- 验证配置文件是否正确
- 错误信息:
Claude for Desktop 日志
日志文件夹:~/Library/Logs/Claude
来自具体 MCP Server 的日志:mcp-server-canteen.log
MCP 连接通用日志:mcp.log
工作原理
- 客户将您的查询发送给 Claude
- Claude 分析可用的工具并决定使用哪一个
- 客户端通过 MCP 服务器执行所选工具
- 结果被发回给 Claude
- Claude 制定了自然语言响应
- 答案已经展示给你了!
相关推荐
🔥 1Panel fournit une interface Web intuitive et un serveur MCP pour gérer des sites Web, des fichiers, des conteneurs, des bases de données et des LLM sur un serveur Linux.
🧑🚀 全世界最好的 LLM 资料总结 (数据处理、模型训练、模型部署、 O1 模型、 MCP 、小语言模型、视觉语言模型) | Résumé des meilleures ressources LLM du monde.
⛓️RULEGO est un cadre de moteur de règle d'orchestration des composants de nouvelle génération légère, intégrée, intégrée et de nouvelle génération pour GO.
PDF Traduction de papier scientifique avec formats conservés - 基于 AI 完整保留排版的 PDF 文档全文双语翻译 , 支持 Google / Deepl / Olllama / Openai 等服务 , 提供 CLI / GUI / MCP / DOCKER / ZOTERO
Flock est une plate-forme à faible code de workflow pour construire rapidement des chatbots, un chiffon et coordonner des équipes multi-agents, alimentée par Langgraph, Langchain, Fastapi et NextJs. (Flock 是一个基于 Workflow 工作流的低代码平台 , 用于快速构建聊天机器人、 Rag 、 Agent 和 和 , 采用 采用 采用 采用 Langgraph 、 Langchain 、 Fastapi 和 ,))
Plateforme d'automatisation de workflow à code équitable avec des capacités d'IA natives. Combinez le bâtiment visuel avec du code personnalisé, de l'auto-hôte ou du cloud, 400+ intégrations.
Créez facilement des outils et des agents LLM à l'aide de fonctions Plain Bash / JavaScript / Python.
😎简单易用、🧩丰富生态 - 大模型原生即时通信机器人平台 | 适配 QQ / 微信 (企业微信、个人微信) / 飞书 / 钉钉 / Discord / Telegram / Slack 等平台 | 支持 Chatgpt 、 Deepseek 、 Dify 、 Claude 、 GEMINI 、 XAI 、 PPIO 、 OLLAMA 、 LM Studio 、阿里云百炼、火山方舟、 Siliconflow 、 Qwen 、 Moonshot 、 ChatGlm 、 Sillytraven 、 MCP 等 LLM 的机器人 / Agent | Plateforme de bots de messagerie instantanée basés sur LLM, prend en charge Discord, Telegram, WeChat, Lark, Dingtalk, QQ, Slack
Reviews

user_dRRkvl0H
I have been using the mcp-canteen-server by wrdan, and it has significantly improved the efficiency of our canteen operations. The setup process was straightforward, and the performance has been reliable. This tool is a must-have for managing canteen servers effectively. Highly recommend it!

user_yOU5qpvI
I've been using the mcp-canteen-server by wrdan for a while now, and it has significantly improved the efficiency of our canteen operations. The interface is user-friendly, and it integrates well with our existing systems. The welcome information is clear and helpful, making onboarding a breeze. Highly recommend this tool for any canteen management needs!

user_NZirrFNZ
As a dedicated user of MCP-Canteen-Server, I am extremely impressed with its performance and scalability. The seamless integration and intuitive interface have significantly improved the efficiency of our canteen management. Kudos to Wrdan for creating such a robust solution!

user_cMy358o9
I've been using the mcp-canteen-server by wrdan, and it has truly transformed the way I manage canteen operations. The intuitive interface and seamless integration have saved me a lot of time. Highly recommend to anyone looking to streamline their processes efficiently!

user_vc7Oo1zJ
The mcp-canteen-server by wrdan is an outstanding tool for managing canteen operations efficiently. Its user-friendly interface and robust features make it a must-have for any canteen. Highly recommended for its performance and reliability!

user_y24lFiyZ
The mcp-canteen-server by wrdan is an exceptional tool for managing canteen operations. This product offers seamless integration, efficient performance, and is pleasantly user-friendly. It greatly simplifies canteen management tasks, enhancing productivity. Highly recommended for canteen administrators!