ST

scald/tesla-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

20 stars 8 forks 质量 65 趋势 10MIT

一个用于AI模型与特斯拉车队API接口的模型上下文协议服务器。

概览

一个连接特斯拉车队API的模型上下文协议(MCP)服务器,允许你使用Claude及其他支持MCP的AI助手控制你的特斯拉车辆。 - : 唤醒您的特斯拉从睡眠模式中 - : 获取您的特斯拉车辆详细信息 - : 按需刷新车辆数据 - : 访问详细车辆信息以协助排查故障 - Node.js 18+ - pnpm(优先)或 npm - 拥有至少一辆车辆的特斯拉账户- 特斯拉 API 凭证(客户 ID 和客户端秘密)- Ngrok(用于开发和注册) 本项目处理敏感的特斯拉API凭证。请遵循以下安全措施: - : .gitignore 文件排除 .env 和密钥/,但务必再次检查 - : 在提交前运行 ./check-secrets.sh 以检测潜在泄露的凭据 - : 保持密钥/目录内容安全 - : 确保任何源文件中没有硬编码凭证 1. 确保没有包含.env文件 2.

概述(AI 翻译)

一个连接特斯拉车队API的模型上下文协议(MCP)服务器,允许你使用Claude及其他支持MCP的AI助手控制你的特斯拉车辆。

特色

  • 唤醒车辆:唤醒你的特斯拉从睡眠模式中
  • 车辆信息:获取关于您的特斯拉车辆的详细信息
  • 实时更新:按需刷新车辆数据
  • 调试工具:获取详细车辆信息以协助排查

要求

  • Node.js 18+
  • PNPM(优先选)或NPM
  • 特斯拉账户,至少拥有一辆车
  • 特斯拉API凭证(客户端ID和客户端秘密)
  • Ngrok(用于开发和注册)

安全最佳实践

本项目处理敏感的特斯拉API凭证。请遵循以下安全措施:

  • 永不提交凭证:.gitignore 文件排除 .env 和 keys/,但始终进行双重检查
  • 使用安全检查器:在提交前运行./check-secrets.sh以检测潜在泄露的凭证
  • 保护您的私钥:保护keys/目录内容的安全
  • 分享前请先审查代码:确保任何源文件中没有硬编码凭证

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

Tesla MCP Server

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.

Features

  • Wake up vehicles: Wake up your Tesla from sleep mode
  • Vehicle information: Get detailed information about your Tesla vehicles
  • Real-time updates: Refresh vehicle data on demand
  • Debugging tools: Access detailed vehicle information to help with troubleshooting

Requirements

  • Node.js 18+
  • pnpm (preferred) or npm
  • Tesla account with at least one vehicle
  • Tesla API credentials (Client ID and Client Secret)
  • Ngrok (for development and registration)

Security Best Practices

This project handles sensitive Tesla API credentials. Please follow these security practices:

  • Never commit credentials: The .gitignore file excludes .env and keys/ but always double-check
  • Use the security checker: Run ./check-secrets.sh before committing to detect potentially leaked credentials
  • Protect your private keys: Keep the contents of the keys/ directory secure
  • Review code before sharing: Make sure no credentials are hardcoded in any source files

When forking or sharing this project:

  1. Make sure the .env file is not included
  2. Check that no private keys are committed
  3. Verify the .gitignore file is properly set up

Quick Start

  1. Clone the repository

    git clone https://github.com/yourusername/tesla-mcp.git
    cd tesla-mcp
    
  2. Install dependencies

    pnpm install
    
  3. 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
    
  4. Get a refresh token (if you don’t have one)

    pnpm get-token
    
  5. Register your application with Tesla’s API

    pnpm register
    

    Follow the instructions provided by the script

  6. Build the server

    pnpm build
    
  7. Run the server

    pnpm start
    

Authentication & Registration

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:

  1. Authentication: Obtaining a refresh token through the OAuth 2.0 flow
  2. Registration: Registering your application with Tesla via the Partner Accounts API

Authentication

Authentication requires:

  • Client ID and Client Secret from the Tesla Developer Portal
  • A refresh token obtained through the OAuth 2.0 authorization code flow

The included pnpm get-token utility simplifies this process by:

在 GitHub 查看完整 README

安装

This server does not publish a one-line install command.

Open the repository installation guide 新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "tesla-mcp-server": { "command": "/absolute/path/to/tesla-mcp/run-mcp.js" } } }