PetLibro MCP Server
Enables Claude to control PetLibro RFID pet feeders and water fountains by checking food/battery/water status, dispensing food by the cup, and force-opening feeder lids via the PetLibro cloud API.
README
PetLibro MCP Server
An MCP (Model Context Protocol) server that lets Claude control PetLibro RFID pet feeders and Dockstream water fountains: check food/battery/water status, dispense food by the cup, and force-open feeder lids — all backed by the PetLibro cloud API (the same one the PetLibro mobile app uses).
Feeders and fountains are addressed by short names you define once in
pets.toml (e.g. zeus, ferris, dockstream1), not by raw device serials.
Install
Requires Python >= 3.10.
cd petlibro
python -m venv .venv
.venv/bin/pip install -e ".[dev]"
This installs the petlibro-mcp console script into .venv/bin/.
Run the test suite:
.venv/bin/pytest
Configuration
.env — PetLibro cloud credentials
Create a .env file at the repo root (already git-ignored — never commit
real credentials):
PETLIBRO_EMAIL=you@example.com
PETLIBRO_PASSWORD=your-petlibro-app-password
PETLIBRO_REGION=US
These are the same credentials you use to log into the PetLibro mobile app.
PETLIBRO_REGION selects the regional API base URL (see
src/petlibro_mcp/vendored/api.py for supported regions; US is the
default).
pets.toml — your devices
Copy the bundled template and fill in your own devices (the real pets.toml
is git-ignored so your serials/MACs/chip IDs stay private):
cp pets.example.toml pets.toml
pets.toml at the repo root maps your feeders and fountains to friendly
names:
[defaults]
portions_per_cup = 12 # default dispense ratio, overridable per feeder
region = "US"
max_cups_per_command = 4 # safety cap; "feed" refuses more unless force=true
[[pet]]
name = "ferris"
serial = "EXAMPLE_FEEDER_SN_FERRIS" # from the device or the cloud device list
mac = "EXAMPLE_MAC_FERRIS"
chip = "100003"
# portions_per_cup = 10 # optional per-feeder override
[[fountain]]
name = "dockstream1"
serial = "EXAMPLE_FOUNTAIN_SN_1"
mac = "EXAMPLE_MAC_FOUNTAIN_1"
near = ["zeus", "colby", "bridget"] # cosmetic: which pets drink from it
Serials are the values the PetLibro cloud reports for each device (deviceSn
in the API), not necessarily the exact string printed on the physical label.
Run the smoke script below after any config change to confirm every
configured serial actually matches something the cloud reports — a mismatch
means feed/open_lid calls for that device will fail.
Verifying the connection (smoke test)
scripts/smoke.py is a small, read-only script (git-ignored, not part of the
package) that logs in and lists devices to confirm the whole stack — .env,
pets.toml, and the vendored API client — actually talks to your real
account:
.venv/bin/python scripts/smoke.py
It prints login OK, the number of devices the cloud reports, each cloud
device's serial/name, and then reconciles every configured feeder/fountain
serial against those cloud serials (OK or MISSING from cloud). This does
not feed anything or open any lid — it only calls login + list devices.
Calibrating portions_per_cup
The feeders dispense in discrete "portions," but you usually think in cups.
portions_per_cup converts one to the other (cups_to_portions in
config.py), and the default of 12 is a guess — calibrate it for your
actual food:
- Use the
feedtool (or the PetLibro app) to dispense a known number of portions into an empty measuring cup (e.g. 12 portions). - Measure how many cups that actually filled.
- Compute
portions_per_cup = portions_dispensed / cups_measured. - Set it in
pets.toml, either globally under[defaults]or per feeder (food density/kibble size can differ by station, so add aportions_per_cup = Nline under any[[pet]]that needs its own ratio).
Tools
The server exposes five MCP tools:
| Tool | Purpose |
|---|---|
feed |
Dispense food. Takes pets (name, list of names, or "all") and cups. Refuses to exceed max_cups_per_command unless force=true. |
open_lid |
Force the RFID lid open on one, several, or all feeders. |
feeder_status |
Food level, battery, online state, and today's feeding total for one feeder or all of them. |
fountain_status |
Water level %, water state, pump, filter/cleaning days remaining, and battery for one fountain or all. |
list_devices |
Configured feeders/fountains plus the live cloud device list — useful for spotting a serial mismatch. |
Example prompts once the server is registered with Claude:
- "Feed ferris 3 cups"
- "Open all the lids"
- "How much food does zeus have?"
- "Feed everyone 1 cup"
- "What's the status of dockstream2?"
- "List all my PetLibro devices"
Registering with Claude
Add an entry to your MCP config (Claude Code's .mcp.json, or the Claude
Desktop config). Credentials should come from .env, not be hardcoded in a
config file that might get shared or committed.
The server loads .env for you. On startup it reads a .env file next to
pets.toml (or at PETLIBRO_ENV), so the simplest registration just points at
the console script and sets the config path — no password in the MCP config at
all:
{
"mcpServers": {
"petlibro": {
"command": "/home/scarter4work/projects/petlibro/.venv/bin/petlibro-mcp",
"env": {
"PETLIBRO_PETS_TOML": "/home/scarter4work/projects/petlibro/pets.toml"
}
}
}
}
PETLIBRO_PETS_TOML also tells the server where to find .env (same
directory). Real environment variables always win over the .env file, so you
can still override any value from the MCP env block.
If you'd rather set credentials directly in the MCP config's env block
instead of sourcing .env, never write the real password into a file that
gets committed — use a placeholder and fill in the real value only in your
local, git-ignored config:
{
"mcpServers": {
"petlibro": {
"command": "/home/scarter4work/projects/petlibro/.venv/bin/petlibro-mcp",
"env": {
"PETLIBRO_EMAIL": "you@example.com",
"PETLIBRO_PASSWORD": "REDACTED",
"PETLIBRO_REGION": "US",
"PETLIBRO_PETS_TOML": "/home/scarter4work/projects/petlibro/pets.toml"
}
}
}
}
Either way, keep whichever file holds the real password (.env or the MCP
config itself) out of git.
Safety notes
feedenforcesmax_cups_per_commandas a per-call overfeed guard;force=truebypasses it deliberately, not accidentally.- Every tool call surfaces real errors (auth failures, unknown pet names, API errors) instead of swallowing them — a failed dispense or a serial mismatch should always be visible, never silently ignored.
- Always run
scripts/smoke.pyafter changingpets.tomlor rotating credentials, before trustingfeed/open_lidagainst real hardware.
Known gaps (deferred, not stubbed)
- Schedule editing, fountain pump control, and RFID visit history
(
recent_visits) are not implemented.
License & attribution
Licensed under GPL-3.0-or-later (see LICENSE).
The code under src/petlibro_mcp/vendored/ is derived from the community
PETLIBRO Home Assistant integration
(cd1zz/petlibro-homeassistant,
originally jjjonesjr33/petlibro),
adapted to run standalone. That upstream is GPL-3.0, so this project is too.
See NOTICE for details.
PetLibro does not publish a public API; this project uses the same private cloud endpoints as the official app. Not affiliated with or endorsed by PetLibro.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.