Ask Claude about my car. It cannot send the car a single command.
A small MCP server over Tesla's official Fleet API, hosted so Claude Code, claude.ai and Meta's Muse agent can all ask about my car, and can do nothing else.
Each client can read battery, range, charging and lock status, and the design makes sure that is all any of them can do.
First run against the real car
> what is my tesla battery
Called tesla-fleet 2 times
I can't see the battery level right now. The car is offline, and the
Fleet API won't return battery data until it connects.
I can try to wake it, but each wake costs about 10x a normal read.
Should I try?
> yes wake it
Called tesla-fleet
The car woke up. Your Tesla is at 65% battery, with about 207 miles of range.
- Charging: not plugged in (charge limit set to 80%)
- Locked: yes
- Odometer: 13,374 miles
The first answer is the point. The car was offline, so the server reported that and stopped. Waking it costs money, so that decision stayed with me. One wake, then one read.
How it is built
Every client meets the same gate: GitHub sign-in, then an allowlist with one name on it. Behind the gate, every rule lives in a plain Python core that can be tested without any AI involved, and only that core ever talks to Tesla.
- One owner for the login. Tesla's refresh tokens work once each. Only the core reads or writes them, behind a file lock, and it saves each new one before doing anything else. Two clients holding copies would log each other out.
- Waking is a choice, not a tool. There is no wake tool to call on reflex. Status reads take a wake flag that defaults to off, so an asleep car is reported as asleep.
- Tools shaped like questions. Four tools: list vehicles, vehicle status, Supercharger history and API spend. No endpoint mirror and no raw passthrough, which would quietly turn a read-only server into full control. A test fails if a command tool is ever added.
- Spend you can see. Every request is counted in a local ledger, so "what has this cost me?" is a question Claude can answer.
- A stranger is refused before seeing anything. GitHub sign-in alone would admit any GitHub user, so an allowlist refuses every other account at the connection handshake, before it can even list the tools.
- Autonomous agents get a smaller budget. Each client is named by where its sign-in returns to. Claude Code and claude.ai get 5 wakes a day; Muse, which acts on its own and reads untrusted content like email, gets 2. Daily caps and an $8 monthly ceiling are checked before any request is sent, so a refused call costs nothing.
- An audit log that never holds car data. One line per call, refusal and rejected sign-in. It records that location was read, never where the car was. It caught two of my own bugs during the build, both in how clients were named.
- Secrets in one place. Deploy secrets live in a 1Password vault. GitHub holds a single read-only key to it. The Tesla client secret and private key never reach the server.
Where it goes next
- Read-only, one client. Done. Claude Code on my laptop, verified against the real car.
- A few signed commands, such as lock and climate, each requiring confirmation, after pairing a virtual key with the car. Only if I find I actually want one.
- A hosted server that owns the login and serves every client. Done. Claude Code, claude.ai on web and phone, and Muse, all through the same gate.
Built with Python, FastMCP, Fly.io, 1Password and Claude Code. Source under the MIT license at github.com/toneeraj/tesla-fleet-mcp.