From fd0ec696670d74bc93cb791acc4353a23be5ada1 Mon Sep 17 00:00:00 2001 From: Peter Jausovec Date: Tue, 3 Mar 2026 11:15:32 -0800 Subject: [PATCH] pin down python dependencies Signed-off-by: Peter Jausovec --- .../python/templates/.python-version.tmpl | 2 +- .../python/templates/pyproject.toml.tmpl | 22 +++++++++---------- .../python/templates/src/core/server.py.tmpl | 8 ++++--- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/pkg/cli/internal/frameworks/python/templates/.python-version.tmpl b/pkg/cli/internal/frameworks/python/templates/.python-version.tmpl index 4b7e483..fdcfcfd 100644 --- a/pkg/cli/internal/frameworks/python/templates/.python-version.tmpl +++ b/pkg/cli/internal/frameworks/python/templates/.python-version.tmpl @@ -1 +1 @@ -3.11 \ No newline at end of file +3.12 \ No newline at end of file diff --git a/pkg/cli/internal/frameworks/python/templates/pyproject.toml.tmpl b/pkg/cli/internal/frameworks/python/templates/pyproject.toml.tmpl index 664cd06..cd4998b 100644 --- a/pkg/cli/internal/frameworks/python/templates/pyproject.toml.tmpl +++ b/pkg/cli/internal/frameworks/python/templates/pyproject.toml.tmpl @@ -12,12 +12,12 @@ description = "{{.ProjectName}} MCP server built with FastMCP" {name = "Unknown Author"} ]{{end}}{{end}} readme = "README.md" -requires-python = ">=3.10" +requires-python = ">=3.12" dependencies = [ - "fastmcp>=0.2.0", - "pydantic>=2.0.0", - "pyyaml>=6.0", - "python-dotenv>=1.0.0", + "fastmcp==3.0.0", + "pydantic==2.12.5", + "pyyaml==6.0.3", + "python-dotenv==1.2.1", ] [build-system] @@ -35,12 +35,12 @@ start = "src.main:start" [tool.uv] dev-dependencies = [ - "pytest>=7.0.0", - "pytest-asyncio>=0.21.0", - "black>=22.0.0", - "mypy>=1.0.0", - "ruff>=0.1.0", - "types-PyYAML>=6.0.0", + "pytest==9.0.2", + "pytest-asyncio==1.3.0", + "black==26.1.0", + "mypy==1.19.1", + "ruff==0.15.1", + "types-PyYAML==6.0.12.20250915", ] [tool.black] diff --git a/pkg/cli/internal/frameworks/python/templates/src/core/server.py.tmpl b/pkg/cli/internal/frameworks/python/templates/src/core/server.py.tmpl index b6d2c41..dc298f7 100644 --- a/pkg/cli/internal/frameworks/python/templates/src/core/server.py.tmpl +++ b/pkg/cli/internal/frameworks/python/templates/src/core/server.py.tmpl @@ -4,6 +4,7 @@ This server automatically discovers and loads tools from the tools directory. Each tool file should contain a function decorated with @mcp.tool(). """ +import asyncio import importlib.util import logging import sys @@ -75,14 +76,14 @@ class DynamicMCPServer: for tool_file in tool_files: try: # Get the number of tools before importing - tools_before = len(self.mcp._tool_manager._tools) + tools_before = len(asyncio.run(self.mcp.list_tools())) # Simply import the module - tools auto-register via @mcp.tool() # decorator tool_name = tool_file.stem if self._import_tool_module(tool_file, tool_name): # Check if any tools were actually registered - tools_after = len(self.mcp._tool_manager._tools) + tools_after = len(asyncio.run(self.mcp.list_tools())) if tools_after > tools_before: self.loaded_tools.append(tool_name) loaded_count += 1 @@ -143,7 +144,8 @@ class DynamicMCPServer: """Get tools synchronously for testing purposes.""" # This is a simplified version for testing - in real usage, use get_tools() # async - return self.mcp._tool_manager._tools + tools_list = asyncio.run(self.mcp.list_tools()) + return {t.name: t for t in tools_list} def run(self, transport_mode: str = "stdio", host: str = "localhost", port: int = 3000) -> None: """Run the FastMCP server.