golf-mcp 0.1.20__py3-none-any.whl → 0.2.0__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 +9 -1
- golf/_endpoints.py +6 -0
- golf/_endpoints_fallback.py +10 -0
- golf/auth/__init__.py +188 -84
- golf/auth/api_key.py +6 -14
- golf/auth/factory.py +333 -0
- golf/auth/helpers.py +12 -42
- golf/auth/providers.py +396 -0
- golf/auth/registry.py +256 -0
- golf/cli/branding.py +192 -0
- golf/cli/main.py +28 -69
- golf/commands/__init__.py +2 -0
- golf/commands/build.py +4 -7
- golf/commands/init.py +30 -53
- golf/commands/run.py +50 -20
- golf/core/builder.py +355 -414
- golf/core/builder_auth.py +63 -144
- golf/core/builder_telemetry.py +26 -3
- golf/core/config.py +38 -59
- golf/core/parser.py +132 -139
- golf/core/platform.py +12 -10
- golf/core/telemetry.py +11 -19
- golf/core/transformer.py +38 -15
- golf/examples/__pycache__/__init__.cpython-311.pyc +0 -0
- golf/examples/basic/.coverage +0 -0
- golf/examples/basic/.env.example +8 -4
- golf/examples/basic/README.md +117 -45
- golf/examples/basic/__pycache__/auth.cpython-311.pyc +0 -0
- golf/examples/basic/auth.py +76 -0
- golf/examples/basic/golf.json +2 -5
- golf/examples/basic/htmlcov/.gitignore +2 -0
- golf/examples/basic/htmlcov/class_index.html +547 -0
- golf/examples/basic/htmlcov/coverage_html_cb_6fb7b396.js +733 -0
- golf/examples/basic/htmlcov/favicon_32_cb_58284776.png +0 -0
- golf/examples/basic/htmlcov/function_index.html +2091 -0
- golf/examples/basic/htmlcov/index.html +349 -0
- golf/examples/basic/htmlcov/keybd_closed_cb_ce680311.png +0 -0
- golf/examples/basic/htmlcov/status.json +1 -0
- golf/examples/basic/htmlcov/style_cb_8e611ae1.css +337 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496___init___py.html +323 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_api_key_py.html +170 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_factory_py.html +430 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_helpers_py.html +288 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_providers_py.html +493 -0
- golf/examples/basic/htmlcov/z_1c9a91c0e91c8496_registry_py.html +353 -0
- golf/examples/basic/htmlcov/z_3ec3b3f490dc0950___init___py.html +120 -0
- golf/examples/basic/htmlcov/z_3ec3b3f490dc0950_instrumentation_py.html +1535 -0
- golf/examples/basic/htmlcov/z_4b8b9dd4ccccc5db___init___py.html +98 -0
- golf/examples/basic/htmlcov/z_4b8b9dd4ccccc5db_branding_py.html +289 -0
- golf/examples/basic/htmlcov/z_4b8b9dd4ccccc5db_main_py.html +476 -0
- golf/examples/basic/htmlcov/z_5a6c4e6bcc86fb2f___init___py.html +97 -0
- golf/examples/basic/htmlcov/z_6cadab9ec0df475d___init___py.html +102 -0
- golf/examples/basic/htmlcov/z_6cadab9ec0df475d_build_py.html +178 -0
- golf/examples/basic/htmlcov/z_6cadab9ec0df475d_init_py.html +387 -0
- golf/examples/basic/htmlcov/z_6cadab9ec0df475d_run_py.html +222 -0
- golf/examples/basic/htmlcov/z_6fcdee0582ba84e4___init___py.html +106 -0
- golf/examples/basic/htmlcov/z_6fcdee0582ba84e4__endpoints_fallback_py.html +107 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217___init___py.html +98 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_builder_auth_py.html +306 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_builder_metrics_py.html +329 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_builder_py.html +1471 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_builder_telemetry_py.html +186 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_config_py.html +315 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_parser_py.html +1149 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_platform_py.html +279 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_telemetry_py.html +589 -0
- golf/examples/basic/htmlcov/z_7ba499ed22986217_transformer_py.html +286 -0
- golf/examples/basic/htmlcov/z_7d7da37693a43688___init___py.html +107 -0
- golf/examples/basic/htmlcov/z_7d7da37693a43688_collector_py.html +417 -0
- golf/examples/basic/htmlcov/z_7d7da37693a43688_registry_py.html +109 -0
- golf/examples/basic/htmlcov/z_abe733142b40ad4e___init___py.html +109 -0
- golf/examples/basic/htmlcov/z_abe733142b40ad4e_context_py.html +150 -0
- golf/examples/basic/htmlcov/z_abe733142b40ad4e_elicitation_py.html +267 -0
- golf/examples/basic/htmlcov/z_abe733142b40ad4e_sampling_py.html +318 -0
- golf/examples/basic/prompts/__pycache__/welcome.cpython-311.pyc +0 -0
- golf/examples/basic/prompts/welcome.py +3 -5
- golf/examples/basic/resources/__pycache__/current_time.cpython-311.pyc +0 -0
- golf/examples/basic/resources/__pycache__/info.cpython-311.pyc +0 -0
- golf/examples/basic/resources/current_time.py +5 -13
- golf/examples/basic/resources/weather/__pycache__/common.cpython-311.pyc +0 -0
- golf/examples/basic/resources/weather/__pycache__/current.cpython-311.pyc +0 -0
- golf/examples/basic/resources/weather/__pycache__/forecast.cpython-311.pyc +0 -0
- golf/examples/basic/resources/weather/city.py +46 -0
- golf/examples/basic/resources/weather/common.py +4 -11
- golf/examples/basic/resources/weather/current.py +5 -5
- golf/examples/basic/resources/weather/forecast.py +5 -5
- golf/examples/basic/tools/__pycache__/calculator.cpython-311.pyc +0 -0
- golf/examples/basic/tools/calculator.py +94 -0
- golf/examples/basic/tools/say/__pycache__/hello.cpython-311.pyc +0 -0
- golf/examples/basic/tools/say/hello.py +65 -0
- golf/metrics/collector.py +100 -19
- golf/telemetry/__init__.py +4 -0
- golf/telemetry/instrumentation.py +484 -178
- golf/utilities/__init__.py +12 -0
- golf/utilities/context.py +53 -0
- golf/utilities/elicitation.py +170 -0
- golf/utilities/sampling.py +221 -0
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.0.dist-info}/METADATA +51 -104
- golf_mcp-0.2.0.dist-info/RECORD +110 -0
- golf/auth/oauth.py +0 -861
- golf/auth/provider.py +0 -115
- golf/examples/api_key/.env +0 -2
- golf/examples/api_key/.env.example +0 -1
- golf/examples/api_key/README.md +0 -84
- golf/examples/api_key/golf.json +0 -8
- golf/examples/api_key/pre_build.py +0 -11
- golf/examples/api_key/tools/issues/create.py +0 -93
- golf/examples/api_key/tools/issues/list.py +0 -92
- golf/examples/api_key/tools/repos/list.py +0 -111
- golf/examples/api_key/tools/search/code.py +0 -106
- golf/examples/api_key/tools/users/get.py +0 -82
- golf/examples/basic/.env +0 -5
- golf/examples/basic/pre_build.py +0 -28
- golf/examples/basic/tools/github_user.py +0 -65
- golf/examples/basic/tools/hello.py +0 -34
- golf/examples/basic/tools/payments/charge.py +0 -70
- golf/examples/basic/tools/payments/common.py +0 -36
- golf/examples/basic/tools/payments/refund.py +0 -61
- golf_mcp-0.1.20.dist-info/RECORD +0 -60
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.0.dist-info}/WHEEL +0 -0
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.0.dist-info}/entry_points.txt +0 -0
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.0.dist-info}/licenses/LICENSE +0 -0
- {golf_mcp-0.1.20.dist-info → golf_mcp-0.2.0.dist-info}/top_level.txt +0 -0
golf/commands/run.py
CHANGED
|
@@ -6,7 +6,11 @@ import sys
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
|
|
8
8
|
from rich.console import Console
|
|
9
|
+
from rich.panel import Panel
|
|
10
|
+
from rich.align import Align
|
|
11
|
+
from rich.text import Text
|
|
9
12
|
|
|
13
|
+
from golf.cli.branding import create_command_header, get_status_text, STATUS_ICONS, GOLF_BLUE, GOLF_GREEN, GOLF_ORANGE
|
|
10
14
|
from golf.core.config import Settings
|
|
11
15
|
|
|
12
16
|
console = Console()
|
|
@@ -24,7 +28,8 @@ def run_server(
|
|
|
24
28
|
Args:
|
|
25
29
|
project_path: Path to the project root
|
|
26
30
|
settings: Project settings
|
|
27
|
-
dist_dir: Path to the directory containing the built server
|
|
31
|
+
dist_dir: Path to the directory containing the built server
|
|
32
|
+
(defaults to project_path/dist)
|
|
28
33
|
host: Host to bind the server to (overrides settings)
|
|
29
34
|
port: Port to bind the server to (overrides settings)
|
|
30
35
|
|
|
@@ -38,11 +43,41 @@ def run_server(
|
|
|
38
43
|
# Check if server file exists
|
|
39
44
|
server_path = dist_dir / "server.py"
|
|
40
45
|
if not server_path.exists():
|
|
41
|
-
console.print(
|
|
42
|
-
f"[bold red]Error: Server file {server_path} not found.[/bold red]"
|
|
43
|
-
)
|
|
46
|
+
console.print(get_status_text("error", f"Server file {server_path} not found"))
|
|
44
47
|
return 1
|
|
45
48
|
|
|
49
|
+
# Display server startup header
|
|
50
|
+
create_command_header("Starting Server", f"{settings.name}", console)
|
|
51
|
+
|
|
52
|
+
# Show server info with flashy styling
|
|
53
|
+
server_host = host or settings.host or "localhost"
|
|
54
|
+
server_port = port or settings.port or 3000
|
|
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")
|
|
62
|
+
|
|
63
|
+
# Add telemetry status indicator
|
|
64
|
+
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}")
|
|
69
|
+
|
|
70
|
+
console.print(
|
|
71
|
+
Panel(
|
|
72
|
+
Align.center(server_content),
|
|
73
|
+
border_style=GOLF_BLUE,
|
|
74
|
+
padding=(1, 2),
|
|
75
|
+
title="[bold]🌐 SERVER READY 🌐[/bold]",
|
|
76
|
+
title_align="center",
|
|
77
|
+
)
|
|
78
|
+
)
|
|
79
|
+
console.print()
|
|
80
|
+
|
|
46
81
|
# Prepare environment variables
|
|
47
82
|
env = os.environ.copy()
|
|
48
83
|
if host is not None:
|
|
@@ -65,31 +100,26 @@ def run_server(
|
|
|
65
100
|
)
|
|
66
101
|
|
|
67
102
|
# Provide more context about the exit
|
|
103
|
+
console.print()
|
|
68
104
|
if process.returncode == 0:
|
|
69
|
-
console.print("
|
|
105
|
+
console.print(get_status_text("success", "Server stopped successfully"))
|
|
70
106
|
elif process.returncode == 130:
|
|
71
|
-
console.print("
|
|
107
|
+
console.print(get_status_text("info", "Server stopped by user interrupt (Ctrl+C)"))
|
|
72
108
|
elif process.returncode == 143:
|
|
73
|
-
console.print(
|
|
74
|
-
"[yellow]Server stopped by SIGTERM (graceful shutdown)[/yellow]"
|
|
75
|
-
)
|
|
109
|
+
console.print(get_status_text("info", "Server stopped by SIGTERM (graceful shutdown)"))
|
|
76
110
|
elif process.returncode == 137:
|
|
77
|
-
console.print(
|
|
78
|
-
"[yellow]Server stopped by SIGKILL (forced shutdown)[/yellow]"
|
|
79
|
-
)
|
|
111
|
+
console.print(get_status_text("warning", "Server stopped by SIGKILL (forced shutdown)"))
|
|
80
112
|
elif process.returncode in [1, 2]:
|
|
81
|
-
console.print(
|
|
82
|
-
f"[red]Server exited with error code {process.returncode}[/red]"
|
|
83
|
-
)
|
|
113
|
+
console.print(get_status_text("error", f"Server exited with error code {process.returncode}"))
|
|
84
114
|
else:
|
|
85
|
-
console.print(
|
|
86
|
-
f"[orange]Server exited with code {process.returncode}[/orange]"
|
|
87
|
-
)
|
|
115
|
+
console.print(get_status_text("warning", f"Server exited with code {process.returncode}"))
|
|
88
116
|
|
|
89
117
|
return process.returncode
|
|
90
118
|
except KeyboardInterrupt:
|
|
91
|
-
console.print(
|
|
119
|
+
console.print()
|
|
120
|
+
console.print(get_status_text("info", "Server stopped by user (Ctrl+C)"))
|
|
92
121
|
return 130 # Standard exit code for SIGINT
|
|
93
122
|
except Exception as e:
|
|
94
|
-
console.print(
|
|
123
|
+
console.print()
|
|
124
|
+
console.print(get_status_text("error", f"Error running server: {e}"))
|
|
95
125
|
return 1
|