Describe the bug
The mcp-code-wrapper has a hardcoded 30-second timeout that causes connections to some HTTP-based MCP servers to fail during tool extraction. When the server takes longer than 30 seconds to respond, the connection times out with Error: Request timeout, preventing successful MCP server integration.
Steps to reproduce
- Create
.mcp.json with an HTTP-based MCP server configuration (see MCP Configuration below)
- Run command:
bunx mcp-code-wrapper .
- Select the affected MCP servers from the list
- Observe error during tool extraction:
Error: Request timeout
Expected behavior
The wrapper should:
- Support longer timeouts for slower MCP servers
- Provide a configurable timeout option via CLI flags
- Have a more reasonable default timeout (e.g., 120 seconds)
Actual behavior
The connection fails after exactly 30 seconds with:
Error: Request timeout
at Timeout._onTimeout (file:///tmp/bunx-1000-mcp-code-wrapper@latest/node_modules/mcp-code-wrapper/dist/executor.js:110:28)
Environment
- OS: Linux (Fedora 43)
- Node version: 25.5.0
- Package version: mcp-code-wrapper@0.1.0-beta.38
MCP Configuration
{
"mcpServers": {
"web-search-prime": {
"type": "stdio",
"command": "bunx",
"args": [
"@z_ai/mcp-server",
"--server",
"https://api.z.ai/api/mcp/web_search_prime/mcp"
],
"env": {
"Z_AI_API_KEY": "${ZAI_API_KEY}",
"Z_AI_MODE": "ZAI"
}
}
}
}
Additional context
Root Cause:
In three files, the timeout is hardcoded to 30000ms (30 seconds):
executor.js (line 142-112):
// Timeout after 30s
setTimeout(() => {
if (this.pendingRequests.has(id)) {
this.pendingRequests.delete(id);
reject(new Error('Request timeout'));
}
}, 30000);
runtime-executor.js (line 107-85):
setTimeout(() => {
if (this.pendingRequests.has(id)) {
this.pendingRequests.delete(id);
reject(new Error(`Request timeout: ${method}`));
}
}, 30000);
generator.js (line 116-121):
setTimeout(() => {
if (this.pendingRequests.has(id)) {
this.pendingRequests.delete(id);
reject(new Error(`Request timeout: ${method}`));
}
}, 30000);
Suggested Fix:
- Make timeout configurable: Add CLI flag
--timeout <ms> to allow users to specify custom timeout values
- Increase default timeout: Change default from 30s to 120s for better compatibility with slower servers
- Add timeout constants: Define timeout in one place and reuse across files to avoid inconsistency
Workaround:
Manually patch the three files in /tmp/bunx-1000-mcp-code-wrapper@latest/node_modules/mcp-code-wrapper/dist/ to increase timeout from 30000ms to 120000ms (120 seconds):
sed -i 's/}, 30000);/}, 120000);/g' \
/tmp/bunx-1000-mcp-code-wrapper@latest/node_modules/mcp-code-wrapper/dist/executor.js \
/tmp/bunx-1000-mcp-code-wrapper@latest/node_modules/mcp-code-wrapper/dist/runtime-executor.js \
/tmp/bunx-1000-mcp-code-wrapper@latest/node_modules/mcp-code-wrapper/dist/generator.js
Note:
The @z_ai/mcp-server --server <url> flag internally handles HTTP-to-stdio conversion, so no external bridging tool is required. Refer to #1 for details regarding refusal to run using http transfer protocol.
Describe the bug
The mcp-code-wrapper has a hardcoded 30-second timeout that causes connections to some HTTP-based MCP servers to fail during tool extraction. When the server takes longer than 30 seconds to respond, the connection times out with
Error: Request timeout, preventing successful MCP server integration.Steps to reproduce
.mcp.jsonwith an HTTP-based MCP server configuration (see MCP Configuration below)bunx mcp-code-wrapper .Error: Request timeoutExpected behavior
The wrapper should:
Actual behavior
The connection fails after exactly 30 seconds with:
Environment
MCP Configuration
{ "mcpServers": { "web-search-prime": { "type": "stdio", "command": "bunx", "args": [ "@z_ai/mcp-server", "--server", "https://api.z.ai/api/mcp/web_search_prime/mcp" ], "env": { "Z_AI_API_KEY": "${ZAI_API_KEY}", "Z_AI_MODE": "ZAI" } } } }Additional context
Root Cause:
In three files, the timeout is hardcoded to 30000ms (30 seconds):
executor.js (line 142-112):
runtime-executor.js (line 107-85):
generator.js (line 116-121):
Suggested Fix:
--timeout <ms>to allow users to specify custom timeout valuesWorkaround:
Manually patch the three files in
/tmp/bunx-1000-mcp-code-wrapper@latest/node_modules/mcp-code-wrapper/dist/to increase timeout from 30000ms to 120000ms (120 seconds):sed -i 's/}, 30000);/}, 120000);/g' \ /tmp/bunx-1000-mcp-code-wrapper@latest/node_modules/mcp-code-wrapper/dist/executor.js \ /tmp/bunx-1000-mcp-code-wrapper@latest/node_modules/mcp-code-wrapper/dist/runtime-executor.js \ /tmp/bunx-1000-mcp-code-wrapper@latest/node_modules/mcp-code-wrapper/dist/generator.jsNote:
The
@z_ai/mcp-server --server <url>flag internally handles HTTP-to-stdio conversion, so no external bridging tool is required. Refer to #1 for details regarding refusal to run using http transfer protocol.