teslamate-mcp

A Model Context Protocol (MCP) server that provides access to your TeslaMate database, allowing AI assistants to query Tesla vehicle data and analytics.

GitHub Stars

98

User Rating

Not Rated

Favorites

0

Views

31

Forks

12

Issues

1

Installation
Difficulty
Intermediate
Estimated Time
10-20 minutes
Requirements
Python 3.11 or higher
PostgreSQL database running with TeslaMate

Installation

Installation

Prerequisites

TeslaMate: Running with a PostgreSQL database
Python: 3.11 or higher
Access to your TeslaMate database

Installation Steps

1. Clone Repository

bash
git clone https://github.com/cobanov/teslamate-mcp.git
cd teslamate-mcp

2. Install Dependencies

bash
uv sync
Or using pip:
bash
pip install -r requirements.txt

3. Create .env File

Create a .env file in the project root with the following content:
env
DATABASE_URL=postgresql://username:password@hostname:port/teslamate

4. Docker Deployment (Remote Access)

bash

Clone and navigate to the repository

git clone https://github.com/cobanov/teslamate-mcp.git cd teslamate-mcp

Run the deployment script

./deploy.sh deploy

Or manually:

cp env.example .env

Edit .env with your database credentials

docker-compose up -d
The remote server will be available at:
Streamable HTTP: http://localhost:8888/mcp

Configuration

Configuration

Basic Configuration

Configuring Authentication (Optional)

To secure your remote MCP server with bearer token authentication, set a bearer token in your .env file:
env
AUTH_TOKEN=your-secret-bearer-token-here

Configuration Example

json
{
  "mcpServers": {
    "teslamate-remote": {
      "url": "http://your-server:8888/mcp",
      "transport": "streamable_http",
      "headers": {
        "Authorization": "Bearer your-secret-bearer-token-here"
      }
    }
  }
}

Examples

Examples

Basic Usage

Programmatic Usage

javascript
// JavaScript example (Node.js)
const { MCPClient } = require('@modelcontextprotocol/client');

const client = new MCPClient();
await client.connect();

// Execute tool
const result = await client.callTool('toolName', {
  parameter1: 'value1',
  parameter2: 'value2'
});

console.log(result);

Use Cases

Analyze driving data of Tesla vehicles to understand driving patterns.
Check charging history to optimize charging efficiency.
Monitor battery health to determine maintenance timing.
Use location data to analyze driving trends in specific areas.

Additional Resources