eufy-lock-codes
A local MCP server for managing Eufy smart-lock access codes across rental properties, with safety features like dry-run planning and explicit confirmation for write operations.
README
eufy-lock-codes
eufy-lock-codes is a local MCP server for managing Eufy smart-lock access codes across rental properties. It is designed for real operations: code changes are planned first, write operations require explicit confirmation, stored plans are redacted, and successful writes are recorded in a private local escrow so future rotations do not depend on Eufy returning plaintext.
The system uses the unofficial eufy-security-client package. Eufy does not provide a stable public smart-lock API, so this project keeps the Eufy integration behind a backend adapter and treats live verification as a maintainer gate.
What It Does
- Discovers Eufy smart locks and reports capability flags.
- Lists lock-code users and passcode metadata for one lock, one property, or all configured properties.
- Creates dry-run plans for creating, updating, deleting, and rotating codes.
- Executes exactly one unexpired confirmation token.
- Atomically claims confirmation tokens so one pending plan cannot be executed twice.
- Waits for Eufy user-event acknowledgments, then verifies final user-list state.
- Stores locally created or updated plaintext passcodes in ignored private escrow.
- Writes redacted audit logs and live-test backups under ignored local state.
It never performs lock or unlock commands.
Safety Model
- Write operations require a plan first, then
execute_plan. - Plans expire and cannot be reused after execution.
- Pending plan files contain masked operations. Plaintext needed for execution is stored separately under ignored local state, deleted when a plan is claimed, and cleaned during expiry maintenance.
- Public tool responses and audit logs mask passcodes.
- Ambiguous usernames, missing mappings, unsupported locks, and failed list calls are hard stops.
- Rotation creates or updates the replacement before deleting an old user when the username changes.
- If a later operation fails after new users were created, the executor attempts to delete those newly created users to avoid leaving extra active access.
- Live verification scripts require
--yes-live-writeorEUFY_CONFIRM_LIVE_WRITE=1.
Architecture
mcp/server.mjsexposes MCP tools over stdio.src/tools.mjsimplements planning, target resolution, safety checks, and execution.src/backend/eufy-adapter.mjsisolates the unofficial Eufy client and waits for user-event acknowledgments.src/plan-store.mjspersists redacted plans, short-lived pending secrets, expiry cleanup, and redacted audit records underdata/.src/escrow.mjsstores plaintext for locally created or updated codes under ignored local state.src/recovery-cache.mjscan merge previously recovered local inventory into masked list responses when private recovery files exist.
MCP Tools
discover_locks: list Eufy smart locks and capability flags.health_check: verify credentials, Eufy connectivity, config, and mapped lock availability.list_lock_codes: list users and passcode metadata without returning full plaintext passcodes.plan_create_code: create a dry-run add-user/code plan.plan_update_code: create a dry-run passcode or schedule update plan.plan_delete_code: create a dry-run exact-username delete plan.plan_rotate_codes: create a dry-run tenant or maintenance rotation plan.execute_plan: execute one unexpired confirmation token.
Setup
Requirements:
- Node.js 24 or newer
- A Eufy account with supported smart locks
Install dependencies:
npm ci
Create local configuration:
cp .env.example .env
cp config/properties.example.yaml config/properties.local.yaml
Fill .env with:
eufy_email=your-account@example.com
eufy_pass=your-password
EUFY_COUNTRY=US
EUFY_LANGUAGE=en
Fill config/properties.local.yaml with your real property aliases and lock serials. Local configs are ignored by git.
Running
Run the MCP server:
node mcp/server.mjs
Run the no-credentials demo:
npm run demo
Run local checks:
npm run check
Run test coverage:
npm run coverage
Run a read-only Eufy smoke check with real local credentials:
npm run smoke
Run live CRUD verification against one configured test lock:
EUFY_LIVE_TEST_PROPERTY=sample-property \
EUFY_LIVE_TEST_LOCK_ALIAS=front \
npm run test:live -- --yes-live-write
The live test creates and removes temporary users, creates and removes one scheduled expiring code, writes before/after backups under data/backups/, and verifies the test users are gone. It does not lock or unlock the door.
Example Flow
- Run
health_check. - Run
list_lock_codesfor the target property or lock. - Run a
plan_*tool. - Review the dry-run operations and confirmation token.
- Run
execute_planonly for the intended token. - Re-run
list_lock_codesto verify final state.
Limitations
- Eufy smart-lock APIs are unofficial and can drift.
- Existing plaintext PINs are not always available from Eufy cloud responses.
- Passcode value verification is limited by what Eufy returns; writes are verified through acknowledgements, final user-list state, and local escrow.
- Offline or low-battery locks may not answer live P2P/read operations.
- Production use should keep local backups and use a designated live verification lock after backend changes.
See docs/threat-model.md and docs/verification.md for the safety assumptions and maintainer verification gate.
License
AGPL-3.0-only.
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.
Neon Database
MCP server for interacting with Neon Management API and databases
E2B
Using MCP to run code via e2b.
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.