You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
fix(mcp): deconflict local and remote MCP servers to prevent partial deploys (#23)
Rename remote MCP server from "jack" to "jack-cloud" and rename file
tools to clearly signal they're for terminal-less environments only:
- update_file → stage_file
- list_staged_changes → list_staged_files
- list_project_files → browse_deployed_source
- read_project_file → read_deployed_file
Tool descriptions now include negative guidance ("if you have
Read/Edit/Write tools, use those instead") to prevent agents from
using remote file staging when local filesystem access is available.
Add dual-connection detection to jack mcp install — automatically
removes remote MCP configs that conflict with the local server.
Narrow CLAUDE.md and agents://context guidance from blanket "always
prefer MCP tools" to "prefer MCP for cloud operations, use built-in
tools for file editing."
Copy file name to clipboardExpand all lines: CLAUDE.md
+14-3Lines changed: 14 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,11 +107,12 @@ When uploading Workers to Cloudflare's dispatch namespace, upload ALL files from
107
107
108
108
## Jack MCP (for AI Agents)
109
109
110
-
**CRITICAL:**When Jack MCP is connected, always prefer `mcp__jack__*` tools over CLI commands or wrangler. MCP tools are cloud-aware and work with Jack Cloud mode where wrangler won't.
110
+
When Jack MCP is connected, prefer `mcp__jack__*` tools for **cloud operations** (deploy, databases, logs, crons, domains, storage, vectorize) over CLI commands or wrangler. MCP tools are cloud-aware and work with Jack Cloud mode where wrangler won't.
111
111
112
-
-Check your available tools for anything prefixed with `mcp__jack__`
113
-
-Use those instead of `jack` CLI commands or `wrangler` commands
112
+
-For deployments, databases, logs, and services: use `mcp__jack__*` tools
113
+
-For file editing: always use built-in Read/Edit/Write tools, never remote MCP tools like `stage_file` or `read_deployed_file`
114
114
- If a capability isn't available via MCP, ask the user to run it via CLI
115
+
- The local MCP (`mcp__jack__*`) and remote MCP (`mcp__jack_cloud__*`) are mutually exclusive — never connect both simultaneously
-`parseJsonc()` in `jsonc.ts` — JSONC parsing (never use regex comment stripping)
240
241
-`readProjectLink()` + `getDeployMode()` in `project-link.ts` — project link and deploy mode
242
+
243
+
**After modifying shell integration (`shell-integration.ts`), regenerate the shell file for local testing.**
244
+
245
+
`jack update` only regenerates `~/.config/jack/shell.sh` after a successful npm update — it won't pick up local dev changes. After editing `shell-integration.ts`, run:
246
+
247
+
```bash
248
+
bun -e "import { writeShellFile } from './apps/cli/src/lib/shell-integration.ts'; writeShellFile();"
249
+
```
250
+
251
+
Then open a new terminal (or `source ~/.zshrc`) to load the updated shell function. Without this, you'll be testing against the stale shell.sh from the last published version.
Copy file name to clipboardExpand all lines: apps/cli/src/commands/mcp.ts
+2-2Lines changed: 2 additions & 2 deletions
Original file line number
Diff line number
Diff line change
@@ -262,7 +262,7 @@ async function outputProjectContext(): Promise<void> {
262
262
lines.push("- Status: `mcp__jack__get_project_status` or `jack info`");
263
263
lines.push("");
264
264
lines.push(
265
-
"Prefer `mcp__jack__*` tools or `jack` CLI over raw `wrangler` commands for consistency.",
265
+
"For cloud operations, prefer `mcp__jack__*` tools or `jack` CLI over raw `wrangler` commands. For file editing, use built-in Read/Edit/Write tools.",
266
266
);
267
267
}
268
268
@@ -272,7 +272,7 @@ async function outputProjectContext(): Promise<void> {
272
272
);
273
273
lines.push("");
274
274
lines.push(
275
-
"**Always prefer `mcp__jack__*` tools over CLI commands or wrangler** — they are cloud-aware and work in all deploy modes.",
275
+
"**For cloud operations (deploy, databases, logs, services), prefer `mcp__jack__*` tools over CLI commands or wrangler** — they are cloud-aware and work in all deploy modes. For file editing, always use built-in Read/Edit/Write tools.",
`\n⚠ Removing remote Jack MCP server ("${key}") — it conflicts with the local server.\n Local MCP covers all remote capabilities when you have filesystem access.\n Remote MCP is only needed in terminal-less environments (claude.ai web).\n`,
164
+
);
165
+
deletemcpServers[key];
166
+
}
167
+
}
168
+
130
169
/**
131
170
* Install MCP config to a single app
132
171
* Reads existing config, merges jack server, writes back
The local MCP (`jack mcp serve`, stdio) and remote MCP (`mcp.getjack.org`, HTTP) serve different environments and should **never be connected simultaneously**:
41
+
42
+
| Environment | MCP Server | Why |
43
+
|-------------|-----------|-----|
44
+
| Claude Code (has terminal + local FS) | Local only (`jack`) | Agent has Read/Edit/Write for files, local MCP for cloud ops |
45
+
| claude.ai web (no terminal) | Remote only (`jack-cloud`) | No local FS, must use stage_file + deploy for file changes |
46
+
| Claude Desktop | One or the other | Depends on whether shell access is available |
47
+
48
+
If both are connected, agents use remote file tools (`stage_file`, `read_deployed_file`) instead of local filesystem tools, causing partial deploys and failures. The `jack mcp install` command detects and removes remote MCP configs to prevent this.
- files: Full file set for a brand-new project. Pass all source files as { "path": "content" }. Only use this for the FIRST deploy of a new custom project.
27
27
- template: Deploy a prebuilt template (hello, api, miniapp, nextjs, saas). Always creates a new project.
28
28
- changes: Partial update to an existing project. Pass only changed/added files as { "path": "new content" } or { "path": null } to delete. Requires project_id.
29
-
- staged: Deploy files previously staged via update_file. Set staged=true with project_id. Use this when files are too large to pass inline in a single changes call.
29
+
- staged: Deploy files previously staged via stage_file. Set staged=true with project_id. Use this when files are too large to pass inline in a single changes call.
30
30
31
31
IMPORTANT: To update an existing project, ALWAYS use changes mode with project_id. Do NOT use files mode for existing projects — it replaces all files and may create a duplicate project. If the user mentions an existing app, call list_projects first to find its project_id, then use changes.
32
32
33
-
For large files (>15KB): Use update_file to stage files one at a time, then deploy(staged=true, project_id). This avoids output token limits that can truncate large inline content.`,
33
+
For large files (>15KB): Use stage_file to stage files one at a time, then deploy(staged=true, project_id). This avoids output token limits that can truncate large inline content.`,
34
34
{
35
35
files: z
36
36
.record(z.string(),z.string())
@@ -52,7 +52,7 @@ For large files (>15KB): Use update_file to stage files one at a time, then depl
52
52
.boolean()
53
53
.optional()
54
54
.describe(
55
-
"Deploy files previously staged via update_file calls. Requires project_id. Use when files are too large for inline changes.",
55
+
"Deploy files previously staged via stage_file calls. Requires project_id. Use when files are too large for inline changes.",
56
56
),
57
57
project_id: z
58
58
.string()
@@ -73,8 +73,10 @@ For large files (>15KB): Use update_file to stage files one at a time, then depl
73
73
);
74
74
75
75
server.tool(
76
-
"update_file",
77
-
`Stage a file change for later deployment. Use this to build up changes across multiple calls, then deploy them all at once with deploy(staged=true).
76
+
"stage_file",
77
+
`Stage a file for cloud deployment via deploy(staged=true). Only use this in environments WITHOUT local filesystem access (e.g. claude.ai web, Claude Desktop without terminal).
78
+
79
+
If you have built-in Read/Edit/Write tools available, do NOT use this tool — edit files locally and deploy with deploy_project or jack ship instead.
78
80
79
81
Best for:
80
82
- Large files that exceed output token limits when passed inline via changes
@@ -100,8 +102,8 @@ Pass content=null to mark a file for deletion.`,
100
102
);
101
103
102
104
server.tool(
103
-
"list_staged_changes",
104
-
"List files currently staged via update_file that haven't been deployed yet. Use to review pending changes before calling deploy(staged=true).",
105
+
"list_staged_files",
106
+
"List files currently staged via stage_file that haven't been deployed yet. Use to review pending changes before calling deploy(staged=true).",
@@ -188,8 +190,12 @@ Pass content=null to mark a file for deletion.`,
188
190
);
189
191
190
192
server.tool(
191
-
"list_project_files",
192
-
"List all source files in a deployed project. Use before read_project_file to see what files exist, or before deploying with changes to understand current project structure.",
193
+
"browse_deployed_source",
194
+
`List all source files in the DEPLOYED version of a project on Jack Cloud. Shows the file tree as it exists in production, not local files.
195
+
196
+
If you have local filesystem access (e.g. Claude Code with Glob/LS tools), read the local project directory instead — it's faster and more accurate.
197
+
198
+
Use before read_deployed_file to see what files exist, or before deploying with changes to understand current project structure.`,
@@ -199,11 +205,15 @@ Pass content=null to mark a file for deletion.`,
199
205
);
200
206
201
207
server.tool(
202
-
"read_project_file",
203
-
"Read the contents of a single source file from a deployed project. Use after list_project_files to inspect specific files before making changes with deploy(changes).",
208
+
"read_deployed_file",
209
+
`Read the contents of a single source file from the DEPLOYED version on Jack Cloud. Returns the file as it exists in production.
210
+
211
+
If you have local filesystem access (e.g. Claude Code with the Read tool), read the local file instead — it's faster and always up-to-date with your working copy.
212
+
213
+
Use after browse_deployed_source to inspect specific files before making changes with deploy(changes).`,
0 commit comments