golf-mcp 0.2.9__tar.gz → 0.2.12__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.

Files changed (68) hide show
  1. golf_mcp-0.2.12/MANIFEST.in +38 -0
  2. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/PKG-INFO +7 -6
  3. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/README.md +5 -4
  4. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/pyproject.toml +4 -7
  5. golf_mcp-0.2.12/src/golf/__init__.py +1 -0
  6. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/auth/__init__.py +0 -4
  7. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/auth/helpers.py +0 -82
  8. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/cli/branding.py +1 -2
  9. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/cli/main.py +3 -5
  10. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/commands/run.py +24 -12
  11. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/core/builder.py +253 -57
  12. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/core/builder_auth.py +1 -1
  13. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/core/builder_metrics.py +0 -11
  14. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/core/config.py +2 -21
  15. golf_mcp-0.2.12/src/golf/examples/basic/.env.example +4 -0
  16. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/telemetry/instrumentation.py +0 -36
  17. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf_mcp.egg-info/PKG-INFO +7 -6
  18. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf_mcp.egg-info/SOURCES.txt +0 -7
  19. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf_mcp.egg-info/requires.txt +1 -1
  20. golf_mcp-0.2.9/.docs/docs.md +0 -203
  21. golf_mcp-0.2.9/.docs/fastmcp-diff.md +0 -27
  22. golf_mcp-0.2.9/.docs/mcp.md +0 -325
  23. golf_mcp-0.2.9/MANIFEST.in +0 -18
  24. golf_mcp-0.2.9/setup.py +0 -87
  25. golf_mcp-0.2.9/src/golf/__init__.py +0 -9
  26. golf_mcp-0.2.9/src/golf/_endpoints.py.in +0 -6
  27. golf_mcp-0.2.9/src/golf/_endpoints_fallback.py +0 -10
  28. golf_mcp-0.2.9/src/golf/core/platform.py +0 -182
  29. golf_mcp-0.2.9/src/golf/examples/basic/.env.example +0 -8
  30. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/LICENSE +0 -0
  31. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/setup.cfg +0 -0
  32. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/auth/api_key.py +0 -0
  33. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/auth/factory.py +0 -0
  34. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/auth/providers.py +0 -0
  35. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/auth/registry.py +0 -0
  36. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/cli/__init__.py +0 -0
  37. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/commands/__init__.py +0 -0
  38. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/commands/build.py +0 -0
  39. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/commands/init.py +0 -0
  40. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/core/__init__.py +0 -0
  41. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/core/builder_telemetry.py +0 -0
  42. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/core/parser.py +0 -0
  43. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/core/telemetry.py +0 -0
  44. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/core/transformer.py +0 -0
  45. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/__init__.py +0 -0
  46. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/README.md +0 -0
  47. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/auth.py +0 -0
  48. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/golf.json +0 -0
  49. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/prompts/welcome.py +0 -0
  50. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/resources/current_time.py +0 -0
  51. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/resources/info.py +0 -0
  52. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/resources/weather/city.py +0 -0
  53. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/resources/weather/client.py +0 -0
  54. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/resources/weather/current.py +0 -0
  55. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/resources/weather/forecast.py +0 -0
  56. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/tools/calculator.py +0 -0
  57. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/examples/basic/tools/say/hello.py +0 -0
  58. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/metrics/__init__.py +0 -0
  59. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/metrics/collector.py +0 -0
  60. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/metrics/registry.py +0 -0
  61. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/telemetry/__init__.py +0 -0
  62. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/utilities/__init__.py +0 -0
  63. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/utilities/context.py +0 -0
  64. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/utilities/elicitation.py +0 -0
  65. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf/utilities/sampling.py +0 -0
  66. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf_mcp.egg-info/dependency_links.txt +0 -0
  67. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf_mcp.egg-info/entry_points.txt +0 -0
  68. {golf_mcp-0.2.9 → golf_mcp-0.2.12}/src/golf_mcp.egg-info/top_level.txt +0 -0
@@ -0,0 +1,38 @@
1
+ include README.md
2
+ include LICENSE
3
+ include pyproject.toml
4
+ graft .docs
5
+ graft src/golf/examples
6
+
7
+ # Exclude common Python bytecode files and caches
8
+ prune **/__pycache__
9
+ global-exclude *.py[co]
10
+
11
+ # Exclude build artifacts and local env/dist files if they were accidentally included
12
+ prune build
13
+ prune dist
14
+ prune .eggs
15
+ prune *.egg-info
16
+ prune .env
17
+ prune .venv
18
+
19
+ # Exclude development and cache directories
20
+ prune .claude
21
+ prune htmlcov
22
+ prune thoughts
23
+ prune new
24
+ prune tests
25
+ prune .pytest_cache
26
+ prune .ruff_cache
27
+ prune .git
28
+ prune .github
29
+
30
+ # Exclude development files
31
+ exclude build.sh
32
+ exclude setup.py
33
+ exclude CLAUDE.md
34
+ exclude Makefile
35
+ exclude .coverage
36
+ exclude .DS_Store
37
+ exclude *.code-workspace
38
+ exclude golf-banner.png
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: golf-mcp
3
- Version: 0.2.9
3
+ Version: 0.2.12
4
4
  Summary: Framework for building MCP servers
5
5
  Author-email: Antoni Gmitruk <antoni@golf.dev>
6
6
  License-Expression: Apache-2.0
@@ -21,7 +21,7 @@ Description-Content-Type: text/markdown
21
21
  License-File: LICENSE
22
22
  Requires-Dist: typer>=0.15.4
23
23
  Requires-Dist: rich>=14.0.0
24
- Requires-Dist: fastmcp<3.0.0,>=2.11.0
24
+ Requires-Dist: fastmcp==2.12.5
25
25
  Requires-Dist: pydantic>=2.11.0
26
26
  Requires-Dist: pydantic-settings>=2.0.0
27
27
  Requires-Dist: python-dotenv>=1.1.0
@@ -197,9 +197,10 @@ from golf.utils import elicit, sample, get_context
197
197
  ```
198
198
 
199
199
  ```bash
200
- # Automatic telemetry with Golf Platform
201
- export GOLF_API_KEY="your-key"
202
- golf run # ✅ Telemetry enabled automatically
200
+ # Enable OpenTelemetry tracing
201
+ export OTEL_TRACES_EXPORTER="otlp_http"
202
+ export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318/v1/traces"
203
+ golf run # ✅ Telemetry enabled
203
204
  ```
204
205
 
205
206
  **[📚 Complete Documentation →](https://docs.golf.dev)**
@@ -220,7 +221,7 @@ Basic configuration in `golf.json`:
220
221
  ```
221
222
 
222
223
  - **`transport`**: Choose `"sse"`, `"streamable-http"`, or `"stdio"`
223
- - **`opentelemetry_enabled`**: Auto-enabled with `GOLF_API_KEY`
224
+ - **`opentelemetry_enabled`**: Enable OpenTelemetry tracing
224
225
  - **`detailed_tracing`**: Capture input/output (use carefully with sensitive data)
225
226
 
226
227
 
@@ -157,9 +157,10 @@ from golf.utils import elicit, sample, get_context
157
157
  ```
158
158
 
159
159
  ```bash
160
- # Automatic telemetry with Golf Platform
161
- export GOLF_API_KEY="your-key"
162
- golf run # ✅ Telemetry enabled automatically
160
+ # Enable OpenTelemetry tracing
161
+ export OTEL_TRACES_EXPORTER="otlp_http"
162
+ export OTEL_EXPORTER_OTLP_ENDPOINT="http://localhost:4318/v1/traces"
163
+ golf run # ✅ Telemetry enabled
163
164
  ```
164
165
 
165
166
  **[📚 Complete Documentation →](https://docs.golf.dev)**
@@ -180,7 +181,7 @@ Basic configuration in `golf.json`:
180
181
  ```
181
182
 
182
183
  - **`transport`**: Choose `"sse"`, `"streamable-http"`, or `"stdio"`
183
- - **`opentelemetry_enabled`**: Auto-enabled with `GOLF_API_KEY`
184
+ - **`opentelemetry_enabled`**: Enable OpenTelemetry tracing
184
185
  - **`detailed_tracing`**: Capture input/output (use carefully with sensitive data)
185
186
 
186
187
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "golf-mcp"
7
- version = "0.2.9"
7
+ version = "0.2.12"
8
8
  description = "Framework for building MCP servers"
9
9
  authors = [
10
10
  {name = "Antoni Gmitruk", email = "antoni@golf.dev"}
@@ -28,7 +28,7 @@ classifiers = [
28
28
  dependencies = [
29
29
  "typer>=0.15.4",
30
30
  "rich>=14.0.0",
31
- "fastmcp>=2.11.0,<3.0.0",
31
+ "fastmcp==2.12.5",
32
32
  "pydantic>=2.11.0",
33
33
  "pydantic-settings>=2.0.0",
34
34
  "python-dotenv>=1.1.0",
@@ -66,7 +66,7 @@ golf = ["examples/**/*"]
66
66
 
67
67
  [tool.poetry]
68
68
  name = "golf-mcp"
69
- version = "0.2.9"
69
+ version = "0.2.12"
70
70
  description = "Framework for building MCP servers with zero boilerplate"
71
71
  authors = ["Antoni Gmitruk <antoni@golf.dev>"]
72
72
  license = "Apache-2.0"
@@ -79,16 +79,13 @@ classifiers = [
79
79
  "Intended Audience :: Developers",
80
80
  "Topic :: Software Development :: Libraries :: Python Modules",
81
81
  "Programming Language :: Python :: 3",
82
- "Programming Language :: Python :: 3.8",
83
- "Programming Language :: Python :: 3.9",
84
- "Programming Language :: Python :: 3.10",
85
82
  "Programming Language :: Python :: 3.11",
86
83
  "Programming Language :: Python :: 3.12"
87
84
  ]
88
85
 
89
86
  [tool.poetry.dependencies]
90
87
  python = ">=3.8" # Match requires-python
91
- fastmcp = ">=2.11.0,<3.0.0"
88
+ fastmcp = "==2.12.5"
92
89
  typer = {extras = ["all"], version = ">=0.15.4"}
93
90
  pydantic = ">=2.11.0"
94
91
  pydantic-settings = ">=2.0.0"
@@ -0,0 +1 @@
1
+ __version__ = "0.2.12"
@@ -32,11 +32,9 @@ from .registry import (
32
32
  # Re-export for backward compatibility
33
33
  from .api_key import configure_api_key, get_api_key_config, is_api_key_configured
34
34
  from .helpers import (
35
- debug_api_key_context,
36
35
  extract_token_from_header,
37
36
  get_api_key,
38
37
  get_auth_token,
39
- get_provider_token,
40
38
  set_api_key,
41
39
  )
42
40
 
@@ -70,11 +68,9 @@ __all__ = [
70
68
  "get_api_key_config",
71
69
  "is_api_key_configured",
72
70
  # Helper functions
73
- "debug_api_key_context",
74
71
  "extract_token_from_header",
75
72
  "get_api_key",
76
73
  "get_auth_token",
77
- "get_provider_token",
78
74
  "set_api_key",
79
75
  ]
80
76
 
@@ -1,26 +1,12 @@
1
1
  """Helper functions for working with authentication in MCP context."""
2
2
 
3
3
  from contextvars import ContextVar
4
- from typing import Any
5
4
 
6
- from starlette.requests import Request
7
5
 
8
6
  # Context variable to store the current request's API key
9
7
  _current_api_key: ContextVar[str | None] = ContextVar("current_api_key", default=None)
10
8
 
11
9
 
12
- def get_provider_token() -> str | None:
13
- """
14
- Get a provider token (legacy function - no longer supported in Golf 0.2.x).
15
-
16
- In Golf 0.2.x, use FastMCP's built-in auth providers for OAuth flows.
17
- This function returns None and is kept for backwards compatibility.
18
- """
19
- # Legacy OAuth provider support removed in Golf 0.2.x
20
- # Use FastMCP 2.11+ auth providers instead
21
- return None
22
-
23
-
24
10
  def extract_token_from_header(auth_header: str) -> str | None:
25
11
  """Extract bearer token from Authorization header.
26
12
 
@@ -123,25 +109,6 @@ def get_api_key() -> str | None:
123
109
  return None
124
110
 
125
111
 
126
- def get_api_key_from_request(request: Request) -> str | None:
127
- """Get the API key from a specific request object.
128
-
129
- This is useful when you have direct access to the request object.
130
-
131
- Args:
132
- request: The Starlette Request object
133
-
134
- Returns:
135
- The API key if available, None otherwise
136
- """
137
- # Check request state first (set by our middleware)
138
- if hasattr(request, "state") and hasattr(request.state, "api_key"):
139
- return request.state.api_key
140
-
141
- # Fall back to context variable
142
- return _current_api_key.get()
143
-
144
-
145
112
  def get_auth_token() -> str | None:
146
113
  """Get the authorization token from the current request context.
147
114
 
@@ -206,52 +173,3 @@ def get_auth_token() -> str | None:
206
173
  pass
207
174
 
208
175
  return None
209
-
210
-
211
- def debug_api_key_context() -> dict[str, Any]:
212
- """Debug function to inspect API key context.
213
-
214
- Returns a dictionary with debugging information about the current
215
- API key context. Useful for troubleshooting authentication issues.
216
-
217
- Returns:
218
- Dictionary with debug information
219
- """
220
- import asyncio
221
- import os
222
- import sys
223
-
224
- debug_info = {
225
- "context_var_value": _current_api_key.get(),
226
- "has_async_task": False,
227
- "task_id": None,
228
- "main_module_has_storage": False,
229
- "main_module_has_context": False,
230
- "request_id_from_context": None,
231
- "env_vars": {
232
- "API_KEY": bool(os.environ.get("API_KEY")),
233
- "GOLF_API_KEY_DEBUG": os.environ.get("GOLF_API_KEY_DEBUG", "false"),
234
- },
235
- }
236
-
237
- try:
238
- task = asyncio.current_task()
239
- if task:
240
- debug_info["has_async_task"] = True
241
- debug_info["task_id"] = id(task)
242
- except Exception:
243
- pass
244
-
245
- try:
246
- main_module = sys.modules.get("__main__")
247
- if main_module:
248
- debug_info["main_module_has_storage"] = hasattr(main_module, "api_key_storage")
249
- debug_info["main_module_has_context"] = hasattr(main_module, "request_id_context")
250
-
251
- if hasattr(main_module, "request_id_context"):
252
- request_id_context = main_module.request_id_context
253
- debug_info["request_id_from_context"] = request_id_context.get()
254
- except Exception:
255
- pass
256
-
257
- return debug_info
@@ -33,7 +33,6 @@ STATUS_ICONS = {
33
33
  "building": "🔨",
34
34
  "generating": "⚙️",
35
35
  "packaging": "📦",
36
- "platform": "⛳",
37
36
  "server": "🚀",
38
37
  "loading": "⭕",
39
38
  }
@@ -163,7 +162,7 @@ def get_status_text(status: str, message: str, style: str = "") -> Text:
163
162
  elif status == "warning":
164
163
  text.append("⚡ ", style=f"bold {GOLF_ORANGE}")
165
164
  text.append(f"{icon} {message}", style=f"bold {GOLF_ORANGE}")
166
- elif status in ["building", "generating", "packaging", "platform"]:
165
+ elif status in ["building", "generating", "packaging"]:
167
166
  text.append("🔥 ", style=f"bold {GOLF_ORANGE}")
168
167
  text.append(f"{icon} {message}", style=f"bold {GOLF_BLUE}")
169
168
  else:
@@ -167,11 +167,9 @@ def build_prod(
167
167
  ) -> None:
168
168
  """Build a production version for deployment.
169
169
 
170
- Golf credentials (GOLF_*) are always loaded from .env for build operations
171
- (platform registration, resource updates). App environment variables are
172
- NOT copied for security - provide them in your deployment environment.
173
-
174
- Your production deployment must include GOLF_* vars for runtime telemetry.
170
+ Environment variables from .env are loaded for build operations.
171
+ App environment variables are NOT copied for security - provide them
172
+ in your deployment environment.
175
173
  """
176
174
  # Find project root directory
177
175
  project_root, config_path = find_project_root()
@@ -5,7 +5,7 @@ import subprocess
5
5
  import sys
6
6
  from pathlib import Path
7
7
 
8
- from rich.console import Console
8
+ from rich.console import Console, Group
9
9
  from rich.panel import Panel
10
10
  from rich.align import Align
11
11
  from rich.text import Text
@@ -53,23 +53,35 @@ def run_server(
53
53
  server_host = host or settings.host or "localhost"
54
54
  server_port = port or settings.port or 3000
55
55
 
56
- server_content = Text()
57
- server_content.append("🚀 ", style=f"bold {GOLF_ORANGE}")
58
- server_content.append(f"{STATUS_ICONS['server']} Server starting on ", style=f"bold {GOLF_BLUE}")
59
- server_content.append(f"http://{server_host}:{server_port}", style=f"bold {GOLF_GREEN}")
60
- server_content.append(" 🚀", style=f"bold {GOLF_ORANGE}")
61
- server_content.append("\n")
56
+ # Create server URL line
57
+ server_line = Text()
58
+ server_line.append("🚀 ", style=f"bold {GOLF_ORANGE}")
59
+ server_line.append(f"{STATUS_ICONS['server']} Server starting on ", style=f"bold {GOLF_BLUE}")
60
+ server_line.append(f"http://{server_host}:{server_port}", style=f"bold {GOLF_GREEN}")
61
+
62
+ # Create content with proper alignment
63
+ content_lines = [
64
+ "", # Empty line at top
65
+ Align.center(server_line),
66
+ ]
62
67
 
63
68
  # Add telemetry status indicator
64
69
  if settings.opentelemetry_enabled:
65
- server_content.append("📊 Golf telemetry enabled", style=f"dim {GOLF_BLUE}")
66
- server_content.append("\n")
67
-
68
- server_content.append("⚡ Press Ctrl+C to stop ⚡", style=f"dim {GOLF_ORANGE}")
70
+ telemetry_line = Text("📊 OpenTelemetry enabled", style=f"dim {GOLF_BLUE}")
71
+ content_lines.append(Align.center(telemetry_line))
72
+
73
+ # Add empty line and stop instruction
74
+ content_lines.extend(
75
+ [
76
+ "", # Empty line before stop instruction
77
+ Align.center(Text("⚡ Press Ctrl+C to stop ⚡", style=f"dim {GOLF_ORANGE}")),
78
+ "", # Empty line at bottom
79
+ ]
80
+ )
69
81
 
70
82
  console.print(
71
83
  Panel(
72
- Align.center(server_content),
84
+ Group(*content_lines),
73
85
  border_style=GOLF_BLUE,
74
86
  padding=(1, 2),
75
87
  title="[bold]🌐 SERVER READY 🌐[/bold]",