Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const (
McpServerInitReqTimeoutSecEnvVar = "MCP_SERVER_INIT_REQ_TIMEOUT_SEC"

// McpServerInitRequestTimeoutSecondsDefault is the default timeout in seconds for MCP server initialization requests.
McpServerInitRequestTimeoutSecondsDefault = 10
McpServerInitRequestTimeoutSecondsDefault = 30

// SessionIdleTimeoutSecEnvVar is the environment variable for configuring the idle timeout for stateful sessions.
SessionIdleTimeoutSecEnvVar = "SESSION_IDLE_TIMEOUT_SEC"
Expand All @@ -79,7 +79,7 @@ var startServerCmd = &cobra.Command{
"For Postgres, you can also set individual connection details using the following environment variables:\n" +
"POSTGRES_HOST, POSTGRES_PORT (default 5432), POSTGRES_USER (default postgres), POSTGRES_PASSWORD, POSTGRES_DB (default postgres)\n\n" +
"You can also configure the amount of time (in seconds) mcpjungle will wait for a new MCP server's initialization before aborting it.\n" +
"Set the MCP_SERVER_INIT_REQ_TIMEOUT_SEC environment variable to an integer (default is 10).\n" +
"Set the MCP_SERVER_INIT_REQ_TIMEOUT_SEC environment variable to an integer (default is 30).\n" +
"This is useful when you register a MCP server (usually stdio, like filesystem) that may take some time to start up.\n\n" +
"Finally, you can also configure the idle timeout (in seconds) for stateful sessions.\n" +
"Set the SESSION_IDLE_TIMEOUT_SEC environment variable to an integer (default is -1, meaning no timeout).\n" +
Expand Down
4 changes: 3 additions & 1 deletion internal/service/mcp/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,9 @@ func runStdioServer(ctx context.Context, s *model.McpServer, initReqTimeoutSec i
if errors.Is(err, context.DeadlineExceeded) {
return nil, fmt.Errorf(
"initialization request to MCP server timed out after %d seconds,"+
" check mcpungle server logs for any errors from this MCP server",
" check mcpungle server logs for any errors from this MCP server"+
" update the MCP_SERVER_INIT_REQ_TIMEOUT_SEC env var to change the timeout,"+
" default is 30 seconds",
Copy link
Member

@duaraghav8 duaraghav8 Jan 14, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than hard-coding the value of 30 here, we should read it from the constant declared so that it acts as the source of truth.
I recommend that you move the McpServerInitRequestTimeoutSecondsDefault = 30 const declaration inside pkg/types/mcp_server.go file. This package contains all definitions that are shared between the CLI & server.

initReqTimeoutSec,
)
}
Expand Down