๐Ÿš— Tesla MCP Server

โœ… Server is running
๐Ÿ” Authentication Required
This API requires an API key for access.
โš ๏ธ Tesla API Access Required
This server requires valid Tesla Developer Portal credentials and a refresh token. You must own a Tesla vehicle and have registered as a Tesla developer.

About

This is a Model Context Protocol (MCP) server that connects to the Tesla Fleet API, allowing you to control your Tesla vehicle through AI assistants. It provides access to vehicle information, wake-up functionality, and debugging tools.

๐Ÿ“ง API Key Access
To request an API key for this service, please contact:
bartosz.dariusz.majewski@gmail.com

API Endpoint

POST requests to: https://tesla.mcp.majewscy.tech/

๐Ÿ”‘ Required HTTP Headers

For MCP authentication:

x-api-key

Your server authentication key (contact us for access)

For Tesla API access:

x-tesla-client-id

Your Tesla Developer Portal Client ID

x-tesla-client-secret

Your Tesla Developer Portal Client Secret

x-tesla-refresh-token

Your Tesla OAuth refresh token

๐Ÿงช Test Your Connection

1. List Available Tools

curl -X POST https://tesla.mcp.majewscy.tech/ \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_SERVER_KEY" \
  -H "x-tesla-client-id: YOUR_CLIENT_ID" \
  -H "x-tesla-client-secret: YOUR_CLIENT_SECRET" \
  -H "x-tesla-refresh-token: YOUR_REFRESH_TOKEN" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/list",
    "id": 1
  }'

2. Debug Vehicles

curl -X POST https://tesla.mcp.majewscy.tech/ \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_SERVER_KEY" \
  -H "x-tesla-client-id: YOUR_CLIENT_ID" \
  -H "x-tesla-client-secret: YOUR_CLIENT_SECRET" \
  -H "x-tesla-refresh-token: YOUR_REFRESH_TOKEN" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "debug_vehicles",
      "arguments": {}
    },
    "id": 2
  }'

3. Wake Up Vehicle

curl -X POST https://tesla.mcp.majewscy.tech/ \
  -H "Content-Type: application/json" \
  -H "x-api-key: YOUR_SERVER_KEY" \
  -H "x-tesla-client-id: YOUR_CLIENT_ID" \
  -H "x-tesla-client-secret: YOUR_CLIENT_SECRET" \
  -H "x-tesla-refresh-token: YOUR_REFRESH_TOKEN" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
      "name": "wake_up",
      "arguments": {
        "vehicle_id": "YOUR_VEHICLE_ID"
      }
    },
    "id": 3
  }'

๐Ÿ”ง Configuration Examples

Claude Code (.mcp.json)

{
  "mcpServers": {
    "tesla": {
      "type": "http",
      "url": "https://tesla.mcp.majewscy.tech/",
      "headers": {
        "x-api-key": "YOUR_SERVER_KEY",
        "x-tesla-client-id": "YOUR_CLIENT_ID",
        "x-tesla-client-secret": "YOUR_CLIENT_SECRET",
        "x-tesla-refresh-token": "YOUR_REFRESH_TOKEN"
      }
    }
  }
}

Bridge Mode (.env)

MCP_URL=https://tesla.mcp.majewscy.tech/
MCP_API_KEY=YOUR_SERVER_KEY
TESLA_CLIENT_ID=YOUR_CLIENT_ID
TESLA_CLIENT_SECRET=YOUR_CLIENT_SECRET
TESLA_REFRESH_TOKEN=YOUR_REFRESH_TOKEN

Available Tools

๐Ÿš— Tesla Vehicle Control

  • wake_up - Wake up your Tesla from sleep mode
  • refresh_vehicles - Refresh the list of Tesla vehicles
  • debug_vehicles - Show detailed vehicle information (ID, VIN, state)

Note: As of October 2023, Tesla has deprecated many vehicle command endpoints. This server currently supports only REST API endpoints that remain functional.

๐Ÿ”‘ Getting Tesla API Credentials

  1. Register as Tesla Developer: Go to Tesla Developer Portal
  2. Create Application: Create a new application to get Client ID and Client Secret
  3. Get Refresh Token: Use Tesla's OAuth flow to obtain a refresh token
  4. Register Application: Register your app with Tesla's Partner Accounts API

Requirements: You must own a Tesla vehicle and have a Tesla account to access the API.

โŒ Common Errors

Invalid API Key

{"jsonrpc":"2.0","id":1,"error":{"code":-32001,"message":"Invalid API Key"}}

Solution: Check your x-api-key header value

Missing Tesla Credentials

{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Tesla credentials required"}}

Solution: Provide all Tesla API headers (client-id, client-secret, refresh-token)

Vehicle Not Found

{"jsonrpc":"2.0","id":1,"error":{"code":-32603,"message":"Vehicle not found"}}

Solution: Use debug_vehicles to get correct vehicle IDs

Health Check

GET /health - Returns server status (no authentication required)

Learn More