Weather MCP Server
Bu proje, Model Context Protocol (MCP) kullanarak hava durumu bilgisi sağlayan bir FastAPI uygulamasıdır.
Özellikler
- MCP Protokolü: Model Context Protocol standardına uygun
- FastAPI: Modern, hızlı web framework
- Hava Durumu API: wttr.in servisini kullanarak gerçek zamanlı hava durumu
- Hata Yönetimi: Kapsamlı hata yakalama ve kullanıcı dostu mesajlar
Kurulum
- Bağımlılıkları yükleyin:
pip install -r requirements.txt
- Sunucuyu başlatın:
python main.py
Sunucu http://localhost:8000 adresinde çalışmaya başlayacaktır.
Kullanım
MCP Protokolü ile
MCP protokolü üzerinden /mcp endpoint’ini kullanın:
POST /mcp
{
"method": "tools/call",
"params": {
"name": "get_weather",
"arguments": {
"city": "İstanbul"
}
}
}
Direkt API Kullanımı
Test amaçlı direkt endpoint’ler:
# GET isteği
curl http://localhost:8000/weather/İstanbul
# POST isteği
curl -X POST http://localhost:8000/weather
-H "Content-Type: application/json"
-d '{"name": "get_weather", "arguments": {"city": "İstanbul"}}'
API Endpoints
GET /- Sunucu bilgileriGET /health- Sağlık kontrolüPOST /mcp- Ana MCP protokol handlerGET /weather/{city}- Basit hava durumu sorgusuPOST /weather- Detaylı hava durumu sorgusu
Yanıt Formatı
Başarılı yanıt örneği:
{
"city": "İstanbul",
"location": {
"area_name": "Istanbul",
"country": "Turkey",
"region": "Istanbul"
},
"current_weather": {
"temperature_c": "15",
"temperature_f": "59",
"feels_like_c": "14",
"feels_like_f": "57",
"humidity": "72",
"description": "Partly cloudy",
"wind_speed_kmh": "11",
"wind_direction": "NW",
"pressure": "1013",
"visibility": "10"
},
"status": "success"
}
Hata yanıtı örneği:
{
"city": "GeçersizŞehir",
"error": "Hava durumu alınamadı: Bağlantı hatası - 404 Client Error",
"status": "error"
}
Geliştirme
Sunucuyu geliştirme modunda çalıştırmak için:
uvicorn main:app --reload --host 0.0.0.0 --port 8000
Dosya Yapısı
main.py- Ana FastAPI uygulaması ve MCP sunucumcp_config.py- MCP konfigürasyonu ve weather tool implementasyonurequirements.txt- Python bağımlılıklarıREADME.md- Bu dosya
Weather Information Server
Project Details
- iremaltunay55/deneme3
- Last Updated: 5/23/2025
Recomended MCP Servers
A Model Context Protocol (MCP) server that provides enhanced file operation capabilities with streaming, patching, and change tracking...
[MCP Server] The Security Agent for AI assisted coding
This read-only MCP Server allows you to connect to Salesforce Marketing data from Claude Desktop through CData JDBC...
This read-only MCP Server allows you to connect to Sybase IQ data from Claude Desktop through CData JDBC...
A Model Context Protocol (MCP) integration that enables AI assistants to search for and control Home Assistant devices...
A secure Model Context Protocol (MCP) server providing filesystem access within predefined directories
A MCP server providing character info query for wuthering waves
A nomad MCP Server (modelcontextprotocol)
MCP Server for AI automation of the PlayCanvas Editor
This is a simple Model Context Protocol (MCP) server that sends emails using AWS SES (Simple Email Service)....
MCP server written in .net to interact with NuGet package servers





