Google Air Quality MCP
G

Google Air Quality MCP

2 points
3.8K

Installation

Copy the following command to your Client for configuration
Note: Your key is sensitive information, do not share it with anyone.

๐Ÿš€ Google Air Quality MCP Server

This Model Context Protocol (MCP) server offers access to Google's Air Quality API, allowing AI assistants to obtain real - time air quality data, forecasts, historical information, and heatmap visualizations.

๐Ÿš€ Quick Start

The Google Air Quality MCP Server enables seamless access to Google's Air Quality API. Follow the steps below to get started:

  1. Ensure you have Go 1.21 or higher installed and obtain a Google Air Quality API key.
  2. Clone the repository, install dependencies, and configure environment variables.
  3. Run the server and start exploring air quality data.

โœจ Features

  • ๐ŸŒ Real - time Air Quality Data: Get current air quality conditions for any location worldwide.
  • ๐Ÿ“Š Forecasts: Hourly air quality predictions.
  • ๐Ÿ“ˆ Historical Data: Access past air quality measurements.
  • ๐Ÿ—บ๏ธ Heatmap Visualizations: Generate air quality heatmap tiles.
  • ๐Ÿค– LLM - Friendly Prompts: Use natural language for location queries.
  • ๐Ÿ“ฆ MCP Resources: Access structured data via URI templates.

๐Ÿ“ฆ Installation

Prerequisites

  • Go 1.21 or higher
  • Google Air Quality API key (see API Key Setup)

Steps

  1. Clone the repository
git clone git@github.com:ContexaAI/google-air-quality-mcp.git
cd google-air-quality-mcp
  1. Install dependencies
go mod download
  1. Configure environment variables

Create a .env file in the project root:

GOOGLE_AIR_QUALITY_API_KEY=your_api_key_here
MCP_SERVER_NAME=Google Air Quality MCP Server
PORT=8080

๐Ÿ“š Documentation

API Key Setup

Step 1: Enable the API

  1. Go to the Google Cloud Console.
  2. Create a new project or select an existing one.
  3. Navigate to APIs & Services > Library.
  4. Search for "Air Quality API".
  5. Click Enable.

Step 2: Create API Credentials

  1. Go to APIs & Services > Credentials.
  2. Click Create Credentials > API Key.
  3. Copy the generated API key.
  4. (Recommended) Click Restrict Key and:
    • Under API restrictions, select "Restrict key".
    • Choose "Air Quality API" from the dropdown.
    • Under Application restrictions, you can restrict by IP, HTTP referrer, etc.

Step 3: Configure the Server

Add your API key to the .env file:

GOOGLE_AIR_QUALITY_API_KEY=AIzaSyD...your-key-here

โš ๏ธ Important Note

The Air Quality API may require billing to be enabled on your Google Cloud project. Check the pricing page for details.

Usage

Running the Server

go run cmd/server/main.go

The server will start on http://localhost:8080 with the MCP endpoint at /mcp.

Connecting with MCP Inspector

  1. Open MCP Inspector.
  2. Connect to http://localhost:8080/mcp.
  3. Explore available tools, prompts, and resources.

API Reference

Tools

Property Details
Tool Name get_current_air_quality, get_air_quality_forecast, get_air_quality_history, get_air_quality_heatmap_tile
Description Get current air quality conditions, hourly forecasts, historical data, and heatmap tiles respectively
Required Parameters Vary by tool, e.g., latitude and longitude for most tools
Optional Parameters Vary by tool, e.g., universalAqi, languageCode etc.

Valid Map Types for Heatmap

  • UAQI_RED_GREEN - Universal AQI with red - green color palette
  • UAQI_INDIGO_PERSIAN - Universal AQI with indigo - persian palette
  • PM25_INDIGO_PERSIAN - PM2.5 concentration heatmap
  • GBR_DEFRA - UK DEFRA index
  • DEU_UBA - German UBA index
  • CAN_EC - Canadian AQHI
  • FRA_ATMO - French ATMO index
  • US_AQI - US EPA AQI

Prompts

Property Details
Prompt Name current_air_quality_by_location_prompt, air_quality_forecast_by_location_prompt etc.
Description Use natural language location names to get air quality data
Arguments Vary by prompt, e.g., location for most prompts

Resources

Property Details
Resource URI example://server-info
Type Static
Description Basic server information and available resources
Content Type text/plain

Examples

๐Ÿ’ป Usage Examples

Basic Usage
{
  "name": "get_current_air_quality",
  "arguments": {
    "latitude": 37.7749,
    "longitude": -122.4194,
    "universalAqi": true
  }
}

This code gets the current air quality for San Francisco.

Advanced Usage
{
  "name": "get_air_quality_forecast",
  "arguments": {
    "latitude": 40.7128,
    "longitude": -74.0060,
    "pageSize": 24
  }
}

This code gets a 24 - hour air quality forecast for New York.

Project Structure

.
โ”œโ”€โ”€ cmd/
โ”‚   โ””โ”€โ”€ server/              # Server entry point
โ”œโ”€โ”€ internal/
โ”‚   โ”œโ”€โ”€ capabilities/        # MCP capabilities
โ”‚   โ”‚   โ”œโ”€โ”€ prompts/        # Prompt definitions and handlers
โ”‚   โ”‚   โ”œโ”€โ”€ resources/      # Resource definitions and handlers
โ”‚   โ”‚   โ””โ”€โ”€ tools/          # Tool implementations
โ”‚   โ”‚       โ”œโ”€โ”€ client.go   # Google Air Quality API client
โ”‚   โ”‚       โ”œโ”€โ”€ types.go    # Shared types and structures
โ”‚   โ”‚       โ”œโ”€โ”€ current_conditions.go
โ”‚   โ”‚       โ”œโ”€โ”€ forecast.go
โ”‚   โ”‚       โ”œโ”€โ”€ history.go
โ”‚   โ”‚       โ””โ”€โ”€ heatmap.go
โ”‚   โ”œโ”€โ”€ config/             # Configuration management
โ”‚   โ””โ”€โ”€ mcp/                # MCP server setup
โ”œโ”€โ”€ .env                    # Environment variables (not in git)
โ”œโ”€โ”€ .gitignore
โ”œโ”€โ”€ go.mod
โ”œโ”€โ”€ go.sum
โ””โ”€โ”€ README.md

Development

Building

go build -o bin/server cmd/server/main.go

Running

./bin/server

Testing

go test ./...

Configuration

Property Details
Variable GOOGLE_AIR_QUALITY_API_KEY, MCP_SERVER_NAME, PORT
Description Google Air Quality API key, display name for MCP server, HTTP server port
Default - for GOOGLE_AIR_QUALITY_API_KEY, Google Air Quality MCP Server for MCP_SERVER_NAME, 8080 for PORT
Required Yes for GOOGLE_AIR_QUALITY_API_KEY, No for others

Troubleshooting

API Key Issues

  • Error: "API key not valid"
    • Verify your API key is correct in .env.
    • Ensure the Air Quality API is enabled in Google Cloud Console.
    • Check that API restrictions (if any) allow requests from your IP.
  • Error: "This API method requires billing to be enabled"
    • Enable billing on your Google Cloud project.
    • The Air Quality API may have usage costs.

Connection Issues

  • Error: "address already in use"
    • Another process is using port 8080.
    • Kill the process: npx kill - port 8080.
    • Or change the PORT in .env.

๐Ÿ“„ License

This project is licensed under the MIT license.

๐Ÿ”— Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

๐Ÿ“š Resources

๐Ÿ†˜ Support

For issues and questions:

Alternatives

P
Praisonai
PraisonAI is a production-ready multi-AI agent framework with self-reflection capabilities, designed to create AI agents to automate the solution of various problems from simple tasks to complex challenges. It simplifies the construction and management of multi-agent LLM systems by integrating PraisonAI agents, AG2, and CrewAI into a low-code solution, emphasizing simplicity, customization, and effective human-machine collaboration.
Python
7.3K
5 points
M
MCP Server
The Mapbox MCP Server is a model context protocol server implemented in Node.js, providing AI applications with access to Mapbox geospatial APIs, including functions such as geocoding, point - of - interest search, route planning, isochrone analysis, and static map generation.
TypeScript
8.8K
4 points
M
Maverick MCP
MaverickMCP is a personal stock analysis server based on FastMCP 2.0, providing professional level financial data analysis, technical indicator calculation, and investment portfolio optimization tools for MCP clients such as Claude Desktop. It comes pre-set with 520 S&P 500 stock data, supports multiple technical analysis strategies and parallel processing, and can run locally without complex authentication.
Python
9.2K
4 points
K
Klavis
Klavis AI is an open-source project that provides a simple and easy-to-use MCP (Model Context Protocol) service on Slack, Discord, and Web platforms. It includes various functions such as report generation, YouTube tools, and document conversion, supporting non-technical users and developers to use AI workflows.
TypeScript
18.0K
5 points
S
Scrapling
Scrapling is an adaptive web scraping library that can automatically learn website changes and re - locate elements. It supports multiple scraping methods and AI integration, providing high - performance parsing and a developer - friendly experience.
Python
13.0K
5 points
A
Apple Health MCP
An MCP server for querying Apple Health data via SQL, implemented based on DuckDB for efficient analysis, supporting natural language queries and automatic report generation.
TypeScript
10.4K
4.5 points
M
MCP Server Airbnb
Certified
MCP service for Airbnb listing search and details query
TypeScript
14.8K
4 points
B
Baidu Map
Certified
Baidu Maps MCP Server is the first domestic map service compatible with the MCP protocol, offering 10 standardized API interfaces such as geocoding and route planning, supporting quick access via Python and Typescript, and enabling agents to implement map - related functions.
Python
32.8K
4.5 points
N
Notion Api MCP
Certified
A Python-based MCP Server that provides advanced to-do list management and content organization functions through the Notion API, enabling seamless integration between AI models and Notion.
Python
19.1K
4.5 points
M
Markdownify MCP
Markdownify is a multi-functional file conversion service that supports converting multiple formats such as PDFs, images, audio, and web page content into Markdown format.
TypeScript
30.3K
5 points
G
Gitlab MCP Server
Certified
The GitLab MCP server is a project based on the Model Context Protocol that provides a comprehensive toolset for interacting with GitLab accounts, including code review, merge request management, CI/CD configuration, and other functions.
TypeScript
21.9K
4.3 points
D
Duckduckgo MCP Server
Certified
The DuckDuckGo Search MCP Server provides web search and content scraping services for LLMs such as Claude.
Python
63.7K
4.3 points
U
Unity
Certified
UnityMCP is a Unity editor plugin that implements the Model Context Protocol (MCP), providing seamless integration between Unity and AI assistants, including real - time state monitoring, remote command execution, and log functions.
C#
27.1K
5 points
F
Figma Context MCP
Framelink Figma MCP Server is a server that provides access to Figma design data for AI programming tools (such as Cursor). By simplifying the Figma API response, it helps AI more accurately achieve one - click conversion from design to code.
TypeScript
58.1K
4.5 points
G
Gmail MCP Server
A Gmail automatic authentication MCP server designed for Claude Desktop, supporting Gmail management through natural language interaction, including complete functions such as sending emails, label management, and batch operations.
TypeScript
19.9K
4.5 points
M
Minimax MCP Server
The MiniMax Model Context Protocol (MCP) is an official server that supports interaction with powerful text-to-speech, video/image generation APIs, and is suitable for various client tools such as Claude Desktop and Cursor.
Python
41.5K
4.8 points