mcp-teslamate-fleet
The mcp-teslamate-fleet server combines TeslaMate historical analytics with Tesla Fleet API live data and remote commands, providing comprehensive monitoring and control of your Tesla vehicle through MCP-compatible clients (Claude Code, Claude Desktop, Cursor, etc.).
Status & History (via TeslaMate)
tesla_status— Current battery, range, location, climate, and odometertesla_drives— Recent drives with distance, duration, efficiency, and locationstesla_charging_history— Charging sessions with energy added, duration, and locationtesla_battery_health— Battery degradation trends over timetesla_efficiency— Energy consumption trends (Wh/mi)tesla_location_history/tesla_top_destinations— Location history and most-visited placestesla_state_history— Vehicle state transitions (online/asleep/offline)tesla_software_updates— Firmware version history
Analytics (via TeslaMate)
tesla_savings— Gas savings vs. an equivalent gas vehicletesla_trip_cost— Estimated cost and range feasibility for a destinationtesla_efficiency_by_temp— How temperature affects energy consumptiontesla_charging_by_location— Charging patterns and costs by locationtesla_longest_trips— Longest road trips ranked by distancetesla_monthly_summary— Monthly miles, kWh, cost, and efficiencytesla_vampire_drain— Overnight battery loss while parked
Live Data (via Fleet API)
tesla_live— Real-time battery, charging, climate, locks, and Sentry Mode status
Remote Commands (via Fleet API)
Climate:
tesla_climate_on/off,tesla_set_tempCharging:
tesla_charge_start/stop,tesla_set_charge_limit(50–100%)Security:
tesla_lock/tesla_unlock(unlock requires confirmation)Alerts:
tesla_honk,tesla_flashtesla_trunk— Open/close trunk or frunk (requires confirmation)tesla_sentry— Enable/disable Sentry Mode
Commands are rate-limited to 40 per day for safety. The server requires a TeslaMate Postgres database for historical tools and Tesla Fleet API OAuth tokens for live data and commands.
Combines TeslaMate historical analytics with Tesla Fleet API live data and commands, allowing for monitoring vehicle status, analyzing driving/charging history, and executing remote commands like climate control and charging management.
TeslaMate + Fleet API MCP Server
MCP server combining TeslaMate historical analytics with Fleet API live data and commands. Works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible client.
The first MCP server to bring both data sources together — use TeslaMate for deep analytics and Fleet API for real-time control, or configure just one.
Features
29 tools across four categories:
Category | Tools | Backend |
Status & History |
| TeslaMate |
Analytics |
| TeslaMate |
Live Data |
| Fleet API |
Commands |
| Fleet API |
Safety: unlock and trunk commands require confirm=True. All commands are rate-limited to 40/day.
Related MCP server: teslamate-mcp
Quick Start
Claude Code (.mcp.json)
{
"mcpServers": {
"tesla": {
"command": "uvx",
"args": ["--from", "git+https://github.com/lodordev/mcp-teslamate-fleet", "mcp-teslamate-fleet"],
"env": {
"TESLAMATE_DB_HOST": "localhost",
"TESLAMATE_DB_PASS": "your_password",
"TESLA_VIN": "your_vin",
"TESLA_TOKEN_FILE": "/path/to/tokens.json",
"TESLA_CLIENT_ID": "your_client_id",
"TESLA_CLIENT_SECRET": "your_client_secret",
"TESLA_PROXY_URL": "https://localhost:4443",
"TESLA_VERIFY_SSL": "false"
}
}
}
}Claude Desktop (claude_desktop_config.json)
Same structure — add under mcpServers.
Local install
git clone https://github.com/lodordev/mcp-teslamate-fleet
cd tesla-mcp
pip install -e .Prerequisites
You need at least one of these backends configured. Both is ideal.
TeslaMate (analytics + history)
TeslaMate is an open-source Tesla data logger. It records driving, charging, and vehicle state to a Postgres database.
If you already run TeslaMate, you just need the database connection details. If not, see the TeslaMate installation guide.
Fleet API (live data + commands)
Tesla's Fleet API provides real-time vehicle data and remote commands. Setup requires:
Register an app at developer.tesla.com
Generate OAuth tokens — use Tesla's token generation flow
Set up the HTTP proxy — commands must be signed using the Tesla Vehicle Command Protocol. Deploy the
tesla-http-proxyfrom that repo
The proxy is only needed for commands (tesla_climate_on, tesla_lock, etc.). tesla_live works with just a token.
Tesla provides a $10/month free credit for Fleet API, which is more than enough for personal MCP use.
Configuration
All configuration is via environment variables.
TeslaMate Database
Variable | Default | Description |
| (required) | Postgres host |
|
| Postgres port |
|
| Postgres user |
| (required) | Postgres password |
|
| Database name |
Fleet API
Variable | Default | Description |
| (required) | Vehicle VIN |
| (required) | Path to |
| Fleet API client ID (for token refresh) | |
| Fleet API client secret (for token refresh) | |
| HTTP proxy URL for commands | |
| NA region | Fleet API endpoint (regional options) |
|
| Set |
Vehicle Configuration
Variable | Default | Description |
|
| TeslaMate car ID (for multi-car instances) |
|
| Usable battery capacity in kWh |
|
| EPA range at 100% in km |
Energy consumption is estimated from ideal range deltas using these values. Adjust for your vehicle:
Vehicle | Battery (kWh) | Range (km) |
Model 3 Standard Range | 54 | 350 |
Model 3 Long Range | 75 | 500 |
Model Y Long Range | 75 | 525 |
Model S Long Range | 100 | 650 |
Model X Long Range | 100 | 560 |
Cost Defaults
These are defaults — tesla_savings and tesla_trip_cost accept per-call overrides.
Variable | Default | Description |
|
| Electricity cost in $/kWh |
|
| Gas price in $/gallon (for comparison) |
|
| Comparable gas vehicle MPG |
Architecture
Single-file Python server (~1400 lines) using FastMCP. Two data paths:
┌─────────────┐ ┌──────────────┐
│ TeslaMate │────▶│ Postgres │──┐
│ (logger) │ │ (telemetry) │ │
└─────────────┘ └──────────────┘ │ ┌───────────┐ ┌────────────┐
├──▶│ tesla.py │────▶│ MCP Client │
┌─────────────┐ ┌──────────────┐ │ │ (server) │ │ (Claude, │
│ Tesla │────▶│ HTTP Proxy │──┘ └───────────┘ │ Cursor) │
│ Fleet API │ │ (commands) │ └────────────┘
└─────────────┘ └──────────────┘Limitations
Single vehicle — queries use a configurable
car_idbut tools don't accept it as a parameter. Multi-car users should run separate server instances.Imperial units — output is in miles, °F, and PSI. Metric support is planned.
Estimated kWh — TeslaMate's
drivestable doesn't include energy consumed directly. We estimate from ideal range deltas using your configured battery capacity. Accuracy is ~90-95%.
Credits
Inspired by cobanov/teslamate-mcp. Built with FastMCP and TeslaMate.
License
MIT
Available Tools
29 toolstesla_battery_healthA
Battery degradation trend — range at 100% charge over time.
Shows monthly snapshots of ideal range when battery is at 100%.
Inputs: no named parameters. Returns: result
tesla_charge_startA
Start charging (vehicle must be plugged in).
Inputs: no named parameters. Returns: result
tesla_charge_stopB
Stop charging.
Inputs: no named parameters. Returns: result
tesla_charging_by_locationB
Charging patterns by location — where you charge and how much.
Inputs: no named parameters. Returns: result
tesla_charging_historyC
Charging sessions over the last N days.
Shows energy added, duration, battery range, and location for each session.
Inputs: days. Returns: result
tesla_climate_offB
Stop climate preconditioning.
Inputs: no named parameters. Returns: result
tesla_climate_onA
Start climate preconditioning — heats or cools cabin to target temp.
Inputs: no named parameters. Returns: result
tesla_drivesA
Recent drives — distance, duration, efficiency, start/end locations.
Shows the last N days of driving activity with energy consumption.
Inputs: days. Returns: result
tesla_efficiencyC
Energy consumption trends — Wh/mi over time.
Shows weekly average efficiency from driving data.
Inputs: days. Returns: result
tesla_efficiency_by_tempB
Efficiency curve by temperature — Wh/mi at different temps.
Shows how outside temperature affects energy consumption.
Inputs: no named parameters. Returns: result
tesla_flashA
Flash the headlights.
Inputs: no named parameters. Returns: result
tesla_honkB
Honk the horn.
Inputs: no named parameters. Returns: result
tesla_liveA
Live vehicle data from Fleet API — real-time battery, charging, climate, locks, sentry.
More current than TeslaMate (which polls on intervals). Use this when you need the latest state right now.
Inputs: no named parameters. Returns: result
tesla_location_historyC
Where the car has been — top locations by time spent.
Groups positions by proximity and shows time at each cluster.
Inputs: days. Returns: result
tesla_lockB
Lock all doors.
Inputs: no named parameters. Returns: result
tesla_longest_tripsA
Top drives ranked by distance — your epic road trips.
Inputs: limit. Returns: result
tesla_monthly_summaryC
Monthly driving summary — miles, kWh, cost, efficiency.
Inputs: months. Returns: result
tesla_savingsA
Gas savings scorecard — how much you've saved vs a gas car.
Inputs: gas_price, mpg_equivalent. Returns: result
tesla_sentryB
Toggle sentry mode on or off.
Inputs: on. Returns: result
tesla_set_charge_limitA
Set charge limit percentage (50-100).
Inputs: percent. Returns: result
tesla_set_tempB
Set cabin temperature target (Fahrenheit). Both driver and passenger.
Inputs: temp_f. Returns: result
tesla_software_updatesB
Firmware version history — all recorded software versions and install dates.
Inputs: no named parameters. Returns: result
tesla_state_historyC
Vehicle state transitions — online, asleep, offline.
Shows when the car was awake vs sleeping, useful for vampire drain analysis.
Inputs: days. Returns: result
tesla_statusA
Current vehicle state — battery, range, location, climate, odometer.
Returns the latest position snapshot and vehicle info from TeslaMate.
Inputs: no named parameters. Returns: result
tesla_top_destinationsB
Most visited locations ranked by number of visits.
Inputs: limit. Returns: result
tesla_trip_costA
Estimate trip cost to a destination — kWh, cost, range check.
Uses your personal 30-day average efficiency and current battery level.
Inputs: destination (required), gas_price, mpg_equivalent. Returns: result
tesla_trunkA
Open or close the trunk or frunk. Requires confirm=True.
Inputs: which, confirm. Returns: result
tesla_unlockA
Unlock all doors. Requires confirm=True for safety.
Inputs: confirm. Returns: result
tesla_vampire_drainB
Vampire drain analysis — battery loss while parked overnight.
Checks for periods where the car was parked (no drives) for 8+ hours and measures battery drop.
Inputs: days. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 29 tools
Most tools target distinct actions or data views, but several analytics tools overlap in purpose: tesla_status and tesla_live both report current state, charging_history and charging_by_location overlap, and drives vs longest_trips and location_history vs top_destinations cover similar territory. The descriptions help, but users may struggle to pick the right tool without reading carefully.
All tools use a consistent tesla_ prefix and snake_case, which is clear and predictable. However, the pattern mixes noun-phrase names (tesla_status, tesla_drives, tesla_savings) with verb-phrase names (tesla_charge_start, tesla_set_temp, tesla_lock), so the naming convention is not fully uniform.
With 29 tools, this server is over the 25-tool threshold that starts to feel heavy. The scope is broad—covering both TeslaMate analytics and Fleet API controls—but several analytics tools could be consolidated without losing functionality.
The toolset covers core Tesla workflows well: live state, historical analytics, charging, climate, locks, and sentry mode. Minor gaps exist, such as no charge-port control, no window/vent controls, and no explicit multi-vehicle selection, but these are not critical for the apparent single-owner use case.
Maintenance
Related MCP Connectors
MCP server wrapping the Tesla Fleet API and TeslaMate API
Shared memory MCP server for Claude Code, Codex, Gemini CLI and Cursor. Cited, editable.
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
Official Fibery MCP server: query and update your workspace from any AI client via OAuth.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that connects to the Tesla Fleet API, allowing AI assistants like Claude to control Tesla vehicles and access vehicle information through natural language commands.20MIT
- AlicenseAqualityBmaintenanceA Model Context Protocol (MCP) server that provides access to your TeslaMate database, allowing AI assistants to query Tesla vehicle data and analytics.18142MIT
- AlicenseNot gradedqualityDmaintenanceEnables control and monitoring of Tesla vehicles through the Tessie API, providing access to vehicle state (battery, location, climate) and commands (lock/unlock, climate control, navigation) with support for both local and Cloudflare Worker deployment.11MIT
- FlicenseNot gradedqualityDmaintenanceProvides access to Tesla vehicle telemetry data via the Tessie API, enabling real-time monitoring of battery status, charging state, climate controls, location, and other vehicle metrics through 30+ tools with intelligent caching.-