# Agents

> Give Claude, ChatGPT, Claude Code, Codex or Cursor the thelastapi tools over MCP, use the CLI, read the docs tool, and install the agent skills.

thelastapi is built to be driven by agents. When you approve an agent's sign-in you choose what its key may do: **Full access** (pre-selected) can do everything you can, live payments, refunds and withdrawals, secrets, domains and deleting included; **Limited** creates projects, deploys, sends email, uses AI and does everything in development, but never reads a production secret or moves live money. A Limited key that hits something only you may do gets `403 owner_only` with `details.next_step`: the link to do it yourself, and the Keys page link to give that key full access. You can change any key between Full and Limited on the Keys page.

There are four ways in, and they share one API:

| | For | |
| --- | --- | --- |
| **Remote MCP server** (`https://thelastapi.dev/mcp`) | Claude and ChatGPT (custom connector), Claude Code, Codex, Cursor, any MCP client with OAuth | the same tools, nothing to install; sign in on first use |
| **MCP server** (`vibiz mcp`) | Claude Code, Codex, Cursor, any MCP client | tools for every product, plus `vibiz_docs`, and local folders and files |
| **CLI** (`vibiz`) | terminals, scripts, agents with a shell | [CLI reference](https://thelastapi.dev/docs/cli) |
| **Agent skills** | Claude Code, Codex, Cursor | [installable SKILL.md bundles](https://thelastapi.dev/skills) that teach the workflows |
| **HTTP** | anything | [API reference](https://thelastapi.dev/docs/api) |

## Paste to your agent

Set up once, from one line. Paste this into Claude Code, Codex or Cursor (or press **Paste to your agent** at [thelastapi.dev/get-started](https://thelastapi.dev/get-started)):

```text
Set up thelastapi for me: follow https://thelastapi.dev/get-started.md
```

[`/get-started.md`](https://thelastapi.dev/get-started.md) is a playbook for the agent: install the CLI and log in, add the skills (`vibiz skills add --global`), connect the MCP server (`vibiz mcp add --clients "<client>"`, with a manual route per client), check the connection with `vibiz_docs` and `vibiz_project_status`, and report what is set up. It pauses only for your sign-in.

Then ask for what you want, in an empty folder:

```text
Use thelastapi (https://thelastapi.dev/llms.txt) to build and deploy <what you want>.
```

**Already set up somewhere else?** One prompt also works on its own: add "Log in with `npx @vibiz/cli login` and show me the link."

**Logging in.** `npx @vibiz/cli login` prints a link and a code. The person opens the link, signs in with their thelastapi account and clicks **Authorize** (Full access unless they pick Limited); a thelastapi account is opened on the way if they have none. If their email can't open a new account yet, the login answers `reason: signup_closed` with `waitlist_url`, so stop and give them that link instead of retrying. The CLI then holds its own key (`cli · <computer name>`). If the shell times out first, run `vibiz login` again: it keeps waiting on the same code. Never ask the person to paste a key into the chat. A tool that answers `unauthorized` with `reason: not_logged_in` means exactly this step.

## Remote MCP: nothing to install

```bash
claude mcp add --transport http vibiz https://thelastapi.dev/mcp
```

Your client finds the sign-in on its own (OAuth 2.1 with PKCE): the first time it calls a tool, it opens the browser on the same **Authorize** page. The person picks its access there too (Full access, or Limited). The connection gets its own key with that access, named after the client ("Claude Code"), listed on the API keys page, where its access can be changed and revoking it disconnects the client. Tokens refresh on their own and keep the access.

- **Any of them, from the CLI**: `vibiz mcp add --clients "Claude Code"` (or `Codex`, `Cursor`, `"VS Code with Copilot"`, `Windsurf`, `"Gemini CLI"`, `OpenCode`; several, comma-separated). It runs the client's own CLI where there is one and otherwise merges only the `vibiz` entry into its user config.
- **Cursor**: `.cursor/mcp.json` → `{ "mcpServers": { "vibiz": { "url": "https://thelastapi.dev/mcp" } } }`
- **Codex**: `codex mcp add vibiz --url https://thelastapi.dev/mcp`, then `codex mcp login vibiz`
- **Headless** (CI): send a key instead, `--header "Authorization: Bearer $VIBIZ_API_KEY"`.

The remote server has every tool of the local one. `vibiz_deploy` takes the site's files themselves (`files: [{ path, content }]`); its `path` (a folder on your machine) and `vibiz_speech_transcribe` of a local file answer with the CLI command to run instead (`npx @vibiz/cli deploy --project <id>`), and `write_to` isn't available: use the local server or the CLI for those.

## Chat apps (Claude, ChatGPT)

Claude (claude.ai, desktop, mobile) and ChatGPT reach the same remote server as a custom connector, with nothing installed:

```text
https://thelastapi.dev/mcp
```

- **Claude**: **Settings ▸ Connectors ▸ Add custom connector**, name `Vibiz`, that URL, **Add**, then **Connect**, sign in and **Authorize**. On Free (one custom connector), Pro, Max, Team and Enterprise; on Team and Enterprise an Owner adds it.
- **ChatGPT**: turn on **Developer mode** (Settings ▸ Apps ▸ Advanced settings), then create an app with the same URL and OAuth sign-in. Menu names vary by plan; it needs a plan that allows custom connectors.

The sign-in is the same **Authorize** page (Full access, or Limited), and the connection gets its own key on the API keys page. What works from a chat:

- **Build and publish a site**: `vibiz_create_project`, then `vibiz_deploy { project_id, files }` with every file. It's live at `<slug>.vibiz.app`.
- **Edit it later**: `vibiz_code` reads the live files (they are the project's code), then `vibiz_deploy` sends only the changed ones; `vibiz_rollback` undoes a deploy.
- **Secrets**: `vibiz_request_secret` gives the person a console link to paste a key; it never goes through the chat.
- Every other tool (database, sign-in, email, payments, analytics, AI, web data) works as it does anywhere.

Limits: one deploy carries up to 300 files, 3 MiB per file and 4 MiB in all. A bigger app or an existing codebase belongs on your computer, with the CLI or a coding agent. Both share the account and the code: `vibiz pull` brings a site started in a chat into a folder, and a chat can edit anything deployed from a computer. Details in [Hosting](https://thelastapi.dev/docs/hosting#from-a-chat-nothing-installed).

## Install

The CLI and the MCP server are one npm package, `@vibiz/cli` (Node 20+): `npx @vibiz/cli …` runs the CLI and `npx -y @vibiz/cli mcp` the MCP server, with nothing to install first. Apps install `@vibiz/app`; scripts and servers that drive the API itself use `@vibiz/sdk`. An app that can't add a dependency calls the same HTTP routes with `fetch`: see [@vibiz/app](https://thelastapi.dev/docs/app-sdk#without-the-package).

The local MCP server reads `VIBIZ_API_KEY` and `VIBIZ_API_URL` from its environment, or the CLI's saved login (`vibiz login`). Leave `VIBIZ_API_URL` out for production (`https://thelastapi.dev`). Without a key it still starts, and every tool answers `unauthorized` with `details.next_step`: run `npx @vibiz/cli login` and show the person the link.

## Claude Code

```bash
claude mcp add --transport http vibiz https://thelastapi.dev/mcp   # remote, sign in on first use
claude mcp add vibiz -- npx -y @vibiz/cli mcp                           # local, uses `vibiz login`
```

Or commit a project `.mcp.json` without the key (`${VIBIZ_API_KEY}` is read from your shell):

```json
{
  "mcpServers": {
    "vibiz": {
      "command": "npx",
      "args": ["-y", "@vibiz/cli", "mcp"],
      "env": { "VIBIZ_API_KEY": "${VIBIZ_API_KEY}" }
    }
  }
}
```

## Codex

```bash
codex mcp add vibiz --env VIBIZ_API_KEY=vz_sk_… -- npx -y @vibiz/cli mcp
```

Or in `~/.codex/config.toml`:

```toml
[mcp_servers.vibiz]
command = "npx"
args = ["-y", "@vibiz/cli", "mcp"]
env = { VIBIZ_API_KEY = "vz_sk_…" }
```

`codex exec` (non-interactive) refuses tools it can't ask you to approve; add `-c mcp_servers.vibiz.default_tools_approval_mode="approve"` to let it call them.

## Cursor

`.cursor/mcp.json` in the project, or `~/.cursor/mcp.json` for every project:

```json
{
  "mcpServers": {
    "vibiz": {
      "command": "npx",
      "args": ["-y", "@vibiz/cli", "mcp"],
      "env": { "VIBIZ_API_KEY": "${env:VIBIZ_API_KEY}" }
    }
  }
}
```

## The tools

| Tool | Does |
| --- | --- |
| `vibiz_docs` | **Read first.** The facts and code agents otherwise guess: `payments`, `app-payments`, `webhooks`, `company`, `keys`, `usage`, `connectors`, `social`, `console-urls`. Also MCP resources `vibiz://docs/<topic>` |
| `vibiz_usage` | **Check before spending.** What was spent and today's limits |
| `vibiz_billing` | the account's credits: balance, status, a top-up link for a person, history |
| `vibiz_capabilities` | resource types, actions, defaults |
| `vibiz_create_project`, `vibiz_add_resources`, `vibiz_project_status` | projects and resources; waits until ready |
| `vibiz_project_env` | the production env's variable **names** (never values) |
| `vibiz_dev_env` | the development env; `write_to` merges it into an env file without showing values |
| `vibiz_hosts` | connected hosts; `sync: true` pushes the env again |
| `vibiz_domains`, `vibiz_buy_domain`, `vibiz_dns_records` | the app's own domains (add, verify, DNS records); search, quote and buy a domain, and use a bought one (or `app.<domain>`) on any project with no DNS, or move it; a bought domain's DNS records (list, add, remove) |
| `vibiz_export` | the project's code, database and env guide as download links |
| `vibiz_files` | the project's Files: generated media and uploads, with permanent links |
| `vibiz_deploy`, `vibiz_promote`, `vibiz_rollback` | hosting: a local folder (`path`), or the files themselves from a chat (`files`); over a live site, only the changed files. Always pass a short `message`. `vibiz_rollback` goes back to any version; the database is not rolled back, so ask first |
| `vibiz_code` | the project's code, which is its live deployment's files: `list`, or `read` up to 20 at a time; `history` lists every version, `diff` shows what changed |
| `vibiz_request_secret` | a console link where the person pastes a secret, so it never passes through the chat |
| `vibiz_database` | the development database: tables, or one read-only statement |
| `vibiz_auth_settings` | sign-in settings, development copy |
| `vibiz_send_email`, `vibiz_run_action` | email and actions: web data (scrape, crawl, search, screenshot, places, reviews, social, products) |
| `vibiz_inbox_threads`, `vibiz_inbox_read`, `vibiz_inbox_reply`, `vibiz_inbox_send`, `vibiz_inbox_mark`, `vibiz_inbox_setup`, `vibiz_email_forwarding` | the business's own inbox at its domain, and forwarding to an inbox it already uses |
| `vibiz_email_contacts`, `vibiz_email_broadcasts`, `vibiz_email_automations`, `vibiz_email_settings` | contacts and imports, drafts, reviews, tests to the owner; sending and activating are the owner's unless they set a monthly allowance ([Email](https://thelastapi.dev/docs/email#newsletters-announcements-and-automations)) |
| `vibiz_ads_library`, `vibiz_action_runs` | competitor ads from the Meta Ad Library; past web data runs, with their output |
| `vibiz_seo` | SEO data: who ranks for a keyword, keyword volume and ideas, a site's search traffic and backlinks, a page audit, mentions in ChatGPT and Google AI answers |
| `vibiz_web_design` | a site's design system (tokens, components, layout) with Tailwind, shadcn/ui and CSS exports |
| `vibiz_payments` | payments: `get`, `products`, `create_product`, `add_price`, `checkout`, `payments`, `subscriptions`, `ledger`, `withdrawals`, `deliveries`, `connect_own_account` (a link for the owner); in development `webhook`, `simulate`, `refund`, `cancel`, `withdraw` |
| `vibiz_social` | the business's social and ad accounts: connect, post, schedule, analytics, campaigns |
| `vibiz_connectors`, `vibiz_call` | the user's own APIs, added from an OpenAPI spec or a manifest, called with the key kept by thelastapi |
| `vibiz_company` | company formation: `catalog`, `draft`, `get`; in development `submit`, `simulate` |
| `vibiz_ai_chat`, `vibiz_image_generate`, `vibiz_speech_create`, `vibiz_speech_transcribe` | AI, metered; media as links, `write_to` saves files |
| `vibiz_ai_models`, `vibiz_ai_keys` | every model you can call, with prices; the account's own AI provider key status (never a secret) |
| `vibiz_analytics`, `vibiz_replay_insights`, `vibiz_list_replays`, `vibiz_replay_detail`, `vibiz_replay_frames`, `vibiz_replay_share_link` | analytics and replay |
| `vibiz_delete_project`, `vibiz_restore_project` | offline now, data kept 7 days |

Tools default to the **development** environment (`vibiz_files` reads production unless `env` says otherwise). The project id is in `./vibiz.json` in a linked app folder, or `vibiz_project_status` lists them. Set `VIBIZ_USER` in the server's env to attribute an agent's calls to an end user.

## The docs tool

`vibiz_docs` (and `vibiz docs <topic>` in the CLI) serves the [agent guides](https://thelastapi.dev/docs/guides/payments): short pages written from what real Claude Code and Codex runs got wrong (the 7-day hold, the fee example ($100 → $94.80 with the default 2% thelastapi fee), wiring webhooks, the `@vibiz/app` calls, company fees in cents). They are the same text as on this site and in `/llms-full.txt`, generated from one source.

## For agents reading this site

- [/llms.txt](https://thelastapi.dev/llms.txt): the index of every page, as markdown links.
- [/llms-full.txt](https://thelastapi.dev/llms-full.txt): every page in one file.
- Any page as markdown: add `.md` to its URL (`/docs/payments.md`).

## What agents can and can't do

| Agents may | Only a person may |
| --- | --- |
| create projects, deploy, promote, roll back, delete and restore | read the production env, create or revoke keys, remove domains, connect hosts |
| everything in development, including test payments and test company filings | live refunds, cancels, withdrawals and payment settings |
| create products, prices and checkout links, live too | submit a real company filing, sign, send an SSN or ITIN |
| send email, run actions, use AI (metered) | verify identity and add a bank to get paid |
| add contacts, draft broadcasts and automations, send tests to the owner | send a broadcast or turn an automation on (beyond the owner's monthly allowance), set the postal address |

Never paste a full-access key into an agent's environment: an agent with a shell can read what the owner's machine can.
