6. CLI and agents

Use Saba-chan from a terminal, and let your own AI agent, like Claude Code or Codex, use it for you.

6. CLI and agents

saba-chan-cli is the tool for using Saba-chan from a terminal. A terminal is a window where you type commands. Everything you can do in the app, you can do with the CLI. Like the app, the CLI only asks the daemon to do things and never touches server files itself. It is easy for people to use and also gives machine-readable output, so you can use it to hand Saba-chan to your own AI agent.


Using the CLI

The CLI is in the folder where you installed Saba-chan (by default C:\Program Files\Saba-chan\saba-chan-cli.exe). The installer doesn't change the system PATH (the list of folders Windows searches for commands). Call the CLI by its full path, or add that folder to PATH yourself. On Linux the installer creates ~/.local/bin/saba-chan-cli.

  • Run it without arguments to open the interactive screen.
  • If the daemon isn't running, it asks whether to start it. Closing the CLI leaves the daemon and servers running.
  • Part of a server name is enough.
What you wantCommand
Overall statussaba-chan-cli status
Add a serversaba-chan-cli server add
Start · stop · restartsaba-chan-cli start pal · stop pal · restart pal
Console · game commandsaba-chan-cli console pal · saba-chan-cli run mc say Hello
Backups · scheduled taskssaba-chan-cli backup … · saba-chan-cli schedule …
Connect Discordsaba-chan-cli bot pair (shows a code and waits until it's connected)
Command permissionssaba-chan-cli perm …
Discord server prefix · slash command stylesaba-chan-cli bot prefix … · bot slash …
Reading Saba-chan · Discord server managementsaba-chan-cli bot tts … · bot moderation · bot channel …
Saba-chan updatessaba-chan-cli update check · update apply
Remote daemonsaba-chan-cli remote … · --daemon <name> on any command (Remote daemon)
Switch to the appsaba-chan-cli gui
Erase all my datasaba-chan-cli bot erase
Detailed helpsaba-chan-cli <command> --help

Connecting your AI agent

Any AI agent that can run terminal commands, like Claude Code or Codex, can look after Saba-chan for you. The agent takes requests in plain words like a person would, runs saba-chan-cli behind the scenes and reads the result.

My AI agent (e.g. Claude Code, Codex)
›

The CLI keeps these rules so agents can rely on it.

  • --json: standard output carries exactly one JSON document. Notices and progress go to standard error. On failure it has error, error_code and, when there are any, suggestions.
  • Exit codes: 0 success, 1 failure, 2 usage error or several matching targets, 3 can't reach the daemon, 4 target not found, 130 cancelled.
  • help --json: the full command tree, arguments, global options and exit code table as JSON. Works even when the daemon is off. Have your agent read this first instead of memorizing commands.
  • --json-stream: long jobs (installing a server, updates) report progress as one JSON object per line, with the result on the last line.
  • events --json: follows daemon events (server start and stop, install progress and so on) one line at a time.
  • do: the list of actions the daemon offers. do action --plan shows what would change before you run it.

What a person has to do

  • Commands that need confirmation don't ask outside a terminal; they stop and need --yes to run. Have the agent ask you before it adds --yes to anything that can't be undone, like deleting or resetting a server.
  • Accepting a game EULA, and agreeing to run an unverified module without isolation, can't be done with --yes or --json. A person does these in a terminal or in the app.

Example to paste into your agent's instructions

Add something like this to your agent's instruction file (for example AGENTS.md or CLAUDE.md). Adjust the path to your install location.

## Saba-chan game servers
- Manage game servers only with saba-chan-cli: "C:\Program Files\Saba-chan\saba-chan-cli.exe"
- Read the commands and arguments once with `saba-chan-cli help --json`.
- Add --json to every command and check the exit code (0 success, 1 failure, 2 usage or ambiguous, 3 no daemon, 4 not found).
- Ask the person before adding --yes to anything that can't be undone, like deleting or resetting a server.
- Leave EULA acceptance and turning off isolation to the person.

Connecting an AI agent remotely (MCP)

Even if an AI agent such as ChatGPT or Claude can't use your PC's terminal, you can connect it to the Saba-chan cloud as a remote MCP and let it handle your PC's game servers. It manages every PC connected to your Discord account, as the app does.

  1. In the agent's screen for adding a connector (remote MCP server), enter https://saba-chan.online/mcp. You can also see this address on the app's Settings → Connection screen, with /mysaba agent, and with saba-chan-cli bot agent.
  2. When a Discord login opens in the browser, sign in with the Discord account that has your PC connected, and allow it on the Saba-chan consent screen.
  3. Ask the agent in plain words. For example: "How is the Minecraft server doing?" or "Restart the Palworld server"

Good to know:

  • You can connect several agents to one Discord account (up to 10). Allowing the same agent again replaces only its earlier connection. You can see and disconnect each agent in Saba-chan Settings → Connection or with /내사바쨩 에이전트.
  • Dangerous commands, and stop and restart, are asked again on the agent's screen before they run (the same rule as the app). It doesn't ask through Discord.
  • What is blocked in Saba-chan web (PC-only settings such as paths and passwords, Saba-chan updates and so on) can't be done through the agent either.
  • To disconnect: press Disconnect agent on the app's Settings → Connection screen, use /mysaba agent in Discord, or run saba-chan-cli bot agent --unlink. A connection that hasn't been used for 90 days is disconnected automatically.