Happy MedBox MCP Server
Provides tools for managing a SQLite database storing medication information, including querying, adding, updating, and deleting medicine records, as well as scanning for expiring items and retrieving medication advice.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Happy MedBox MCP Serverlist medicines expiring within 30 days"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Happy MedBox Management System (Happy MedBox)
Three-terminal software scaffold: WeChat Mini Program + Node/SQLite Backend + MCP Server + A2A Reminder Agent. Core full workflow: Photo capture and recognition → Write to database → Scheduled expiration scanning → MCP provides data interface → A2A triggers reminders → Mini program displays reminders and suggestions.
Technology stack: Backend and mini program are implemented with native/zero external dependencies (Node 22 built-in
http/node:sqlite/node:test), can be run and tested offline withnode, nonpm installrequired.
Directory Structure
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
Quick Start
1. Start Backend + A2A (Default Ports 3000 / 4100 / 4200)
cd happy-medbox
node src/index.jsAfter starting:
Mini program connects to REST:
http://localhost:3000Reminder agent (AgentCard / trigger scanning):
http://localhost:4100User agent inbox:
http://localhost:4200
Environment variables: API_PORT / REMINDER_PORT / USER_PORT / WARNING_DAYS (default 30) / REMINDER_INTERVAL_MS (default 60000) / MEDBOX_DB (default data/medbox.db, use :memory: for in-memory database).
2. Run Tests (19 items, all pass)
node --test3. Start MCP Server Independently (for AI assistant stdio calls)
node src/mcp-server.js
# 支持 initialize / tools/list / tools/call
# 工具:query_medicines / recognize_medicine_image / compute_expiry /
# get_medication_advice / add_medicine / list_expiring4. Open the Mini Program
Use WeChat Developer Tools to import the miniprogram/ directory (the appid is set to touristappid for guest mode, allowing direct preview).
For real device debugging, change the baseUrl in miniprogram/app.js to your computer's LAN IP (e.g., http://192.168.x.x:3000), and check "Do not verify valid domain names" in the developer tools.
Key Process Description
Photo Recognition:
capturepagewx.chooseMedia→POST /api/ocr→ Currently returns Mock structured fields (name/specification/production date/expiration date), user reviews thenPOST /api/medicinesto store.Countdown to Expiration: Backend
expiry.jscalculates remaining days and status (safe/warning/expired) in real-time based on the current day; displayed on the mini program's home page and detail page.Scheduled Scanning + A2A Push: The reminder agent in
a2a-server.jsscans for soon-to-expire medicines at intervals → writes to thereminderstable and encapsulates an A2A Task → HTTP pushes to the user agent/tasks(cross-agent message flow) → the mini program'sreminderpage polls for display, allowing marking as read.MCP Data Interface: AI assistant calls six tools via stdio JSON-RPC to query medicines / recognize / calculate expiration dates / retrieve medication suggestions as needed.
Production Replacement Suggestions (Interface Contract Unchanged)
Database:
node:sqlite→better-sqlite3(faster, synchronous).MCP:
src/mcp-server.jsself-implemented JSON-RPC → official@modelcontextprotocol/sdk.REST: Built-in
http→Express/Fastify.OCR: Mock branch in
ocr.js→ Integrate Tencent Cloud Universal Print OCR or WeChat OCR plugin (requires key/qualification).
Known Boundaries (MVP Scope)
Reminder channel uses in-app polling for now; WeChat subscription message interface is reserved.
Knowledge base contains a few built-in examples; admin backend is pending (P2).
No account system, single-family local identifier (P2 for multi-device cloud sync).
This server cannot be deployed
Maintenance
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.
Nifty's MCP server — exposes tasks, projects, messages, and files as tools for AI agents.
Hosted MCP server for Cliniko — patients, appointments, availability, and invoices for AI agents.
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.370 npm1MIT
- AlicenseAqualityCmaintenanceMCP server for managing personal items with expiration dates, enabling AI agents to add, query, and scan barcode items via API Key authentication.59 npmMIT
- FlicenseCqualityFmaintenanceAn MCP server that exposes Homebox inventory management as tools for AI agents, enabling search, add, update, delete products, locations, tags, and maintenance entries.172-