AI Agents (MCP and WebMCP)
Lopaka supports two ways for AI agents to work with your projects:
Choose MCP or WebMCP
| Feature | MCP server | WebMCP |
|---|---|---|
| Best for | Coding agents in your terminal or IDE (Claude Code, Codex, Gemini CLI, OpenCode, Cursor) | Browser agents that support the WebMCP API (document.modelContext) |
| Access | Read projects, list assets, and generate display code | Inspect and edit screens, layers, assets, and projects in the open tab |
| Setup | Add https://api.lopaka.app/mcp and create an API key | None: uses your active Lopaka browser session |
MCP server
The Lopaka MCP server lets an AI coding agent read Lopaka projects and generate their source code. The agent gets the same code that the editor shows.
Server URL: https://api.lopaka.app/mcp (Streamable HTTP transport).
Connect your agent
1. Create the API key
The API key gives the agent access to the projects that you own. This includes private projects and private screens.
- Sign in to Lopaka.
- Open the account menu and select Profile.
- In API access, select Generate API key.
- Copy the key. Lopaka shows the full key only one time.
All plans can create an API key. One account has one key.
2. Save the key in an environment variable
Run this command in the terminal. Replace lpk_your_key with your key:
export LOPAKA_API_KEY="lpk_your_key"This variable stays only in the current terminal. Codex and OpenCode read the variable each time that they start. For these agents, add the same line to your shell profile, for example ~/.zshrc or ~/.bashrc.
3. Add the Lopaka server to your agent
Select your agent and run the command in the same terminal:
claude mcp add --transport http --scope user lopaka https://api.lopaka.app/mcp \
--header "Authorization: Bearer $LOPAKA_API_KEY"codex mcp add lopaka --url https://api.lopaka.app/mcp \
--bearer-token-env-var LOPAKA_API_KEYgemini mcp add --scope user --transport http lopaka https://api.lopaka.app/mcp \
--header "Authorization: Bearer $LOPAKA_API_KEY"opencode mcp add lopaka --global --url https://api.lopaka.app/mcp \
--header 'Authorization=Bearer {env:LOPAKA_API_KEY}'{
"mcpServers": {
"lopaka": {
"url": "https://api.lopaka.app/mcp",
"headers": {
"Authorization": "Bearer lpk_your_key"
}
}
}
}- Claude Code and Gemini CLI save the key in their settings.
- Codex and OpenCode save only the name of the variable.
- Cursor has no command for this step. Put this JSON in your user file
~/.cursor/mcp.jsonand replacelpk_your_keywith your key. Do not put it in.cursor/mcp.jsonof a project that you share.
4. Check the connection
claude mcp listcodex mcp listgemini mcp listopencode mcp listThe list shows the lopaka server. In Cursor, open Customize in the sidebar and find lopaka in the MCP servers. Gemini CLI starts MCP servers only in trusted folders.
Other MCP clients
Many clients use the same JSON format. Add the server with these values:
| Setting | Value |
|---|---|
| Transport | Streamable HTTP |
| URL | https://api.lopaka.app/mcp |
| Header | Authorization: Bearer <your API key> |
{
"mcpServers": {
"lopaka": {
"type": "http",
"url": "https://api.lopaka.app/mcp",
"headers": {
"Authorization": "Bearer lpk_your_key"
}
}
}
}Public projects without a key
Public gallery projects need no account and no key. Add the server without the key: remove the --header or --bearer-token-env-var part from the command, or the headers part from the JSON.
Tools
All agents get the public tools:
| Tool | Result |
|---|---|
get_public_project | Project data and the list of public screens |
list_public_generation_options | Code templates and code settings that the platform supports |
generate_public_project_code | Source code of one public screen |
Tools for your projects
With a key, the agent also gets these tools:
| Tool | Result |
|---|---|
list_my_projects | Your projects: id, title, platform, screen size, and privacy |
get_project | Project data and the list of screens |
list_project_assets | Fonts, images, and animations of the project, with their file URLs |
list_generation_options | Code templates and code settings that the platform supports |
generate_project_code | Source code of one screen |
These tools also read the public projects of other users.
To identify a project, the agent uses the project id or the address of the project in Lopaka, for example https://lopaka.app/canvas/123.
Example
Ask the agent in your firmware project:
Find my Lopaka project "Thermostat", generate the code of the screen "Main", and add it to
src/display.cpp.
Keep the key safe
- The key gives read access to all your projects. Do not put it in a public repository.
- The key cannot change or delete projects.
- Regenerate makes a new key. The old key stops immediately. Save the new key in
LOPAKA_API_KEYand in Cursor. For Claude Code and Gemini CLI, also remove the server (claude mcp remove lopaka -s userorgemini mcp remove lopaka -s user) and do step 3 again. - Revoke deletes the key. Agents that use it lose access immediately.
WebMCP (browser agents)
WebMCP lets a browser AI agent inspect and edit Lopaka directly in your open browser tab.
How WebMCP works
Lopaka registers WebMCP tools automatically when your browser provides the WebMCP API (document.modelContext.registerTool).
- No API key and no server configuration are needed.
- The agent uses your current Lopaka browser session and permissions.
- Browsers without
document.modelContextdo not load WebMCP. - Tools update automatically when you switch screens, open another page, or sign out.
Available tools by page
Lopaka registers only the tools that match the page you have open:
| Open page | What the agent can do |
|---|---|
Projects (/projects, signed in) | List, inspect, create, update, open, publish, fork, and delete your projects; read supported platforms and display sizes |
Your project in the editor (/canvas/...) | Inspect the screen, layers, generated code, and canvas PNG; create, edit, organize, and delete layers; search and place assets; manage screens; search the Gallery; fork projects |
Public Gallery preview (/gallery/...) | Read-only inspection of the screen, layers, generated code, and canvas PNG; search and open Gallery projects; fork a project into your account when signed in |
| Other pages or signed-out workspace | No mutation tools are registered |
WebMCP tools
Lopaka exposes 37 WebMCP tools across these areas:
| Area | Tools |
|---|---|
| Context and capabilities | lopaka_get_context, lopaka_get_capabilities |
| Read screen state | lopaka_get_screen_summary, lopaka_list_layers, lopaka_get_layer, lopaka_generate_code, lopaka_get_canvas_png |
| Layer creation, editing, and organization | lopaka_create_layer, lopaka_update_layer, lopaka_delete_layers, lopaka_select_layers, lopaka_update_layer_state, lopaka_reorder_layers, lopaka_group_layers, lopaka_ungroup_layers |
| Asset library | lopaka_search_assets, lopaka_get_asset, lopaka_add_asset |
| Screen management | lopaka_list_screens, lopaka_get_screen, lopaka_create_screen, lopaka_copy_screen, lopaka_update_screen, lopaka_reorder_screens, lopaka_delete_screen, lopaka_open_screen |
Project workspace (/projects) | lopaka_list_projects, lopaka_get_project, lopaka_get_project_options, lopaka_create_project, lopaka_update_project, lopaka_open_project, lopaka_publish_project, lopaka_delete_project |
| Gallery and forking | lopaka_search_gallery, lopaka_open_gallery_project, lopaka_fork_project |
WebMCP example
Open your project in Lopaka and ask your browser agent:
Add a battery icon in the top-right corner, center a temperature label in large text, and move the status bar to the bottom.
Safety and limits
- Undo and redo stay user-only. Every edit that the agent makes on the canvas adds a normal history entry, so you can undo it in the editor.
- Plan limits still apply. Project limits, screen limits, the one-screen minimum per project, and paid asset access follow your Lopaka plan.
- Stale edits are blocked. If you switch screens or change the layer stack while an agent runs, Lopaka rejects outdated edits.
- Not available through WebMCP: account settings, authentication, billing, subscriptions, file uploads, file pickers, exports, clipboard, Web Serial, fullscreen, Gallery stars, and changing the platform of an existing project.