MCP Weather Server Demo

by raulcalderon

Not rated
GitHub

About

Fetches weather data for any city using the Open-Meteo API.

Details

Author
raulcalderon
Categories
Cloud Service, Other

Setup

Install MCP Weather Server Demo in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/raulcalderon/my-first-mcp

Follow the installation instructions in the repository README, then restart your MCP client.

This project is a sample MCP (Model Context Protocol) server that exposes a tool to fetch the weather for any city using the Open-Meteo API.

- Basic MCP server using@modelcontextprotocol/sdkandzodfor validation.
- fetch-weathertool that takes a city name and returns current weather information.
- Uses public APIs for geocoding and weather data.
- Clone this repository:

git clone https://github.com/your-username/your-repo.git cd your-repo

This will start the server and you can connect from any compatible MCP client.

You can also run this to use the inspector on the web browser.

npx -y @modelcontextprotocol/inspector npx -y tsx main.ts

1.- Run the command. 2.- Go to the link provided in console. 3.- Configure the enviroment this way: - Transport Type: STDIO - Command: npx - Arguments: -y tsx main.ts - Proxy Session Token: the token generated when start the server. (MCP_PROXY_AUTH_TOKEN=YOUR_TOKEN) 4.- Connect -> List Tools -> Select your MCP -> Start using it.

- main.ts: Source code for the server and weather tool.
- package.json: Project dependencies and scripts.

I attatched a json file (with a different name), which is used on Claude an AI Assistant built by Anthropic. In this file, we can use the AI to do incredible things, such as the following and many more:

1.- Get access to folders and interact with your computer. 📁

https://github.com/modelcontextprotocol/servers/tree/main/src/filesystem

"mcpServers": { "filesystem": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-filesystem", "/Users/username/Desktop", "/path/to/other/allowed/dir" ] } }

Tasks examples (via prompts): Give permission to access the Desktop

- Give instructions to move any .mp4 file to a single folder.
- Ask to remove any file larger than 20 MB.
- Create a script for a video. etc.

2.- Get access to a database and start prompting simple or complex tasks. 🤖

https://github.com/modelcontextprotocol/servers-archived/tree/main/src/postgres

"postgres": { "command": "npx", "args": [ "-y", "@modelcontextprotocol/server-postgres", "postgresql://DB_USER:DB_PASS@localhost:5432/DB_NAME" ] }

- Truncate a single table
- Get all data from a single user and export it into a csv file.
- Get all activity from a user that has root privileges on diferent tables. etc.

You can install Claude Agent and configure the json file like this to test them.[Just make sure you are using the Claude configuration in both cases.]

the 'weather' element in the configuration file, is the MCP we just created. Yes, you can using on Claude too.

This project is licensed under the MIT License. See theLICENSEfile for details.

Example project to learn how to create MCP tools and consume public APIs.

Provides aviation weather information for flight planning from aviationweather.gov.

Fetches precipitation forecast data for a specific location using the Buienradar service.

Query weather information and meteorological warnings for Chinese cities using the QWeather API.

Integrates the US National Weather Service API to provide real-time weather data and forecasts.

Provides weather information tools using the US National Weather Service API.

A server for fetching weather information using the OpenWeather API.

Provides hourly weather forecasts using the AccuWeather API.

Access global weather forecasts and historical data through the Open-Meteo API.

Access global weather data and forecasts using the OpenMeteo API, including current conditions, historical data, and location search.

Provides comprehensive weather data and forecasts using the OpenWeatherMap API.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.