> For the complete documentation index, see [llms.txt](https://docs.commercelayer.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.commercelayer.io/ai/mcp/servers/docs.md).

# Documentation MCP server

Commerce Layer architecture enables AI agents to execute every commerce action programmatically. But accessible APIs are only half the equation for agentic commerce — AI agents also need to understand how to use those APIs correctly, which means access to documentation in formats they can effectively consume and reason about. In short, documentation must be AI-ready too. That's why Commerce Layer docs ship with features designed for AI systems to retrieve accurate, contextual answers in real time.

## What is the Documentation MCP?

The Commerce Layer Documentation MCP is an HTTP MCP server that gives AI assistants structured, real-time access to the full developer documentation — no scraping, no stale training data, no manual context-pasting.

The server is available at the following URL:

```http
https://docs.commercelayer.io/~gitbook/mcp
```

{% hint style="warning" %}
Opening this URL in a browser returns an error. It is an MCP endpoint, not a web page — use it only inside an MCP client configuration.
{% endhint %}

It's compatible with Claude, ChatGPT, Cursor, VS Code with GitHub Copilot, and any other client that implements the Model Context Protocol.

## Why does it exist?

The Documentation MCP exposes Commerce Layer's developer documentation as structured resources that AI tools can discover and retrieve in real time. This means an AI assistant can answer questions about the [Core API](https://docs.commercelayer.io/core/), [Metrics API](https://docs.commercelayer.io/metrics/), [Provisioning API](https://docs.commercelayer.io/provisioning/), [Rules Engine](https://docs.commercelayer.io/rules-engine/), and more by reading the actual documentation — rather than relying on its training data, which may be outdated or incomplete.

You can easily leverage it for:

* Asking questions about Commerce Layer APIs during development.
* Looking up endpoint parameters, resource schemas, and authentication patterns.
* Getting step-by-step guidance from how-to guides directly in your editor.
* Answering questions about Commerce Layer in AI-powered support workflows.

## What can you ask it?

Once connected, you can ask your AI assistant things like:

* *"How do I create an order with line items using the Core API?"*
* *"What authentication method should I use for a B2B storefront?"*
* *"What's the difference between a sales channel token and an integration token?"*
* *"Which filter predicates can I use on the orders endpoint?"*
* *"How do I use the JavaScript SDK to list SKUs with a custom filter?"*
* *"What does the `_place` trigger attribute do on an order?"*
* *"How do I set up a market with a custom price list and inventory model?"*
* *"Walk me through a complete checkout flow end to end."*
* *"Show me the full schema for the shipments resource."*

The assistant reads the actual documentation in real time — not its training data — so answers reflect the current state of the API.

## How to connect

The Documentation MCP uses [HTTP transport](https://modelcontextprotocol.io/specification/2025-06-18/basic/transports#streamable-http). There is no binary to install or build step required. Just register the endpoint URL in your MCP client's configuration. No authentication required.

{% tabs %}
{% tab title="Claude Desktop" %}
{% stepper %}
{% step %}

#### Add the Documentation MCP server

You have two options:

<details>

<summary><strong>Connect via the Claude Desktop UI (no authentication required)</strong></summary>

Open Claude Desktop, click *Customize* in the compose area, and select *Add connector*. Enter a service name — e.g. `Commerce Layer Docs` — and the endpoint URL:

```http
https://docs.commercelayer.io/~gitbook/mcp
```

</details>

<details>

<summary><strong>Connect via the config file (no token needed)</strong></summary>

Open your `claude_desktop_config.json` file:

* **MacOS** — `~/Library/Application Support/Claude/claude_desktop_config.json`
* **Windows** — `%APPDATA%\Claude\claude_desktop_config.json`.

Add the following entry under `mcpServers`:

<pre class="language-json"><code class="lang-json">{
  "mcpServers": {
    "commercelayer-docs": {
      "command": "npx",
      "args": [
<strong>        "mcp-remote",
</strong><strong>        "https://docs.commercelayer.io/~gitbook/mcp"
</strong>      ]
    }
  }
}
</code></pre>

</details>
{% endstep %}

{% step %}

#### Save and restart

Save the file and restart Claude Desktop. The server will be available in your next conversation.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
For the full setup reference, see the [Claude Desktop MCP guide](https://support.claude.com/en/articles/10949351-getting-started-with-local-mcp-servers-on-claude-desktop).
{% endhint %}
{% endtab %}

{% tab title="Cursor" %}
{% stepper %}
{% step %}

#### Open MCP settings

In Cursor, go to *Settings > Cursor Settings > MCP* and click *Add new MCP server*.
{% endstep %}

{% step %}

#### Configure the server

Set the transport type to *HTTP* and enter the endpoint URL:

```
https://docs.commercelayer.io/~gitbook/mcp
```

Give it a name — e.g. `commercelayer-docs`.
{% endstep %}

{% step %}

#### Save the configuration

Click *Save*. The server will appear in your MCP tools list and will be available to the Cursor AI assistant.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
For the full setup reference, see the [Cursor MCP documentation](https://cursor.com/docs/context/mcp).
{% endhint %}
{% endtab %}

{% tab title="VS Code" %}
{% stepper %}
{% step %}

#### Configure the server

You have two options:

<details>

<summary><strong>Command palette</strong></summary>

Open the [Command Palette](https://code.visualstudio.com/docs/editing/userinterface#_command-palette) by pressing:

* **MacOS** — `Cmd+Shift+P`
* **Windows** — `Ctrl+Shift+P`

Run *MCP: Add Server*, select *HTTP* as the transport type and enter the endpoint URL:

```
https://docs.commercelayer.io/~gitbook/mcp
```

</details>

<details>

<summary><strong>Configuration file</strong></summary>

Add the server directly to your `.vscode/mcp.json` file:

<pre class="language-json"><code class="lang-json">{
  "servers": {
    "commercelayer-docs": {
      "type": "http",
<strong>      "url": "https://docs.commercelayer.io/~gitbook/mcp"
</strong>    }
  }
}
</code></pre>

</details>
{% endstep %}

{% step %}

#### Verify the connection

Once registered, GitHub Copilot in agent mode can use the Documentation MCP as a tool. Open a Copilot chat and confirm the server appears in the available tools list.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
For the full setup reference, see the [VS Code MCP guide](https://code.visualstudio.com/docs/copilot/customization/mcp-servers).
{% endhint %}
{% endtab %}
{% endtabs %}

### Authentication and permissions

The Documentation MCP requires no authentication. The endpoint is publicly accessible — no token, no credentials, and no setup beyond registering the URL in your client.

{% hint style="info" icon="pen-nib-slash" %}
The Documentation MCP is read-only by design. There are no write operations and no access to Commerce Layer account data.
{% endhint %}

## List of tools

Two tools are available, designed to work in sequence: search to surface relevant content, then fetch to read any page in full.

<table><thead><tr><th width="260">Tool</th><th width="130" data-type="checkbox">Can write?</th><th>Description</th></tr></thead><tbody><tr><td><code>searchDocumentation</code></td><td>false</td><td>Search across the documentation to find relevant information, code examples, API references, and guides. Returns contextual content with titles and direct links to the matching pages.</td></tr><tr><td><code>getPage</code></td><td>false</td><td>Fetch the full markdown content of a documentation page by URL. Use after <code>searchDocumentation</code> when partial results are not enough and you need the complete page.</td></tr></tbody></table>

## LLM-friendly formats

Beyond the MCP server, to make Commerce Layer APIs documentation content available in [text-based formats](https://llmstxt.org/) that are easier for LLMs to process, ingest, and work with, you can leverage the following [text files](#llms.txt-files). On top of that, all of the pages of Commerce Layer docs are automatically available as [markdown files](#per-page-markdown).

### `llms.txt` files

Two LLM-optimized text files are available at the root of the docs site.

* [Index](https://docs.commercelayer.io/llms.txt) — contains an index of all the page URLs and titles of our API docs sites, providing a comprehensive list of all available markdown-formatted pages:

```
https://docs.commercelayer.io/llms.txt
```

* [Full content](https://docs.commercelayer.io/llms-full.txt) — contains the full content of our API docs sites in one file that can be passed to LLMs as context:

```
https://docs.commercelayer.io/llms-full.txt
```

{% hint style="success" %}
You can pass them directly to a model as context — useful when you want to prime a model with Commerce Layer knowledge without a live tool connection.
{% endhint %}

{% hint style="info" %}
To query Core API documentation specifically, use the [Core MCP server](/ai/mcp/servers/core.md), which includes documentation tools scoped to Core API content.
{% endhint %}

### Per-page markdown

Every documentation page is available as a markdown file. If you append the `.md` extension to any page, you will see the content of that page rendered in markdown which you can pass to an LLM for more efficient processing without the overhead of HTML parsing. For example:

```
https://docs.commercelayer.io/core-api-reference/orders/retrieve.md
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.commercelayer.io/ai/mcp/servers/docs.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
