Merge pull request #252 from MiaoDX: Update MCP to use server_fastmcp with venv Python

This PR modernizes the MCP setup with comprehensive improvements:

**Key Improvements:**
 Virtual environment auto-detection (venv, .venv, $VIRTUAL_ENV)
 Module-based imports (python -m skill_seekers.mcp.server_fastmcp)
 Eliminates 'module not found' errors from missing dependencies
 No need for --break-system-packages or global installs
 Clean project isolation with venv
 Prepares for v3.0.0 when server.py will be removed

**Bug Fixes:**
🐛 Fixed 41 instances of server_fastmcp_fastmcp → server_fastmcp typo
🐛 Updated tests to accept -e ".[mcp]" format
🐛 Updated tests for module reference format

**Files Changed:** 13 files (+312/-154 lines)

**Testing:** All 1386 tests passing (verified)

Co-Authored-By: MiaoDX <miaodx@hotmail.com>
Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
yusyus
2026-01-18 13:39:20 +03:00
13 changed files with 234 additions and 76 deletions

View File

@@ -62,9 +62,11 @@ class TestSetupMCPScript:
def test_requirements_txt_path(self, script_content):
"""Test that script uses pip install -e . (v2.0.0 modern packaging)"""
# v2.0.0 uses '-e .' (editable install) instead of requirements files
# The actual command is "$PIP_INSTALL_CMD -e ."
assert " -e ." in script_content or " -e." in script_content, (
"Should use '-e .' for editable install (modern packaging)"
# v2.7.0 PR #252 uses '-e ".[mcp]"' with MCP extra dependencies
# The actual command is "$PIP_INSTALL_CMD -e ." or "$PIP_INSTALL_CMD -e ".[mcp]""
has_editable = " -e ." in script_content or " -e." in script_content or '-e ".' in script_content
assert has_editable, (
"Should use '-e .' or '-e \".[mcp]\"' for editable install (modern packaging)"
)
# Should NOT reference old requirements.txt paths
@@ -121,9 +123,10 @@ class TestSetupMCPScript:
def test_json_config_path_format(self, script_content):
"""Test that JSON config examples use correct format (v2.4.0 MCP 2025 upgrade)"""
# MCP 2025 uses module import: python3 -m skill_seekers.mcp.server_fastmcp
# Config should show the server_fastmcp.py path for stdio examples
assert "server_fastmcp.py" in script_content, (
"Config should reference server_fastmcp.py (MCP 2025 upgrade)"
# v2.7.0 PR #252 uses module reference format, not file path
# Config should show the module reference: skill_seekers.mcp.server_fastmcp
assert "skill_seekers.mcp.server_fastmcp" in script_content, (
"Config should reference skill_seekers.mcp.server_fastmcp module (MCP 2025 upgrade)"
)
def test_no_hardcoded_paths(self, script_content):