kotlin-sdk/samples/weather-stdio-server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Pavel Gorgulov 0b39f57cff
docs: streamable server sample (#595)
- add a simple streamable http server example with auth
- update readme: replace quickstart example from sse server to
streamable server
- add readme files for samples, simple-streamable-server, notebooks

closes #170 

## How Has This Been Tested?
knit and inspector

## Breaking Changes
NaN

## Types of changes
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)
- [x] Documentation update

## Checklist
- [x] I have read the [MCP
Documentation](https://modelcontextprotocol.io)
- [x] My code follows the repository's style guidelines
- [x] New and existing tests pass locally
- [ ] I have added appropriate error handling
- [x] I have added or updated documentation as needed
2026-03-10 12:45:21 +01:00
..
gradle Bump gradle-wrapper from 9.3.0 to 9.3.1 (#523) 2026-02-16 10:31:59 +02:00
src Upgrade SDK to 0.8.0 in Weather STDIO server sample (#428) 2025-11-27 18:35:47 +02:00
build.gradle.kts Add Ktor BOM for dependency management across all modules, run Kotlin-MCP-Server Sample (#367) 2025-11-04 11:44:39 +02:00
gradle.properties #302 Update samples build workflow (#330) 2025-10-23 13:02:22 +03:00
gradlew #302 Update samples build workflow (#330) 2025-10-23 13:02:22 +03:00
gradlew.bat #302 Update samples build workflow (#330) 2025-10-23 13:02:22 +03:00
README.md docs: streamable server sample (#595) 2026-03-10 12:45:21 +01:00
settings.gradle.kts #302 Update samples build workflow (#330) 2025-10-23 13:02:22 +03:00

Weather STDIO Server

A minimal MCP server that exposes weather forecast and alert tools using the National Weather Service API over STDIO transport.

Overview

This sample shows how to build a STDIO-based MCP server in Kotlin. It registers two tools that query the weather.gov API — one for weather forecasts by latitude/longitude and one for active alerts by US state. Because it uses STDIO, the server is launched as a subprocess by an MCP client or a desktop application like Claude Desktop.

Prerequisites

  • JDK 17+
  • Internet access (the server calls the weather.gov API at runtime)

Build & Run

Run the server (it communicates via stdin/stdout):

./gradlew run

MCP Inspector

Build the fat JAR first, then connect with the MCP Inspector:

./gradlew build
npx @modelcontextprotocol/inspector -- java -jar samples/weather-stdio-server/build/libs/weather-stdio-server-0.1.0-all.jar

Claude Desktop integration

Add the following to your Claude Desktop configuration:

{
    "mcpServers": {
        "weather": {
            "command": "java",
            "args": [
                "-jar",
                "/absolute/path/to/samples/weather-stdio-server/build/libs/weather-stdio-server-0.1.0-all.jar"
            ]
        }
    }
}

MCP Capabilities

Tools

Name Description
get_forecast Returns weather forecast for a given latitude / longitude using the weather.gov API.
get_alerts Returns active weather alerts for a two-letter US state code (e.g. CA, NY).

Additional Resources