golf-mcp 0.1.1__tar.gz → 0.1.3__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of golf-mcp might be problematic. Click here for more details.
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/.docs/docs.md +1 -18
- golf_mcp-0.1.3/PKG-INFO +240 -0
- golf_mcp-0.1.3/README.md +202 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/pyproject.toml +4 -3
- golf_mcp-0.1.3/src/golf/__init__.py +1 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/cli/main.py +79 -23
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/commands/init.py +14 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/commands/run.py +5 -1
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/core/config.py +0 -1
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/core/parser.py +1 -42
- golf_mcp-0.1.3/src/golf/core/telemetry.py +260 -0
- golf_mcp-0.1.3/src/golf/examples/basic/README.md +61 -0
- golf_mcp-0.1.3/src/golf_mcp.egg-info/PKG-INFO +240 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf_mcp.egg-info/SOURCES.txt +1 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf_mcp.egg-info/requires.txt +1 -0
- golf_mcp-0.1.1/PKG-INFO +0 -78
- golf_mcp-0.1.1/README.md +0 -41
- golf_mcp-0.1.1/src/golf/__init__.py +0 -1
- golf_mcp-0.1.1/src/golf/examples/basic/README.md +0 -117
- golf_mcp-0.1.1/src/golf_mcp.egg-info/PKG-INFO +0 -78
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/.docs/fast-mcp.md +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/.docs/fastmcp-example-1.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/.docs/fastmcp-example-2.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/.docs/mcp.md +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/.docs/oauth-implementation.md +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/.docs/oauth.md +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/LICENSE +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/MANIFEST.in +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/setup.cfg +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/auth/__init__.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/auth/helpers.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/auth/oauth.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/auth/provider.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/cli/__init__.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/commands/__init__.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/commands/build.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/core/__init__.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/core/builder.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/core/builder_auth.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/core/builder_telemetry.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/core/transformer.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/__init__.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/.env +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/.env.example +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/golf.json +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/pre_build.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/prompts/welcome.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/resources/current_time.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/resources/info.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/resources/weather/common.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/resources/weather/current.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/resources/weather/forecast.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/tools/github_user.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/tools/hello.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/tools/payments/charge.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/tools/payments/common.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf/examples/basic/tools/payments/refund.py +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf_mcp.egg-info/dependency_links.txt +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf_mcp.egg-info/entry_points.txt +0 -0
- {golf_mcp-0.1.1 → golf_mcp-0.1.3}/src/golf_mcp.egg-info/top_level.txt +0 -0
|
@@ -113,15 +113,13 @@ The parser SHALL fail the build if:
|
|
|
113
113
|
\| **6 Packaging** | Copy auxiliary files (e.g. TLS certs) if declared. |
|
|
114
114
|
\| **7 Completion** | Write artifact map & build log. |
|
|
115
115
|
|
|
116
|
-
Build is **incremental**: SHA‑1 of each file stored; unchanged files skip parsing.
|
|
117
|
-
|
|
118
116
|
---
|
|
119
117
|
|
|
120
118
|
## 7 CLI Contract
|
|
121
119
|
|
|
122
120
|
```bash
|
|
123
121
|
$ golf init [--template <repo‑url>] # scaffold
|
|
124
|
-
$ golf build [--outdir DIR]
|
|
122
|
+
$ golf build [--outdir DIR] # compile once
|
|
125
123
|
$ golf run [--host HOST] [--port P] # build if stale then exec app.py
|
|
126
124
|
```
|
|
127
125
|
|
|
@@ -203,18 +201,3 @@ mcp.tool(
|
|
|
203
201
|
|
|
204
202
|
* **Pre‑Build Plugins** — `pre_build.py` in project root can register callbacks to mutate `Component` objects.
|
|
205
203
|
* **Transport Providers** — third‑party packages can expose `golf_transport` entry‑point returning `TransportFactory` classes recognised by codegen.
|
|
206
|
-
|
|
207
|
-
---
|
|
208
|
-
|
|
209
|
-
## 11 Compliance & Versioning
|
|
210
|
-
|
|
211
|
-
* Spec version is tracked in `golf.json` under `"spec_version"` (default `0.2`).
|
|
212
|
-
* Build engine MUST refuse to build projects with a higher spec\_version than supported.
|
|
213
|
-
|
|
214
|
-
---
|
|
215
|
-
|
|
216
|
-
## 12 Open Items
|
|
217
|
-
|
|
218
|
-
* Auto‑watch & hot‑reload (`golf run --watch`).
|
|
219
|
-
* Injection metadata (`@inject("gmail_client")`) vs type‑based.
|
|
220
|
-
* Resource URI override strategy.
|
golf_mcp-0.1.3/PKG-INFO
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: golf-mcp
|
|
3
|
+
Version: 0.1.3
|
|
4
|
+
Summary: Framework for building MCP servers
|
|
5
|
+
Author-email: Antoni Gmitruk <antoni@golf.dev>
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://golf.dev
|
|
8
|
+
Project-URL: Repository, https://github.com/golf-mcp/golf
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Classifier: Development Status :: 3 - Alpha
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.8
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
19
|
+
Requires-Python: >=3.8
|
|
20
|
+
Description-Content-Type: text/markdown
|
|
21
|
+
License-File: LICENSE
|
|
22
|
+
Requires-Dist: typer>=0.15.4
|
|
23
|
+
Requires-Dist: rich>=14.0.0
|
|
24
|
+
Requires-Dist: fastmcp>=2.0.0
|
|
25
|
+
Requires-Dist: pydantic>=2.11.0
|
|
26
|
+
Requires-Dist: python-dotenv>=1.1.0
|
|
27
|
+
Requires-Dist: black>=24.10.0
|
|
28
|
+
Requires-Dist: pyjwt>=2.0.0
|
|
29
|
+
Requires-Dist: httpx>=0.28.1
|
|
30
|
+
Requires-Dist: posthog>=4.1.0
|
|
31
|
+
Provides-Extra: telemetry
|
|
32
|
+
Requires-Dist: opentelemetry-api>=1.33.1; extra == "telemetry"
|
|
33
|
+
Requires-Dist: opentelemetry-sdk>=1.33.1; extra == "telemetry"
|
|
34
|
+
Requires-Dist: opentelemetry-instrumentation-asgi>=0.40b0; extra == "telemetry"
|
|
35
|
+
Requires-Dist: opentelemetry-exporter-otlp-proto-http>=0.40b0; extra == "telemetry"
|
|
36
|
+
Requires-Dist: wrapt>=1.17.0; extra == "telemetry"
|
|
37
|
+
Dynamic: license-file
|
|
38
|
+
|
|
39
|
+
<div align="center">
|
|
40
|
+
<img src="./golf-banner.png" alt="Golf Banner">
|
|
41
|
+
|
|
42
|
+
<br>
|
|
43
|
+
|
|
44
|
+
<h1 align="center">
|
|
45
|
+
<br>
|
|
46
|
+
<span style="font-size: 80px;">⛳ Golf</span>
|
|
47
|
+
<br>
|
|
48
|
+
</h1>
|
|
49
|
+
|
|
50
|
+
<h3 align="center">
|
|
51
|
+
Easiest framework for building MCP servers
|
|
52
|
+
</h3>
|
|
53
|
+
|
|
54
|
+
<br>
|
|
55
|
+
|
|
56
|
+
<p>
|
|
57
|
+
<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>
|
|
58
|
+
<a href="https://github.com/golf-mcp/golf/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs"></a>
|
|
59
|
+
<a href="https://github.com/golf-mcp/golf/issues"><img src="https://img.shields.io/badge/support-contact%20author-purple.svg" alt="Support"></a>
|
|
60
|
+
</p>
|
|
61
|
+
|
|
62
|
+
<p>
|
|
63
|
+
<a href="https://docs.golf.dev"><strong>📚 Documentation</strong></a>
|
|
64
|
+
</p>
|
|
65
|
+
</div>
|
|
66
|
+
|
|
67
|
+
## Overview
|
|
68
|
+
|
|
69
|
+
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.
|
|
70
|
+
|
|
71
|
+
With Golf, you can focus on implementing your agent's logic rather than wrestling with server setup and integration complexities. It's built for developers who want a quick, organized way to build powerful MCP servers.
|
|
72
|
+
|
|
73
|
+
## Quick Start
|
|
74
|
+
|
|
75
|
+
Get your Golf project up and running in a few simple steps:
|
|
76
|
+
|
|
77
|
+
### 1. Install Golf
|
|
78
|
+
|
|
79
|
+
Ensure you have Python (3.10+ recommended) installed. Then, install Golf using pip:
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
pip install golf-mcp
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
### 2. Initialize Your Project
|
|
86
|
+
|
|
87
|
+
Use the Golf CLI to scaffold a new project:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
golf init your-project-name
|
|
91
|
+
```
|
|
92
|
+
This command creates a new directory (`your-project-name`) with a basic project structure, including example tools, resources, and a `golf.json` configuration file.
|
|
93
|
+
|
|
94
|
+
### 3. Run the Development Server
|
|
95
|
+
|
|
96
|
+
Navigate into your new project directory and start the development server:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
cd your-project-name
|
|
100
|
+
golf build dev
|
|
101
|
+
golf run
|
|
102
|
+
```
|
|
103
|
+
This will start the FastMCP server, typically on `http://127.0.0.1:3000` (configurable in `golf.json`).
|
|
104
|
+
|
|
105
|
+
That's it! Your Golf server is running and ready for integration.
|
|
106
|
+
|
|
107
|
+
## Basic Project Structure
|
|
108
|
+
|
|
109
|
+
A Golf project initialized with `golf init` will have a structure similar to this:
|
|
110
|
+
|
|
111
|
+
```
|
|
112
|
+
<your-project-name>/
|
|
113
|
+
│
|
|
114
|
+
├─ golf.json # Main project configuration
|
|
115
|
+
│
|
|
116
|
+
├─ tools/ # Directory for tool implementations
|
|
117
|
+
│ └─ hello.py # Example tool
|
|
118
|
+
│
|
|
119
|
+
├─ resources/ # Directory for resource implementations
|
|
120
|
+
│ └─ info.py # Example resource
|
|
121
|
+
│
|
|
122
|
+
├─ prompts/ # Directory for prompt templates
|
|
123
|
+
│ └─ welcome.py # Example prompt
|
|
124
|
+
│
|
|
125
|
+
├─ .env # Environment variables (e.g., API keys, server port)
|
|
126
|
+
└─ pre_build.py # (Optional) Script for pre-build hooks (e.g., auth setup)
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
- **`golf.json`**: Configures server name, port, transport, telemetry, and other build settings.
|
|
130
|
+
- **`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.
|
|
131
|
+
- 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 hyphens).
|
|
132
|
+
- **`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.
|
|
133
|
+
|
|
134
|
+
## Example: Defining a Tool
|
|
135
|
+
|
|
136
|
+
Creating a new tool is as simple as adding a Python file to the `tools/` directory. The example `tools/hello.py` in the boilerplate looks like this:
|
|
137
|
+
|
|
138
|
+
```python
|
|
139
|
+
# tools/hello.py
|
|
140
|
+
"""Hello World tool {{project_name}}."""
|
|
141
|
+
|
|
142
|
+
from pydantic import BaseModel
|
|
143
|
+
|
|
144
|
+
class Output(BaseModel):
|
|
145
|
+
"""Response from the hello tool."""
|
|
146
|
+
message: str
|
|
147
|
+
|
|
148
|
+
async def hello(
|
|
149
|
+
name: str = "World",
|
|
150
|
+
greeting: str = "Hello"
|
|
151
|
+
) -> Output:
|
|
152
|
+
"""Say hello to the given name.
|
|
153
|
+
|
|
154
|
+
This is a simple example tool that demonstrates the basic structure
|
|
155
|
+
of a tool implementation in Golf.
|
|
156
|
+
"""
|
|
157
|
+
print(f"{greeting} {name}...")
|
|
158
|
+
return Output(message=f"{greeting}, {name}!")
|
|
159
|
+
|
|
160
|
+
# Designate the entry point function
|
|
161
|
+
export = hello
|
|
162
|
+
```
|
|
163
|
+
Golf will automatically discover this file. The module docstring `"""Hello World tool {{project_name}}."""` is used as the tool's description. It infers parameters from the `hello` function's signature and uses the `Output` Pydantic model for the output schema. The tool will be registered with the ID `hello`.
|
|
164
|
+
|
|
165
|
+
## Configuration (`golf.json`)
|
|
166
|
+
|
|
167
|
+
The `golf.json` file is the heart of your Golf project configuration. Here's what each field controls:
|
|
168
|
+
|
|
169
|
+
```jsonc
|
|
170
|
+
{
|
|
171
|
+
"name": "{{project_name}}", // Your MCP server name (required)
|
|
172
|
+
"description": "A Golf project", // Brief description of your server's purpose
|
|
173
|
+
"host": "127.0.0.1", // Server host - use "0.0.0.0" to listen on all interfaces
|
|
174
|
+
"port": 3000, // Server port - any available port number
|
|
175
|
+
"transport": "sse", // Communication protocol:
|
|
176
|
+
// - "sse": Server-Sent Events (recommended for web clients)
|
|
177
|
+
// - "streamable-http": HTTP with streaming support
|
|
178
|
+
// - "stdio": Standard I/O (for CLI integration)
|
|
179
|
+
}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
### Key Configuration Options:
|
|
183
|
+
|
|
184
|
+
- **`name`**: The identifier for your MCP server. This will be shown to clients connecting to your server.
|
|
185
|
+
- **`transport`**: Choose based on your client needs:
|
|
186
|
+
- `"sse"` is ideal for web-based clients and real-time communication
|
|
187
|
+
- `"streamable-http"` provides HTTP streaming for traditional API clients
|
|
188
|
+
- `"stdio"` enables integration with command-line tools and scripts
|
|
189
|
+
- **`host` & `port`**: Control where your server listens. Use `"127.0.0.1"` for local development or `"0.0.0.0"` to accept external connections.
|
|
190
|
+
|
|
191
|
+
## Privacy & Telemetry
|
|
192
|
+
|
|
193
|
+
Golf collects **anonymous** usage data to help us understand how the framework is being used and improve it over time. The data collected includes:
|
|
194
|
+
|
|
195
|
+
- Commands run (init, build, run)
|
|
196
|
+
- Success/failure status (no error details)
|
|
197
|
+
- Golf version, Python version (major.minor only), and OS type
|
|
198
|
+
- Template name (for init command only)
|
|
199
|
+
- Build environment (dev/prod for build commands only)
|
|
200
|
+
|
|
201
|
+
**No personal information, project names, code content, or error messages are ever collected.**
|
|
202
|
+
|
|
203
|
+
### Opting Out
|
|
204
|
+
|
|
205
|
+
You can disable telemetry in several ways:
|
|
206
|
+
|
|
207
|
+
1. **Using the telemetry command** (recommended):
|
|
208
|
+
```bash
|
|
209
|
+
golf telemetry disable
|
|
210
|
+
```
|
|
211
|
+
This saves your preference permanently. To re-enable:
|
|
212
|
+
```bash
|
|
213
|
+
golf telemetry enable
|
|
214
|
+
```
|
|
215
|
+
|
|
216
|
+
2. **During any command**: Add `--no-telemetry` to save your preference:
|
|
217
|
+
```bash
|
|
218
|
+
golf init my-project --no-telemetry
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
3. **Environment variable** (temporary override):
|
|
222
|
+
```bash
|
|
223
|
+
export GOLF_TELEMETRY=0
|
|
224
|
+
golf init my-project
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Your telemetry preference is stored in `~/.golf/telemetry.json` and persists across all Golf commands.
|
|
228
|
+
|
|
229
|
+
## Roadmap
|
|
230
|
+
|
|
231
|
+
Here are the things we are working hard on:
|
|
232
|
+
|
|
233
|
+
* **Native OpenTelemetry implementation for tracing**
|
|
234
|
+
* **`golf deploy` command for one click deployments to Vercel, Blaxel and other providers**
|
|
235
|
+
* **Production-ready OAuth token management, to allow for persistent, encrypted token storage and client mapping**
|
|
236
|
+
|
|
237
|
+
|
|
238
|
+
<div align="center">
|
|
239
|
+
Made with ❤️ in Warsaw, Poland and SF
|
|
240
|
+
</div>
|
golf_mcp-0.1.3/README.md
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
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 FastMCP server, minimizing boilerplate and accelerating development.
|
|
32
|
+
|
|
33
|
+
With Golf, you can focus on implementing your agent's logic rather than wrestling with server setup and integration complexities. It's built for developers who want a quick, organized way to build powerful MCP servers.
|
|
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 FastMCP server, typically on `http://127.0.0.1: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
|
+
└─ pre_build.py # (Optional) Script for pre-build hooks (e.g., auth setup)
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
- **`golf.json`**: Configures server name, port, transport, telemetry, and other build settings.
|
|
92
|
+
- **`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.
|
|
93
|
+
- 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 hyphens).
|
|
94
|
+
- **`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.
|
|
95
|
+
|
|
96
|
+
## Example: Defining a Tool
|
|
97
|
+
|
|
98
|
+
Creating a new tool is as simple as adding a Python file to the `tools/` directory. The example `tools/hello.py` in the boilerplate looks like this:
|
|
99
|
+
|
|
100
|
+
```python
|
|
101
|
+
# tools/hello.py
|
|
102
|
+
"""Hello World tool {{project_name}}."""
|
|
103
|
+
|
|
104
|
+
from pydantic import BaseModel
|
|
105
|
+
|
|
106
|
+
class Output(BaseModel):
|
|
107
|
+
"""Response from the hello tool."""
|
|
108
|
+
message: str
|
|
109
|
+
|
|
110
|
+
async def hello(
|
|
111
|
+
name: str = "World",
|
|
112
|
+
greeting: str = "Hello"
|
|
113
|
+
) -> Output:
|
|
114
|
+
"""Say hello to the given name.
|
|
115
|
+
|
|
116
|
+
This is a simple example tool that demonstrates the basic structure
|
|
117
|
+
of a tool implementation in Golf.
|
|
118
|
+
"""
|
|
119
|
+
print(f"{greeting} {name}...")
|
|
120
|
+
return Output(message=f"{greeting}, {name}!")
|
|
121
|
+
|
|
122
|
+
# Designate the entry point function
|
|
123
|
+
export = hello
|
|
124
|
+
```
|
|
125
|
+
Golf will automatically discover this file. The module docstring `"""Hello World tool {{project_name}}."""` is used as the tool's description. It infers parameters from the `hello` function's signature and uses the `Output` Pydantic model for the output schema. The tool will be registered with the ID `hello`.
|
|
126
|
+
|
|
127
|
+
## Configuration (`golf.json`)
|
|
128
|
+
|
|
129
|
+
The `golf.json` file is the heart of your Golf project configuration. Here's what each field controls:
|
|
130
|
+
|
|
131
|
+
```jsonc
|
|
132
|
+
{
|
|
133
|
+
"name": "{{project_name}}", // Your MCP server name (required)
|
|
134
|
+
"description": "A Golf project", // Brief description of your server's purpose
|
|
135
|
+
"host": "127.0.0.1", // Server host - use "0.0.0.0" to listen on all interfaces
|
|
136
|
+
"port": 3000, // Server port - any available port number
|
|
137
|
+
"transport": "sse", // Communication protocol:
|
|
138
|
+
// - "sse": Server-Sent Events (recommended for web clients)
|
|
139
|
+
// - "streamable-http": HTTP with streaming support
|
|
140
|
+
// - "stdio": Standard I/O (for CLI integration)
|
|
141
|
+
}
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
### Key Configuration Options:
|
|
145
|
+
|
|
146
|
+
- **`name`**: The identifier for your MCP server. This will be shown to clients connecting to your server.
|
|
147
|
+
- **`transport`**: Choose based on your client needs:
|
|
148
|
+
- `"sse"` is ideal for web-based clients and real-time communication
|
|
149
|
+
- `"streamable-http"` provides HTTP streaming for traditional API clients
|
|
150
|
+
- `"stdio"` enables integration with command-line tools and scripts
|
|
151
|
+
- **`host` & `port`**: Control where your server listens. Use `"127.0.0.1"` for local development or `"0.0.0.0"` to accept external connections.
|
|
152
|
+
|
|
153
|
+
## Privacy & Telemetry
|
|
154
|
+
|
|
155
|
+
Golf collects **anonymous** usage data to help us understand how the framework is being used and improve it over time. The data collected includes:
|
|
156
|
+
|
|
157
|
+
- Commands run (init, build, run)
|
|
158
|
+
- Success/failure status (no error details)
|
|
159
|
+
- Golf version, Python version (major.minor only), and OS type
|
|
160
|
+
- Template name (for init command only)
|
|
161
|
+
- Build environment (dev/prod for build commands only)
|
|
162
|
+
|
|
163
|
+
**No personal information, project names, code content, or error messages are ever collected.**
|
|
164
|
+
|
|
165
|
+
### Opting Out
|
|
166
|
+
|
|
167
|
+
You can disable telemetry in several ways:
|
|
168
|
+
|
|
169
|
+
1. **Using the telemetry command** (recommended):
|
|
170
|
+
```bash
|
|
171
|
+
golf telemetry disable
|
|
172
|
+
```
|
|
173
|
+
This saves your preference permanently. To re-enable:
|
|
174
|
+
```bash
|
|
175
|
+
golf telemetry enable
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
2. **During any command**: Add `--no-telemetry` to save your preference:
|
|
179
|
+
```bash
|
|
180
|
+
golf init my-project --no-telemetry
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
3. **Environment variable** (temporary override):
|
|
184
|
+
```bash
|
|
185
|
+
export GOLF_TELEMETRY=0
|
|
186
|
+
golf init my-project
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
Your telemetry preference is stored in `~/.golf/telemetry.json` and persists across all Golf commands.
|
|
190
|
+
|
|
191
|
+
## Roadmap
|
|
192
|
+
|
|
193
|
+
Here are the things we are working hard on:
|
|
194
|
+
|
|
195
|
+
* **Native OpenTelemetry implementation for tracing**
|
|
196
|
+
* **`golf deploy` command for one click deployments to Vercel, Blaxel and other providers**
|
|
197
|
+
* **Production-ready OAuth token management, to allow for persistent, encrypted token storage and client mapping**
|
|
198
|
+
|
|
199
|
+
|
|
200
|
+
<div align="center">
|
|
201
|
+
Made with ❤️ in Warsaw, Poland and SF
|
|
202
|
+
</div>
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "golf-mcp"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.3"
|
|
8
8
|
description = "Framework for building MCP servers"
|
|
9
9
|
authors = [
|
|
10
10
|
{name = "Antoni Gmitruk", email = "antoni@golf.dev"}
|
|
@@ -33,7 +33,8 @@ dependencies = [
|
|
|
33
33
|
"python-dotenv>=1.1.0",
|
|
34
34
|
"black>=24.10.0",
|
|
35
35
|
"pyjwt>=2.0.0",
|
|
36
|
-
"httpx>=0.28.1"
|
|
36
|
+
"httpx>=0.28.1",
|
|
37
|
+
"posthog>=4.1.0"
|
|
37
38
|
]
|
|
38
39
|
|
|
39
40
|
[project.optional-dependencies]
|
|
@@ -63,7 +64,7 @@ golf = ["examples/**/*"]
|
|
|
63
64
|
|
|
64
65
|
[tool.poetry]
|
|
65
66
|
name = "golf-mcp"
|
|
66
|
-
version = "0.1.
|
|
67
|
+
version = "0.1.3"
|
|
67
68
|
description = "Framework for building MCP servers with zero boilerplate"
|
|
68
69
|
authors = ["Antoni Gmitruk <antoni@golf.dev>"]
|
|
69
70
|
license = "Apache-2.0"
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
__version__ = "0.1.3"
|