Skip to content

Commit d2a814a

Browse files
committed
update mcp-demo to Compose Material 3 and bump dependencies
1 parent da1833b commit d2a814a

File tree

4 files changed

+21
-22
lines changed

4 files changed

+21
-22
lines changed

projects/mcp/mcp-demo/composeApp/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ kotlin {
1515
commonMain.dependencies {
1616
implementation(compose.runtime)
1717
implementation(compose.foundation)
18-
implementation(compose.material)
18+
implementation(compose.material3)
1919
implementation(compose.ui)
2020
implementation(compose.components.resources)
2121
implementation(compose.components.uiToolingPreview)

projects/mcp/mcp-demo/composeApp/src/desktopMain/kotlin/io/github/devcrocod/App.kt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import androidx.compose.foundation.lazy.items
77
import androidx.compose.foundation.lazy.rememberLazyListState
88
import androidx.compose.foundation.shape.CircleShape
99
import androidx.compose.foundation.shape.RoundedCornerShape
10-
import androidx.compose.material.*
11-
import androidx.compose.material.icons.Icons
12-
import androidx.compose.material.icons.automirrored.filled.Send
10+
import androidx.compose.material3.*
1311
import androidx.compose.runtime.*
1412
import androidx.compose.ui.Alignment
1513
import androidx.compose.ui.Modifier
@@ -43,6 +41,7 @@ private fun getCurrentTime(): String {
4341
return String.format("%02d:%02d", now.hour, now.minute)
4442
}
4543

44+
@OptIn(ExperimentalMaterial3Api::class)
4645
@Composable
4746
@Preview
4847
fun App() {
@@ -78,9 +77,8 @@ fun App() {
7877
}
7978

8079
MaterialTheme(
81-
colors = MaterialTheme.colors.copy(
80+
colorScheme = MaterialTheme.colorScheme.copy(
8281
primary = DarkBlue,
83-
primaryVariant = LightBlue,
8482
secondary = LightBlue,
8583
background = Color.White,
8684
surface = Color.White
@@ -112,8 +110,9 @@ fun App() {
112110
)
113111
}
114112
},
115-
backgroundColor = Color.White,
116-
elevation = 4.dp
113+
colors = TopAppBarDefaults.topAppBarColors(
114+
containerColor = Color.White
115+
)
117116
)
118117
},
119118
content = { padding ->
@@ -162,7 +161,7 @@ fun App() {
162161
// Input field and send button
163162
Card(
164163
modifier = Modifier.fillMaxWidth(),
165-
elevation = 8.dp
164+
elevation = CardDefaults.cardElevation(defaultElevation = 8.dp)
166165
) {
167166
Row(
168167
modifier = Modifier
@@ -188,7 +187,7 @@ fun App() {
188187
placeholder = { Text("Enter your query...") },
189188
enabled = !isLoading,
190189
shape = RoundedCornerShape(24.dp),
191-
colors = TextFieldDefaults.outlinedTextFieldColors(
190+
colors = OutlinedTextFieldDefaults.colors(
192191
focusedBorderColor = DarkBlue,
193192
unfocusedBorderColor = Color.LightGray
194193
),
@@ -211,10 +210,10 @@ fun App() {
211210
.clip(CircleShape)
212211
.background(if (query.isNotBlank()) DarkBlue else Color.LightGray)
213212
) {
214-
Icon(
215-
imageVector = Icons.AutoMirrored.Filled.Send,
216-
contentDescription = "Send",
217-
tint = Color.White
213+
Text(
214+
text = "Send",
215+
color = Color.White,
216+
fontWeight = FontWeight.Bold
218217
)
219218
}
220219
}

projects/mcp/mcp-demo/composeApp/src/desktopMain/kotlin/io/github/devcrocod/MCPClient.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class MCPClient : AutoCloseable {
5959
lateinit var availableTools: List<ChatCompletionTool>
6060

6161
// Configures using the `OPENAI_API_KEY`, `OPENAI_ORG_ID` and `OPENAI_PROJECT_ID` environment variables
62-
var openAiClient: OpenAIClient = OpenAIOkHttpClient.fromEnv()
62+
val openAiClient: OpenAIClient = OpenAIOkHttpClient.fromEnv()
6363

6464
val serverVersion: Implementation
6565
get() = mcpClient.serverVersion ?: error("Server version is not available")

projects/mcp/mcp-demo/gradle/libs.versions.toml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
[versions]
2-
androidx-lifecycle = "2.8.4"
3-
compose-multiplatform = "1.7.3"
2+
androidx-lifecycle = "2.9.0"
3+
compose-multiplatform = "1.8.1"
44
junit = "4.13.2"
5-
kotlin = "2.1.20"
6-
kotlinx-coroutines = "1.10.1"
7-
mcp = "0.4.0"
8-
slf4j = "2.0.9"
5+
kotlin = "2.1.21"
6+
kotlinx-coroutines = "1.10.2"
7+
mcp = "0.5.0"
8+
slf4j = "2.0.17"
99
ktor = "3.1.1"
1010
shadow = "8.1.1"
11-
openai = "0.44.3"
11+
openai = "2.2.0"
1212

1313
[libraries]
1414
kotlin-test = { module = "org.jetbrains.kotlin:kotlin-test", version.ref = "kotlin" }

0 commit comments

Comments
 (0)