MCP Weather Server Demo

MCP Weather Server Demo

Fetches current weather information for any city using the Open-Meteo API through a simple MCP tool interface.

Category
Visit Server

README

MCP Weather Server Demo

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.

Features

  • Basic MCP server using @modelcontextprotocol/sdk and zod for validation.
  • fetch-weather tool that takes a city name and returns current weather information.
  • Uses public APIs for geocoding and weather data.

Installation

  1. Clone this repository:
    git clone https://github.com/your-username/your-repo.git
    cd your-repo
    
  2. Install dependencies:
    npm install
    

Usage

Run the MCP server:

npx tsx main.ts

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

Note:

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 structure

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

BONUS

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" ] }

Tasks examples (via prompts):

  • 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.]

NOTE

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

License

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


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

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
E2B

E2B

Using MCP to run code via e2b.

Official
Featured