Control nodes can help doing this.
A Control is a rectangular node and has a clip_content property, which will achieve the effect you want within its rectangle. Control — Godot Engine (3.1) documentation in English
Then everything drawn from it or child of it will be clipped. This is used originally to make scroll areas, but other uses like yours could work too.
If you want to do it from code, another way is with custom drawing in _draw, calling VisualServer: