Skip to content

MCP: Piping non-nushell commands hangs forever (e.g., echo "hi" | cat) #17122

@andrewgazelka

Description

@andrewgazelka

Bug report form

  • I have done a basic search of the issue tracker to find any existing issues that are similar.
  • I have checked that my version is at least the latest stable release available via my installation method.

Describe the bug

When using nushell as an MCP server, piping non-nushell (external) commands hangs forever. For example:

echo "hi" | cat

This command never completes when run through the MCP interface.

I have fixed this before in a different context, and IIRC the issue is related to MCP using stdio for JSON-RPC communication. The external commands stdio gets mixed up with the MCP transport layer.

Possible solutions

I previously fixed this by using HTTP streaming for the RPC transport instead of stdio. However, there is probably a way to make stdio work—perhaps by using child process stdio redirection (pseudo-terminals / PTYs?) so the external commands stdio doesnt conflict with the MCP JSON-RPC stdio.

Stdio transport is really nice for integration with tools like Claude Code, so it would be great to find a solution that preserves stdio as a transport option.

How to reproduce

  1. Start nushell as an MCP server (nu --mcp)
  2. Use an MCP client (e.g., Claude Code) to run: echo "hi" | cat
  3. The command hangs indefinitely

Expected behavior

The command should complete and return hi.

Configuration

Running from main branch (commit 08d27ca7e).

Metadata

Metadata

Assignees

No one assigned

    Labels

    A:MCPModel Context Protocol (nu-mcp)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions