mcp -java-sse-http-demo
Java Model Context Protocol SSE HTTP Server with Jetty
claude mcp add --transport stdio stantonk-mcp-server-java-sse-http-demo java -jar mcp-server/target/mcp-server-1.0-SNAPSHOT.jar \ --env JAVA_HEAP="Optional: set if needed (e.g., -Xmx1g)" \ --env MCP_LOG_LEVEL="Optional: log verbosity"
How to use
This MCP server implements a Weather service using the Java SSE HTTP transport. It demonstrates end-to-end model context usage where a local weather MCP tool can be invoked via a remote SSE transport, enabling the MCP client to query weather data for multiple cities and return a summarized forecast. The server is designed to work with the MCP ecosystem, including a lightweight agent that can discover and call tools such as a geolocation fetch service and the weather service itself, all through the SSE stream. You can connect to the SSE endpoint, observe tool invocations, and see the agent aggregate forecasts (e.g., which city will be warmest tomorrow).
How to install
Prerequisites:
- Java JDK 8+ and Maven
- Optional: Git if cloning from a repo
- Build the MCP server
mvn clean package
- Run the MCP server (SSE HTTP transport)
java -jar mcp-server/target/mcp-server-1.0-SNAPSHOT.jar
- (Optional) Configure a client to connect via SSE
- Ensure the server is reachable at http://localhost:8080/sse
- Example client config (MCP client) can reference the SSE transport endpoint
Notes:
- The server demonstrates how to expose weather-related tools over an SSE transport and how an agent can orchestrate calls to a fetch service and the weather service.
- If you modify the server, rebuild with Maven to apply changes.
Additional notes
Tips and caveats:
- The README demonstrates an SSE endpoint at /sse and a message endpoint at /mcp/message. Ensure those routes are accessible in your environment.
- When testing locally, you may need to start additional services such as the fetch websearch MCP server that Weather relies on for city lat/long lookups.
- If you encounter connection or timeout issues, adjust the read_timeout_seconds in your MCP server configuration to match network latency.
- You can modify environment variables such as MCP_LOG_LEVEL to get more verbose logs during debugging.
Related MCP Servers
sonarqube
SonarQube MCP Server
PIXRA
Pixelize the real world on-chain
wanaku
Wanaku MCP Router
zerodha
Zerodha MCP Server & Client - AI Agent (w/Agno & w/Google ADK)
symfony
A Symfony package designed for building secure servers based on the Model Context Protocol, utilizing Server-Sent Events (SSE) and/or StreamableHTTP for real-time communication. It offers a scalable tool system tailored for enterprise-grade applications.
WigAI
Bitwig Controller Extension that provides an MCP Server for AI Agent control