File tree Expand file tree Collapse file tree 5 files changed +33
-31
lines changed
composeApp/src/jvmMain/kotlin/dev/johnoreilly/climatetrace/di Expand file tree Collapse file tree 5 files changed +33
-31
lines changed Original file line number Diff line number Diff line change 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
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import dev.johnoreilly.climatetrace.remote.Country
44import io.github.xxfast.kstore.KStore
55import io.github.xxfast.kstore.file.storeOf
66import kotlinx.io.files.Path
7+ import kotlinx.io.files.SystemFileSystem
78import net.harawata.appdirs.AppDirsFactory
89import org.koin.core.module.Module
910import org.koin.dsl.module
@@ -15,7 +16,9 @@ private const val AUTHOR = "johnoreilly"
1516actual 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}
Original file line number Diff line number Diff line change 33plugins {
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 {
1718java {
1819 toolchain {
1920 languageVersion.set(JavaLanguageVersion .of(24 ))
20- vendor.set(JvmVendorSpec .GRAAL_VM )
21- nativeImageCapable.set(true )
2221 }
2322}
2423
2524application {
26- mainClass = " MainKt "
25+ mainClass = " McpServerKt "
2726}
2827
2928graalvmNative {
@@ -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+ }
Original file line number Diff line number Diff line change @@ -16,9 +16,23 @@ import kotlinx.serialization.json.jsonPrimitive
1616import 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+
2236fun 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
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments