Leaf provides a Model Context Protocol (MCP) server that lets you interact with the Leaf API directly from Cursor. You can list users, query fields, pull operations, check weather data, and browse API documentation without leaving your editor.Documentation Index
Fetch the complete documentation index at: https://docs.withleaf.io/llms.txt
Use this file to discover all available pages before exploring further.
Before you start
- A Leaf account with API credentials.
- Cursor IDE installed (version 0.40+ with MCP support).
- A valid Leaf API token. Get one by authenticating:
id_token from the response.
Step 1: Add the MCP server to Cursor
Open Cursor Settings (Cmd+, on Mac, Ctrl+, on Windows/Linux) and navigate to MCP Servers. Click Add new MCP Server and configure it:- Name:
leaf-mcp - Type:
HTTP - URL:
https://mcp.withleaf.io/mcp
Step 2: Verify the connection
Open a new Cursor chat (Agent mode) and ask:get_docs_index tool and returns a list of all documentation topics available through the MCP server. If you see the index, the connection is working.
Step 3: List your Leaf users
list_users and returns the paginated list of Leaf users under your API owner account. Each user has an id you’ll use in subsequent queries.
Step 4: Query fields for a user
<leaf_user_id> with an actual UUID from the previous step. Cursor calls list_fields and returns fields with their boundaries, providers, and metadata.
Step 5: Pull harvest operations
list_operations with operationType=harvested and returns the harvest operations. Each operation includes startTime, endTime, fieldId, and links to its summary and GeoJSON data.
To dig into a specific operation:
get_operation_summary and returns aggregated stats like total area, average yield, and crop type.
Step 6: Explore additional tools
The MCP server exposes tools for the full Leaf API surface:| Category | Tools |
|---|---|
| Users | list_users |
| Fields | list_fields, get_field, get_field_boundary |
| Operations | list_operations, get_operation, get_operation_summary, get_operation_units |
| Machine files | list_files, get_file, get_file_summary, get_file_status, get_file_units |
| Batches | list_batches, get_batch, get_batch_status |
| Weather | get_weather_forecast_field_daily, get_weather_historical_field_daily, and hourly/lat-lon variants |
| Billing | list_billing_contracts, get_contract_consumption |
| Configuration | get_api_owner_configuration, get_leaf_user_configuration |
| Credentials | get_john_deere_credentials_events, get_climate_fieldview_credentials_events, get_cnhi_credentials_events |
| Documentation | get_docs_index, get_leaf_doc |
- “What’s the weather forecast for field X?”
- “Show me the processing status of file Y”
- “Pull the API documentation for field operations”

