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

# Usar com IA (MCP)

> Connect Claude Code, Claude Desktop, Cursor, Windsurf, or VS Code to CamposCloud.

The Model Context Protocol (MCP) gives an AI assistant tools to work with your CamposCloud account. Your client runs the `@camposcloud/mcp` server locally over standard input and output (stdio). The server calls the CamposCloud API with your token.

Use Node.js 22.12 or later with npm. This guide covers `@camposcloud/mcp` version 0.1.1.

## Create a token

1. In the CamposCloud dashboard, open **Perfil → Desenvolvedor**.
2. Create a token just for the assistant, give it a recognizable name, and set an expiration date. Your account can have several tokens, each with its own expiration.
3. Copy the token, which starts with `cc_pat_`, and use it as `CAMPOS_TOKEN` in your client's configuration. The token uses your account's permissions.

> [!WARNING]
>
> Keep the token out of chat and version control. If it leaks, revoke it in **Perfil → Desenvolvedor** and configure a new token.

## Connect your assistant

Replace `SEU_TOKEN` with your token wherever it appears. The server uses the public CamposCloud API by default. To connect to a local API, set `CAMPOS_API_URL` to its base URL without the `/v1` suffix.

### Claude Code

```sh theme={null}
claude mcp add camposcloud --transport stdio -e CAMPOS_TOKEN=SEU_TOKEN -- npx -y @camposcloud/mcp
```

Put the name `camposcloud` before `-e` so the option does not consume it as another environment value. The default scope applies to the current project. Add `-s user` after `camposcloud` to use the server in any project.

On Windows, use `-- cmd /c npx -y @camposcloud/mcp` at the end of the command. If you use Git Bash, prefix the command with `MSYS_NO_PATHCONV=1` to keep Git Bash from rewriting `/c`.

### Claude Desktop, Cursor, and Windsurf

Open the configuration file for your client:

| Client | Configuration |
| - | - |
| Claude Desktop | **Settings → Developer → Edit Config** opens `claude_desktop_config.json`. |
| Cursor | Use `~/.cursor/mcp.json` for all projects or `.cursor/mcp.json` for the current project. |
| Windsurf | Use `~/.codeium/windsurf/mcp_config.json`. |

Add `camposcloud` under `mcpServers`, keeping any existing servers, and restart the client.

```json theme={null}
{
  "mcpServers": {
    "camposcloud": {
      "command": "npx",
      "args": ["-y", "@camposcloud/mcp"],
      "env": {
        "CAMPOS_TOKEN": "SEU_TOKEN"
      }
    }
  }
}
```

### VS Code

Run **MCP: Open User Configuration** from the Command Palette and add the following configuration. When the server starts, VS Code prompts for the token in a password field and keeps the value out of the configuration file.

```json theme={null}
{
  "inputs": [
    {
      "type": "promptString",
      "id": "campos-token",
      "description": "CamposCloud token",
      "password": true
    }
  ],
  "servers": {
    "camposcloud": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "@camposcloud/mcp"],
      "env": {
        "CAMPOS_TOKEN": "${input:campos-token}"
      }
    }
  }
}
```

### Windows JSON configuration

If your client cannot find `npx` on Windows, set `command` to `cmd` and start `args` with `"/c", "npx"`:

```json theme={null}
"command": "cmd",
"args": ["/c", "npx", "-y", "@camposcloud/mcp"]
```

## What to ask

Start with “Which CamposCloud account is connected?” Then try a request like one of these:

* “Show the last 100 console lines for `store-api` that contain `ERROR`.”
* “Restart `store-api` in the `Shop` team.”
* “Create a Node.js app called `store-api` from `/home/dev/projects/store-api` with 512 MB of memory and the start command `npm start`.”
* “Create a PostgreSQL database called `store-db` with 512 MB of memory, user `store`, and database name `store`. Ask for the password before creating it.”
* “Set `LOG_LEVEL` to `info` in `store-api` and list the variable names.”

## Confirm irreversible actions

Six actions require confirmation: delete an application and its files, delete selected files or folders, delete a database and its data, change a database password and invalidate the old one, remove a team member, and delete a team.

If your client shows a form, review the action and type the exact name shown. For file deletion, type the application name. For member removal, type the member's name.

If your client does not support the form, the assistant must show you the action and ask for approval. After you approve, it repeats the request with a single-use confirmation code. The code expires after two minutes and only applies to the original action and target.

## Limits and data access

| Operation | Limit or behavior |
| - | - |
| Console logs | A sample of up to 500 lines and 96 KiB per request, with a four-second read limit. The default is 200 lines. |
| GitHub deploy logs | Up to the last 65,536 characters. |
| App files | Read UTF-8 text up to 256 KiB and write up to 1 MiB. Move or delete up to 50 paths per request. |
| Uploads | Use an absolute local path. The source contents and the resulting ZIP each have a 50 MiB limit. Folder uploads support up to 10,000 entries, follow `.gitignore`, and exclude `.env*`, `.git`, and `node_modules`. |
| Folder deploys | Upload to the application root and restart by default. Set `restart: false` to skip the restart. Remote files missing from the upload stay in place. |
| Downloads | Save up to 200 MiB of file contents as a ZIP at an absolute local path. Folder downloads include `.env.example`, `.env.sample`, and `.env.template`. Use `includeEnv: true` to include private environment files in a folder download, or `overwrite: true` to replace an existing local ZIP. |
| Environment variables | The tools edit the application's `.env` file. Values are hidden by default. Use `reveal: true` only when you want the values sent to the assistant. |

The database API provides connection details such as host, port, and username. The password stays out of API responses. Use the password you set when you created the database or last changed its credentials.

## Tools by group

Tool names start with `campos_`. You can ask for the task in plain language.

| Group | Available actions |
| - | - |
| Account | Check the connected account and list supported runtimes. |
| Applications | List, inspect, create from a folder, update settings, start, stop, restart, and delete. Read logs and metrics, list GitHub deployments and their logs, redeploy, roll back, and verify a custom domain. |
| Files | List folders, read and write text files, create folders, rename, move, delete, upload, download, and deploy from a local folder. |
| Environment variables | List variables, set a value, or remove a variable. |
| Databases | List, inspect, create, update, start, stop, restart, and delete. Read logs, metrics, and activity, get a connection address, and change credentials. |
| Teams | List, inspect, create, rename, and delete. Invite or remove members, resend or revoke invitations, and manage member roles and permissions. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.