> 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/snowflake-coco.md).

# Snowflake CoCo

[Snowflake CoCo](https://docs.snowflake.com/en/user-guide/cortex-code/cortex-code) is Snowflake's coding agent, available in Snowsight, as a desktop IDE, and as a CLI that runs in your local shell. It can work with CARTO through a remote MCP server, the CARTO Agent Skills, and the CARTO CLI.

* **CARTO MCP:** gives CoCo access to CARTO tools.
* **CARTO Agent Skills:** gives CoCo reusable CARTO-specific instructions and workflows.
* **CARTO CLI:** provides command-line access for scripting, automation, and administration.

Together, these let CoCo use CARTO tools while following CARTO-specific patterns and processes.

{% hint style="info" %}
CoCo is the coding agent. For the chat surface, where CARTO is reached through a Cortex agent and an MCP Connector, see [Snowflake CoWork](/carto-for-agents/connect-your-platform/snowflake-cowork.md).
{% endhint %}

## MCP

### Connect to the MCP Server

First, copy your **MCP Server URL** from **CARTO Workspace > Settings > CARTO MCP Server**. Then add CARTO with the CoCo CLI:

```
cortex mcp add carto https://<region>.api.carto.com/mcp/<account_id> --type http
```

Alternatively, add the server manually to `~/.snowflake/cortex/mcp.json`:

```json
{
  "mcpServers": {
    "carto": {
      "type": "http",
      "url": "https://<region>.api.carto.com/mcp/<account_id>",
      "oauth": {
        "client_id": "<your SPA client id>",
        "redirect_port": 8585,
        "scope": "openid profile email read:workflows write:workflows"
      }
    }
  }
}
```

Replace `<region>` and `<account_id>` with the values from your CARTO MCP Server URL.

Use `cortex mcp list` to confirm the server is registered.

### Authentication

CoCo uses OAuth to authenticate to CARTO. Before connecting the MCP server, create and configure a SPA OAuth Client in CARTO.

#### **1. Create a SPA OAuth Client**

In CARTO, go to **Developers > Credentials > SPA OAuth Clients** and create a new client.

#### **2. Configure the callback URL**

CoCo uses a local callback to complete the OAuth flow.

When configuring the SPA OAuth Client:

1. Open the client you created.
2. Turn off **Use default logout/callback URLs and Origins**.
3. Add the callback URL using the port configured in CoCo's `redirect_port`.

For example:

```
http://localhost:8585
```

Make sure the port in the callback URL matches the `redirect_port` you configure in CoCo.

#### **3. Connect the MCP Server**

Configure the CARTO MCP Server in CoCo using the **MCP Server URL** and the **SPA OAuth Client ID**:

```
{  "oauth": {    "client_id": "<your SPA client id>",    "redirect_port": 8585,    "scope": "openid profile email read:workflows write:workflows"  }}
```

#### **4. Sign in to CARTO**

The first time CoCo connects to the CARTO MCP Server, it opens a browser window. Sign in to CARTO to authorize the connection.

Once authentication is complete, CoCo can use the CARTO tools available through MCP.

{% hint style="info" %}
If sign-in fails with a callback error, check the `redirect_uri` parameter in the authorization URL in your browser. This shows the exact callback URL CoCo is using, which must be registered on the SPA OAuth Client.
{% endhint %}

See [Connecting with OAuth](/carto-for-agents/mcp-server/connecting-with-oauth.md) for the shared OAuth mechanics.

## CARTO CLI

The CoCo CLI runs in a terminal, so the [CARTO CLI](/carto-for-agents/cli.md) can be used alongside MCP and Agent Skills for scripting, automation, and administration.

Install the CLI:

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

Authenticate:

```
carto auth login
```

The CLI is useful when a task is better suited to command-line operations, scripting, or CARTO administration than to an MCP tool call.

## Agent Skills

[CARTO Agent Skills](/carto-for-agents/agent-skills.md) complement MCP and the CLI. They provide CARTO-specific instructions and workflows that help CoCo use both interfaces consistently and idiomatically.

CoCo reads skills from several locations, including `.claude/skills/` in a project and `~/.claude/skills/` for a user, alongside its own `.cortex/skills/` and `~/.snowflake/cortex/skills/`. Each skill is a folder containing a `SKILL.md` file with YAML frontmatter.

If you have already installed the CARTO Agent Skills for another coding agent that uses `~/.claude/skills/`, CoCo picks them up with no further setup. Otherwise, see [**Agent Skills → Installation**](/carto-for-agents/agent-skills/installation.md).

MCP provides CoCo with access to CARTO tools, while the CLI provides command-line capabilities. Skills provide the guidance for using them effectively.


---

# 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/snowflake-coco.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.
