home / mcp / weather mcp server
A working pattern for SSE-based MCP clients and servers
Configuration
View docs{
"mcpServers": {
"sidharthrajaram-mcp-sse": {
"url": "http://0.0.0.0:8080/sse",
"headers": {
"ANTHROPIC_API_KEY": "YOUR_API_KEY"
}
}
}
}You can run an SSE-based MCP server that exposes weather-related tools and connect to it with an MCP client. This pattern lets you decouple the server from the client, so you can deploy, scale, and reuse the server independently while your client interacts with it over a stable HTTP SSE endpoint.
You start the server as a standalone process and then connect a client to its SSE endpoint to invoke tools. The server exposes tools like getting alerts and forecasts, which the client can call by name. You supply your API key as an environment variable so tools requiring authentication can operate.
Usage flow you can follow:
# Prerequisites: Node.js/yarn for Smithery, Python tooling for the server, and a valid API key
# Install the SSE-based MCP server and client using Smithery
npx -y @smithery/cli install @sidharthrajaram/mcp-sse --client claudeInstall and run the server and client using the commands shown below. The server runs by default on 0.0.0.0:8080, and you can override the host/port if needed.
uv run weather.py
uv run client.py http://0.0.0.0:8080/sse
```
```bash
# Optional: customize host and port for the server
uv run weather.py --host <your host> --port <your port>
```
```bash
# Connect the client to the server SSE endpoint
uv run client.py http://0.0.0.0:8080/sseEnvironment variable required: ANTHROPIC_API_KEY must be available in your environment or defined in a .env file before starting the server and client.
Fetch current weather alerts from supported sources and return a structured list of alerts.
Retrieve weather forecast data for a given latitude and longitude, returning the forecast details for the requested location.