Weather MCP Server
README.md
# Weather MCP Server
A TypeScript [Model Context Protocol (MCP)](https://modelcontextprotocol.io) Streamable HTTP server that provides real-time US weather data using the [NOAA National Weather Service (NWS) API](https://www.weather.gov/documentation/services-web-api).
## Tools
| Tool | Description |
|------|-------------|
| `get_alerts` | Get active weather alerts for a US state (two-letter state code, e.g. `CA`) |
| `get_forecast` | Get weather forecast for a US location by latitude and longitude |
> **Note:** Only US locations are supported by the NWS API.
## Prerequisites
- [Node.js](https://nodejs.org/) v18 or later
- npm
## Setup
1. **Clone the repository and install dependencies:**
```bash
git clone <repository-url>
cd custom-mcp-server
npm install
```
2. **Build the TypeScript source:**
```bash
npm run build
```
3. **Run the server:**
```bash
npm start
```
The MCP endpoint is available at `http://127.0.0.1:3010/mcp`.
Set `HOST` and `PORT` to change the listening address. For example:
```bash
HOST=0.0.0.0 PORT=8080 npm start
```
## Development
To watch for changes and recompile automatically:
```bash
npm run dev
```
## Connecting to an MCP Client
To use this server with an MCP client such as VS Code Copilot, start the server and add its URL to your MCP configuration:
```json
{
"servers": {
"weather": {
"type": "http",
"url": "http://127.0.0.1:3010/mcp"
}
}
}
```
## Container
Build and run the server locally:
```bash
docker build -t weather-mcp .
docker run --rm -p 3010:3010 weather-mcp
```
The health endpoint is available at `http://127.0.0.1:3010/healthz`.
## Deploy to Azure Container Apps
The deployment creates an Azure Container Registry, a Consumption-plan Container Apps environment, Log Analytics, and an externally accessible Container App. The app uses a managed identity with the `AcrPull` role; registry admin credentials are disabled.
Prerequisites:
- Azure CLI
- An Azure account with permission to create resources and role assignments
Sign in and run the deployment:
```bash
az login
./scripts/deploy.sh
```
Customize the deployment with environment variables:
```bash
RESOURCE_GROUP=my-weather-rg \
LOCATION=westus2 \
APP_NAME=my-weather-mcp \
IMAGE_TAG=v1 \
./scripts/deploy.sh
```
Set `AZURE_SUBSCRIPTION_ID` when the signed-in account has access to multiple subscriptions. The script builds and publishes the image with ACR Tasks, so local Docker is not required.
## Project Structure
```
src/
index.ts # Server entry point and tool definitions
build/
index.js # Compiled output (generated by npm run build)
infra/
registry.bicep # Azure Container Registry
main.bicep # Container Apps resources
scripts/
deploy.sh # Build, publish, and deploy workflow
Dockerfile
package.json
tsconfig.json
```
This server cannot be deployed
Maintenance
ActivityStale
ResponsivenessNo issues