Use with AI

Let your AI build on Leaf API.

Paste one prompt into your coding agent and it connects the Leaf API MCP server and installs the Leaf API skill. After that, any prototype or demo it builds gets a working backend, and it can manage your data for you.

Sign in and your API key is filled into every snippet. Otherwise, replace YOUR_LEAF_API_KEY with the key from your dashboard.

1

Paste one prompt into your coding agent

Works with Claude Code, Codex, Cursor, VS Code Copilot, Windsurf, Gemini CLI and other agents that can run commands or edit files. The agent detects which tool it's running in, adds the MCP server and installs the skill (steps 2 and 3), then checks the connection. If it gets stuck, it asks you before it continues.

Setup prompt
Set up Leaf API (https://leafapi.com) for me so you can use it as the backend for prototypes and demos. When you're done I want both the Leaf API MCP server and the Leaf API skill installed for the tool you are running in.

How to work:
- Go through the steps below in order and do the work yourself (run the commands, edit the files). Don't just tell me what to do.
- If something blocks you (a missing value, a permission you don't have, a command that fails, a step that doesn't apply to your tool), stop and ask me one short, specific question. Once I answer, continue from where you stopped.
- If you have web access and are unsure of your tool's current config format, check its official docs before you write anything.
- Never print my API key in your replies or in logs.

Step 1. Work out your environment
- Which tool you are (Claude Code, Codex, Cursor, VS Code Copilot, Windsurf, Gemini CLI, or something else), the OS, and whether you can run shell commands and write files in my home directory.
- If you can't tell which tool you are, ask me.

Step 2. Get my API key
- I haven't given you my key yet. Ask me to paste my Leaf API key (it's shown on https://leafapi.com/dashboard after signing in). Don't continue until you have it.
- In the rest of these steps, LEAF_API_KEY means this key.

Step 3. Check what's already installed
- Look for an existing "leafapi" MCP server entry and an existing Leaf API skill or rules file in the locations listed in steps 4 and 5.
- If they're already set up with the same URL and key, say so and skip that step. If they're outdated, update them in place. Never add a duplicate entry.

Step 4. Add the Leaf API MCP server
It's a remote MCP server using streamable HTTP. It needs no install, only a URL and one header:
   - name: leafapi
   - url: https://leafapi.com/api/mcp
   - header: leaf-api-key: LEAF_API_KEY
Use the method for your tool. When you edit a config file, keep all its existing entries, create the file if it's missing, and make sure the result is still valid JSON or TOML:
   - Claude Code: run `claude mcp add --transport http --scope user leafapi https://leafapi.com/api/mcp --header "leaf-api-key: LEAF_API_KEY"`
   - Codex: in ~/.codex/config.toml add a [mcp_servers.leafapi] table with url = "https://leafapi.com/api/mcp" and http_headers = { "leaf-api-key" = "LEAF_API_KEY" }
   - Cursor: in ~/.cursor/mcp.json under "mcpServers": { "leafapi": { "url": "https://leafapi.com/api/mcp", "headers": { "leaf-api-key": "LEAF_API_KEY" } } }
   - VS Code / Copilot: in .vscode/mcp.json under "servers": { "leafapi": { "type": "http", "url": "https://leafapi.com/api/mcp", "headers": { "leaf-api-key": "LEAF_API_KEY" } } }
   - Windsurf: in ~/.codeium/windsurf/mcp_config.json under "mcpServers": { "leafapi": { "serverUrl": "https://leafapi.com/api/mcp", "headers": { "leaf-api-key": "LEAF_API_KEY" } } }
   - Gemini CLI: in ~/.gemini/settings.json under "mcpServers": { "leafapi": { "httpUrl": "https://leafapi.com/api/mcp", "headers": { "leaf-api-key": "LEAF_API_KEY" } } }
   - Anything else: look up how your tool adds a remote HTTP MCP server with a custom header. If it only supports local (stdio) servers, use: npx -y mcp-remote https://leafapi.com/api/mcp --header "leaf-api-key: LEAF_API_KEY"
   - If your tool can't use MCP at all, tell me and continue with step 5. The skill works on its own.

Step 5. Install the Leaf API skill
- Download https://leafapi.com/skills/leafapi/SKILL.md with curl or your web-fetch tool. If you have no network access, ask me to paste its contents.
- Save it where your tool will read it:
   - Claude Code: ~/.claude/skills/leafapi/SKILL.md
   - Codex: ~/.codex/skills/leafapi/SKILL.md
   - Cursor: .cursor/rules/leafapi.mdc in this project. Replace the front matter with "description" (copied from the skill) and "alwaysApply: false".
   - Windsurf: .windsurf/rules/leafapi.md in this project
   - VS Code / Copilot: append it to .github/copilot-instructions.md under a "## Leaf API" heading
   - Anything else: append it to AGENTS.md (or whichever global instructions file you read) under a "## Leaf API" heading, unless that heading is already there

Step 6. Verify
- Check every file you changed: it exists, it parses, and the key is correct.
- If you can list MCP servers (for example `claude mcp list` or `codex mcp list`), confirm leafapi shows up and is connected.
- If the Leaf API MCP tools are already available in this session, call leaf_usage to confirm the connection and show me my plan and limits. If they aren't available yet, tell me exactly what to restart or reload, and what to ask you afterwards to run the check.

Step 7. Report
Finish with a short checklist:
- MCP server: done, already set up, or not possible (where it was added, or why not)
- Skill: done, already set up, or not possible (path)
- What I still need to do, if anything (restart, reload, approve a server)
2

Or connect the MCP server yourself

The MCP server lets your AI list, create, update and delete your Leaf API data, check usage and plan limits, and seed demo data. It's hosted at https://leafapi.com/api/mcp, so there's nothing to install.

Run in your terminal. --scope user makes it available in every project.

Claude Code config
claude mcp add --transport http --scope user leafapi https://leafapi.com/api/mcp \
  --header "leaf-api-key: YOUR_LEAF_API_KEY"
3

Add the Leaf API skill

The skill tells your AI to use Leaf API whenever a prototype, demo or MVP needs a backend, and covers the API, limits and a ready-made client. It uses the MCP tools when they're connected and plain fetch in the code it writes.

Installs the skill for every project. Claude loads it whenever a task fits.

Install command
mkdir -p ~/.claude/skills/leafapi && \
  curl -fsSL https://leafapi.com/skills/leafapi/SKILL.md -o ~/.claude/skills/leafapi/SKILL.md
Download SKILL.md
4

Using a chat AI with no MCP?

For ChatGPT, v0, Lovable, Bolt and similar tools, paste this at the start of your request so the app they generate stores its data in Leaf API.

Prompt
Use Leaf API as the backend for this app. Do not create a server or database.

Base URL: https://leafapi.com/api
Auth header on every request: leaf-api-key: YOUR_LEAF_API_KEY
Data model: project -> module -> records. Records are any JSON object. Projects and modules are created automatically on the first write. Leaf API adds "id" and "created_at" to each record; never send those yourself.

Endpoints:
- GET    /{project}/{module}?page=1&limit=25&sort_field=created_at&sort_order=desc&search=   -> { data: [...], meta: { total, total_pages, page, per_page } }
- POST   /{project}/{module}         body: JSON object                                       -> { data: record }
- GET    /{project}/{module}/{id}                                                            -> { data: record }
- PATCH  /{project}/{module}/{id}    body: fields to merge                                   -> { data: record }
- DELETE /{project}/{module}/{id}
Errors return { error: "message" } (400, 401, 403 plan limit, 404, 429 rate limit). Show the message to the user.

Rules: use one project for this app and one module per entity. There are no server-side filters or joins, so store related ids and filter on the client or use "search". The rate limit is 120 requests/min, so don't send one request per item in a loop. Keep the key in a single config constant.

Full reference: https://leafapi.com/skills/leafapi/SKILL.md

The MCP tools use the same limits as the REST API. See API endpoints and plan limits.