golf-mcp 0.1.6__py3-none-any.whl → 0.1.8__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.6"
1
+ __version__ = "0.1.8"
golf/auth/api_key.py CHANGED
@@ -20,6 +20,10 @@ class ApiKeyConfig(BaseModel):
20
20
  "",
21
21
  description="Optional prefix to strip from the header value (e.g., 'Bearer ')"
22
22
  )
23
+ required: bool = Field(
24
+ True,
25
+ description="Whether API key is required for all requests"
26
+ )
23
27
 
24
28
 
25
29
  # Global configuration storage
@@ -28,7 +32,8 @@ _api_key_config: Optional[ApiKeyConfig] = None
28
32
 
29
33
  def configure_api_key(
30
34
  header_name: str = "X-API-Key",
31
- header_prefix: str = ""
35
+ header_prefix: str = "",
36
+ required: bool = True
32
37
  ) -> None:
33
38
  """Configure API key extraction from request headers.
34
39
 
@@ -37,21 +42,31 @@ def configure_api_key(
37
42
  Args:
38
43
  header_name: Name of the header containing the API key (default: "X-API-Key")
39
44
  header_prefix: Optional prefix to strip from the header value (e.g., "Bearer ")
40
- case_sensitive: Whether header name matching should be case-sensitive
45
+ required: Whether API key is required for all requests (default: True)
41
46
 
42
47
  Example:
43
48
  # In pre_build.py
44
49
  from golf.auth.api_key import configure_api_key
45
50
 
51
+ # Require API key for all requests
52
+ configure_api_key(
53
+ header_name="Authorization",
54
+ header_prefix="Bearer ",
55
+ required=True
56
+ )
57
+
58
+ # Or make API key optional (pass-through mode)
46
59
  configure_api_key(
47
60
  header_name="Authorization",
48
- header_prefix="Bearer "
61
+ header_prefix="Bearer ",
62
+ required=False
49
63
  )
50
64
  """
51
65
  global _api_key_config
52
66
  _api_key_config = ApiKeyConfig(
53
67
  header_name=header_name,
54
- header_prefix=header_prefix
68
+ header_prefix=header_prefix,
69
+ required=required
55
70
  )
56
71
 
57
72