enableHttpServer
Enable the HTTP transport (Ktor) for desktop MCP clients.
Parameters
Plaintext port to bind (ignored when enableTls supplies an HTTPS port).
Fixed bearer token; when null and requireAuth is true, one is generated via SecureRandom and exposed as DroidMcp.serverToken.
Require a Bearer token on every request (default true). When false the server is open on the local network.
Expose and accept only read-only tools (filters tools/list, rejects mutating tools/call).
Android context, used for mDNS service broadcast when available.
Browser origins (e.g. "http://localhost:6274" for MCP Inspector) allowed to call the server. Requests carrying any other Origin header are rejected with 403 to block DNS-rebinding and drive-by browser requests; native clients send no Origin and are unaffected.
Throws
if token is shorter than HttpTransport.MIN_TOKEN_LENGTH characters.