wdpa-mcp
# wdpa-mcp
[](https://github.com/thesven/wdpa-mcp/actions/workflows/ci.yml)
[](https://www.python.org/downloads/)
[](https://opensource.org/licenses/MIT)
A dedicated conservation zoning and protected areas **Model Context Protocol (MCP)** server for the [World Database on Protected Areas (WDPA) and Protected Planet API v3](https://api.protectedplanet.net/).
Provides critical spatial conservation context to biodiversity observations (iNaturalist, eBird, GBIF), checking if wildlife sightings fall inside or adjacent to national parks, wilderness reserves, UNESCO biosphere reserves, or marine protected areas.
---
## Key Features
- **International Designation Filtering**: Query reserves classified under global conventions, including Ramsar Wetlands of International Importance, UNESCO World Heritage Sites, and Biosphere Reserves.
- **Reserve Proximity Evaluation**: Query coordinates (`lat`, `lon`, `radius_km`) to determine if a species observation is inside or near a protected conservation reserve.
- **IUCN Management Categories**: Identify strict nature reserves (Ia), wilderness areas (Ib), national parks (II), natural monuments (III), habitat management areas (IV), protected landscapes (V), and sustainable resource management reserves (VI).
- **National Coverage & 30x30 Metrics**: Retrieve terrestrial and marine protected surface area percentages by ISO-3 country to track progress toward Kunming-Montreal Global Biodiversity Framework targets.
- **Resilient Fallback Engine**: Built-in curated conservation registry ensures proximity queries and searches work reliably even without an external API token or during upstream downtime.
---
## Available Tools
| Tool | Description |
| :--- | :--- |
| `check_protected_area_nearby` | Assess whether GPS coordinates fall within or near a protected conservation area. |
| `search_protected_areas` | Search protected conservation areas by name, designation, or ISO country. |
| `filter_protected_areas_by_designation` | Filter protected zones by Ramsar, World Heritage, IUCN category, or marine status. |
| `get_protected_area_details` | Retrieve complete governance, IUCN management category, and area for a WDPA site. |
| `get_country_protection_coverage` | Retrieve national protected area coverage percentages and 30x30 statistics. |
| `list_country_protected_areas` | List and paginate designated national parks and reserves in a country by ISO-3 code. |
| `get_protected_area_boundary_envelope` | Retrieve bounding coordinates, centroid, and area envelope for GIS mapping. |
---
## Installation & Usage
### Running with `uvx` (Recommended)
```bash
uvx --from git+https://github.com/thesven/wdpa-mcp.git wdpa-mcp
```
### Configuration (Optional)
If you have a Protected Planet API v3 token, you can provide it via environment variable:
```bash
PROTECTED_PLANET_API_KEY=your_token_here
# or
WDPA_API_KEY=your_token_here
```
### Claude Desktop Configuration
Add to your `claude_desktop_config.json`:
```json
{
"mcpServers": {
"wdpa": {
"command": "uvx",
"args": ["--from", "git+https://github.com/thesven/wdpa-mcp.git", "wdpa-mcp"],
"env": {
"PROTECTED_PLANET_API_KEY": "optional_token_here"
}
}
}
}
```
---
## Development & Quality Gate
```bash
# Run code formatting check
uv run ruff format --check src tests scripts
# Run linting
uv run ruff check src tests scripts
# Run test suite with strict coverage floor (>90%)
uv run pytest --cov=wdpa_mcp --cov-branch --cov-report=term-missing
# Build wheel and sdist
uv build
# Run package distribution check & smoke test
uv run python scripts/check_dist.py
uv run python scripts/smoke.py
```
## License
MIT License. See [LICENSE](LICENSE) for details.
TDQS
Scored across 7 tools
search_protected_areas already accepts designation and country as parameters, so filter_protected_areas_by_designation and list_country_protected_areas read largely as parameterized subsets of the same query. check_protected_area_nearby, get_protected_area_details, and get_protected_area_boundary_envelope are clearly distinct (point-in-polygon, attributes, geometry), so the overlap is confined to the three query tools.
All seven names are snake_case with a leading verb (check_, search_, get_, filter_, list_), which is a predictable pattern. Minor deviations: check_protected_area_nearby uses a trailing modifier while others use pure verb_noun, and names are noticeably long, but nothing is ambiguous stylistically.
Seven tools is well within the ideal range and each maps to a recognizable GIS/conservation query pattern (point lookup, keyword search, record detail, aggregate stats, thematic filter, country listing, geometry envelope). No tool feels like filler for a read-only reference dataset of this scope.
The surface covers the core lifecycle for a reference dataset: find (search/filter/list), inspect (details), geospatial (boundary envelope), proximity (nearby), and aggregate reporting (country coverage/30x30). Gaps are minor — no direct lookup by WDPA site ID, no bulk/multi-site comparison, and no way to query designations or IUCN categories as a vocabulary.