Happy MedBox MCP Server
家庭幸福药箱管理系统(Happy MedBox)
三端软件脚手架:微信小程序端 + Node/SQLite 后端 + MCP 服务端 + A2A 提醒代理。 核心全流程:拍摄识别 → 写入数据库 → 定时扫描过期 → MCP 提供数据接口 → A2A 触发提醒 → 小程序展示提醒与建议。
技术选型:后端与小程序均用原生/零外部依赖实现(Node 22 内置
http/node:sqlite/node:test),离线即可node运行与测试,无需npm install。
目录结构
happy-medbox/
├─ prd.md / architecture.md # 产品需求 + 系统架构(团队 SOP 产出)
├─ package.json / README.md
├─ src/ # 后端:API + 数据库 + MCP + A2A
│ ├─ db.js # SQLite 连接与建表(node:sqlite)
│ ├─ expiry.js # 过期计算(纯函数,可单测)
│ ├─ ocr.js # OCR 接口 + Mock(预留腾讯云/微信 OCR)
│ ├─ repository.js # 数据访问层 CRUD
│ ├─ mcp-server.js # MCP 工具 + JSON-RPC(stdio)
│ ├─ server.js # REST API(小程序对接)
│ ├─ a2a-server.js # 提醒代理 + 用户代理(双端口,A2A 推送)
│ ├─ seed.js # 样例数据
│ └─ index.js # 编排入口(启动 + 定时扫描)
├─ miniprogram/ # 微信小程序端(原生)
│ ├─ pages/{index,capture,detail,knowledge,reminder}/
│ └─ utils/{api,ocr,format}.js
└─ test/ # 单元测试(expiry/db/mcp/a2a)Related MCP server: Medical MCP Server
快速开始
1. 启动后端 + A2A(默认端口 3000 / 4100 / 4200)
cd happy-medbox
node src/index.js启动后:
小程序对接 REST:
http://localhost:3000提醒代理(AgentCard / 触发扫描):
http://localhost:4100用户代理收件箱:
http://localhost:4200
环境变量:API_PORT / REMINDER_PORT / USER_PORT / WARNING_DAYS(默认30) / REMINDER_INTERVAL_MS(默认60000) / MEDBOX_DB(默认 data/medbox.db,内存库用 :memory:)。
2. 运行测试(19 项,全过)
node --test3. 单独启动 MCP 服务端(供 AI 助手 stdio 调用)
node src/mcp-server.js
# 支持 initialize / tools/list / tools/call
# 工具:query_medicines / recognize_medicine_image / compute_expiry /
# get_medication_advice / add_medicine / list_expiring4. 打开小程序
用微信开发者工具导入 miniprogram/ 目录(appid 已设为 touristappid 游客模式可直接预览)。
真机调试时把 miniprogram/app.js 里的 baseUrl 改成电脑局域网 IP(如 http://192.168.x.x:3000),并在开发者工具勾选"不校验合法域名"。
关键流程说明
拍照识别:
capture页wx.chooseMedia→POST /api/ocr→ 当前返回 Mock 结构化字段(名称/规格/生产日期/有效期),用户校对后POST /api/medicines入库。倒计时过期:后端
expiry.js按当天实时计算剩余天数与状态(safe/warning/expired);小程序首页与详情页展示。定时扫描 + A2A 推送:
a2a-server.js的提醒代理按间隔扫描临期药 → 写入reminders表并封装 A2A Task → HTTP 推送到用户代理/tasks(跨代理消息流转)→ 小程序reminder页轮询展示,可标记已读。MCP 数据接口:AI 助手通过 stdio JSON-RPC 调用六个工具,按需查询药品 / 识别 / 计算效期 / 检索用药建议。
生产替换建议(接口契约不变)
数据库:
node:sqlite→better-sqlite3(更快、同步)。MCP:
src/mcp-server.js自实现 JSON-RPC → 官方@modelcontextprotocol/sdk。REST:内置
http→Express/Fastify。OCR:
ocr.js的 Mock 分支 → 接入腾讯云通用印刷体 OCR 或微信 OCR 插件(需密钥/资质)。
已知边界(MVP 范围)
提醒通道先用小程序内轮询,微信订阅消息留接口。
知识库为内置少量样例,管理员后台待做(P2)。
无账号体系,单家庭本地标识(P2 多端云同步)。
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceMCP server for managing Homebox inventory via AI assistants, enabling item management, location organization, and label categorization.4MIT
- AlicenseNot gradedqualityDmaintenanceA comprehensive Model Context Protocol (MCP) server for medical document processing with advanced AI capabilities, including OCR, medical NER, local embeddings, and vector search.3581MIT
- AlicenseAqualityDmaintenanceMCP server for managing personal items with expiration dates, enabling AI agents to add, query, and scan barcode items via API Key authentication.59MIT
- FlicenseCqualityCmaintenanceAn MCP server that exposes Homebox inventory management as tools for AI agents, enabling search, add, update, delete products, locations, tags, and maintenance entries.171
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Personal assistant MCP server with search, execute, packages, jobs, secrets, and integrations.
Hosted MCP server exposing US hospital procedure cost data to AI assistants
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/tomwugdgz/happy-medbox'
If you have feedback or need assistance with the MCP directory API, please join our Discord server