Skip to content

Commit c8d3344

Browse files
authored
Merge pull request #97 from golf-mcp/asch/pre-release-prep
docs: update README to reflect new features in Golf v0.2.0, including…
2 parents 4fa9ebd + b4ae839 commit c8d3344

File tree

1 file changed

+46
-100
lines changed

1 file changed

+46
-100
lines changed

README.md

Lines changed: 46 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030

3131
Golf is a **framework** designed to streamline the creation of MCP server applications. It allows developers to define server's capabilities—*tools*, *prompts*, and *resources*—as simple Python files within a conventional directory structure. Golf then automatically discovers, parses, and compiles these components into a runnable FastMCP server, minimizing boilerplate and accelerating development.
3232

33-
With Golf, you can focus on implementing your agent's logic rather than wrestling with server setup and integration complexities. It's built for developers who want a quick, organized way to build powerful MCP servers.
33+
With Golf v0.2.0, you get **enterprise-grade authentication** (JWT, OAuth Server, API key, development tokens), **built-in utilities** for LLM interactions, and **automatic telemetry** integration. Focus on implementing your agent's logic while Golf handles authentication, monitoring, and server infrastructure.
3434

3535
## Quick Start
3636

@@ -85,10 +85,11 @@ A Golf project initialized with `golf init` will have a structure similar to thi
8585
│ └─ welcome.py # Example prompt
8686
8787
├─ .env # Environment variables (e.g., API keys, server port)
88-
└─ auth.py # Authentication configuration (JWT, OAuth, API keys)
88+
└─ auth.py # Authentication configuration (JWT, OAuth Server, API key, dev tokens)
8989
```
9090

9191
- **`golf.json`**: Configures server name, port, transport, telemetry, and other build settings.
92+
- **`auth.py`**: Dedicated authentication configuration file (new in v0.2.0, breaking change from v0.1.x authentication API) for JWT, OAuth Server, API key, or development authentication.
9293
- **`tools/`**, **`resources/`**, **`prompts/`**: Contain your Python files, each defining a single component. These directories can also contain nested subdirectories to further organize your components (e.g., `tools/payments/charge.py`). The module docstring of each file serves as the component's description.
9394
- Component IDs are automatically derived from their file path. For example, `tools/hello.py` becomes `hello`, and a nested file like `tools/payments/submit.py` would become `submit_payments` (filename, followed by reversed parent directories under the main category, joined by underscores).
9495
- **`common.py`** (not shown, but can be placed in subdirectories like `tools/payments/common.py`): Used to share code (clients, models, etc.) among components in the same subdirectory.
@@ -125,118 +126,63 @@ export = hello
125126
```
126127
Golf will automatically discover this file. The module docstring `"""Hello World tool {{project_name}}."""` is used as the tool's description. It infers parameters from the `hello` function's signature and uses the `Output` Pydantic model for the output schema. The tool will be registered with the ID `hello`.
127128

128-
## Configuration (`golf.json`)
129+
## Authentication & Features
129130

130-
The `golf.json` file is the heart of your Golf project configuration. Here's what each field controls:
131+
Golf includes enterprise-grade authentication, built-in utilities, and automatic telemetry:
131132

132-
```jsonc
133-
{
134-
"name": "{{project_name}}", // Your MCP server name (required)
135-
"description": "A Golf project", // Brief description of your server's purpose
136-
"host": "localhost", // Server host - use "0.0.0.0" to listen on all interfaces
137-
"port": 3000, // Server port - any available port number
138-
"transport": "sse", // Communication protocol:
139-
// - "sse": Server-Sent Events (recommended for web clients)
140-
// - "streamable-http": HTTP with streaming support
141-
// - "stdio": Standard I/O (for CLI integration)
142-
143-
// HTTP Transport Configuration (optional)
144-
"stateless_http": false, // Make streamable-http transport stateless (new session per request)
145-
// When true, server restarts won't break existing client connections
146-
147-
// Health Check Configuration (optional)
148-
"health_check_enabled": false, // Enable health check endpoint for Kubernetes/load balancers
149-
"health_check_path": "/health", // HTTP path for health check endpoint
150-
"health_check_response": "OK", // Response text returned by health check
151-
152-
// OpenTelemetry Configuration (optional)
153-
"opentelemetry_enabled": false, // Enable distributed tracing
154-
"opentelemetry_default_exporter": "console" // Default exporter if OTEL_TRACES_EXPORTER not set
155-
// Options: "console", "otlp_http"
156-
}
157-
```
158-
159-
### Key Configuration Options:
160-
161-
- **`name`**: The identifier for your MCP server. This will be shown to clients connecting to your server.
162-
- **`transport`**: Choose based on your client needs:
163-
- `"sse"` is ideal for web-based clients and real-time communication
164-
- `"streamable-http"` provides HTTP streaming for traditional API clients
165-
- `"stdio"` enables integration with command-line tools and scripts
166-
- **`host` & `port`**: Control where your server listens. Use `"localhost"` for local development or `"0.0.0.0"` to accept external connections.
167-
- **`stateless_http`**: When true, makes the streamable-http transport stateless by creating a new session for each request. This ensures that server restarts don't break existing client connections, making the server truly stateless.
168-
- **`health_check_enabled`**: When true, enables a health check endpoint for Kubernetes readiness/liveness probes and load balancers
169-
- **`health_check_path`**: Customizable path for the health check endpoint (defaults to "/health")
170-
- **`health_check_response`**: Customizable response text for successful health checks (defaults to "OK")
171-
- **`opentelemetry_enabled`**: When true, enables distributed tracing for debugging and monitoring your MCP server
172-
- **`opentelemetry_default_exporter`**: Sets the default trace exporter. Can be overridden by the `OTEL_TRACES_EXPORTER` environment variable
173-
174-
## Features
175-
176-
### 🏥 Health Check Support
177-
178-
Golf includes built-in health check endpoint support for production deployments. When enabled, it automatically adds a custom HTTP route that can be used by:
179-
- Kubernetes readiness and liveness probes
180-
- Load balancers and reverse proxies
181-
- Monitoring systems
182-
- Container orchestration platforms
183-
184-
#### Configuration
185-
186-
Enable health checks in your `golf.json`:
187-
```json
188-
{
189-
"health_check_enabled": true,
190-
"health_check_path": "/health",
191-
"health_check_response": "Service is healthy"
192-
}
133+
```python
134+
# auth.py - Configure authentication
135+
from golf.auth import configure_auth, JWTAuthConfig, StaticTokenConfig, OAuthServerConfig
136+
137+
# JWT authentication (production)
138+
configure_auth(JWTAuthConfig(
139+
jwks_uri_env_var="JWKS_URI",
140+
issuer_env_var="JWT_ISSUER",
141+
audience_env_var="JWT_AUDIENCE",
142+
required_scopes=["read", "write"]
143+
))
144+
145+
# OAuth Server mode (Golf acts as OAuth 2.0 server)
146+
# configure_auth(OAuthServerConfig(
147+
# base_url="https://your-golf-server.com",
148+
# valid_scopes=["read", "write", "admin"]
149+
# ))
150+
151+
# Static tokens (development only)
152+
# configure_auth(StaticTokenConfig(
153+
# tokens={"dev-token": {"client_id": "dev", "scopes": ["read"]}}
154+
# ))
155+
156+
# Built-in utilities available in all tools
157+
from golf.utils import elicit, sample, get_context
193158
```
194159

195-
The generated server will include a route like:
196-
```python
197-
@mcp.custom_route('/health', methods=["GET"])
198-
async def health_check(request: Request) -> PlainTextResponse:
199-
"""Health check endpoint for Kubernetes and load balancers."""
200-
return PlainTextResponse("Service is healthy")
160+
```bash
161+
# Automatic telemetry with Golf Platform
162+
export GOLF_API_KEY="your-key"
163+
golf run # ✅ Telemetry enabled automatically
201164
```
202165

203-
### 🔍 OpenTelemetry Support
166+
**[📚 Complete Documentation →](https://docs.golf.dev)**
204167

205-
Golf includes built-in OpenTelemetry instrumentation for distributed tracing. When enabled, it automatically traces:
206-
- Tool executions with arguments and results
207-
- Resource reads and template expansions
208-
- Prompt generations
209-
- HTTP requests and sessions
168+
## Configuration
210169

211-
#### Configuration
170+
Basic configuration in `golf.json`:
212171

213-
Enable OpenTelemetry in your `golf.json`:
214172
```json
215173
{
216-
"opentelemetry_enabled": true,
217-
"opentelemetry_default_exporter": "otlp_http"
174+
"name": "My Golf Server",
175+
"host": "localhost",
176+
"port": 3000,
177+
"transport": "sse",
178+
"opentelemetry_enabled": false,
179+
"detailed_tracing": false
218180
}
219181
```
220182

221-
Then configure via environment variables:
222-
```bash
223-
# For OTLP HTTP exporter (e.g., Jaeger, Grafana Tempo)
224-
OTEL_TRACES_EXPORTER=otlp_http
225-
OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:4318/v1/traces
226-
OTEL_SERVICE_NAME=my-golf-server # Optional, defaults to project name
227-
228-
# For console exporter (debugging)
229-
OTEL_TRACES_EXPORTER=console
230-
```
231-
232-
**Note**: When using the OTLP HTTP exporter, you must set `OTEL_EXPORTER_OTLP_ENDPOINT`. If not configured, Golf will display a warning and disable tracing to avoid errors.
233-
234-
## Roadmap
235-
236-
Here are the things we are working hard on:
237-
238-
* **`golf deploy` command for one click deployments to Vercel, Blaxel and other providers**
239-
* **Production-ready OAuth token management, to allow for persistent, encrypted token storage and client mapping**
183+
- **`transport`**: Choose `"sse"`, `"streamable-http"`, or `"stdio"`
184+
- **`opentelemetry_enabled`**: Auto-enabled with `GOLF_API_KEY`
185+
- **`detailed_tracing`**: Capture input/output (use carefully with sensitive data)
240186

241187

242188
## Privacy & Telemetry

0 commit comments

Comments
 (0)