kevinthomasissac/mcp-server
If you are the rightful owner of mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
The MCP Server for Weather provides U.S. weather forecasts and severe weather alerts using data from the National Weather Service (NWS).
🌦️ MCP Server – Weather
A Model Context Protocol (MCP) server providing U.S. weather forecasts and severe weather alerts using data from the National Weather Service (NWS).
🧩 Features
get-alerts: Fetch current weather alerts for a U.S. stateget-forecast: Get a short-term forecast for a U.S. location (latitude/longitude)
📦 Project Setup
1. Clone and install dependencies
git clone <your-repo-url>
cd mcp-server-weather
npm install
2. Build the TypeScript code
npm run build
This compiles the source from src/ to dist/.
3. Run the server directly
node dist/index.js
You should see:
Weather MCP Server running on stdio
🧰 Testing with the MCP Inspector CLI
The official CLI tool for interacting with MCP servers is @modelcontextprotocol/inspector.
4. List available tools
npx @modelcontextprotocol/inspector --cli node dist/index.js --method tools/list
Expected output:
{
"tools": [
{ "name": "get-alerts", "description": "Get weather alerts for a US state" },
{ "name": "get-forecast", "description": "Get weather forecast for a location in the US" }
]
}
5. Get weather alerts
npx @modelcontextprotocol/inspector --cli node dist/index.js \
--method tools/call \
--params '{"name":"get-alerts","arguments":{"state":"CA"}}'
6. Get forecast
npx @modelcontextprotocol/inspector --cli node dist/index.js \
--method tools/call \
--params '{"name":"get-forecast","arguments":{"latitude":37.7749,"longitude":-122.4194}}'
⚙️ Publishing to npm
To publish this MCP server as an npm CLI tool:
- Update the
name,version, andrepositoryfields in yourpackage.json. - Ensure the executable mapping is correct:
"bin": { "mcp-server-weather": "dist/index.js" } - Build the project:
npm run build - Make sure the binary file is executable:
chmod +x dist/index.js - Log in to npm:
npm login - Publish:
npm publish --access public
After publishing, anyone can install and run your server globally:
npm install -g mcp-server-weather
mcp-server-weather
⚙️ Node.js Version
- Minimum required: Node.js 18
- Recommended: Node.js ≥ 22.7.5 (to match the latest
@modelcontextprotocol/inspector) - Update using:
brew upgrade node@22
🧱 Project Structure
mcp-server-weather/
├── src/
│ └── index.ts
├── dist/
│ └── index.js
├── package.json
├── tsconfig.json
└── README.md
🧩 Development Commands
| Command | Description |
|---|---|
npm run build | Compile TypeScript into dist/ |
npm run watch | Watch for changes and rebuild automatically |
npm run clean | Clean build artifacts |
npm run do-publish | Clean, install, and publish package to npm |
npm run publish-dry-run | Test npm publish process without uploading |
⚙️ Notes
- The server uses STDIO transport and must not write to
stdout(useconsole.error()for logs). - MCP clients (like OpenAI ChatGPT or the MCP Inspector) communicate via JSON-RPC.
- Works only for U.S. coordinates, as the NWS API doesn’t cover other countries.
📜 License
MIT License © 2025