Disclaimer: This is considered an "early access" project at the moment. If there are issues with updates, you may need to follow new installation instructions to reconcile as they may not be mentioned anywhere else.
mtapi is a command-line tool written in Rust for interacting with a Motor Town: Behind The Wheel dedicated game server's web API, enabling server administrators to query server status, send messages, ban/unban players, and more.
- Query server status and player lists
- Send in-game chat messages as announcements
- Kick, ban, and unban players
- Support for human-readable "pretty" or raw JSON output
- Config file support with optional CLI overrides
git clone https://github.com/mikhada/mtapi.git
cd mtapi
cargo build --release
The compiled binary will be at target/release/mtapi
.
By default, mtapi
will look for a configuration file in one of two places:
$HOME/.config/mtapi.toml
./mtapi.toml
(current directory)
Example config file (also found in mtapi_example.toml
):
host = "http://localhost"
port = 8080
api_password = "changeit"
mtapi [OPTIONS] <COMMAND> [ARGS...]
Flag | Description |
---|---|
-f, --config |
Path to TOML config file |
-s, --server |
Override server hostname |
-P, --port |
Override server port |
-p, --password |
Override API password |
--raw |
Output raw JSON instead of pretty |
Command | Description |
---|---|
version |
Get server version |
count |
Get number of players online |
players |
List all connected players |
housing |
List rented player houses |
banlist |
Show the list of banned players |
chat |
Send chat message to the server (announcement) |
kick |
Kick a player by unique_id |
ban |
Ban a player (supports duration + reason) |
unban |
Unban a player by unique_id |
List players:
mtapi players
Send a chat message:
mtapi chat "Hello, citizens."
Kick a player:
mtapi kick 1234567890abcdef
Ban a player for 12 hours with a reason:
mtapi ban 1234567890abcdef 12 "Griefing in the tuning shop"
Unban a player:
mtapi unban 1234567890abcdef
The code is organized as follows:
main.rs
— command-line parsing, configuration loading, command dispatchapiget.rs
— all HTTP GET endpoint wrappersapipost.rs
— all HTTP POST endpoint wrappersconfig.rs
— config file loading with support for CLI overrides
Apache 2.0 License - See LICENSE
for details, or visit the Apache license page.