This documentation describes how you can connect to your MindsDB server from Python code.

Here is how to connect to your local MindsDB server:

import mindsdb_sdk

# connects to the default port (47334) on localhost 
server = mindsdb_sdk.connect()

# connects to the specified host and port
server = mindsdb_sdk.connect('http://127.0.0.1:47334')