golf-mcp/golf
A convention-driven Python framework that turns modules into MCP servers
Automated SPDX check for reference only — not legal advice. Disclaimer
GitHub Star History
Full-history star trajectory from GitHub official history. Switch ranges or hover any point for exact counts.
Evidence-Backed Technical Brief
AI Deep ReviewArchitecture & 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.
tools/, resources/, and prompts/; default IDs derive from paths.export; Golf infers inputs from the signature and can use a Pydantic return model for output.InputRequiredResult unchanged and handle re-entry with the client's answer.auth.py supports JWT, OAuth Server, API keys, and development tokens; JWT validation requires a resource audience.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.
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.
Quick Start & Installation
pip install golf-mcpComparison vs. Top Coding, Skills & MCP Alternatives
Full comparison →| Repository | Stars | 7d Trend | Stack | License | Core Positioning |
|---|---|---|---|---|---|
| golf ★ | 841 | — | Python | Apache-2.0 | A convention-driven Python framework that turns modules into MCP servers |
| headroom | 81.5k | +455 | Python | Apache-2.0 | Local context compression for LLMs via a Python library, proxy, and MCP server |
| goose | 57.3k | +219 | Rust | Apache-2.0 | Rust coding agent with MCP tools and local or hosted models, embeddable via ACP |
| mcp-for-blender | 37.1k | +1.1k | Python | GPL-3.0 | A local MCP bridge for inspecting and editing live Blender scenes with AI |
AI Context Briefing (for Claude / Cursor / Windsurf)
Standardized architecture summary & quickstart commands ready to paste into coding agents.
curl -sL https://repoforai.com/repo/golf-mcp/golf.md
Active README embeds unlock Hot-Tier 6h Telemetry Refresh automatically (zero pay-to-rank).
Frequently Asked Questions about golf
How does a Python function become a tool an MCP client can call?
tools/ and assign its entry function to export. Golf discovers the module, derives the default tool ID from its path, uses the module docstring as the description, and infers the input schema from the function signature. A Pydantic return model can define the output schema. Use stdio for a client-launched process or Streamable HTTP for a separately hosted endpoint.Does Golf need a GPU, and how should I size a deployment?
Can I self-host Golf commercially, and what should I check for compliance?
golf telemetry disable to persistently opt out of CLI usage telemetry; configure server-side OpenTelemetry independently.When should I choose Golf rather than use FastMCP directly?
Upstream README & Documentation
This profile focuses on independent engineering analysis and live telemetry. Read the full upstream README, changelog, and examples directly on GitHub.
Top 10 Breakout Open-Source AI Repos, Every Thursday
Signal-only digest of fast-growing AI repos, SPDX license alerts, and architecture picks. Zero spam.
Zero spam · 1-click unsubscribe · Privacy Policy