The UNICEF Google Earth Engine (GEE) MCP Server provides access to geospatial data and analysis capabilities through Google Earth Engine. This Model Context Protocol (MCP) server exposes specialized tools for querying, processing, and visualizing geospatial datasets related to children's environmental risks and demographics.
This MCP server serves as the geospatial data backend for the UNICEF Geosphere project, providing access to:
- Hazard Datasets: Natural disaster and climate risk data (floods, droughts, heatwaves, storms)
- Demographic Data: Population and children-specific spatial datasets
- Spatial Analysis: Advanced geospatial processing and visualization tools
- Dataset Discovery: Browse available hazard and demographic datasets
- Image Processing: Filter, mask, threshold, and combine geospatial images
- Feature Operations: Spatial intersections, unions, and merging
- Spatial Analysis: Zonal statistics and area calculations
- Map Generation: Interactive HTML map creation with visualizations
- Multi-hazard Analysis: Combine different hazard datasets
- Population Exposure: Calculate children at risk from environmental hazards
- Custom Visualizations: Generate maps with UNICEF-specific styling
- Google Earth Engine: Planetary-scale geospatial analysis, official GEE client library
- FastMCP: Model Context Protocol server framework
- Folium: Interactive map generation
ee_mcp/
├── server.py # MCP server and tool definitions
├── handlers.py # Tool implementation and business logic
├── config.py # Configuration and settings management
├── initialize.py # Google Earth Engine authentication setup
├── datasets.py # Dataset catalog and metadata
├── utils.py # Utility functions for data processing
├── schemas.py # Pydantic models and validation
├── constants.py # Application constants
├── hazards_metadata.yaml # Comprehensive dataset metadata
├── config.yaml # Server configuration
└── logging_config.py # Logging setup
Before setting up the UNICEF GEE MCP Server, ensure you have:
- An active Google Cloud Project with Earth Engine API enabled
- A dedicated service account with JSON key file for server authentication
- Earth Engine access permissions granted to the service account
- Permissions to access UNICEF's private Earth Engine assets
# Install dependencies using uv
uv sync
- Create service account in Google Cloud Console
- Download JSON key file
- Enable Earth Engine API for your project
- Grant Earth Engine access to the service account
The server requires Google Earth Engine authentication via service account:
# Set service account credentials
export GOOGLE_APPLICATION_CREDENTIALS="/path/to/service-account.json"
# Or mount as Docker secret
/run/secrets/ee_auth.json
ee_mcp/config.yaml
:
server:
host: "0.0.0.0" # Server bind address
port: 8003 # Server port
transport: "sse" # MCP transport protocol
The server uses hazards_metadata.yaml
for dataset definitions. Each dataset entry must include the following fields:
Required Fields:
asset_id
(string): Google Earth Engine asset identifier for the datasetimage_filename
(string): JSON filename for cached image datadescription
(string): Human-readable description of the dataset and its purposemosaic
(boolean): Whether the dataset should be processed as a mosaic or single imagesource_name
(string): Name of the data source organizationsource_url
(string): URL to the original data source or documentationcolor_palette
(array): List of hex color codes for visualization (from low to high values)
Optional Fields:
threshold
(number): Default threshold value for filtering or classification
Example Configuration:
The MCP server exposes 12 specialized tools for geospatial analysis:
Returns comprehensive information about all available datasets.
Returns: Dictionary with dataset IDs, descriptions, sources, and visualization parameters.
Retrieves a specific dataset image with its metadata.
Parameters:
dataset_id
: Identifier for the dataset (e.g., "river_flood", "agricultural_drought")
Returns: Earth Engine Image object with metadata.
Applies a spatial mask to an image using a geometry.
Parameters:
image_data
: Serialized Earth Engine Imagegeometry_data
: Serialized Earth Engine Geometry for masking
Returns: Masked image with only values within the geometry.
Filters image pixels based on value thresholds.
Parameters:
image_data
: Serialized Earth Engine Imagethreshold
: Numeric threshold valuecomparison
: Comparison operator ("gt", "gte", "lt", "lte", "eq")
Returns: Binary image with pixels meeting the threshold condition.
Creates a union (OR operation) of two binary images.
Returns: Combined image showing areas where either input image has values.
Creates an intersection (AND operation) of two binary images.
Returns: Combined image showing areas where both input images have values.
Finds spatial intersection between two feature collections.
Parameters:
fc1_data
: Serialized Earth Engine FeatureCollectionfc2_data
: Serialized Earth Engine FeatureCollection
Returns: Features that spatially intersect between the two collections.
Combines two feature collections into one.
Returns: Merged FeatureCollection containing all features from both inputs.
Performs spatial reduction (statistics) over an image within a geometry.
Parameters:
image_data
: Serialized Earth Engine Imagegeometry_data
: Serialized Earth Engine Geometryreducer
: Reduction operation ("sum", "mean", "count", "max", "min")
Returns: Statistical result of the reduction operation.
Creates a buffer zone around a geometry.
Parameters:
geometry_data
: Serialized Earth Engine Geometrybuffer_distance
: Buffer distance in meters
Returns: Buffered geometry representing the zone of area.
Generates an interactive HTML map visualization.
Parameters:
image_data
: Serialized Earth Engine Imagegeometry_data
: Serialized Earth Engine Geometryvis_params
: Visualization parameters (colors, opacity, etc.)
Returns: HTML string containing interactive map with data layers.
# Development mode
mcp dev ee_mcp/server.py
# Production mode
uv run ee_mcp/server.py
# Run all tests
uv run pytest
# Run integration tests
uv run pytest tests/test_integration.py -v
- Clone repository
- Install dependencies:
uv sync
- Set up GEE authentication
- Configure test environment
- Run tests to verify setup
- Service Account Keys: Securely managed via Docker secrets
- Least Privilege: Service account has minimal required permissions
- Private Assets: UNICEF datasets stored in private Earth Engine assets
- Network Security: Server accessible only within internal network
- Code Style: Follow PEP 8 and use type hints
- Testing: Add comprehensive tests for new tools
- Documentation: Update tool descriptions and examples
- Define tool in
server.py
with@mcp.tool()
decorator - Implement handler in
handlers.py
- Add validation schemas in
schemas.py
- Write tests in
tests/test_handlers.py
- Update documentation in README
- Add metadata to
hazards_metadata.yaml
- Verify asset permissions for Earth Engine assets
- Test data access with integration tests
- Document data sources and licensing
This project is licensed under the MIT License. See the LICENSE file for details.
- Issues: Submit issues on GitHub repository
- Earth Engine Support: Google Earth Engine Help Center
- UNICEF Data: Contact UNICEF data team for asset access
- Technical Support: Repository maintainers