Weather MCP Server
Servidor MCP de Clima
Un servidor de Model Context Protocol que proporciona datos meteorológicos en tiempo real, asegurado con autenticación mediante token Bearer AWS Cognito OAuth 2.1.
Implementa la Especificación de Autorización MCP (2025-11-25) completa:
RFC 9728 — Descubrimiento de Metadatos de Recursos Protegidos (PRM)
RFC 6750 — Uso de token Bearer
RFC 7591 — Registro Dinámico de Clientes (DCR) puenteado a Cognito
Arquitectura
Client / AI Agent
│
├─ GET /.well-known/oauth-protected-resource → discover auth server
├─ POST /register → dynamic client registration (optional)
├─ POST Cognito /oauth2/token → exchange credentials for JWT
└─ POST /mcp Authorization: Bearer <token> → call MCP toolsLos datos meteorológicos provienen de Open-Meteo — gratuitos, no se requiere clave de API.
Related MCP server: MCP Authentication Example
Estructura del Proyecto
weather-mcp/
├── weather_mcp/
│ ├── __init__.py
│ ├── config.py # Env var loading (COGNITO_REGION/USER_POOL_ID/DOMAIN_PREFIX, SERVER_URL)
│ ├── auth.py # JWT validation, middleware, PRM + DCR handlers
│ ├── tools.py # MCP instance + weather tools
│ └── main.py # Starlette app factory + uvicorn entrypoint
├── infra/
│ └── cognito.yaml # CloudFormation — Cognito User Pool, IAM role
├── docs/
│ └── deploy-ecs-express.md # ECS Express Mode deployment guide
├── pyproject.toml
├── Dockerfile
├── .env.example
└── README.mdRequisitos previos
Python 3.13+ y uv
Cuenta de AWS con CLI configurada (
aws configure)Docker (opcional, para despliegue en contenedores)
Inicio rápido
1 — Desplegar AWS Cognito
aws cloudformation deploy \
--template-file infra/cognito.yaml \
--stack-name weather-mcp \
--region us-east-1 \
--capabilities CAPABILITY_NAMED_IAMObtenga los valores de salida:
aws cloudformation describe-stacks \
--stack-name weather-mcp \
--query "Stacks[0].Outputs" \
--output table2 — Configurar el entorno
cp .env.example .env
# Fill in COGNITO_REGION, COGNITO_USER_POOL_ID, COGNITO_DOMAIN_PREFIX from CloudFormation Outputs3 — Ejecutar
Localmente:
uv sync
uv run python -m weather_mcp.mainDocker:
docker build -t weather-mcp:local .
docker run --env-file .env -p 8000:8000 weather-mcp:localEl servidor se inicia en http://0.0.0.0:8000.
Desplegar en AWS ECS Express Mode:
Consulte docs/deploy-ecs-express.md para obtener la guía completa: construye la imagen, la envía a ECR y crea un servicio HTTPS público con escalado automático.
Endpoints de la API
Endpoint | Autenticación | Descripción |
| Ninguna | Comprobación de estado |
| Ninguna | Documento de descubrimiento RFC 9728 |
| Ninguna | Registro Dinámico de Clientes RFC 7591 |
| Token Bearer | Herramientas MCP (HTTP transmitible) |
Herramientas MCP
Herramienta | Descripción |
| Clima actual para cualquier ubicación por latitud/longitud |
Uso
Registro Dinámico de Clientes (sin preconfiguración)
# 1. Register a new client
curl -s -X POST http://localhost:8000/register \
-H "Content-Type: application/json" \
-d '{"client_name":"my-agent","grant_types":["client_credentials"],"scope":"weather-mcp/read"}'
# 2. Get a token
curl -s -X POST https://weather-mcp-auth.auth.us-east-1.amazoncognito.com/oauth2/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>&scope=weather-mcp/read"
# 3. Call MCP
curl -s -X POST http://localhost:8000/mcp \
-H "Authorization: Bearer <TOKEN>" \
-H "Accept: application/json, text/event-stream" \
-H "Content-Type: application/json" \
-d '{"jsonrpc":"2.0","method":"tools/list","id":1}'Variables de entorno
Variable | Descripción |
| Región de AWS (ej. |
| ID del grupo de usuarios de Cognito |
| Prefijo de dominio de Hosted-UI |
| URL pública de este servidor (predeterminado: |
Cómo funciona la autenticación
Una solicitud llega a
/mcpsin un token → el servidor responde con401y un encabezadoWWW-Authenticateque apunta a/.well-known/oauth-protected-resourceEl cliente obtiene el documento de descubrimiento para encontrar el servidor de autorización de Cognito
El cliente obtiene un token de acceso JWT de Cognito (a través de
client_credentialso Registro Dinámico de Clientes)El cliente incluye
Authorization: Bearer <token>en las solicitudes posterioresEl middleware valida la firma JWT contra el endpoint JWKS de Cognito (RS256, caché de 1 hora)
Notas
El servidor MCP se vincula a
0.0.0.0:8000con la protección contra rebinding de DNS desactivada (host="0.0.0.0"). Esto es necesario cuando se ejecuta detrás de un balanceador de carga (ej. ECS Express Mode ALB) donde el encabezadoHostes el dominio público, nolocalhost.Al desplegar en ECS Express Mode, la imagen se fija por resumen (digest) — consulte la guía de despliegue para saber cómo actualizarla.
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.
Related MCP Servers
- -licenseNot gradedqualityNot gradedmaintenanceEnables real-time weather data streaming through a secure MCP server. Features authentication using Descope and can be deployed to Fly.io for remote access.21
- FlicenseNot gradedqualityDmaintenanceDemonstrates OAuth2/OIDC authentication for MCP servers using Asgardeo, with JWT validation and a sample weather tool to showcase secured API access.
- FlicenseNot gradedqualityDmaintenanceProvides weather information from the National Weather Service API with full MCP OAuth 2.1 compliance, including weather alerts and forecasts for US locations through secure Azure AD authentication.27
- AlicenseNot gradedqualityCmaintenanceDemonstrates how to secure an MCP server with OAuth 2.1 using AWS Cognito, with support for dynamic client registration and client ID metadata documents.68MIT
Related MCP Connectors
NOAA and ECMWF weather forecast MCP for discovery, validation, and GribStream OAuth queries.
Open-Meteo MCP — weather forecast + historical reanalysis + sister APIs
OpenWeather MCP — wraps the OpenWeatherMap API (openweathermap.org)
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- 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/sauravkumar329/weather-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server