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.
/versionGETREST: report the server build version + pid.
/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.
  • session — SessionManager, 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§

api
Dispatcher of the API, translating RpcRequests into SessionState operations.
background_thread
Per-session request loop.
ceo_builder
CEO Builder backend logic.
jobs
State of the jobs of a session. See rpfm_ipc::api::jobs.
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.
state
Per-session state, and the operations a session can run on it.
translation_hub
Submission of translations to the Translation Hub, and the GitHub sign-in it needs.
updater
Self-update checks against GitHub releases.

Constants§

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.
GITHUB_OAUTH_CLIENT_ID
Client ID of RPFM’s GitHub OAuth App, used to sign in to submit translations.
POSTHOG_API_KEY_VALUE 🔒
PostHog project API key used for telemetry and feedback.
SENTRY_DSN_KEY 🔒
Sentry DSN used for crash reports.

Statics§

GLOBAL 🔒

Functions§

allowed_origins
Returns the browser origins allowed to send requests to the server: only its own, as it serves no pages that call it.
apply_telemetry_settings
Applies the telemetry toggles and the anonymous telemetry ID of the provided settings to the whole process.
main 🔒
Process entry point.
sessions_handler 🔒
REST endpoint to get information about all active sessions.
version_handler 🔒
REST endpoint reporting the server’s build version and process id.