diff --git a/cmd/start.go b/cmd/start.go index 09d8c619a..d291c96af 100644 --- a/cmd/start.go +++ b/cmd/start.go @@ -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" @@ -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" + diff --git a/internal/service/mcp/util.go b/internal/service/mcp/util.go index 0573ba03e..c08d72ae3 100644 --- a/internal/service/mcp/util.go +++ b/internal/service/mcp/util.go @@ -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", initReqTimeoutSec, ) }