MCP Connector

Access and Analyze Geospatial Data via STAC

An MCP server for STAC geospatial catalog discovery - search collections/items, capability discovery with graceful fallbacks, and data-size estimation.

Works with githubdockerpodman

91
Spark score
out of 100
Updated 8 months ago
Version 2.1.2
Models
universal

Add to Favorites

Why it matters

Leverage AI assistants to search, access, and analyze vast amounts of geospatial data, including satellite imagery and metadata, through a STAC-compliant API.

Outcomes

What it gets done

01

Search and retrieve satellite imagery and metadata using STAC.

02

Perform spatial, temporal, and attribute-based queries on geospatial datasets.

03

Estimate data size without downloading using lazy loading.

04

Discover and query STAC collections and items.

Install

Add it to your toolbox

Run in your project directory:

curl -fsSL https://spark.entire.vc/get/vb-stac | bash

Capabilities

Tools your agent gets

get_root

Get the root document with id, title, description, links, and conformance information

get_conformance

Get a list of all conformance classes and optionally check specific URIs

search_collections

Get a list and search available STAC collections

get_collection

Get detailed information about a specific STAC collection

search_items

Search STAC items with spatial, temporal, and attribute filters

get_item

Get detailed information about a specific STAC item

estimate_data_size

Estimate data size for STAC items using lazy loading with XArray and odc.stac

get_queryables

Returns properties available for querying in STAC search

get_aggregations

Creates STAC Search requests with aggregation for data analysis

Overview

STAC MCP Server

An MCP server for STAC geospatial catalog discovery - collection/item search, capability-aware graceful fallbacks, and lazy-loaded, download-free data size estimation. Use when an AI assistant needs to search, browse, or estimate the size of geospatial datasets in a STAC-compliant catalog.

What it does

Gives AI assistants access to STAC (SpatioTemporal Asset Catalog) APIs for geospatial data discovery: searching and browsing collections, finding datasets like satellite imagery or weather data, accessing metadata and asset information, and running spatial and temporal queries. Every tool accepts an output_format parameter, defaulting to plain text but switchable to a structured JSON envelope for machine-readable chaining, falling back to a text_fallback mode if a specific handler has no JSON branch yet. Core tools cover the root document, conformance classes, collection search and detail, item search with spatial, temporal, and attribute filters, item detail, and a data-size estimator. Capability discovery tools support adaptive client behavior with graceful fallbacks rather than hard errors: get_conformance falls back to the root document's own conformsTo array if the dedicated endpoint is missing, get_queryables returns an empty set with an explanatory message if the catalog does not implement it, and get_aggregations attempts an aggregations-enabled search request and returns a descriptive message, preserving the original search parameters, if the catalog responds with an unsupported error instead.

The estimate_data_size tool is a distinct capability: it uses lazy loading via odc.stac to load STAC items into xarray datasets without actually downloading the data, automatically clips to the smaller of a bounding box or an AOI GeoJSON when both are given, falls back to an estimate even if odc.stac itself fails, and returns detailed metadata on data variables, spatial dimensions, and individual assets, with structured output suited to batch processing.

When to use - and when NOT to

Use it when an AI assistant needs to search, browse, or estimate the size of geospatial datasets available through a STAC-compliant catalog, such as Microsoft Planetary Computer or AWS Earth Search. It runs over stdio transport by default, installable via uvx directly from the GitHub source, or as a published container image via Docker or Podman. Development uses ruff for formatting and linting and pytest/coverage.py for testing with branch coverage enforced, and the project follows semantic versioning with automatic version bumps on merge driven by PR labels or, as a fallback, branch-name prefixes.

Capabilities

STAC catalog root, conformance, collection, and item access with dual text and JSON output, capability-aware graceful degradation for conformance, queryables, and aggregations, and lazy-loaded, download-free data size estimation with AOI clipping.

How to install

Configure the MCP client for stdio transport:

{
  "stac": {
    "command": "uvx",
    "args": [
      "--from",
      "git+https://github.com/wayfinder-foundry/stac-mcp",
      "stac-mcp"
    ],
    "transport": "stdio"
  }
}

or run the published container image with docker run --rm -i ghcr.io/wayfinder-foundry/stac-mcp:latest.

Who it's for

Developers and AI agents working with geospatial data who need to discover, query, and size STAC-catalog datasets programmatically, with structured JSON output available for downstream automated processing. The project is licensed under Apache 2.0.

Source README

STAC MCP Server

PyPI Version
Build Status
CI

Container
Python
License
PyPI Downloads
Ruff

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.

STAC Server MCP server

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
  • 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
  • estimate_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 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:

  • 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.

{
  "stac": {
    "command": "uvx",
    "args": [
      "--from",
      "git+https://github.com/wayfinder-foundry/stac-mcp",
      "stac-mcp"
    ],
    "transport": "stdio",
  }
}
Published Image
# With Docker
docker run --rm -i ghcr.io/wayfinder-foundry/stac-mcp:latest

# With Podman
podman run --rm -i ghcr.io/wayfinder-foundry/stac-mcp:latest

Examples

Example: JSON Output Mode

Below is an illustrative (client-side) pseudo-call showing output_format usage through an MCP client message:

{
  "method": "tools/call",
  "params": {
    "name": "search_items",
    "arguments": {
      "collections": ["landsat-c2l2-sr"],
      "bbox": [-122.5, 37.7, -122.3, 37.8],
      "datetime": "2023-01-01/2023-01-31",
      "limit": 5,
      "output_format": "json"
    }
  }
}

The server responds with a single TextContent whose text is a JSON string like:

{"mode":"json","data":{"type":"item_list","count":5,"items":[{"id":"..."}]}}

This wrapping keeps the MCP content type stable while enabling machine-readable chaining.

Development

Local Development
git clone https://github.com/wayfinder-foundry/stac-mcp.git
cd stac-mcp
pip install -e ".[dev]"

For local development with containers, you can use VS Code's Remote Containers extension with the provided .devcontainer configuration.

Testing

pytest -v
Test Coverage

The project uses coverage.py (already a dependency was added) for measuring statement and branch coverage.

Quick run (terminal):

coverage run -m pytest -q
coverage report -m

Example output (illustrative):

Name                                Stmts   Miss Branch BrMiss  Cover
---------------------------------------------------------------------
stac_mcp/observability.py             185      4     42      3    96%
stac_mcp/tools/execution.py            68      2     18      1    94%
... (others) ...
---------------------------------------------------------------------
TOTAL                                 620     20    140      9    96%

Generate an HTML report (optional):

coverage html
open htmlcov/index.html  # macOS

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:

  1. ruff format stac_mcp/ tests/
  2. ruff check stac_mcp/ tests/ --fix
  3. coverage run -m pytest -q
  4. coverage report -m (ensure no unexpected drops)

Linting

ruff format stac_mcp/ tests/
ruff check stac_mcp/ tests/ --fix --no-cache

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):

# Show current version
python scripts/version.py current

# Increment version based on change type
python scripts/version.py patch    # Bug fixes (0.1.0 -> 0.1.1)
python scripts/version.py minor    # New features (0.1.0 -> 0.2.0)  
python scripts/version.py major    # Breaking changes (0.1.0 -> 1.0.0)

# Set specific version
python scripts/version.py set 1.2.3

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:

# Build development image
docker build -f Containerfile -t stac-mcp:dev .

# Test the container
docker run --rm -i stac-mcp:dev

# Using docker-compose for development
docker-compose up --build

# For debugging, use an interactive shell (requires modifying Containerfile)
# docker run --rm -it --entrypoint=/bin/sh stac-mcp:dev

Current Containerfile (single-stage) notes:

  • Based on python:3.12-slim for 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

STAC Resources

FAQ

Common questions

Discussion

Questions & comments · 0

Sign In Sign in to leave a comment.