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
- Create
.mcp.json with an HTTP-type server configuration (see MCP Configuration below)
- Create a test script that uses an MCP wrapper function
- Run command:
npx tsx .mcp-wrappers/.runtime-executor.ts my-http-server ./script.ts
- See error:
TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefined
Expected behavior
The executor should:
- Auto-detect server type (
stdio vs http) from the configuration
- Make HTTP requests to HTTP-type servers with appropriate headers
- 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:
-
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
-
Add explicit error message: If HTTP isn't implemented, fail with clear error: "HTTP-type servers are not currently supported. Use stdio-type servers."
-
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).
Describe the bug
The
.runtime-executor.tsonly 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
.mcp.jsonwith an HTTP-type server configuration (see MCP Configuration below)npx tsx .mcp-wrappers/.runtime-executor.ts my-http-server ./script.tsTypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received undefinedExpected behavior
The executor should:
stdiovshttp) from the configurationActual behavior
The executor attempts to spawn a subprocess for HTTP-type servers, resulting in:
Environment
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:HTTP-type servers don't have a
commandfield, causingspawn()to receiveundefinedas the file argument.Suggested Fix:
Implement HTTP client support: Add HTTP client to
MCPClientclass that auto-detects server type:stdio: spawn subprocess (current behavior)http: make POST requests to configured URL with JSON-RPC payload and headersAdd explicit error message: If HTTP isn't implemented, fail with clear error: "HTTP-type servers are not currently supported. Use stdio-type servers."
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).