by cobanov
A Model Context Protocol (MCP) server that provides access to your TeslaMate database, allowing AI assistants to query Tesla vehicle data and analytics.
# Add to your Claude Code skills
git clone https://github.com/cobanov/teslamate-mcp
A Model Context Protocol (MCP) server that connects your TeslaMate database to AI assistants, enabling natural language queries about your Tesla data.
git clone https://github.com/cobanov/teslamate-mcp.git
cd teslamate-mcp
cp env.example .env
# Edit .env with your DATABASE_URL
uv sync
Configure your MCP client:
{
"mcpServers": {
"teslamate": {
"command": "uv",
"args": ["--directory", "/path/to/teslamate-mcp", "run", "main.py"]
}
}
}
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 -d
Server available at: http://localhost:8888/mcp
Create .env file:
DATABASE_URL=postgresql://user:pass@host:5432/teslamate
AUTH_TOKEN= # Optional: for remote auth
Generate auth token (optional):
python utils/generate_token.py
Vehicle Info:
get_basic_car_information - VIN, model, firmwareget_current_car_status - Real-time status, location, batteryget_software_update_history - Firmware update timelineBattery & Health:
get_battery_health_summary - Current health metricsget_battery_degradation_over_time - Historical capacityget_daily_battery_usage_patterns - Usage patternsget_tire_pressure_weekly_trends - Tire pressure trackingDriving Analytics:
get_monthly_driving_summary - Monthly statisticsget_daily_driving_patterns - Driving habitsget_longest_drives_by_distance - Top tripsget_total_distance_and_efficiency - Lifetime statsget_drive_summary_per_day - Daily summariesEfficiency:
get_efficiency_by_month_and_temperature - Seasonal analysisget_average_efficiency_by_temperature - Temperature impactget_unusual_power_consumption - Anomaly detectionCharging & Location:
get_charging_by_location - Charging patternsget_all_charging_sessions_summary - Complete historyget_most_visited_locations - Frequent placesget_database_schema - View database structurerun_sql - Execute custom SELECT queries (read-only, validated)"What's my current battery health?"
"Show me my longest drives"
"How does cold weather affect my efficiency?"
"Where do I charge most often?"
"Run a SQL query to find drives over 100km"
teslamate-mcp/
āāā src/ # Core modules
ā āāā config.py # Configuration
ā āāā database.py # DB operations
ā āāā tools.py # Tool registry
ā āāā validators.py # SQL validation
āāā queries/ # 18 SQL query files
āāā data/ # Database schema
āāā utils/ # Helper scripts
āāā main.py # Local (STDIO)
āāā main_remote.py # Remote (HTTP)
āāā Dockerfile
āāā docker-compose.yml
queries/:-- queries/my_query.sql
SELECT * FROM my_table;
src/tools.py:ToolDefinition(
name="get_my_data",
description="What this returns",
sql_file="my_query.sql",
)
python test_server.py
This project is licensed under the MIT License. See the LICENSE file for details.
No comments yet. Be the first to share your thoughts!