hkconnect
An unofficial async Rust client, command-line tool and Claude (MCP) server for Hyundai Bluelink India and Kia Connect India connected cars.
| Crate | What it is |
|---|---|
hkconnect |
Async library: login, session reuse, typed reads, remote commands |
hkc |
Command-line app built on the library |
hkc-mcp |
MCP server so Claude can read and control the car (setup guide) |
Disclaimer. This project is not affiliated with, endorsed by, or supported by Hyundai Motor Company, Kia Corporation, or their Indian subsidiaries. It uses the same undocumented servers as the official apps, with your own account. The API can change or break without notice. Remote commands act on a real vehicle; you are responsible for how you use them. The software is provided "as is", without warranty of any kind.
Support
| Area | Status |
|---|---|
| Hyundai India and Kia India, older (non-CCS2) protocol | Supported |
| Reads: vehicles, status, location, info, trips | Verified on a real car (2024 Hyundai Creta, petrol, automatic) |
| Lock | Verified on a real car (2024 Hyundai Creta): confirmed by the car in about 30 s |
| Unlock, remote start with climate, stop | Experimental: implemented to match the reference implementation and tested against a fake server; not yet verified on a real car |
| Valet mode, send destination to navigation | Experimental: as above |
| Hazard lights / horn | Experimental: as above, and the endpoint may not exist on non-CCS2 cars |
| Newer "CCS2" cars | Not supported: status and remote commands return a clear error |
| EV features (charging, charge limits, schedules) | Not implemented |
| Other regions (EU, US, Canada, ...) | Out of scope; see hyundai_kia_connect_api |
Kia support uses the same protocol as Hyundai on a different host and has
not been tested against a real Kia. The endpoint-by-endpoint status is in
docs/api-coverage.md. Reports from other models
are welcome: open an issue with the "New car / endpoint support" form.
Install
Prebuilt binaries of hkc (the CLI) and hkc-mcp (the MCP server) are
published on GitHub Releases
for macOS (Apple silicon and Intel), Linux (x86_64 and arm64, glibc) and
Windows (x86_64). Pick one of:
Homebrew (macOS, Linux):
Shell installer (macOS, Linux):
|
|
PowerShell installer (Windows):
powershell -ExecutionPolicy Bypass -c "irm https://github.com/SwapShaOnline/hkconnect/releases/latest/download/hkc-installer.ps1 | iex"
powershell -ExecutionPolicy Bypass -c "irm https://github.com/SwapShaOnline/hkconnect/releases/latest/download/hkc-mcp-installer.ps1 | iex"
cargo-binstall (downloads the prebuilt binary):
From crates.io (builds from source; needs Rust 1.89 or later):
From a git checkout:
To use the library, add it to your project along with an async runtime:
Configuration
hkc reads your Bluelink / Kia Connect app login from environment
variables:
| Variable | Required | Meaning |
|---|---|---|
HKC_USERNAME |
yes | Account email |
HKC_PASSWORD |
yes | Account password |
HKC_PIN |
for PIN commands | The 4-digit PIN set in the app (stop, hazard, valet, navigate) |
HKC_BRAND |
no | hyundai (default) or kia |
HKC_VEHICLE |
if several cars | Which car, by name, VIN or id (same as --vehicle) |
Instead of exporting them, you can put them in a .env file at:
- macOS:
~/Library/Application Support/hkconnect/.env - Linux:
~/.config/hkconnect/.env
HKC_USERNAME=you@example.com
HKC_PASSWORD=change-me
HKC_PIN=0000
HKC_BRAND=hyundai
The file is read literally, one KEY=VALUE per line:
- Lines starting with
#, and blank lines, are ignored. Anexportprefix is allowed. - Values are never expanded:
$,\and${...}are kept as written, soHKC_PASSWORD=pa$word1means exactlypa$word1. - Spaces around the value are trimmed. To keep them, or to use
#, wrap the value in single or double quotes (HKC_PASSWORD='my # pass'); the quotes are removed and nothing inside is interpreted. A quoted value cannot contain its own kind of quote, so use the other kind. A comment may follow the closing quote. - An unquoted value containing
#is rejected rather than guessed at (quote it, or move the comment to its own line), as are lines without=and unterminated quotes. Rejected lines are reported by line number, never by value, and skipped.
A .env in the current directory is deliberately not read. Real environment
variables and command-line options take precedence over the file. Restrict
the file's permissions (chmod 600), since it contains your password; hkc
warns if other users can read it.
After the first login, hkc saves the session (access and refresh tokens,
no password) as session.json in the OS data directory
(~/Library/Application Support/hkconnect/ on macOS,
~/.local/share/hkconnect/ on Linux) with owner-only (0600) permissions,
so later commands skip the roughly 4 s login. hkc logout deletes it. If
the session cannot be saved, hkc prints a warning but keeps the command's
own result and exit code.
Usage
Remote start accepts temperatures from 14 to 29.5 °C in 0.5 steps and durations of 1 to 10 minutes; anything else is rejected before you are asked to confirm.
If the account has more than one car, every command except hkc vehicles
needs --vehicle (or HKC_VEHICLE). It matches an exact id first, then a
VIN, then a name (both ignoring case); a name shared by two cars is rejected,
so use the VIN or id.
Remote commands wait for the car to report the result, which usually takes
10 to 40 seconds. Pass --no-wait to return as soon as the server accepts
the command, then look the result up later with hkc check <id>. The
command id is printed as soon as the server accepts the command. With
--json, the final result goes to stdout once the car answers, and while
waiting hkc writes one line to stderr as soon as the command is accepted:
{"event":"sent","command":"Unlock","id":"..."}, so a script that is
killed while waiting still knows the id. hkc exits non-zero if the car reports failure or does
not respond, or if waiting fails or is interrupted with Ctrl-C; the command
was still sent, so check it with hkc check <id> rather than sending it
again.
Run hkc --help or hkc <command> --help for every option.
Library quick start
use Duration;
use ;
async
Client logs in on first use, refreshes tokens automatically, and is safe
to share across tasks (wrap it in an Arc). Errors map the server's result
codes to hkconnect::Error
variants such as RateLimited, CarTimeout and InvalidPin. The returned
data types (Vehicle, VehicleStatus, Trip, ...) implement serde's
Serialize and Deserialize with the same field names both ways, so you
can store them and read them back; a stored Trip can still be passed to
Client::trip_detail. Full API documentation is on
docs.rs.
Safety
- Confirmations.
hkc unlock,hkc start,hkc hazard --horn,hkc valetandhkc navigatename the car and ask before acting, and refuse to run non-interactively without--yes. Think before scripting them.lock,stopandhazardwithout--horndo not ask. - The right car. With several cars on the account,
hkcrefuses to guess: pick one with--vehicleorHKC_VEHICLE. - "Sent" is not "done". The server accepting a command only means it was
queued.
hkcwaits for the car's own result and reports success, failure, or no response. - Don't resend blindly. If sending fails with a network error or
timeout, the server may still have received the command; run
hkc statusbefore retrying. If the command was accepted but waiting fails,hkcprints its id: usehkc check <id>instead of sending it again. - 12V battery.
hkc status --refresh(andClient::refresh_status) wakes the car's modem and draws on the 12V battery. Do not poll it on a timer; plainhkc statusreturns the last reported state without waking the car. - Rate limits. Hyundai and Kia rate-limit accounts (error 5091). Space out requests, especially commands and refreshes.
- PIN. Stop, hazard, valet and navigate need the app PIN, which is
exchanged for a short-lived control token. Repeated wrong PINs may
block remote control on your account for a while, so once the server
rejects the PIN, the library never submits it again for the life of that
Client(forhkc, the rest of the run). CheckHKC_PINif you see "the PIN was rejected". - Experimental commands. Until a command is verified on a real car, test it while you can see the car.
Privacy
- Credentials, tokens and the PIN are held as redacted secrets and never
logged.
-vshows each call's method, path and HTTP status; paths include your vehicle id, so redact it before sharing the output. - The saved session lets anyone who can read it control your car until the
tokens expire. Keep your home directory private, and run
hkc logouton shared machines. - Trip history includes GPS routes and timestamps, and
hkc locationreports where the car is parked. Treat this output as personal data before sharing or storing it. hkctalks only to the brand's official servers. It sends nothing anywhere else.- Text from the server (car names, service items, error messages) is
stripped of control characters before
hkcprints it, so it cannot inject terminal escape sequences.
When filing issues, redact your email, VIN, vehicle id, tokens and coordinates.
How it works
The client registers a device, logs in through the same OAuth flow as the
Android app, and calls the regional REST API. Commands return a message id;
the outcome is read later from the account's notification records. The
protocol, design decisions and open questions are documented in
docs/design.md, and every endpoint's status is listed in
docs/api-coverage.md.
Minimum supported Rust version
Rust 1.89 (edition 2024). Raising the MSRV is treated as a minor-version change.
Contributing
Bug reports, reports from other car models, and pull requests are welcome. See CONTRIBUTING.md for setup, quality gates and how to add an endpoint, and SECURITY.md to report a vulnerability privately. Changes are recorded in CHANGELOG.md.
License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.
Credits
The protocol knowledge in this project (endpoints, request formats, app identifiers and error codes) comes from hyundai_kia_connect_api, an MIT-licensed Python library by Fuat Akgun and contributors. See THIRD_PARTY_NOTICES.md.