weather-mcp
Allows GitHub Copilot in VSCode to use the get_forecast tool to retrieve weather forecasts and answer weather-related queries.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@weather-mcpwhat's the weather in Recife?"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
weather-mcp
Servidor MCP (Model Context Protocol) de previsão do tempo. Recebe o nome de
uma cidade (ex.: Recife,BR) e retorna a previsão usando a API do
OpenWeather via PyOWM.
O transporte é Streamable HTTP, então o servidor sobe em
http://127.0.0.1:8000/mcp e pode ser consumido por qualquer cliente MCP.
O código do servidor cabe em ~30 linhas (server.py) — feito para servir de
demo/exemplo em apresentações.
Getting Started
1. Pré-requisitos
Python 3.12+
uv (gerenciador de pacotes/projeto)
Uma API Key do OpenWeather — crie uma conta gratuita em https://home.openweathermap.org/api_keys
2. Setup do projeto
# instala as dependências no ambiente virtual do projeto
uv sync3. Configuração da API Key
A chave é lida da variável de ambiente OPENWEATHER_API_KEY.
export OPENWEATHER_API_KEY="sua_chave_aqui"Dica: você também pode criar um arquivo
.enve carregá-lo (ex.:export $(cat .env | xargs)), mas exportar a variável já é suficiente.
4. Execução
uv run python server.pySaída esperada:
INFO: Uvicorn running on http://127.0.0.1:8000 (Press CTRL+C to quit)O endpoint MCP fica disponível em http://127.0.0.1:8000/mcp.
5. Teste rápido (opcional)
Use o inspector oficial para explorar o servidor pelo navegador:
npx @modelcontextprotocol/inspectorNo inspector, escolha o transporte Streamable HTTP e aponte para
http://127.0.0.1:8000/mcp. A tool disponível é get_forecast(city).
Related MCP server: Open Weather13 MCP Server
Configuração nos clientes MCP
Deixe o servidor rodando (uv run python server.py) antes de configurar os
clientes abaixo. Todos apontam para o mesmo endpoint HTTP.
VSCode + GitHub Copilot
Crie o arquivo .vscode/mcp.json na raiz do workspace:
{
"servers": {
"weather": {
"type": "http",
"url": "http://127.0.0.1:8000/mcp"
}
}
}Abra o Copilot Chat no modo Agent, clique no ícone de ferramentas e
confirme que a tool get_forecast aparece.
Claude Code
Registre o servidor com transporte HTTP:
claude mcp add --transport http weather http://127.0.0.1:8000/mcpVerifique com claude mcp list. Dentro de uma sessão, use /mcp para inspecionar
o servidor e suas tools.
Codex
No arquivo de configuração ~/.codex/config.toml, adicione:
[mcp_servers.weather]
url = "http://127.0.0.1:8000/mcp"Dependendo da versão do Codex CLI, o suporte a transporte HTTP exige habilitar o cliente RMCP. Se o servidor não conectar, adicione ao topo do
~/.codex/config.toml:experimental_use_rmcp_client = true
Como funciona
# server.py
mcp = FastMCP("weather")
owm = OWM(os.environ["OPENWEATHER_API_KEY"])
@mcp.tool()
def get_forecast(city: str) -> str:
forecast = owm.weather_manager().forecast_at_place(city, "3h").forecast
...
mcp.run(transport="streamable-http")FastMCPexpõe a função decorada com@mcp.tool()como uma tool MCP.forecast_at_place(city, "3h")usa a previsão gratuita de 5 dias / 3 horas do OpenWeather.transport="streamable-http"sobe o servidor HTTP em/mcp.
Exemplo de uso
Pergunte ao seu assistente:
Qual a previsão do tempo para Recife?
Ele chamará get_forecast("Recife,BR") e responderá com base no retorno da tool.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/henriquemenezes/weather-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server