Server-filesystem Child Process Exits With Code=1 When Launched By Mcp-superassistant-proxy

by ADMIN 92 views

Description

The mcp-superassistant-proxy (version 0.0.6) fails to connect to @modelcontextprotocol/server-filesystem when it's configured as an stdio server. The child process for @modelcontextprotocol/server-filesystem exits with code=1 shortly after the proxy sends the initialize JSON-RPC message, leading to a connection timeout.

This issue occurs despite the following:

  1. @modelcontextprotocol/server-filesystem runs without immediately crashing when executed directly via npx in the terminal.
  2. A custom minimal Node.js stdio MCP server (see details below) connects and communicates successfully with mcp-superassistant-proxy, indicating the proxy's basic stdio child process management is functional.
  3. @modelcontextprotocol/server-filesystem reportedly works correctly with other MCP clients (e.g., Claude Desktop), suggesting an incompatibility or issue specific to its interaction with mcp-superassistant-proxy.

Environment

  • mcp-superassistant-proxy Version: 0.0.6
  • Server Package: @modelcontextprotocol/server-filesystem (latest version via npx -y)
  • Operating System: Windows 11
  • Node.js Version: v23.10.0

Configuration (mcptestconfig.json)

{
    "mcpServers": {
        "filesystem": {
            "command": "npx",
            "args": [
                "-y",
                "@modelcontextprotocol/server-filesystem",
                "C:/Users/theuser/Documents/Projects/show_start_menu_Copy"
            ]
        }
    }
}

(Note: The issue also occurred when using simple local paths like C:/mcptemp/dir1)

Observed Behavior (Proxy Log Output)

When running npx @srbhptl39/mcp-superassistant-proxy@latest --config "path/to/mcptestconfig.json":

[mcp-superassistant-proxy] Loading configuration from: C:\Users\theuser\Documents\u\mcptools\mcptestconfig.json
[mcp-superassistant-proxy] Resolved config path to: C:\Users\theuser\Documents\u\mcptools\mcptestconfig.json
[mcp-superassistant-proxy] Starting proxy server...
[mcp-superassistant-proxy]   - port: 3006
[mcp-superassistant-proxy]   - baseUrl: http://localhost:3006
[mcp-superassistant-proxy]   - ssePath: /sse
[mcp-superassistant-proxy]   - messagePath: /message
[mcp-superassistant-proxy]   - heartbeat interval: 30000ms
[mcp-superassistant-proxy]   - Connected servers: filesystem
{"method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"mcp-superassistant-proxy","version":"0.0.6"}},"jsonrpc":"2.0","id":0}
[mcp-superassistant-proxy] Child process "filesystem" exited: code=1, signal=null
{"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":0reason":"McpError: MCP error -32001: Request timed out"}}
[mcp-superassistant-proxy] Failed to connect to servers: filesystem
[mcp-superassistant-proxy]   - Failed to connect to stdio server "filesystem": MCP error -32001: Request timed out
[mcp-superassistant-proxy] No MCP servers could be connected. The proxy will start but will not be functional.
[mcp-superassistant-proxy] Connected to 0 of 1 servers
[mcp-superassistant-proxy] Proxy server listening on port 3006
...

Expected Behavior

The mcp-superassistant-proxy should successfully connect to the @modelcontextprotocol/server-filesystem and log Connected to 1 of 1 servers without the child process exiting prematurely.

Troubleshooting Steps Performed

Direct Execution of Filesystem Server

Running npx -y @modelcontextprotocol/server-filesystem "PATH1" "PATH2" directly in the terminal starts the server, and it outputs:

Secure MCP Filesystem Server running on stdio
Allowed directories: [ ... ]

It does not crash immediately, indicating the server package itself can start.

Simplified Paths

The issue persists even when the paths provided in mcptestconfig.json are changed to simple local directories (e.g., C:/mcptemp/dir1).

Custom Minimal Stdio MCP Server Test

A minimal Node.js script (test-stdio.js, see content below) acting as a compliant MCP server was configured in mcptestconfig.json:

  • Configuration:

// mcptestconfig.json using test-stdio.js "mcpServers" { "filesystem": { "command": "node", "args": ["C:/path/to/your/test-stdio.js"] } }


    This minimal server **connects successfully** to `mcp-superassistant-proxy`:

    *   **Log Output:**
        ```log
[mcp-superassistant-proxy] ...
{"method":"initialize","params":{"protocolVersion":"2025-03-26", ...},"jsonrpc":"2.0","id":0}
{"method":"notifications/initialized","jsonrpc":"2.0"}
[mcp-superassistant-proxy] Connected to 1 of 1 servers
[mcp-superassistant-proxy] Proxy server listening on port 3006
...
*   **Content of `test-stdio.js` (v3) used for successful test:**
    ```javascript

// test-stdio.js (Corrected Version 3) process.stderr.write("Minimal test-stdio.js server (v3) started.\n");

const initializeResponse = jsonrpc "2.0", id: 0, result: { protocolVersion: "2025-03-26", serverInfo: { name: "test-stdio-server", version: "1.0.0" , capabilities: {} } };

process.stderr.write("Minimal test-stdio.js (v3) preparing to send initialize response.\n"); process.stdout.write(JSON.stringify(initializeResponse) + '\n'); process.stderr.write("Minimal test-stdio.js (v3) sent initialize response.\n");

let incomingData = ''; process.stdin.on('data', (chunk) => incomingData += chunk; let newlineIndex; while ((newlineIndex = incomingData.indexOf('\n')) !== -1) { const messageString = incomingData.substring(0, newlineIndex); incomingData = incomingData.substring(newlineIndex + 1); if (messageString) { process.stderr.write(`test-stdio.js (v3) received raw ${messageString\n); try { const message = JSON.parse(messageString); process.stderr.write(test-stdio.js (v3) received parsed method: $message.method}, id ${message.id\n); if (message.id !== undefined && message.id !== null) { const genericResponse = { jsonrpc: "2.0", id: message.id, result: { status: "received", method: message.method || "notification" } }; process.stdout.write(JSON.stringify(genericResponse) + '\n'); process.stderr.write(test-stdio.js (v3) sent generic response for id $message.id}.\n); } } catch (e) { process.stderr.write(test-stdio.js (v3) error parsing JSON ${e.message on data: ${messageString}\n`); } } } });

process.stdin.on('end', () => { process.stderr.write("Minimal test-stdio.js (v3) stdin ended. Exiting.\n"); process.exit(0); });


    This confirms that the proxy's basic stdio child process management and MCP handshake mechanism are functional with a compliant server.

### Works with Other MCP Clients

The `@modelcontextprotocol/server-filesystem` works correctly with other MCP client applications (e.g., Claude Desktop).

## Conclusion/Hypothesis

The `code=1` exit of `@modelcontextprotocol/server-filesystem` appears to be specific to its interaction with `mcp-superassistant-proxy`. It's likely crashing after receiving the `initialize` message from the proxy, possibly due to:

*   An issue within `@modelcontextprotocol/server-filesystem` when processing the `initialize` parameters sent by this specific proxy (e.g., the `clientInfo` or empty `capabilities` object).
*   A subtle difference in how `mcp-superassistant-proxy` manages stdio or the child process environment on Windows that affects `@modelcontextprotocol/server-filesystem` negatively, but not simpler scripts.

Given that a minimal compliant MCP server works with the proxy, and `@modelcontextprotocol/server-filesystem` works with other clients, the incompatibility seems to lie in the specific handshake or environment setup between these two particular pieces of software.

## Steps to Reproduce

1.  **Install Node.js on Windows 11.**
2.  **Create the `mcptestconfig.json` file as specified above.** (Using example paths `C:/Users/theuser/Documents/Projects/show_start_menu_Copy` and `C:/Users/theuser/Documents/Projects/VoiceAssistant - Copy` or any other accessible directories).
3.  **Run<br/>
# server-filesystem child process exits with code=1 when launched by mcp-superassistant-proxy

## Q&A

### Q: What is the issue with `mcp-superassistant-proxy` and `@modelcontextprotocol/server-filesystem`?

A: The `mcp-superassistant-proxy` (version 0.0.6) fails to connect to `@modelcontextprotocol/server-filesystem` when it's configured as an stdio server. The child process for `@modelcontextprotocol/server-filesystem` exits with `code=1` shortly after the proxy sends the `initialize` JSON-RPC message, leading to a connection timeout.

### Q: What are the symptoms of this issue?

A: The proxy logs show the following error:
```log
[mcp-superassistant-proxy] Child process "filesystem" exited: code=1, signal=null
{"jsonrpc":"2.0","method":"notifications/cancelled","params":{"requestId":0,"reason":"McpError: MCP error -32001: Request timed out"}}
[mcp-superassistant-proxy] Failed to connect to servers: filesystem
[mcp-superassistant-proxy]   - Failed to connect to stdio server "filesystem": MCP error -32001: Request timed out

Q: What troubleshooting steps have been performed?

A: The following troubleshooting steps have been performed:

  1. Direct Execution of Filesystem Server: Running npx -y @modelcontextprotocol/server-filesystem "PATH1" "PATH2" directly in the terminal starts the server, and it outputs:

Secure MCP Filesystem Server running on stdio Allowed directories: [ ... ]

    It does not crash immediately, indicating the server package itself can start.
2.  **Simplified Paths:** The issue persists even when the paths provided in `mcptestconfig.json` are changed to simple local directories (e.g., `C:/mcptemp/dir1`).
3.  **Custom Minimal Stdio MCP Server Test:** A minimal Node.js script (`test-stdio.js`, see content below) acting as a compliant MCP server was configured in `mcptestconfig.json`:
    *   **Configuration:**
        ```json
// mcptestconfig.json using test-stdio.js
{
    "mcpServers": {
        "filesystem": {
            "command": "node",
            "args": ["C:/path/to/your/test-stdio.js"]
        }
    }
}
This minimal server **connects successfully** to `mcp-superassistant-proxy`:
*   **Log Output:**
    ```log

[mcp-superassistant-proxy] ... "method""initialize","params":{"protocolVersion":"2025-03-26", ...,"jsonrpc":"2.0","id":0} "method""notifications/initialized","jsonrpc":"2.0" [mcp-superassistant-proxy] Connected to 1 of 1 servers [mcp-superassistant-proxy] Proxy server listening on port 3006 ...

    *   **Content of `test-stdio.js` (v3) used for successful test:**
        ```javascript
// test-stdio.js (Corrected Version 3)
process.stderr.write("Minimal test-stdio.js server (v3) started.\n");

const initializeResponse = {
    jsonrpc: "2.0",
    id: 0,
    result: {
        protocolVersion: "2025-03-26",
        serverInfo: {
            name: "test-stdio-server",
            version: "1.0.0"
        },
        capabilities: {}
    }
};

process.stderr.write("Minimal test-stdio.js (v3) preparing to send initialize response.\n");
process.stdout.write(JSON.stringify(initializeResponse) + '\n');
process.stderr.write("Minimal test-stdio.js (v3) sent initialize response.\n");

let incomingData = '';
process.stdin.on('data', (chunk) => {
    incomingData += chunk;
    let newlineIndex;
    while ((newlineIndex = incomingData.indexOf('\n')) !== -1) {
        const messageString = incomingData.substring(0, newlineIndex);
        incomingData = incomingData.substring(newlineIndex + 1);
        if (messageString) {
            process.stderr.write(`test-stdio.js (v3) received raw: ${messageString}\n`);
            try {
                const message = JSON.parse(messageString);
                process.stderr.write(`test-stdio.js (v3) received parsed method: ${message.method}, id: ${message.id}\n`);
                if (message.id !== undefined && message.id !== null) {
                    const genericResponse = {
                        jsonrpc: "2.0",
                        id: message.id,
                        result: { status: "received", method: message.method || "notification" }
                    };
                    process.stdout.write(JSON.stringify(genericResponse) + '\n');
                    process.stderr.write(`test-stdio.js (v3) sent generic response for id ${message.id}.\n`);
                }
            } catch (e) {
                process.stderr.write(`test-stdio.js (v3) error parsing JSON: ${e.message} on data: ${messageString}\n`);
            }
        }
    }
});

process.stdin.on('end', () => {
    process.stderr.write("Minimal test-stdio.js (v3) stdin ended. Exiting.\n");
    process.exit(0);
});
This confirms that the proxy's basic stdio child process management and MCP handshake mechanism are functional with a compliant server.

Q: What is the expected behavior?

A: The mcp-superassistant-proxy should successfully connect to the @modelcontextprotocol/server-filesystem and log Connected to 1 of 1 servers without the child process exiting prematurely.

Q: What are the possible causes of this issue?

A: The possible causes of this issue are:

  • An issue within @modelcontextprotocol/server-filesystem when processing the initialize parameters sent by this specific proxy (e.g., the clientInfo or empty capabilities object).
  • A subtle difference in how mcp-superassistant-proxy manages stdio or the child process environment on Windows that affects @modelcontextprotocol/server-filesystem negatively, but not simpler scripts.

Q: How can this issue be reproduced?

A: To reproduce this issue, follow these steps:

  1. Install Node.js on Windows 11.
  2. Create the mcptestconfig.json file as specified above. (Using example paths C:/Users/theuser/Documents/Projects/show_start_menu_Copy and C:/Users/theuser/Documents/Projects/VoiceAssistant - Copy or any other accessible directories).
  3. Run npx @srbhptl39/mcp-superassistant-proxy@latest --config "path/to/mcptestconfig.json".