Poke HabitTracker MCP

Poke HabitTracker MCP

Enables Poke to read and update today's HabitTracker habits via Supabase, with tools for listing, completing, uncompleting habits, and viewing a dashboard summary.

Category
访问服务器

README

Poke HabitTracker MCP

This is Daniel's private Poke-compatible MCP server. The MVP lets Poke read and update today's HabitTracker habits directly through Supabase.

Architecture

Poke / Telegram / SMS
        |
FastMCP server in this repo
        |
Supabase HabitTracker tables
        |
HabitTracker web/iOS clients

HabitTracker remains the source of truth. This server does not add API routes to HabitTracker and does not create schema migrations.

Current Tools

  • health(): returns safe server/config status without secrets.
  • list_today_habits(): lists active habits for today with completion status.
  • complete_habit(habit_name): marks today's matching habit complete.
  • uncomplete_habit(habit_name): marks today's matching habit incomplete without deleting rows.
  • get_today_dashboard(): returns completed/incomplete habit summary for today.
  • Task and check-in tools return blocked responses until HabitTracker has those schemas.

Environment

Create .env from the example:

Copy-Item .env.example .env

Fill the required HabitTracker Supabase values:

SUPABASE_URL=
SUPABASE_SERVICE_ROLE_KEY=
DANIEL_USER_ID=

Optional:

APP_ENV=development
APP_TIMEZONE=America/Chicago
MCP_HOST=127.0.0.1
MCP_PORT=8000
MCP_PATH=/mcp
POKE_MCP_API_KEY=

SUPABASE_SERVICE_ROLE_KEY must stay server-side. Every operation in this repo is scoped to DANIEL_USER_ID.

When POKE_MCP_API_KEY is set, the MCP endpoint requires FastMCP bearer auth:

Authorization: Bearer <POKE_MCP_API_KEY>

The /health HTTP route remains public and secret-safe for platform health checks.

Local Setup

python -m venv .venv
.\.venv\Scripts\python -m pip install -e ".[dev]"

Run Tests

Run unit tests and lint:

.\.venv\Scripts\python -m pytest
.\.venv\Scripts\python -m ruff check .

Run The Server

Run the MCP server locally:

.\.venv\Scripts\python -m poke_mcp.server

The default local MCP URL is:

http://127.0.0.1:8000/mcp

The server uses FastMCP HTTP transport at MCP_PATH, default /mcp.

Manual Smoke Tests

The smoke script uses an in-memory FastMCP client. It always checks tool registration and health(). It calls real Supabase read tools only when SUPABASE_URL, SUPABASE_SERVICE_ROLE_KEY, and DANIEL_USER_ID are present.

Read-only smoke test:

.\.venv\Scripts\python scripts\smoke_test.py

When env vars are present, the read-only smoke test calls:

  • health()
  • list_today_habits()
  • get_today_dashboard()

Intentional write smoke test:

.\.venv\Scripts\python scripts\smoke_test.py --write --habit "Creatine"

Write mode calls both complete_habit() and uncomplete_habit() against real Supabase. It chooses the order so the habit ends with the same visible completed/incomplete state it had at the start. If the habit starts incomplete, this may create a completed=false habit_logs row because this MVP intentionally does not delete logs.

Deploy To HTTPS

Use a host that can run Python 3.12 and expose HTTPS, such as Render, Railway, or Fly.io. This repo includes:

  • Dockerfile: production container image.
  • render.yaml: Render Blueprint for a Docker web service.
  • railway.toml: Railway config-as-code using the Dockerfile.
  • fly.toml: Fly app config using the Dockerfile.

Runtime behavior:

  • The server binds MCP_HOST, default 127.0.0.1.
  • The server uses MCP_PORT; if MCP_PORT is absent, platform PORT is accepted.
  • The MCP endpoint is mounted at MCP_PATH, default /mcp.
  • /health is a plain HTTP health route for deployment checks. It is secret-safe and returns the same config booleans as the health() MCP tool.

Recommended deployment shape:

Build/install: python -m pip install -e .
Start: python -m poke_mcp.server
Environment:
  APP_ENV=production
  MCP_HOST=0.0.0.0
  MCP_PORT=<numeric platform port; PORT is also accepted>
  MCP_PATH=/mcp
  SUPABASE_URL=<project url>
  SUPABASE_SERVICE_ROLE_KEY=<server-side secret>
  DANIEL_USER_ID=<Daniel's auth.users id>

Terminate TLS at the hosting provider and connect Poke to:

https://your-public-host.example.com/mcp

Do not expose the endpoint publicly without setting POKE_MCP_API_KEY or using a host/proxy rule that enforces equivalent bearer auth.

Render

Use render.yaml as a Blueprint, or create a Docker web service from the GitHub repo.

Set these secret/env values in Render:

APP_ENV=production
APP_TIMEZONE=America/Chicago
MCP_HOST=0.0.0.0
MCP_PATH=/mcp
SUPABASE_URL=<project url>
SUPABASE_SERVICE_ROLE_KEY=<server-side secret>
DANIEL_USER_ID=<Daniel's auth.users id>

Render provides PORT, so MCP_PORT is optional. Health check path: /health.

Railway

Railway will use railway.toml and the Dockerfile. Set the same production env vars as Render. Railway provides PORT, so MCP_PORT is optional. After deploy, create or use the public Railway domain and use:

https://your-railway-domain.up.railway.app/mcp

Fly.io

Edit fly.toml if the app name poke-mcp is unavailable, then set secrets and deploy:

fly secrets set SUPABASE_URL="<project url>" SUPABASE_SERVICE_ROLE_KEY="<server-side secret>" DANIEL_USER_ID="<Daniel's auth.users id>"
fly deploy

fly.toml sets MCP_PORT=8080 and maps Fly's public HTTPS service to internal port 8080. Health check path: /health.

Deployed Smoke-Test Checklist

After a deployment finishes:

  1. Confirm logs show the server starting on 0.0.0.0 and the expected port.
  2. Open https://your-public-host.example.com/health.
  3. Confirm the health payload has status: "ok", supabase_configured: true, and no secret values.
  4. Run a read-only remote MCP smoke test:
.\.venv\Scripts\python scripts\smoke_test.py --url https://your-public-host.example.com/mcp

If the remote MCP endpoint requires bearer auth, pass the key through FastMCP's HTTP auth path:

.\.venv\Scripts\python scripts\smoke_test.py --url https://your-public-host.example.com/mcp --api-key "<secret>"
  1. Confirm the smoke test lists tools and returns today's habit dashboard.
  2. Connect Poke to https://your-public-host.example.com/mcp.
  3. From Poke, ask "What habits do I have left today?"
  4. Only after read-only checks pass, intentionally test writes with a low-risk habit:
.\.venv\Scripts\python scripts\smoke_test.py --url https://your-public-host.example.com/mcp --api-key "<secret>" --write --habit "Creatine"

Connect From Poke

MCP URL:

https://your-public-host.example.com/mcp

Auth behavior in this MVP:

  • If POKE_MCP_API_KEY is set on the server, /mcp requires Authorization: Bearer <POKE_MCP_API_KEY>.
  • scripts/smoke_test.py --api-key sends that exact header using FastMCP's HTTP auth= support.
  • Poke should be configured to send Authorization: Bearer <POKE_MCP_API_KEY> when connecting to the MCP URL.
  • health() reports whether POKE_MCP_API_KEY is configured, but it does not reveal the key.

Example Poke prompts:

  • "What habits do I have left today?"
  • "Show my habit dashboard."
  • "Mark Creatine complete."
  • "Mark Cardio incomplete for today."
  • "Did I finish all my habits?"

HabitTracker Schema Assumptions

The MVP only uses:

  • habits: id, user_id, title, active_from, active_until, created_at
  • habit_logs: habit_id, date, completed

Active habits are those where active_from <= today and active_until is null or after today. Missing active_from falls back to created_at, matching HabitTracker's app logic.

Known Limitations

  • No task tools until HabitTracker gets a task table.
  • No check-in tools until HabitTracker gets a daily check-in or health-log table.
  • No Google Calendar integration in this MVP.
  • uncomplete_habit upserts completed=false; HabitTracker web currently often represents incomplete as no log row.
  • Production remote auth should be finalized when Poke custom integration requirements are known.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选