The golf.json file is the main configuration file for your Golf project. Place this file in your project root directory to configure your MCP server.

name
string
required

The name of your MCP server instance.

{
  "name": "MyProject"
}
description
string

A brief description of your Golf project.

{
  "description": "A GolfMCP project"
}
host
string
default:"127.0.0.1"

The network interface the server will bind to.

{
  "host": "127.0.0.1"
}
port
integer
default:"3000"

The port number the server will listen on.

{
  "port": 3000
}
transport
string
default:"sse"

The transport protocol for client-server communication.

Options:

  • "sse" - Server-Sent Events
  • "streamable-http" - HTTP with streaming support
  • "stdio" - Standard input/output
{
  "transport": "sse"
}
opentelemetry_enabled
boolean
default:"false"

Enable OpenTelemetry distributed tracing for your MCP server.

{
  "opentelemetry_enabled": true
}
opentelemetry_default_exporter
string
default:"otlp_http"

The default exporter to use for OpenTelemetry traces when enabled.

Options:

  • "otlp_http" - OTLP HTTP exporter (for Jaeger, Grafana Tempo, etc.)
  • "console" - Console exporter (for debugging)
{
  "opentelemetry_default_exporter": "otlp_http"
}

When using otlp_http, you must set the OTEL_EXPORTER_OTLP_ENDPOINT environment variable. See the environment variables section below.

Example configuration

{
  "name": "{{project_name}}",
  "description": "A GolfMCP project",
  "host": "127.0.0.1",
  "port": 3000,
  "transport": "sse",
  "opentelemetry_enabled": true,
  "opentelemetry_default_exporter": "otlp_http"
}

Environment variables for OpenTelemetry

When OpenTelemetry is enabled, configure these environment variables in your .env file:

Required for OTLP HTTP exporter

OTEL_EXPORTER_OTLP_ENDPOINT
string
required

The endpoint URL for your OpenTelemetry collector.

Example: http://localhost:4318/v1/traces

Optional

OTEL_SERVICE_NAME
string

The service name for traces. Defaults to the name from golf.json.

OTEL_EXPORTER_OTLP_HEADERS
string

Additional headers for the OTLP exporter.

Example: Authorization=Bearer your-token

OTEL_TRACES_EXPORTER
string

Override the exporter type.

Example: console for debugging

Example .env file

# OpenTelemetry configuration
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318/v1/traces
OTEL_SERVICE_NAME=my-mcp-server
# OTEL_EXPORTER_OTLP_HEADERS=Authorization=Bearer your-cloud-provider-token

The {{project_name}} placeholder will be replaced with your actual project name when you run golf init.