Tesla MCP Server

Tesla MCP Server

Connects Claude with the Tesla Owner API, enabling authentication and data retrieval for Tesla vehicles and solar systems.

Category
Visit Server

README

Tesla MCP Server

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.11
  • 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

# Create virtual environment
uv venv

# Activate virtual environment
# On macOS/Linux:
source .venv/bin/activate
# On Windows:
.venv\Scripts\activate

4. Sync project dependencies

uv sync

Usage

Authentication Setup

This server uses Tesla's Owner API and implements a secure OAuth2 authentication flow. Before using the server with Claude Desktop, you must first run the authentication setup script.

1. Run Authentication Setup

IMPORTANT: You must run this setup script before using the server with Claude:

python setup_auth.py

This script will:

  • Prompt you to authenticate via your browser
  • Walk you through the Tesla OAuth2 flow
  • Create a refresh_token.txt file for future sessions
  • Test the API connection to ensure everything works

Do not commit refresh_token.txt to version control.

2. Authentication Flow Details

  • On first run of setup_auth.py, you will be prompted to authenticate via your browser
  • Follow the instructions in the terminal to complete the OAuth2 flow
  • After successful authentication, a refresh_token.txt file will be created and used for future sessions
  • The refresh token will be automatically used by the MCP server for subsequent API calls

Configure Claude Desktop

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:
mcp install src/tesla_mcp_server/server.py --name "Tesla" --with-editable .
  1. If you open your Claude Desktop App configuration file claude_desktop_config.json, it should look like this:
{
  "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.

  1. Restart Claude Desktop.

Use the MCP server with Claude

Once the server is running and Claude Desktop is configured, you can use the following tools to interact with your Tesla systems:

  • tesla_auth_status: Check Tesla authentication status
  • get_vehicles: Get a list of all your vehicles
  • get_vehicle: Get detailed information about a specific vehicle
  • send_command: Send a command to a vehicle
  • get_solar_system: Get status of a solar system
  • get_solar_history: Get history of a solar system
  • get_system_summary: Get a summary of all Tesla systems

Re-authentication

  • If you ever need to re-authenticate, simply delete refresh_token.txt and run python setup_auth.py again.

Development and testing

Install development dependencies and run the test suite with:

uv sync --all-extras
pytest -v tests

Running the server locally

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

mcp run src/tesla_mcp_server/server.py

License

The GNU General Public License v3.0

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured