Skip to content
CLI tool · Cloud & deploy

Vercel CLI for AI agents

The Vercel CLI for coding agents: link projects, pull env vars, ship preview deploys, and read deployment logs, plus which commands need approval.

vercelby VercelOfficial MCP option
What it is

What Vercel CLI does for an agent

The Vercel CLI is Vercel's official tool for deploying and managing projects from the terminal. It links a local directory to a Vercel project, pulls environment variables, creates preview and production deployments, and shows deployment logs.

Running vercel with no arguments creates a preview deployment; production needs the explicit --prod flag, which makes it a good fit for agents that should only ever ship previews.

Official site: vercel.com

Install

Install Vercel CLI

The install commands from the official docs. Check it worked with vercel --version.

npm (global)
npm install -g vercel
Auth

Signing in Vercel CLI for an agent

A human signs in once with vercel login. In CI, Vercel's guides pass an access token with the --token flag, usually stored as a VERCEL_TOKEN secret.

Check the sign-in (read-only)
vercel whoami
Interactive sign-in (human)
vercel login
Link this directory to a project
vercel link

Environment variables: VERCEL_TOKEN. Set them in the agent's environment; never paste values into prompts or commit them.

Common agent tasks

What agents use Vercel CLI for

Example commands with placeholder names. Swap in your own project, app, or file names.

  1. Pull development env vars

    vercel
    vercel env pull .env.local

    Writes secrets to disk. Make sure the file is gitignored and never print it.

  2. List recent deployments

    vercel
    vercel ls
  3. Create a preview deployment

    vercel
    vercel deploy
  4. Inspect a deployment and its build logs

    vercel
    vercel inspect https://my-app-abc123.vercel.app --logs
Safety

Safety rules for agents

Safe to run without asking

  • vercel whoami
  • vercel ls
  • vercel inspect <url>
  • vercel env ls

Ask a human first

  • vercel deploy --prod
  • vercel promote <url>
  • vercel rollback
  • vercel env add / rm
  • vercel remove <project>
  • Ship previews only. Production deploys, promotions, and rollbacks are for a human or CI.
  • Never print, paste, or commit the files written by vercel env pull.
  • Confirm the linked project and team with vercel whoami and the .vercel directory before deploying.
Agent instructions

AGENTS.md or CLAUDE.md snippet

Paste this into the instruction file your agent reads at the start of every session, then adjust the rules to your setup.

AGENTS.md
## Vercel CLI (vercel)

Use `vercel` for linking projects, managing environment variables, and creating preview deployments on Vercel.

- Check it is installed with `vercel --version`. If it is missing, ask before installing it.
- Auth: a human signs vercel in. Check with `vercel whoami`; if it fails, stop and ask. Never run the login flow yourself, and never print tokens (VERCEL_TOKEN).
- Run without asking (read-only): `vercel whoami`, `vercel ls`, `vercel inspect <url>`, `vercel env ls`.
- Ask a human first (changes or deletes things): `vercel deploy --prod`, `vercel promote <url>`, `vercel rollback`, `vercel env add / rm`, `vercel remove <project>`.
- Ship previews only. Production deploys, promotions, and rollbacks are for a human or CI.
- Never print, paste, or commit the files written by vercel env pull.
- Confirm the linked project and team with vercel whoami and the .vercel directory before deploying.
- Prefer JSON output where the command supports it, and keep output short.
CLI or MCP server?

Vercel CLI or an MCP server?

An official MCP option exists. Vercel runs an official remote MCP server for searching docs and inspecting projects and deployments. It suits chat clients without a shell; inside a repository, the CLI deploys and pulls env vars directly.

Rule of thumb: in a terminal agent that a human has signed in, the CLI is usually faster and cheaper in context. In a chat client without a shell, or when you want a fixed set of typed tools, use an MCP server.

Same category
All Cloud & deploy tools
FAQ

Vercel CLI questions

How do I install Vercel CLI?

npm (global): npm install -g vercel. Check the install with vercel --version, and see the Vercel docs for other platforms.

How does an AI agent authenticate Vercel CLI?

A human signs in once with vercel login. In CI, Vercel's guides pass an access token with the --token flag, usually stored as a VERCEL_TOKEN secret. The agent can check the sign-in with vercel whoami and should stop and ask if it fails.

Which Vercel CLI commands are safe for an agent to run?

Commands that only read state are safe to run without asking: vercel whoami; vercel ls; vercel inspect <url>; vercel env ls. Ask a human before anything that changes or deletes something: vercel deploy --prod; vercel promote <url>; vercel rollback; vercel env add / rm; vercel remove <project>.

Is there an MCP server for Vercel CLI?

Vercel runs an official remote MCP server for searching docs and inspecting projects and deployments. It suits chat clients without a shell; inside a repository, the CLI deploys and pulls env vars directly.