RepositoryPythonTRTürkiye
cobanov

cobanov/teslamate-mcp

A Model Context Protocol (MCP) server that provides access to your TeslaMate database, allowing AI assistants to query Tesla vehicle data and analytics.

142stars
25forks
0issues
3views

Featured achievements

The project's latest awards

1
TINIX TRENDING·Topic: teslamate

#1 Repository of the week

2
TINIX TRENDING·Topic: tesla-api

#2 Repository of the week

3
TINIX TRENDING·Topic: tesla

#3 Repository of the week

TeslaMate MCP Server

TeslaMate MCP Server demo

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.

CI Release GHCR Python License Ruff Archestra Trust Score

Features

  • 20 tools — 18 predefined analytics queries (battery, charging, driving, efficiency, locations) plus run_sql and get_database_schema
  • 6 prompts — one-click workflows for battery health, driving summary, charging behaviour, anomaly hunting, weather efficiency, and a quick status report
  • 2 resources — teslamate://queries and teslamate://queries/{name} for catalog browsing without invoking a tool
  • Hardened run_sql — runs inside a PostgreSQL READ ONLY transaction with statement_timeout, lock_timeout, and an automatic row cap
  • Live schema introspection — get_database_schema reads information_schema at runtime; no stale JSON checked into the repo
  • Two transports, one binary — teslamate-mcp stdio for local clients, teslamate-mcp http for remote
  • Bearer-token auth with timing-safe comparison; /health probe for liveness checks
  • Decimal → float JSON serialization so language models see numbers, not strings

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 sync

CLI

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 tools

python -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 -d

The 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:latest

Configuration

All settings are read from environment variables (.env supported). Only DATABASE_URL is required.

VariableDefaultNotes
DATABASE_URLrequiredpostgresql://user:pass@host:5432/teslamate
AUTH_TOKENemptyEnables bearer auth on the HTTP endpoint
HOST0.0.0.0HTTP bind host
PORT8888HTTP bind port
POOL_MIN_SIZE1psycopg pool floor
POOL_MAX_SIZE10psycopg pool ceiling
QUERY_TIMEOUT_MS5000statement_timeout for run_sql
CUSTOM_SQL_ROW_LIMIT1000LIMIT injected when run_sql doesn't supply one
LOG_LEVELINFOStandard Python log level
DEBUGfalseStarlette debug mode (keep off in production)

Generate a bearer token:

uv run teslamate-mcp gen-token

Available 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 custom SELECT or WITH … SELECT

Adding a new query

  1. Drop a SELECT into src/teslamate_mcp/queries/your_query.sql.

  2. Add a sibling your_query.toml:

    name = "get_your_data"
    description = "What this returns."
    
  3. 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.

MseeP.ai security audit   Glama MCP catalog

Similar Projects

Discover other similar projects and AI models.

RepositoryTypeScript
morluto/rea

Reverse engineer anything with agents, from app behavior down to native binaries.

487.0k
Dec 2, 2026
RepositoryPython
jheredianet/Teslamate-CustomGrafanaDashboards

Custom Grafana Dashboards for Teslamate 🚘

388
Oct 19, 2026
RepositoryTypeScript
upstash/context7

Context7 Platform -- Up-to-date docs for AI agents

65.7k
Dec 1, 2026
RepositoryTypeScript
sansan0/TrendRadar

⭐AI-driven public opinion & trend monitor with multi-platform aggregation, RSS, web search, MCP & smart alerts.🎯 告别信息过载,你的 AI 舆情监控助手与热点筛选工具!聚合多平台热点 + RSS 订阅 + 定时联网搜索,支持关键词与 AI 智能筛选。AI 翻译 + AI 分析简报直推手机,支持接入 MCP 架构,赋能 AI 自然语言对话分析、实时检索、情感洞察与趋势预测。支持 Docker,数据本地/云端自持。集成微信/飞书/钉钉/Telegram/邮件/ntfy/Bark/Slack 等渠道智能推送。

64.0k
Nov 29, 2026
RepositoryTypeScript
ChromeDevTools/chrome-devtools-mcp

Chrome DevTools for coding agents

60.2k
Dec 2, 2026
RepositoryC
DeusData/codebase-memory-mcp

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

49.3k
Nov 29, 2026
RepositoryTypeScript
bytedance/UI-TARS-desktop

The Open-Source Multimodal AI Agent Stack: Connecting Cutting-Edge AI Models and Agent Infra

39.6k
Oct 9, 2026
RepositoryGo
github/github-mcp-server

GitHub's official MCP Server

34.9k
Dec 1, 2026
RepositoryElixir
teslamate-org/teslamate

A self-hosted data logger for your Tesla 🚘 [main maintainer=@JakobLichterfeld]

9.3k
Dec 1, 2026