Skip to content

Commit b4ae839

Browse files
committed
docs: update README to include OAuth Server support in authentication configuration and clarify breaking changes in v0.2.0
1 parent 116c9fc commit b4ae839

File tree

1 file changed

+23
-7
lines changed

1 file changed

+23
-7
lines changed

README.md

Lines changed: 23 additions & 7 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 v0.2.0, you get **enterprise-grade authentication** (JWT, 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.
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,11 +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, API key, dev tokens)
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) for JWT, API key, or development authentication.
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.
9393
- **`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.
9494
- 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).
9595
- **`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.
@@ -132,10 +132,26 @@ Golf includes enterprise-grade authentication, built-in utilities, and automatic
132132

133133
```python
134134
# auth.py - Configure authentication
135-
from golf.auth import configure_api_key, configure_jwt_auth, configure_dev_auth
136-
137-
# API Key (pass-through to external APIs)
138-
configure_api_key(header_name="Authorization", header_prefix="Bearer ")
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+
# ))
139155

140156
# Built-in utilities available in all tools
141157
from golf.utils import elicit, sample, get_context

0 commit comments

Comments
 (0)