---
url: https://docs.sunlicense.com/guide/ai-assistants.md
description: >-
  Use SunLicense with Claude Code, Codex, Cursor, Antigravity or Copilot - docs
  written for assistants (llms.txt), a ready prompt per language, the MCP server
  and the Claude Code plugin.
---

# Use SunLicense with your AI assistant

Your coding assistant can add SunLicense to your project and test it for you. There are three levels;
the first two work on every plan.

| | What the assistant gets | Plans |
|---|---|---|
| [Docs for assistants](#docs-for-assistants) | Every docs page as plain Markdown | All |
| [A prompt to paste](#a-prompt-to-paste) | What to build and the rules to follow, for your language | All |
| [MCP server](#let-it-manage-your-account-mcp) | Tools to create products, issue a test license, create an API key and test a key | Lite, Standard |

## Docs for assistants

These docs are published in the [llms.txt](https://llmstxt.org) format, which assistants read better than web pages:

| URL | Holds |
|---|---|
| [docs.sunlicense.com/llms.txt](https://docs.sunlicense.com/llms.txt) | The table of contents, with a link to each page |
| [docs.sunlicense.com/llms-full.txt](https://docs.sunlicense.com/llms-full.txt) | Every page in one file |
| `docs.sunlicense.com/<page>.md` | One page as Markdown, e.g. [/guide/sdks.md](https://docs.sunlicense.com/guide/sdks.md) |

Tell your assistant to read them ("use https://docs.sunlicense.com/llms.txt"), or add the URL to its docs
settings (Cursor: **@Docs → Add new doc**).

## A prompt to paste

Copy the prompt for your language into your assistant, in your project. It holds no keys: the assistant
reads the docs and your API key stays in an environment variable. The dashboard has the same prompt on
**SDKs** (and in the **Get set up** checklist, matched to your answers).

::: code-group

```text [Java]
Add SunLicense license checks to my software (Java).

- Docs written for AI assistants: https://docs.sunlicense.com/llms.txt (all pages in one file: https://docs.sunlicense.com/llms-full.txt). Read https://docs.sunlicense.com/guide/sdks.md first.
- Base URL: https://api.sunlicense.com
- Read the API key from configuration or an environment variable named SUNLICENSE_API_KEY; never hard-code it.
- Read the customer's license key from the app's config file (ask me where). Never print or log the full key.
- Use the official SDK: implementation 'com.sunlicense:sunlicense:0.0.1' (source and README: https://github.com/sunlicense-com/sunlicense-java).
- Send a stable machine id as host so each machine counts as one activation.
- Check once on startup. If the license is rejected, show the reason and stop the paid features; if SunLicense can't be reached, keep working (fail open).
```

```text [JavaScript]
Add SunLicense license checks to my software (JavaScript).

- Docs written for AI assistants: https://docs.sunlicense.com/llms.txt (all pages in one file: https://docs.sunlicense.com/llms-full.txt). Read https://docs.sunlicense.com/guide/sdks.md first.
- Base URL: https://api.sunlicense.com
- Read the API key from configuration or an environment variable named SUNLICENSE_API_KEY; never hard-code it.
- Read the customer's license key from the app's config file (ask me where). Never print or log the full key.
- Use the official SDK: npm install sunlicense (source and README: https://github.com/sunlicense-com/sunlicense-js).
- Send a stable machine id as host so each machine counts as one activation.
- Check once on startup. If the license is rejected, show the reason and stop the paid features; if SunLicense can't be reached, keep working (fail open).
```

```text [Python]
Add SunLicense license checks to my software (Python).

- Docs written for AI assistants: https://docs.sunlicense.com/llms.txt (all pages in one file: https://docs.sunlicense.com/llms-full.txt). Read https://docs.sunlicense.com/guide/sdks.md first.
- Base URL: https://api.sunlicense.com
- Read the API key from configuration or an environment variable named SUNLICENSE_API_KEY; never hard-code it.
- Read the customer's license key from the app's config file (ask me where). Never print or log the full key.
- Use the official SDK: pip install sunlicense (source and README: https://github.com/sunlicense-com/sunlicense-py).
- Send a stable machine id as host so each machine counts as one activation.
- Check once on startup. If the license is rejected, show the reason and stop the paid features; if SunLicense can't be reached, keep working (fail open).
```

```text [.NET]
Add SunLicense license checks to my software (.NET).

- Docs written for AI assistants: https://docs.sunlicense.com/llms.txt (all pages in one file: https://docs.sunlicense.com/llms-full.txt). Read https://docs.sunlicense.com/guide/sdks.md first.
- Base URL: https://api.sunlicense.com
- Read the API key from configuration or an environment variable named SUNLICENSE_API_KEY; never hard-code it.
- Read the customer's license key from the app's config file (ask me where). Never print or log the full key.
- Use the official SDK: dotnet add package SunLicense (source and README: https://github.com/sunlicense-com/sunlicense-dotnet).
- Send a stable machine id as host so each machine counts as one activation.
- Check once on startup. If the license is rejected, show the reason and stop the paid features; if SunLicense can't be reached, keep working (fail open).
```

```text [PHP]
Add SunLicense license checks to my software (PHP).

- Docs written for AI assistants: https://docs.sunlicense.com/llms.txt (all pages in one file: https://docs.sunlicense.com/llms-full.txt). Read https://docs.sunlicense.com/guide/sdks.md first.
- Base URL: https://api.sunlicense.com
- Read the API key from configuration or an environment variable named SUNLICENSE_API_KEY; never hard-code it.
- Read the customer's license key from the app's config file (ask me where). Never print or log the full key.
- Use the official SDK: composer require sunlicense/sunlicense (source and README: https://github.com/sunlicense-com/sunlicense-php).
- Send a stable machine id as host so each machine counts as one activation.
- Check once on startup. If the license is rejected, show the reason and stop the paid features; if SunLicense can't be reached, keep working (fail open).
```

```text [Lua (FiveM)]
Add SunLicense license checks to my FiveM resource (Lua).

- Docs written for AI assistants: https://docs.sunlicense.com/llms.txt (all pages in one file: https://docs.sunlicense.com/llms-full.txt). Read https://docs.sunlicense.com/guide/sdks.md first.
- Base URL: https://api.sunlicense.com
- Read the API key from configuration or an environment variable named SUNLICENSE_API_KEY; never hard-code it.
- Read the customer's license key from the app's config file (ask me where). Never print or log the full key.
- Use the official SDK: luarocks install sunlicense (source and README: https://github.com/sunlicense-com/sunlicense-lua).
- Send a stable machine id as host so each machine counts as one activation.
- Check once on startup. If the license is rejected, show the reason and stop the paid features; if SunLicense can't be reached, keep working (fail open).
```

```text [Any other language]
Add SunLicense license checks to my software.

- Docs written for AI assistants: https://docs.sunlicense.com/llms.txt (all pages in one file: https://docs.sunlicense.com/llms-full.txt). Read https://docs.sunlicense.com/guide/sdks.md first.
- Base URL: https://api.sunlicense.com
- Read the API key from configuration or an environment variable named SUNLICENSE_API_KEY; never hard-code it.
- Read the customer's license key from the app's config file (ask me where). Never print or log the full key.
- Call POST /api/v2/license/validate with JSON {"license": "<key>", "host": "<stable machine id>"} and the API key as a Bearer token. HTTP 200 means valid, 400 means rejected (the body's code says why).
- Send a stable machine id as host so each machine counts as one activation.
- Check once on startup. If the license is rejected, show the reason and stop the paid features; if SunLicense can't be reached, keep working (fail open).
```

:::

Selling a Minecraft plugin or mod, a FiveM resource or a Discord bot? Start from a [template](/guide/templates)
instead: each one has the check built in and an `AGENTS.md` that tells assistants how to work in it.

## Let it manage your account (MCP)

With the [SunLicense CLI](/cli/) installed, `sunlicense mcp` gives the assistant tools to create a
product and policy, issue a test license, create an API key for your app, block a machine and check a
key the way your app does, so it can test what it built. It's included in **Lite** (300 tool calls a day)
and **Standard** (3,000 a day).

1. Create a **personal access token** under **Settings → Personal access tokens** with only the scopes
   the assistant needs (or sign in with `sunlicense login`; that session lasts 12 hours).
2. Add the server:

::: code-group

```bash [Claude Code]
claude mcp add sunlicense --env SUNLICENSE_TOKEN=slp_... -- sunlicense mcp
```

```bash [Codex CLI]
codex mcp add sunlicense --env SUNLICENSE_TOKEN=slp_... -- sunlicense mcp
```

```json [Cursor and Antigravity]
{
  "mcpServers": {
    "sunlicense": {
      "command": "sunlicense",
      "args": ["mcp"],
      "env": { "SUNLICENSE_TOKEN": "slp_..." }
    }
  }
}
```

:::

[AI assistants (MCP)](/cli/mcp) lists every tool, the daily limits and what stays private.

## Claude Code plugin

The SunLicense plugin bundles a skill that knows how to add a license check the right way (official
SDK, API key outside source control, stable machine id, fail open, masked keys, no bypasses) with the
MCP server above:

```text
/plugin marketplace add sunlicense-com/claude-plugin
/plugin install sunlicense@sunlicense
```

Sign in with `sunlicense login` or export `SUNLICENSE_TOKEN` before starting Claude Code so the MCP
server can reach your account. The skill works on every plan; on Free the MCP server stops with an
upgrade link. Source: [github.com/sunlicense-com/claude-plugin](https://github.com/sunlicense-com/claude-plugin).

## Good to know

* **Never give your app a personal access token.** Apps use an API key (`slk_…`); tokens (`slp_…`) are
  for the CLI and assistants, and can do everything their scopes allow.
* **Review the check.** Ask the assistant to show you where it reads the API key and what happens when
  SunLicense says no or can't be reached. The [SDKs page](/guide/sdks#handling-errors) has the
  recommended behaviour.
* **Your code stays yours.** SunLicense receives the API calls the CLI makes, never your prompts or code.
