scald/tesla-mcp
Built by Metorial, the integration platform for agentic AI.
scald/tesla-mcp
Server Summary
Wake up vehicles
Retrieve vehicle information
Provide real-time updates
Access troubleshooting tools
A Model Context Protocol (MCP) server that connects to the Tesla Fleet API, allowing you to control your Tesla vehicle using Claude and other AI assistants that support MCP.
This project handles sensitive Tesla API credentials. Please follow these security practices:
.gitignore
file excludes .env
and keys/
but always double-check./check-secrets.sh
before committing to detect potentially leaked credentialskeys/
directory secureWhen forking or sharing this project:
.env
file is not included.gitignore
file is properly set upClone the repository
git clone https://github.com/yourusername/tesla-mcp.git
cd tesla-mcp
Install dependencies
pnpm install
Set up environment variables
Create a .env
file in the root directory:
TESLA_CLIENT_ID=your_client_id
TESLA_CLIENT_SECRET=your_client_secret
TESLA_REFRESH_TOKEN=your_refresh_token
Get a refresh token (if you don't have one)
pnpm get-token
Register your application with Tesla's API
pnpm register
Follow the instructions provided by the script
Build the server
pnpm build
Run the server
pnpm start
This project uses the official Tesla Fleet API OAuth 2.0 authentication flow to securely connect to your Tesla account. The full process involves two steps:
Authentication requires:
The included pnpm get-token
utility simplifies this process by:
.env
fileThe Tesla Fleet API requires applications to be registered before they can access vehicle data. The registration server (pnpm register
) automates this process:
ngrok authtoken YOUR_AUTH_TOKEN
The server provides the following tools that Claude can use:
wake_up
: Wakes up a Tesla vehicle from sleep mode
vehicle_id
as a required parameterrefresh_vehicles
: Refreshes the list of Tesla vehicles
debug_vehicles
: Shows detailed information about available vehicles
Create the Claude configuration directory:
mkdir -p ~/Library/Application\ Support/Claude
Create or edit the configuration file:
nano ~/Library/Application\ Support/Claude/claude_desktop_config.json
Add the following configuration (adjust the path as needed):
{
"mcpServers": {
"tesla-mcp-server": {
"command": "/absolute/path/to/tesla-mcp/run-mcp.js"
}
}
}
Make the run-mcp.js script executable:
chmod +x run-mcp.js
Restart Claude completely
Once the server is running and Claude is configured, you can ask Claude to:
If you encounter issues:
.env
file contains valid credentialspnpm get-token
to refresh your token if neededpnpm start
)wake_up
commanddebug_vehicles
command to get detailed information about your vehiclesThe server includes several helpful scripts:
pnpm build
: Compile the TypeScript codepnpm start
: Run the server using the run-mcp.js scriptpnpm register
: Register your app with Tesla's APIpnpm get-token
: Get a refresh token from Teslapnpm test-api
: Test your connection to the Tesla APIpnpm inspector
: Run the server with the MCP Inspector for debuggingAs of 2023-10-09, Tesla has deprecated many vehicle command endpoints in their REST API. Commands like honking the horn now require the Tesla Vehicle Command Protocol instead of the REST API. This MCP server currently supports only REST API endpoints that remain functional.
Possible future improvements include: