Summary
normalizeDirectory in src/helpers.ts rejects Windows absolute paths, so every tool that accepts a directory parameter is effectively unusable for Windows MCP clients. The validation hardcodes a POSIX assumption (normalized.startsWith("/")) that is only true on path.posix.
Repro
On Windows, from any MCP client:
opencode_run({ directory: "C:\Users\me\my-project", prompt: "..." })
or equivalently through any other tool that accepts directory.
Expected
The path is accepted and the request is scoped to that project.
Actual
Error: Invalid directory: "C:\Users\me\my-project" is not an absolute path.
Provide a full path like "/home/user/my-project".
Root cause
src/helpers.ts, function normalizeDirectory:
const normalized = resolve(directory);
// Must be an absolute path
if (!normalized.startsWith("/")) {
throw new Error(
`Invalid directory: "${directory}" is not an absolute path. ` +
`Provide a full path like "/home/user/my-project".`,
);
}
path.resolve is platform-aware and produces C:\Users\me\my-project on Windows, which does not start with "/", so every Windows absolute path (including UNC paths like \server\share) is rejected.
Fix
Use the platform-aware path.isAbsolute from node:path in place of startsWith("/"). resolve already guarantees an absolute path on every platform, so the check becomes correct on both POSIX and Windows without changing POSIX behavior.
Workaround
Omit the directory parameter entirely. The OpenCode server then inherits the cwd of the process that spawned it, which is usually fine for single-project setups but breaks multi-project workflows.
Impact
Complete loss of the directory parameter for every Windows client (Claude Code, Cursor, Windsurf, any MCP client on Windows). 79 tools are affected, since every tool uses directoryParam.
Environment
- opencode-mcp: v1.10.1
- Node.js: v22.x
- OS: Windows 11
- Tested on a regular
C: drive path and a mapped X: drive.
PR
A fix is ready — I'll open a PR right after this issue and link it here.
Summary
normalizeDirectoryinsrc/helpers.tsrejects Windows absolute paths, so every tool that accepts adirectoryparameter is effectively unusable for Windows MCP clients. The validation hardcodes a POSIX assumption (normalized.startsWith("/")) that is only true onpath.posix.Repro
On Windows, from any MCP client:
or equivalently through any other tool that accepts
directory.Expected
The path is accepted and the request is scoped to that project.
Actual
Root cause
src/helpers.ts, functionnormalizeDirectory:path.resolveis platform-aware and producesC:\Users\me\my-projecton Windows, which does not start with"/", so every Windows absolute path (including UNC paths like\server\share) is rejected.Fix
Use the platform-aware
path.isAbsolutefromnode:pathin place ofstartsWith("/").resolvealready guarantees an absolute path on every platform, so the check becomes correct on both POSIX and Windows without changing POSIX behavior.Workaround
Omit the
directoryparameter entirely. The OpenCode server then inherits the cwd of the process that spawned it, which is usually fine for single-project setups but breaks multi-project workflows.Impact
Complete loss of the
directoryparameter for every Windows client (Claude Code, Cursor, Windsurf, any MCP client on Windows). 79 tools are affected, since every tool usesdirectoryParam.Environment
C:drive path and a mappedX:drive.PR
A fix is ready — I'll open a PR right after this issue and link it here.