Habit Tracker MCP Server
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., "@Habit Tracker MCP ServerCreate a new habit: drink 8 glasses of water daily"
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.
Habit Tracker ChatGPT App
一個在 ChatGPT 裡追蹤每日習慣的 App,用 ChatGPT Apps SDK / MCP 建構。 使用者可以用自然語言(「新增喝水習慣」「幫我打卡」),也可以在內嵌的視覺化 介面直接操作;兩種方式共用同一套後端邏輯。資料存在本機 SQLite。
功能
新增 / 更新 / 刪除習慣,可設定每天的目標次數(
target_per_day)打卡(check-in),自動計算**連續天數(streak)**與今日進度
「今日待完成」檢視:列出今天還沒達標的習慣
內嵌 React widget:清單、打卡按鈕、新增表單,操作即時同步
Related MCP server: habitify-mcp-server
架構概觀
使用者 ─┬─ 對 ChatGPT 說話 ──► 模型呼叫工具
└─ 點 widget 按鈕 ──► 介面呼叫工具
│
▼
MCP server (server/app.py, /mcp)
│
repository.py ──► SQLite
│
回傳 structured_content
▼
ChatGPT 渲染 React widget(iframe)MCP 工具分兩組:給模型用的(模型自己決定何時呼叫)與只給介面用的
widget_*別名(對模型隱形,由 widget 按鈕觸發)。兩組指向同一批函式。衍生狀態不落地:streak、今日進度都在讀取時即時算出(
habits_with_status), 不存快取欄位,永遠是最新的。widget 執行期的細節(沙箱 iframe、CORS/CSP、postMessage 橋)見
docs/widget-architecture.md。
檔案結構
habittrack/
├── server/
│ ├── config.py # 環境變數設定
│ ├── database.py # SQLite engine + session + 建表
│ ├── models.py # Habit / CheckIn 資料表
│ ├── repository.py # 資料存取 + streak / 今日進度計算
│ └── app.py # MCP server、工具、widget resource、HTTP 路由
├── web/src/
│ ├── types.ts # 前後端共用型別
│ ├── bridge.ts # 封裝與 ChatGPT host 的橋接
│ ├── App.tsx # React widget
│ └── main.tsx # 掛載 React
├── tests/ # repository 單元測試
└── docs/
└── widget-architecture.md本機開發
# 1. 後端
cp .env.example .env # 預設用 SQLite,可直接跑
uv sync
uv run pytest # 跑測試
# 2. 前端(改動後要重新 build)
cd web && npm install && npm run build && cd ..
# 3. 啟動(MCP 端點 /mcp,健康檢查 /health、/ready)
uv run uvicorn server.app:app --host 0.0.0.0 --port 2100 --reloadChatGPT 只接受 HTTPS,所以用 ngrok 對外暴露,再到 Developer Mode 註冊:
ngrok http 2100
# 把 .env 的 PUBLIC_BASE_URL 設成 ngrok 的 https 網址,重啟 server
# 在 ChatGPT 註冊 https://<ngrok-host>/mcp(No authentication)
PUBLIC_BASE_URL同時是 widget 載入資產的網址與 CSP 白名單,務必設成對外的 HTTPS origin(無尾斜線);改動後要重啟 server。
環境變數
變數 | 說明 | 預設 |
| 資料庫連線字串 |
|
| widget 資產與 CSP 的對外 origin |
|
| 環境名稱 |
|
說明
目前為單機、無驗證的私人 Developer Mode 版本。若要分享或上線,需另外加上 OAuth 與 per-user 資料隔離。
This server cannot be deployed
Maintenance
Related MCP Connectors
Manage your MakeMeBetter AI tasks, habits, and goals from your AI assistant.
Create Hevy routines and analyze your training from chat. Unofficial; BYO Hevy PRO API key.
Track, curate, and analyze data about your health, habits, and goals.
Track expenses from your AI chat: log, categorize, monthly CSV reports. All data is local.
141
Related MCP Servers
- AlicenseCqualityDmaintenanceEnables AI assistants to interact with the Habitica API to manage tasks, track habits, and engage in gamified productivity features like pet raising and inventory management. It allows users to control their Habitica account through natural language for a personalized and automated productivity experience.2612 npm20MIT
- AlicenseNot gradedqualityFmaintenanceEnables AI assistants to manage Habitify habits, journals, moods, and notes through the Habitify API, with tools for adding, deleting, and retrieving habit logs and other data.172 npm8MIT
- FlicenseNot gradedqualityDmaintenanceEnables Poke to read and update today's HabitTracker habits via Supabase, with tools for listing, completing, uncompleting habits, and viewing a dashboard summary.-
- FlicenseNot gradedqualityDmaintenanceEnables users to analyze their habits over a specified period and receive weekly reviews through natural language prompts.-