koan_server/lib.rs
1//! koan-server — GraphQL, Subsonic REST, and MCP server for koan.
2//!
3//! Library crate that exports server entry points. No TUI, no CLI, no clap.
4//! Depends only on koan-core.
5
6pub mod auth;
7pub mod clients;
8pub mod covers;
9mod demo;
10pub mod graphql;
11mod html;
12pub mod icon;
13pub mod mcp;
14pub mod pair;
15pub mod push;
16pub mod share;
17pub mod subsonic;
18mod transcode;
19pub mod ui;
20
21/// Where a server's `server.url` comes from.
22#[derive(Clone, Debug, PartialEq, Eq)]
23pub enum ServerUrl {
24 /// Read once, at start: a server whose configuration changes only with a
25 /// restart, and tests, which share one configuration.
26 Fixed(Option<String>),
27 /// `share.url`, read as asked: an app sharing its library changes it as
28 /// it runs, and keeps it apart from a headless server's `server.url`.
29 Live,
30}
31
32impl ServerUrl {
33 pub fn get(&self) -> Option<String> {
34 match self {
35 Self::Fixed(url) => url.clone(),
36 Self::Live => koan_core::config::Config::cached().share_url(),
37 }
38 }
39}
40
41// Re-exports for downstream convenience.
42pub use auth::AuthUser;
43pub use graphql::{KoanSchema, build_schema};
44pub use mcp::KoanMcpServer;