I wrote a previous post about how to develop an MCP Server using the Kotlin MCP SDK. That was primarily based on local deployment (using stdio protocol)…a setup that Claude Desktop for example could only support at the time. With the announcement that Claude now supports access to remote MCP Servers (from desktop and mobile) I thought I’d take a look at deploying the MCP Server in the ClimateTraceKMP sample to Google Cloud Run.

The first thing we need to do is create a Google Cloud project that we can deploy our server to (using Cloud Run)….something we can do for example using the Cloud Resource Manager. In our case we created climatetrace-mcp and we set that as the active gcloud project as follows.

gcloud config set project climatetrace-mcp

Before we can run our server on Cloud Run we need to build the code, package as a container and deploy that container to Artifact Registry. We do that using the Jib Gradle Plugin as shown below.

libs.version.toml

1
2
3
4
5
6
7
8
[versions]
...
jib = "3.4.5"


[plugins]
...
jib = { id = "com.google.cloud.tools.jib", version.ref = "jib" }

build.gradle.kts

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
plugins {
    ...
    alias(libs.plugins.jib)
}

...

jib {
    from.image = "docker.io/library/eclipse-temurin:21"

    to {
        image = "gcr.io/climatetrace-mcp/climatetrace-mcp-server"
    }
    container {
        ports = listOf("8080")
        mainClass = "McpServerKt"
    }
}

We run the jib gradle task then which will create and deploy the container image.

./gradlew :mcp-server:jib

Note the following is what the container is configured to run (this makes use of the mcp Ktor extension function from the Kotlin MCP SDK which sets up the required SSE support).

McpServer.kt

fun main() {
    val server = configureMcpServer()

    val port = System.getenv().getOrDefault("PORT", "8080").toInt()
    embeddedServer(CIO, port, host = "0.0.0.0") {
        mcp {
            server
        }
    }.start(wait = true)
}


And finally we can deploy that container to Cloud Run using the following command.

gcloud run deploy climatetrace-mcp --image=gcr.io/climatetrace-mcp/climatetrace-mcp-server

We can now configure Claude Desktop for example to use our deployed MCP Server. Claude Deskop

And now, with that server configured, we can also access from the Claude mobile apps.

Claude Mobile

We can also interact with the server using MCP Inspector. MCP Inspector

The code shown here is part of the mcp-server module in the ClimateTraceKMP repository.