HttpTransport
Ktor/Netty MCP server for desktop clients. Exposes the JSON-RPC surface at POST /mcp (plus an SSE channel and a /health probe), enforces bearer auth via a TokenStore when requireAuth is set, optionally terminates TLS, and advertises itself over mDNS (_mcp._tcp). Prefer building one through DroidMcp.Builder.enableHttpServer rather than directly.
Parameters
Tools to serve.
Plaintext port; overridden by TlsConfig.httpsPort when tls is set.
Fixed primary token; a random one is generated when null and requireAuth is true.
Require a Bearer token on every request. When false the server is open.
Serve only read-only tools.
Android context for mDNS registration; mDNS is skipped when null.
Version reported in initialize and the mDNS TXT record.
Optional per-call audit hook.
TLS material; when set the server binds HTTPS and exposes tlsFingerprint.
Properties
Current primary token, or null on an open server. Tracks rotateToken.
Whether the server terminates TLS.
mDNS service name advertised on the network, derived from the device model (sanitised, ≤63 chars).
SHA-256 fingerprint of the server certificate to pin in the pairing QR, or null when TLS is disabled. See TlsConfig.certFingerprintSha256.
Functions
Mint a revocable token for a named client. Re-pairing an existing label replaces its token. Returns the new token, or null on an open server.
Snapshot of paired clients (excludes the primary). Empty on an open server.
Revoke a paired client's token. @return true if a client with that label existed.
Rotate the primary bearer token, invalidating the old one. Paired-client tokens are unaffected. Returns the new token, or null on an open server. Surface the new value in a fresh pairing QR.