Skip to content

Conversation

@mastermakrela
Copy link

@mastermakrela mastermakrela commented Nov 6, 2025

This patch fixes issue #768, where sv add mcp generated an invalid configuration for the opencode client.
Previously, the addon produced a malformed config using "command": "npx" and a separate args field, which caused schema validation errors.

Fixes: #768

Changes

  • Updated getLocalConfig to support both command and args as flexible inputs.
  • Default command for local setup for opencode is now correctly defined as an array: ["npx", "-y", "@sveltejs/mcp"]; for other IDEs nothing has changed
  • Made args optional, to avoid schema warning in OpenCode, i.e. when using array-style commands.

Notes

  • I’ve looked at the contributing guidelines, and if I understand correctly, a changeset isn’t needed since this is part of an addon.
    If I'm wrong - I'll generate one :)
  • I noticed there’s already an MCP test, but it doesn’t verify the generated output for specific IDEs. But if wanted, I can create one.

Result

The generated opencode.json now matches the official schema at
https://opencode.ai/config.json, preventing the “expected array, received string” error when running opencode.

Before After
Screenshot 2025-11-06 at 22 35 38 Screenshot 2025-11-06 at 22 36 13

@changeset-bot
Copy link

changeset-bot bot commented Nov 6, 2025

⚠️ No Changeset found

Latest commit: 20c9dd3

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new
Copy link

pkg-pr-new bot commented Nov 7, 2025

Open in StackBlitz

npx https://pkg.pr.new/sveltejs/cli/sv@769
npx https://pkg.pr.new/sveltejs/cli/svelte-migrate@769

commit: 20c9dd3

@manuel3108 manuel3108 requested a review from jycouet November 7, 2025 15:09
@manuel3108
Copy link
Member

Looks correct according to their docs, thank you!
@jycouet Any idea if the docs were different when this addon was created, or which docs we were following?

@jycouet
Copy link
Contributor

jycouet commented Nov 7, 2025

Thank you for doing this.
I added a test to save snapshots, it will be easier to see if things change.

Any idea if the docs were different when this addon was created, or which docs we were following

I looked at links again, I think it's just me that didn't read well! >< Too many at the same time ^^


What do you think?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ading local MCP for OpenCode produces wrong config file

3 participants