Tesla MCP Server

Control your Tesla and get vehicle data from any MCP-capable AI assistant.

README.md

Tesla MCP Server

A Model Context Protocol (MCP) server for the Tesla Fleet API. Control your Tesla and get vehicle data (location, wake up, list cars) from any MCP-capable AI assistant or agent.

Features

  • list_cars — List your vehicles and get IDs for use with other tools
  • get_vehicle_location — Current GPS location and Google Maps link (parking monitor style)
  • wake_up — Wake a vehicle from sleep
  • refresh_vehicles / debug_vehicles — Refresh list and debug info
  • HTTP/SSE mode — Host as a web service; each user brings their own Tesla Developer credentials (no server-side secrets required)
  • Receive and respond to texts (optional) — With Twilio configured, receive inbound SMS via webhook and use get_recent_texts / send_text so the agent can read and reply to messages

Security

  • We never see or store your Tesla password. Sign-in is via Tesla’s OAuth in your browser.
  • HTTP mode: Credentials and tokens are stored in memory per session only; not written to disk.
  • No sensitive data in logs — We do not log tokens, full session IDs, or API response bodies.
  • Before you commit: Run ./check-secrets.sh to catch accidental hardcoded secrets.

See SECURITY.md for details and how to report issues.


Quick Start (Hosted — recommended)

Use the server without running anything locally. Each user connects with their own Tesla account.

1. Add the server in your MCP client

  • Server URL: https://tesla-mcp.onrender.com/sse
    (Or use your own deployed URL; see Deploy below.)

2. First time: connect your Tesla

  1. Use a tool (e.g. get_setup_url) — the agent will return a link.
  2. Open the link and enter your Tesla Developer Client ID and Client Secret.
  3. Log in with your Tesla account when redirected.
  4. On the success page, copy the connection URL (e.g. https://.../sse?token=...). Use that URL as your MCP server URL in your client so reconnects keep you logged in. Keep it private.
  5. If you don’t add that URL, your client may get a new session on each reconnect and ask you to set up again.

Getting Tesla Developer credentials: Create an app at developer.tesla.com. Set the redirect URI to https://YOUR_SERVER_URL/auth/callback (e.g. https://tesla-mcp.onrender.com/auth/callback).

Render: Set Instance count to 1 (Dashboard → your service → Settings) so all requests hit the same server and your session isn’t lost.


Quick Start (Local)

Option A: HTTP server (multi-user, browser auth)

git clone https://github.com/Sara3/Tesla-MCP.git
cd Tesla-MCP
npm install
npm run build
npm run start:http
  • Open http://localhost:3000 and follow the setup link to add your Tesla Developer credentials and sign in.
  • In your MCP client, use Server URL: http://localhost:3000/sse (for production use HTTPS and set BASE_URL).

Option B: Stdio (single user, .env only)

For a single user with credentials in .env:

# .env
TESLA_CLIENT_ID=...
TESLA_CLIENT_SECRET=...
TESLA_REFRESH_TOKEN=...
npm run build
npm start

Configure your MCP client to run the server command (e.g. node run-mcp.js). Get a refresh token with npm run get-token.


Environment variables

Variable Required Description
HTTP mode
BASE_URL Yes (production) Public HTTPS URL of your server (e.g. https://tesla-mcp.onrender.com)
TESLA_CLIENT_ID Optional If set with TESLA_CLIENT_SECRET, users go straight to the Tesla login page (no setup page)
TESLA_CLIENT_SECRET Optional Server Tesla app secret; use with TESLA_CLIENT_ID
PORT No Port (default 3000)
HOST No Bind address (default 0.0.0.0)
Stdio mode
TESLA_CLIENT_ID Yes From developer.tesla.com
TESLA_CLIENT_SECRET Yes From developer portal
TESLA_REFRESH_TOKEN Yes From npm run get-token
SMS (Twilio, HTTP mode only)
TWILIO_ACCOUNT_SID Optional Twilio account SID (enables get_recent_texts / send_text)
TWILIO_AUTH_TOKEN Optional Twilio auth token
TWILIO_PHONE_NUMBER Optional Your Twilio phone number (E.164, e.g. +15551234567)

SMS setup: In the Twilio console, set your phone number’s “A message comes in” webhook to https://YOUR_BASE_URL/webhooks/twilio/sms (e.g. https://tesla-mcp.onrender.com/webhooks/twilio/sms). Inbound messages are stored in memory and returned by get_recent_texts; use send_text to reply.

Never commit .env or keys/. Run ./check-secrets.sh before pushing.


Tools (MCP)

Tool Description
get_setup_url Get the URL to set up Tesla Developer credentials
get_auth_url Get the URL to connect your Tesla account (after setup)
**li

Tools 7

list_carsList your vehicles and get IDs for use with other tools
get_vehicle_locationGet current GPS location and Google Maps link
wake_upWake a vehicle from sleep
get_setup_urlGet the URL to set up Tesla Developer credentials
get_auth_urlGet the URL to connect your Tesla account
get_recent_textsRetrieve recent SMS messages (requires Twilio)
send_textSend an SMS message (requires Twilio)

Environment Variables

BASE_URLPublic HTTPS URL of your server for production
TESLA_CLIENT_IDTesla Developer Client ID
TESLA_CLIENT_SECRETTesla Developer Client Secret
TESLA_REFRESH_TOKENTesla refresh token for Stdio mode
TWILIO_ACCOUNT_SIDTwilio account SID for SMS features

Try it

List all my Tesla vehicles and tell me their current status.
Wake up my Model 3 and get its current GPS location.
Check if I have any recent text messages on my car's connected phone.
Send a text message to my spouse saying I am on my way home.

Frequently Asked Questions

What are the key features of Tesla MCP Server?

List and identify Tesla vehicles. Retrieve real-time GPS location and mapping links. Remote vehicle wake-up functionality. Optional SMS integration via Twilio for reading and sending messages. Supports both Stdio and HTTP/SSE transport modes.

What can I use Tesla MCP Server for?

Monitoring vehicle location for parking security. Automating vehicle wake-up before a scheduled departure. Integrating car status updates into a personal AI dashboard. Managing SMS communications through an AI agent while driving.

How do I install Tesla MCP Server?

Install Tesla MCP Server by running: npm install && npm run build && npm start

What MCP clients work with Tesla MCP Server?

Tesla MCP Server works with any MCP-compatible client including Claude Desktop, Claude Code, Cursor, and other editors with MCP support.

Turn this server into reusable context

Keep Tesla MCP Server docs, env vars, and workflow notes in Conare so your agent carries them across sessions.

Open Conare