tesla-fleet-mcp
tesla-fleet-mcp
用于特斯拉 Fleet API 的极简 stdio MCP。TypeScript。单进程、基于环境变量的密钥,无需额外的守护进程即可读取/唤醒。
命令(空调、充电、锁车)需要特斯拉官方的 tesla-http-proxy 以及车上的虚拟钥匙。该代理不包含在此处。
Hermes 服务器名称:tesla-fleet。工具以 mcp__tesla_fleet__* 形式出现。
工具
工具 | 说明 |
| 账户车辆 |
| 轻量状态( |
| 实时数据。按次计费。默认返回完整数据(无 |
| 附近的充电站点 |
| 从休眠中唤醒 |
| 需要命令代理 |
| 需要命令代理 |
| 需要命令代理 |
请不要轮询 vehicle_data。特斯拉按调用次数计费。请先检查 vehicle_get。
使用逗号分隔的 endpoints 查询仅返回元数据(不含 charge_state)。此服务器会将逗号重写为 ;。
Related MCP server: mcp-teslamate-fleet
要求
Node 20+
一个特斯拉开发者应用(dashboard)
一个你拥有的 HTTPS 主机名(不得包含
tesla字样)公钥位于
https://<your-domain>/.well-known/appspecific/com.tesla.3p.public-key.pem在你使用的每个区域注册合作伙伴
POST /api/1/partner_accounts付款方式 + 计费限额(Fleet API 按量付费;每月约 $10 额度)
环境变量
复制 env.example,并将 TESLA_CACHE_PATH 指向 git 之外的 0600 权限文件。
变量 | 必填 | 说明 |
| 是 | 开发者应用客户端 ID |
| 是 | 开发者应用密钥 |
| 是 | 必须与应用允许的重定向地址匹配(例如 |
| 是 | 你所在区域的 Fleet 基础 URL( |
| 否 | 令牌缓存路径(默认: |
| 否 |
|
| 否 | 工具省略 |
| 否 | 代理源,例如 |
| 否 | 使用自签名 localhost 证书时的代理 TLS CA |
切勿提交密钥。切勿将刷新令牌或客户端密钥粘贴到聊天中。
设置(一次性)
创建特斯拉开发者应用。授权类型:授权码和机器对机器。
允许的来源:
https://your.domain。允许的重定向:https://your.domain/callback。你需要的权限范围,通常为:
openid、offline_access、vehicle_device_data,如果使用相关工具还需vehicle_cmds/vehicle_charging_cmds/vehicle_location。生成 P-256 密钥对:
openssl ecparam -name prime256v1 -genkey -noout -out private-key.pem
openssl ec -in private-key.pem -pubout -out public-key.pem仅托管公钥于:
https://your.domain/.well-known/appspecific/com.tesla.3p.public-key.pem
注册合作伙伴账户(欧盟示例):
# partner token
curl -s --data-urlencode grant_type=client_credentials \
--data-urlencode client_id="$TESLA_CLIENT_ID" \
--data-urlencode client_secret="$TESLA_CLIENT_SECRET" \
--data-urlencode audience="$TESLA_AUDIENCE" \
--data-urlencode scope='openid vehicle_device_data vehicle_cmds' \
https://fleet-auth.prd.vn.cloud.tesla.com/oauth2/v3/token
# then POST {"domain":"your.domain"} to $TESLA_AUDIENCE/api/1/partner_accounts
# with Authorization: Bearer <partner access_token>用户登录(车辆所有者):
set -a && source .env && set +a
npm install
npm run login
# open the printed URL, approve, paste the full https://your.domain/callback?code=... URL:
npm run login -- "https://your.domain/callback?code=...."回调主机只需接受浏览器的访问;此 CLI 会读取你粘贴的 URL。空白页面即可。
Hermes
# example wrapper: source your env file, then tsx
hermes mcp add tesla-fleet --command /path/to/tesla-fleet-mcp/run.shrun.sh 会加载仓库目录中的 .env,或在设置了 $TESLA_ENV 时加载该文件。添加后重启 Hermes 进程/网关。在客户端中启用/禁用工具(tools.include / exclude),而不是通过额外的服务器标志。
命令(可选)
Model 3 / Y 以及较新的 S/X 需要 Vehicle Command Protocol。未签名的 Fleet 命令调用将被拒绝。
使用你的私钥、TLS 运行
tesla-http-proxy,仅限 localhost。配对虚拟钥匙(特斯拉应用,车辆在线):
https://tesla.com/_ak/your.domain设置
TESLA_COMMAND_BASE=https://127.0.0.1:4443(如果代理证书是自签名的,还需设置NODE_EXTRA_CA_CERTS)。
请勿将代理发布到互联网。
开发
npm test
npx tsc --noEmit许可证
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
MCP server wrapping the Tesla Fleet API and TeslaMate API
Control your Tesla - wake it, warm it up, unlock and more. Get your developer token at https://Infoseek.ai/mcp. Also requires your own Tesla developer token which is tied to your car/fleet.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Streamable HTTP MCP gateway for NV oOS fleets — one API key, namespaced tools, quotas and policy.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceAn MCP server that connects to the Tesla Fleet API, allowing users to control vehicles and retrieve real-time status updates through Claude and other AI assistants. It supports functions such as waking up vehicles, viewing detailed vehicle information, and debugging via both stdio and HTTP/SSE transports.MIT
- AlicenseBqualityDmaintenanceMCP server combining TeslaMate historical analytics with Fleet API live data and commands. Works with Claude Code, Claude Desktop, Cursor, and any MCP-compatible client.292MIT
- AlicenseAqualityAmaintenanceLocal MCP server for Hey.com email - read, search, send, reply, and manage the screener via stored session cookies. Runs over stdio, stores no credentials.3713MIT
- AlicenseNot gradedqualityBmaintenanceA Model Context Protocol server for the TeslaFi API that lets MCP clients query live vehicle data, drive and charge history, commute patterns, and optionally send commands.2MIT