Imel23/Meteo_MCP_server_tuto
If you are the rightful owner of Meteo_MCP_server_tuto and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
This project demonstrates how to use the FastMCP framework to create a simple MCP server for weather forecasting and geolocation.
🚀 Tutorial: Use FastMCP with GitHub Copilot in VS Code
A minimal weather tool demo using MCP over STDIO
This repo shows how to:
- Build an MCP server using
fastmcp - Run it locally via
uvand the STDIO protocol - Use GitHub Copilot Chat in VS Code to call your tools without any glue code
- Debug using MCP Inspector
📦 Setup
git clone <your-repo-url>
cd <repo>
uv pip install -r requirements.txt
🧠 What tools are exposed?
Defined in meteo_mcp.py:
| Tool | Description |
|---|---|
get_coords(city: str) | Returns (lat, lon) |
get_current_weather(lat: float, lon: float) | Returns current temperature and wind |
get_forecast(lat: float, lon: float, days: int = 3) | Returns a weather forecast for up to 3 days |
🛠️ Add MCP Server in VS Code (STDIO)
-
Open Command Palette:
Ctrl/⌘ + Shift + P→MCP: Add Server -
Choose:
- Transport:
Command (stdio) - Command:
uv - Arguments:
["run", "meteo_mcp.py"]
- Transport:
-
The config will be saved (or added to) under:
// .vscode/mcp.json
{
"servers": {
"my-mcp-server-f963fb24": {
"type": "stdio",
"command": "uv",
"args": ["run", "meteo_mcp.py"]
}
}
}
🧠 Use GitHub Copilot Chat (as a Tool-Calling Agent)
-
Open GitHub Copilot Chat panel
-
Click 3-dot menu (⋮) → Enable Agent Mode
-
Ask:
What’s the 3-day forecast for Paris?
Copilot will:
- Call
get_coords("Paris") - Then call
get_forecast(lat, lon, 3)
✅ No glue code or prompt engineering needed — tools are invoked automatically via MCP!
🧪 Test with MCP Inspector
- Install Inspector CLI (requires Node.js v18 or later):
npm install -g @modelcontextprotocol/inspector
- Launch the MCP Inspector in STDIO mode:
uv run mcp dev meteo_mcp.py
This starts both:
- A web UI at
http://localhost:6274- An MCP proxy for debugging requests/responses
-
In the UI:
- Select a tool (
get_coords,get_forecast, etc.) - Provide JSON input (e.g.
{ "city": "Berlin" }) - Run and inspect results
- Select a tool (
🌐 External APIs Used
| API | Purpose |
|---|---|
https://geocoding-api.open-meteo.com/v1/search | Geocoding |
https://api.open-meteo.com/v1/forecast | Weather forecast |
Let me know if you want a template version of this for new MCP tool projects or want to integrate logging or unit tests.