Skip to main content

Crate rpfm_server

Crate rpfm_server 

Source
Expand description

§rpfm_server

Backend process for Rusted PackFile Manager. Hosts the heavy work that the Qt6 UI (rpfm_ui) and AI / MCP clients drive remotely: Pack I/O, schema decoding, diagnostics, search, dependencies, optimisation and so on.

§Architecture

The server is built on [axum] (HTTP + WebSocket) and [tokio]. It binds to 127.0.0.1:45127 by default and exposes three endpoints:

EndpointMethodPurpose
/wsGETWebSocket upgrade. Carries the rpfm_ipc command/response protocol.
/sessionsGETREST: list every active session (used by the UI session picker).
/mcp*MCP StreamableHttpService exposing the same surface to AI / MCP clients.

Every client connection is wrapped in a session::Session managed by a session::SessionManager. Each session owns a dedicated background thread (see background_thread) that processes commands serially against its own in-memory state (open packs, dependency cache, settings cache), so multiple concurrent clients can’t step on each other.

§Modules

  • background_thread — central command dispatcher; one async loop per session.
  • comms — generic mpsc-based request/response abstraction used to talk to the background thread.
  • server_websocket/ws upgrade handler and message multiplexer.
  • server_mcp/mcp endpoint: tools, prompts, resources for MCP clients.
  • sessionSessionManager, Session, lifecycle and timeout handling.
  • settings — JSON-backed settings store with batch-write optimisation.
  • updater — self-update checks against GitHub releases.

§Telemetry

Logging, panic capture and action telemetry are wired through rpfm_telemetry. The Sentry guard returned by Logger::init is held for the process lifetime in main.

Modules§

background_thread
Per-session command dispatcher — where every Pack, schema, search, diagnostics and dependency operation actually runs.
comms
Inter-thread communication primitives.
server_mcp
Model Context Protocol server exposed at the /mcp endpoint.
server_websocket
WebSocket upgrade handler and message multiplexer for the /ws endpoint.
session
Per-client session state and lifecycle.
settings
Persistent settings store and config-path helpers.
updater
Self-update checks against GitHub releases.

Macros§

set_batch
Macro to set a batch of settings in one go in an efficient way.

Constants§

APP_NAME 🔒
Application name used to derive the OS-specific config directory.
DEFAULT_ADDRESS 🔒
Default IP address the HTTP server binds to (127.0.0.1 / loopback).
DEFAULT_PORT 🔒
Default TCP port the HTTP server listens on.
ORG_DOMAIN 🔒
Organisation domain used to derive the OS-specific config directory (mirrors QCoreApplication::organizationDomain on the UI side).
ORG_NAME 🔒
Organisation name used to derive the OS-specific config directory.
SENTRY_DSN_KEY 🔒
Sentry DSN used for crash reports and action telemetry.

Statics§

GLOBAL 🔒

Functions§

main 🔒
Process entry point.
sessions_handler 🔒
REST endpoint to get information about all active sessions.