Skip to content

Commit d74043c

Browse files
committed
Merge remote-tracking branch 'origin/main' into native_image
# Conflicts: # mcp-server/build.gradle.kts # mcp-server/src/main/kotlin/McpServer.kt
2 parents f0e7e3c + c11285e commit d74043c

File tree

5 files changed

+33
-31
lines changed

5 files changed

+33
-31
lines changed

.github/workflows/ios.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
java-version: 21
2020

2121
- name: Build iOS app
22-
run: xcodebuild -allowProvisioningUpdates -allowProvisioningUpdates -workspace iosApp/iosApp.xcodeproj/project.xcworkspace -configuration Debug -scheme iosApp -sdk iphoneos -destination name='iPhone 15'
22+
run: xcodebuild -allowProvisioningUpdates -allowProvisioningUpdates -workspace iosApp/iosApp.xcodeproj/project.xcworkspace -configuration Debug -scheme iosApp -sdk iphoneos -destination name='iPhone 16'
2323

2424

2525

composeApp/src/jvmMain/kotlin/dev/johnoreilly/climatetrace/di/Koin.desktop.kt

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import dev.johnoreilly.climatetrace.remote.Country
44
import io.github.xxfast.kstore.KStore
55
import io.github.xxfast.kstore.file.storeOf
66
import kotlinx.io.files.Path
7+
import kotlinx.io.files.SystemFileSystem
78
import net.harawata.appdirs.AppDirsFactory
89
import org.koin.core.module.Module
910
import org.koin.dsl.module
@@ -15,7 +16,9 @@ private const val AUTHOR = "johnoreilly"
1516
actual fun dataModule(): Module = module {
1617
single<KStore<List<Country>>> {
1718
val filesDir: String = AppDirsFactory.getInstance()
18-
.getUserDataDir(PACKAGE_NAME, VERSION, AUTHOR)
19+
.getUserCacheDir(PACKAGE_NAME, VERSION, AUTHOR)
20+
val files = Path(filesDir)
21+
with(SystemFileSystem) { if(!exists(files)) createDirectories(files) }
1922
storeOf(file = Path(path = "$filesDir/countries.json"), default = emptyList())
2023
}
2124
}

mcp-server/build.gradle.kts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
plugins {
44
alias(libs.plugins.kotlinJvm)
55
alias(libs.plugins.kotlinx.serialization)
6+
alias(libs.plugins.jib)
67
application
78
id("org.graalvm.buildtools.native") version "0.11.0"
89
}
@@ -17,13 +18,11 @@ dependencies {
1718
java {
1819
toolchain {
1920
languageVersion.set(JavaLanguageVersion.of(24))
20-
vendor.set(JvmVendorSpec.GRAAL_VM)
21-
nativeImageCapable.set(true)
2221
}
2322
}
2423

2524
application {
26-
mainClass = "MainKt"
25+
mainClass = "McpServerKt"
2726
}
2827

2928
graalvmNative {
@@ -46,3 +45,14 @@ graalvmNative {
4645
}
4746
}
4847

48+
jib {
49+
from.image = "docker.io/library/eclipse-temurin:21"
50+
51+
to {
52+
image = "gcr.io/climatetrace-mcp/climatetrace-mcp-server"
53+
}
54+
container {
55+
ports = listOf("8080")
56+
mainClass = "McpServerKt"
57+
}
58+
}

mcp-server/src/main/kotlin/McpServer.kt

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,23 @@ import kotlinx.serialization.json.jsonPrimitive
1616
import kotlinx.serialization.json.putJsonObject
1717

1818

19-
private val koin = initKoin(enableNetworkLogs = true).koin
2019

2120

21+
fun main(args: Array<String>) {
22+
val command = args.firstOrNull() ?: "--sse-server"
23+
val port = args.getOrNull(1)?.toIntOrNull() ?: 8080
24+
when (command) {
25+
"--sse-server" -> `run sse mcp server`(port)
26+
"--stdio" -> `run mcp server using stdio`()
27+
else -> {
28+
System.err.println("Unknown command: $command")
29+
}
30+
}
31+
}
32+
33+
34+
private val koin = initKoin(enableNetworkLogs = true).koin
35+
2236
fun configureMcpServer(): Server {
2337
val climateTraceRepository = koin.get<ClimateTraceRepository>()
2438

@@ -67,7 +81,6 @@ fun configureMcpServer(): Server {
6781
content = listOf(TextContent("The 'countryCodeList' parameters are required."))
6882
)
6983
}
70-
7184
val countryAssetEmissionInfo = climateTraceRepository.fetchCountryAssetEmissionsInfo(
7285
countryCodeList = countryCodeList
7386
.jsonArray

mcp-server/src/main/kotlin/main.kt

Lines changed: 0 additions & 24 deletions
This file was deleted.

0 commit comments

Comments
 (0)