Weather Java SSE Transport MCP Service

Weather Java SSE Transport MCP Service

By stantonk GitHub

Java Model Context Protocol SSE HTTP Server with Jetty

java ai
Overview

What is Weather Java SSE Transport MCP Service?

Weather Java SSE Transport MCP Service is a Java-based implementation of the Model Context Protocol (MCP) that demonstrates how to build a working end-to-end solution for weather data retrieval using Server-Sent Events (SSE).

How to use Weather Java SSE Transport MCP Service?

To use the service, you need to build and start the Weather MCP Server using Maven, and then install and configure the fast-agent to interact with the server. You can send messages to the server to retrieve weather forecasts for different cities.

Key features of Weather Java SSE Transport MCP Service?

  • Demonstrates interaction with multiple MCP servers (local and remote)
  • Uses Claude Sonnet 3.7 for LLM capabilities
  • Fetches geographical data and weather forecasts based on user input
  • Provides a simple setup without heavy dependencies like Spring

Use cases of Weather Java SSE Transport MCP Service?

  1. Retrieving weather forecasts for multiple cities based on user queries.
  2. Demonstrating the capabilities of the Model Context Protocol in a practical application.
  3. Integrating with other MCP servers for enhanced functionality.

FAQ from Weather Java SSE Transport MCP Service?

  • Is this service production-ready?

No, this is a demonstration project and not intended for production use.

  • What technologies are used in this project?

The project is built using Java and Jetty, and it utilizes the Model Context Protocol.

  • How can I contribute to this project?

You can contribute by forking the repository and submitting pull requests with improvements or additional features.

Content

Weather Java SSE Transport MCP Service

A working implementation Model Context Protocol java-sdk. Includes a fast-agent for the MCP Client to interact with the Weather mcp-server.

⚠️This isn't remotely production grade, just demonstrating how to build something working end to end that can leverage multiple MCP Servers both local (Stdio Transport) and remote (HTTP SSE Transport). Also avoids pulling in as much of Spring as possible, for those who don't want it.

In the demo, you'll see the agent:

  1. The agent uses Claude Sonnet 3.7 throughout for the LLM bits
  2. The agent calls out to the "fetch" websearch MCP Server tool to look up lat/long for each city I asked for.
  3. The agent then uses those lat/long values to call the weather MCP Server tool (implemented in this repository). You can see the calls being made in the upper half of the terminal split window.
  4. The agent summarizes the forecasts and determine which of the 4 cities is the warmest tomorrow.

The agent is figuring out which tools to call from the context of the user's inputted prompts.

Description of image

build and start Weather MCP Server

mvn clean package
java -jar java -jar mcp-server/target/mcp-server-1.0-SNAPSHOT.jar

install, configure, and start fast-agent

install

pip install uv
uv pip install fast-agent-mcp
uv run agent.py

Configure Claude and OpenAI api keys

cp fastagent.secrets.yaml.TEMPLATE fastagent.secrets.yaml

then add your api keys to that config file.

Note: Weather MCP Server config

Note, in fastagent.config.yaml we've configured the MCP Servers available to the agent, in this case our server uses the SSE HTTP Transport, this enables calling remote MCP Servers :).

mcp:
    servers:
        weather:
            transport: "sse"
            read_timeout_seconds: 10
            url: "http://localhost:8080/sse"

Lower level for testing

Connect to SSE stream

curl -v -H "Accept: text/event-stream" "http://localhost:8080/sse"

Send messages to /mcp/messages (note, include sessionId from SSE)

curl -X POST "http://localhost:8080/mcp/message?sessionId=b64ad193-6bb3-4e2e-b33c-27a23011acb4" -d '{"hi": "mynameis"}' | jq .

Things to check out:

No tools information available.

A Model Context Protocol server for integrating HackMD's note-taking platform with AI assistants.

YouTube MCP Server
YouTube MCP Server by IA-Programming

YouTube MCP Server is an AI-powered solution designed to revolutionize your YouTube experience. It empowers users to search for YouTube videos, retrieve detailed transcripts, and perform semantic searches over video content—all without relying on the official API. By integrating with a vector database, this server streamlines content discovery.

youtube ai
View Details
JADX-AI-MCP
JADX-AI-MCP by zinja-coder

Plugin for JADX to integrate MCP server

java mobile
View Details

MCP Deep Research Server using Gemini creating a Research AI Agent

research ai
View Details
MCP-Mealprep
MCP-Mealprep by JoshuaRL

This project takes a number of MCP servers from GitHub locations, packages them together with this repo's GHCR container, and launches them with docker-compose to run as a stack for ML/AI resources.

docker ai
View Details

BioMCP: Biomedical Model Context Protocol

bioinformatics ai
View Details
MySQL MCP Server
MySQL MCP Server by designcomputer

A Model Context Protocol (MCP) server that enables secure interaction with MySQL databases