golf-mcp 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl

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/__init__.py CHANGED
@@ -1 +1 @@
1
- __version__ = "0.1.1"
1
+ __version__ = "0.1.2"
@@ -1,117 +1,61 @@
1
- # {{project_name}}
1
+ # GolfMCP Project Boilerplate
2
2
 
3
- A GolfMCP project that provides MCP-compatible tools, resources, and prompts.
3
+ This directory serves as a starting template for new GolfMCP projects. Initialize a project using the `golf init <your-project-name>` command.
4
+ ## About GolfMCP
4
5
 
5
- ## Getting Started
6
+ GolfMCP is a Python framework designed to build MCP servers with minimal boilerplate. It allows you to define tools, resources, and prompts as simple Python files. These components are then automatically discovered and compiled into a runnable [FastMCP](https://github.com/fastmcp/fastmcp) server.
6
7
 
7
- This project is built with [GolfMCP](https://github.com/yourusername/golfmcp), a Python framework for building MCP servers with zero boilerplate.
8
+ ## Getting Started (After `golf init`)
8
9
 
9
- To start the development server with hot reload:
10
+ Once you've initialized your new project from this boilerplate:
10
11
 
11
- ```bash
12
- golf dev
13
- ```
12
+ 1. **Navigate to your project directory:**
13
+ ```bash
14
+ cd your-project-name
15
+ ```
14
16
 
15
- This will watch for file changes and automatically reload the server.
17
+ 2. **Start the development server:**
18
+ ```bash
19
+ golf build dev # For a development build
20
+ # or
21
+ golf build prod # For a production build
22
+
23
+ golf run
24
+ ```
16
25
 
17
26
  ## Project Structure
18
27
 
19
- - `tools/` - Tool implementations (functions an LLM can call)
20
- - `resources/` - Resource implementations (data an LLM can read)
21
- - `prompts/` - Prompt templates (conversations an LLM can use)
22
- - `golf.json` - Configuration file with settings like telemetry and transport
28
+ Your initialized GolfMCP project will typically have the following structure:
23
29
 
24
- ## Adding New Components
25
-
26
- ### Tools
27
-
28
- To add a new tool, create a Python file in the `tools/` directory:
29
-
30
- ```python
31
- # tools/my_tool.py
32
- from pydantic import BaseModel
33
- from fastmcp import Context
34
-
35
- class Input(BaseModel):
36
- param1: str
37
- param2: int = 42
38
-
39
- class Output(BaseModel):
40
- result: str
41
-
42
- async def run(input: Input, ctx: Context) -> Output:
43
- """Description of what my tool does."""
44
- await ctx.info(f"Processing {input.param1}...")
45
- return MyOutput(result=f"Processed {input.param1} with {input.param2}")
46
- ```
47
-
48
- ### Resources
49
-
50
- To add a new resource, create a Python file in the `resources/` directory:
30
+ - `tools/`: Directory for your tool implementations (Python files defining functions an LLM can call).
31
+ - `resources/`: Directory for your resource implementations (Python files defining data an LLM can read).
32
+ - `prompts/`: Directory for your prompt templates (Python files defining reusable conversation structures).
33
+ - `golf.json`: The main configuration file for your project, including settings like the server name, port, and transport.
34
+ - `pre_build.py`: (Optional) A Python script that can be used to run custom logic before the build process begins, such as configuring authentication.
35
+ - `.env`: File to store environment-specific variables (e.g., API keys). This is created during `golf init`.
51
36
 
52
- ```python
53
- # resources/my_data.py
54
- resource_uri = "data://my-data"
55
-
56
- async def run() -> dict:
57
- """Description of the resource."""
58
- return {
59
- "title": "My Data",
60
- "content": "Some valuable information"
61
- }
62
- ```
63
-
64
- ### Sharing Functionality with common.py
65
-
66
- For directories with multiple related components (like `tools/payments/` or `resources/weather/`),
67
- use a `common.py` file to share functionality:
68
-
69
- ```python
70
- # tools/payments/common.py
71
- class PaymentClient:
72
- """Shared payment client implementation."""
73
- # Implementation details...
74
-
75
- # Create a shared client instance
76
- payment_client = PaymentClient()
77
- ```
78
-
79
- Then import and use the shared functionality in your components:
80
-
81
- ```python
82
- # tools/payments/charge.py
83
- from .common import payment_client
37
+ ## Adding New Components
84
38
 
85
- async def run(input):
86
- result = await payment_client.create_charge(...)
87
- # Rest of implementation...
88
- ```
39
+ To add new functionalities:
89
40
 
90
- This pattern helps organize shared code and makes it easier to build and maintain your project.
41
+ - **Tools**: Create a new `.py` file in the `tools/` directory.
42
+ - **Resources**: Create a new `.py` file in the `resources/` directory.
43
+ - **Prompts**: Create a new `.py` file in the `prompts/` directory.
91
44
 
92
- ## Telemetry
45
+ Each Python file should generally define a single component. A module-level docstring in the file will be used as the description for the component. See the example files (e.g., `tools/hello.py`, `resources/info.py`) provided in this boilerplate for reference.
93
46
 
94
- This project includes OpenTelemetry integration for tracing server requests:
47
+ For shared functionality within a component subdirectory (e.g., `tools/payments/common.py`), you can use a `common.py` file.
95
48
 
96
- ```json
97
- // golf.json
98
- {
99
- "telemetry": true,
100
- "telemetry_exporter": "console" // or "otlp_http"
101
- }
102
- ```
49
+ ## Documentation
103
50
 
104
- You can configure it with environment variables:
105
- - `OTEL_SERVICE_NAME`: Set service name (defaults to app name)
106
- - `OTEL_TRACES_EXPORTER`: Exporter type ("console" or "otlp_http")
107
- - `OTEL_EXPORTER_OTLP_ENDPOINT`: OTLP exporter endpoint URL
51
+ For comprehensive details on the GolfMCP framework, including component specifications, advanced configurations, CLI commands, and more, please refer to the official documentation:
108
52
 
109
- ## Deployment
53
+ [https://docs.golf.dev](https://docs.golf.dev)
110
54
 
111
- To build the project for deployment:
55
+ ---
112
56
 
113
- ```bash
114
- golf build
115
- ```
57
+ Happy Building!
116
58
 
117
- This creates a standalone FastMCP application in the `dist/` directory.
59
+ <div align="center">
60
+ Made with ❤️ in San Francisco
61
+ </div>
@@ -0,0 +1,180 @@
1
+ Metadata-Version: 2.4
2
+ Name: golf-mcp
3
+ Version: 0.1.2
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
+ Provides-Extra: telemetry
31
+ Requires-Dist: opentelemetry-api>=1.33.1; extra == "telemetry"
32
+ Requires-Dist: opentelemetry-sdk>=1.33.1; extra == "telemetry"
33
+ Requires-Dist: opentelemetry-instrumentation-asgi>=0.40b0; extra == "telemetry"
34
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http>=0.40b0; extra == "telemetry"
35
+ Requires-Dist: wrapt>=1.17.0; extra == "telemetry"
36
+ Dynamic: license-file
37
+
38
+ <div align="center">
39
+ <img src="./golf-banner.png" alt="Golf Banner">
40
+
41
+ <h1>Golf</h1>
42
+
43
+ <p><strong>Easiest framework for building MCP servers.</strong></p>
44
+
45
+ <p>
46
+ <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>
47
+ <a href="https://github.com/golf-mcp/golf/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen.svg" alt="PRs"></a>
48
+ <a href="https://github.com/golf-mcp/golf/issues"><img src="https://img.shields.io/badge/support-contact%20author-purple.svg" alt="Support"></a>
49
+ </p>
50
+
51
+ <p><a href="https://docs.golf.dev">Docs</a></p>
52
+ </div>
53
+
54
+ ## Overview
55
+
56
+ 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.
57
+
58
+ 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.
59
+
60
+ ## Quick Start
61
+
62
+ Get your Golf project up and running in a few simple steps:
63
+
64
+ ### 1. Install Golf
65
+
66
+ Ensure you have Python (3.10+ recommended) installed. Then, install Golf using pip:
67
+
68
+ ```bash
69
+ pip install golf-mcp
70
+ ```
71
+
72
+ ### 2. Initialize Your Project
73
+
74
+ Use the Golf CLI to scaffold a new project:
75
+
76
+ ```bash
77
+ golf init your-project-name
78
+ ```
79
+ This command creates a new directory (`your-project-name`) with a basic project structure, including example tools, resources, and a `golf.json` configuration file.
80
+
81
+ ### 3. Run the Development Server
82
+
83
+ Navigate into your new project directory and start the development server:
84
+
85
+ ```bash
86
+ cd your-project-name
87
+ golf build dev
88
+ golf run
89
+ ```
90
+ This will start the FastMCP server, typically on `http://127.0.0.1:3000` (configurable in `golf.json`). The `dev` command includes hot reloading, so changes to your component files will automatically restart the server.
91
+
92
+ That's it! Your Golf server is running and ready for integration.
93
+
94
+ ## Basic Project Structure
95
+
96
+ A Golf project initialized with `golf init` will have a structure similar to this:
97
+
98
+ ```
99
+ <your-project-name>/
100
+
101
+ ├─ golf.json # Main project configuration
102
+
103
+ ├─ tools/ # Directory for tool implementations
104
+ │ └─ hello.py # Example tool
105
+
106
+ ├─ resources/ # Directory for resource implementations
107
+ │ └─ info.py # Example resource
108
+
109
+ ├─ prompts/ # Directory for prompt templates
110
+ │ └─ welcome.py # Example prompt
111
+
112
+ ├─ .env # Environment variables (e.g., API keys, server port)
113
+ └─ pre_build.py # (Optional) Script for pre-build hooks (e.g., auth setup)
114
+ ```
115
+
116
+ - **`golf.json`**: Configures server name, port, transport, telemetry, and other build settings.
117
+ - **`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.
118
+ - 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).
119
+ - **`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.
120
+
121
+ ## Example: Defining a Tool
122
+
123
+ 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:
124
+
125
+ ```python
126
+ # tools/hello.py
127
+ """Hello World tool {{project_name}}."""
128
+
129
+ from pydantic import BaseModel
130
+
131
+ class Output(BaseModel):
132
+ """Response from the hello tool."""
133
+ message: str
134
+
135
+ async def hello(
136
+ name: str = "World",
137
+ greeting: str = "Hello"
138
+ ) -> Output:
139
+ """Say hello to the given name.
140
+
141
+ This is a simple example tool that demonstrates the basic structure
142
+ of a tool implementation in Golf.
143
+ """
144
+ print(f"{greeting} {name}...")
145
+ return Output(message=f"{greeting}, {name}!")
146
+
147
+ # Designate the entry point function
148
+ export = hello
149
+ ```
150
+ 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`.
151
+
152
+ ## Configuration (`golf.json`)
153
+
154
+ Key aspects of your Golf server are configured in `golf.json`. The boilerplate provides a starting point like this:
155
+
156
+ ```jsonc
157
+ {
158
+ "name": "{{project_name}}", // Will be replaced with your project name
159
+ "description": "A Golf project", // A default description
160
+ "host": "127.0.0.1", // Server host address
161
+ "port": 3000, // Server port
162
+ "transport": "sse", // 'sse', 'streamable-http', or 'stdio'
163
+ "opentelemetry_enabled": false, // OpenTelemetry disabled by default - we're working on this as a feature
164
+ "opentelemetry_default_exporter": "console"
165
+ }
166
+ ```
167
+ ## Roadmap
168
+
169
+ We are actively developing Golf. Here's what's on our current roadmap:
170
+
171
+
172
+ ## Documentation
173
+
174
+ For more information, please visit our official documentation:
175
+
176
+ [https://docs.golf.dev](https://docs.golf.dev)
177
+
178
+ <div align="center">
179
+ Made with ❤️ in Warsaw, Poland and SF
180
+ </div>
@@ -1,4 +1,4 @@
1
- golf/__init__.py,sha256=8oAxKUG747GUokmxjkrWejyJa5yPNEsoJDlXxoedxTw,21
1
+ golf/__init__.py,sha256=K5SiDdEGYMpdqXThrqwTqECJJBOQNTQDrnpc2K5mzKs,21
2
2
  golf/auth/__init__.py,sha256=0cfMJsLsOAsA4gHynyPGDkrjB90s3xsGSFoCEWg-y6o,3999
3
3
  golf/auth/helpers.py,sha256=TqMlOzwtcQcrZ6en2WVkzH0TSQ0RsoDRObpi_rR0Ie4,1681
4
4
  golf/auth/oauth.py,sha256=MGtuKMSt77yihuZiuiEm33xAlXJynIMcFmMLZRlppdg,31525
@@ -19,7 +19,7 @@ golf/core/transformer.py,sha256=3mr4_K4l1HZl1WQWSt9NKEhB5oi3b7kJnniseYEfrcI,5573
19
19
  golf/examples/__init__.py,sha256=Nqnn8clbgv-5l0PgxcTOldg8mkMKrFn4TvPL-rYUUGg,1
20
20
  golf/examples/basic/.env,sha256=CRh4u1yXPCbjjgUKUMUgw51aOBdVFEgY748z7WgfkVc,156
21
21
  golf/examples/basic/.env.example,sha256=gCTFcabTvr_-Rg3kTGmi63JQtCEOwMu4U5jTa1GM66U,123
22
- golf/examples/basic/README.md,sha256=Hp6mQlC2pj_JKd55fO1O50zTxmqA55JldwoVOXUSCPA,2882
22
+ golf/examples/basic/README.md,sha256=-mY3R6AAnkXT9FPkALDrJtdf9IyKDvuqjsrLAMTLRYI,2663
23
23
  golf/examples/basic/golf.json,sha256=JThi6EC93trGqECo3ryD3MhDcyR9Haub8kYvmYo4yjQ,213
24
24
  golf/examples/basic/pre_build.py,sha256=VVYtBSCy4Xjg1Ocpl8ZwEr7VCVqPSSkDEzrTfQkAQKY,1037
25
25
  golf/examples/basic/prompts/welcome.py,sha256=LgT1eQewe0J08I5WFBv4RrgDr6yn4a4ww6XQ8k3sTVk,822
@@ -33,9 +33,9 @@ golf/examples/basic/tools/hello.py,sha256=hJUMraxgi5g0gzhPbUZGOeAbiKZX4BTr1L64SE
33
33
  golf/examples/basic/tools/payments/charge.py,sha256=jLOyQmbpRm8cOIK2JXSirPmQGXDM-yHvg7ruv72j6qU,1287
34
34
  golf/examples/basic/tools/payments/common.py,sha256=z5shSOZizUEnxBmGUSYghxmNwIvuhg-yfXKIfPWgV04,1292
35
35
  golf/examples/basic/tools/payments/refund.py,sha256=_HG4dDeki8FyKCtWs5fXYeLpUsrc_SAx3vxAIS7Icf0,1302
36
- golf_mcp-0.1.1.dist-info/licenses/LICENSE,sha256=5_j2f6fTJmvfmUewzElhkpAaXg2grVoxKouOA8ihV6E,11348
37
- golf_mcp-0.1.1.dist-info/METADATA,sha256=mXLS9WPAwviBjcyjW9BRHVOlro9Uc0M90l5YVSLZtm4,2421
38
- golf_mcp-0.1.1.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
39
- golf_mcp-0.1.1.dist-info/entry_points.txt,sha256=5y7rHYM8jGpU-nfwdknCm5XsApLulqsnA37MO6BUTYg,43
40
- golf_mcp-0.1.1.dist-info/top_level.txt,sha256=BQToHcBUufdyhp9ONGMIvPE40jMEtmI20lYaKb4hxOg,5
41
- golf_mcp-0.1.1.dist-info/RECORD,,
36
+ golf_mcp-0.1.2.dist-info/licenses/LICENSE,sha256=5_j2f6fTJmvfmUewzElhkpAaXg2grVoxKouOA8ihV6E,11348
37
+ golf_mcp-0.1.2.dist-info/METADATA,sha256=pgiA91H0Gk_AwkI8Y-GDHVpN0TtB4DAnwUIWVjwk3XM,7365
38
+ golf_mcp-0.1.2.dist-info/WHEEL,sha256=zaaOINJESkSfm_4HQVc5ssNzHCPXhJm0kEUakpsEHaU,91
39
+ golf_mcp-0.1.2.dist-info/entry_points.txt,sha256=5y7rHYM8jGpU-nfwdknCm5XsApLulqsnA37MO6BUTYg,43
40
+ golf_mcp-0.1.2.dist-info/top_level.txt,sha256=BQToHcBUufdyhp9ONGMIvPE40jMEtmI20lYaKb4hxOg,5
41
+ golf_mcp-0.1.2.dist-info/RECORD,,
@@ -1,78 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: golf-mcp
3
- Version: 0.1.1
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
- Provides-Extra: telemetry
31
- Requires-Dist: opentelemetry-api>=1.33.1; extra == "telemetry"
32
- Requires-Dist: opentelemetry-sdk>=1.33.1; extra == "telemetry"
33
- Requires-Dist: opentelemetry-instrumentation-asgi>=0.40b0; extra == "telemetry"
34
- Requires-Dist: opentelemetry-exporter-otlp-proto-http>=0.40b0; extra == "telemetry"
35
- Requires-Dist: wrapt>=1.17.0; extra == "telemetry"
36
- Dynamic: license-file
37
-
38
- # GolfMCP
39
-
40
- A Pythonic framework for building Model Context Protocol (MCP) servers with zero boilerplate.
41
-
42
- ## Features
43
-
44
- * 🚀 **Zero-to-live in under 90 seconds**: Quick setup and deployment
45
- * 💡 **Convention over configuration**: Minimal boilerplate
46
- * 🔄 **Fast feedback**: Hot-reload during development (≤ 500 ms)
47
- * 📂 **Nested folder support**: Organize your tools, resources, and prompts
48
- * 🔌 **Pluggable auth & deploy**: Built-in providers for OAuth, Vercel, Fly.io, etc.
49
- * 🛠️ **Delegates protocol compliance to FastMCP**: Focus on your logic, not the wire format
50
-
51
- ## Installation
52
-
53
- ```bash
54
- pip install golfmcp
55
- ```
56
-
57
- ## Quick Start
58
-
59
- Initialize a new project:
60
-
61
- ```bash
62
- golf init my-mcp-project
63
- cd my-mcp-project
64
- ```
65
-
66
- Start the development server with hot-reload:
67
-
68
- ```bash
69
- golf dev
70
- ```
71
-
72
- ## Documentation
73
-
74
- For detailed documentation, visit [docs](https://golfmcp.docs.example.com/).
75
-
76
- ## License
77
-
78
- MIT License