seheremir
MCP Serverseheremirpublic

mastra weather agent api

基于 Mastra 框架开发的天气信息获取代理工具,支持城市天气查询。

Repository Info

0
Stars
0
Forks
0
Watchers
0
Issues
TypeScript
Language
-
License

About This Server

基于 Mastra 框架开发的天气信息获取代理工具,支持城市天气查询。

Model Context Protocol (MCP) - This server can be integrated with AI applications to provide additional context and capabilities, enabling enhanced AI interactions and functionality.

Documentation

Mastra Weather Agent

Bu proje, Mastra framework kullanarak geliştirilmiş bir hava durumu agent'idir. MCP Weather Server API'sini kullanarak şehirlerin hava durumu bilgilerini getirir.

🚀 Özellikler

  • ☁️ Basit hava durumu sorgulama
  • 📊 Detaylı hava durumu raporları
  • 🌡️ Sıcaklık bazlı öneriler
  • 🌍 Türkçe dil desteği
  • 🤖 Mastra framework entegrasyonu
  • 💬 Interactive CLI modu

📋 Gereksinimler

  • Node.js (v16 veya üzeri)
  • npm veya yarn
  • TypeScript

🛠️ Kurulum

1. Projeyi klonlayın veya dosyaları oluşturun

mkdir mastra-weather-agent
cd mastra-weather-agent

2. Paket yöneticisini başlatın

npm init -y

3. Bağımlılıkları yükleyin

npm install @mastra/core dotenv
npm install -D @types/node typescript ts-node

4. TypeScript yapılandırmasını yapın

Yukarıdaki tsconfig.json dosyasını projenizin kök dizinine ekleyin.

5. Kaynak kodlarını oluşturun

mkdir -p src/agents

Daha sonra yukarıdaki dosyaları ilgili dizinlere yerleştirin:

  • src/agents/WeatherAgent.ts
  • src/index.ts

6. Environment dosyasını hazırlayın

cp .env.example .env

🚦 Çalıştırma

Geliştirme Modu

npm run dev

Build ve Çalıştırma

npm run build
npm start

Interactive Mod

npm run dev -- --interactive
# veya
npm run dev -- -i

📖 Kullanım Örnekleri

Programatik Kullanım

import WeatherAgent from './agents/WeatherAgent';

const weatherAgent = new WeatherAgent();

// Basit hava durumu
const weather = await weatherAgent.getWeather('Istanbul');
console.log(weather);

// Detaylı hava durumu
const detailedWeather = await weatherAgent.getDetailedWeather('Ankara');
console.log(detailedWeather);

CLI Kullanımı

Interactive modda çalıştırdığınızda:

🌤️  Interactive Weather Agent
💡 Şehir adı girin (çıkmak için "exit" yazın)

Şehir adı: Istanbul
🌤️ **Istanbul Hava Durumu:**
📍 Şehir: Istanbul
🌡️ Sıcaklık: 22°C
☁️ Durum: Partly cloudy
📅 Tarih: 28.05.2025

🏗️ Proje Yapısı

mastra-weather-agent/
├── src/
│   ├── agents/
│   │   └── WeatherAgent.ts     # Ana weather agent sınıfı
│   └── index.ts                # Ana uygulama dosyası
├── dist/                       # Build çıktıları
├── .env.example               # Environment variables örneği
├── .env                       # Environment variables (create this)
├── package.json               # Proje bağımlılıkları
├── tsconfig.json              # TypeScript konfigürasyonu
└── README.md                  # Bu dosya

🔧 Scripts

  • npm run build - TypeScript kodlarını JavaScript'e derler
  • npm run start - Build edilmiş uygulamayı çalıştırır
  • npm run dev - Geliştirme modunda çalıştırır
  • npm run clean - Build dosyalarını temizler

🌐 API Bilgileri

Bu proje MCP Weather Server API'sini kullanır:

  • Base URL: https://smithery.ai/server/@isdaniel/mcp_weather_server/
  • Endpoint: /weather?city={cityName}
  • Method: GET
  • Response Format: JSON

🎯 Agent Yetenekleri

getWeather(city: string)

Belirtilen şehir için basit hava durumu bilgisi getirir.

getDetailedWeather(city: string)

Belirtilen şehir için detaylı hava durumu raporu oluşturur.

getInfo()

Agent hakkında bilgi verir.

🔧 Özelleştirme

Yeni Tool Ekleme

WeatherAgent.ts dosyasında tools objesine yeni araçlar ekleyebilirsiniz:

const tools = {
  // Mevcut araçlar...
  
  newTool: {
    description: "Yeni aracın açıklaması",
    parameters: {
      // Parametreler...
    },
    execute: async (params) => {
      // Aracın işlevi...
    },
  },
};

Model Değiştirme

Agent yapılandırmasında farklı bir model kullanabilirsiniz:

const config: AgentConfig = {
  // Diğer ayarlar...
  model: "gpt-4" as any, // veya başka bir model
};

🐛 Hata Ayıklama

Yaygın sorunlar ve çözümleri:

  1. API Erişim Hatası: İnternet bağlantınızı kontrol edin
  2. Şehir Bulunamadı: Şehir adını İngilizce veya Türkçe karakterlerle deneyin
  3. Build Hatası: npm run clean çalıştırıp tekrar build edin

📄 Lisans

MIT License

🤝 Katkıda Bulunma

  1. Fork edin
  2. Feature branch oluşturun (git checkout -b feature/amazing-feature)
  3. Commit edin (git commit -m 'Add amazing feature')
  4. Push edin (git push origin feature/amazing-feature)
  5. Pull Request oluşturun

📞 İletişim

Sorularınız için GitHub Issues kullanabilirsiniz.


⭐ Bu projeyi beğendiyseniz yıldız vermeyi unutmayın!

Quick Start

1

Clone the repository

git clone https://github.com/seheremir/mastra-weather-agent-api
2

Install dependencies

cd mastra-weather-agent-api
npm install
3

Follow the documentation

Check the repository's README.md file for specific installation and usage instructions.

Repository Details

Ownerseheremir
Repomastra-weather-agent-api
LanguageTypeScript
License-
Last fetched8/10/2025

Recommended MCP Servers

💬

Discord MCP

Enable AI assistants to seamlessly interact with Discord servers, channels, and messages.

integrationsdiscordchat
🔗

Knit MCP

Connect AI agents to 200+ SaaS applications and automate workflows.

integrationsautomationsaas
🕷️

Apify MCP Server

Deploy and interact with Apify actors for web scraping and data extraction.

apifycrawlerdata
🌐

BrowserStack MCP

BrowserStack MCP Server for automated testing across multiple browsers.

testingqabrowsers

Zapier MCP

A Zapier server that provides automation capabilities for various apps.

zapierautomation