Core concepts
Project structure
Understand GolfMCP project layout and component naming conventions.
GolfMCP uses a convention-based project structure.
golf.json
: The main configuration file (see Configuration)..env
: Stores environment variables. Loaded by the built server.pre_build.py
: Optional script for pre-build tasks, like auth setup.tools/
: Contains Python files defining your server’s tools (callable functions).resources/
: Contains Python files defining data resources the LLM can read.prompts/
: Contains Python files defining reusable prompt templates.
Component discovery
- Each
.py
file withintools/
,resources/
, orprompts/
(and their subdirectories) is treated as a single component. - Files named
__init__.py
are ignored for direct component definition but are essential for Python’s packaging if you structure your components as modules. - Files named
common.py
are special and used for shared code (seecommon.py
section).
Component ID derivation
The unique ID for each component (used for registration in FastMCP) is derived from its file path relative to the category directory (tools
, resources
, prompts
).
Examples:
tools/hello.py
-> ID:hello
tools/payments/transaction/submit.py
-> ID:submit-transaction-payments
resources/weather/current.py
-> ID:current-weather
ID collisions will result in a build-time error.