一个用于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
.gitignorefile excludes.envandkeys/but always double-check - Use the security checker: Run
./check-secrets.shbefore 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:
- Make sure the
.envfile is not included - Check that no private keys are committed
- Verify the
.gitignorefile is properly set up
Quick Start
-
Clone the repository
git clone https://github.com/yourusername/tesla-mcp.git cd tesla-mcp -
Install dependencies
pnpm install -
Set up environment variables Create a
.envfile 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 registerFollow the instructions provided by the script
-
Build the server
pnpm build -
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:
- Authentication: Obtaining a refresh token through the OAuth 2.0 flow
- 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:
安装
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"
}
}
}