The golf command-line interface is your primary tool for managing GolfMCP projects.

Commands

golf init

Initializes a new GolfMCP project directory.
golf init my_awesome_server
project_name
string
required
The name of the project and the directory to be created.
--output-dir
string
Specifies a different directory to create the project in. Defaults to a new directory named project_name in the current location.Alias: -o
--template
string
Use a specific project template.Available templates:
  • default - Standard GolfMCP project with example components
  • api_key - Project pre-configured with API key authentication

golf build

Builds your GolfMCP project into a runnable MCP server.
golf build dev
env
string
required
The build environment. Must be either dev or prod.
  • dev: Creates a development build. Copies the .env file from your project root to the output directory (dist/) so the server can access environment variables during local development.
  • prod: Creates a production build. Environment variables are expected to be set in the production environment itself, so .env is not copied.

golf run

Runs a previously built GolfMCP server.
golf run
Make sure to run golf build before using golf run. The command executes the server from the dist/ directory.