MCP ExplorerExplorer

Tezlab Cli

@The-Focus-AIon 10 months ago
1 MIT
FreeCommunity
AI Systems
#modelcontextprotocol#tezlab
CLI and ModelContextProtocol interface to tezlab

Overview

What is Tezlab Cli

tezlab-cli is a Command Line Interface (CLI) and Model Context Protocol (MCP) server implementation for TezLab, designed to provide access to Tesla vehicle data and charging information through a standardized interface.

Use cases

Use cases for tezlab-cli include monitoring charging sessions, analyzing battery performance, integrating vehicle data into applications, and providing insights into energy usage and efficiency for Tesla vehicles.

How to use

To use tezlab-cli, install the dependencies using ‘pnpm install’, build the project with ‘pnpm build’, and then utilize the commands available as either an MCP server or a CLI tool. For example, you can log in with ‘pnpm tezlab login’ and retrieve charging reports or battery information using ‘pnpm tezlab charge’ or ‘pnpm tezlab battery’.

Key features

Key features of tezlab-cli include detailed charge reports with information on duration, battery levels, energy usage, and vehicle state during charging, as well as real-time battery information including charging status, vehicle location, and efficiency metrics.

Where to use

tezlab-cli is primarily used in the automotive and electric vehicle sectors, particularly for Tesla vehicle owners and developers looking to access and analyze vehicle data.

Content

TezLab MCP Server

A Model Context Protocol (MCP) server implementation for TezLab, providing access to Tesla vehicle data and charging information through a standardized interface.

Features

  • Charge Report: Get detailed information about your latest charging session, including:

    • Duration and timing
    • Battery levels and range
    • Energy usage and efficiency
    • Cost and savings
    • Environmental conditions
    • Vehicle state during charging
  • Battery Info: Access real-time vehicle information, including:

    • Battery level and charging status
    • Vehicle location with reverse geocoding
    • Software version and vehicle details
    • Range and efficiency metrics
    • Vehicle state (locked, sentry mode, etc.)

Installation

# Install dependencies
pnpm install

# Build the project
pnpm build

Usage

The server can be used in two ways:

1. As an MCP Server

The MCP server provides two main commands:

  • chargeReport: Retrieves the latest charging session data in JSON format
  • batteryInfo: Gets current vehicle status and information in JSON format

To setup in claude desktop.

pnpm build

Then edit ~/Library/Application Support/claude_desktop_config.json and add something like:

2. As a CLI Tool

The CLI provides direct access to the same functionality:

# Login to TezLab
pnpm tezlab login

# Get charge report
pnpm tezlab charge

# Get battery info
pnpm tezlab battery

# Save API responses to JSON files
pnpm tezlab charge --record
pnpm tezlab battery --record

Development

# Run tests
pnpm test

# Build in watch mode
pnpm dev

# Lint code
pnpm lint

Environment Variables

The following environment variables can be used to configure the application:

  • TEZLAB_TOKEN_FILE: Path to the token file (default: ~/.tezlab/token.json)

API Response Types

The server returns data in the following formats:

Charge Report Response

interface ChargeSession {
  id: number;
  start_time_ms: number;
  stop_time_ms: number;
  start_percent: number;
  end_percent: number;
  vehicle: {
    id: number;
    display_name: string;
    car_type: string;
  };
  est_max_range: number;
  est_max_range_units: string;
  // ... and more fields
}

Battery Info Response

interface TezlabResponse {
  vehicle: {
    available_vehicles: Vehicle[];
    selected_vehicle: string;
    data?: VehicleData;
  };
}

License

MIT

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Tools

No tools

Comments

Recommend MCP Servers

View All MCP Servers