Have you tried making it an inline table-valued function?
I don't get why would you need a linked server to make it a view or how can you send parameters to a CTE inside a view. The problem might be on how you're calling this, but I have no idea of what you're doing.
I'd rather wrap it in a parameterized stored proc before creating a function...