Skip to content

Commit 25200da

Browse files
committed
feat(python): reads version from tag
1 parent 470d1c6 commit 25200da

File tree

3 files changed

+14
-7
lines changed

3 files changed

+14
-7
lines changed

python/kubernetes_mcp_server/kubernetes_mcp_server.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@
77
import tempfile
88
import urllib.request
99

10+
if sys.version_info >= (3, 8):
11+
from importlib.metadata import version
12+
else:
13+
from importlib_metadata import version
14+
15+
__version__ = version("kubernetes-mcp-server")
16+
1017
def get_platform_binary():
1118
"""Determine the correct binary for the current platform."""
1219
system = platform.system().lower()
@@ -29,11 +36,11 @@ def get_platform_binary():
2936
else:
3037
raise RuntimeError(f"Unsupported operating system: {system}")
3138

32-
def download_binary(version="latest", destination=None):
39+
def download_binary(binary_version="latest", destination=None):
3340
"""Download the correct binary for the current platform."""
3441
binary_name = get_platform_binary()
3542
if destination is None:
36-
destination = Path.home() / ".kubernetes-mcp-server" / "bin"
43+
destination = Path.home() / ".kubernetes-mcp-server" / "bin" / binary_version
3744

3845
destination = Path(destination)
3946
destination.mkdir(parents=True, exist_ok=True)
@@ -43,10 +50,10 @@ def download_binary(version="latest", destination=None):
4350
return binary_path
4451

4552
base_url = "https://github.com/manusa/kubernetes-mcp-server/releases"
46-
if version == "latest":
53+
if binary_version == "latest":
4754
release_url = f"{base_url}/latest/download/{binary_name}"
4855
else:
49-
release_url = f"{base_url}/download/{version}/{binary_name}"
56+
release_url = f"{base_url}/download/v{binary_version}/{binary_name}"
5057

5158
# Download the binary
5259
print(f"Downloading {binary_name} from {release_url}")
@@ -71,7 +78,7 @@ def execute(args=None):
7178
args = []
7279

7380
try:
74-
binary_path = download_binary()
81+
binary_path = download_binary(binary_version=__version__)
7582
cmd = [str(binary_path)] + args
7683

7784
# Execute the binary with the provided arguments

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
44

55
[project]
66
name = "kubernetes-mcp-server"
7-
version = "0.0.21-7-g869ebc2"
7+
version = "0.0.0"
88
description = "Kubernetes MCP Server (Model Context Protocol) with special support for OpenShift"
99
readme = {file="README.md", content-type="text/markdown"}
1010
requires-python = ">=3.6"

python/uv.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)