mcp-teslamate-fleet

mcp-teslamate-fleet

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.

Category
访问服务器

README

TeslaMate + Fleet API MCP Server

mcp-teslamate-fleet 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 tesla_status, tesla_drives, tesla_charging_history, tesla_battery_health, tesla_efficiency, tesla_location_history, tesla_state_history, tesla_software_updates TeslaMate
Analytics tesla_savings, tesla_trip_cost, tesla_efficiency_by_temp, tesla_charging_by_location, tesla_top_destinations, tesla_longest_trips, tesla_monthly_summary, tesla_vampire_drain TeslaMate
Live Data tesla_live Fleet API
Commands tesla_climate_on/off, tesla_set_temp, tesla_charge_start/stop, tesla_set_charge_limit, tesla_lock, tesla_unlock, tesla_honk, tesla_flash, tesla_trunk, tesla_sentry Fleet API

Safety: unlock and trunk commands require confirm=True. All commands are rate-limited to 40/day.

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:

  1. Register an app at developer.tesla.com
  2. Generate OAuth tokens — use Tesla's token generation flow
  3. Set up the HTTP proxy — commands must be signed using the Tesla Vehicle Command Protocol. Deploy the tesla-http-proxy from 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
TESLAMATE_DB_HOST (required) Postgres host
TESLAMATE_DB_PORT 5432 Postgres port
TESLAMATE_DB_USER teslamate Postgres user
TESLAMATE_DB_PASS (required) Postgres password
TESLAMATE_DB_NAME teslamate Database name

Fleet API

Variable Default Description
TESLA_VIN (required) Vehicle VIN
TESLA_TOKEN_FILE (required) Path to tokens.json with OAuth tokens
TESLA_CLIENT_ID Fleet API client ID (for token refresh)
TESLA_CLIENT_SECRET Fleet API client secret (for token refresh)
TESLA_PROXY_URL HTTP proxy URL for commands
TESLA_FLEET_URL NA region Fleet API endpoint (regional options)
TESLA_VERIFY_SSL true Set false for self-signed proxy certs

Vehicle Configuration

Variable Default Description
TESLA_CAR_ID 1 TeslaMate car ID (for multi-car instances)
TESLA_BATTERY_KWH 75 Usable battery capacity in kWh
TESLA_BATTERY_RANGE_KM 525 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
TESLA_ELECTRICITY_RATE 0.12 Electricity cost in $/kWh
TESLA_GAS_PRICE 3.50 Gas price in $/gallon (for comparison)
TESLA_GAS_MPG 28 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_id but 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 drives table 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

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选