Weather MCP Server logo

Weather MCP Server

by moizghumann

The Weather MCP Server provides weather data using the Model Context Protocol (MCP). It's built with TypeScript and runs on Node.js.

View on GitHub

Last updated: N/A

Weather MCP Server

This is a Weather MCP Server that provides weather data using the Model Context Protocol (MCP). It is built with TypeScript and runs on Node.js.

šŸ“Œ Features

  • Fetches and processes weather data.
  • Uses Model Context Protocol (MCP) SDK.
  • Built with TypeScript for type safety.
  • Configurable via environment variables.

šŸ›  Installation

1ļøāƒ£ Clone the Repository

git clone https://github.com/your-username/weather-mcp-server.git
cd weather-mcp-server

2ļøāƒ£ Install Dependencies

npm install

3ļøāƒ£ Build the Project

npm run build

4ļøāƒ£ Run the Server

npm start

Alternatively, you can run the compiled JavaScript directly:

node build/index.js

šŸ”§ Configuration

This project uses environment variables for configuration. You can create a .env file in the root directory:

API_KEY=your_weather_api_key
PORT=3000

šŸ“ Scripts

| Command | Description | |---------------|-------------| | npm run build | Compiles TypeScript into JavaScript | | npm start | Runs the compiled server | | npm run lint | Lints TypeScript files using ESLint |

šŸ“ Project Structure

weather-mcp-server/
│── src/
│   ā”œā”€ā”€ index.ts       # Main entry point
│── build/             # Compiled JavaScript output
│── package.json       # Project dependencies and scripts
│── tsconfig.json      # TypeScript configuration
│── .eslintrc.js       # ESLint configuration

šŸž Troubleshooting

  • If npm run build doesn't produce output, check TypeScript logs:
    npx tsc --diagnostics
    
  • If Node.js cannot find index.js, ensure build/ contains compiled files:
    ls build/
    
  • If running on Windows, chmod will fail in package.json. Remove chmod 755 build/index.js from the build script.

šŸ“œ License

This project is licensed under the ISC License.


šŸ”§ Developed by Moiz Ghuman