-
-
Notifications
You must be signed in to change notification settings - Fork 503
feat: mcp options #2606
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: master
Are you sure you want to change the base?
feat: mcp options #2606
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 adds MCP transport configuration options and fixes several issues in MCP-related code generation. The changes enable configuration of MCP transport (stdio vs http), properly handle custom mutators, use generated schema names instead of hand-crafted ones, and ensure all server tool declarations include required parameters.
Key Changes:
- Add MCP transport configuration option (stdio/http) in type definitions and normalization
- Fix server tool declarations to include required empty object parameter for tools without input schemas
- Add missing RequestInit options parameter to all handler types and implementations
- Fix custom mutator imports in http-client file generation
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/core/src/types.ts | Adds MCP options types with transport configuration |
| packages/orval/src/utils/options.ts | Normalizes MCP options with default stdio transport |
| packages/mcp/src/index.ts | Uses generated schema names, adds options parameter, conditionally generates server connect code based on transport, and adds mutator import handling |
| samples/mcp/petstore/src/server.ts | Adds required empty object parameter to tool declarations |
| samples/mcp/petstore/src/handlers.ts | Adds options parameter to all handler types and function calls |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| handlerArgsTypes.push(` bodyParams: ${verbOptions.body.definition};`); | ||
| } | ||
|
|
||
| handlerArgsTypes.push(` options?: RequestInit;`); |
Copilot
AI
Dec 1, 2025
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 options parameter should be added conditionally only when handlerArgsTypes has other parameters. When there are no other parameters (e.g., for getInventory), the handler will have args as a parameter with only options, but the function call will always pass args.options, which could be undefined if no args are provided.
| if (verbOptions.body.definition) fetchParams.push(`args.bodyParams`); | ||
| if (verbOptions.queryParams) fetchParams.push(`args.queryParams`); | ||
|
|
||
| fetchParams.push(`args.options`); |
Copilot
AI
Dec 1, 2025
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.
This unconditionally pushes args.options to fetchParams, but when handlerArgsTypes is empty (no parameters), the handler function signature won't accept args, causing a mismatch between the handler signature and the fetch call parameters.
…s, and improve MCP generator imports and server connection.
5f519da to
bb666ca
Compare
soartec-lab
left a comment
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.
Thanks! could you also write the doc ?
https://github.com/orval-labs/orval/blob/master/docs/src/pages/reference/configuration/output.mdx
and ad test case
https://github.com/orval-labs/orval/blob/master/tests/configs/mcp.config.ts
Fix #2594