Skip to content

fix: handle non-stdio MCP server configs in config mcp - #784

Merged
ieedan merged 4 commits into
jsrepojs:mainfrom
guillevc:fix/mcp-config-unknown-server-types
Mar 6, 2026
Merged

ieedan merged 4 commits into
jsrepojs:mainfrom
guillevc:fix/mcp-config-unknown-server-types

Conversation

@guillevc

@guillevc guillevc commented Mar 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • McpServerConfigSchema and VSCodeServerConfigSchema validated every MCP server entry against ServerConfigSchema, which requires command and args. This breaks when the config already contains non-stdio servers (e.g. HTTP-based with url).
  • Changed the record value type from ServerConfigSchema to z.unknown() so existing entries are preserved as-is.
  • Added a test case covering non-stdio server configs.

Fixes #783

note: This PR was written with the assistance of Claude Code.

`config mcp` fails when the existing config file has servers that
don't use the stdio format (e.g. HTTP-based servers with `url` instead
of `command`/`args`). Use z.unknown() for the record values so other
servers are preserved without being validated.

Refs jsrepojs#783
@changeset-bot

changeset-bot Bot commented Mar 5, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: e009b94

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 11 packages
Name Type
jsrepo Patch
@jsrepo/bun Patch
@jsrepo/mcp Patch
@jsrepo/migrate Patch
@jsrepo/pnpm Patch
@jsrepo/shadcn Patch
@jsrepo/transform-biome Patch
@jsrepo/transform-filecasing Patch
@jsrepo/transform-javascript Patch
@jsrepo/transform-oxfmt Patch
@jsrepo/transform-prettier Patch

Not sure what this means? Click here to learn what changesets are.

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

@vercel

vercel Bot commented Mar 5, 2026

Copy link
Copy Markdown

@guillevc is attempting to deploy a commit to the jsrepo Team on Vercel.

A member of the Team first needs to authorize it.

@ieedan

ieedan commented Mar 5, 2026

Copy link
Copy Markdown
Collaborator

The premise works but we should probably use an actual type here instead of unknown. Not sure if there is a standard that can be followed

@guillevc

guillevc commented Mar 5, 2026

Copy link
Copy Markdown
Contributor Author

I looked into this and there isn't really a standard to follow. The MCP spec covers the transport protocols (stdio and streamable HTTP) but doesn't define a config file schema, and each client has their own convention. The spec also allows custom transports, so new shapes could show up anytime.

Since jsrepo doesn't care about the format of existing servers' configs and just needs to preserve them while writing its own entry, I think z.unknown() is fine here. That said, we could use z.object({}).passthrough() insted if we want to at least validate that each entry is an object.

Happy to update either way.

@ieedan

ieedan commented Mar 6, 2026

Copy link
Copy Markdown
Collaborator

I think for now we can just have a type that says that it could have those stdio properties or http properties instead of having no typing at all. That way if we need to access them in the future they are already there.

@pkg-pr-new

pkg-pr-new Bot commented Mar 6, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

jsrepo

pnpm add https://pkg.pr.new/jsrepojs/jsrepo@784

@jsrepo/mcp

pnpm add https://pkg.pr.new/jsrepojs/jsrepo/@jsrepo/mcp@784

@jsrepo/migrate

pnpm add https://pkg.pr.new/jsrepojs/jsrepo/@jsrepo/migrate@784

@jsrepo/transform-biome

pnpm add https://pkg.pr.new/jsrepojs/jsrepo/@jsrepo/transform-biome@784

@jsrepo/transform-filecasing

pnpm add https://pkg.pr.new/jsrepojs/jsrepo/@jsrepo/transform-filecasing@784

@jsrepo/transform-javascript

pnpm add https://pkg.pr.new/jsrepojs/jsrepo/@jsrepo/transform-javascript@784

@jsrepo/transform-oxfmt

pnpm add https://pkg.pr.new/jsrepojs/jsrepo/@jsrepo/transform-oxfmt@784

@jsrepo/transform-prettier

pnpm add https://pkg.pr.new/jsrepojs/jsrepo/@jsrepo/transform-prettier@784

commit: e009b94

@vercel

vercel Bot commented Mar 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
jsrepo.dev Ready Ready Preview, Comment Mar 6, 2026 0:55am

Request Review

@ieedan ieedan left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@ieedan
ieedan merged commit a28e22c into jsrepojs:main Mar 6, 2026
9 checks passed

This branch was successfully deployed

1 active deployment
Preview — e009b94d Deployed Mar 6, 2026 by vercel[bot]
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.

config mcp fails when existing config contains non-stdio servers

2 participants