Leaf’s MCP server works with Claude Code, giving you Leaf API access from the command line through natural language. You can list users, browse fields, pull operations data, and read API documentation without writing HTTP requests.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.
- Claude Code installed. See Anthropic’s Claude Code documentation for installation.
- A valid Leaf API token:
id_token.
Step 1: Configure the MCP server
Add the Leaf MCP server to your Claude Code configuration. Create or edit~/.claude/claude_code_config.json:
.mcp.json in your project root instead.
Step 2: Verify the connection
Launch Claude Code and ask:get_docs_index and returns the documentation index. If you see the list, the MCP server is connected.
Step 3: Query your data
The same tools available in Cursor work here. A few examples: List Leaf users:Step 4: Use documentation tools for context
Claude Code can pull Leaf API documentation inline to answer questions about endpoints, schemas, and behavior:get_leaf_doc with the path API_Reference/Field_Operations/operations_endpoints and returns the full endpoint documentation, which Claude Code can then reference when helping you write integration code.
Available tools
| 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 | Forecast and historical, daily and hourly, by field or lat/lon |
| Billing | list_billing_contracts, get_contract_consumption |
| Configuration | get_api_owner_configuration, get_leaf_user_configuration |
| Credentials | Provider credential event tools for John Deere, Climate FieldView, CNHi |
| Documentation | get_docs_index, get_leaf_doc |

