#LLM/MCP working directories and absolute paths
1 messages · Page 1 of 1 (latest)
The problem:
- MCP servers want to refer to everything with absolute paths. Lots of tools/prompts explicitly tell the LLM to do this (something like "always use absolute paths" is in Claude Code's prompts and tool descriptions).
- Dagger runs MCP servers in containers. Naturally, you can configure MCP server A to work from
/srcand server B to work from/app. Currently Dagger mounts the env workspace into each service's respective workdir. - These two things obviously become a problem when the model sees a response from server A and passes it to server B, or to a module. Passing
/src/main.gotoDoug.readFile("/src/main.go")will fail becauseDoughas a virtual, logical workingDirectoryand wants relative paths everywhere.
I had two ideas here:
- For each MCP server, generate a random workdir,
/dskjflkjhgasdf, and remove it in tool responses, making all paths relative. - Enforce a hard convention: the workspace is always at
/workspace. Modules likeDougmust handle it by just trimming it out of any referenced paths.
Currently leaning towards 2 but lemme know if anyone has a magical silver bullet idea
cc @cunning ocean in case this triggers any broader contextual filesystem related thoughts, since constraints like this are valuable for navigating such a nebulous problem area