-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathverify_setup.py
More file actions
112 lines (92 loc) · 3.5 KB
/
verify_setup.py
File metadata and controls
112 lines (92 loc) · 3.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
#!/usr/bin/env python3
"""
Verify MCP development environment setup.
Checks that all required dependencies are installed and working.
"""
import importlib
import sys
from typing import Tuple
def check_import(module_name: str, description: str = "") -> Tuple[bool, str]:
"""Check if a module can be imported."""
try:
importlib.import_module(module_name)
return True, f"✅ {module_name} - {description}"
except ImportError as e:
return False, f"❌ {module_name} - {description} - Error: {e}"
def main():
"""Main verification function."""
print("🔍 Verifying MCP Development Environment Setup")
print("=" * 60)
# Core dependencies we actually use
dependencies = [
("fastapi", "Web framework for HTTP endpoints"),
("uvicorn", "ASGI server for FastAPI"),
("httpx", "HTTP client for async requests"),
("pydantic", "Data validation and serialization"),
("mcp", "Official MCP SDK"),
("mcp.client", "MCP client functionality"),
("mcp.types", "MCP type definitions"),
("pytest", "Testing framework"),
("black", "Code formatter"),
("isort", "Import sorter"),
("flake8", "Linting tool"),
]
print("\n📦 Checking Core Dependencies:")
print("-" * 40)
all_good = True
for module, desc in dependencies:
success, message = check_import(module, desc)
print(message)
if not success:
all_good = False
# Test MCP functionality
print("\n🧪 Testing MCP Functionality:")
print("-" * 40)
try:
# Test MCP types
from mcp import types
types.CallToolRequest(
method="tools/call",
params=types.CallToolRequestParams(
name="test_tool", arguments={"test": "value"}
),
)
print("✅ MCP types - Can create CallToolRequest")
# Test our MCP service imports
try:
from mcp_service import data, models # noqa: F401
print("✅ MCP Service - Core modules import successfully")
except ImportError as e:
print(f"❌ MCP Service - Import error: {e}")
all_good = False
# Test data functions
try:
from mcp_service.data import search_products
results = search_products("iPhone")
if results:
count = len(results)
print(
f"✅ MCP Service - Data functions work " f"(found {count} products)"
)
else:
print("⚠️ MCP Service - Data functions work " "but no products found")
except Exception as e:
print(f"❌ MCP Service - Data function error: {e}")
all_good = False
except ImportError as e:
print(f"❌ MCP functionality test failed: {e}")
all_good = False
print("\n" + "=" * 60)
if all_good:
print("✅ All dependencies installed and working correctly!")
print("🚀 Your devcontainer is ready for MCP development")
print("\nQuick start commands:")
print(" python -m mcp_service # Start MCP server")
print(" python mcp_client_example.py # Test MCP client")
print(" python -m pytest tests/ # Run test suite")
else:
print("❌ Some dependencies are missing or not working properly")
print("🔧 Check the error messages above and install missing packages")
return 0 if all_good else 1
if __name__ == "__main__":
sys.exit(main())