Weather MCP Server
by DilipSC
README.md
## ๐ฆ๏ธ Weather MCP Server
This project is a [Model Context Protocol (MCP)](https://github.com/modelcontextprotocol) compatible weather server that provides:
* ๐ฉ๏ธ Active weather alerts for U.S. states
* ๐ค๏ธ 7-day forecasts for a given latitude and longitude
It connects to Claude Desktop using the `stdio` transport.
---
## ๐ Project Structure
```
MCP_pracc/
โโโ src/
โ โโโ index.ts # Main MCP server source code
โโโ build/ # Output folder for compiled JS
โโโ package.json
โโโ tsconfig.json
โโโ README.md
```
---
## โ๏ธ Installation & Setup
### 1. Clone the project & install dependencies
```bash
npm install
```
---
### 2. Build the TypeScript source
```bash
npm run build
```
> This will compile `src/index.ts` into `build/index.js` with proper ES module output.
---
### 3. Run the MCP server
```bash
node ./build/index.js
```
You should see:
```
Weather MCP Server running on stdio
```
If you do, your MCP server is ready to be connected to Claude Desktop.
for more info get a look at [Fireship](https://youtu.be/HyzlYwjoXOQ?si=sG5HqCKfROaby5mc)
---
## ๐ง Connecting to Claude Desktop
1. Open **Claude Desktop**
2. Go to **Settings โ Model Context Protocol โ Edit Config File**
3. Add this to your `config.json`:
```json
{
"mcpServers": {
"weather": {
"command": "node",
"args": [
"path/to/index/build/index.js"
]
}
}
}
```
> โ
Ensure the path matches the location of your compiled `index.js` file
> โ
Use forward slashes `/` even on Windows
4. Restart Claude Desktop
---
## ๐งช Usage from Claude
Try these tool calls inside Claude's prompt:
```bash
/tools get_alerts { "state": "CA" }
```
```bash
/tools get_forecast { "latitude": 37.7749, "longitude": -122.4194 }
```
---
## ๐ Developer Notes
### TypeScript Configuration (`tsconfig.json`)
```json
{
"compilerOptions": {
"target": "ES2022",
"module": "ES2022",
"moduleResolution": "bundler",
"outDir": "build",
"rootDir": "src",
"esModuleInterop": true,
"strict": true,
"skipLibCheck": true
},
"include": ["src/**/*.ts"],
"exclude": ["build"]
}
```
### Scripts (`package.json`)
```json
"bin": {
"weather": "./build/index.js"
},
"scripts": {
"build": "tsc && chmod 755 build/index.js"
}
```
---
## ๐ฆ Dependencies
* [`@modelcontextprotocol/sdk`](https://www.npmjs.com/package/@modelcontextprotocol/sdk)
* [`zod`](https://www.npmjs.com/package/zod)
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo issues