> ## Documentation Index
> Fetch the complete documentation index at: https://lmn.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Build with AI (Lovable, Cursor, Claude)

> Connect our docs MCP server to your AI builder and integrate the LMN API without hand-writing the plumbing.

## Overview

<Note>
  **You need a sandbox key first.** Sign up at [console.lmnauto.com](https://console.lmnauto.com/console/signup) — work email and company name, auto-approved, key in hand in about five minutes. It carries a **1,000-call trial budget**, which is enough to build and demo an integration but will not survive a page that polls on every render. See [Quickstart](/quickstart#get-a-sandbox-key).
</Note>

If you build with an AI tool — Lovable, Cursor, Claude Code, or Claude Desktop — you don't need to paste our docs into prompts. We publish two machine-readable surfaces that keep your AI grounded in the real API instead of guessing:

| Asset           | URL                                 | What it does                                                                  |
| --------------- | ----------------------------------- | ----------------------------------------------------------------------------- |
| Docs MCP server | `https://lmn.mintlify.app/mcp`      | Lets your AI search and read these docs live while it writes your integration |
| llms.txt        | `https://lmn.mintlify.app/llms.txt` | One-page docs index for tools that ingest a URL instead of connecting MCP     |

The MCP server is public and read-only — no key, no OAuth. It searches documentation; it does not call the API or see your data.

<Warning>
  **The LMN API is server-to-server only.** There is no browser CORS support — a website calling `api.lmnauto.com` directly from frontend JavaScript will fail before the request is sent, and your API key would be exposed to every visitor if it didn't. All calls must come from a backend (server, serverless function, or edge function) that holds your key privately. Every recipe on this page follows that rule.
</Warning>

## Connect the MCP server

| Your tool                  | How to connect                                                     |
| -------------------------- | ------------------------------------------------------------------ |
| Lovable                    | **Connectors → Chat connectors → New MCP server** → paste the URL  |
| Claude Code                | `claude mcp add --transport http lmn https://lmn.mintlify.app/mcp` |
| Claude Desktop / claude.ai | **Settings → Connectors → Add custom connector** → paste the URL   |
| Cursor                     | **Settings → MCP** → add server with the URL                       |

Once connected, your AI gains a search tool and a docs-reading tool. Ask it anything about the API ("how does authentication work?", "what does a vehicle object look like?") and it will answer from the current published docs.

## Integrating from Lovable

Lovable generates frontend code and delegates everything server-side to a backend it provisions for you (Lovable Cloud, built on Supabase). Because the LMN API is server-to-server only, that backend is not optional — it's where your API key lives and where the calls happen.

<Steps>
  <Step title="Let Lovable create its backend">
    When Lovable asks you to connect **Supabase** (or enable **Lovable Cloud**), approve it. This is the step that makes a secure integration possible — if you skip it, Lovable cannot store your key or call our API, and the integration silently goes nowhere.
  </Step>

  <Step title="Add the LMN docs connector">
    In Lovable: **Connectors → Chat connectors → New MCP server** → paste `https://lmn.mintlify.app/mcp`. Now Lovable reads our real endpoint contracts instead of inventing them.
  </Step>

  <Step title="Paste the integration prompt">
    Use this as your Lovable prompt (edit the page description to taste):

    ```text theme={null}
    Add a "Live Inventory" page showing vehicles from the LMN Open API.
    Use the LMN MCP connector to read the API documentation first.

    Requirements:
    - FIRST, before building anything: call
      GET https://sandbox-api.lmnauto.com/v1/vehicles?limit=1 from the
      backend with my API key in the x-api-key header and show me the
      response. Only proceed once it returns 200.
    - Create a backend edge function that calls
      https://sandbox-api.lmnauto.com/v1/vehicles with my API key in the
      x-api-key header. Store the key as a backend secret named LMN_API_KEY.
    - Never call the LMN API from the browser and never put the key in
      frontend code. The frontend talks only to the edge function.
    - Show each vehicle's photo, make, model, year, and price, with a
      detail view backed by /v1/vehicles/{id}.
    ```
  </Step>

  <Step title="Add your API key as a secret">
    When Lovable asks for `LMN_API_KEY`, paste your key **there and only there**. Start with your sandbox key (`lmn_stg_*`) against `sandbox-api.lmnauto.com`; switch the base URL and key to production (`lmn_prd_*`, `api.lmnauto.com`) once the page works.
  </Step>

  <Step title="Verify">
    Load the preview. If vehicles render, you're live. If not, ask Lovable to show the edge function's response — then check the [error code matrix](/errors). The two most common first-run failures are a missing `x-api-key` header and an IP allowlist rejection (below).
  </Step>
</Steps>

<Note>
  **IP allowlist:** sandbox trial keys have **no allowlist** — Lovable Cloud, Supabase Edge Functions, and Vercel all work out of the box. Production keys *are* restricted to registered egress IPs (see [Authentication](/authentication)), which serverless platforms with rotating pools cannot satisfy directly. Build and certify on sandbox, then use **Request production access** in the console and tell us you're deploying serverless — we'll plan the egress setup with you rather than leaving you to discover it at cutover.
</Note>

<Warning>
  **Watch the trial budget while your AI iterates.** Every authenticated call counts against the 1,000-call budget, including the ones your tool makes while debugging its own code. An agent stuck in a retry loop can burn the whole budget in a minute. Ask it to cache responses during development, and check `X-Quota-Remaining` on any response — when it hits zero you'll get [`429 rate_limited`](/errors#trial-budget-exhausted), which does not clear on its own.
</Warning>

## Other AI coding tools

The same shape applies outside Lovable: connect the MCP server, then ask your tool to build a **server-side** client. For a Next.js app that means an API route or server component; for plain Node, any server process. Keep `LMN_API_KEY` in environment variables or a secret manager — never in code that ships to a browser.

## If something doesn't work

Email `partners@lmnauto.com` with what your tool generated — the request code and the response body — or message your LMN contact if you have one. Include the `request_id` from the error envelope (also returned as the `X-Request-Id` header): it lets us find your exact call in our logs. We can see whether your key's calls reach us at all, and "nothing arrived" versus "arrived but rejected" points to completely different fixes.
