The STAC MCP Server enables AI assistants and applications to interact with STAC catalogs for geospatial data discovery and access.
Core Capabilities:
Search and browse collections - List available STAC collections with customizable limits
Get detailed collection/item information - Retrieve comprehensive metadata about specific collections and items
Advanced geospatial search - Find STAC items using spatial filters (bounding boxes, GeoJSON AOI), temporal ranges, and custom query parameters
Estimate data sizes - Calculate dataset sizes using lazy loading without downloading actual data
Multi-catalog support - Connect to Microsoft Planetary Computer or any STAC-compliant API
Area of Interest clipping - Automatically clip data to the smallest area when both bbox and GeoJSON AOI are provided
Batch processing - Handle multiple items efficiently with structured metadata retention
Provides access to STAC (SpatioTemporal Asset Catalog) APIs for discovering and accessing geospatial datasets including satellite imagery and weather data, with support for spatial and temporal queries across STAC-compliant catalogs
STAC MCP Server
An MCP (Model Context Protocol) Server that provides access to STAC (SpatioTemporal Asset Catalog) APIs for geospatial data discovery and access. Supports dual output modes (text and structured json) for all tools.
The coverage badge is updated automatically on pushes to
mainby the CI workflow.
Overview
This MCP server enables AI assistants and applications to interact with STAC catalogs to:
Search and browse STAC collections
Find geospatial datasets (satellite imagery, weather data, etc.)
Access metadata and asset information
Perform spatial and temporal queries
Features
Available Tools
All tools accept an optional output_format parameter ("text" default, or "json"). JSON mode returns a single MCP TextContent whose text field is a compact JSON envelope: { "mode": "json", "data": { ... } } (or { "mode": "text_fallback", "content": ["..."] } if a handler lacks a JSON branch). This preserves backward compatibility while enabling structured consumption (see ADR 0006 and ASR 1003).
get_root: Fetch root document (id/title/description/links/conformance subset)get_conformance: List all conformance classes; optionally verify specific URIssearch_collections: List and search available STAC collectionsget_collection: Get detailed information about a specific collectionsearch_items: Search for STAC items with spatial, temporal, and attribute filtersget_item: Get detailed information about a specific STAC itemestimate_data_size: Estimate data size for STAC items using lazy loading (XArray + odc.stac)
Capability Discovery & Aggregations
The new capability tools (ADR 0004) allow adaptive client behavior:
Graceful fallbacks: Missing
/conformance,/queryables, or aggregation support returns structured JSON withsupported:falseinstead of hard errors.get_conformancefalls back to the root document'sconformsToarray when the dedicated endpoint is absent.get_queryablesreturns an empty set with a message if the endpoint is not implemented by the catalog.get_aggregationsconstructs a STAC Search request with anaggregationsobject; if unsupported (HTTP 400/404), it returns a descriptive message while preserving original search parameters.
Data Size Estimation
The estimate_data_size tool provides accurate size estimates for geospatial datasets without downloading the actual data:
Lazy Loading: Uses odc.stac to load STAC items into xarray datasets without downloading
AOI Clipping: Automatically clips to the smallest area when both bbox and AOI GeoJSON are provided
Fallback Estimation: Provides size estimates even when odc.stac fails
Detailed Metadata: Returns information about data variables, spatial dimensions, and individual assets
Batch Support: Retains structured metadata for efficient batch processing
Usage
MCP Protocol / Server Configuration
The server implements the Model Context Protocol (MCP) for standardized communication.
Published Image
Examples
Example: JSON Output Mode
Below is an illustrative (client-side) pseudo-call showing output_format usage through an MCP client message:
The server responds with a single TextContent whose text is a JSON string like:
This wrapping keeps the MCP content type stable while enabling machine-readable chaining.
Development
Local Development
For local development with containers, you can use VS Code's Remote Containers extension with the provided .devcontainer configuration.
Testing
Test Coverage
The project uses coverage.py (already a dependency was added) for measuring statement and branch coverage.
Quick run (terminal):
Example output (illustrative):
Generate an HTML report (optional):
Configuration: .coveragerc enforces branch = True and omits tests/* and scripts/version.py. Update omit patterns only when necessary to keep metrics honest.
Recommended workflow before opening a PR:
ruff format stac_mcp/ tests/ruff check stac_mcp/ tests/ --fixcoverage run -m pytest -qcoverage report -m(ensure no unexpected drops)
Linting
Version Management
The project uses semantic versioning (SemVer) with automated version management based on PR labels or branch naming, implemented in .github/workflows/container.yml.
Automatic Versioning
When PRs are merged to main, the workflow determines the version increment using either PR labels or branch prefixes:
PR Labels (Recommended for Automated Tools)
Labels take priority over branch prefixes. Add one of these labels to your PR:
bump:patch or bump:hotfix → patch increment (0.1.0 → 0.1.1) for bug fixes
bump:minor or bump:feature → minor increment (0.1.0 → 0.2.0) for new features
bump:major or bump:release → major increment (0.1.0 → 1.0.0) for breaking changes
Branch Prefixes (For Human Contributors)
If no version bump label is present, the workflow falls back to branch prefix detection:
hotfix/, fix/, copilot/fix-, or copilot/hotfix/ branches → patch increment (0.1.0 → 0.1.1) for bug fixes
feature/ or copilot/feature/ branches → minor increment (0.1.0 → 0.2.0) for new features
release/ or copilot/release/ branches → major increment (0.1.0 → 1.0.0) for breaking changes
See CONTRIBUTING.md for detailed guidelines on version bumping.
Manual Version Management
You can also manually manage versions using the version script (should normally not be needed unless doing a coordinated release):
The version system maintains consistency across:
pyproject.toml(project version)stac_mcp/__init__.py(version)stac_mcp/server.py(server_version in MCP initialization)
Container Development
To develop with containers:
Current Containerfile (single-stage) notes:
Based on
python:3.12-slimfor broad wheel compatibility (rasterio, shapely, etc.)Installs GDAL/PROJ system libraries needed by rasterio/odc-stac
Installs the package with
pip install .Entrypoint:
python -m stac_mcp.server(stdio MCP transport)Multi-stage/distroless hardening can be reintroduced later (tracked by potential future ADR)
Documentation
FastMCP Guidelines and Architecture
STAC MCP includes comprehensive documentation for FastMCP patterns and agentic geospatial reasoning:
FastMCP Documentation: Complete guide to MCP decorators, resources, tools, and prompts for STAC workflows
DECORATORS.md: Choosing the right decorator for STAC operations
GUIDELINES.md: FastMCP architecture and usage patterns
PROMPTS.md: Agentic STAC search reasoning and methodology
RESOURCES.md: STAC catalog discovery and metadata patterns
CONTEXT.md: Context usage for logging and progress tracking
These documents provide guidance for:
AI agents reasoning about STAC catalog searches
Developers implementing STAC MCP features
Understanding the planned FastMCP integration (issues #69, #78)
Additional Documentation
Test Coverage Strategy: Testing approach and coverage goals
STAC Resources
License
Apache 2.0 - see LICENSE file for details.