Settings › MCP servers: how each is signed in to, and a sign-in opened in the browser
CI / check (push) Canceled after 0s
CI / check (push) Canceled after 0s
`GET /api/v2/mcp` as a page: each server's name, how many tools it offers, and its state (ready, signed in, not signed in, needs a new sign-in), with who the provider says signed in and until when. One that waits for this person's sign-in has a button that opens the instance's own sign-in page in the browser (a Custom Tab): the sign-in happens there, against the instance, on its cookie door. The app starts and finishes nothing and its token is in no address it opens. Only a page of the instance the app is signed in to is opened: an address on another origin is read as its path on that instance. A shared sign-in an administrator makes says so and has no button. The list is read again each time the page comes back to the front. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
16 files changed
+449
-12
No files matched your search
+4
-1
@@ -5,7 +5,7 @@ is in alpha and releases come off `main`.
|
||||
|
||||
## [Unreleased]
|
||||
|
||||
For Files and generated media as described here the instance must be newer than
|
||||
For Files, generated media and MCP servers as described here the instance must be newer than
|
||||
LLeMbas 2.0.0-beta.16. On an older one Files lists and shows text as before, and says so where
|
||||
it cannot do more.
|
||||
|
||||
@@ -42,6 +42,9 @@ it cannot do more.
|
||||
says why in the instance's own words. Nothing of this is shown over the lock screen, and the
|
||||
app posts no notification about a file.
|
||||
- **Sound and video you attached can be played** from the message they are attached to.
|
||||
- **Settings › MCP servers.** The MCP servers your chats may be offered, how many tools each
|
||||
has and how each is signed in to. One that waits for your sign-in has a button that opens the
|
||||
instance's own sign-in page in the browser; the list is read again when you come back.
|
||||
- **A new folder from inside the folder picker**, when moving, copying or saving a share.
|
||||
- **A table can be shown as its text**, and as a table again.
|
||||
|
||||
|
||||
@@ -58,6 +58,7 @@ import eu.llembas.android.ui.scheduled.ScheduleEditScreen
|
||||
import eu.llembas.android.ui.scheduled.ScheduleScreen
|
||||
import eu.llembas.android.ui.scheduled.ScheduledScreen
|
||||
import eu.llembas.android.ui.scheduled.SchedulingModelsScreen
|
||||
import eu.llembas.android.ui.settings.McpScreen
|
||||
import eu.llembas.android.ui.settings.SettingsScreen
|
||||
import eu.llembas.android.ui.signin.SignInScreen
|
||||
import eu.llembas.android.ui.theme.LembasTheme
|
||||
@@ -320,6 +321,7 @@ class MainActivity : ComponentActivity() {
|
||||
composable("files") { FilesScreen(onBack = { nav.popBackStack() }) }
|
||||
// Files at a folder: where a generated file's "Open in Files" leads.
|
||||
composable("files-at/{at}") { e -> FilesScreen(onBack = { nav.popBackStack() }, start = e.arguments?.getString("at")) }
|
||||
composable("mcp") { McpScreen(onBack = { nav.popBackStack() }) }
|
||||
composable("archived") {
|
||||
ArchivedScreen(onBack = { nav.popBackStack() }, onOpen = { top("chat/$it") }, onRestored = { chats.load() })
|
||||
}
|
||||
@@ -388,7 +390,7 @@ class MainActivity : ComponentActivity() {
|
||||
ScheduleEditScreen(e.arguments?.getString("id"), onBack = { nav.popBackStack() }, onSaved = { nav.popBackStack() })
|
||||
}
|
||||
composable("settings") {
|
||||
SettingsScreen(onBack = { nav.popBackStack() }, onAddInstance = { over("add") })
|
||||
SettingsScreen(onBack = { nav.popBackStack() }, onAddInstance = { over("add") }, onMcp = { over("mcp") })
|
||||
}
|
||||
// Signing in to one more instance makes it the one in use, which starts a
|
||||
// fresh navigation for it (the `key` above).
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
@file:OptIn(androidx.compose.material3.ExperimentalMaterial3Api::class)
|
||||
|
||||
package eu.llembas.android.ui.settings
|
||||
|
||||
import androidx.compose.foundation.border
|
||||
import androidx.compose.foundation.layout.Arrangement
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.Column
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.heightIn
|
||||
import androidx.compose.foundation.layout.padding
|
||||
import androidx.compose.foundation.lazy.LazyColumn
|
||||
import androidx.compose.foundation.lazy.items
|
||||
import androidx.compose.foundation.shape.RoundedCornerShape
|
||||
import androidx.compose.material.icons.Icons
|
||||
import androidx.compose.material.icons.automirrored.filled.ArrowBack
|
||||
import androidx.compose.material.icons.filled.Refresh
|
||||
import androidx.compose.material3.Button
|
||||
import androidx.compose.material3.ButtonDefaults
|
||||
import androidx.compose.material3.CircularProgressIndicator
|
||||
import androidx.compose.material3.Icon
|
||||
import androidx.compose.material3.IconButton
|
||||
import androidx.compose.material3.MaterialTheme
|
||||
import androidx.compose.material3.Scaffold
|
||||
import androidx.compose.material3.Text
|
||||
import androidx.compose.material3.TopAppBar
|
||||
import androidx.compose.material3.TopAppBarDefaults
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.LaunchedEffect
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableIntStateOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.runtime.setValue
|
||||
import androidx.compose.ui.Alignment
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.platform.LocalContext
|
||||
import androidx.compose.ui.res.stringResource
|
||||
import androidx.compose.ui.text.style.TextOverflow
|
||||
import androidx.compose.ui.unit.dp
|
||||
import androidx.lifecycle.Lifecycle
|
||||
import androidx.lifecycle.compose.LifecycleEventEffect
|
||||
import eu.llembas.android.R
|
||||
import eu.llembas.android.api.ApiException
|
||||
import eu.llembas.android.api.McpServer
|
||||
import eu.llembas.android.api.signInAddress
|
||||
import eu.llembas.android.lembas
|
||||
import eu.llembas.android.ui.files.filesSay
|
||||
import eu.llembas.android.ui.scheduled.ScheduleLogic
|
||||
import eu.llembas.android.ui.theme.LocalPalette
|
||||
import eu.llembas.android.ui.viewer.openOutside
|
||||
import kotlinx.coroutines.CancellationException
|
||||
|
||||
/** The instance's MCP servers as the page draws them: on their way, refused, or the list. */
|
||||
data class McpState(val servers: List<McpServer> = emptyList(), val loading: Boolean = true, val error: String? = null)
|
||||
|
||||
/**
|
||||
* Settings › MCP servers: the servers whose tools the person's chats may be offered, and how
|
||||
* each is signed in to. One that waits for a sign-in has a button that opens the instance's own
|
||||
* sign-in page **in the browser** -- the sign-in happens there, against the instance, with the
|
||||
* person signed in to the instance by its cookie. The app starts and finishes nothing, and sees,
|
||||
* sends and stores no token of a server; its own token is in no address it opens. The list is
|
||||
* read again whenever the page comes back to the front, which is when the browser was left.
|
||||
*/
|
||||
@Composable
|
||||
fun McpScreen(onBack: () -> Unit) {
|
||||
val context = LocalContext.current
|
||||
var state by remember { mutableStateOf(McpState()) }
|
||||
var reads by remember { mutableIntStateOf(0) }
|
||||
var base by remember { mutableStateOf("") }
|
||||
LifecycleEventEffect(Lifecycle.Event.ON_RESUME) { reads++ }
|
||||
LaunchedEffect(reads) {
|
||||
state = state.copy(loading = true, error = null)
|
||||
state = try {
|
||||
val api = context.lembas.instances.client() ?: throw ApiException(401, context.getString(R.string.assist_signed_out))
|
||||
base = api.base
|
||||
McpState(api.mcpServers(), loading = false)
|
||||
} catch (e: CancellationException) {
|
||||
throw e
|
||||
} catch (e: Exception) {
|
||||
state.copy(loading = false, error = context.filesSay(e))
|
||||
}
|
||||
}
|
||||
McpContent(
|
||||
state,
|
||||
onBack = onBack,
|
||||
onReload = { reads++ },
|
||||
// Only a page of the instance the app is signed in to is ever opened (signInAddress).
|
||||
onSignIn = { server -> signInAddress(base, server.auth.signinUrl)?.let { openOutside(context, it) } },
|
||||
)
|
||||
}
|
||||
|
||||
/** The words for how a server is signed in to; a state this app does not know is said as the instance says it. */
|
||||
@Composable
|
||||
internal fun mcpState(server: McpServer): String = when (server.auth.state) {
|
||||
"ready" -> stringResource(R.string.mcp_ready)
|
||||
"signed_in" -> stringResource(R.string.mcp_signed_in)
|
||||
"signed_out" -> stringResource(R.string.mcp_signed_out)
|
||||
"needs_signin" -> stringResource(R.string.mcp_needs_signin)
|
||||
else -> server.auth.state
|
||||
}
|
||||
|
||||
/** The page, from [state] alone. Each server is a card: its words stacked, and under them the one button, the card's whole width. */
|
||||
@Composable
|
||||
fun McpContent(state: McpState, onBack: () -> Unit = {}, onReload: () -> Unit = {}, onSignIn: (McpServer) -> Unit = {}) {
|
||||
val palette = LocalPalette.current
|
||||
Scaffold(
|
||||
containerColor = palette.bg,
|
||||
topBar = {
|
||||
TopAppBar(
|
||||
colors = TopAppBarDefaults.topAppBarColors(containerColor = palette.bg, scrolledContainerColor = palette.bg),
|
||||
title = { Text(stringResource(R.string.mcp_title), maxLines = 1, overflow = TextOverflow.Ellipsis) },
|
||||
navigationIcon = {
|
||||
IconButton(onClick = onBack) { Icon(Icons.AutoMirrored.Filled.ArrowBack, contentDescription = stringResource(R.string.back)) }
|
||||
},
|
||||
actions = { IconButton(onClick = onReload) { Icon(Icons.Filled.Refresh, contentDescription = stringResource(R.string.reload)) } },
|
||||
)
|
||||
},
|
||||
) { padding ->
|
||||
Box(Modifier.padding(padding).fillMaxSize()) {
|
||||
when {
|
||||
state.error != null -> Text(state.error, color = MaterialTheme.colorScheme.error, modifier = Modifier.padding(16.dp))
|
||||
|
||||
state.loading && state.servers.isEmpty() -> CircularProgressIndicator(Modifier.align(Alignment.Center))
|
||||
|
||||
state.servers.isEmpty() -> Text(
|
||||
stringResource(R.string.mcp_none),
|
||||
color = palette.inkMuted,
|
||||
modifier = Modifier.align(Alignment.Center).padding(32.dp),
|
||||
)
|
||||
|
||||
else -> LazyColumn(
|
||||
Modifier.fillMaxSize(),
|
||||
contentPadding = PaddingValues(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(12.dp),
|
||||
) {
|
||||
item { Text(stringResource(R.string.mcp_intro), style = MaterialTheme.typography.bodyMedium, color = palette.inkMuted) }
|
||||
items(state.servers, key = { it.id }) { server -> McpCard(server, onSignIn) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Composable
|
||||
private fun McpCard(server: McpServer, onSignIn: (McpServer) -> Unit) {
|
||||
val palette = LocalPalette.current
|
||||
val auth = server.auth
|
||||
Column(
|
||||
Modifier.fillMaxWidth().border(1.dp, palette.border, RoundedCornerShape(16.dp)).padding(16.dp),
|
||||
verticalArrangement = Arrangement.spacedBy(4.dp),
|
||||
) {
|
||||
Text(server.label, style = MaterialTheme.typography.titleMedium, color = palette.ink)
|
||||
Text(
|
||||
listOf(mcpState(server), stringResource(R.string.mcp_tools, server.tools.toString())).joinToString(" · "),
|
||||
style = MaterialTheme.typography.bodyMedium,
|
||||
color = if (auth.needsSignIn) palette.danger else palette.inkMuted,
|
||||
)
|
||||
// Who the provider says signed in: a stranger's text, drawn as plain text.
|
||||
if (auth.account.isNotBlank()) {
|
||||
Text(stringResource(R.string.mcp_account, auth.account), style = MaterialTheme.typography.bodySmall, color = palette.inkMuted)
|
||||
}
|
||||
if (!auth.needsSignIn) {
|
||||
ScheduleLogic.moment(auth.expiresAt)?.let {
|
||||
Text(stringResource(R.string.mcp_until, it), style = MaterialTheme.typography.bodySmall, color = palette.inkMuted)
|
||||
}
|
||||
}
|
||||
if (auth.needsSignIn) {
|
||||
if (auth.signinUrl.isNullOrBlank()) {
|
||||
// One sign-in for everyone, which only an administrator makes: nothing for this person to do.
|
||||
Text(stringResource(R.string.mcp_shared_note), style = MaterialTheme.typography.bodySmall, color = palette.inkMuted)
|
||||
} else {
|
||||
Text(stringResource(R.string.mcp_browser_note), style = MaterialTheme.typography.bodySmall, color = palette.inkMuted)
|
||||
Button(
|
||||
onClick = { onSignIn(server) },
|
||||
colors = ButtonDefaults.buttonColors(containerColor = palette.accent, contentColor = palette.accentInk),
|
||||
modifier = Modifier.fillMaxWidth().padding(top = 8.dp).heightIn(min = 48.dp),
|
||||
) { Text(stringResource(R.string.mcp_sign_in)) }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -36,6 +36,7 @@ import androidx.compose.material.icons.filled.CheckCircle
|
||||
import androidx.compose.material.icons.filled.Dns
|
||||
import androidx.compose.material.icons.filled.Download
|
||||
import androidx.compose.material.icons.filled.ErrorOutline
|
||||
import androidx.compose.material.icons.filled.Extension
|
||||
import androidx.compose.material.icons.filled.Forum
|
||||
import androidx.compose.material.icons.filled.GraphicEq
|
||||
import androidx.compose.material.icons.filled.Hearing
|
||||
@@ -135,6 +136,9 @@ import kotlinx.coroutines.launch
|
||||
interface SettingsActions {
|
||||
fun use(instance: Instance) {}
|
||||
fun add() {}
|
||||
|
||||
/** The instance's MCP servers and their sign-ins. */
|
||||
fun mcpServers() {}
|
||||
fun signOut(instance: Instance) {}
|
||||
fun theme(value: String) {}
|
||||
fun language(value: String) {}
|
||||
@@ -207,7 +211,7 @@ data class SettingsState(
|
||||
)
|
||||
|
||||
@Composable
|
||||
fun SettingsScreen(onBack: () -> Unit, onAddInstance: () -> Unit) {
|
||||
fun SettingsScreen(onBack: () -> Unit, onAddInstance: () -> Unit, onMcp: () -> Unit = {}) {
|
||||
val context = LocalContext.current
|
||||
val store = context.lembas.instances
|
||||
val scope = rememberCoroutineScope()
|
||||
@@ -265,6 +269,8 @@ fun SettingsScreen(onBack: () -> Unit, onAddInstance: () -> Unit) {
|
||||
|
||||
override fun add() = onAddInstance()
|
||||
|
||||
override fun mcpServers() = onMcp()
|
||||
|
||||
override fun signOut(instance: Instance) {
|
||||
scope.launch {
|
||||
Push.disable(context, instance)
|
||||
@@ -550,6 +556,9 @@ fun SettingsContent(state: SettingsState, actions: SettingsActions, onBack: () -
|
||||
if (state.instances.isNotEmpty()) Rule()
|
||||
SettingRow(Icons.Filled.Add, stringResource(R.string.add_instance), onClick = actions::add)
|
||||
state.active?.let { current ->
|
||||
Rule()
|
||||
// The MCP servers of the instance in use, and which of them wait for a sign-in.
|
||||
SettingRow(Icons.Filled.Extension, stringResource(R.string.mcp_title), onClick = actions::mcpServers)
|
||||
Rule()
|
||||
SettingRow(Icons.AutoMirrored.Filled.Logout, stringResource(R.string.sign_out), tint = palette.danger, onClick = {
|
||||
actions.signOut(current)
|
||||
|
||||
@@ -411,6 +411,19 @@
|
||||
<string name="job_failed">Selhalo</string>
|
||||
<string name="job_cancelled">Zrušeno</string>
|
||||
<string name="job_expired">Vypršelo</string>
|
||||
<string name="mcp_title">Servery MCP</string>
|
||||
<string name="mcp_intro">Servery, jejichž nástroje mohou být nabídnuty ve vašich chatech. Některé se používají s vaším vlastním účtem u nich: jejich nástroje jsou nabízeny, dokud jste přihlášeni.</string>
|
||||
<string name="mcp_none">Na této instanci vám nejsou nabízeny žádné servery MCP.</string>
|
||||
<string name="mcp_ready">Připraveno</string>
|
||||
<string name="mcp_signed_in">Přihlášeno</string>
|
||||
<string name="mcp_signed_out">Nepřihlášeno</string>
|
||||
<string name="mcp_needs_signin">Je potřeba nové přihlášení</string>
|
||||
<string name="mcp_tools">Nástroje: %1$s</string>
|
||||
<string name="mcp_account">Přihlášeno jako %1$s</string>
|
||||
<string name="mcp_until">Přihlášeno do %1$s</string>
|
||||
<string name="mcp_shared_note">Tento server má jedno společné přihlášení, které provádí správce.</string>
|
||||
<string name="mcp_browser_note">Přihlášení probíhá v prohlížeči, přímo na instanci. Pokud prohlížeč není k instanci přihlášen, nejprve si to vyžádá. Potom se vraťte sem.</string>
|
||||
<string name="mcp_sign_in">Přihlásit se</string>
|
||||
<string name="notebook_empty">Tento zápisník nemá žádné buňky.</string>
|
||||
<string name="notebook_more">Dalších %1$s buněk se nezobrazuje.</string>
|
||||
<string name="notebook_cell_cut">Tato buňka je delší, než se zde zobrazuje.</string>
|
||||
|
||||
@@ -411,6 +411,19 @@
|
||||
<string name="job_failed">Fehlgeschlagen</string>
|
||||
<string name="job_cancelled">Abgebrochen</string>
|
||||
<string name="job_expired">Abgelaufen</string>
|
||||
<string name="mcp_title">MCP-Server</string>
|
||||
<string name="mcp_intro">Die Server, deren Werkzeuge in den eigenen Chats angeboten werden können. Manche werden mit einem eigenen Konto dort genutzt: Deren Werkzeuge werden angeboten, solange die Anmeldung besteht.</string>
|
||||
<string name="mcp_none">Auf dieser Instanz werden keine MCP-Server angeboten.</string>
|
||||
<string name="mcp_ready">Bereit</string>
|
||||
<string name="mcp_signed_in">Angemeldet</string>
|
||||
<string name="mcp_signed_out">Nicht angemeldet</string>
|
||||
<string name="mcp_needs_signin">Neue Anmeldung nötig</string>
|
||||
<string name="mcp_tools">Werkzeuge: %1$s</string>
|
||||
<string name="mcp_account">Angemeldet als %1$s</string>
|
||||
<string name="mcp_until">Angemeldet bis %1$s</string>
|
||||
<string name="mcp_shared_note">Dieser Server hat eine gemeinsame Anmeldung, die ein Administrator vornimmt.</string>
|
||||
<string name="mcp_browser_note">Die Anmeldung geschieht im Browser, auf der Instanz selbst. Ist der Browser dort nicht angemeldet, wird zuerst danach gefragt. Danach hierher zurückkehren.</string>
|
||||
<string name="mcp_sign_in">Anmelden</string>
|
||||
<string name="notebook_empty">Dieses Notebook hat keine Zellen.</string>
|
||||
<string name="notebook_more">%1$s weitere Zellen werden nicht gezeigt.</string>
|
||||
<string name="notebook_cell_cut">Diese Zelle ist länger, als hier gezeigt wird.</string>
|
||||
|
||||
@@ -411,6 +411,19 @@
|
||||
<string name="job_failed">Fallidos</string>
|
||||
<string name="job_cancelled">Cancelado</string>
|
||||
<string name="job_expired">Caducado</string>
|
||||
<string name="mcp_title">Servidores MCP</string>
|
||||
<string name="mcp_intro">Los servidores cuyas herramientas pueden ofrecerse en sus chats. Algunos se usan con una cuenta propia en ellos: sus herramientas se ofrecen mientras la sesión esté iniciada.</string>
|
||||
<string name="mcp_none">En esta instancia no se le ofrece ningún servidor MCP.</string>
|
||||
<string name="mcp_ready">Listo</string>
|
||||
<string name="mcp_signed_in">Sesión iniciada</string>
|
||||
<string name="mcp_signed_out">Sin sesión iniciada</string>
|
||||
<string name="mcp_needs_signin">Hace falta iniciar sesión de nuevo</string>
|
||||
<string name="mcp_tools">Herramientas: %1$s</string>
|
||||
<string name="mcp_account">Sesión iniciada como %1$s</string>
|
||||
<string name="mcp_until">Sesión iniciada hasta %1$s</string>
|
||||
<string name="mcp_shared_note">Este servidor tiene un inicio de sesión compartido, que hace un administrador.</string>
|
||||
<string name="mcp_browser_note">El inicio de sesión se hace en el navegador, en la propia instancia. Si el navegador no tiene la sesión iniciada en la instancia, primero la pide. Después, vuelva aquí.</string>
|
||||
<string name="mcp_sign_in">Iniciar sesión</string>
|
||||
<string name="notebook_empty">Este cuaderno no tiene celdas.</string>
|
||||
<string name="notebook_more">No se muestran %1$s celdas más.</string>
|
||||
<string name="notebook_cell_cut">Esta celda es más larga de lo que se muestra aquí.</string>
|
||||
|
||||
@@ -411,6 +411,19 @@
|
||||
<string name="job_failed">Échecs</string>
|
||||
<string name="job_cancelled">Annulé</string>
|
||||
<string name="job_expired">Expiré</string>
|
||||
<string name="mcp_title">Serveurs MCP</string>
|
||||
<string name="mcp_intro">Les serveurs dont les outils peuvent être proposés dans vos discussions. Certains s’utilisent avec un compte à vous chez eux : leurs outils sont proposés tant que vous y êtes connecté.</string>
|
||||
<string name="mcp_none">Aucun serveur MCP ne vous est proposé sur cette instance.</string>
|
||||
<string name="mcp_ready">Prêt</string>
|
||||
<string name="mcp_signed_in">Connecté</string>
|
||||
<string name="mcp_signed_out">Non connecté</string>
|
||||
<string name="mcp_needs_signin">Nouvelle connexion nécessaire</string>
|
||||
<string name="mcp_tools">Outils : %1$s</string>
|
||||
<string name="mcp_account">Connecté en tant que %1$s</string>
|
||||
<string name="mcp_until">Connecté jusqu’au %1$s</string>
|
||||
<string name="mcp_shared_note">Ce serveur a une connexion partagée, établie par un administrateur.</string>
|
||||
<string name="mcp_browser_note">La connexion se fait dans le navigateur, sur l’instance elle-même. Si le navigateur n’y est pas connecté, il le demande d’abord. Revenez ensuite ici.</string>
|
||||
<string name="mcp_sign_in">Se connecter</string>
|
||||
<string name="notebook_empty">Ce notebook n\'a aucune cellule.</string>
|
||||
<string name="notebook_more">%1$s autres cellules ne sont pas affichées.</string>
|
||||
<string name="notebook_cell_cut">Cette cellule est plus longue que ce qui est affiché ici.</string>
|
||||
|
||||
@@ -411,6 +411,19 @@
|
||||
<string name="job_failed">Sikertelen</string>
|
||||
<string name="job_cancelled">Megszakítva</string>
|
||||
<string name="job_expired">Lejárt</string>
|
||||
<string name="mcp_title">MCP-szerverek</string>
|
||||
<string name="mcp_intro">Azok a szerverek, amelyek eszközei felkínálhatók a csevegéseiben. Némelyik az ottani saját fiókjával használható: az eszközeik addig érhetők el, amíg be van jelentkezve.</string>
|
||||
<string name="mcp_none">Ezen a példányon nincs Önnek felkínált MCP-szerver.</string>
|
||||
<string name="mcp_ready">Kész</string>
|
||||
<string name="mcp_signed_in">Bejelentkezve</string>
|
||||
<string name="mcp_signed_out">Nincs bejelentkezve</string>
|
||||
<string name="mcp_needs_signin">Új bejelentkezés szükséges</string>
|
||||
<string name="mcp_tools">Eszközök: %1$s</string>
|
||||
<string name="mcp_account">Bejelentkezve mint %1$s</string>
|
||||
<string name="mcp_until">Bejelentkezve eddig: %1$s</string>
|
||||
<string name="mcp_shared_note">Ennek a szervernek egy közös bejelentkezése van, amelyet egy rendszergazda végez el.</string>
|
||||
<string name="mcp_browser_note">A bejelentkezés a böngészőben történik, magán a példányon. Ha a böngésző nincs bejelentkezve a példányba, előbb azt kéri. Utána térjen vissza ide.</string>
|
||||
<string name="mcp_sign_in">Bejelentkezés</string>
|
||||
<string name="notebook_empty">Ennek a jegyzetfüzetnek nincsenek cellái.</string>
|
||||
<string name="notebook_more">További %1$s cella nem jelenik meg.</string>
|
||||
<string name="notebook_cell_cut">Ez a cella hosszabb, mint ami itt látszik.</string>
|
||||
|
||||
@@ -411,6 +411,19 @@
|
||||
<string name="job_failed">Non riusciti</string>
|
||||
<string name="job_cancelled">Annullato</string>
|
||||
<string name="job_expired">Scaduto</string>
|
||||
<string name="mcp_title">Server MCP</string>
|
||||
<string name="mcp_intro">I server i cui strumenti possono essere offerti nelle tue chat. Alcuni si usano con un tuo account presso di loro: i loro strumenti sono offerti finché hai effettuato l’accesso.</string>
|
||||
<string name="mcp_none">Su questa istanza non ti è offerto alcun server MCP.</string>
|
||||
<string name="mcp_ready">Pronto</string>
|
||||
<string name="mcp_signed_in">Accesso effettuato</string>
|
||||
<string name="mcp_signed_out">Accesso non effettuato</string>
|
||||
<string name="mcp_needs_signin">Serve un nuovo accesso</string>
|
||||
<string name="mcp_tools">Strumenti: %1$s</string>
|
||||
<string name="mcp_account">Accesso effettuato come %1$s</string>
|
||||
<string name="mcp_until">Accesso valido fino a %1$s</string>
|
||||
<string name="mcp_shared_note">Questo server ha un accesso condiviso, che viene eseguito da un amministratore.</string>
|
||||
<string name="mcp_browser_note">L’accesso avviene nel browser, sull’istanza stessa. Se il browser non ha effettuato l’accesso all’istanza, prima lo chiede. Poi torna qui.</string>
|
||||
<string name="mcp_sign_in">Accedi</string>
|
||||
<string name="notebook_empty">Questo notebook non ha celle.</string>
|
||||
<string name="notebook_more">Altre %1$s celle non vengono mostrate.</string>
|
||||
<string name="notebook_cell_cut">Questa cella è più lunga di quanto mostrato qui.</string>
|
||||
|
||||
@@ -411,6 +411,19 @@
|
||||
<string name="job_failed">Nieudane</string>
|
||||
<string name="job_cancelled">Anulowane</string>
|
||||
<string name="job_expired">Wygasło</string>
|
||||
<string name="mcp_title">Serwery MCP</string>
|
||||
<string name="mcp_intro">Serwery, których narzędzia mogą być oferowane w Twoich czatach. Niektóre działają z Twoim własnym kontem u nich: ich narzędzia są oferowane, dopóki trwa zalogowanie.</string>
|
||||
<string name="mcp_none">Na tej instancji nie są oferowane żadne serwery MCP.</string>
|
||||
<string name="mcp_ready">Gotowy</string>
|
||||
<string name="mcp_signed_in">Zalogowano</string>
|
||||
<string name="mcp_signed_out">Nie zalogowano</string>
|
||||
<string name="mcp_needs_signin">Wymaga ponownego zalogowania</string>
|
||||
<string name="mcp_tools">Narzędzia: %1$s</string>
|
||||
<string name="mcp_account">Zalogowano jako %1$s</string>
|
||||
<string name="mcp_until">Zalogowano do %1$s</string>
|
||||
<string name="mcp_shared_note">Ten serwer ma jedno wspólne logowanie, które wykonuje administrator.</string>
|
||||
<string name="mcp_browser_note">Logowanie odbywa się w przeglądarce, na samej instancji. Jeśli przeglądarka nie jest zalogowana do instancji, najpierw o to poprosi. Potem wróć tutaj.</string>
|
||||
<string name="mcp_sign_in">Zaloguj się</string>
|
||||
<string name="notebook_empty">Ten notatnik nie ma komórek.</string>
|
||||
<string name="notebook_more">Kolejnych %1$s komórek nie pokazano.</string>
|
||||
<string name="notebook_cell_cut">Ta komórka jest dłuższa, niż tu pokazano.</string>
|
||||
|
||||
@@ -411,6 +411,19 @@
|
||||
<string name="job_failed">Zlyhalo</string>
|
||||
<string name="job_cancelled">Zrušené</string>
|
||||
<string name="job_expired">Vypršalo</string>
|
||||
<string name="mcp_title">Servery MCP</string>
|
||||
<string name="mcp_intro">Servery, ktorých nástroje môžu byť ponúknuté vo vašich chatoch. Niektoré sa používajú s vaším vlastným účtom u nich: ich nástroje sú ponúkané, kým ste prihlásení.</string>
|
||||
<string name="mcp_none">Na tejto inštancii vám nie sú ponúkané žiadne servery MCP.</string>
|
||||
<string name="mcp_ready">Pripravené</string>
|
||||
<string name="mcp_signed_in">Prihlásené</string>
|
||||
<string name="mcp_signed_out">Neprihlásené</string>
|
||||
<string name="mcp_needs_signin">Je potrebné nové prihlásenie</string>
|
||||
<string name="mcp_tools">Nástroje: %1$s</string>
|
||||
<string name="mcp_account">Prihlásené ako %1$s</string>
|
||||
<string name="mcp_until">Prihlásené do %1$s</string>
|
||||
<string name="mcp_shared_note">Tento server má jedno spoločné prihlásenie, ktoré robí správca.</string>
|
||||
<string name="mcp_browser_note">Prihlásenie prebieha v prehliadači, priamo na inštancii. Ak prehliadač nie je do inštancie prihlásený, najprv si to vyžiada. Potom sa vráťte sem.</string>
|
||||
<string name="mcp_sign_in">Prihlásiť sa</string>
|
||||
<string name="notebook_empty">Tento zápisník nemá žiadne bunky.</string>
|
||||
<string name="notebook_more">Ďalších %1$s buniek sa nezobrazuje.</string>
|
||||
<string name="notebook_cell_cut">Táto bunka je dlhšia, než sa tu zobrazuje.</string>
|
||||
|
||||
@@ -413,6 +413,19 @@
|
||||
<string name="job_failed">Failed</string>
|
||||
<string name="job_cancelled">Cancelled</string>
|
||||
<string name="job_expired">Expired</string>
|
||||
<string name="mcp_title">MCP servers</string>
|
||||
<string name="mcp_intro">The servers whose tools your chats may be offered. Some are used with an account of your own there: their tools are offered while you are signed in.</string>
|
||||
<string name="mcp_none">No MCP servers are offered to you on this instance.</string>
|
||||
<string name="mcp_ready">Ready</string>
|
||||
<string name="mcp_signed_in">Signed in</string>
|
||||
<string name="mcp_signed_out">Not signed in</string>
|
||||
<string name="mcp_needs_signin">Needs a new sign-in</string>
|
||||
<string name="mcp_tools">Tools: %1$s</string>
|
||||
<string name="mcp_account">Signed in as %1$s</string>
|
||||
<string name="mcp_until">Signed in until %1$s</string>
|
||||
<string name="mcp_shared_note">This server has one shared sign-in, which an administrator makes.</string>
|
||||
<string name="mcp_browser_note">Signing in happens in the browser, on the instance itself. If the browser is not signed in to the instance, it asks for that first. Come back here afterwards.</string>
|
||||
<string name="mcp_sign_in">Sign in</string>
|
||||
<string name="notebook_empty">This notebook has no cells.</string>
|
||||
<string name="notebook_more">%1$s more cells are not shown.</string>
|
||||
<string name="notebook_cell_cut">This cell is longer than is shown here.</string>
|
||||
|
||||
@@ -10,6 +10,8 @@ import androidx.compose.runtime.Composable
|
||||
import androidx.compose.ui.Modifier
|
||||
import androidx.compose.ui.unit.dp
|
||||
import eu.llembas.android.api.GeneratedMedia
|
||||
import eu.llembas.android.api.McpAuth
|
||||
import eu.llembas.android.api.McpServer
|
||||
import eu.llembas.android.api.MediaJob
|
||||
import eu.llembas.android.api.Message
|
||||
import eu.llembas.android.api.Step
|
||||
@@ -21,13 +23,15 @@ import eu.llembas.android.ui.chat.JobCard
|
||||
import eu.llembas.android.ui.chat.JobSeen
|
||||
import eu.llembas.android.ui.chat.MediaActions
|
||||
import eu.llembas.android.ui.chat.MediaCard
|
||||
import eu.llembas.android.ui.settings.McpContent
|
||||
import eu.llembas.android.ui.settings.McpState
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import org.robolectric.annotation.GraphicsMode
|
||||
|
||||
/** Generated media's cards, and a chat that holds them, each from made-up state. */
|
||||
/** Generated media's cards, a chat that holds them, and Settings › MCP servers, each from made-up state. */
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@GraphicsMode(GraphicsMode.Mode.NATIVE)
|
||||
@Config(sdk = [35], qualifiers = "xhdpi")
|
||||
@@ -114,4 +118,28 @@ class MediaShots {
|
||||
shoot("61-chat-media") { ChatContent(state, object : ChatActions {}, agent = false, media = actions) }
|
||||
shoot("61-chat-media", Phone.Small, fontScale = 1.5f) { ChatContent(state, object : ChatActions {}, agent = false, media = actions) }
|
||||
}
|
||||
|
||||
@Test
|
||||
fun mcpServers() {
|
||||
val servers = listOf(
|
||||
McpServer(id = "mcp1", name = "Tracker", tools = 4, auth = McpAuth(kind = "secret", state = "ready")),
|
||||
McpServer(id = "mcp2", name = "Mail", tools = 7, auth = McpAuth(kind = "oauth", state = "signed_in", account = "frodo@example.org", renews = true)),
|
||||
McpServer(
|
||||
id = "mcp3",
|
||||
name = "Notes of the long expedition",
|
||||
tools = 3,
|
||||
auth = McpAuth(kind = "oauth", state = "signed_out", signinUrl = "https://lembas.example.org/settings/mcp/mcp3/sign-in"),
|
||||
),
|
||||
McpServer(id = "mcp4", name = "Wiki", tools = 2, auth = McpAuth(kind = "oauth", state = "needs_signin", shared = true)),
|
||||
McpServer(
|
||||
id = "mcp5",
|
||||
name = "Calendar",
|
||||
tools = 5,
|
||||
auth = McpAuth(kind = "oauth", state = "signed_in", account = "frodo", expiresAt = "2026-03-10T08:00:00+00:00"),
|
||||
),
|
||||
)
|
||||
shoot("62-mcp", Phone.Scroll) { McpContent(McpState(servers, loading = false)) }
|
||||
shoot("62-mcp", Phone.SmallScroll, fontScale = 1.5f) { McpContent(McpState(servers, loading = false)) }
|
||||
shoot("62-mcp-none") { McpContent(McpState(loading = false)) }
|
||||
}
|
||||
}
|
||||
@@ -438,6 +438,20 @@ STRINGS: dict[str, str] = {
|
||||
"job_failed": "Failed",
|
||||
"job_cancelled": "Cancelled",
|
||||
"job_expired": "Expired",
|
||||
# Settings › MCP servers
|
||||
"mcp_title": "MCP servers",
|
||||
"mcp_intro": "The servers whose tools your chats may be offered. Some are used with an account of your own there: their tools are offered while you are signed in.",
|
||||
"mcp_none": "No MCP servers are offered to you on this instance.",
|
||||
"mcp_ready": "Ready",
|
||||
"mcp_signed_in": "Signed in",
|
||||
"mcp_signed_out": "Not signed in",
|
||||
"mcp_needs_signin": "Needs a new sign-in",
|
||||
"mcp_tools": "Tools: %1$s",
|
||||
"mcp_account": "Signed in as %1$s",
|
||||
"mcp_until": "Signed in until %1$s",
|
||||
"mcp_shared_note": "This server has one shared sign-in, which an administrator makes.",
|
||||
"mcp_browser_note": "Signing in happens in the browser, on the instance itself. If the browser is not signed in to the instance, it asks for that first. Come back here afterwards.",
|
||||
"mcp_sign_in": "Sign in",
|
||||
"notebook_empty": "This notebook has no cells.",
|
||||
"notebook_more": "%1$s more cells are not shown.",
|
||||
"notebook_cell_cut": "This cell is longer than is shown here.",
|
||||
|
||||
@@ -411,7 +411,17 @@
|
||||
"widget_hint": "Zeptejte se na cokoli",
|
||||
"widget_speak": "Mluvit",
|
||||
"media_model": "3D model",
|
||||
"job_expired": "Vypršelo"
|
||||
"job_expired": "Vypršelo",
|
||||
"mcp_intro": "Servery, jejichž nástroje mohou být nabídnuty ve vašich chatech. Některé se používají s vaším vlastním účtem u nich: jejich nástroje jsou nabízeny, dokud jste přihlášeni.",
|
||||
"mcp_none": "Na této instanci vám nejsou nabízeny žádné servery MCP.",
|
||||
"mcp_ready": "Připraveno",
|
||||
"mcp_signed_in": "Přihlášeno",
|
||||
"mcp_signed_out": "Nepřihlášeno",
|
||||
"mcp_needs_signin": "Je potřeba nové přihlášení",
|
||||
"mcp_tools": "Nástroje: %1$s",
|
||||
"mcp_account": "Přihlášeno jako %1$s",
|
||||
"mcp_until": "Přihlášeno do %1$s",
|
||||
"mcp_browser_note": "Přihlášení probíhá v prohlížeči, přímo na instanci. Pokud prohlížeč není k instanci přihlášen, nejprve si to vyžádá. Potom se vraťte sem."
|
||||
},
|
||||
"de": {
|
||||
"about_version": "LLeMbas für Android %1$s",
|
||||
@@ -826,7 +836,17 @@
|
||||
"widget_hint": "Frag mich alles",
|
||||
"widget_speak": "Sprechen",
|
||||
"media_model": "3D-Modell",
|
||||
"job_expired": "Abgelaufen"
|
||||
"job_expired": "Abgelaufen",
|
||||
"mcp_intro": "Die Server, deren Werkzeuge in den eigenen Chats angeboten werden können. Manche werden mit einem eigenen Konto dort genutzt: Deren Werkzeuge werden angeboten, solange die Anmeldung besteht.",
|
||||
"mcp_none": "Auf dieser Instanz werden keine MCP-Server angeboten.",
|
||||
"mcp_ready": "Bereit",
|
||||
"mcp_signed_in": "Angemeldet",
|
||||
"mcp_signed_out": "Nicht angemeldet",
|
||||
"mcp_needs_signin": "Neue Anmeldung nötig",
|
||||
"mcp_tools": "Werkzeuge: %1$s",
|
||||
"mcp_account": "Angemeldet als %1$s",
|
||||
"mcp_until": "Angemeldet bis %1$s",
|
||||
"mcp_browser_note": "Die Anmeldung geschieht im Browser, auf der Instanz selbst. Ist der Browser dort nicht angemeldet, wird zuerst danach gefragt. Danach hierher zurückkehren."
|
||||
},
|
||||
"es": {
|
||||
"about_version": "LLeMbas para Android %1$s",
|
||||
@@ -1240,7 +1260,17 @@
|
||||
"widget_hint": "Pregunta lo que quieras",
|
||||
"widget_speak": "Hablar",
|
||||
"media_model": "Modelo 3D",
|
||||
"job_expired": "Caducado"
|
||||
"job_expired": "Caducado",
|
||||
"mcp_intro": "Los servidores cuyas herramientas pueden ofrecerse en sus chats. Algunos se usan con una cuenta propia en ellos: sus herramientas se ofrecen mientras la sesión esté iniciada.",
|
||||
"mcp_none": "En esta instancia no se le ofrece ningún servidor MCP.",
|
||||
"mcp_ready": "Listo",
|
||||
"mcp_signed_in": "Sesión iniciada",
|
||||
"mcp_signed_out": "Sin sesión iniciada",
|
||||
"mcp_needs_signin": "Hace falta iniciar sesión de nuevo",
|
||||
"mcp_tools": "Herramientas: %1$s",
|
||||
"mcp_account": "Sesión iniciada como %1$s",
|
||||
"mcp_until": "Sesión iniciada hasta %1$s",
|
||||
"mcp_browser_note": "El inicio de sesión se hace en el navegador, en la propia instancia. Si el navegador no tiene la sesión iniciada en la instancia, primero la pide. Después, vuelva aquí."
|
||||
},
|
||||
"fr": {
|
||||
"about_version": "LLeMbas pour Android %1$s",
|
||||
@@ -1655,7 +1685,17 @@
|
||||
"widget_hint": "Posez une question",
|
||||
"widget_speak": "Parler",
|
||||
"media_model": "Modèle 3D",
|
||||
"job_expired": "Expiré"
|
||||
"job_expired": "Expiré",
|
||||
"mcp_intro": "Les serveurs dont les outils peuvent être proposés dans vos discussions. Certains s’utilisent avec un compte à vous chez eux : leurs outils sont proposés tant que vous y êtes connecté.",
|
||||
"mcp_none": "Aucun serveur MCP ne vous est proposé sur cette instance.",
|
||||
"mcp_ready": "Prêt",
|
||||
"mcp_signed_in": "Connecté",
|
||||
"mcp_signed_out": "Non connecté",
|
||||
"mcp_needs_signin": "Nouvelle connexion nécessaire",
|
||||
"mcp_tools": "Outils : %1$s",
|
||||
"mcp_account": "Connecté en tant que %1$s",
|
||||
"mcp_until": "Connecté jusqu’au %1$s",
|
||||
"mcp_browser_note": "La connexion se fait dans le navigateur, sur l’instance elle-même. Si le navigateur n’y est pas connecté, il le demande d’abord. Revenez ensuite ici."
|
||||
},
|
||||
"hu": {
|
||||
"about_version": "LLeMbas Androidra %1$s",
|
||||
@@ -2070,7 +2110,17 @@
|
||||
"widget_hint": "Kérdezz bármit",
|
||||
"widget_speak": "Beszéd",
|
||||
"media_model": "3D-modell",
|
||||
"job_expired": "Lejárt"
|
||||
"job_expired": "Lejárt",
|
||||
"mcp_intro": "Azok a szerverek, amelyek eszközei felkínálhatók a csevegéseiben. Némelyik az ottani saját fiókjával használható: az eszközeik addig érhetők el, amíg be van jelentkezve.",
|
||||
"mcp_none": "Ezen a példányon nincs Önnek felkínált MCP-szerver.",
|
||||
"mcp_ready": "Kész",
|
||||
"mcp_signed_in": "Bejelentkezve",
|
||||
"mcp_signed_out": "Nincs bejelentkezve",
|
||||
"mcp_needs_signin": "Új bejelentkezés szükséges",
|
||||
"mcp_tools": "Eszközök: %1$s",
|
||||
"mcp_account": "Bejelentkezve mint %1$s",
|
||||
"mcp_until": "Bejelentkezve eddig: %1$s",
|
||||
"mcp_browser_note": "A bejelentkezés a böngészőben történik, magán a példányon. Ha a böngésző nincs bejelentkezve a példányba, előbb azt kéri. Utána térjen vissza ide."
|
||||
},
|
||||
"it": {
|
||||
"about_version": "LLeMbas per Android %1$s",
|
||||
@@ -2484,7 +2534,17 @@
|
||||
"widget_hint": "Chiedi qualsiasi cosa",
|
||||
"widget_speak": "Parla",
|
||||
"media_model": "Modello 3D",
|
||||
"job_expired": "Scaduto"
|
||||
"job_expired": "Scaduto",
|
||||
"mcp_intro": "I server i cui strumenti possono essere offerti nelle tue chat. Alcuni si usano con un tuo account presso di loro: i loro strumenti sono offerti finché hai effettuato l’accesso.",
|
||||
"mcp_none": "Su questa istanza non ti è offerto alcun server MCP.",
|
||||
"mcp_ready": "Pronto",
|
||||
"mcp_signed_in": "Accesso effettuato",
|
||||
"mcp_signed_out": "Accesso non effettuato",
|
||||
"mcp_needs_signin": "Serve un nuovo accesso",
|
||||
"mcp_tools": "Strumenti: %1$s",
|
||||
"mcp_account": "Accesso effettuato come %1$s",
|
||||
"mcp_until": "Accesso valido fino a %1$s",
|
||||
"mcp_browser_note": "L’accesso avviene nel browser, sull’istanza stessa. Se il browser non ha effettuato l’accesso all’istanza, prima lo chiede. Poi torna qui."
|
||||
},
|
||||
"pl": {
|
||||
"about_version": "LLeMbas na Androida %1$s",
|
||||
@@ -2898,7 +2958,17 @@
|
||||
"widget_hint": "Zapytaj o cokolwiek",
|
||||
"widget_speak": "Mów",
|
||||
"media_model": "Model 3D",
|
||||
"job_expired": "Wygasło"
|
||||
"job_expired": "Wygasło",
|
||||
"mcp_intro": "Serwery, których narzędzia mogą być oferowane w Twoich czatach. Niektóre działają z Twoim własnym kontem u nich: ich narzędzia są oferowane, dopóki trwa zalogowanie.",
|
||||
"mcp_none": "Na tej instancji nie są oferowane żadne serwery MCP.",
|
||||
"mcp_ready": "Gotowy",
|
||||
"mcp_signed_in": "Zalogowano",
|
||||
"mcp_signed_out": "Nie zalogowano",
|
||||
"mcp_needs_signin": "Wymaga ponownego zalogowania",
|
||||
"mcp_tools": "Narzędzia: %1$s",
|
||||
"mcp_account": "Zalogowano jako %1$s",
|
||||
"mcp_until": "Zalogowano do %1$s",
|
||||
"mcp_browser_note": "Logowanie odbywa się w przeglądarce, na samej instancji. Jeśli przeglądarka nie jest zalogowana do instancji, najpierw o to poprosi. Potem wróć tutaj."
|
||||
},
|
||||
"sk": {
|
||||
"about_version": "LLeMbas pre Android %1$s",
|
||||
@@ -3312,6 +3382,16 @@
|
||||
"widget_hint": "Opýtajte sa na čokoľvek",
|
||||
"widget_speak": "Hovoriť",
|
||||
"media_model": "3D model",
|
||||
"job_expired": "Vypršalo"
|
||||
"job_expired": "Vypršalo",
|
||||
"mcp_intro": "Servery, ktorých nástroje môžu byť ponúknuté vo vašich chatoch. Niektoré sa používajú s vaším vlastným účtom u nich: ich nástroje sú ponúkané, kým ste prihlásení.",
|
||||
"mcp_none": "Na tejto inštancii vám nie sú ponúkané žiadne servery MCP.",
|
||||
"mcp_ready": "Pripravené",
|
||||
"mcp_signed_in": "Prihlásené",
|
||||
"mcp_signed_out": "Neprihlásené",
|
||||
"mcp_needs_signin": "Je potrebné nové prihlásenie",
|
||||
"mcp_tools": "Nástroje: %1$s",
|
||||
"mcp_account": "Prihlásené ako %1$s",
|
||||
"mcp_until": "Prihlásené do %1$s",
|
||||
"mcp_browser_note": "Prihlásenie prebieha v prehliadači, priamo na inštancii. Ak prehliadač nie je do inštancie prihlásený, najprv si to vyžiada. Potom sa vráťte sem."
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user