Golf: An Open-Source Framework for Simplifying MCP Server Development
Golf is an open-source framework designed to simplify the development of MCP servers by defining server functionalities through Python files, such as tools, prompts, and resources. It automatically parses and compiles these files into a FastMCP server, reducing complex configurations and making it suitable for quickly building efficient MCP servers. Key features include: 1. Development simplification: • Organizes code using a simple directory structure (`tools/`, `resources/`, `prompts/`) • Defines components via Python files, automatically generating tool IDs (e.g., `tools/hello.py` is registered as `hello`) • Supports nested directories for flexible organization of complex projects. 2. Quick startup: • Install with `pip install golf-mcp` • Initialize a project using `golf init`, which generates a standard directory structure and configuration file `golf.json`. • Start the development server using `golf build dev` and `golf run` (defaulting to `http://127.0.0.1:3000`). 3. Flexible configuration: • The `golf.json` file configures server name, port, communication protocols (like SSE, HTTP streaming, standard I/O) • Supports OpenTelemetry for distributed tracing, making debugging and monitoring easier. 4. Built-in features: • Automatically discovers and registers tools, resources, and prompts • Supports Pydantic model definitions for input and output, standardizing data structures • Optional pre-build scripts (`pre_build.py`) for custom setups (like authentication). 5. Telemetry support: • Collects anonymous usage data (commands, versions, etc., with no personal or code information) • Can be disabled via `golf telemetry disable` or `–no-telemetry`. Sample tool: # tools/hello.py “””Hello World tool.””” from pydantic import BaseModel class Output(BaseModel): message: str async def hello(name: str = “World”, greeting: str = “Hello”) -> Output: return Output(message=f”{greeting}, {name}!”) export = hello • Automatically registered as the `hello` tool, description derived from the module’s docstring • Parameters and outputs are automatically inferred from function signatures and Pydantic models. Future plans include one-click deployment to platforms like Vercel and Blaxel, improved OAuth token management, and support for encrypted storage and client mapping.