Skip to content

[BUG] HTTP-type MCP servers not supported by runtime executor #1

@arisgrout

Description

@arisgrout

Describe the bug

The .runtime-executor.ts only supports stdio-type MCP servers and fails when configured with HTTP-type MCP servers. There is no apparent way to use HTTP-type servers even when attempting to pass flags like --allow-http.

Steps to reproduce

  1. Create .mcp.json with an HTTP-type server configuration (see MCP Configuration below)
  2. Create a test script that uses an MCP wrapper function
  3. Run command: npx tsx .mcp-wrappers/.runtime-executor.ts my-http-server ./script.ts
  4. See error: TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined

Expected behavior

The executor should:

  1. Auto-detect server type (stdio vs http) from the configuration
  2. Make HTTP requests to HTTP-type servers with appropriate headers
  3. Return tool results to the executing script

Actual behavior

The executor attempts to spawn a subprocess for HTTP-type servers, resulting in:

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined
    at normalizeSpawnArguments (node:child_process:568:3)
    at spawn (node:child_process:789:13)

Environment

  • OS: Linux (Fedora 43)
  • Node version: 25.5.0
  • Package version: mcp-code-wrapper

MCP Configuration

{
  "mcpServers": {
    "my-http-server": {
      "type": "http",
      "url": "https://api.example.com/mcp",
      "headers": {
        "Authorization": "Bearer ${API_KEY}"
      }
    }
  }
}

Additional context

Root Cause:

In loadServerConfig() (line 218-236), the code extracts:

return {
  command: serverConfig.command,  // undefined for http-type
  args: serverConfig.args || [],
  env: serverConfig.env || {}
};

HTTP-type servers don't have a command field, causing spawn() to receive undefined as the file argument.

Suggested Fix:

  1. Implement HTTP client support: Add HTTP client to MCPClient class that auto-detects server type:

    • For stdio: spawn subprocess (current behavior)
    • For http: make POST requests to configured URL with JSON-RPC payload and headers
  2. Add explicit error message: If HTTP isn't implemented, fail with clear error: "HTTP-type servers are not currently supported. Use stdio-type servers."

  3. Document limitation: Clearly state in docs that only stdio-type servers are supported until fixed

Workaround:

Use stdio-type servers that spawn a subprocess (e.g., npx @package/mcp-server).

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions