What's the proper way to pass current working directory to the global opencode.json config? #2256

Open
opened 2026-02-16 17:34:51 -05:00 by yindo · 3 comments
Owner

Originally created by @sheldonhull on GitHub (Oct 23, 2025).

Originally assigned to: @rekram1-node on GitHub.

Question

    "mcp-gopls": {
      "type": "local",
      "command": [
        "mcp-gopls",
        "-workspace",
        "."
      ]
    },

Is this correct way to reference the current location I opened opencode from?
Didn't work for filesystem mcp, and not sure if I should use $(PWD) or some other type of approach. The docs don't mention how to use this.

I think it worked with ".", but it worked through a few errors initially so can't tell if that's opencode fixing the calls since initially it started with /tmp/ as the path it was examining, then /usr/local/go/src/fmt/print.go for some reason, then finally listed document symbols in the actual project.

Originally created by @sheldonhull on GitHub (Oct 23, 2025). Originally assigned to: @rekram1-node on GitHub. ### Question ``` "mcp-gopls": { "type": "local", "command": [ "mcp-gopls", "-workspace", "." ] }, ``` Is this correct way to reference the current location I opened opencode from? Didn't work for filesystem mcp, and not sure if I should use `$(PWD)` or some other type of approach. The docs don't mention how to use this. I _think_ it worked with ".", but it worked through a few errors initially so can't tell if that's opencode fixing the calls since initially it started with `/tmp/` as the path it was examining, then `/usr/local/go/src/fmt/print.go` for some reason, then finally listed document symbols in the actual project.
Author
Owner

@github-actions[bot] commented on GitHub (Oct 23, 2025):

This issue might be a duplicate or related to existing issues. Please check:

  • #1672: Discusses MCP relative path support and the need for better path handling in MCP configurations
  • #2308: About supporting MCP Roots which could be related to workspace/directory configuration

Feel free to ignore if none of these address your specific case about passing the current working directory to opencode.json.

@github-actions[bot] commented on GitHub (Oct 23, 2025): This issue might be a duplicate or related to existing issues. Please check: - #1672: Discusses MCP relative path support and the need for better path handling in MCP configurations - #2308: About supporting MCP Roots which could be related to workspace/directory configuration Feel free to ignore if none of these address your specific case about passing the current working directory to opencode.json.
Author
Owner

@sheldonhull commented on GitHub (Oct 23, 2025):

Partial match with mcp command and relative path, but this is just more focused on how do I use my global config in a local repo properly with a path not hard coded but just where I am working. Not sure if that consistents the same scope as the other.

@sheldonhull commented on GitHub (Oct 23, 2025): Partial match with mcp command and relative path, but this is just more focused on how do I use my global config in a local repo properly with a path not hard coded but just where I am working. Not sure if that consistents the same scope as the other.
Author
Owner

@rekram1-node commented on GitHub (Oct 23, 2025):

Custom lsp servers will spawn in the cwd of wherever you are running opencode

@rekram1-node commented on GitHub (Oct 23, 2025): Custom lsp servers will spawn in the cwd of wherever you are running opencode
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#2256