Use a coding agent to add a component to your page in 5 minutes
Contextile apps consist of pages assembled at runtime from independent components. Each component has a frontend and a dedicated backend function, with a codebase small enough to fit entirely within a coding agent’s context window. In this quickstart, the agent does most of the work.
Prerequisites
- Node.js 20.10 or later (run
node -vto check) - A coding agent with MCP support (Claude Code or Cursor)
- Chrome, Chromium, or Edge for visual verification. If none is installed,
run
npx playwright install chromium.
Create and run the app
~1 minnpx create-contextile my-app
cd my-app && npm run dev
Your browser opens http://127.0.0.1:4242/p/demo automatically. The demo
page already contains two components: a greeting card and a live stats card. This is a real
page assembled from components. Edit components/hello-card/frontend/index.tsx
and save the file; Contextile republishes the page, and your browser reloads it.
Hand the task to the agent
~1 minOpen Claude Code (or Cursor) in the project directory and approve the Contextile MCP server when prompted. You only need to approve it once. Then enter:
“Add a weather card component to the demo page.”
Watch the agent handle the entire workflow
~3 minThe agent scaffolds the component, writes its frontend and backend function, and
deploys it with deploy_component. During deployment, it builds the component,
publishes the assets, activates the function, and creates a new page version, reporting
a clear status at each step. The agent then uses render_page_screenshot to render
the page in a real browser, posts the screenshot in the conversation, and iterates if needed.
Refresh the page—or wait for it to reload automatically—and you’ll see the weather card.
Checkpoints
| Time | You should see |
|---|---|
| T+1 min | the demo page is open in your browser with two cards |
| T+2 min | the agent is working and tool calls are streaming |
| T+5 min | the new component is on the page, and the agent has posted a screenshot |
Stuck?
Start by running the diagnostic command:
npx contextile doctor
It checks your Node.js version, project files, dev server, the browser used by the simulator, MCP configuration, and spec version. Every failed check includes a suggested fix. The three most common issues are:
- Port already in use:
contextile devautomatically tries the next available port. Use the URL shown in the terminal;doctoridentifies the conflicting process so you can stop it. - No browser (screenshots unavailable): run
npx playwright install chromiumto install Chromium. An existing Chrome installation works too. - The agent doesn’t see the Contextile tools: Contextile configures MCP
separately for each project; the
.mcp.jsonfile lives in the project directory. Make sure you opened the agent session from that directory and approved the server when prompted. If you rannpm installafter starting the agent, restart the session.
Next
- Explore the more advanced showcase app in
examples/showcaseon GitHub ↗. It demonstrates cross-component events, streaming rendering, graceful degradation, and rollbacks in seconds. - Read the manifesto and architecture standard →