* claim: #7181 * MCP save: a folder the agent opened or saved a design in stays in scope (#7181) The agent's default folders held the open design's folder only while that design stayed open there, so after a new design, an opened STEP file or a save-as elsewhere a save beside the earlier design was refused, while the same save through the control port worked. The MCP server now keeps, for the rest of its run, the folder of every design file a call opened or saved (open, save, and doc.open, file.save, file.save_as through execute or batch, path given in full) and, headless, of every design open in its session. Such a call only succeeded because the folder was already in scope, so naming a path adds nothing. The folders get the open design folder's terms (inside home or temp, not hidden, hidden entries unreachable), at most 16. Bridged, they go to the app as design_folders, which it judges the same way. The save tool description and docs/mcp.md say how to add a folder with --allow-path. * MCP scope: a design's folder is the folder its file resolves to (#7181) A link in another folder to a design inside the agent's folders passes the scope check, which follows it, but its own folder was what got remembered (and, for the open design, what counted while it was open). Take the folder of the file as the check resolves it. * Control test: a hidden file the export format accepts (#7181) --------- Co-authored-by: MateuszSychXpl <151755914+MateuszSychXpl@users.noreply.github.com>
This commit is contained in:
@@ -124,7 +124,9 @@ reads, writes or deletes (command paths such as `file.export`'s `path` or `doc.r
|
||||
`dir`, `ui.render`, `ui.screenshot`) must then lie inside one of those folders after `..` and
|
||||
symlinks are resolved, or the request fails with `… outside the folders this agent may use …`.
|
||||
The app adds its own recovery folder and, when it lies safely inside the home folder and not in
|
||||
a hidden folder, the open design's folder (whose hidden files stay out of reach). The bridged
|
||||
a hidden folder, the open design's folder (whose hidden files stay out of reach). With
|
||||
`allow_paths`, `design_folders: ["/abs/folder", …]` (at most 16) names folders the agent opened
|
||||
or saved a design in; each counts on the open design folder's terms. The bridged
|
||||
MCP server sends its folders this way on every request ([mcp.md](mcp.md)). Without
|
||||
`allow_paths` file paths are not limited: a client holding the token can do what the user can.
|
||||
|
||||
|
||||
+22
-6
@@ -77,11 +77,19 @@ design is left as it was. Calls bridged to the app are not checked yet.
|
||||
|
||||
Tool calls read, write and delete files only inside the server's folders:
|
||||
|
||||
- the folder of the open design (the `--in` design, or whatever the agent last opened or saved),
|
||||
but only when it lies strictly inside your home folder (or the temporary folder) and not in a
|
||||
hidden folder. Home itself, a folder above it (`/`, `/home`, `/Users`, a drive's root),
|
||||
hidden folders such as `~/.config` and folders elsewhere don't count. Hidden files and folders
|
||||
inside the design's folder (`.env`, `.git`) are out of reach too;
|
||||
- the folder of the open design (the `--in` design, the design open in the app, or whatever
|
||||
the agent last opened or saved), but only when it lies strictly inside your home folder (or
|
||||
the temporary folder) and not in a hidden folder. Home itself, a folder above it (`/`,
|
||||
`/home`, `/Users`, a drive's root), hidden folders such as `~/.config` and folders elsewhere
|
||||
don't count. Hidden files and folders inside the design's folder (`.env`, `.git`) are out of
|
||||
reach too;
|
||||
- on the same terms, every folder the agent opened or saved a design file in during this
|
||||
server's run (`open`, `save`, or `doc.open`, `file.save` and `file.save_as` through `execute`
|
||||
or `batch`, with the path given in full) and, headless, every folder a design was open in,
|
||||
until the server stops (the 16 most recent). So after a new design, an opened STEP file or a
|
||||
save-as elsewhere, the agent can still save beside the design it worked on. Such a call
|
||||
succeeded only because its folder was already one of the agent's, so no folder joins just
|
||||
because the agent names it;
|
||||
- SolidCraft's own recovery folder, so `doc.recovery_list`, `doc.recover` and
|
||||
`doc.recovery_discard` work out of the box (discarding deletes only real recovery entries);
|
||||
- the server's own scratch folder (a new private `solidcraft-mcp-*` folder in the temporary
|
||||
@@ -116,7 +124,15 @@ solidcraft-cli mcp --allow-path ~/designs --allow-path ~/exports
|
||||
solidcraft-cli mcp --allow-any-path # no limit (the behaviour before this option existed)
|
||||
```
|
||||
|
||||
Bridged, the server sends its folders with every request (`allow_paths`, see
|
||||
When a `save` (or any other call) is refused with `… outside the folders this agent may use …`,
|
||||
add the folder to the server's `args` in your MCP client's configuration (the `mcpServers`
|
||||
entries below, or what `solidcraft-cli mcp setup` wrote), for example
|
||||
`"args": ["mcp", "--allow-path", "/Users/NAME/Documents/Designs"]`, and restart the client.
|
||||
An agent should ask you to do that rather than save through the app's control port, which
|
||||
knows nothing of these folders.
|
||||
|
||||
Bridged, the server sends its folders with every request (`allow_paths`, and the folders the
|
||||
agent opened or saved a design in as `design_folders`, see
|
||||
[control-protocol.md](control-protocol.md)) and the app adds its own recovery folder and the
|
||||
folder of the design open in it, under the same rules, so give absolute paths: a relative one
|
||||
resolves against the app's working folder, not the server's. The app's own
|
||||
|
||||
Reference in New Issue
Block a user