fix(opencode): doctor ignores global config, lists 0 servers#36
Open
Sereinxm wants to merge 1 commit into
Open
fix(opencode): doctor ignores global config, lists 0 servers#36Sereinxm wants to merge 1 commit into
Sereinxm wants to merge 1 commit into
Conversation
The OpenCode generator declared `globalConfigPaths: null` while its `detectInstalled()` checked for `~/.config/opencode`. As a result, `getmcp doctor` marked OpenCode as installed but always read the relative `opencode.json` path (which usually does not exist), returning an empty config and listing zero servers. This was especially confusing because the report said "OpenCode: config file is valid" while silently ignoring the user's real `~/.config/opencode/opencode.jsonc`. Two changes: 1. `packages/generators/src/opencode.ts` Declare `globalConfigPaths` pointing at `~/.config/opencode/opencode.jsonc` (darwin/linux) and `%AppData%/opencode/opencode.jsonc` (win32), matching the OpenCode documented global config location. 2. `packages/cli/src/detect.ts` For dual-scope apps, when the project config file does not exist but the global one does, point `configPath` at the global file. This makes `doctor`/`list` reflect the config the user is actually using. Also benefits Claude Code users who only keep `~/.claude.json`. Tests updated to classify OpenCode as dual-scope. Verified locally: `getmcp doctor` now lists all 6 configured servers (previously 0).
|
Someone is attempting to deploy a commit to the rodrigotomees' projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
getmcp doctorreports OpenCode as installed and "config file is valid", but lists zero servers from it — even when the user has 6+ servers configured in `~/.config/opencode/opencode.jsonc`.Example output before fix:
```
◆ OpenCode: config file is valid
└ 2 warning(s) found. 9 check(s) passed. ← OpenCode servers missing
```
Root cause
The OpenCode generator declares `globalConfigPaths: null` while its `detectInstalled()` checks for `~/.config/opencode`:
```ts
// packages/generators/src/opencode.ts
configPaths: "opencode.json", // relative path
globalConfigPaths: null, // ← no global path declared
// ...
detectInstalled(): boolean {
return safeExistsSync(join(configHome, "opencode")); // ← but checks global dir
}
```
Because `globalConfigPaths` is `null`:
This contradicts the OpenCode docs, which state global settings live in `~/.config/opencode/opencode.jsonc`.
Fix
1. `packages/generators/src/opencode.ts` — declare the real global config paths:
```ts
globalConfigPaths: {
darwin: "
/.config/opencode/opencode.jsonc",/.config/opencode/opencode.jsonc",win32: "%AppData%/opencode/opencode.jsonc",
linux: "
},
```
2. `packages/cli/src/detect.ts` — for dual-scope apps, when the project config doesn't exist but the global one does, point `configPath` at the global file. This makes `doctor` / `list` reflect the config the user is actually using. Also benefits Claude Code users who only keep `~/.claude.json`.
3. `packages/cli/tests/detect.test.ts` — move `opencode` from single-scope to dual-scope assertion list.
Verification
Locally, after the fix:
```
$ getmcp doctor
▲ "exa" is not in the registry and not tracked
│ Configured in: opencode
▲ "semble" is not in the registry and not tracked
│ Configured in: opencode
... (4 more servers now detected)
◆ "codebase-memory-mcp" is configured in 2 apps
└ 7 warning(s) found. 10 check(s) passed.
```
All 6 OpenCode servers are now detected (previously 0).
Testing
Scope of change
```
packages/cli/src/detect.ts | 16 +++++++++++++++-
packages/cli/tests/detect.test.ts | 4 ++--
packages/generators/src/opencode.ts | 12 +++++++++++-
3 files changed, 28 insertions(+), 4 deletions(-)
```
No public API changes. The `detectApps()` fallback to global only triggers when the project file is absent — `add` / `remove` commands, which always resolve scope explicitly, are unaffected.