Logo 特斯拉MCP服务器

特斯拉MCP服务器

Cộng đồng
iceener

MCP Server for interacting with Tesla (via Tessie API). Written in TypeScript, Node and Hono.dev

Nhà phát hànhiceener
Kho mãtesla-streamable-mcp-server
Ngôn ngữTypeScript
Bản fork
4
Sao
11
Công cụ có sẵn
0
Phương thức truyền tảistreamable-http
Danh mục
Liên kết
  • Kết nối công cụ với quy trình làm việc AI

    特斯拉MCP服务器 cung cấp các khả năng MCP mà ứng dụng khách và tác nhân AI tương thích có thể sử dụng.

  • 0 công cụ có sẵn

    Xem các thao tác có thể gọi bên dưới, kèm tên và mô tả nếu máy chủ cung cấp.

  • Cấu hình sẵn để sao chép

    Dùng các đoạn cấu hình cài đặt mẫu để thiết lập máy chủ này trong ứng dụng khách MCP bạn muốn dùng.

  • Chỉ số quan tâm đến mã nguồn mở

    11 sao và 4 bản fork từ kho mã được liên kết.

Tesla MCP Server

Streamable HTTP MCP server for Tesla vehicle control via the Tessie API.

Release status (2026-07-27): this repository pins @modelcontextprotocol/server and the test-only @modelcontextprotocol/client to 2.0.0-beta.5, with Zod 4 and the candidate 2026-07-28 protocol. The dated protocol and stable v2 SDK are not final at this commit; do not claim final conformance until the release gate is verified.

The Bun and Cloudflare Workers entry points share one fetch-native handler per deployment and create a fresh MCP server for every request. Modern HTTP is stateless; compatibility with 2025-era clients uses the SDK's stateless fallback and does not create MCP sessions.

Author: overment

[!WARNING] You connect this server to your MCP client at your own responsibility. Language models can make mistakes, misinterpret instructions, or perform unintended actions. Always verify commands before execution, especially for actions like unlocking, opening trunks, or sending navigation destinations.

The HTTP layer enforces bounded request bodies, exact Host and Origin allowlists, strict CORS, and static bearer authentication when enabled. A production deployment must still set its real HTTPS MCP_PUBLIC_URL and exact allowlists, protect secrets, and provide appropriate rate limiting and audit controls.

Notice

This repo works in two ways:

  • As a fetch-native Bun server for local workflows
  • As a fetch-native Cloudflare Worker for remote interactions

Features

  • ✅ State — Battery, range, location, climate, doors, charging status
  • ✅ Commands — Lock/unlock, climate, trunks, sentry, navigation
  • ✅ Location-aware — GPS coordinates for context-aware interactions
  • ✅ Dual Runtime — Node.js/Bun or Cloudflare Workers

Design Principles

  • LLM-friendly: Two unified tools, not 1:1 API mirrors
  • Watch-ready: Designed for AI agents with location context
  • Secure: Tessie API key stored as secret, clients use separate bearer token
  • Clear feedback: Detailed command results and vehicle state

Installation

Prerequisites: Bun, Tessie Account.

Ways to Run (Pick One)

  1. Local Development — Standard setup with bearer token auth
  2. Cloudflare Worker (wrangler dev) — Local Worker testing
  3. Cloudflare Worker (deploy) — Remote production

1. Local Development — Quick Start

  1. Get Tessie credentials:

    • Visit developer.tessie.com
    • Go to Developer Settings → Generate Access Token
    • Copy your access token
    • Note your vehicle's VIN
  2. Configure environment:

bash
cd tesla-mcp
bun install
cp .env.example .env

Edit .env:

env
PORT=3000
AUTH_ENABLED=true
AUTH_STRATEGY=bearer

# Generate with: openssl rand -hex 32
BEARER_TOKEN=your-random-auth-token

# Tessie credentials
TESSIE_ACCESS_TOKEN=your-tessie-access-token
TESSIE_VIN=your-vehicle-vin
  1. Run:
bash
bun dev
# MCP: http://127.0.0.1:3000/mcp

Claude Desktop / Cursor:

json
{
  "mcpServers": {
    "tesla": {
      "command": "npx",
      "args": ["mcp-remote", "http://localhost:3000/mcp", "--transport", "http-only"],
      "env": { "NO_PROXY": "127.0.0.1,localhost" }
    }
  }
}

2. Cloudflare Worker (Local Dev)

bash
bun x wrangler dev --local | cat

Create .dev.vars for local secrets:

env
BEARER_TOKEN=your_random_auth_token
TESSIE_ACCESS_TOKEN=your_tessie_token
TESSIE_VIN=your_vehicle_vin

Endpoint: http://127.0.0.1:8787/mcp


3. Cloudflare Worker (Deploy)

  1. Update wrangler.jsonc for the production URL and exact Host/Origin allowlists. The checked-in values are local-safe defaults. The existing TOKENS binding is retained for deployment compatibility but is not used for MCP sessions.

  2. Set secrets:

bash
# Generate a random token for client authentication
openssl rand -hex 32
bun x wrangler secret put BEARER_TOKEN
# Paste the generated token when prompted

# Tessie API credentials
bun x wrangler secret put TESSIE_ACCESS_TOKEN
# Paste your Tessie token when prompted

bun x wrangler secret put TESSIE_VIN
# Paste your VIN when prompted
  1. Validate generated types and deploy:
bash
bun run types:worker
bun run types:worker:check
bun run build:worker
bun run deploy

Endpoint: https://<worker-name>.<account>.workers.dev/mcp


Client Configuration

Alice App

Add as MCP server with:

  • URL: https://your-worker.workers.dev/mcp
  • Type: streamable-http
  • Header: Authorization: Bearer <your-BEARER_TOKEN>

Claude Desktop / Cursor (Local Server)

json
{
  "mcpServers": {
    "tesla": {
      "command": "npx",
      "args": ["mcp-remote", "http://127.0.0.1:3000/mcp", "--transport", "http-only"],
      "env": { "NO_PROXY": "127.0.0.1,localhost" }
    }
  }
}

Claude Desktop / Cursor (Cloudflare Worker)

json
{
  "mcpServers": {
    "tesla": {
      "command": "npx",
      "args": ["mcp-remote", "https://your-worker.workers.dev/mcp", "--transport", "http-only"]
    }
  }
}

MCP Inspector (Quick Test)

bash
bunx @modelcontextprotocol/inspector
# Connect to: http://localhost:3000/mcp (local) or https://your-worker.workers.dev/mcp (remote)

Tools

tesla_state

Get the current state of your Tesla vehicle.

ts
// Input
{}

// Output
{
  display_name: string;           // Vehicle name
  battery_level: number;          // 0-100%
  battery_range_km: number;       // Estimated range in km
  charging: {
    state: string;                // "Disconnected", "Charging", "Complete", "Stopped"
    minutes_remaining: number | null;
    charge_limit: number;         // Charge limit %
  };
  location: {
    latitude: number;
    longitude: number;
    heading: number;              // 0-359°
    speed: number | null;         // km/h or null if parked
  };
  locked: boolean;
  sentry_mode: boolean;
  climate: {
    is_on: boolean;
    inside_temp: number;          // °C
    outside_temp: number;         // °C
    target_temp: number;          // °C
    is_defrosting: boolean;
  };
  doors: {
    front_left: boolean;          // true = open
    front_right: boolean;
    rear_left: boolean;
    rear_right: boolean;
    frunk: boolean;
    trunk: boolean;
    charge_port: boolean;
  };
  state: "online" | "asleep" | "offline";
  odometer_km: number;
  last_updated: string;           // ISO 8601
}

tesla_command

Execute commands on your Tesla vehicle.

ts
// Input
{
  command: "lock" | "unlock" | "start_climate" | "stop_climate" |
           "set_temperature" | "start_defrost" | "stop_defrost" |
           "open_frunk" | "open_trunk" | "open_charge_port" |
           "close_charge_port" | "enable_sentry" | "disable_sentry" |
           "flash" | "honk" | "share";
  temperature?: number;           // Required for set_temperature (15-28°C)
  destination?: string;           // Required for share
  locale?: string;                // Optional for share (e.g., "en-US")
}

// Output
{
  success: boolean;
  command: string;
  message: string;
}

Commands Reference:

CommandDescriptionParameters
lockLock the vehicle—
unlockUnlock the vehicle—
start_climateStart climate control—
stop_climateStop climate control—
set_temperatureSet cabin temperaturetemperature (15-28°C)
start_defrostTurn on max defrost—
stop_defrostTurn off defrost—
open_frunkOpen front trunk—
open_trunkToggle rear trunk—
open_charge_portOpen charge port door—
close_charge_portClose charge port door—
enable_sentryEnable sentry mode—
disable_sentryDisable sentry mode—
flashFlash the lights—
honkHonk the horn—
shareSend destination to navigationdestination, locale?

Examples

1. Get vehicle state

json
{
  "name": "tesla_state",
  "arguments": {}
}

2. Lock the car

json
{
  "name": "tesla_command",
  "arguments": {
    "command": "lock"
  }
}

3. Set temperature to 22°C

json
{
  "name": "tesla_command",
  "arguments": {
    "command": "set_temperature",
    "temperature": 22
  }
}

4. Start climate before leaving

json
{
  "name": "tesla_command",
  "arguments": {
    "command": "start_climate"
  }
}

5. Navigate to a destination

json
{
  "name": "tesla_command",
  "arguments": {
    "command": "share",
    "destination": "Golden Gate Bridge, San Francisco"
  }
}

Authentication Flow

┌─────────────────────────────────────────────────────────────────┐
│  Client (Alice App, Claude Desktop)                             │
│      │                                                          │
│      │ Authorization: Bearer <BEARER_TOKEN>                     │
│      ▼                                                          │
│  ┌─────────────────────────────────────────────────────────┐   │
│  │  Cloudflare Worker / Node.js Server                      │   │
│  │                                                          │   │
│  │  1. Validate BEARER_TOKEN (client auth)                  │   │
│  │  2. Use TESSIE_ACCESS_TOKEN (internal API key)           │   │
│  │                                                          │   │
│  │  env.TESSIE_ACCESS_TOKEN ──┐                             │   │
│  │  env.TESSIE_VIN ───────────┼──► TessieClient             │   │
│  │                            │         │                   │   │
│  │                            │         ▼                   │   │
│  │                            │   api.tessie.com            │   │
│  └─────────────────────────────────────────────────────────┘   │
└─────────────────────────────────────────────────────────────────┘

Key points:

  • BEARER_TOKEN: Random token you generate — authenticates clients to your MCP server
  • TESSIE_ACCESS_TOKEN: Your Tessie API key — used internally by the server
  • Clients never see your Tessie credentials

HTTP Endpoints

EndpointMethodPurpose
/mcpPOSTMCP JSON-RPC 2.0
/healthGETHealth check

Development

bash
bun dev           # Start with hot reload
bun run typecheck # TypeScript check
bun run lint      # Lint code
bun run build     # Bun production build
bun run build:worker
bun run types:worker:check
bun test           # Modern, legacy, cancellation, security, and provider tests
bun start          # Run Bun production entry point

Architecture

src/
├── shared/
│   └── tools/
│       ├── tesla-state.ts      # Get vehicle state
│       └── tesla-command.ts    # Execute commands
├── services/
│   └── tessie.service.ts       # Tessie API client
├── schemas/
│   ├── commands.ts             # Command definitions
│   ├── outputs.ts              # Tool output schemas
│   └── tessie.ts               # Tessie API response schemas
├── config/
│   └── metadata.ts             # Server & tool descriptions
├── core/
│   ├── mcp.ts                  # Fresh server factory
│   └── runtime.ts              # Deployment-scoped v2 handler
├── http/                       # Auth, body bounds, Host/Origin/CORS
├── index.ts                    # Bun entry
└── worker.ts                   # Workers isolate entry

Environment Variables

Node.js (.env)

VariableRequiredDescription
TESSIE_ACCESS_TOKEN✓Tessie API access token
TESSIE_VIN✓Tesla Vehicle VIN
BEARER_TOKEN✓Auth token for MCP clients
PORTServer port (default: 3000)
HOSTServer host (default: 127.0.0.1)
AUTH_ENABLEDEnable auth (default: true)
AUTH_STRATEGYbearer (default)

Cloudflare Workers (wrangler.jsonc + secrets)

Relevant wrangler.jsonc vars:

jsonc
"vars": {
  "AUTH_ENABLED": "true",
  "AUTH_STRATEGY": "bearer"
}

Secrets (set via wrangler secret put):

  • BEARER_TOKEN — Random auth token for clients
  • TESSIE_ACCESS_TOKEN — Tessie API access token
  • TESSIE_VIN — Your vehicle's VIN

The existing TOKENS binding remains in wrangler.jsonc, but the SDK-owned stateless HTTP fallback does not read it or create sessions.


Troubleshooting

IssueSolution
401 UnauthorizedCheck BEARER_TOKEN is set and client sends Authorization: Bearer <token>
"TESSIE_ACCESS_TOKEN not configured"Set secret: wrangler secret put TESSIE_ACCESS_TOKEN
"TESSIE_VIN not configured"Set secret: wrangler secret put TESSIE_VIN
"Tessie API error"Verify TESSIE_ACCESS_TOKEN is valid at developer.tessie.com
Vehicle not foundCheck TESSIE_VIN is correct (17 characters)
Vehicle offlineVehicle may be in deep sleep. Commands will wake it (takes ~30s)
Command timeoutTessie waits up to 90s for vehicle wake. Try again.
"ReadableStream is not defined"Node.js version too old (needs 18+). Use full path to newer node.
"spawn bunx ENOENT"Claude Desktop can't find bunx. Use npx instead.

Debugging

Test with MCP Inspector:

bash
bunx @modelcontextprotocol/inspector
# Connect to your endpoint and test tools

Check Worker logs:

bash
wrangler tail

License

MIT

Cài đặt

TypingMind
{
  "mcpServers": {
    "tesla-streamable-mcp-server": {
      "url": "https://<worker-name>.<account>.workers.dev/mcp"
    }
  }
}

Dùng MCP 特斯拉MCP服务器 với nhiều mô hình AI

TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên sau khi kết nối 特斯拉MCP服务器, bạn có thể dùng với nhiều mô hình AI khác nhau trong TypingMind thay vì phải thiết lập riêng cho từng mô hình. MCP này kết nối qua URL máy chủ MCP được lưu trữ từ xa trong TypingMind.

Thêm URL máy chủ MCP

Dùng cách này khi 特斯拉MCP服务器 đã được lưu trữ từ xa hoặc nhóm của bạn muốn có một trình kết nối dùng chung cho nhiều người dùng.

1

Mở mục Trình kết nối MCP

Trong TypingMind, vào Plugin, mở mục Trình kết nối MCP, rồi chọn Thêm URL.

  1. Mở TypingMind trong trình duyệt của bạn.
  2. Vào mục Plugin.
  3. Mở mục Trình kết nối MCP.
  4. Nhấp vào Thêm URL.
Biểu mẫu Thêm URL máy chủ MCP tùy chỉnh của TypingMind
2

Dán URL máy chủ

Nhập https://<worker-name>.<account>.workers.dev/mcp vào trường URL máy chủ. Thêm tên kết nối, mô tả, biểu tượng, header HTTP tùy chỉnh hoặc cài đặt ứng dụng khách OAuth nếu máy chủ yêu cầu.

  1. Dán https://<worker-name>.<account>.workers.dev/mcp vào trường URL máy chủ.
  2. Nhập tên kết nối cho 特斯拉MCP服务器.
  3. Thêm mô tả và biểu tượng nếu bạn muốn dễ nhận biết kết nối hơn.
  4. Thêm header HTTP tùy chỉnh hoặc thông tin ứng dụng khách OAuth nếu máy chủ yêu cầu xác thực.
3

Tạo kết nối

Nhấp vào Tạo kết nối, sau đó quay lại danh sách Plugin và xác nhận kết nối MCP mới đang hoạt động.

  1. Nhấp vào Tạo kết nối.
  2. Quay lại danh sách trình kết nối MCP.
  3. Xác nhận kết nối 特斯拉MCP服务器 hiển thị trạng thái đang hoạt động.
  4. Làm mới danh sách plugin nếu kết nối chưa xuất hiện ngay.
4

Đổi mô hình mà không cần kết nối lại

Bắt đầu cuộc trò chuyện với mô hình bạn thích, bật các công cụ của 特斯拉MCP服务器 trong mục Plugin và chuyển sang mô hình khác khi cần. Kết nối MCP vẫn sẵn dùng trong không gian làm việc TypingMind.

  1. Bắt đầu cuộc trò chuyện mới trong TypingMind.
  2. Chọn mô hình AI bạn muốn dùng.
  3. Bật các công cụ của 特斯拉MCP服务器 trong mục Plugin.
  4. Yêu cầu mô hình dùng công cụ khi cần.
  5. Chuyển sang mô hình AI khác và dùng lại cùng kết nối MCP.
Cuộc trò chuyện TypingMind dùng các công cụ MCP đã bật với một mô hình AI được chọn
Bạn có thể dùng 特斯拉MCP服务器 giúp tôi làm việc này không?
特斯拉MCP服务器
Được. Tôi đã đọc.
Đây là kết quả tôi tìm được bằng 特斯拉MCP服务器.

Câu hỏi thường gặp

Máy chủ MCP 特斯拉MCP服务器 dùng để làm gì?

特斯拉MCP服务器 là máy chủ MCP cho phép các ứng dụng AI tương thích kết nối với công cụ và ngữ cảnh bên ngoài. Trong TypingMind, bạn chỉ cần thêm máy chủ MCP này một lần để các công cụ của nó có sẵn trong không gian làm việc AI của bạn.

Bạn có thể dùng MCP 特斯拉MCP服务器 với nhiều mô hình AI trong TypingMind không?

Có. TypingMind kết nối các công cụ MCP ở cấp không gian làm việc, nên bạn có thể dùng 特斯拉MCP服务器 với nhiều mô hình AI như Claude, ChatGPT, Gemini hoặc các mô hình khác đã cấu hình trong TypingMind mà không cần thiết lập máy chủ MCP riêng cho từng mô hình.

Vì sao nên dùng MCP 特斯拉MCP服务器 với TypingMind?

TypingMind là một trong những giao diện trò chuyện với LLM tốt nhất vì tập hợp nhiều mô hình AI, prompt, plugin, tác nhân AI, khóa API và công cụ MCP vào một không gian làm việc. Khi kết nối 特斯拉MCP服务器, bạn có thể dùng các công cụ MCP của dịch vụ này với những mô hình ưa thích, đồng thời giữ quy trình trò chuyện gọn gàng trong TypingMind.

Làm cách nào để kết nối MCP 特斯拉MCP服务器 với TypingMind?

Bạn có thể kết nối 特斯拉MCP服务器 trong TypingMind bằng cách thêm URL máy chủ MCP được lưu trữ từ xa của dịch vụ này. Cách này hữu ích khi bạn muốn dùng kết nối MCP từ xa ngay trong không gian làm việc TypingMind.

MCP 特斯拉MCP服务器 cung cấp những công cụ nào trong TypingMind?

特斯拉MCP服务器 cung cấp các chức năng MCP mà bạn có thể bật từ trang Plugin của TypingMind để dùng trong trò chuyện hoặc gán cho tác nhân AI.

Bạn có cần chia sẻ khóa API với TypingMind để dùng MCP 特斯拉MCP服务器 không?

Không. TypingMind ưu tiên xử lý cục bộ và cho phép bạn kiểm soát nhà cung cấp mô hình, khóa API, prompt và cấu hình MCP. Nếu 特斯拉MCP服务器 yêu cầu xác thực, hãy thêm các header, cài đặt OAuth hoặc cấu hình cục bộ cần thiết cho máy chủ MCP đó khi tạo kết nối.

Máy chủ MCP liên quan

Xem tất cả

Tạo ngay không gian làm việc AI riêng

Đăng ký bản tin của chúng tôi để nhận thông báo về tính năng mới và các đợt tặng quà sắp tới 👇