As you've discovered, SmartDashboard has two methods for showing MJPG streams. "Add MJPG Server" requires you to enter the URL manually (e.g.
http://roborio-XX-frc.local:1181/stream.mjpg, or :5800 based on your current code). "Add CameraServer" is smarter--it uses NetworkTables to enumerate the available cameras, as well as get the correct URL to get the selected camera's stream. The latter requires the use of the WPILib CameraServer class rather than using the cscore classes directly (as the CameraServer class is what publishes the camera information to NetworkTables).
I would recommend using the CameraServer approach unless you have a strong reason to do something different, because it is much more robust in our dynamic networking environment--it will round-robin between multiple IP address options as well as get the robot IP from the DS (only if running on the same computer).
__________________
Author of
cscore - WPILib CameraServer for 2017+
Author of
ntcore - WPILib NetworkTables for 2016+
Creator of
RobotPy - Python for FRC
2010 FRC World Champions (
294, 67, 177)
2007 FTC World Champions (30, 74,
23)
2001 FRC National Champions (71,
294, 125, 365, 279)