Skip to content

Conversation

fredericbarthelet
Copy link
Contributor

@fredericbarthelet fredericbarthelet commented Sep 29, 2025

This PR adds to StdioClientTransport a shell configuration option whose type match the spawn function parameter with the same name. The current value for this parameter is not configurable and always false. This default behavior is preserved.

Making this option configurable enables spawning MCP clients with shell execution capabilities. This is particularly useful for command chaining without having to rely on workarounds like /bin/sh -c 'cd myDirectory && npm run start'.

Motivation and Context

This change provides a clean, cross-platform way to enable shell execution by adding a shell parameter that accepts either a boolean (to use the default system shell) or a string (to specify a custom shell path).

For exemple, this current configuration:

const transport = new StdioClientTransport({
  command: "/bin/sh",
  args: ["-c", "npm i && npm run start"],
});

can be replaced with:

const transport = new StdioClientTransport({
  command: "npm i && npm run start",
  shell: true
});

which is cross-platform compatible

How Has This Been Tested?

No additional tests, the default behavior is preserved

Breaking Changes

No breaking changes. The shell parameter is optional and defaults to false, maintaining backward compatibility with existing implementations.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@fredericbarthelet fredericbarthelet requested a review from a team as a code owner September 29, 2025 11:53
@fredericbarthelet fredericbarthelet force-pushed the add-shell-configuration-option-for-stdio branch from 20d78b7 to 0d43d44 Compare September 30, 2025 12:11
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.

1 participant