🌦️ Weather MCP Server
This project is a Model Context Protocol (MCP) 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
npm install
---
2. Build the TypeScript source
npm run build
This will compile
src/index.tsintobuild/index.jswith proper ES module output.
---
3. Run the MCP server
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
---
🧠 Connecting to Claude Desktop
- Open Claude Desktop
- Go to Settings → Model Context Protocol → Edit Config File
- Add this to your
config.json:
{
"mcpServers": {
"weather": {
"command": "node",
"args": [
"path/to/index/build/index.js"
]
}
}
}
✅ Ensure the path matches the location of your compiled
index.jsfile ✅ Use forward slashes/even on Windows
- Restart Claude Desktop
---
🧪 Usage from Claude
Try these tool calls inside Claude's prompt:
/tools get_alerts { "state": "CA" }
/tools get_forecast { "latitude": 37.7749, "longitude": -122.4194 }
---
🛠 Developer Notes
TypeScript Configuration (tsconfig.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)
"bin": {
"weather": "./build/index.js"
},
"scripts": {
"build": "tsc && chmod 755 build/index.js"
}
---











