-
Notifications
You must be signed in to change notification settings - Fork 173
chore: support schema overrides and custom parserOptions MCP-338 #800
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR renames createUserConfig to parseUserConfig and adds support for schema overrides and custom parser options. The changes enable more flexible configuration parsing, including custom environment variable prefixes and default value overrides.
Key changes:
- Renamed
createUserConfigtoparseUserConfigthroughout the codebase - Added support for schema overrides through a new
overridesparameter - Exposed
ParserOptionstype anddefaultParserOptionsfor customization - Updated public API exports to reflect the new naming
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| src/common/config/createUserConfig.ts | Renamed to parseUserConfig.ts; added overrides and parserOptions parameters to support custom schemas and parser configuration |
| tests/unit/common/config.test.ts | Updated all test calls from createUserConfig to parseUserConfig; added tests for schema overrides and custom environment prefixes |
| src/lib.ts | Updated exports to expose parseUserConfig, defaultParserOptions, and ParserOptions type instead of parseCliArgumentsAsUserConfig |
| src/index.ts | Updated import to use parseUserConfig instead of createUserConfig |
| src/transports/base.ts | Updated documentation comments to reference parseUserConfig instead of createUserConfig |
| eslint-rules/enforce-zod-v4.js | Updated allowed file path from createUserConfig.ts to parseUserConfig.ts |
| MCP_SERVER_LIBRARY.md | Updated documentation to reflect parseUserConfig naming and simplified function signature |
| export { Server, type ServerOptions } from "./server.js"; | ||
| export { Session, type SessionOptions } from "./common/session.js"; | ||
| export { type UserConfig, UserConfigSchema } from "./common/config/userConfig.js"; | ||
| export { createUserConfig as parseCliArgumentsAsUserConfig } from "./common/config/createUserConfig.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
so I unfortunately missed that we're doing this; it's weird to have this discrepancy where our external export is named differently than our internal one. To me the idea that the name isn't straightforward was a code smell.
parseCliArgumentsAsUserConfig is inherently misleading though since by default it also parses environment variables. This can mislead users so it's best to rename it.
It is technically a library breaking change though.
Pull Request Test Coverage Report for Build 20228819696Details
💛 - Coveralls |
| ```typescript | ||
| function parseCliArgumentsAsUserConfig(options?: { | ||
| args?: string[]; | ||
| helpers?: CreateUserConfigHelpers; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the concept of CreateUserConfigHelpers was unused.
This allows for more flexibility when parsing, including specifying custom defaults, environment prefixes, etc..