Etch Agent Bridge
MCP server that enables agentic control of the Etch builder via a Chrome extension, allowing block editing, style changes, component management, and more through natural language.
README
Etch Agent Bridge
Local Chrome extension plus MCP server for controlling the Etch builder from MCP-capable agents such as Claude, Codex, opencode, Cursor, or similar tools.
This is not an AI chat product and it does not need model API keys. Your agent client provides the AI model. This project only connects that client to an already-open Etch builder tab through the Etch Public API.
What You Get
- A Chrome MV3 extension that can see Etch builder tabs only when the URL contains
etch=magic. - A local stdio MCP server that exposes Etch tools to your agent.
- A local WebSocket relay on
ws://127.0.0.1:8787so several MCP clients can share the same browser extension. - Direct Etch edits for blocks, styles, loops, components, navigation, history, UI color scheme, and document saving.
Prerequisites
- Git.
- Bun 1.x or newer: https://bun.sh/docs/installation
- Chrome, Chromium, Brave, Edge, or another Chromium browser that supports unpacked extensions.
- An authenticated WordPress admin session with Etch installed.
- An Etch builder page where
window.etchis available. - One MCP-capable client, for example Claude Code, Claude Desktop, Codex, opencode, Cursor, or Windsurf.
Install And Build
Clone the repo and build the extension:
git clone https://github.com/honestlydesign/etch-agent-extension.git
cd etch-agent-extension
bun install
bun run build
The browser extension build is created at:
apps/extension/dist
Load The Extension
- Open
chrome://extensionsin your Chromium browser. - Enable
Developer mode. - Click
Load unpacked. - Select the
apps/extension/distfolder from this repo. - Keep the extension installed while you use an MCP agent.
After every bun run build, reload the extension on chrome://extensions and reload the Etch builder tab.
The extension has a status popup only. It does not contain an editor UI.
Open An Etch Target
- Log into WordPress in the same browser.
- Open the Etch builder for the page or template you want to edit.
- Add
etch=magicto the URL.
Examples:
https://example.test/wp-admin/admin.php?page=etch-builder&etch=magic
https://example.test/wp-admin/admin.php?page=etch-builder&post=123&etch=magic
If the URL already has query parameters, use &etch=magic. If it has no query parameters, use ?etch=magic.
The extension intentionally ignores pages without etch=magic.
Configure MCP
Each MCP client should launch the same local server:
cd /ABS/PATH/etch-agent-extension && bun run apps/mcp/src/index.ts --client-name <client-name>
Use the absolute path to your cloned repo. If the MCP client cannot find bun, run which bun and replace bun in the command with the absolute Bun path.
The first MCP server process starts the relay host on port 8787. Later MCP clients connect through that existing relay. This means Claude, Codex, and opencode can all have this MCP configured at the same time. Only one agent should mutate the Etch canvas at a time.
The JSON examples below show only the relevant MCP entry. If your client already has a config file, merge the etch-agent entry into it instead of replacing the whole file. Do not commit project MCP config with your private absolute path.
Claude Code Or Claude Desktop
For Claude Code, use a project .mcp.json or your normal Claude MCP config. For Claude Desktop, put the same mcpServers block in claude_desktop_config.json.
{
"mcpServers": {
"etch-agent": {
"command": "bash",
"args": [
"-lc",
"cd /ABS/PATH/etch-agent-extension && exec bun run apps/mcp/src/index.ts --client-name claude"
]
}
}
}
Restart Claude after changing the config.
Codex
Add an MCP server entry to ~/.codex/config.toml:
[mcp_servers.etch-agent]
command = "bash"
args = ["-lc", "cd /ABS/PATH/etch-agent-extension && exec bun run apps/mcp/src/index.ts --client-name codex"]
Restart Codex after changing the config.
opencode
Add a local MCP entry to ~/.config/opencode/opencode.json:
{
"mcp": {
"etch-agent": {
"type": "local",
"command": [
"bash",
"-lc",
"cd /ABS/PATH/etch-agent-extension && exec bun run apps/mcp/src/index.ts --client-name opencode"
]
}
}
}
Restart opencode after changing the config.
Cursor, Windsurf, And Other MCP Clients
Most MCP clients use the same JSON shape as Claude:
{
"mcpServers": {
"etch-agent": {
"command": "bash",
"args": [
"-lc",
"cd /ABS/PATH/etch-agent-extension && exec bun run apps/mcp/src/index.ts --client-name cursor"
]
}
}
}
If your client supports a cwd field, you can also set cwd to the repo path and use command: "bun" with args: ["run", "apps/mcp/src/index.ts", "--client-name", "your-client"].
Verify The Setup
- Start or restart your MCP client.
- Open an Etch builder tab with
etch=magic. - Open the extension popup. It should show relay and target status.
- Ask your agent to list Etch targets or inspect the selected block.
Useful first prompt:
Use the Etch MCP tools to list available targets, inspect the selected block, and do not save anything.
If the agent sees a target, the extension and MCP server are connected.
Save Behavior
Most mutation tools change the Etch canvas immediately but do not persist to the WordPress database until etch_save_document is called.
The agent should call etch_save_document only when you explicitly ask it to save. Until then, browser navigation or document switching can discard unsaved edits, depending on Etch behavior.
Component upserts and component deletes are different: Etch persists them immediately through the component API.
Troubleshooting
No Etch target appears:
- Make sure the builder URL contains
etch=magic. - Make sure the WordPress session is authenticated in the same browser.
- Make sure the extension is loaded from
apps/extension/dist. - Reload the extension and then reload the Etch builder tab.
- Ask the agent to call
etch_list_targetsagain.
The MCP client starts but bun is not found:
- Run
which bun. - Replace
bunin the MCP config command with that absolute path. - Restart the MCP client.
Port 8787 is busy:
- If another Etch Agent Bridge MCP process is running, that is expected. New clients connect to it.
- If a different process owns the port, stop that process and restart the MCP client.
--relay-port <port>exists for tests, but the browser extension expects8787by default.
The extension is connected but Etch tools fail:
- Confirm the page is an actual Etch builder page.
- Confirm
window.etchexists in that builder session. - Reload the builder after reloading the extension.
Changes are not visible after editing code:
- Run
bun run build. - Reload the unpacked extension.
- Reload the Etch builder tab.
Development Commands
bun install
bun run build
bun run typecheck
bun run test
bun run dev:mcp
bun run dev:mcp starts the MCP server directly for local development. In normal use, your MCP client starts the server from its config.
Architecture
apps/extensionis the Chrome MV3 extension with a status popup, background relay connection, isolated content script, and MAIN-worldwindow.etchbridge.apps/mcpis the stdio MCP server. Each running MCP process either hosts the relay onws://127.0.0.1:8787or connects to the existing relay as a client.packages/sharedcontains shared schemas, target types, bridge protocol, activation logic, and MCP tool names.skills/etchapi/SKILL.mddescribes the agent workflow for agents working inside this repo.
Tool Coverage
| Area | Tools |
|---|---|
| Targets and status | etch_list_targets, etch_get_active_target, etch_set_active_target, etch_get_status, etch_get_last_apply_result |
| Blocks | etch_get_selected_block, etch_get_document_tree, etch_get_block_json, etch_find_blocks, etch_insert_blocks, etch_replace_block, etch_update_block, etch_mutate_block_attributes, etch_duplicate_block, etch_move_block, etch_delete_block |
| Styles | etch_list_styles, etch_apply_style_patch, etch_delete_style, etch_get_style_variable, etch_remove_style_variable |
| Components | etch_list_components, etch_get_component_json, etch_upsert_agent_component, etch_delete_agent_component |
| Navigation | etch_list_posts, etch_list_templates, etch_open_post, etch_open_template, etch_get_navigation_context |
| Loops | etch_list_loops, etch_upsert_loop, etch_delete_loop, etch_bind_loop_to_block |
| History and UI | etch_undo, etch_redo, etch_get_color_scheme, etch_set_color_scheme |
| Save | etch_save_document |
Fields and global stylesheets are not implemented in this bridge.
Validation Policy
This bridge is a thin pass-through to the Etch Public API. The MCP layer and page-bridge layer validate the structural shape of payloads with Zod, but they do not try to decide which content is safe or valid for Etch.
- Selectors, class names, component keys, loop keys, CSS variable names, text, attribute values, CSS values, and JSON loop data are passed through.
- Block types are forwarded to Etch. Etch is the source of truth for supported block types, tags, attributes, and payload shapes.
- If Etch rejects a payload, the
window.etcherror is returned through the MCP tool result.
Mutations apply directly to the Etch canvas. Use etch_undo or etch_redo for Etch history operations, and use etch_save_document only when the document should be persisted.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。