Skip to main content
Glama

tesla-fleet-mcp

用于特斯拉 Fleet API 的极简 stdio MCP。TypeScript。单进程、基于环境变量的密钥,无需额外的守护进程即可读取/唤醒。

命令(空调、充电、锁车)需要特斯拉官方的 tesla-http-proxy 以及车上的虚拟钥匙。该代理包含在此处。

Hermes 服务器名称:tesla-fleet。工具以 mcp__tesla_fleet__* 形式出现。

工具

工具

说明

vehicles_list

账户车辆

vehicle_get

轻量状态(online / asleep / offline

vehicle_data

实时数据。按次计费。默认返回完整数据(无 endpoints 过滤)。可选 endpoints 列表;特斯拉要求使用 ;(此 MCP 接受逗号并自动转换)。location_data 用于 GPS

nearby_chargers

附近的充电站点

wake_up

从休眠中唤醒

climate_start / climate_stop / set_temps

需要命令代理

charge_start / charge_stop / set_charge_limit

需要命令代理

door_lock / door_unlock

需要命令代理

不要轮询 vehicle_data。特斯拉按调用次数计费。请先检查 vehicle_get

使用逗号分隔的 endpoints 查询仅返回元数据(不含 charge_state)。此服务器会将逗号重写为 ;

要求

  • 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 权限文件。

变量

必填

说明

TESLA_CLIENT_ID

开发者应用客户端 ID

TESLA_CLIENT_SECRET

开发者应用密钥

TESLA_REDIRECT_URI

必须与应用允许的重定向地址匹配(例如 https://your.domain/callback

TESLA_AUDIENCE

你所在区域的 Fleet 基础 URL(env.example 中有欧盟示例)

TESLA_CACHE_PATH

令牌缓存路径(默认:./token-cache.json

TESLA_REGION

eu(默认)或 na

TESLA_VIN

工具省略 vin 时的默认车辆

TESLA_COMMAND_BASE

代理源,例如 https://127.0.0.1:4443

NODE_EXTRA_CA_CERTS

使用自签名 localhost 证书时的代理 TLS CA

切勿提交密钥。切勿将刷新令牌或客户端密钥粘贴到聊天中。

设置(一次性)

  1. 创建特斯拉开发者应用。授权类型:授权码机器对机器。

  2. 允许的来源:https://your.domain。允许的重定向:https://your.domain/callback

  3. 你需要的权限范围,通常为:openidoffline_accessvehicle_device_data,如果使用相关工具还需 vehicle_cmds / vehicle_charging_cmds / vehicle_location

  4. 生成 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

  1. 注册合作伙伴账户(欧盟示例):

# 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>
  1. 用户登录(车辆所有者):

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.sh

run.sh 会加载仓库目录中的 .env在设置了 $TESLA_ENV 时加载该文件。添加后重启 Hermes 进程/网关。在客户端中启用/禁用工具(tools.include / exclude),而不是通过额外的服务器标志。

命令(可选)

Model 3 / Y 以及较新的 S/X 需要 Vehicle Command Protocol。未签名的 Fleet 命令调用将被拒绝。

  1. 使用你的私钥、TLS 运行 tesla-http-proxy仅限 localhost

  2. 配对虚拟钥匙(特斯拉应用,车辆在线):https://tesla.com/_ak/your.domain

  3. 设置 TESLA_COMMAND_BASE=https://127.0.0.1:4443(如果代理证书是自签名的,还需设置 NODE_EXTRA_CA_CERTS)。

请勿将代理发布到互联网。

开发

npm test
npx tsc --noEmit

许可证

MIT

-
license - not tested
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Connectors

  • MCP server wrapping the Tesla Fleet API and TeslaMate API

  • An MCP server that let you interact with Cycloid.io Internal Development Portal and Platform

  • Tailscale device, route, DNS, key, user, and ACL management over MCP and CLI.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/supervised-nl/tesla-fleet-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server