$git clone https://github.com/golf-mcp/golf<br>
| 1 | <div align="center"> |
| 2 | <img src="./golf-banner.png" alt="Golf Banner"> |
| 3 | |
| 4 | <br> |
| 5 | |
| 6 | <h1 align="center"> |
| 7 | <br> |
| 8 | <span style="font-size: 80px;">⛳ Golf</span> |
| 9 | <br> |
| 10 | </h1> |
| 11 | |
| 12 | <h3 align="center"> |
| 13 | Easiest framework for building MCP servers |
| 14 | </h3> |
| 15 | |
| 16 | <br> |
| 17 | |
| 18 | <p> |
| 19 | <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache%202.0-blue.svg" alt="License"></a> |
| 20 | <a href="https://github.com/golf-mcp/golf/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs"></a> |
| 21 | <a href="https://github.com/golf-mcp/golf/issues"><img src="https://img.shields.io/badge/support-contact%20author-purple.svg" alt="Support"></a> |
| 22 | </p> |
| 23 | |
| 24 | <p> |
| 25 | <a href="https://docs.golf.dev"><strong>📚 Documentation</strong></a> |
| 26 | </p> |
| 27 | </div> |
| 28 | |
| 29 | ## Overview |
| 30 | |
| 31 | 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 MCP server, minimizing boilerplate and accelerating development. |
| 32 | |
| 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. |
| 34 | |
| 35 | ## Quick Start |
| 36 | |
| 37 | Get your Golf project up and running in a few simple steps: |
| 38 | |
| 39 | ### 1. Install Golf |
| 40 | |
| 41 | Ensure you have Python (3.10+ recommended) installed. Then, install Golf using pip: |
| 42 | |
| 43 | ```bash |
| 44 | pip install golf-mcp |
| 45 | ``` |
| 46 | |
| 47 | ### 2. Initialize Your Project |
| 48 | |
| 49 | Use the Golf CLI to scaffold a new project: |
| 50 | |
| 51 | ```bash |
| 52 | golf init your-project-name |
| 53 | ``` |
| 54 | This command creates a new directory (`your-project-name`) with a basic project structure, including example tools, resources, and a `golf.json` configuration file. |
| 55 | |
| 56 | ### 3. Run the Development Server |
| 57 | |
| 58 | Navigate into your new project directory and start the development server: |
| 59 | |
| 60 | ```bash |
| 61 | cd your-project-name |
| 62 | golf build dev |
| 63 | golf run |
| 64 | ``` |
| 65 | This will start the MCP server, typically on `http://localhost:3000` (configurable in `golf.json`). |
| 66 | |
| 67 | That's it! Your Golf server is running and ready for integration. |
| 68 | |
| 69 | ## Basic Project Structure |
| 70 | |
| 71 | A Golf project initialized with `golf init` will have a structure similar to this: |
| 72 | |
| 73 | ``` |
| 74 | <your-project-name>/ |
| 75 | │ |
| 76 | ├─ golf.json # Main project configuration |
| 77 | │ |
| 78 | ├─ tools/ # Directory for tool implementations |
| 79 | │ └─ hello.py # Example tool |
| 80 | │ |
| 81 | ├─ resources/ # Directory for resource implementations |
| 82 | │ └─ info.py # Example resource |
| 83 | │ |
| 84 | ├─ prompts/ # Directory for prompt templates |
| 85 | │ └─ welcome.py # Example prompt |
| 86 | │ |
| 87 | ├─ .env # Environment variables (e.g., API keys, server port) |
| 88 | └─ auth.py # Authentication configuration (JWT, OAuth Server, API key, dev tokens) |
| 89 | ``` |
| 90 | |
| 91 | - **`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. |
| 93 | - **`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. |
| 94 | - 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). |
| 95 | |
| 96 | ## Example: Defining a Tool |
| 97 | |
| 98 | Creating a new tool is a |