Connect Leaf’s MCP server to Claude Code to query Leaf users, fields, operations, and weather data from the terminal using natural language.
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.
Claude Code can pull Leaf API documentation inline to answer questions about endpoints, schemas, and behavior:
Show me the Leaf documentation for field operations endpoints
This calls 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.
You connected Leaf’s MCP server to Claude Code and queried Leaf data from the terminal. This setup is useful for exploring customer data, debugging integrations, and getting contextual API documentation while writing code.For the same workflow in Cursor IDE, see Connect Leaf’s MCP Server in Cursor.
Last modified on March 19, 2026
{"docsConfig":{"theme":"aspen","$schema":"https://mintlify.com/docs.json","name":"Leaf Documentation","colors":{"primary":"#00886b","light":"#07C983","dark":"#00886b"},"logo":{"light":"https://mintcdn.com/leaf-3ed5893a/to88HRn_L8ezHDrX/logo/light.png?fit=max\u0026auto=format\u0026n=to88HRn_L8ezHDrX\u0026q=85\u0026s=8ce24e422c9bf087336b65351eb51f4c","dark":"https://mintcdn.com/leaf-3ed5893a/to88HRn_L8ezHDrX/logo/dark.png?fit=max\u0026auto=format\u0026n=to88HRn_L8ezHDrX\u0026q=85\u0026s=7c5b24b746c2c02501ac6fea486c3a51","href":"https://withleaf.io/"},"favicon":"https://mintcdn.com/leaf-3ed5893a/to88HRn_L8ezHDrX/favicon.png?fit=max\u0026auto=format\u0026n=to88HRn_L8ezHDrX\u0026q=85\u0026s=a435f8f25c1ed914dc32b03c92d844cd","appearance":{"default":"light"},"background":{"color":{"light":"#ffffff","dark":"#18191a"}},"navbar":{"links":[{"icon":"github","href":"https://status.withleaf.io","label":"API Status"},{"href":"https://dashboard.withleaf.io","label":"Log In"}],"primary":{"type":"button","label":"Request Demo","href":"https://withleaf.io/account/get-a-demo"}},"footer":{"socials":{"instagram":"https://www.instagram.com/withleaf_","linkedin":"https://www.linkedin.com/company/leaf-agriculture","x":"https://twitter.com/LeafAgriculture","youtube":"https://www.youtube.com/@leafagriculture7933"}},"seo":{"metatags":{"robots":"noindex"},"indexing":"navigable"},"fonts":{"heading":{"family":"Satoshi","source":"https://cdn.fontshare.com/wf/P2LQKHE6KA6ZP4AAGN72KDWMHH6ZH3TA/ZC32TK2P7FPS5GFTL46EU6KQJA24ZYDB/7AHDUZ4A7LFLVFUIFSARGIWCRQJHISQP.woff2","format":"woff2"},"body":{"family":"Inter"}},"integrations":{"mixpanel":{"projectToken":"2aa8982706dc53402184ef7b6e555d32"}},"contextual":{"options":["copy","view","chatgpt","claude","perplexity","mcp","cursor","vscode"],"display":"header"},"metadata":{"timestamp":true},"styling":{"latex":false},"navigation":{"global":{"anchors":[{"anchor":"About Us","icon":"circle-user","href":"https://withleaf.io/company"}]},"pages":[]}},"deployment":{"deploymentMetadataValue":{"subdomain":"leaf-3ed5893a","hasAudioNarration":false,"actualSubdomain":"leaf-3ed5893a","customDomains":["docs.withleaf.io"],"gitSource":{"type":"github","owner":"leaf-agriculture","repo":"docs-v2","deployBranch":"master","contentDirectory":"","isPrivate":true,"mountPath":"","label":""},"chroma":{"liveDeploymentHistoryId":"6aea55583593d9bacc3250df","collectionId":"c5ff0339-6713-4bbb-8aca-078af8401d84","schemaVersion":"v3","latestBuiltDeploymentHistoryId":"6aea55583593d9bacc3250df"},"entitlements":{"AI_CHAT":{"status":"ENABLED"},"WEB_MCP":{"status":"ENABLED"},"NARRATION":{"status":"ENABLED"}},"buildId":"6aea55583593d9bacc3250df","clientVersion":"0.0.4054","searchFilterCounts":[{"language":"default","tag":"Documentation","count":58},{"language":"default","tag":"API Reference","count":25},{"language":"default","tag":"Guides","count":21},{"language":"default","tag":"Tutorials","count":16},{"language":"default","tag":"Connecting Providers","count":16},{"language":"default","tag":"Beta","count":10},{"language":"default","tag":"Data Hierarchy","count":9},{"language":"default","tag":"OEM and Provider Integrations","count":8},{"language":"default","tag":"Machine Data","count":6},{"language":"default","tag":"Resources","count":6}]},"assistantConfig":{"enableAskAiButton":false,"enableStarterQuestions":false,"enableAskAiSearchBar":true,"deflection":{"enabled":true,"email":"help@withleaf.io","showHelpButton":true}},"basePath":"","hasChatPermissions":true,"hasWebMcpPermissions":true,"toggles":[{"name":"kill-isr","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-mintlify-slack","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"agent-integrations-settings","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-pr-grouping","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"custom-prefix","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"analytics-v7","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"user-flows-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"no-publish-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-onboarding","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"llms-txt-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving-live","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"stripTemperatureMiddleware","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"support-platform-pylon-zendesk","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"snapshot-serving","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"instant-rollback","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications-server","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"granular-notifications","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automations-fable","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fixed-ai-action-pricing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"automation-resolve-merge-conflict","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"scoped-publishing","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"mintql","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"page-level-analytics","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"editor-version-history-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-page-v2","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"full-page-search","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workspace-projects","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"assistant-v5","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"byok-sep-25","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"fork-pr-previews","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"revalidation-jwt","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"vite-origin","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"billing-updated-9-15","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-sso-scim","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"hobby-abuse-scan","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"dashboard-inbox","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-signup","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"turbopuffer-dual-write","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"workos-enabled","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"approve-review-flow","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false},{"name":"sso-setup-deadline-banner","enabled":true,"variant":{"name":"disabled","enabled":false,"feature_enabled":true},"impressionData":false}],"googleFontsInlined":false},"customCss":[{"filePath":"styles/globals.css","content":".delete,.get,.patch,.post,.put{display:inline-block;padding:2px 8px;border-radius:4px;font-size:12px;font-weight:600;text-transform:uppercase;font-family:monospace}.get{background-color:#00866d;color:#fff}.patch,.post{background-color:#edc043;color:#fff}.delete,.put{background-color:#f25925;color:#fff}.put{background-color:#edc043}"}],"page":{"pagePath":"guides/tutorials/claude-code-mcp","slug":"/guides/tutorials/claude-code-mcp","pageMetadata":{"title":"Connect Leaf's MCP Server in Claude Code","sidebarTitle":"Use Claude Code with Leaf","description":"Connect Leaf's MCP server to Claude Code to query Leaf users, fields, operations, and weather data from the terminal using natural language.","href":"/guides/tutorials/claude-code-mcp"},"description":{"compiledSource":"\"use strict\";\nconst {jsx: _jsx} = arguments[0];\nconst {useMDXComponents: _provideComponents} = arguments[0];\nfunction _createMdxContent(props) {\n const _components = {\n p: \"p\",\n ..._provideComponents(),\n ...props.components\n };\n return _jsx(_components.p, {\n children: \"Connect Leaf’s MCP server to Claude Code to query Leaf users, fields, operations, and weather data from the terminal using natural language.\"\n });\n}\nfunction MDXContent(props = {}) {\n const {wrapper: MDXLayout} = {\n ..._provideComponents(),\n ...props.components\n };\n return MDXLayout ? _jsx(MDXLayout, {\n ...props,\n children: _jsx(_createMdxContent, {\n ...props\n })\n }) : _createMdxContent(props);\n}\nreturn {\n default: MDXContent\n};\n","frontmatter":{},"scope":{}},"pageType":"default","mdx":{"mdxSource":{"compiledSource":"\"use strict\";const{Fragment:_Fragment,jsx:_jsx,jsxs:_jsxs}=arguments[0];const{useMDXComponents:_provideComponents}=arguments[0];function _createMdxContent(props){const _components={a:`a`,code:`code`,li:`li`,p:`p`,pre:`pre`,span:`span`,strong:`strong`,tbody:`tbody`,td:`td`,th:`th`,thead:`thead`,tr:`tr`,ul:`ul`,..._provideComponents(),...props.components},{CodeBlock,Heading,Table,Warning}=_components;if(!CodeBlock)_missingMdxReference(`CodeBlock`,true);if(!Heading)_missingMdxReference(`Heading`,true);if(!Table)_missingMdxReference(`Table`,true);if(!Warning)_missingMdxReference(`Warning`,true);return _jsxs(_Fragment,{children:[_jsx(_components.p,{children:`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.`}),`\n`,_jsx(Heading,{level:`2`,id:`before-you-start`,children:`Before you start`}),`\n`,_jsxs(_components.ul,{children:[`\n`,_jsx(_components.li,{children:`A Leaf account with API credentials.`}),`\n`,_jsxs(_components.li,{children:[`Claude Code installed. See `,_jsx(_components.a,{href:`https://docs.anthropic.com/en/docs/claude-code`,children:`Anthropic’s Claude Code documentation`}),` for installation.`]}),`\n`,_jsx(_components.li,{children:`A valid Leaf API token:`}),`\n`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`3`,language:`shellscript`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`shellscript`,children:_jsxs(_components.code,{language:`shellscript`,numberOfLines:`3`,children:[_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#953800`,\"--shiki-dark\":`#DCDCAA`},children:`curl`}),_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -X`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` POST`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"https://api.withleaf.io/api/authenticate\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -H`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` \"Content-Type: application/json\"`}),_jsx(_components.span,{style:{color:`#CF222E`,\"--shiki-dark\":`#D7BA7D`},children:` \\\\`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#0550AE`,\"--shiki-dark\":`#569CD6`},children:` -d`}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:` '{\"username\": \"your-email@example.com\", \"password\": \"your-password\"}'`})]}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`Save the `,_jsx(_components.code,{children:`id_token`}),`.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-1-configure-the-mcp-server`,children:`Step 1: Configure the MCP server`}),`\n`,_jsxs(_components.p,{children:[`Add the Leaf MCP server to your Claude Code configuration. Create or edit `,_jsx(_components.code,{children:`~/.claude/claude_code_config.json`}),`:`]}),`\n`,_jsx(CodeBlock,{filename:``,numberOfLines:`11`,language:`json`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`json`,children:_jsxs(_components.code,{language:`json`,numberOfLines:`11`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`{`})}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"mcpServers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"leaf-mcp\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"type\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"url\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"https://mcp.withleaf.io/mcp\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`,`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"headers\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: {`})]}),`\n`,_jsxs(_components.span,{className:`line`,children:[_jsx(_components.span,{style:{color:`#116329`,\"--shiki-dark\":`#9CDCFE`},children:` \"LEAF_TOKEN\"`}),_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`: `}),_jsx(_components.span,{style:{color:`#0A3069`,\"--shiki-dark\":`#CE9178`},children:`\"your-leaf-api-token\"`})]}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:` }`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{style:{color:`#1F2328`,\"--shiki-dark\":`#D4D4D4`},children:`}`})}),`\n`]})})}),`\n`,_jsxs(_components.p,{children:[`For project-level configuration, add the same block to `,_jsx(_components.code,{children:`.mcp.json`}),` in your project root instead.`]}),`\n`,_jsx(Warning,{children:_jsx(_components.p,{children:`Your Leaf token expires periodically. If you get authentication errors, generate a fresh token and update the config.`})}),`\n`,_jsx(Heading,{level:`2`,id:`step-2-verify-the-connection`,children:`Step 2: Verify the connection`}),`\n`,_jsx(_components.p,{children:`Launch Claude Code and ask:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`List available Leaf API documentation`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`Claude Code calls `,_jsx(_components.code,{children:`get_docs_index`}),` and returns the documentation index. If you see the list, the MCP server is connected.`]}),`\n`,_jsx(Heading,{level:`2`,id:`step-3-query-your-data`,children:`Step 3: Query your data`}),`\n`,_jsx(_components.p,{children:`The same tools available in Cursor work here. A few examples:`}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`List Leaf users:`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Show me all Leaf users`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Query fields:`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`List fields for Leaf user \u003cleaf_user_id>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Pull harvest operations:`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Show harvested operations for Leaf user \u003cleaf_user_id>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Get an operation summary:`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Get the summary for operation \u003coperation_id>`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(_components.p,{children:_jsx(_components.strong,{children:`Check weather:`})}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`What's the daily weather forecast for field \u003cfield_id> under Leaf user \u003cleaf_user_id>?`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsx(Heading,{level:`2`,id:`step-4-use-documentation-tools-for-context`,children:`Step 4: Use documentation tools for context`}),`\n`,_jsx(_components.p,{children:`Claude Code can pull Leaf API documentation inline to answer questions about endpoints, schemas, and behavior:`}),`\n`,_jsx(CodeBlock,{numberOfLines:`2`,language:`text`,children:_jsx(_components.pre,{className:`shiki shiki-themes github-light-default dark-plus`,style:{backgroundColor:`#ffffff`,\"--shiki-dark-bg\":`#0B0C0E`,color:`#1f2328`,\"--shiki-dark\":`#D4D4D4`},language:`text`,children:_jsxs(_components.code,{language:`text`,numberOfLines:`2`,children:[_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{children:`Show me the Leaf documentation for field operations endpoints`})}),`\n`,_jsx(_components.span,{className:`line`,children:_jsx(_components.span,{})})]})})}),`\n`,_jsxs(_components.p,{children:[`This calls `,_jsx(_components.code,{children:`get_leaf_doc`}),` with the path `,_jsx(_components.code,{children:`API_Reference/Field_Operations/operations_endpoints`}),` and returns the full endpoint documentation, which Claude Code can then reference when helping you write integration code.`]}),`\n`,_jsx(Heading,{level:`2`,id:`available-tools`,children:`Available tools`}),`\n`,_jsxs(Table,{children:[_jsx(_components.thead,{children:_jsxs(_components.tr,{children:[_jsx(_components.th,{children:`Category`}),_jsx(_components.th,{children:`Tools`})]})}),_jsxs(_components.tbody,{children:[_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Users`}),_jsx(_components.td,{children:_jsx(_components.code,{children:`list_users`})})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Fields`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`list_fields`}),`, `,_jsx(_components.code,{children:`get_field`}),`, `,_jsx(_components.code,{children:`get_field_boundary`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Operations`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`list_operations`}),`, `,_jsx(_components.code,{children:`get_operation`}),`, `,_jsx(_components.code,{children:`get_operation_summary`}),`, `,_jsx(_components.code,{children:`get_operation_units`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Machine files`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`list_files`}),`, `,_jsx(_components.code,{children:`get_file`}),`, `,_jsx(_components.code,{children:`get_file_summary`}),`, `,_jsx(_components.code,{children:`get_file_status`}),`, `,_jsx(_components.code,{children:`get_file_units`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Batches`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`list_batches`}),`, `,_jsx(_components.code,{children:`get_batch`}),`, `,_jsx(_components.code,{children:`get_batch_status`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Weather`}),_jsx(_components.td,{children:`Forecast and historical, daily and hourly, by field or lat/lon`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Billing`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`list_billing_contracts`}),`, `,_jsx(_components.code,{children:`get_contract_consumption`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Configuration`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`get_api_owner_configuration`}),`, `,_jsx(_components.code,{children:`get_leaf_user_configuration`})]})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Credentials`}),_jsx(_components.td,{children:`Provider credential event tools for John Deere, Climate FieldView, CNHi`})]}),_jsxs(_components.tr,{children:[_jsx(_components.td,{children:`Documentation`}),_jsxs(_components.td,{children:[_jsx(_components.code,{children:`get_docs_index`}),`, `,_jsx(_components.code,{children:`get_leaf_doc`})]})]})]})]}),`\n`,_jsx(Heading,{level:`2`,id:`what-you-built`,children:`What you built`}),`\n`,_jsx(_components.p,{children:`You connected Leaf’s MCP server to Claude Code and queried Leaf data from the terminal. This setup is useful for exploring customer data, debugging integrations, and getting contextual API documentation while writing code.`}),`\n`,_jsxs(_components.p,{children:[`For the same workflow in Cursor IDE, see `,_jsx(_components.a,{href:`/guides/tutorials/cursor-mcp`,children:`Connect Leaf’s MCP Server in Cursor`}),`.`]})]})}function MDXContent(props={}){const{wrapper:MDXLayout}={..._provideComponents(),...props.components};return MDXLayout?_jsx(MDXLayout,{...props,children:_jsx(_createMdxContent,{...props})}):_createMdxContent(props)}return{default:MDXContent};function _missingMdxReference(id,component){throw new Error(`Expected `+(component?`component`:`object`)+\" `\"+id+\"` to be defined: you likely forgot to import, pass, or provide it.\")}","frontmatter":{},"scope":{"config":{},"pageMetadata":{"title":"Connect Leaf's MCP Server in Claude Code","sidebarTitle":"Use Claude Code with Leaf","description":"Connect Leaf's MCP server to Claude Code to query Leaf users, fields, operations, and weather data from the terminal using natural language.","href":"/guides/tutorials/claude-code-mcp"}}},"mdxSourceWithNoJs":null},"mdxExtracts":{"tableOfContents":[{"title":"Before you start","slug":"before-you-start","depth":2,"children":[]},{"title":"Step 1: Configure the MCP server","slug":"step-1-configure-the-mcp-server","depth":2,"children":[]},{"title":"Step 2: Verify the connection","slug":"step-2-verify-the-connection","depth":2,"children":[]},{"title":"Step 3: Query your data","slug":"step-3-query-your-data","depth":2,"children":[]},{"title":"Step 4: Use documentation tools for context","slug":"step-4-use-documentation-tools-for-context","depth":2,"children":[]},{"title":"Available tools","slug":"available-tools","depth":2,"children":[]},{"title":"What you built","slug":"what-you-built","depth":2,"children":[]}],"codeExamples":{}},"jsLinks":[],"subdomain":"leaf-3ed5893a","siteName":"Leaf Documentation","title":"Connect Leaf's MCP Server in Claude Code - Leaf Documentation","navMaps":{"firstHrefInVersion":{},"firstHrefInLanguage":{}},"lastModified":"2026-03-19T14:33:49.086Z","gitLastModified":"2026-03-19T17:14:02.000Z","originalFileLocation":"guides/tutorials/claude-code-mcp.mdx"},"headHtml":"\u003cscript data-mint-head>(function(){var d=document.documentElement,p=null;if(!p){try{p=localStorage.getItem(\"isDarkMode\")}catch(e){}if(p==='true')p='dark';else if(p==='false')p='light';if(p!=='light'\u0026\u0026p!=='dark'\u0026\u0026p!=='system')p=\"light\"}var r=p==='system'?(matchMedia(\"(prefers-color-scheme: dark)\").matches?'dark':'light'):p;d.classList.remove(r==='dark'?'light':'dark');d.classList.add(r);d.setAttribute(\"data-theme-preference\",p)})();\u003c/script>\u003cmeta data-mint-head name=\"description\" content=\"Connect Leaf\u0026#x27;s MCP server to Claude Code to query Leaf users, fields, operations, and weather data from the terminal using natural language.\">\u003cmeta data-mint-head name=\"application-name\" content=\"Leaf Documentation\">\u003cmeta data-mint-head name=\"generator\" content=\"Mintlify\">\u003cmeta data-mint-head name=\"robots\" content=\"noindex\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon/android-chrome-192x192.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"apple-touch-icon\" type=\"image/png\" sizes=\"180x180\" href=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon/apple-touch-icon.png\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon/favicon-16x16.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon/favicon-32x32.png\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon/favicon.ico\" media=\"(prefers-color-scheme: light)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"192x192\" href=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon-dark/android-chrome-192x192.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"16x16\" href=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon-dark/favicon-16x16.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"icon\" type=\"image/png\" sizes=\"32x32\" href=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon-dark/favicon-32x32.png\" media=\"(prefers-color-scheme: dark)\">\u003clink data-mint-head rel=\"shortcut icon\" type=\"image/x-icon\" href=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon-dark/favicon.ico\" media=\"(prefers-color-scheme: dark)\">\u003cmeta data-mint-head property=\"og:title\" content=\"Connect Leaf\u0026#x27;s MCP Server in Claude Code - Leaf Documentation\">\u003cmeta data-mint-head property=\"og:description\" content=\"Connect Leaf\u0026#x27;s MCP server to Claude Code to query Leaf users, fields, operations, and weather data from the terminal using natural language.\">\u003cmeta data-mint-head property=\"og:site_name\" content=\"Leaf Documentation\">\u003cmeta data-mint-head property=\"og:url\" content=\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp\">\u003cmeta data-mint-head property=\"og:type\" content=\"website\">\u003cmeta data-mint-head property=\"og:image\" content=\"https://leaf-3ed5893a.mintlify.app/_mintlify/api/og/v2?division=AI+and+Agents\u0026amp;title=Connect+Leaf%27s+MCP+Server+in+Claude+Code\u0026amp;description=Connect+Leaf%27s+MCP+server+to+Claude+Code+to+query+Leaf+users%2C+fields%2C+operations%2C+and+weather+data+from+the+terminal+using+natural+language.\u0026amp;theme=df28ea0c62b563cc8e5aedca\u0026amp;signature=410b2e093131c33f349279f9d369848854bc9c5cde15c0f4704aa063ee6d2fdd\">\u003cmeta data-mint-head property=\"og:image:width\" content=\"1200\">\u003cmeta data-mint-head property=\"og:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"twitter:card\" content=\"summary_large_image\">\u003cmeta data-mint-head name=\"twitter:title\" content=\"Connect Leaf\u0026#x27;s MCP Server in Claude Code - Leaf Documentation\">\u003cmeta data-mint-head name=\"twitter:description\" content=\"Connect Leaf\u0026#x27;s MCP server to Claude Code to query Leaf users, fields, operations, and weather data from the terminal using natural language.\">\u003cmeta data-mint-head name=\"twitter:image\" content=\"https://leaf-3ed5893a.mintlify.app/_mintlify/api/og/v2?division=AI+and+Agents\u0026amp;title=Connect+Leaf%27s+MCP+Server+in+Claude+Code\u0026amp;description=Connect+Leaf%27s+MCP+server+to+Claude+Code+to+query+Leaf+users%2C+fields%2C+operations%2C+and+weather+data+from+the+terminal+using+natural+language.\u0026amp;theme=df28ea0c62b563cc8e5aedca\u0026amp;signature=410b2e093131c33f349279f9d369848854bc9c5cde15c0f4704aa063ee6d2fdd\">\u003cmeta data-mint-head name=\"twitter:image:width\" content=\"1200\">\u003cmeta data-mint-head name=\"twitter:image:height\" content=\"630\">\u003cmeta data-mint-head name=\"msapplication-config\" content=\"/mintlify-assets/_mintlify/favicons/leaf-3ed5893a/IA--hOPjRaQAEcyW/_generated/favicon/browserconfig.xml\">\u003cmeta data-mint-head name=\"apple-mobile-web-app-title\" content=\"Leaf Documentation\">\u003cmeta data-mint-head name=\"msapplication-TileColor\" content=\"#00886b\">\u003clink data-mint-head rel=\"canonical\" href=\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp\">\u003clink data-mint-head rel=\"alternate\" type=\"application/xml\" href=\"/sitemap.xml\">\u003clink data-mint-head rel=\"alternate\" type=\"text/markdown\" href=\"/guides/tutorials/claude-code-mcp.md\">\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@graph\":[{\"@type\":\"Organization\",\"@id\":\"https://docs.withleaf.io/#organization\",\"name\":\"Leaf Documentation\",\"url\":\"https://docs.withleaf.io\",\"logo\":{\"@type\":\"ImageObject\",\"url\":\"https://mintcdn.com/leaf-3ed5893a/to88HRn_L8ezHDrX/logo/light.png?fit=max\u0026auto=format\u0026n=to88HRn_L8ezHDrX\u0026q=85\u0026s=8ce24e422c9bf087336b65351eb51f4c\"}},{\"@type\":\"WebSite\",\"@id\":\"https://docs.withleaf.io#website\",\"name\":\"Leaf Documentation\",\"url\":\"https://docs.withleaf.io\",\"publisher\":{\"@id\":\"https://docs.withleaf.io/#organization\"}},{\"@type\":\"WebPage\",\"@id\":\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp#webpage\",\"url\":\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp\",\"name\":\"Connect Leaf's MCP Server in Claude Code\",\"description\":\"Connect Leaf's MCP server to Claude Code to query Leaf users, fields, operations, and weather data from the terminal using natural language.\",\"dateModified\":\"2026-03-19T17:14:02.000Z\",\"isPartOf\":{\"@id\":\"https://docs.withleaf.io#website\"},\"breadcrumb\":{\"@id\":\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp#breadcrumb\"}},{\"@type\":\"BreadcrumbList\",\"@id\":\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"AI and Agents\",\"item\":\"https://docs.withleaf.io/guides/tutorials/cursor-mcp\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Connect Leaf's MCP Server in Claude Code\",\"item\":\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp\"}]},{\"@type\":[\"Article\",\"TechArticle\"],\"@id\":\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp#article\",\"headline\":\"Connect Leaf's MCP Server in Claude Code\",\"name\":\"Connect Leaf's MCP Server in Claude Code\",\"description\":\"Connect Leaf's MCP server to Claude Code to query Leaf users, fields, operations, and weather data from the terminal using natural language.\",\"url\":\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp\",\"mainEntityOfPage\":{\"@id\":\"https://docs.withleaf.io/guides/tutorials/claude-code-mcp#webpage\"},\"dateModified\":\"2026-03-19T17:14:02.000Z\",\"publisher\":{\"@id\":\"https://docs.withleaf.io/#organization\"},\"isPartOf\":{\"@id\":\"https://docs.withleaf.io#website\"}}]}\u003c/script>\u003cscript data-mint-head type=\"application/ld+json\">{\"@context\":\"https://schema.org\",\"@type\":\"WebSite\",\"name\":\"Leaf Documentation\",\"creator\":{\"@type\":\"Organization\",\"name\":\"Mintlify\",\"url\":\"https://mintlify.com\"}}\u003c/script>","siteName":"Leaf Documentation","nav":{"global":{"anchors":[{"anchor":"About Us","icon":"circle-user","href":"https://withleaf.io/company"}]},"tabs":[{"tab":"Home","icon":"house","pages":[{"title":"Home","href":""}]},{"tab":"Documentation","icon":"book-open","pages":[{"title":"Documentation","href":"/getting-started/welcome"}]},{"tab":"Guides","icon":"lightbulb","groups":[{"group":"By Use Case","pages":[{"title":"Managed Service Provider","sidebarTitle":"Managed Service Provider","href":"/guides/by-use-case/managed-service-provider"},{"title":"Farm Management (FMIS)","sidebarTitle":"FMIS","href":"/guides/by-use-case/fmis"},{"title":"Crop Insurance","sidebarTitle":"Crop Insurance","href":"/guides/by-use-case/crop-insurance"}]},{"group":"AI and Agents","pages":[{"title":"Connect Leaf's MCP Server in Cursor","sidebarTitle":"Use Cursor with Leaf","description":"Connect Leaf's MCP server to Cursor IDE to query field data, pull harvest operations, and explore the Leaf API using natural language and tool calls.","href":"/guides/tutorials/cursor-mcp"},{"title":"Connect Leaf's MCP Server in Claude Code","sidebarTitle":"Use Claude Code with Leaf","href":"/guides/tutorials/claude-code-mcp"}]},{"group":"Tutorials","pages":[{"group":"OEM and Provider Integrations","pages":[{"title":"Connect to Climate FieldView API","sidebarTitle":"Connect Climate FieldView","description":"Connect Climate FieldView to Leaf: register as a developer, complete the OAuth flow, and attach credentials to a Leaf user.","href":"/guides/tutorials/connect-climate-fieldview"},{"title":"Connect to Stara Telemetry API","sidebarTitle":"Connect Stara","href":"/guides/tutorials/connect-stara"},{"title":"Connect to John Deere Operations Center API","sidebarTitle":"Connect John Deere","href":"/guides/tutorials/connect-john-deere"},{"title":"Connect to CNHi API (AFS Connect)","sidebarTitle":"Connect CNHI (AFS Connect - Legacy)","href":"/guides/tutorials/connect-cnhi"},{"title":"Connect to CNHI FieldOps API","sidebarTitle":"Connect CNHI FieldOps","href":"/guides/tutorials/connect-cnhi-fieldops"},{"title":"Migrate from CNHI AFS Connect to CNHI FieldOps","sidebarTitle":"Migrate CNHI to FieldOps","href":"/guides/tutorials/migrate-cnhi-to-fieldops"},{"title":"Connect to AgLeader AgFiniti API","sidebarTitle":"Connect AgLeader","href":"/guides/tutorials/connect-agleader"},{"title":"Connect to Trimble API","sidebarTitle":"Connect Trimble","href":"/guides/tutorials/connect-trimble"}]},{"title":"Planning Your Integration","sidebarTitle":"Plan Your Integration","href":"/guides/planning/integration-planning"},{"title":"Field Operations Quickstart","sidebarTitle":"Get started with Field Operations","href":"/guides/tutorials/field-operations-quickstart"},{"title":"Preparing Files for Upload","sidebarTitle":"Prepare files for upload","href":"/guides/planning/file-preparation"},{"title":"Upload and Process Machine Files","sidebarTitle":"Upload files from monitors","href":"/guides/tutorials/manual-file-upload"},{"title":"Get Satellite Imagery for Your Fields","sidebarTitle":"Retrieve Satellite Imagery","href":"/guides/tutorials/satellite-imagery"},{"title":"Integrate Leaf Data with ArcGIS","sidebarTitle":"Integrate with ArcGIS","href":"/guides/tutorials/arcgis-integration"},{"title":"Customizing Data Sync","sidebarTitle":"Customizing Data Sync","href":"/guides/planning/data-sync-customization"},{"title":"Why Yield Values Differ Between Platforms","sidebarTitle":"Understanding Data Differences","href":"/guides/planning/yield-differences"}]}]},{"tab":"API Reference","icon":"code-simple","pages":[{"title":"API Reference","href":"/api-reference/authentication"}]},{"tab":"Resources","icon":"books","pages":[{"title":"Resources","href":"/resources/glossary"}]}]},"basePath":"","title":"Connect Leaf's MCP Server in Claude Code - Leaf Documentation","buildId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","deploymentId":"dpl_345ReqzYaAjzS9QpeJemsKdb7KDj","dynamics":[],"chunks":[]}