Meteo_MCP_server_tuto
This repository is a minimal tutorial for building and using an MCP (Model-Context-Protocol) server with FastMCP in Python. It demonstrates how to expose simple weather tools (get_coords, get_forecast) and use them directly in GitHub Copilot Chat in VS Code via the STDIO protocol โ no extra API or plugin code required.
GitHub Stars
0
User Rating
Not Rated
Favorites
0
Views
30
Forks
0
Issues
0
๐ 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 ServerChoose:
- 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.
kickstart-mcp is an interactive tutorial designed to teach the Model Context Protocol (MCP). It guides users through every step from setting up MCP hosts to building servers and clients. With cross-platform support, it is accessible for beginners and offers a comprehensive understanding of MCP concepts.