prmcp

One endpoint for a prain-served model: MCP tools picked by model name (gemma4+terminal,web). The proxy itself is not written yet; this repo holds the stack around it so far.

The prain stack: prain up

scripts/prain is a front door for the prain command. up, down, restart, status and logs drive the stack's OpenRC user services. Every other subcommand (serve, web, tui, check, ...) goes to prain's own CLI in PRAIN_ROOT/.venv, with scripts/env.sh sourced first, so you no longer need to source it yourself. (In a shell where you did, the venv's prain comes first on PATH and prain up is unknown there.) prain --help shows prain's own help with the stack commands merged into its command list.

prain up [NAME...]        start the services (all by default), waiting until each is ready
prain down [NAME...]      stop them, in reverse order
prain restart [NAME...]
prain status [NAME...]
prain logs [NAME...]      tail -F their logs (~/.local/state/prain/NAME.log)

Services live in ~/.config/prain/prain.conf (PRAIN_CONF overrides): PRAIN_SERVICES lists them. Per service:

  • cmd_NAME: the command, run in PRAIN_ROOT with env.sh sourced.
  • ready_NAME: a URL prain up waits for.
  • requires_NAME: services that must already be up. If one isn't, NAME refuses to start with a message (prain: web needs vllm, which is not running ... Start it first: prain up vllm). It never starts them itself.

See scripts/prain.conf.example.

One OpenRC script, openrc/init.d/prain, serves them all through links named prain.NAME. OpenRC settings go in ~/.config/rc/conf.d/prain.NAME:

  • rc_after="prain.vllm": start order when both are in a runlevel. It doesn't start vLLM.
  • respawn_max (3) and respawn_period (600 s; 1800 for vLLM): supervise-daemon restarts a crashed service, and gives up after more than respawn_max crashes within respawn_period. Crashes further apart are restarted forever.
  • respawn_delay (5 s).

Install

ln -s "$PWD/scripts/prain" ~/.local/bin/prain
mkdir -p ~/.config/prain ~/.config/rc/init.d ~/.config/rc/conf.d
cp scripts/prain.conf.example ~/.config/prain/prain.conf
ln -s "$PWD/openrc/init.d/prain" ~/.config/rc/init.d/prain
for n in vllm web; do ln -s prain ~/.config/rc/init.d/prain.$n; done
cp openrc/conf.d/prain.* ~/.config/rc/conf.d/
# optional, start both with the session (web waits for vLLM through rc_after):
rc-update --user add prain.vllm default && rc-update --user add prain.web default

A new service is a cmd_NAME line, its name in PRAIN_SERVICES and one more prain.NAME link.

Test

bash scripts/test_prain.sh
S
Description
No description provided
Readme 39 KiB
Languages
Shell 100%