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