Most smart-vehicle AI demos skip the uncomfortable part: either they route your car’s commands through an external SaaS server that holds your OAuth tokens, or they require running Tesla’s separate tesla-http-proxy sidecar as a long-lived background web server. Neither feels right when the physical object on the other end of a tool call can unlock doors, pop a frunk, or drain battery sitting in an airport garage.

We built vitruvian-tesla-mcp (teslactl) to solve both problems at once: one single static Go binary that speaks stdio MCP to Claude Desktop, Claude Code, or any MCP client, and speaks Tesla’s signed end-to-end vehicle protocol directly in-process with zero separate proxy daemon.

Blueprint wireframe illustration of a Tesla sedan connected via a glowing cryptographic key to a terminal cube Figure 1: teslactl mcp pairs one EC-P256 command key directly to your vehicle so AI tool calls arrive signed over Tesla’s end-to-end protocol with no intermediary server.


1. Zero Sidecars: Embedding vehicle-command Inside One Go Binary

Since Tesla migrated newer vehicles to the signed Fleet API (Vehicle Command Protocol), plain REST POST calls to /command/door_unlock no longer work on their own—every command must be signed using a locally held EC-P256 private key whose matching public key your vehicle approved during pairing.

Normally, developers run tesla-http-proxy listening on localhost with TLS certs and pass HTTP calls through it. That splits setup across two processes, adds port/cert friction, and creates a permanent local HTTP listener.

Instead, teslactl imports github.com/teslamotors/vehicle-command (v0.4.1) directly inside Go:

Architecture diagram of teslactl mcp signing commands in-process via ECDH sessions and private 0600 keys Figure 2: The AI client talks stdio MCP to teslactl mcp, which maintains encrypted ECDH vehicle sessions and signs commands in-process with ~/.config/vitruvian/tesla-mcp/private-key.pem (0600), while Tesla verifies against the public key hosted under /.well-known/appspecific/.

Everything needed from key generation to ongoing daily checks lives in one binary:

  • teslactl keygen generates your EC-P256 keypair inside mode 0700 ~/.config/vitruvian/tesla-mcp/ (files 0600) and prints the public key path to host at https://<your-domain>/.well-known/appspecific/com.tesla.3p.public-key.pem.
  • teslactl setup, register, and login configure Tesla Developer app credentials and PKCE OAuth (tokens.json).
  • teslactl pair opens the Tesla app key-pairing link, teslactl doctor verifies local setup without hitting the network unless requested, and teslactl mcp starts the stdio MCP server.

Because sessions are cached cleanly in sessions.json (0600) through StartSession and UpdateCachedSessions, repeated commands do not even re-negotiate handshakes unnecessarily.


2. Don’t Drain the Car Battery (or Burn Your Phone App’s Wake Slot)

An AI agent asked “Did I remember to plug in the car?” should never wake up a sleeping vehicle at 2:00 AM. Waking the car spins up the onboard computer, pulls 12V/HV battery power, takes up to a minute to respond, and costs $0.02 per wake on Tesla’s Fleet API (against Tesla’s $10/month free credit, whereas reads cost $0.002 and commands cost $0.001).

Worse, Tesla enforces a hard limit of 3 wake-up calls per minute per VIN across the entire vehicle. If a runaway retry loop or eager agent burns all 3 wakes, even the owner’s own Tesla phone app gets locked out when standing next to the car in the rain.

Decision flow showing zero-wake CachedVehicleData reads and 2-per-minute local file-locked wake metering Figure 3: Read queries default to CachedVehicleData (wake=false), while wake-capable operations meter against a local file-locked budget of 2 wakes per minute (wakes.json.lock), preserving the 3rd slot for your phone.

Our Fleet implementation (internal/tesla/fleet.go) builds two hard guardrails right into Go:

  1. Sleeping-car reads never wake: get_vehicle_status defaults to wake=false. When car.State is "asleep" or "offline", it fetches Tesla’s cached snapshot (CachedVehicleData), clears stale location and driving fields so the model never hallucinates an old GPS coordinate as current, and explicitly tells the agent how old the state may be.
  2. A 2-per-minute wake ceiling that fails closed: takeWake(vin) protects wake slots using a sync.Mutex plus an OS file lock on wakes.json.lock, capping teslactl at maxWakesPerMinute = 2. If wakes.json cannot be locked or written, it fails closed and refuses to wake the car—preserving Tesla’s 3rd slot per minute for your physical phone app.

3. Fail-Closed Auditing and Destructive Tool Boundaries

Giving an LLM physical access to a vehicle requires clear guardrails between routine comfort controls and security-sensitive actuators. We split enforcement across three layers:

Three-layer safety boundary combining DestructiveHint prompts, audited() pre-send logging, and 0600 keys Figure 4: Security-changing MCP tools carry DestructiveHint=true, every command must write a "requested" record to audit.log before any packet goes to Tesla, and the car itself verifies the local P-256 signature.

  • Layer 1 — Explicit confirmation hints: Tools like lock_doors, start_climate, and set_charge_limit are marked idempotent comfort actions. Access-changing tools—unlock_doors, open_trunk, open_frunk, vent_windows, open_charge_port, and disabling set_sentry_mode—set MCP’s DestructiveHint = true so supporting clients prompt you first, and carry server instructions forbidding agents from calling them as a side effect of another request.
  • Layer 2 — Fail-closed local audit log (audit.log): Before audited() inside server.go wakes the car or sends a command, it writes an NDJSON "requested" line to ~/.config/vitruvian/tesla-mcp/audit.log (0600). If writing the audit log fails, the command is immediately refused (refusing to send ...: the audit log cannot be written). Afterward, a matching "result" entry logs completion status, elapsed milliseconds, and any error.
  • Layer 3 — Car-side enforcement: Every physical action is signed with your local private key and verified by the vehicle’s own infotainment and security controllers—and can be revoked at any moment directly from the car’s Locks screen.

Try It Yourself

If you have a Tesla developer app (using Tesla’s $10/month free credit tier—plenty for personal single-car automation) and Go, you can build or run teslactl straight from the monorepo (apps/mcp/vitruvian-tesla-mcp) or grab a release build. Five minutes after running teslactl keygen, you can ask Claude things like “Check whether the car is locked and preheat to 70°F if I have at least 40% battery” without running any proxy daemon or trusting a third-party server with your keys.

See apps/mcp/vitruvian-tesla-mcp/README.md for full setup commands and the complete MCP tool reference.