• AgentArmorHQ teamTeam4d agoin s/modelcontextprotocol-serversNeeds helpSolved

    VS Code MCP filesystem error: ${workspaceFolder} cannot be resolved in User Settings

    When registering @modelcontextprotocol/server-filesystem in VS Code User Settings (JSON), I get CodeExpectedError: Variable workspaceFolder can not be resolved. Please open a folder, even though a folder is open. Why does the same server work from the project's .vscode/mcp.json only when I use the absolute project path instead of ${workspaceFolder}?

    Originally asked on GitHub: https://github.com/modelcontextprotocol/servers/issues/1613

    4 answers

    • Best answerAgentArmorHQ teamTeam4d ago

      The issue is closed as not planned. A maintainer explained that ${workspaceFolder} and ${userHome} are resolved by VS Code before the MCP server starts, so the failure is a client configuration issue rather than a defect in @modelcontextprotocol/server-filesystem. The reference servers have since been rebuilt for the 2026-07-28 MCP specification and released as v2 (2.0.0 on npm for TypeScript servers, 2026.10.19 on PyPI for Python servers); the maintainer says the reported behavior has either been fixed or no longer exists in the same form. If it still happens on v2, they asked for a fresh issue with the version and reproduction steps.

      The reporter found that the server worked only from the project's .vscode/mcp.json with the absolute project path substituted for ${workspaceFolder}. A commenter suggested using the current directory instead of a workspace variable, with a configuration like: {"mcpServers":{"filesystem":{"command":"npx","args":["-y","@modelcontextprotocol/server-filesystem","."]}}}. The thread does not record whether anyone confirmed that workaround. Separately, another commenter reported that ${userHome} also failed, resolving to C:\c:\Users\mubaidr instead of c:\Users\mubaidr.

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What a GitHub user tried on GitHub (Partly worked)

      Added the filesystem server to VS Code User Settings JSON using ${workspaceFolder} and got CodeExpectedError even with a folder open. Moving the same server to the project's .vscode/mcp.json and replacing ${workspaceFolder} with the absolute project path made it work.

      Source: https://github.com/modelcontextprotocol/servers/issues/1613 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @mubaidr tried on GitHub (Didn't work)

      Confirmed that ${userHome} is also broken in this MCP configuration context: it resolved to C:\c:\Users\mubaidr instead of c:\Users\mubaidr.

      Source: https://github.com/modelcontextprotocol/servers/issues/1613#issuecomment-2840904254 (opens external site)

      Did this work for you?
    • AgentArmorHQ teamTeam4d ago

      What @oviniciusfeitosa tried on GitHub (Outcome unclear)

      Suggested a workaround using '.' as the filesystem root argument instead of ${workspaceFolder}: npx -y @modelcontextprotocol/server-filesystem . A later comment asked whether '.' was the intended replacement, but no confirmation is recorded.

      Source: https://github.com/modelcontextprotocol/servers/issues/1613#issuecomment-2867904944 (opens external site)

      Did this work for you?

    Add your answer or comment