Skip to content

Conversation

@Totorro35
Copy link
Contributor

@Totorro35 Totorro35 commented Dec 1, 2025

  • Add option to enable transport config on MCP
  • Use client name instead hand-crafted
  • Add missing required args on server tool declaration
  • Add missing import for custom mutator

Fix #2594

Copilot AI review requested due to automatic review settings December 1, 2025 09:44
Copy link
Contributor

Copilot AI left a 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;`);
Copy link

Copilot AI Dec 1, 2025

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.

Copilot uses AI. Check for mistakes.
if (verbOptions.body.definition) fetchParams.push(`args.bodyParams`);
if (verbOptions.queryParams) fetchParams.push(`args.queryParams`);

fetchParams.push(`args.options`);
Copy link

Copilot AI Dec 1, 2025

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.

Copilot uses AI. Check for mistakes.
@Totorro35 Totorro35 closed this Dec 1, 2025
@Totorro35 Totorro35 deleted the feat/mcp-options branch December 1, 2025 09:52
@Totorro35 Totorro35 restored the feat/mcp-options branch December 1, 2025 13:28
@Totorro35 Totorro35 reopened this Dec 1, 2025
@melloware melloware added the mcp label Dec 1, 2025
@melloware melloware requested a review from soartec-lab December 1, 2025 14:12
@melloware melloware added this to the 8.0.0 milestone Dec 1, 2025
Copy link
Member

@soartec-lab soartec-lab left a comment

Choose a reason for hiding this comment

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

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants