Skip to main content
Leaf runs a public Model Context Protocol (MCP) server that gives AI coding assistants direct access to the Leaf API. Connect it to Cursor, Claude Code, or any MCP-compatible client and your assistant can query Leaf users, fields, field operations, machine files, weather, and billing data on your behalf.

How it works

The MCP server exposes Leaf API functionality as MCP tools. When your AI assistant needs to look up a field boundary or check the status of a machine file, it calls the appropriate tool. The server authenticates with your Leaf token, makes the API request, and returns the result to the assistant. No SDK installation required. The server runs remotely at mcp.withleaf.io/mcp using Streamable HTTP transport.

Authentication

Every request to the MCP server requires a valid Leaf API token passed as a LEAF_TOKEN header. The server extracts the token from the MCP request headers and uses it for all downstream API calls. Generate a token the same way you would for direct API use. See Authentication for details.

Connecting from Cursor

Add this to your .cursor/mcp.json file (project-level) or ~/.cursor/mcp.json (global):
{
  "mcpServers": {
    "leaf": {
      "url": "https://mcp.withleaf.io/mcp",
      "headers": {
        "LEAF_TOKEN": "<your-leaf-api-token>"
      }
    }
  }
}
Restart Cursor after saving. The Leaf tools appear in the MCP tools panel.

Connecting from Claude Code

Run this command in your terminal:
claude mcp add leaf \
  --transport http \
  --url https://mcp.withleaf.io/mcp \
  --header "LEAF_TOKEN: <your-leaf-api-token>"
Claude Code picks up the server immediately.

Connecting from other MCP clients

Any client that supports Streamable HTTP transport can connect. Point it at https://mcp.withleaf.io/mcp and include the LEAF_TOKEN header. The server does not use SSE or stdio transport.

Available tools

The MCP server exposes tools across these categories:
CategoryToolsWhat they do
Documentation2Browse Leaf API docs without leaving your editor
Configuration2Read API owner and Leaf user configuration settings
Provider credentials3Check credential status for John Deere, Climate FieldView, and CNHi
User management1List and filter Leaf users
Fields3List fields, get field details and boundaries
Field operations4List and inspect field operations with summaries and units
Machine files5List, inspect, and check processing status of machine files
Batch uploads3List and inspect batch uploads
Weather8Forecast and historical weather by field or coordinates, daily or hourly
Billing5List contracts, check consumption by API owner or Leaf user
See Tools Reference for the full list with parameters.

Common use cases

  • Troubleshoot customer issues: Ask your AI assistant to look up a Leaf user’s credential events, file processing status, or field boundaries without leaving your editor.
  • Explore data interactively: Query field operations, machine files, and summaries by provider, date range, or operation type in natural language.
  • Monitor billing: Check contract consumption at the API owner or Leaf user level to catch unexpected usage spikes.

What to do next

Last modified on March 24, 2026