McpServerStore

class McpServerStore(context: Context, secrets: SecretStore = SecretStore(context), clientCapabilities: JsonObject = JsonObject(emptyMap()))(source)

Saved remote MCP servers. Configs live in SharedPreferences; bearer tokens, OAuth registrations and tokens are encrypted in secrets. Clients are cached per server so the negotiated protocol era and session are reused.

Parameters

clientCapabilities

declared by every client, e.g. dev.ai.elements.core.mcp.McpApps.CLIENT_CAPABILITIES when the app renders MCP Apps (ai-elements-mcp-apps).

Constructors

Link copied to clipboard
constructor(context: Context, secrets: SecretStore = SecretStore(context), clientCapabilities: JsonObject = JsonObject(emptyMap()))

Properties

Link copied to clipboard
val servers: StateFlow<List<McpServerConfig>>

Functions

Link copied to clipboard
Link copied to clipboard

The client for server, with its configured credentials.

The client of the saved server id (e.g. for an MCP App of one of its tools), or null.

Link copied to clipboard
Link copied to clipboard
fun remove(id: String)
Link copied to clipboard
fun setBearerToken(id: String, token: String)
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

The enabled servers as a capability for a turn.

Link copied to clipboard
fun upsert(server: McpServerConfig)