MCP Weather and Currency Assistant
MCPを利用した金融・天気アシスタント
ローカルのMCPサーバーとOpenAI Responses APIを組み合わせたコマンドラインアプリケーションです。このアシスタントは自然言語のクエリを理解し、サーバーが公開するツールを自動検出して実行し、最新の為替レートと気象データを取得します。
このプロジェクトはFastMCP、ExchangeRate-API、Open-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ツール
ツール名 | 説明 |
| 現在のレートを使用して、2つの通貨間で金額を換算します。 |
| 基準通貨に対する複数の通貨のレートを返します。 |
| 都市の座標、国、タイムゾーンを取得します。 |
| 現在の気温、体感温度、湿度、風速、天気状態を取得します。 |
| 今後数日間の気温、降水確率、天気状態を返します。 |
必要条件
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 .envmacOSまたは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-miniOPENAI_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で使用可能なコマンド:
コマンド | アクション |
| ツールとクエリの例を表示します。 |
| 一般的な通貨コードを表示します。 |
| クライアントを終了します。 |
プロジェクト構造
.
├── .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 Responses API: クエリの解釈とツールの選択
ExchangeRate-API: 為替レートと換算
Open-Meteo: ジオコーディングと気象データ
結果はこれらのサービスの可用性、制限、利用規約に依存します。OpenAIの使用は、アカウントと設定されたモデルに応じてコストが発生する場合があります。
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
- Alicense-qualityDmaintenanceA 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
- Flicense-qualityDmaintenanceEnables 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.
- Alicense-qualityDmaintenanceA 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.15MIT
- Flicense-qualityCmaintenanceA 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.
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
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/adri14gl/MCP-Weather-and-Currency-Assistant'
If you have feedback or need assistance with the MCP directory API, please join our Discord server