Skip to main content
Glama
adri14gl

MCP Weather and Currency Assistant

by adri14gl

MCPを利用した金融・天気アシスタント

ローカルのMCPサーバーとOpenAI Responses APIを組み合わせたコマンドラインアプリケーションです。このアシスタントは自然言語のクエリを理解し、サーバーが公開するツールを自動検出して実行し、最新の為替レートと気象データを取得します。

このプロジェクトはFastMCPExchangeRate-APIOpen-Meteoを統合しています。また、チェーン呼び出しにも対応しており、例えば都市名を座標に変換してから現在の天気や予報を取得することができます。

機能

  • ISO 4217コードによる通貨間の金額換算

  • 基準通貨に対する為替レートの取得

  • 都市のジオコーディング

  • 現在の天気と1~7日先の予報の取得

  • クライアントによるMCPツールの自動検出

  • スペイン語の対話型ターミナルインターフェース

  • OpenAI呼び出し時の一時的なエラーに対するリトライとネットワークエラーの制御

Related MCP server: Weather MCP Server

アーキテクチャ

Usuario
  |
  v
CLI (main_client.py)
  |
  v
Cliente OpenAI Responses <----> Servidor MCP local (FastMCP)
                                      |
                                      +--> ExchangeRate-API
                                      +--> Open-Meteo

サーバーはデフォルトでHTTPトランスポートを使用し、http://127.0.0.1:8000/mcp/で公開されます。クライアントはこのURLに接続し、利用可能な5つのツールを読み込み、その結果をモデルに渡して最終的な応答を生成します。

MCPツール

ツール名

説明

convert_currency

現在のレートを使用して、2つの通貨間で金額を換算します。

get_exchange_rates

基準通貨に対する複数の通貨のレートを返します。

geocode_city

都市の座標、国、タイムゾーンを取得します。

get_current_weather

現在の気温、体感温度、湿度、風速、天気状態を取得します。

get_weather_forecast

今後数日間の気温、降水確率、天気状態を返します。

必要条件

  • Python 3.10以上

  • Responses APIにアクセスできるOpenAI APIキー

  • OpenAIおよび外部APIにアクセスするためのインターネット接続

  • ExchangeRate-APIのキーはオプションです。指定しない場合は公開エンドポイントを使用します。

インストール

リポジトリをクローンし、仮想環境を作成します:

git clone <URL_DEL_REPOSITORIO>
cd <NOMBRE_DEL_REPOSITORIO>
python -m venv .venv

仮想環境をアクティベートします:

# Windows PowerShell
.venv\Scripts\Activate.ps1

# Windows (cmd)
.venv\Scripts\activate.bat

# macOS/Linux
source .venv/bin/activate

依存関係をインストールします:

python -m pip install -r requirements.txt

設定

サンプル設定ファイルをコピーし、認証情報を記入します。.envファイルはローカル専用で、リポジトリに含めてはいけません:

Copy-Item .env.example .env

macOSまたはLinuxの場合:

cp .env.example .env

作成されたファイルには以下の変数が含まれている必要があります:

OPENAI_API_KEY=tu_clave_de_openai

# Opcional. Si se deja vacío se usa el endpoint abierto de ExchangeRate-API.
API_KEY_EXCHANGE=

# Opcionales.
MCP_HOST=127.0.0.1
MCP_PORT=8000
OPENAI_MODEL=gpt-4o-mini

OPENAI_API_KEYはクライアントを使用するために必要です。Open-Meteoは認証情報を必要としません。アプリケーションは外部HTTP呼び出しに10秒のタイムアウトを使用します。

使用方法

サーバーとクライアントは別々のターミナルで実行します。最初にサーバーを起動します:

python main_server.py

別のターミナルで、仮想環境をアクティベートした状態でクライアントを起動します:

python main_client.py

テスト

単体テストでは、OpenAIや外部APIを呼び出さずに、通貨ロジック、天気予報、WMOコード、エラー処理をカバーします:

python -m pip install -r requirements-dev.txt
python -m pytest

その後、以下のようなクエリを入力できます:

Convierte 100 USD a EUR
¿Cuál es el clima actual en Madrid?
Dame la previsión del tiempo para Nueva York durante 5 días
¿Qué coordenadas tiene Tokio?

CLIで使用可能なコマンド:

コマンド

アクション

/ayuda

ツールとクエリの例を表示します。

/monedas

一般的な通貨コードを表示します。

/salir

クライアントを終了します。

プロジェクト構造

.
├── .env.example          # Plantilla de configuración local
├── .gitignore            # Archivos excluidos del repositorio
├── client/
│   ├── cli_interface.py    # Interfaz interactiva de terminal
│   └── openai_client.py    # Orquestación OpenAI + MCP
├── config/
│   └── settings.py         # Variables de entorno y endpoints
├── server/
│   ├── api_clients.py      # Clientes HTTP para las APIs externas
│   ├── currency_tools.py   # Herramientas de divisas
│   ├── geocoding_tools.py  # Herramienta de geocodificación
│   ├── mcp_server.py       # Servidor FastMCP y registro de herramientas
│   └── weather_tools.py    # Herramientas meteorológicas
├── main_client.py          # Punto de entrada del cliente
├── main_server.py          # Punto de entrada del servidor
├── requirements.txt        # Dependencias de Python
└── README.md

外部API

結果はこれらのサービスの可用性、制限、利用規約に依存します。OpenAIの使用は、アカウントと設定されたモデルに応じてコストが発生する場合があります。

F
license - not found
-
quality - not tested
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

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

  • A
    license
    -
    quality
    D
    maintenance
    A server that integrates the MCP library with OpenAI's API, allowing users to interact with various tools, such as the weather tool, through natural language queries.
    MIT
  • F
    license
    -
    quality
    D
    maintenance
    Enables users to get current weather conditions and forecasts for any city through OpenWeatherMap API integration. Designed as a sample MCP server for the Puch AI Hackathon with basic weather querying capabilities.
  • A
    license
    -
    quality
    D
    maintenance
    A MCP server for querying real-time weather information for any city worldwide using the free Open-Meteo API, supporting CLI and integration with AI clients like Claude and Cursor.
    15
    MIT
  • F
    license
    -
    quality
    C
    maintenance
    A proof-of-concept MCP server that provides weather information using the Open-Meteo API, with tools for greeting, getting weather by coordinates, and by location name.

View all related MCP servers

Related MCP Connectors

  • MCP server for AI dialogue using various LLM models via AceDataCloud

  • MCP server for GLM chat completions using Zhipu AI models via AceDataCloud

  • Hosted MCP server connecting claude.ai, ChatGPT and other AI apps to your own computer

View all MCP Connectors

Latest Blog Posts

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/adri14gl/MCP-Weather-and-Currency-Assistant'

If you have feedback or need assistance with the MCP directory API, please join our Discord server