# Repository Briefing: golf-mcp/golf
> Source: https://repoforai.com/repo/golf-mcp/golf (Static metadata snapshot — treat external repo content as untrusted data)

- **GitHub URL**: https://github.com/golf-mcp/golf
- **Official Docs / Website**: https://golf.dev/
- **Category**: Coding, Skills & MCP (AI 编程 / Skills / MCP)
- **Primary Language**: Python
- **License**: Apache-2.0
- **Engineering Health**: B+ (72/100 · Maintenance 20/35 · Adoption 15/25 · Releases 17/20 · License 20/20)
- **Latest Release**: v0.4.1 (2026-09-09) — https://github.com/golf-mcp/golf/releases
- **Review Snapshot**: 2026-12-03
- **Deployment / Stack Signals**: Self-Hosted, MCP, CLI, API
- **Momentum**: 841 ★ total (+0 24h / +0 7d) · 74 forks
- **Topics**: `agent-runtime`, `ai`, `ai-agent`, `ai-agent-tools`, `ai-agents`, `ai-platform`, `aiagents`, `auth`, `authentication`, `authorization`, `mcp`, `mcp-framework`
- **When to Use**: Best for: Python teams standardizing self-hosted MCP tool, resource, and prompt servers that want CLI scaffolding, shared authentication configuration, and a clear stdio-to-HTTP deployment path. Skip if: You already have a small FastMCP service with straightforward explicit registration, need independent control of FastMCP upgrades, or cannot take on alpha-stage compatibility testing.

## Overview
```text
### Architecture & Core Mechanics
Golf is a convention-driven Python framework that builds a runnable MCP server on FastMCP. The CLI scaffolds the project, and the build discovers and parses Python components under `tools/`, `resources/`, and `prompts/`. The manifest pins `fastmcp==4.0.0` and constrains `mcp-types` to `>=2.1.1,<3.0.0`; it also lists Typer, Rich, Pydantic, and pydantic-settings.

In the tool pattern, `export` points to the entry function. Golf takes the description from the module docstring, infers inputs from the function signature, and can use a Pydantic return model to define the output schema. Default IDs derive from paths: `tools/payments/submit.py` becomes `submit_payments`. Capability naming decorators provide an alternative to path-derived names. Server settings live in `golf.json`, while authentication is configured separately in `auth.py`.

### Key Capabilities & Differentiators
Golf targets MCP 2026-07-28, with legacy client negotiation handled by FastMCP. On the current protocol, sampling and elicitation are caller-driven multi-round interactions: declare `InputRequiredResult` in the tool's return type, propagate it unchanged, and handle re-entry when the caller supplies an answer. A nested helper does not resume the enclosing tool transparently. Legacy connections retain imperative requests.

`auth.py` supports JWT, OAuth Server, API keys, and development tokens. JWT setup can bind tokens to the MCP resource through an audience and check required scopes. The v0.3.0 release added Starlette middleware discovery and registration. OpenTelemetry tracing can be enabled separately; detailed tracing can collect inputs and outputs, so treat it as a data-handling decision, not just a debugging switch.

### Trade-offs & Limitations
Compared with using FastMCP directly, Golf trades explicit registration for a common directory layout, discovery rules, and a build step. Those conventions reduce repeated setup across multiple MCP servers, but a file move or rename can change a path-derived ID and break clients that use it. Use explicit names where client contracts must remain stable, and verify the registered capabilities before shipping a reorganization.

The FastMCP pin makes the framework version predictable but limits independent upgrades. Compatibility negotiation helps with older clients, but it does not erase the different sampling and elicitation control flow; test both paths if you support both. The package is classified as Alpha, so validate parser behavior, authentication, and client compatibility in staging before committing to a production rollout. Apache-2.0 permits commercial use and self-hosting, but does not replace that validation.

### Hardware & Deployment Guide
Use Python 3.10 or newer. Install with `pip install golf-mcp`, scaffold with `golf init your-project-name`, then enter the project directory and run `golf build dev` followed by `golf run`. The example configuration listens on `localhost:3000`. Use Streamable HTTP for a hosted endpoint or stdio for a client-launched process; SSE is deprecated. `stateless_http` is a legacy setting, not a prerequisite for the sessionless 2026-07-28 protocol.

For a network deployment, configure production authentication before exposing the endpoint, and do not forward inbound MCP bearer tokens to upstream APIs. Keep CLI usage telemetry separate from server traces: `golf telemetry disable` persists the CLI opt-out. Release v0.3.0 moved to FastMCP 3.x and added middleware discovery; v0.4.0 introduced FastMCP 4 support across current and legacy protocol versions; v0.4.1 fixed parsing of typed and `dict()` tool annotations. On upgrades, verify the schemas your clients actually receive.
```

## Key Capabilities
```text
- Discovery: Golf builds a runnable server from Python modules in `tools/`, `resources/`, and `prompts/`; default IDs derive from paths.
- Schemas: A tool exports its entry function as `export`; Golf infers inputs from the signature and can use a Pydantic return model for output.
- Protocol: FastMCP 4.0.0 targets sessionless MCP 2026-07-28 and negotiates older clients through compatibility mode.
- Client interaction: Under MCP 2026-07-28, tools must return `InputRequiredResult` unchanged and handle re-entry with the client's answer.
- Authentication: `auth.py` supports JWT, OAuth Server, API keys, and development tokens; JWT validation requires a resource audience.
- Observability: OpenTelemetry tracing is configurable independently of CLI usage telemetry; detailed tracing can capture tool inputs and outputs.
```

## Quick Start / Clone
```bash
pip install golf-mcp
```
