base44-remote-dev
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
Chinese<!--
Vendored from base44-dev/apper PR #11608
(docs/features/bring-your-own-model/base44-remote-dev/SKILL.md).
Keep in sync with the upstream source if it changes.
-->
<!--
源自 base44-dev/apper PR #11608
(docs/features/bring-your-own-model/base44-remote-dev/SKILL.md)。
若上游源更新,请保持同步。
-->
Remotely develop a Base44 app over MCP
通过MCP远程开发Base44应用
Connect your own coding agent to a Base44 app's sandbox and develop in it
directly — run commands, read and edit files, grep, list directories — while
Base44 supplies the sandbox and you supply the agent and the LLM.
This works with any MCP-capable client. The examples use Claude Code.
Easiest start: in the Base44 app editor, click Send to Coding Agent. For a local agent it gives you a ready-to-paste prompt (which fetches a README and drives the sandbox over MCP or theCLI — Section 10); for the web it gives a prompt to paste into a claude.ai chat (with the Base44 MCP connector) plus an Open Claude button. The button is the discovery surface — the rest of this skill is the reference.base44 sandbox
Two transports: web agents use claude.ai with the Base44 MCP connector (Sections 1–9) — note this is the regular claude.ai chat, not Claude Code on the web (), which runs in its own repo-backed sandbox. A local agent can connect that same MCP server, or drive the sandbox with theclaude.ai/codeCLI (a Base44 CLI token, Section 10) — same tools, same behavior, same error codes; the CLI just exposes them under shorter command names (base44 sandbox,sandbox read, …).sandbox ls
将你自己的编码代理连接到Base44应用的沙箱,直接在其中进行开发——运行命令、读写文件、grep检索、列出目录——由Base44提供沙箱,你提供代理和大语言模型(LLM)。
此功能适用于任何支持MCP的客户端,示例中使用Claude Code。
最简入门方式: 在Base44应用编辑器中,点击发送至编码代理。对于本地代理,它会提供一个可直接粘贴的提示(该提示会获取一份README,并通过MCP或CLI操作沙箱——详见第10节); 对于网页端代理,它会提供一个可粘贴到claude.ai聊天框的提示(搭配Base44 MCP连接器),以及一个打开Claude按钮。该按钮是入口,本文其余内容为参考文档。base44 sandbox
两种传输方式: 网页端代理使用claude.ai搭配Base44 MCP连接器(第1-9节)——注意这是常规的claude.ai聊天,不是网页端的Claude Code(),后者运行在自身的仓库沙箱中。本地代理可连接同一MCP服务器,或通过**claude.ai/codeCLI**(需Base44 CLI令牌,第10节)操作沙箱——工具、行为、错误码完全一致;只是CLI使用更短的命令名称(base44 sandbox、sandbox read等)。sandbox ls
1. Connect the MCP server
1. 连接MCP服务器
The Base44 MCP endpoint is:
https://app.base44.com/mcpRegister it with Claude Code (run from any folder):
bash
claude mcp add --transport http base44 https://app.base44.com/mcpAdd if you want it available in every project rather than just
the current folder.
--scope userclaude mcp addBase44的MCP端点为:
https://app.base44.com/mcp在Claude Code中注册该端点(可在任意文件夹下运行):
bash
claude mcp add --transport http base44 https://app.base44.com/mcp若希望在所有项目中都可用,而非仅当前文件夹,可添加参数。
--scope userclaude mcp add2. Authenticate
2. 认证
Start Claude Code and open the MCP menu:
bash
claudethen, inside Claude Code:
/mcpSelect base44 → Authenticate. A browser opens for the Base44 OAuth
flow (PKCE) — log in and approve. When it succeeds, shows base44 as
connected and lists its tools.
/mcpPure-CLI / headless clients that can't open a browser use the OAuth device
flow () instead — request a code, approve it in a browser
on another device, and the client receives the token.
/oauth/device/code启动Claude Code并打开MCP菜单:
bash
claude然后在Claude Code内部执行:
/mcp选择base44 → Authenticate。浏览器会打开Base44的OAuth流程(PKCE)——登录并授权。成功后,会显示base44已连接,并列出其可用工具。
/mcp纯CLI/无头客户端无法打开浏览器,需使用OAuth设备流()——请求一个验证码,在另一设备的浏览器中授权,客户端将收到令牌。
/oauth/device/codeScopes
权限范围
| Tools | Required scope |
|---|---|
| |
| |
sandbox:writeNOT_AUTHORIZEDsandbox:write| 工具 | 所需权限范围 |
|---|---|
| |
| |
sandbox:writeNOT_AUTHORIZEDsandbox:write3. Pick the app and orient yourself
3. 选择应用并熟悉环境
Every tool takes a required . Find your apps with , then
pin the id in your requests so the agent passes it on every call.
appIdlist_user_appsStart read-only to build a mental model before changing anything:
Using the base44 tools on appId <APP_ID>:
1. list_directory on the app root (recursive, depth 2)
2. read_file src/App.jsx and src/pages.config.js
3. grep for the component I want to change
Summarize the structure before editing.Cold start: if the app has no running sandbox, the first tool call transparently brings one up from your last commit — it just takes a bit longer. Subsequent calls are fast.
CLI names: over theCLI (Section 10) these read tools arebase44 sandbox→list_directory,sandbox ls→read_file, andsandbox read→grep.sandbox grep
每个工具都需要必填参数。使用查找你的应用,然后在请求中固定该ID,以便代理在每次调用时传递。
appIdlist_user_apps在进行任何修改前,先以只读模式构建对应用的认知:
使用base44工具操作appId <APP_ID>:
1. 递归列出应用根目录(深度2)
2. 读取src/App.jsx和src/pages.config.js文件
3. 检索我想要修改的组件
在编辑前总结应用结构。冷启动: 如果应用没有运行中的沙箱,首次工具调用会自动从你上次提交的内容启动沙箱——仅需稍作等待。后续调用速度会很快。
CLI命令名称: 通过CLI(第10节)操作时,这些只读工具对应:base44 sandbox→list_directory,sandbox ls→read_file,sandbox read→grep。sandbox grep
4. Make changes
4. 进行修改
- (
edit_filein the CLI) — preferred for changing existing files. Provide exactsandbox edit→old_textedits. Eachnew_textmust be unique in the file unless you setold_text. All edits in a call apply atomically (all-or-nothing) and you get a unified diff back. Passreplace_allto preview the diff without writing.dry_run: true - (
write_filein the CLI) — for creating new files. To overwrite an existing file you must passsandbox write(it never silently clobbers).overwrite: true - (
run_commandin the CLI) — run any bash command in the sandbox (build, install, scaffolding, codemods). The working directory defaults to the app root;sandbox rundoes not persist across calls, so use thecdparameter or chain commands (cwd). Timeout defaults to 120s (max 600s); output is capped at ~1 MB.cd sub && cmd - (
create_checkpointin the CLI) — save a named restore point the user can later roll back to. Takes an optionalsandbox checkpoint(message/title; auto-generated if omitted). Any pending changes are flushed and committed first so the checkpoint anchors to your latest code; it then returns the checkpoint id, name, and git commit hash. Use it to mark a known-good state before or after a chunk of edits. (If a recent auto-commit can't be confirmed durable yet, it refuses with the retryablenamerather than checkpoint stale state — retry shortly.)COMMIT_FLUSH_PENDING
Example:
On appId <APP_ID>, use edit_file to change the homepage heading in
src/pages/Home.jsx from "Welcome" to "Welcome back". Show me the diff first
with dry_run, then apply it.- (CLI中为
edit_file)——修改现有文件的首选方式。提供精确的sandbox edit→old_text编辑内容。除非设置new_text,否则每个replace_all在文件中必须唯一。单次调用中的所有编辑会原子性生效(要么全部成功,要么全部失败),并返回统一的差异结果。传递old_text可预览差异而不写入文件。dry_run: true - (CLI中为
write_file)——用于创建新文件。若要覆盖现有文件,必须传递sandbox write(不会静默覆盖)。overwrite: true - (CLI中为
run_command)——在沙箱中运行任意bash命令(构建、安装、脚手架、代码转换等)。工作目录默认为应用根目录;sandbox run命令不会在调用间持久生效,因此需使用cd参数或链式命令(cwd)。默认超时时间为120秒(最长600秒);输出上限约为1MB。cd sub && cmd - (CLI中为
create_checkpoint)——保存一个命名的恢复点,用户后续可回滚到该状态。可选参数sandbox checkpoint(消息/标题;若省略则自动生成)。创建前会先刷新并提交所有待处理变更,以便检查点锚定到最新代码;随后返回检查点ID、名称和Git提交哈希。在进行大量编辑前后,使用它标记已知的良好状态。(若最近的自动提交尚未确认持久化,会返回可重试的name错误,而非基于过时状态创建检查点——稍后重试即可。)COMMIT_FLUSH_PENDING
示例:
针对appId <APP_ID>,使用edit_file将src/pages/Home.jsx中的主页标题从"Welcome"修改为"Welcome back"。先通过dry_run显示差异,再应用修改。5. Preview and verify (the edit → check loop)
5. 预览与验证(编辑→检查循环)
There is no live log-streaming tool, but you can close the feedback loop:
- See it live: brings up the dev server and returns the preview URL. Vite HMR reflects your edits as you make them.
get_app_preview_url - Build status: returns
get_app_status/ready/processing.error - Surface build/type/lint errors on demand with :
run_commandbashnpm run build # bundler/compile errors npx tsc --noEmit # type errors npm run lint # lint errors - Read the dev-server (Vite) logs — the managed dev server writes to
. Tail it via
/tmp/vite.logto see HMR/compile errors:run_command(This is outside the app tree, so it's only reachable throughbashtail -c 32000 /tmp/vite.log, not the file tools — and therefore needsrun_command.)sandbox:write
A solid loop: → (or tail ) → fix any
errors → to eyeball it.
edit_filenpm run build/tmp/vite.logget_app_preview_urlBrowser-runtime errors (a component that compiles but throws on render, a failing client API call) appear in the browser console, not in. Open the preview URL to catch those./tmp/vite.log
虽然没有实时日志流工具,但你可以形成反馈闭环:
- 实时查看: 会启动开发服务器并返回预览URL。Vite HMR会在你进行编辑时实时反映变更。
get_app_preview_url - 构建状态: 返回
get_app_status/ready/processing。error - 按需查看构建/类型检查/ lint错误:使用执行:
run_commandbashnpm run build # 打包/编译错误 npx tsc --noEmit # 类型错误 npm run lint # lint错误 - 读取开发服务器(Vite)日志——托管的开发服务器会写入。通过
/tmp/vite.log查看尾部内容,了解HMR/编译错误:run_command(该文件位于应用目录外,因此只能通过bashtail -c 32000 /tmp/vite.log访问,无法通过文件工具操作——因此需要run_command权限。)sandbox:write
可靠的循环流程: → (或查看尾部)→ 修复错误 → 直观验证。
edit_filenpm run build/tmp/vite.logget_app_preview_url浏览器运行时错误(编译通过但渲染时抛出的组件错误、失败的客户端API调用)会显示在浏览器控制台中,而非。打开预览URL即可捕获此类错误。/tmp/vite.log
6. How your changes persist
6. 变更的持久化方式
You don't need to "save." Every mutating call schedules a debounced
auto-commit (~5 seconds): the change is committed and pushed to Base44's code
storage, so it:
- survives sandbox death (the sandbox is recreated from the last commit),
- appears in the builder's Library/Data tabs,
- keeps backend-function deploys consistent, and
- is included when you publish the app.
Practical implications:
- There's a small loss window (~5s) — don't kill the session immediately after the last edit; give it a moment to commit.
- Edits to entities, agents, workflows, backend functions, and page routing are synced into Base44 automatically after the commit. Plain page/component/CSS edits live in git and need nothing extra.
你无需手动「保存」。每次修改调用都会触发防抖自动提交(约5秒):变更会被提交并推送到Base44的代码存储中,因此:
- 即使沙箱终止,变更也会保留(沙箱会从上次提交的内容重新创建),
- 变更会显示在构建器的Library/Data标签页中,
- 确保后端函数部署的一致性,
- 发布应用时会包含这些变更。
实际影响:
- 存在一个小的丢失窗口(约5秒)——不要在最后一次编辑后立即终止会话;给它一点时间完成提交。
- 对实体、Agent、工作流、后端函数和页面路由的编辑会在提交后自动同步到Base44中。普通页面/组件/CSS编辑存储在Git中,无需额外操作。
7. Concurrency: you vs. the Base44 builder
7. 并发:你与Base44构建器
You and the in-app Base44 builder can't mutate the same app at once:
- While you're actively using the sandbox tools, the Base44 builder chat is blocked ("An external agent is currently working on this app"). Your session is implicit — recent tool calls are the session; it ends after a short idle period (~10 min).
- If the Base44 builder is mid-build, your mutating tools return
. Poll
BUILDER_BUSYand retry once it'sget_app_status. Read-only tools still work during a build.ready
你和Base44应用内构建器无法同时修改同一应用:
- 当你正在使用沙箱工具时,Base44构建器聊天会被阻止(「外部代理当前正在处理此应用」)。你的会话是隐式的——最近的工具调用即代表会话;闲置一段时间后(约10分钟)会话结束。
- 如果Base44构建器正在构建中,你的修改类工具会返回。轮询
BUILDER_BUSY,当状态变为get_app_status后重试。构建期间只读工具仍可正常使用。ready
8. Guardrails & limits
8. 防护措施与限制
- Paths are confined to the app. File tools operate only within the app
directory; traversal/absolute paths are rejected ().
PATH_OUTSIDE_SANDBOX - is off-limits to file tools (
.agents/) — it holds agent-managed config and secrets (PROTECTED_PATH). Don't try to read or edit it through the file tools..agents/.env - Rate limits apply per app: reads ~120/min, mutations ~60/min, commands
~30/min. If you hit , slow down.
RATE_LIMITED - isn't a dedicated tool — delete via
delete_file.run_command rm
- 路径限制在应用内部。文件工具仅能在应用目录内操作;遍历/绝对路径会被拒绝()。
PATH_OUTSIDE_SANDBOX - 目录禁止文件工具访问(
.agents/)——该目录包含代理管理的配置和密钥(PROTECTED_PATH)。不要尝试通过文件工具读取或编辑该目录。.agents/.env - 速率限制:每个应用的读取操作约120次/分钟,修改操作约60次/分钟,命令操作约30次/分钟。若收到错误,请降低操作频率。
RATE_LIMITED - 没有专门的工具——通过
delete_file命令删除文件。run_command rm
Error codes you may see
可能遇到的错误码
NOT_AUTHORIZEDAPP_NOT_FOUNDPATH_OUTSIDE_SANDBOXPROTECTED_PATHNOT_FOUNDBINARY_FILEEDIT_TEXT_NOT_FOUNDEDIT_TEXT_NOT_UNIQUEold_textreplace_allOVERWRITE_NOT_ALLOWEDoverwrite: trueTIMEOUTOUTPUT_TRUNCATEDBUILDER_BUSYCOMMIT_FLUSH_PENDINGcreate_checkpointRATE_LIMITEDBACKEND_ERRORMessages are written so the agent can self-correct — read them and adjust.
NOT_AUTHORIZEDAPP_NOT_FOUNDPATH_OUTSIDE_SANDBOXPROTECTED_PATHNOT_FOUNDBINARY_FILEEDIT_TEXT_NOT_FOUNDEDIT_TEXT_NOT_UNIQUEold_textreplace_allOVERWRITE_NOT_ALLOWEDoverwrite: trueTIMEOUTOUTPUT_TRUNCATEDBUILDER_BUSYCOMMIT_FLUSH_PENDINGcreate_checkpointRATE_LIMITEDBACKEND_ERROR错误消息设计为便于代理自我修正——请阅读并调整操作。
9. Tips & tricks
9. 技巧与窍门
- Read before you write. A quick +
list_directory(orread_file) pass costs little and dramatically improves edit accuracy.grep - Use on
dry_runto confirm the diff before committing to a change, especially for multi-edit calls.edit_file - Prefer over
edit_filefor existing files — surgical edits avoid clobbering and produce a reviewable diff.write_file - Read line ranges with 's
read_file/offseton large files instead of pulling the whole thing into context.limit - When something "looks broken," tail before guessing — it usually names the exact file and line.
/tmp/vite.log - Let it commit. Pause a few seconds after your final edit so the auto-commit lands before you disconnect or publish.
- Checkpoint known-good states. Use (
create_checkpoint) to mark a restore point before or after a risky chunk of edits — it flushes pending changes first, so the user can always roll back to that point.sandbox checkpoint - One agent at a time. The feature is designed for a single external agent per app; don't run parallel sessions against the same app.
- 先读后写。快速执行+
list_directory(或read_file)的成本很低,但能大幅提高编辑的准确性。grep - 在中使用
edit_file——在提交变更前确认差异,尤其是多编辑调用时。dry_run - 修改现有文件优先使用而非
edit_file——精准编辑避免覆盖,并生成可审核的差异。write_file - 读取大文件时使用的
read_file/offset参数读取行范围,而非将整个文件加载到上下文。limit - 当出现「看起来异常」的情况时,先查看尾部——它通常会明确指出问题文件和行号。
/tmp/vite.log - 等待提交完成。最后一次编辑后暂停几秒,让自动提交完成后再断开连接或发布应用。
- 为已知良好状态创建检查点。在风险较大的编辑前后,使用(
create_checkpoint)标记恢复点——它会先刷新待处理变更,因此用户始终可以回滚到该状态。sandbox checkpoint - 同一时间仅使用一个代理。该功能设计为每个应用对应一个外部代理;不要针对同一应用运行并行会话。
10. Local agents via the base44 sandbox
CLI
base44 sandbox10. 通过base44 sandbox
CLI使用本地代理
base44 sandboxIf your agent runs on your machine, it can drive the same sandbox through the Base44 CLI instead of
MCP, authenticating with the Base44 CLI instead of OAuth. Same tools, same behavior, same error
codes (Section 8) — only the surface and auth differ.
Auth. Log in with the Base44 CLI () — the same credential used for
. Like the projectless commands, the sandbox
subcommands resolve the app id from , then , then a local ;
no is required.
base44 loginbase44 functions deploybase44 connectors--app-idBASE44_APP_ID.app.jsoncconfig.jsoncCommand names. The CLI exposes each sandbox tool under a shorter name:
| MCP tool | CLI command |
|---|---|
| |
| |
| |
| |
| |
| |
| |
bash
npx base44 sandbox read --app-id <APP_ID> src/App.jsxbase44 sandbox checkpoint--namebash
npx base44 sandbox checkpoint --app-id <APP_ID> --name "before refactor"Hand an agent the full reference for a specific app (instructions, public, no
auth needed to fetch):
https://app.base44.com/api/sandbox/<APP_ID>/local-agent/readme.md(The cloud/MCP equivalent is .)
.../api/sandbox/<APP_ID>/claude-web/readme.mdEverything else in this skill — the edit→preview→verify loop (Section 5), persistence
(Section 6), concurrency (Section 7), and guardrails (Section 8) — applies identically; only the
surface and auth differ.
如果你的代理在本地机器上运行,它可以通过Base44 CLI而非MCP操作同一沙箱,使用Base44 CLI而非OAuth进行认证。工具、行为、错误码(第8节)完全一致——仅交互方式和认证方式不同。
认证。使用Base44 CLI登录()——与使用相同的凭据。与无项目的命令类似,沙箱子命令会从、、本地文件中解析应用ID;无需文件。
base44 loginbase44 functions deploybase44 connectors--app-idBASE44_APP_ID.app.jsoncconfig.jsonc命令名称。CLI使用更短的名称暴露每个沙箱工具:
| MCP工具 | CLI命令 |
|---|---|
| |
| |
| |
| |
| |
| |
| |
bash
npx base44 sandbox read --app-id <APP_ID> src/App.jsxbase44 sandbox checkpoint--namebash
npx base44 sandbox checkpoint --app-id <APP_ID> --name "before refactor"为代理提供特定应用的完整参考文档(说明文档,公开访问,无需认证即可获取):
https://app.base44.com/api/sandbox/<APP_ID>/local-agent/readme.md(云端/MCP对应的链接为。)
.../api/sandbox/<APP_ID>/claude-web/readme.md本文其余内容——编辑→预览→验证循环(第5节)、持久化(第6节)、并发(第7节)、防护措施(第8节)——完全适用;仅交互方式和认证方式不同。
11. Connectors (OAuth integrations)
11. 连接器(OAuth集成)
Beyond the sandbox file/shell tools, the Base44 MCP server exposes two tools for managing a
third-party OAuth connector (Google Calendar, Gmail, Slack, …) on an app. They don't touch the
sandbox filesystem — they operate on the app's connector state directly. Both take .
appId| Tool | Scope | Purpose |
|---|---|---|
| | List the app's connectors. With no |
| | Connect (or re-scope) a connector. Inputs: |
Two semantics to get right:
- Declarative scopes (replace, not merge). sets the connector to exactly the
initiate_connector_connectionyou pass. Omitted scopes are removed and the user is re-prompted to consent. Always callscopesfirst, then pass the complete desired set (existing scopes you want to keep plus any new ones).list_connectors - OAuth needs a human. The tool returns either (nothing to do) or a
already_authorized: truethe user must open in a browser to sign in and consent — you can't complete it yourself. After they finish, callredirect_urlagain to verify and read the granted scopes (a provider may grant fewer than requested).list_connectors
These need only / — not . Over the CLI surface
(Section 10), the equivalent is the projectless commands
(, , ), which
print the same authorization URL.
apps:readapps:writesandbox:writebase44 connectorslist-availableinitiate --integration-type <t> --scopes <s...> --app-id <id>pull除沙箱文件/Shell工具外,Base44 MCP服务器还提供两个工具,用于管理应用中的第三方OAuth连接器(Google日历、Gmail、Slack等)。它们不会触及沙箱文件系统——直接操作应用的连接器状态。两个工具都需要参数。
appId| 工具 | 权限范围 | 用途 |
|---|---|---|
| | 列出应用的连接器。若未指定 |
| | 连接(或重新授权)连接器。输入参数: |
需要注意两个语义:
- 声明式权限范围(替换,而非合并)。会将连接器的权限范围设置为完全匹配你传递的
initiate_connector_connection。未包含的权限范围会被移除,用户需重新授权。务必先调用scopes,然后传递完整的期望权限范围(包含你想保留的现有权限范围以及任何新权限范围)。list_connectors - OAuth需要人工操作。该工具会返回(无需操作)或一个
already_authorized: true,用户必须在浏览器中打开该链接进行登录和授权——你无法自行完成此操作。用户完成后,再次调用redirect_url验证并读取已授予的权限范围(提供商可能授予的权限范围少于请求的范围)。list_connectors
这些工具仅需要 / 权限——不需要。通过CLI(第10节)操作时,对应的是无项目的命令(、、),这些命令会打印相同的授权URL。
apps:readapps:writesandbox:writebase44 connectorslist-availableinitiate --integration-type <t> --scopes <s...> --app-id <id>pull