Skip to main content
Glama
evans885-forester

urban-forestry-mcp

README.md
# 🌳 Urban Forestry Model Context Protocol (MCP) Server

A municipal Model Context Protocol (MCP) server for urban forestry, tree inventory management, Tree Canopy Assessment (TCA) metrics, resident communications, work orders, and GIS boundary analysis.

---

## 🚀 Features & Datasets

- **Tree Sites (17,700+ records):** Search public tree stock by species, condition (0–5), street, address, risk, or maintenance status.
- **Tree Activities (11,600+ records):** Full work order history (cycle pruning, removals, planting, inspections).
- **Historical Annual Tree Log:** Track year-over-year DBH growth and condition changes (`Original_GlobalID <-> GlobalID`).
- **Master Taxonomy Roster (731 species):** Authoritative catalog for mature sizes, growth rate, native status, and street tree approvals.
- **Tree Canopy Assessment (TCA 2025):** True aerial canopy coverage percentage and acre metrics citywide, by Ward, Zoning, Subdivision, Land Use, or Park.
- **Forestry Contacts & Communications (Read-Only):** Resident requests, safety warnings, and full interaction logs with soft address matching.
- **Forestry Tasks:** Real-time work assignments and status tracking.
- **Subdivisions & Parcels:** Spatial queries for developments and parcel-specific canopy data.

---

## 🛠️ The 15 MCP Tools

1. `search_trees` - Search public tree stock by species, street, address, condition, or risk.
2. `get_tree_details` - Complete tree site details with activities, snapshots count, and soft-matched contacts.
3. `get_tree_activities` - Chronological maintenance/inspection history for a tree.
4. `get_tree_history` - Annual snapshot logs tracking tree attributes over time.
5. `search_trees_by_location` - Proximity search within a radius in **FEET** or bounding box.
6. `get_tree_statistics` - Server-side grouping and aggregation across tree inventory.
7. `get_activity_statistics` - Server-side grouping across work orders.
8. `get_urban_forest_health_report` - Complete health, 10-20-30 diversity, condition, and risk report.
9. `get_tree_canopy_metrics` - True TCA tree canopy coverage % and acre metrics.
10. `search_taxonomy_roster` - Master 731-species taxonomy catalog search.
11. `get_subdivision_profile` - Subdivision tree stock and aerial canopy coverage profile.
12. `search_parcels` - Parcel number/address search with parcel canopy % and soft tree matching.
13. `search_forestry_contacts` - Resident contact details, planting requests, and communication logs.
14. `search_forestry_tasks` - Work assignments by assignee, status, priority, or task type.
15. `get_recent_updates` - Real-time tracking of edits and additions in the last N days.

---

## 🏃 Local Quickstart

### 1. Install Requirements
```bash
pip install -r requirements.txt
```

### 2. Verify Tools
```bash
python test_tools.py
```

### 3. Run Locally (stdio mode for Antigravity / Claude Desktop)
```bash
python server.py --transport stdio
```

### 4. Run Locally (SSE mode on port 8000 for LibreChat / Web)
```bash
python server.py --transport sse --host 0.0.0.0 --port 8000
```

---

## 🐳 Docker Deployment (For Field / Cloud Hosting)

```bash
# Build and start container in the background
docker-compose up -d --build
```
The SSE endpoint will be available at `http://<your-server-ip>:8000/sse`.

---

## 📱 Connecting Field Clients (LibreChat / Mobile)

Add to your `librechat.yaml`:
```yaml
mcpServers:
  urban-forestry:
    type: sse
    url: http://<your-server-or-domain>:8000/sse
```