STAC MCP Server
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
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 main by 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 URIs
- **get_capabilities**: Get a summary of STAC API capabilities (query, sort, fields, queryables, aggregation, filter)
- **search_collections**: List and search available STAC collections
- **get_collection**: Get detailed information about a specific collection
- **search_items**: Search for STAC items with spatial, temporal, and attribute filters
- **get_item**: Get detailed information about a specific STAC item
- **get_queryables**: Get queryable properties for a collection
- **get_aggregations**: Get aggregations for STAC items
- **estimate_data_size**: Estimate data size for STAC items using lazy loading (XArray + odc.stac)
Search Parameters
The search_items tool supports comprehensive STAC API search parameters:
- **collections**: One or more collection IDs to search
- **bbox**: Bounding box [west, south, east, north] or GeoJSON geometry
- **datetime**: Datetime filter (e.g., "2020-01-01/2020-12-31")
- **limit**: Maximum number of items to return
- **query**: Query filter for properties
- **fields**: List of fields to include/exclude (e.g., ["id", "properties.datetime"])
- **intersects**: GeoJSON geometry for spatial intersection queries
- **ids**: List of specific item IDs to retrieve (batch fetch)
- **sortby**: Sort order (e.g., ["-properties.datetime"] for descending)
- **sign_assets**: If True and catalog is Planetary Computer, sign asset URLs for direct access
Pagination Support
Search responses include pagination metadata with cursor-based navigation links:
Planetary Computer Asset Signing
When working with Microsoft Planetary Computer catalogs, you can enable asset signing to get signed URLs for direct asset access:
Capability Discovery & Aggregations
The new capability tools (ADR 0004) allow adaptive client behavior:
- Graceful fallbacks: Missing /conformance, /queryables, or aggregation support returns structured JSON with supported:false instead of hard errors.
- get_conformance falls back to the root document's conformsTo array when the dedicated endpoint is absent.
- get_queryables returns an empty set with a message if the endpoint is not implemented by the catalog.
- get_aggregations constructs a STAC Search request with an aggregations object; 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: