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

# MCP Server

> Use LLMGenerator directly from Claude, Cursor, Windsurf, and any MCP-compatible AI agent. Generate llms.txt files without leaving your AI chat.

The LLMGenerator MCP (Model Context Protocol) server lets AI agents generate, inspect, and validate `llms.txt` files on your behalf — without leaving the chat.

**Endpoint**: `https://mcp.llmgenerator.com/mcp`

***

## Prerequisites

You need an LLMGenerator API key. Get one in your [API Keys settings](https://app.llmgenerator.com/settings/api-keys).

Your key will look like: `llmgen_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`

***

## Setup

<Tabs>
  <Tab title="Claude Desktop">
    Edit the config file:

    * **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
    * **Windows / Linux**: `~/.config/claude/claude_desktop_config.json`

    ```json theme={null}
    {
      "mcpServers": {
        "llmgenerator": {
          "url": "https://mcp.llmgenerator.com/mcp",
          "headers": {
            "Authorization": "Bearer llmgen_your_api_key_here"
          }
        }
      }
    }
    ```

    Restart Claude Desktop. You should see the LLMGenerator tools listed under the tools icon in the chat.
  </Tab>

  <Tab title="Claude Code CLI">
    ```bash theme={null}
    claude mcp add llmgenerator \
      --url https://mcp.llmgenerator.com/mcp \
      --header "Authorization: Bearer llmgen_your_api_key_here"
    ```
  </Tab>

  <Tab title="Cursor">
    Open **Settings → MCP** and add a new server:

    * **Name**: `llmgenerator`
    * **URL**: `https://mcp.llmgenerator.com/mcp`
    * **Headers**: `Authorization: Bearer llmgen_your_api_key_here`
  </Tab>

  <Tab title="Windsurf">
    Open **Settings → AI → MCP Servers** and add:

    * **URL**: `https://mcp.llmgenerator.com/mcp`
    * **Authorization header**: `Bearer llmgen_your_api_key_here`
  </Tab>
</Tabs>

***

## Available Tools

Once connected, your AI agent has access to 9 tools:

| Tool                    | Description                                             |
| ----------------------- | ------------------------------------------------------- |
| `generate_llms_txt`     | Start generating an `llms.txt` for any website URL      |
| `get_generation_status` | Poll a job until it completes                           |
| `list_sites`            | List all your generated sites                           |
| `get_site`              | Get details and file URLs for one site                  |
| `get_llms_txt_content`  | Fetch the actual `llms.txt` text content                |
| `discover_urls`         | Crawl a site and discover its URLs                      |
| `get_discovered_urls`   | Get the URL list from a discovery job                   |
| `get_credit_balance`    | Check your credit balance and recent transactions       |
| `validate_llms_txt`     | Validate any `llms.txt` content and get a quality score |

***

## Example Prompts

Once connected, you can ask your AI agent naturally:

<AccordionGroup>
  <Accordion title="Generate llms.txt for a website">
    > "Generate an llms.txt file for stripe.com"

    The agent will call `generate_llms_txt`, poll `get_generation_status` until complete, then return the result.
  </Accordion>

  <Accordion title="List and read existing files">
    > "Show me all my generated sites and fetch the llms.txt content for the most recent one"

    The agent calls `list_sites` then `get_llms_txt_content`.
  </Accordion>

  <Accordion title="Validate llms.txt content">
    > "Validate this llms.txt and tell me how to improve it: \[paste content]"

    The agent calls `validate_llms_txt` and returns a score (0–100) with specific suggestions.
  </Accordion>

  <Accordion title="Discover site URLs before generating">
    > "Discover the URLs on docs.example.com before I decide which ones to include"

    The agent calls `discover_urls` then `get_discovered_urls` and lists them for you.
  </Accordion>

  <Accordion title="Check credits">
    > "How many credits do I have left?"

    The agent calls `get_credit_balance` and shows your balance and recent usage.
  </Accordion>
</AccordionGroup>

***

## How It Works

The MCP server runs on Cloudflare Workers and acts as a thin proxy over the LLMGenerator REST API. Your API key is forwarded with each request — the server itself stores nothing.

```
AI Agent → mcp.llmgenerator.com → api.llmgenerator.com
              (MCP protocol)          (REST API)
```

**Rate limits**: 60 requests per minute per API key. Exceeding this returns a `429` error with a clear message.

***

## Credit Usage

MCP tool calls consume the same credits as direct API calls:

| Tool                                            | Credits    |
| ----------------------------------------------- | ---------- |
| `generate_llms_txt` (simple method)             | 1 credit   |
| `generate_llms_txt` (enhanced method)           | 2 credits  |
| `discover_urls` (first scan)                    | Free       |
| `discover_urls` (rescan)                        | 10 credits |
| All read tools (`list_sites`, `get_site`, etc.) | Free       |
| `validate_llms_txt`                             | Free       |

***

## Troubleshooting

<AccordionGroup>
  <Accordion title="Tools not showing in my AI client">
    1. Confirm the URL is exactly `https://mcp.llmgenerator.com/mcp` (note the `/mcp` path)
    2. Check that your API key starts with `llmgen_`
    3. Restart your AI client after saving the config
    4. Test the connection directly:

    ```bash theme={null}
    curl -s -X POST https://mcp.llmgenerator.com/mcp \
      -H "Accept: application/json, text/event-stream" \
      -H "Authorization: Bearer llmgen_YOUR_KEY" \
      -H "Content-Type: application/json" \
      -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'
    ```
  </Accordion>

  <Accordion title="401 Unauthorized error">
    Your API key is missing or invalid. Make sure the `Authorization` header is set to `Bearer llmgen_your_key` — including the `Bearer ` prefix. Get a new key at [API Keys settings](https://app.llmgenerator.com/settings/api-keys).
  </Accordion>

  <Accordion title="429 Rate limit exceeded">
    You've made more than 60 requests in a minute with the same API key. Wait 60 seconds and try again. If you need higher limits, [contact us](mailto:llmgenerator@gmail.com).
  </Accordion>

  <Accordion title="Generation job stuck in 'processing'">
    Generation can take 1–3 minutes for large sites. The agent should keep polling `get_generation_status` automatically. If it stays stuck for over 5 minutes, try regenerating.
  </Accordion>
</AccordionGroup>

***

## Protocol Details

For developers integrating the MCP server programmatically:

* **Transport**: [Streamable HTTP](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#streamable-http) (stateless, no sessions)
* **Protocol version**: MCP `2024-11-05`
* **Auth**: `Authorization: Bearer llmgen_xxx` header
* **Content-Type**: requests must include `Accept: application/json, text/event-stream`

<Info>
  OAuth 2.1 browser-based login is on the roadmap. Once available, you'll be able to connect without manually copying an API key.
</Info>
