teslamate-mcp
The TeslaMate MCP server enables AI assistants to query and analyze Tesla vehicle data from a TeslaMate PostgreSQL database through natural language.
Key Capabilities:
Vehicle Information: Retrieve basic details (VIN, model, color), current status (location, battery level, temperature), and software update history
Battery Analytics: Monitor health and degradation over time, track daily usage patterns
Driving Insights: Access monthly/daily summaries, identify longest drives, view total distance and efficiency metrics
Efficiency Analysis: Analyze trends by month and temperature, detect unusual power consumption
Charging Data: View all charging sessions and statistics by location
Location Tracking: Identify most visited places and analyze location patterns
Tire Monitoring: Track tire pressure trends over time
Custom Queries: Execute safe, read-only SQL SELECT queries with complete database schema access and built-in validation to prevent data modification
All data access is secure and read-only, making it safe for comprehensive Tesla vehicle data exploration and analysis.
Connects to a PostgreSQL database containing TeslaMate data to retrieve and analyze Tesla vehicle information.
Allows querying Tesla vehicle data from a TeslaMate database, providing access to vehicle information, driving statistics, charging data, battery health, efficiency metrics, and location analytics.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@teslamate-mcpwhat's my current battery health?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
TeslaMate MCP Server
A Model Context Protocol server that exposes your TeslaMate PostgreSQL database to MCP-aware AI clients (Claude Desktop, Cursor, etc.) over either stdio or streamable HTTP.
Features
20 tools — 18 predefined analytics queries (battery, charging, driving, efficiency, locations) plus
run_sqlandget_database_schema6 prompts — one-click workflows for battery health, driving summary, charging behaviour, anomaly hunting, weather efficiency, and a quick status report
2 resources —
teslamate://queriesandteslamate://queries/{name}for catalog browsing without invoking a toolHardened
run_sql— runs inside a PostgreSQLREAD ONLYtransaction withstatement_timeout,lock_timeout, and an automatic row capLive schema introspection —
get_database_schemareadsinformation_schemaat runtime; no stale JSON checked into the repoTwo transports, one binary —
teslamate-mcp stdiofor local clients,teslamate-mcp httpfor remoteBearer-token auth with timing-safe comparison;
/healthprobe for liveness checksDecimal → floatJSON serialization so language models see numbers, not strings
Related MCP server: Tesla MCP Server
Requirements
TeslaMate already running against PostgreSQL
Python 3.11+ for a local install, or Docker for a remote deployment
Install
git clone https://github.com/cobanov/teslamate-mcp.git
cd teslamate-mcp
cp env.example .env
# Edit .env — at minimum, set DATABASE_URL
uv syncCLI
The teslamate-mcp console script has four subcommands:
teslamate-mcp stdio # local (Cursor / Claude Desktop)
teslamate-mcp http [--host] [--port] # remote (HTTP / SSE)
teslamate-mcp gen-token # produce an AUTH_TOKEN value
teslamate-mcp list-tools # diagnostic: list registered toolspython -m teslamate_mcp <subcommand> works too.
Local use (stdio)
Configure your MCP client to launch the stdio server. Example for Cursor or Claude Desktop:
{
"mcpServers": {
"teslamate": {
"command": "uv",
"args": ["--directory", "/path/to/teslamate-mcp", "run", "teslamate-mcp", "stdio"]
}
}
}Remote use (Docker)
cp env.example .env
# Set DATABASE_URL and ideally AUTH_TOKEN
docker compose up -dThe MCP endpoint is at http://localhost:8888/mcp and a liveness probe is exposed at http://localhost:8888/health.
A prebuilt multi-arch image (linux/amd64, linux/arm64) is also published to GHCR on every tagged release:
docker run --rm -e DATABASE_URL=... -p 8888:8888 ghcr.io/cobanov/teslamate-mcp:latestConfiguration
All settings are read from environment variables (.env supported). Only DATABASE_URL is required.
Variable | Default | Notes |
| required |
|
| empty | Enables bearer auth on the HTTP endpoint |
|
| HTTP bind host |
|
| HTTP bind port |
|
| psycopg pool floor |
|
| psycopg pool ceiling |
|
|
|
|
| LIMIT injected when |
|
| Standard Python log level |
|
| Starlette debug mode (keep off in production) |
Generate a bearer token:
uv run teslamate-mcp gen-tokenAvailable tools
Predefined (18)
Vehicle: get_basic_car_information, get_current_car_status, get_software_update_history
Battery & health: get_battery_health_summary, get_battery_degradation_over_time, get_daily_battery_usage_patterns, get_tire_pressure_weekly_trends
Driving: get_monthly_driving_summary, get_daily_driving_patterns, get_longest_drives_by_distance, get_total_distance_and_efficiency, get_drive_summary_per_day
Efficiency: get_efficiency_by_month_and_temperature, get_average_efficiency_by_temperature, get_unusual_power_consumption
Charging & location: get_charging_by_location, get_all_charging_sessions_summary, get_most_visited_locations
Custom (2)
get_database_schema— current TeslaMate schema (one row per column)run_sql(query)— execute a customSELECTorWITH … SELECT
Adding a new query
Drop a SELECT into
src/teslamate_mcp/queries/your_query.sql.Add a sibling
your_query.toml:name = "get_your_data" description = "What this returns."Restart the server. The registry picks it up automatically.
Development
uv sync # install with dev deps
uv run ruff check src tests # lint
uv run ruff format src tests # format
uv run pytest # tests (Docker-backed integration tests skip if Docker is absent)License
MIT — see LICENSE.
Featured in
Maintenance
Latest Blog Posts
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/cobanov/teslamate-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server