PetKit

io.github.dirkjanfaberv0.3.0更新於 Oct 2, 2026

Unofficial MCP server for PetKit smart feeders: status, feeding history and schedule control.

已驗證STDIO僅桌面Location & Lifestyle

概覽

AI 產生的概覽

針對 PetKit Fresh Element Solo 智慧餵食器的非官方 MCP 伺服器,讓助理查看餵食器狀態與餵食紀錄並控制餵食排程。

功能
連接 PetKit 雲端 API,為 Fresh Element Solo 餵食器(裝置類型 D4)提供工具。list_feeders 回傳即時狀態,例如飼料、電池與乾燥劑狀態、鎖定、燈光與音效設定、當日餵食總量以及當天排定的餐次。feed_now 立即出糧,份量為固定級距;update_feeder_setting 修改數值型設定,例如兒童鎖或缺糧警示;skip_scheduled_feed 與 restore_scheduled_feed 可跳過或復原當天某一餐,而不影響循環排程。
適用情境
當你希望助理在聊天用戶端中查看 PetKit 餵食器狀態與餵食紀錄,或出糧、調整當天餵食排程時使用。適合擁有 Fresh Element Solo 且能接受非官方社群整合的使用者。
執行需求
以 npm 套件形式在本機執行(npx mcp-server-petkit),透過 stdio 通訊;也可用 --http 或 MCP_TRANSPORT=http 以 HTTP 模式執行。需要 PetKit 帳號:PETKIT_EMAIL、PETKIT_PASSWORD、PETKIT_REGION,可選 PETKIT_TIMEZONE。HTTP 模式另需 MCP_PUBLIC_URL 與 MCP_OWNER_PASSWORD,可選 MCP_HOST、MCP_PORT、MCP_STATE_FILE。官方發布支援 amd64 與 arm64 的 Docker 映像。
安裝前請注意
需要以 PETKIT_PASSWORD 提供 PetKit 帳號密碼;由於 PetKit 每個帳號只允許一個工作階段,伺服器登入會把 PetKit 應用程式登出(R57、R58)。相關工具會實際出糧並修改餵食設定,誤呼叫會造成實際影響。HTTP 模式下 MCP_OWNER_PASSWORD 用於授權用戶端,任何持有權杖的人都能出糧或修改計畫(R37、R38),因此不要直接對外開放連接埠並設定強密碼。所用 API 為非官方逆向工程所得,可能隨時失效(R8)。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 PetKit,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

mcp-server-petkit

[CI]

MCP (Model Context Protocol) server for the PetKit cloud API. Exposes feeder status and control for the Fresh Element Solo (device type D4) as MCP tools.

Disclaimer: This project is not affiliated with, endorsed by, or in any way associated with PetKit. It is an independent, community-developed integration created by a happy user of their hardware and software. PetKit and Fresh Element Solo are trademarks of their respective owner. Use of this package is at your own risk. The underlying API is unofficial and reverse-engineered by the community - it may change or break without notice.

Tools

ToolDescription
list_feedersList all Fresh Element Solo feeders and their live state (food/battery/desiccant status, lock/light/sound settings, today's feed totals)
feed_nowDispense food immediately
update_feeder_settingChange a numeric setting (child lock, indicator light, dispense tone, shortage alarm, ...)
skip_scheduled_feedSkip one of today's scheduled meals (d4/removeDailyFeed), leaving the recurring plan untouched
restore_scheduled_feedUndo a skip for today (d4/restoreDailyFeed)

Feed amounts

The D4 only accepts these five portion sizes: 10, 20, 30, 40, 50.

Feed totals are per device, not per cat

list_feeders also returns feedPlanToday: today's scheduled meals from the feeder's weekly plan (d4/device_detail's multiFeedItem), each with its readable time, the feedTime (seconds since midnight) that skip_scheduled_feed takes, the portion amount in feed_now's units, and the meal name.

list_feeders' fedToday/fedTodayScheduled/fedTodayExtra/fedTodayPlanned/dispensesToday/feedTimesToday fields reflect what each physical feeder dispensed - PetKit has no way to attribute a dispense to a specific cat. If your cats share or steal from each other's bowls, these numbers won't tell you what any one cat actually ate.

Common setting keys

KeyMeaning
manualLockChild lock (0/1)
lightModeIndicator light
feedSoundDispense tone (0/1)
foodWarnShortage alarm (0/1)

Other numeric keys the device reports via list_feeders may also work but are unconfirmed.

Configuration

Set the following environment variables before starting the server:

bash
export PETKIT_EMAIL="[email protected]"export PETKIT_PASSWORD="yourpassword"export PETKIT_REGION="Netherlands"   # must match the exact region name shown in the PetKit appexport PETKIT_TIMEZONE="Europe/Amsterdam"   # optional, defaults to the host's own timezone

Note: PetKit account passwords are capped at 6-14 characters. A longer password fails login with a generic "incorrect username or password" error indistinguishable from an actually-wrong one - if login fails unexpectedly, check that first.

Usage with Claude Desktop

Add to your claude_desktop_config.json:

json
{  "mcpServers": {    "petkit": {      "command": "npx",      "args": ["mcp-server-petkit"],      "env": {        "PETKIT_EMAIL": "[email protected]",        "PETKIT_PASSWORD": "yourpassword",        "PETKIT_REGION": "Netherlands"      }    }  }}

Remote use: claude.ai connector (HTTP + OAuth)

To use the server from claude.ai and the Claude mobile apps, run it in HTTP mode on an always-on machine and add it as a custom connector. claude.ai connects from the internet, so the server needs a public https:// URL - a Cloudflare Tunnel or Tailscale Funnel gives you one without opening ports on your router.

HTTP mode is single-user: when you connect Claude, the server shows a page asking for your owner passphrase. Anyone who knows it can authorize a client, and anyone with a token can dispense food or change the feeding plan - pick a strong one.

bash
npx mcp-server-petkit --http   # or MCP_TRANSPORT=http
VariableDefault
MCP_PUBLIC_URL(required)The https:// URL claude.ai reaches the server on
MCP_OWNER_PASSWORD(required)Passphrase for authorizing Claude, at least 12 characters
MCP_HOST127.0.0.1Interface to listen on; the Docker image sets 0.0.0.0
MCP_PORT3000
MCP_STATE_FILE~/.mcp-server-petkit/oauth-state.jsonRegistered clients and refresh-token hashes, so Claude stays connected across restarts

plus the PETKIT_* variables from Configuration.

Docker (e.g. on a Raspberry Pi)

Each release publishes ghcr.io/dirkjanfaber/mcp-server-petkit for amd64 and arm64, tagged with the version and latest. With a Cloudflare Tunnel alongside it, no port needs publishing: create a tunnel in the Cloudflare dashboard, point its public hostname at http://petkit-mcp:3000, and put its token in .env next to the PetKit and MCP_* settings:

yaml
# docker-compose.ymlservices:  petkit-mcp:    image: ghcr.io/dirkjanfaber/mcp-server-petkit:latest   # or pin a version, e.g. :0.3.0    restart: unless-stopped    env_file: .env   # PETKIT_*, MCP_PUBLIC_URL, MCP_OWNER_PASSWORD    volumes:      - petkit-data:/data  cloudflared:    image: cloudflare/cloudflared:latest    command: tunnel run    restart: unless-stopped    environment:      TUNNEL_TOKEN: ${TUNNEL_TOKEN}volumes:  petkit-data:

Update with docker compose pull && docker compose up -d. To build the image yourself instead, replace image: with build: https://github.com/dirkjanfaber/mcp-server-petkit.git.

The server trusts one proxy hop (X-Forwarded-For from cloudflared) for rate limiting. Don't also publish its port directly to the internet.

Connecting Claude

In claude.ai: Settings → Connectors → Add custom connector, with URL https://<your public host>/mcp. Claude registers itself, opens the passphrase page, and once you allow it, the tools show up in claude.ai and the mobile apps.

PetKit allows one session per account. The server's login signs the PetKit app out (and vice versa); it re-logs in on its own when that happens, but expect the app to ask you to log in again whenever the server restarts or its session lapses. Running the stdio server, Node-RED's PetKit nodes, or a second HTTP instance on the same account makes them take turns signing each other out.

References

來源:README.md,提交 7c806aa

工具

0
工具後設資料尚未被收錄。

版本歷史

1
  1. v0.3.0最新Oct 2, 2026