EO-MCP
A Python MCP server for discovering and analyzing Sentinel-2 L2A imagery, enabling AI agents to search scenes, check quality, and compute spectral indices like NDVI, NDWI, and NBR from remote COG windows.
README
EO-MCP
EO-MCP is a Python Model Context Protocol (MCP) server for discovering and analysing Sentinel-2 Level-2A imagery. It gives AI agents a small, focused toolset for finding scenes, checking their suitability, computing spectral indices, and summarising an index inside a polygon.
The server reads only the required windows from cloud-optimized GeoTIFFs hosted by the Microsoft Planetary Computer. It does not download complete Sentinel-2 scenes.
Features
- Search the live Sentinel-2 L2A STAC catalog by bounding box, date, and cloud cover.
- Inspect scene-level cloud and nodata metadata before performing analysis.
- Confirm that a scene footprint covers the requested area of interest.
- Compute NDVI, NDWI, and NBR from remote raster windows.
- Calculate polygon-clipped min, max, mean, and pixel count.
- Return structured, agent-friendly results with processing metadata.
The intended workflow is:
stac_search → scene_quality → compute_index
└─→ quick_stats
Always call scene_quality before computing an index.
Tools
| Tool | Purpose | Key inputs |
|---|---|---|
stac_search |
Find the clearest Sentinel-2 L2A scenes intersecting an area. | bbox, start_date, end_date, max_cloud_cover, limit |
scene_quality |
Check cloud cover, nodata, and scene-footprint coverage. | scene_id, bbox |
compute_index |
Compute summary statistics for NDVI, NDWI, or NBR over a rectangular area. | scene_id, bbox, index_name |
quick_stats |
Compute index statistics clipped to a WGS84 GeoJSON Polygon or MultiPolygon. | scene_id, polygon, index_name, all_touched |
Bounding boxes use WGS84 coordinates in this order:
[west, south, east, north]
Dates use ISO YYYY-MM-DD format.
Supported indices
| Index | Formula | Typical use |
|---|---|---|
| NDVI | (B08 - B04) / (B08 + B04) |
Vegetation condition and greenness |
| NDWI | (B03 - B08) / (B03 + B08) |
Surface-water detection |
| NBR | (B08 - B12) / (B08 + B12) |
Burn severity and fire impact |
Sentinel-2 digital numbers are converted to reflectance before the index is calculated. EO-MCP also accounts for the offset introduced with processing baseline 04.00 and later.
Requirements
- Python 3.12 or newer
uv- Internet access to the Planetary Computer STAC API and Sentinel-2 COG assets
No Planetary Computer API key is required for the current public-data workflow.
Quick start
From the repository root:
uv sync --frozen
uv run python -c "import eo_mcp; print('eo_mcp import: ok')"
uv run fastmcp inspect src/eo_mcp/app.py
The inspect command should report the server name EO-MCP and four tools.
To start the STDIO server manually:
uv run fastmcp run src/eo_mcp/app.py
An STDIO server waits for an MCP client and usually produces no interactive
prompt. Use an MCP client or fastmcp call to invoke its tools.
Test from the command line
Search for Sentinel-2 scenes:
uv run fastmcp call \
--server-spec src/eo_mcp/app.py \
--target stac_search \
--input-json '{
"bbox": [73.0, 33.65, 73.12, 33.75],
"start_date": "2024-06-01",
"end_date": "2024-08-31",
"max_cloud_cover": 10,
"limit": 1
}' \
--json
Check the selected scene:
uv run fastmcp call \
--server-spec src/eo_mcp/app.py \
--target scene_quality \
--input-json '{
"scene_id": "S2B_MSIL2A_20240603T054639_R048_T43SCT_20240603T090813",
"bbox": [73.0, 33.65, 73.12, 33.75]
}' \
--json
Compute NDVI after the quality check passes:
uv run fastmcp call \
--server-spec src/eo_mcp/app.py \
--target compute_index \
--input-json '{
"scene_id": "S2B_MSIL2A_20240603T054639_R048_T43SCT_20240603T090813",
"bbox": [73.0, 33.65, 73.02, 33.67],
"index_name": "NDVI"
}' \
--json
For the installed FastMCP version, pass src/eo_mcp/app.py as the server
specification without appending :mcp.
Connect to Codex or another MCP client
EO-MCP currently runs as a local STDIO server. Configure the client with an absolute project path so it can launch the server from any working directory.
{
"mcpServers": {
"eo-mcp": {
"command": "uv",
"args": [
"run",
"--project",
"/absolute/path/to/eo-mcp",
"--frozen",
"fastmcp",
"run",
"/absolute/path/to/eo-mcp/src/eo_mcp/app.py"
]
}
}
}
If the client cannot find uv, replace "uv" with the absolute path returned
by:
command -v uv
With the Codex CLI, the equivalent registration command is:
codex mcp add eo-mcp -- \
/absolute/path/to/uv run \
--project /absolute/path/to/eo-mcp \
--frozen fastmcp run \
/absolute/path/to/eo-mcp/src/eo_mcp/app.py
Restart the client or open a new session after saving the configuration. In
Codex, use /mcp to confirm that eo-mcp is connected.
Example agent request:
Find a low-cloud Sentinel-2 scene for Lahore during July 2026. Check the
scene's quality, then compute NDVI for a small area and report the mean.
GeoJSON polygon example
quick_stats accepts either a GeoJSON geometry or a GeoJSON Feature:
{
"type": "Polygon",
"coordinates": [
[
[73.002, 33.652],
[73.018, 33.652],
[73.018, 33.668],
[73.002, 33.668],
[73.002, 33.652]
]
]
}
Coordinates must be WGS84 longitude/latitude values. Polygon and MultiPolygon geometries are supported.
How index processing works
- EO-MCP retrieves the requested STAC item and signs its asset URLs.
- It transforms the WGS84 area into the source raster coordinate system.
- Rasterio reads only the intersecting COG window over HTTPS.
- Bands on a different grid are aligned to the reference band.
- Digital numbers are converted to reflectance and the selected index is calculated.
- The server returns statistics and processing metadata rather than the full raster array.
compute_index reports min, max, mean, median, standard deviation, 2nd and
98th percentiles, pixel counts, CRS, resolution, and the source window.
quick_stats clips the index raster to the supplied polygon and reports min,
max, mean, and count.
Quality rules and operational limits
A scene is marked usable when all of the following are true:
- Scene-level cloud cover is at most 20%.
- Scene-level nodata is at most 10%.
- The scene footprint covers at least 99% of the requested area.
Important limitations:
- Cloud and nodata percentages come from scene-level STAC metadata; they are not calculated specifically for the requested bounding box.
- Index calculations do not apply a per-pixel cloud mask. Select a suitable
scene with
scene_qualityfirst. - A rectangular index request is limited to 4,000,000 reference-grid pixels. Reduce the bounding box if this limit is exceeded.
compute_indexsummarises the full rectangular window. Usequick_statswhen results must be clipped to an exact administrative, farm, water, or other polygon boundary.- Signed Planetary Computer asset URLs expire. Search again instead of storing them as permanent download links.
- Large requests depend on remote-network speed and upstream service availability.
Project structure
eo-mcp/
├── pyproject.toml
├── src/
│ └── eo_mcp/
│ ├── __init__.py
│ ├── app.py # FastMCP server and registered tools
│ ├── tools.py # STAC, raster, index, and zonal-stat logic
│ └── utils.py # Input validation helpers
└── README.md
Technology
- FastMCP for the MCP server
- PySTAC Client for STAC discovery
- Microsoft Planetary Computer for the Sentinel-2 L2A catalog and signed assets
- Rasterio and NumPy for windowed raster processing
- Rasterstats and Shapely for polygon statistics
uvfor dependency and project management
Remote deployment
STDIO is intended for local clients. To share EO-MCP across machines, expose it using FastMCP's Streamable HTTP transport, add authentication, and deploy it on a Python or container hosting platform. Do not publish an unauthenticated analysis endpoint to the public internet.
See the FastMCP HTTP deployment guide for the supported remote-server patterns.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。