AQICN MCP Server

by mattmarcin
MIT License
  • Linux
  • Apple

AQICN MCP サーバー

これは、世界大気質指標(AQICN)プロジェクトの大気質データツールを提供するモデルコンテキストプロトコル(MCP)サーバーです。これにより、LLMは世界中の都市と座標のリアルタイム大気質データを取得できます。

インストール

Smithery経由でインストール

Smithery経由で Claude Desktop 用の AQICN MCP Server を自動的にインストールするには:

npx -y @smithery/cli install @mattmarcin/aqicn-mcp --client claude

推奨UV(手動)によるインストール

Python 環境を管理するには、 uvを使用することをお勧めします。

# Install the package and dependencies uv pip install -e .

環境設定

プロジェクト ルートに.envファイルを作成します ( .env.exampleからコピーできます)。

# .env AQICN_API_KEY=your_api_key_here

あるいは、環境変数を直接設定することもできます。

# Linux/macOS export AQICN_API_KEY=your_api_key_here # Windows set AQICN_API_KEY=your_api_key_here

サーバーの実行

開発モード

サーバーをテストおよびデバッグする最も速い方法は、MCP Inspector を使用することです。

mcp dev aqicn_server.py

クロードデスクトップ統合

サーバーの準備ができたら、Claude Desktop にインストールします。

mcp install aqicn_server.py

直接実行

テストまたはカスタム展開の場合:

python aqicn_server.py

利用可能なツール

1. シティアキ

特定の都市の空気質データを取得します。

@mcp.tool() def city_aqi(city: str) -> AQIData: """Get air quality data for a specific city."""

入力:

  • city : 空気質データを取得する都市の名前

出力: AQIDataと次の内容:

  • aqi :大気質指数値
  • station :駅名
  • dominant_pollutant : 主な汚染物質(存在する場合)
  • time : 測定のタイムスタンプ
  • coordinates :駅の緯度と経度

2. geo_aqi

座標を使用して特定の場所の空気質データを取得します。

@mcp.tool() def geo_aqi(latitude: float, longitude: float) -> AQIData: """Get air quality data for a specific location using coordinates."""

入力:

  • latitude : 場所の緯度
  • longitude : 場所の経度

出力: city_aqiと同じ

3. 検索ステーション

キーワードで空気質監視ステーションを検索します。

@mcp.tool() def search_station(keyword: str) -> list[StationInfo]: """Search for air quality monitoring stations by keyword."""

入力:

  • keyword :駅を検索するためのキーワード(都市名、駅名など)

**出力:**次の内容を含むStationInfoのリスト:

  • name :駅名
  • station_id : 一意の駅識別子
  • coordinates :駅の緯度と経度

使用例

MCP Python クライアントの使用:

from mcp import Client async with Client() as client: # Get air quality data for Beijing beijing_data = await client.city_aqi(city="beijing") print(f"Beijing AQI: {beijing_data.aqi}") # Get air quality data by coordinates (Tokyo) geo_data = await client.geo_aqi(latitude=35.6762, longitude=139.6503) print(f"Tokyo AQI: {geo_data.aqi}") # Search for stations stations = await client.search_station(keyword="london") for station in stations: print(f"Station: {station.name} ({station.coordinates})")

貢献

お気軽に問題提起やプルリクエストを行ってください。変更には適切なテストとドキュメントが含まれていることをご確認ください。

ライセンス

このプロジェクトは MIT ライセンスに基づいてライセンスされています。

-
security - not tested
A
license - permissive license
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

モデル コンテキスト プロトコル (MCP) を介して、世界大気質指数とのやり取りを可能にし、世界中の都市と座標のリアルタイムの大気質データを取得します。

  1. Installation
    1. Installing via Smithery
    2. Installing via recommended uv (manual)
  2. Environment Setup
    1. Running the Server
      1. Development Mode
      2. Claude Desktop Integration
      3. Direct Execution
    2. Available Tools
      1. 1. city_aqi
      2. 2. geo_aqi
      3. 3. search_station
    3. Example Usage
      1. Contributing
        1. License

          Related MCP Servers

          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol server that retrieves current weather information for specified cities using the Open-Meteo API, requiring no API key.
            Last updated -
            Python
            Apache 2.0
            • Linux
            • Apple
          • -
            security
            F
            license
            -
            quality
            Provides current weather and air quality data for any city using WeatherAPI, easily integrating with MCP clients like n8n and Claude Desktop App.
            Last updated -
            214
            JavaScript
          • -
            security
            -
            license
            -
            quality
            Provides a Model Context Protocol server that enables large language models to query and retrieve real-time weather forecasts for cities and regions across China.
            Last updated -
            Python
          • A
            security
            A
            license
            A
            quality
            Model Context Protocol (MCP) server that provides weather forecast, warnings, water level associated with flood, and earthquake reports from Malaysia Government's Open API.
            Last updated -
            4
            Python
            MIT License

          View all related MCP servers

          ID: pi3py17y7w