restart_server
Replaces the running Kiln MCP server process with a fresh instance to apply plugin installs, environment variable changes, or server code updates without reconnecting the MCP client.
Instructions
Restart the Kiln MCP server process.
Replaces the current process with a fresh instance using
``os.execve``. The exec keeps the stdio pipe, so the MCP client sees
no disconnect and repeats no ``initialize`` handshake; the fresh
process takes up the handshake this connection already made, so the
client's next call simply works. The client keeps the tool list it
cached when it connected: tools the new code adds reach it when it
reconnects. The result's ``keeps_connection`` says whether the
handshake was handed on.
WHAT A RESTART REFRESHES depends on how this server was launched,
and the result says which happened. A launcher script that
exported ``KILN_SERVE_WRAPPER`` is re-entered whole, so whatever
that script does before serving — syncing code, healing installs —
runs again. Without it the restart re-execs ``python -m kiln
serve`` in place: a fresh process over however this interpreter
resolves ``kiln``, which picks up edits to those files but runs no
launcher logic. (Measured 2026-08-19: an operator launcher synced
two runtime clones on every start, and a restart through this tool
silently skipped the sync — the served code was two revisions
stale while the restart reported success.)
Use after installing or updating kiln-pro plugins, changing
environment variables, or modifying server code — avoids the
need to fully restart the MCP client application.
:param clean_env: When ``True`` (default), strips ``KILN_PRINTER_*``
environment variables from the child process if
``~/.kiln/config.yaml`` has a printer configured. This defeats
the "ghost env" footgun where a stale ``KILN_PRINTER_API_KEY``
inherited from a past shell session silently shadows config.yaml
edits for the lifetime of the MCP parent process. Without this,
every edit to config.yaml looks like it does nothing and the
printer rejects MQTT auth with no hint why. Set to ``False`` to
preserve the full env (useful for CI or pure env-driven workflows
where config.yaml is absent or deliberately overridden).
:returns: Confirmation that the restart is imminent, plus the list
of env vars that were stripped (for debugging transparency).
The exec happens ~0.5 seconds after this returns.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "restart_server"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| clean_env | No | When ``True`` (default), strips ``KILN_PRINTER_*`` environment variables from the child process if ``~/.kiln/config.yaml`` has a printer configured. This defeats the "ghost env" footgun where a stale ``KILN_PRINTER_API_KEY`` inherited from a past shell session silently shadows config.yaml edits for the lifetime of the MCP parent process. Without this, every edit to config.yaml looks like it does nothing and the printer rejects MQTT auth with no hint why. Set to ``False`` to preserve the full env (useful for CI or pure env-driven workflows where config.yaml is absent or deliberately overridden). Default: true. |