Skip to content

AI Agents (MCP and WebMCP) ​

Lopaka supports two ways for AI agents to work with your projects:

Choose MCP or WebMCP ​

FeatureMCP serverWebMCP
Best forCoding agents in your terminal or IDE (Claude Code, Codex, Gemini CLI, OpenCode, Cursor)Browser agents that support the WebMCP API (document.modelContext)
AccessRead projects, list assets, and generate display codeInspect and edit screens, layers, assets, and projects in the open tab
SetupAdd https://api.lopaka.app/mcp and create an API keyNone: 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.

  1. Sign in to Lopaka.
  2. Open the account menu and select Profile.
  3. In API access, select Generate API key.
  4. 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:

sh
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:

sh
claude mcp add --transport http --scope user lopaka https://api.lopaka.app/mcp \
  --header "Authorization: Bearer $LOPAKA_API_KEY"
sh
codex mcp add lopaka --url https://api.lopaka.app/mcp \
  --bearer-token-env-var LOPAKA_API_KEY
sh
gemini mcp add --scope user --transport http lopaka https://api.lopaka.app/mcp \
  --header "Authorization: Bearer $LOPAKA_API_KEY"
sh
opencode mcp add lopaka --global --url https://api.lopaka.app/mcp \
  --header 'Authorization=Bearer {env:LOPAKA_API_KEY}'
json
{
    "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.json and replace lpk_your_key with your key. Do not put it in .cursor/mcp.json of a project that you share.

4. Check the connection ​

sh
claude mcp list
sh
codex mcp list
sh
gemini mcp list
sh
opencode mcp list

The 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:

SettingValue
TransportStreamable HTTP
URLhttps://api.lopaka.app/mcp
HeaderAuthorization: Bearer <your API key>
json
{
    "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:

ToolResult
get_public_projectProject data and the list of public screens
list_public_generation_optionsCode templates and code settings that the platform supports
generate_public_project_codeSource code of one public screen

Tools for your projects ​

With a key, the agent also gets these tools:

ToolResult
list_my_projectsYour projects: id, title, platform, screen size, and privacy
get_projectProject data and the list of screens
list_project_assetsFonts, images, and animations of the project, with their file URLs
list_generation_optionsCode templates and code settings that the platform supports
generate_project_codeSource 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_KEY and in Cursor. For Claude Code and Gemini CLI, also remove the server (claude mcp remove lopaka -s user or gemini 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.modelContext do 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 pageWhat 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 workspaceNo mutation tools are registered

WebMCP tools ​

Lopaka exposes 37 WebMCP tools across these areas:

AreaTools
Context and capabilitieslopaka_get_context, lopaka_get_capabilities
Read screen statelopaka_get_screen_summary, lopaka_list_layers, lopaka_get_layer, lopaka_generate_code, lopaka_get_canvas_png
Layer creation, editing, and organizationlopaka_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 librarylopaka_search_assets, lopaka_get_asset, lopaka_add_asset
Screen managementlopaka_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 forkinglopaka_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.