home / mcp / teslamate mcp server
A Model Context Protocol (MCP) server that provides access to your TeslaMate database, allowing AI assistants to query Tesla vehicle data and analytics.
Configuration
View docs{
"mcpServers": {
"cobanov-teslamate-mcp": {
"url": "http://localhost:8888/mcp",
"headers": {
"AUTH_TOKEN": "YOUR_TOKEN",
"DATABASE_URL": "postgresql://user:pass@host:5432/teslamate"
}
}
}
}You can connect your TeslaMate PostgreSQL database to AI assistants using this MCP server, enabling natural language queries about your Tesla data while keeping safety and structure intact.
You will run the MCP server either locally or remotely and then connect an MCP client to start asking questions about your Tesla data. Use the predefined queries to get quick insights on battery health, driving patterns, charging behavior, and more. You can also run custom SQL SELECT queries against your TeslaMate schema in a read-only, validated fashion. Start by ensuring your TeslaMate database is reachable from the MCP server and that authentication (if used) is configured.
Prerequisites: you need a working TeslaMate instance with PostgreSQL, Python 3.11 or newer for local usage, or Docker for remote deployments.
# Local setup using UVX (Cursor/Claude Desktop style)
git clone https://github.com/cobanov/teslamate-mcp.git
cd teslamate-mcp
cp env.example .env
# Edit .env to set your DATABASE_URL
uv sync
# Local MCP client configuration example (inline JSON)
```
```json
{
"mcpServers": {
"teslamate": {
"command": "uv",
"args": ["--directory", "/path/to/teslamate-mcp", "run", "main.py"]
}
}
}If you prefer remote deployment, you can run the MCP server with Docker. After you have a .env with your DATABASE_URL, start the container stack with the following command.
git clone https://github.com/cobanov/teslamate-mcp.git
cd teslamate-mcp
cp env.example .env
# Edit .env with your DATABASE_URL
docker-compose up -dOnce running, the MCP server is available at http://localhost:8888/mcp. Connect your MCP client to this URL and begin issuing natural language queries or SELECT-based requests through the safe, read-only endpoints.
Create your environment file with the following keys. These values are required to establish the TeslaMate connection and optional for remote authentication.
DATABASE_URL=postgresql://user:pass@host:5432/teslamate
AUTH_TOKEN= # Optional: for remote authIf you want to enable optional token-based authentication for remote deployments, generate an auth token using the provided helper.
python utils/generate_token.pyReturns VIN, model, and firmware details for the connected TeslaMate vehicle.
Provides real-time status including location and battery state.
Shows firmware update history for the vehicle.
Summarizes current battery health metrics.
Charts historical battery capacity degradation.
Reveals daily patterns in battery usage.
Tracks weekly tire pressure trends.
Aggregates driving stats on a monthly basis.
Analyzes daily driving habits.
Identifies top trips by distance.
Displays lifetime distance and efficiency.
Provides daily drive summaries.
Analyzes efficiency by month and ambient temperature.
Averages efficiency across temperature ranges.
Detects anomalous power usage.
Shows charging patterns by location.
Summarizes all charging sessions.
Lists locations visited most often.
Views the database schema.
Executes safe SELECT queries against the database.