Tesla MCP Server

by robcerda

224 downloads Not rated yet
GitHub

About

MCP Server for Tesla Products, specifically using the Owner API

Explore

- Integrates Claude Desktop with the Tesla Owner API
- OAuth2 authentication with browser-based login
- Retrieve vehicle and solar system data
- Send commands to vehicles
- Local development with mcp run src/tesla_mcp_server/server.py
- Refresh token persistence across sessions

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Tesla MCP Server
    Command (node, npx, python, etc.)

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

Python 3.12 or higher
Model Context Protocol (MCP) Python SDK
httpx
python-dotenv

curl -LsSf https://astral.sh/uv/install.sh | sh

uv venv

This server uses Tesla's Owner API and implements a secure OAuth2 authentication flow. On first run, you will be prompted to authenticate via your browser. After successful authentication, a refresh_token.txt file will be created and used for future sessions. Do not commit refresh_token.txt to version control.

To use this server with Claude Desktop, you need to add it to your Claude Desktop configuration.

1. Run the following from the tesla_mcp_server directory to configure Claude Desktop:

bash
mcp install src/tesla_mcp_server/server.py --name "Tesla" --with-editable .

2. If you open your Claude Desktop App configuration file claude_desktop_config.json, it should look like this:

json
{
"mcpServers": {
"Tesla": {
"command": "/Users/<USERNAME>/.cargo/bin/uv",
"args": [
"run",
"--with",
"mcp[cli]",
"--with-editable",
"/path/to/tesla-mcp-server",
"mcp",
"run",
"/path/to/tesla-mcp-server/src/tesla_mcp_server/server.py"
],
"env": {
"LOG_LEVEL": "INFO"
}
}
}
}

Where /path/to/ is the path to the tesla-mcp-server code folder in your system.

3. Restart Claude Desktop.

- On first run, you will be prompted to authenticate via your browser. Follow the instructions in the terminal.
- After authenticating, a refresh_token.txt file will be created and used for future sessions.
- If you ever need to re-authenticate, simply delete refresh_token.txt and restart the server.

To start the server manually (useful when developing or testing), run:

bash
mcp run src/tesla_mcp_server/server.py
```

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "tesla mcp server": {
            "tesla-mcp-server": {
                "command": "uv",
                "args": [
                    "venv"
                ]
            }
        }
    }
}

McpServers

{
    "tesla-mcp-server": {
        "command": "uv",
        "args": [
            "venv"
        ]
    }
}

Model Context Protocol (MCP) server for connecting Claude with the Tesla Owner API. It provides tools for authentication and data retrieval for Tesla vehicles and solar systems.

Requirements

Python 3.12 or higher
Model Context Protocol (MCP) Python SDK
httpx
python-dotenv

Setup

1. Install uv (recommended)

curl -LsSf https://astral.sh/uv/install.sh | sh

2. Clone this repository

git clone https://github.com/yourusername/tesla-mcp-server.git
cd tesla-mcp-server

3. Create and activate a virtual environment

```bash

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.