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:
You can ask Cursor natural-language questions and it will pick the right tool. For example:
- “What’s the weather forecast for field X?”
- “Show me the processing status of file Y”
- “Pull the API documentation for field operations”

