Leaf's MCP Server: AI-Ready Farm Data in Seconds
Modern LLM-powered tools thrive when they can reason over a well-defined set of capabilities. Today we're giving them exactly that: a Model Context Protocol (MCP) server for Leaf's unified agriculture API. Developers can now wire Cursor, VS Code chat, Claude Desktop, or any JSON-RPC agent straight into live farm data with one command.
Agriculture is built on conversations — between growers, advisors, insurance agents, and input providers. As companies serving agriculture, you know these conversations drive every farming decision.
Leaf's MCP server extends those conversations to make it easy for you to include AI in your products, giving your teams fast access to relevant operational data. Whether your agronomists are discussing yield trends or your sales team is planning programs with growers, AI can now participate to help make everybody more informed and grounded in the data.
Why MCP?
MCP (Model Context Protocol) is an open standard by Anthropic that lets AI systems securely connect to data sources and tools. Instead of building custom integrations for every AI application, MCP provides a universal way for agents to discover and interact with services.
Leaf's MCP server is a single integration point that exposes our unified agricultural API to any AI agent. Your agents can read docs, call endpoints, and chain tools instantly.
Learn more: MCP Documentation | GitHub
Install For Cursor IDE
Add this configuration to ~/.cursor/mcp.json:
{ | |
"mcpServers": { | |
"leaf": { | |
"url": "https://mcp.withleaf.io", | |
"headers": { | |
"LEAF_TOKEN": "YOUR_LEAF_TOKEN" | |
} | |
} | |
} | |
} |
{ | |
"mcpServers": { | |
"leaf": { | |
"url": "https://mcp.withleaf.io", | |
"headers": { | |
"LEAF_TOKEN": "YOUR_LEAF_TOKEN" | |
} | |
} | |
} | |
} |
Drop this block into ~/.cursor/mcp.json, making sure you put your specific Leaf Token into the config, reload your editor, and ask it a question like you might ask an analyst on your team:
“What was the hybrid which was planted during the most recent planting operation for [NAME] and what was the soil temperature?”
Cursor (or any compliant agent) will inspect the tool schema, choose the appropriate operations, and call Leaf for you - no extra code needed.
What You Get
- Growing list of tools: Key API endpoints wrapped as an MCP tool
- Integrated documentation: Get answers to your API questions without leaving chat
- Security: All tool calls use your API key with our existing API endpoints
Example: Chat with Your Fields
Want to see a full working example? Check out our complete demo application of a conversational agent that can answer questions about your Leaf data using the Leaf MCP server with OpenAI's API. The demo includes:
- FastMCP client setup with proper authentication
- Tool discovery and OpenAI format conversion
- Interactive chat loop with tool calling on GitHub:
Getting Started
- Get your Leaf API token - Book a demo or follow authentication steps
- Add to your AI tool - Configure Leaf as an MCP server in Cursor, Claude Desktop, or VS Code
- Start asking questions - Your AI assistant now has access to all your agricultural data