DEV Community

Control Your Tesla from the Terminal with a Kiro CLI Skill

πŸ”— https://github.com/guyon-it-consulting/myteslamate-skills-and-power

Demo

Last Tuesday, I was deep into a CDK refactor β€” the kind where I have 14 files open and I'm scared to blink. Then a thought hit me: did I turn on Sentry mode? My car was parked at the train station. I could grab my phone, open the Tesla app, wait for it to wake the car, scroll to Security, check the toggle… or I could just not break my flow.

What if I could ask my coding assistant instead?

Turns out, I can. I built a Kiro CLI skill that lets me control my Tesla straight from the terminal. It was also the perfect excuse to learn how to create a Kiro CLI Skill 😊 β€” and what better way to test a new feature than with something fun? Check the battery, lock the doors, toggle Sentry mode, pull up charging stats β€” all without leaving my editor. The secret ingredient? An MCP server that wraps APIs that any AI assistant can call.

What is MyTeslaMate?

Before we get to the skill itself, let me introduce the engine behind it.

MyTeslaMate is the hosted version of TeslaMate, the most popular open-source data logger for Tesla vehicles. If you own a Tesla and you haven't heard of TeslaMate, stop reading and go look at it. It continuously records every drive, charge session, sleep cycle, and software update into a PostgreSQL database, and exposes rich Grafana dashboards β€” battery degradation, charging curves, trip history, lifetime stats, vampire drain, efficiency trends, and more.

MyTeslaMate takes all of that and hosts it for you. No Docker, no self-hosting, no database maintenance. It adds premium features like supercharger cost import, automations, fleet management, and β€” this is the part we care about β€” an MCP server.

The MCP server at https://mcp.myteslamate.com/mcp wraps two APIs into a single endpoint:

API Tools What it does
Tesla Fleet API 98 Vehicle commands, energy control, charging, navigation, security
TeslaMate API 9 Drive stats, charging analytics, efficiency data, trip history

That's 100+ tools accessible from any MCP-compatible AI assistant. Authentication is handled via OAuth SSO with Tesla's authorization server.

MyTeslaMate dashboard

What is a Kiro CLI Skill?

A skill is how you teach Kiro CLI about a specific domain. It's a markdown file with YAML frontmatter that describes what the skill does and when to activate it. Think of it as a cheat sheet that Kiro loads on demand β€” it doesn't bloat your context until you actually need it.

A skill has two parts:

The frontmatter β€” metadata that tells Kiro when to load the skill:

---
name: tesla-commands
description: Control your Tesla vehicle and energy products via MyTeslaMate MCP server.
  Use when the user asks about their car, vehicle status, lock/unlock, climate control, charging, Powerwall, solar production, energy optimization, Sentry mode, trip planning, drive statistics, or any Tesla-related query. Triggers on "tesla", "my car", "vehicle",
  "charge", "battery", "climate", "powerwall", "solar", "sentry", "lock", "unlock",
  "supercharger", "road trip", "energy", "charging history", "drive stats".
---
Enter fullscreen mode Exit fullscreen mode

The body β€” capabilities, workflow instructions, and safety rules that guide the agent:

# Tesla Commands

The `tesla-mcp` server exposes **100+ tools**.

## Capabilities
### Vehicle Control (64 commands)
- Doors & Access: lock, unlock, open/close trunk, open frunk
- Climate: start/stop HVAC, set temps, seat heaters, steering wheel heater
- Charging: start/stop charge, set charge limit, schedule charging
...

## Workflow
1. Use @tesla-mcp tools directly for all Tesla operations.
2. Check current state before making changes.
3. Wake the vehicle before sending action commands if the car is asleep.

## Safety
- Confirm with the user before executing security-sensitive commands.
- Always show current state before making changes.
Enter fullscreen mode Exit fullscreen mode

The skill lives in ~/.kiro/skills/tesla-commands/SKILL.md. But a skill alone isn't enough β€” you also need an agent that knows how to use it.

The Tesla agent configuration

I created a dedicated agent: a JSON file that ties everything together: the skill, the MCP server and the tools.

{
  "name": "tesla",
  "description": "Tesla vehicle and energy control agent via MyTeslaMate MCP server",
  "prompt": "You help the user monitor and control their Tesla vehicle and energy products. Use the tesla-mcp tools for all operations. Present data in a human-readable format. Confirm before executing security-sensitive commands.",
  "tools": ["read", "shell", "grep", "glob", "@tesla-mcp"],
  "allowedTools": ["read", "@tesla-mcp"],
  "resources": [
    "skill://.kiro/skills/tesla-commands/SKILL.md"
  ],
  "mcpServers": {
    "tesla-mcp": {
      "url": "https://mcp.myteslamate.com/mcp"
    }
  },
  "welcomeMessage": "Tesla control ready. What would you like to do with your car?"
}
Enter fullscreen mode Exit fullscreen mode

A few things worth noting here:

  • resources uses the skill:// URI scheme. This tells Kiro to load the skill's metadata at startup but defer loading the full content until it's actually needed. No wasted context. (See Agent Configuration Reference in the Kiro docs: "skill:// β€” Skills progressively loaded on demand".)
  • mcpServers points to the remote MyTeslaMate MCP server in this case, no local mcp server needed.
  • allowedTools auto-approves read and all @tesla-mcp tools so you don't get prompted for every single API call.

How to set it up

Prerequisites: You'll need a Tesla vehicle (obviously) and a MyTeslaMate account. Sign up, link your Tesla account, and pick a subscription plan. This gives you access to the MCP server and the TeslaMate analytics dashboards.

Step 1: Clone the repo and copy the files.

git clone https://github.com/guyon-it-consulting/myteslamate-skills-and-power.git
cd myteslamate-skills-and-power

# Copy the skill
cp -r kiro/skills/tesla-commands ~/.kiro/skills/

# Copy the agent
cp kiro/agents/tesla.json ~/.kiro/agents/
Enter fullscreen mode Exit fullscreen mode

Step 2: Start a new Kiro CLI session and switch to Tesla Agent

$ kiro-cli

/agent swap tesla

βœ” Switched to agent: tesla
Tesla control ready. What would you like to do with your car?
Enter fullscreen mode Exit fullscreen mode

Step 3: Authenticate with Tesla.

Run /mcp. The tesla-mcp server will show ⚠ auth-required. Follow the instructions to copy the OAuth URL, open it in your browser, and sign in with your Tesla account. This is a one-time step β€” the token persists across sessions.

OAuth flow

Using it

Now the fun part. Just talk naturally:

> Is Sentry mode on?

Nope β€” Sentry Mode is currently off on your Model Y. 
It is available though, so I can turn it on for you if you'd like.
Want me to enable it?
Enter fullscreen mode Exit fullscreen mode
> What's my battery at?

Fresh data from TeslaMate:
- Battery level: 80% (hit your charge limit!)
- Estimated range: ~411 km
- Charging state: Complete β€” plugged in but done charging
- Energy added this session: 34.1 kWh

Looks like it finished charging since we last checked (was at 77% earlier).
You're topped up to your 80% limit.
Enter fullscreen mode Exit fullscreen mode
> Lock my car

Your car is already locked according to the latest status.
No action needed!
Enter fullscreen mode Exit fullscreen mode
> How much did I spend on charging this month?

Here's your April charging summary (so far, through April 10):

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚ Type             β”‚ Sessions β”‚ Energy        β”‚ Cost       β”‚
β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
β”‚ Supercharger     β”‚ 2        β”‚ 105.0 kWh     β”‚ €37.88     β”‚
β”‚ Home/Destination β”‚ 5        β”‚ 60.98 kWh     β”‚ €0*        β”‚
β”‚ **Total**        β”‚ **7**    β”‚ **166.0 kWh** β”‚ **€37.88** β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

No Data, estimating home/destination charging at ~€0.25/kWh, that's roughly €15 extra,
bringing the estimated total to around €53
Enter fullscreen mode Exit fullscreen mode
> What's my battery health status ?

Your battery is in great shape:
- Battery health: 98.6%
- Current capacity: 75.7 kWh (out of 76.8 kWh max)
- Current max range: 506 km (vs 512 km when new)
- Degradation: only ~1.4% 

Very healthy for a car with 435 drives logged.
Nothing to worry about there.
Enter fullscreen mode Exit fullscreen mode

The agent checks the current state before making changes, asks for confirmation on security-sensitive commands, and presents data with proper units. All of that behavior comes from the SKILL.md instructions.

Things to know

  • 100+ tools, one endpoint. The MyTeslaMate MCP server covers vehicle control, vehicle data, energy/Powerwall/solar, charging history, and TeslaMate analytics. You don't need to know which API to call β€” the agent figures it out.

  • Wake before you command. Tesla vehicles go to sleep to save battery. The skill instructs the agent to wake the car before sending action commands. You'll see a brief delay the first time.

  • Safety checks. The skill explicitly tells the agent to confirm before executing unlock, disable Sentry, remote start, or erase data. You won't accidentally unlock your car because of a typo.

  • OAuth, not API keys. Authentication goes through Tesla's OAuth flow via MyTeslaMate. The token is scoped and can be revoked from your Tesla account at any time.

β€” JΓ©rΓ΄me

Top comments (0)