Let an AI agent build and deploy a full-stack app
Give an AI agent access to thelastapi via MCP or CLI to let it provision hosting, database, sign-in, and deploy a full-stack app safely.
On this page 7 sections
You can let an AI agent build and deploy a full-stack app by connecting it to thelastapi via the Model Context Protocol (MCP) or the CLI. Give your agent a single command to run the setup playbook, approve its sign-in in your browser, and then ask it to build your project in plain English. Your agent provisions the backend resources, writes the code, tests against an isolated development branch, and deploys the live app to a public URL.
AI agents are capable of writing frontend templates and backend routes, but they usually stall when they hit external infrastructure. They cannot easily open cloud accounts, configure DNS, provision databases, or wire authentication secrets on their own. thelastapi unifies hosting, serverless Postgres, sign-in, email, payments, and AI access behind one interface built specifically for tools like Claude Code, Codex, and Cursor.
How to connect your agent in one step
If you use Claude Code, Codex, or Cursor, you can configure your agent with a single instruction. Create an empty directory and paste this command directly to your agent:
Set up thelastapi for me: follow https://thelastapi.dev/get-started.mdYour agent fetches the setup playbook from that URL and handles the entire configuration automatically:
- It installs the CLI package globally (
npm install --global @vibiz/cli). - It runs
vibiz loginand presents you with an authorization link. - It installs the thelastapi agent skills (
vibiz skills add --global). - It attaches the MCP server to your client configuration (
vibiz mcp add --clients "<your agent>"). - It verifies that the tools are live by calling
vibiz_docsandvibiz_project_status.
The agent pauses only once: when it displays your login link. Click the link, sign in to your thelastapi account, and click Authorize. If you do not have an account yet, create one at thelastapi.dev/start.
If you configure your tools from the command line, you can attach Claude Code to the remote MCP server directly:
vibiz mcp add --clients "Claude Code"Or connect the local stdio MCP server:
claude mcp add vibiz -- npx -y @vibiz/cli mcpIn Cursor, add the remote MCP server to .cursor/mcp.json:
{
"mcpServers": {
"vibiz": {
"url": "https://thelastapi.dev/mcp"
}
}
}The first time your agent invokes a thelastapi tool on the remote server, it triggers an OAuth 2.1 flow in your browser. Review the permission level, click Authorize, and your agent gains access through its own dedicated API key.
What happens during the setup playbook
The setup playbook equips your agent with two crucial layers: MCP tools and agent skills.
First, the MCP connection gives the agent direct tools for every product capability. Instead of guessing CLI flags or inventing external routes, it receives structured tools such as vibiz_create_project, vibiz_database, vibiz_deploy, and vibiz_payments. It also gets vibiz_docs, which serves technical guides on webhook signatures, pricing shapes, and @vibiz/app calls directly to the agent context.
Second, running vibiz skills add --global installs structured SKILL.md bundles for Claude Code, Codex, or Cursor. As explained in our guide to agent skills (SKILL.md) for Claude Code, Codex and Cursor, these bundles teach your agent proven workflows for database migrations, authentication setups, and deployments before it writes code. For more setup details, see the official Agent skills documentation.
Prompting your agent to build and deploy
Once connected, your agent has everything it needs to create and publish a complete web application. You do not need to stitch together separate providers, as outlined in our overview of one API key for an AI agent: hosting, database, email, payments and models.
Open an empty project folder and prompt your agent:
Use thelastapi (https://thelastapi.dev/llms.txt) to build and deploy a SaaS app for Acme Bakery with Google and GitHub sign-in, an AI assistant, and a $15/month subscription plan.Here is what the agent executes behind the scenes:
1. Project creation
The agent initializes the project using the CLI or the MCP tool vibiz_create_project:
vibiz init "Acme Bakery" --resources database,auth,aiThis writes ./vibiz.json in the current folder, containing the project ID (prj_123) and slug. By default, vibiz init provisions hosting, a serverless Postgres database, user sign-in, and analytics. Adding ai provisions a project-scoped AI gateway key. The agent monitors provisioning until all resources transition from pending to ready.
2. Development environment isolation
Before writing application logic, the agent provisions a local development environment:
vibiz devThis command generates .env.development.local. It contains an isolated development database branch (cloning production's schema without any rows), development sign-in credentials configured to trust http://localhost:3000, and a development AI key.
3. Application code
The agent writes the app using Next.js or any preferred framework. In the server code, it installs @vibiz/app to integrate database, authentication, and payments:
import { vibiz } from '@vibiz/app';
// Load project environment variables securely at boot
await vibiz.loadEnv();For AI features, the agent configures the standard OpenAI SDK using the development environment variables:
import OpenAI from 'openai';
const ai = new OpenAI({
baseURL: process.env.VIBIZ_AI_BASE_URL,
apiKey: process.env.VIBIZ_AI_API_KEY,
});
export async function askAssistant(prompt: string) {
return await ai.chat.completions.create({
model: 'vibiz/fast',
messages: [{ role: 'user', content: prompt }],
});
}4. Products and prices
The agent creates subscription plans directly against the payments system:
vibiz payments products add "Bakery Pro" --amount 1500 --interval month --lookup-key bakery-pro --devIn development, test cards can simulate purchases without processing live funds.
5. Deployment
Once local tests pass, the agent deploys the app:
vibiz deploy -m "Initial release with auth, AI assistant, and subscriptions"The app is immediately live at https://acme-bakery.vibiz.app. The deployment command outputs the live URL and version ID. If you prefer to test in chat environments before touching a terminal, read how to deploy a website from Claude or ChatGPT with nothing installed. For a complete walkthrough of our core stack, check our Quickstart guide.
How environments keep production safe
Giving an AI agent a shell on your computer requires clear boundaries. thelastapi enforces strict isolation through environment separation and scoped API keys.
Every project has two environments: production and development.
- Database: Production holds live user data. Development runs on an isolated branch with identical tables but zero rows.
- Sign-in: Production trusts your live custom domains. Development trusts
http://localhost:3000and allows social sign-in via Google and GitHub. - Payments: Production handles real card transactions with a standard 7-day holding period. Development runs in test mode, allowing test payments, automated dispute tests, and simulation commands.
- Secrets: Production environment variables are completely masked. Limited keys and development processes can never read production secrets.
When your agent runs vibiz dev, it works exclusively within the development copy. It can migrate tables, register test users, simulate purchases, and invoke AI models without risking live customer data or racking up unapproved expenses.
What agents can do versus what only you can do
When you authorize your agent during vibiz login or through MCP OAuth, you choose its key permissions: Full access (default) or Limited.
A Limited key can build code, execute development migrations, make test payments, call AI models, and deploy new releases. However, a Limited key cannot touch live money or view production secrets.
| Action | Limited agent key | You (Owner / Full access) |
|---|---|---|
| Create projects, write code, deploy live | Yes | Yes |
| Run migrations on development database | Yes | Yes |
| Read production database rows | No (database.production:read required) | Yes |
| Read production environment values | No (names only) | Yes |
| Create test products and test checkouts | Yes | Yes |
| Live card refunds, cancellations, bank withdrawals | No | Yes |
| Rotate production app keys | No | Yes |
| Disconnect domains or delete projects | No | Yes |
| Provide third-party secrets | No (generates secret link) | Yes (pastes value into console) |
If a Limited key attempts an owner-only action, the API rejects the request with 403 owner_only and returns structured JSON containing:
details.permission: the specific permission name required (such aspayments.live:write).details.grant_url: a direct console link where you can approve that permission for this key.details.console_url: the URL where you can complete the action manually.
If your application requires a third-party secret, the agent never asks you to paste it into the terminal or chat window. Instead, it calls vibiz_request_secret (or POST /v1/projects/:id/secret-link), which gives you a secure web URL to enter the value directly into the platform console. Learn more about managing key scopes in the Keys and environments reference.
Next step
To get started, open Claude Code, Codex, or Cursor in a fresh directory and run:
Set up thelastapi for me: follow https://thelastapi.dev/get-started.mdFollow the browser link to authorize your agent, then tell it what app you want to build. Further architecture details and tool definitions are available in our Agents documentation.
Frequently asked questions
What happens if an agent tries to perform an action it is not authorized for?
The API returns an HTTP 403 error with reason `owner_only`, identifying the missing permission and providing a `grant_url`. You can open this URL in your browser to grant that permission to the agent's key, or complete the action yourself via `console_url`.
Can an AI agent see my production secrets or live database records?
No, an agent using a Limited key cannot inspect production environment variable values or read live database rows. It only sees environment variable names and interacts with an isolated development database branch containing zero production rows.
How does the agent handle sensitive API keys that need to be added to the project?
The agent calls `vibiz_request_secret` to generate a one-time console link. You open the link in your browser and paste the sensitive value directly into the platform, ensuring secrets never pass through chat transcripts or agent context windows.