> For the complete documentation index, see [llms.txt](https://docs.carto.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.carto.com/carto-for-agents/connect-your-platform/claude-code.md).

# Claude Code

If you’re setting up [Claude Code](https://code.claude.com/docs/en/overview) with CARTO, that means you’ll want three integration layers:

* **CARTO MCP Server**: gives Claude Code in-conversation access to CARTO tools.
* **CARTO Agent Skills**: teaches the agent CARTO-specific workflows and conventions.
* **CARTO CLI:** handles scripting, automation, and more advanced administration.

<figure><img src="https://3029946802-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FybPdpmLltPkzGFvz7m8A%2Fuploads%2F5RmHEWsjWu5xwzFDcdW4%2Fimage.png?alt=media&amp;token=0e882c83-cb9e-460f-8e96-b6bb2525322c" alt=""><figcaption></figcaption></figure>

## Connect the MCP Server

**No SPA OAuth client is required.** Claude Code is recognized by CARTO automatically.

First, copy your **MCP Server URL** from **CARTO Workspace > Settings > CARTO MCP Server**.

Then run:

```bash
claude mcp add --transport http carto https://<region>.api.carto.com/mcp/<account_id>
```

On first use, run `/mcp` inside Claude Code and choose **Authenticate**. Claude Code opens the CARTO login in your browser and completes the OAuth flow.

{% hint style="info" %}
Connecting over OAuth gives the agent the **full tool surface:** creating and editing maps, authoring Workflows, and admin. If your organization uses SSO, use the **SSO login URL from CARTO Workspace** instead.
{% endhint %}

## Add the Agent Skills

Install the [CARTO Agent Skills](/carto-for-agents/agent-skills.md) so Claude Code follows the recommended CARTO patterns – including choosing the right tool, SQL dialect, and job-handling approach.

```shellscript
/plugin marketplace add CartoDB/agent-skills
```

Then install the CARTO skills:

```shellscript
/plugin install carto-skills@agent-skills
```

See [Agent Skills → Installation](/carto-for-agents/agent-skills/installation.md) for more details.

## Add the CLI for scripting and admin

For scripting, CI/CD, headless runs, bulk or cross-organization operations, and deeper administration and auditing – such as querying usage logs with SQL – install the CARTO CLI:

```bash
npm install -g @carto/carto-cli
```

Then authenticate:

```shellscript
carto auth login
```

The **Agent Skills know when to reach for the CLI versus the MCP Server**, allowing Claude Code to choose the appropriate path for each request.


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.carto.com/carto-for-agents/connect-your-platform/claude-code.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
