Customize the GolfMCP build process using the pre_build.py script.
pre_build.py
file located at the root of your project. This Python script is executed by GolfMCP before the main build process (parsing components, generating code) begins.
Purpose:
pre_build.py
within the context of your project directory.from golf.auth import ProviderConfig, configure_auth, configure_api_key
).golf build
runs, it will first execute this pre_build.py
. The configuration calls store the authentication settings. The build process then uses this stored configuration to:
server.py
with appropriate authentication middleware and handlers.dist/golf/auth/
directory.