ClimateTraceKMP

kotlin-version

Kotlin/Compose Multiplatform project to show climate related emission data from https://climatetrace.org/data.

Running on

  • iOS (SwiftUI + shared Compose Multiplatform UI)
  • Android
  • Desktop
  • Web (Wasm)
  • Kotlin Notebook
  • MCP Server
  • AI Agents (Koog + Google ADK)

The iOS client as mentioned includes shared Compose Multiplatform UI code. It also includes option to use either SwiftUI or Compose code for the Country List screen (in both cases selecting a country will navigate to shared Compose emissions details screen).

Related posts:

Project structure

  • composeApp - shared Kotlin Multiplatform code (data layer, view models and Compose Multiplatform UI) along with desktop and web entry points
  • androidApp - Android app
  • iosApp - iOS app (SwiftUI + shared Compose UI)
  • mcp-server - MCP server that exposes emissions data as MCP tools (using the Kotlin MCP SDK)
  • agents - Kotlin based AI agent built using Google's Agent Development Kit (ADK)

Uses, amongst other things, Ktor, Koin, kstore, Voyager, KoalaPlot and Koog.

Building and running

  • Android: open the project in Android Studio, or run ./gradlew :androidApp:installDebug
  • iOS: open iosApp/iosApp.xcodeproj in Xcode and run
  • Desktop: ./gradlew :composeApp:run
  • Web (Wasm): ./gradlew :composeApp:wasmJsBrowserDevelopmentRun
  • MCP server: ./gradlew :mcp-server:shadowJar (see MCP Server section below)
  • ADK agent Dev UI: ./gradlew :agents:startDevUI

Android (Compose)

iOS (SwiftUI/Compose)

Compose for Desktop

Compose for Web (Wasm)

Kotlin Notebook

See ClimateTrace.ipynb

MCP Server

The mcp-server module uses the Kotlin MCP SDK to expose an MCP tools endpoint (returning per country emission data) that can for example be plugged in to Claude Desktop as shown below. That module uses same KMP shared code.

To integrate the MCP server with Claude Desktop for example you need to firstly run gradle shadowJar task and then select "Edit Config" under Developer Settings and add something like the following (update with your path)

{
  "mcpServers": {
    "climatetrace": {
      "command": "java",
      "args": [
        "-jar",
        "/path/to/ClimateTraceKMP/mcp-server/build/libs/serverAll.jar",
        "--stdio"
      ]
    }
  }
}

AI Agents

The app includes an Agents screen, built using Koog, that allows querying emissions data using an LLM based agent.

The agents module also includes a Kotlin based agent built using Google's Agent Development Kit (ADK), making use of the same shared KMP code to provide emissions data as a tool. Its dev UI can be run using ./gradlew :agents:startDevUI.

Full set of Kotlin Multiplatform/Compose/SwiftUI samples