citum-server
Long-running server process for real-time citation formatting. Wraps
citum-engine behind a newline-delimited JSON-RPC interface, with an optional
HTTP mode for web app integrations.
Transports
stdin/stdout (default)
The default mode reads JSON-RPC requests from stdin and writes responses to stdout, one object per line. This matches the protocol used by citeproc-rs and works cleanly inside word-processor plugins (Zotero, Pandoc pipelines) with no port management.
|
# {"id":1,"result":"(Hawking, 1988)"}
HTTP (feature-gated)
Build with --features http to expose the same methods over HTTP via
axum. Useful for the citum-hub live preview panel.
# {"id":1,"result":{"format":"html","content":"<div class=\"csln-bibliography\">...","entries":null}}
Note:
refsuses native Citum schema format.issuedis an EDTF string ("1988"), not a CSL-JSON{"date-parts": [[1988]]}object.
Performance
A simulation script is available to benchmark the server under a simulated word processor workflow (large bibliography, sequential citation insertion, and periodic bibliography refreshes).
# Ensure the server is built in release mode first
# Run the simulation
Methods
| Method | Params | Result |
|---|---|---|
render_citation |
style_path, refs, citation, output_format?, inject_ast_indices? |
String |
render_bibliography |
style_path, refs, output_format?, inject_ast_indices? |
{format, content, entries?} |
validate_style |
style_path |
{valid, warnings} |
format_document |
style, refs, citations, document_options?, output_format?, locale? |
{formatted_citations, bibliography, warnings} |
Supported output_format values:
plain(default)htmldjotlatextypst
Debug Parameters: The inject_ast_indices parameter (optional, default false) is accepted by render_citation and render_bibliography for debug use. When enabled, AST node indices are embedded in the output.
Request / response envelope
Discovery
When running in HTTP mode, two read-only discovery endpoints are available:
# List all supported methods
# JSON Schema for method parameters (requires --features schema build)
Sending a GET request to /rpc returns a 405 Method Not Allowed response with a JSON hint explaining POST usage.
Batch Document Formatting
The format_document method is designed for processing a full document in one request. For practical workflows where data is stored in local files, you can use jq to assemble the JSON-RPC payload.
# Assemble and send a document formatting request using local JSON files
|
Working with Local Files
When running citum-server locally, the style_path (or style) parameter accepts relative or absolute paths to Citum YAML files.
However, the refs and citations parameters always expect data objects, not paths. This allows the server to remain transport-agnostic and simplifies its security model (preventing arbitrary file reads by the server process). To use local files for these parameters, load them into the request payload on the client side as shown in the example above.
Features
| Feature | Default | Description |
|---|---|---|
async |
off | Required for non-blocking I/O. Wraps Processor in tokio::task::spawn_blocking |
http |
off | Enables axum HTTP server; requires and automatically enables async |
schema |
off | Enables /rpc/schema endpoint; requires and automatically enables http and async |
Usage
# stdio mode (default)
# HTTP mode
&&
# Options
Dependencies
Depends on citum-engine, citum-schema, and citum_store for the standard
resolver chain. No migrate crate is pulled in.