Spaces:
Sleeping
Sleeping
File size: 2,744 Bytes
551ad28 |
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 |
#!/usr/bin/env python3
"""
Verification script for MCP setup
"""
import os
import sys
import subprocess
def check_files():
"""Check that all MCP-related files exist."""
required_files = [
"mcp_server.py",
"docs/MCP_INTEGRATION.md",
"docs/MCP_IMPLEMENTATION_SUMMARY.md",
"examples/mcp_client_example.py",
"tests/test_mcp_server.py",
"tests/test_mcp_integration.py"
]
missing_files = []
for file in required_files:
if not os.path.exists(file):
missing_files.append(file)
if missing_files:
print("โ Missing files:")
for file in missing_files:
print(f" - {file}")
return False
else:
print("โ
All MCP-related files are present")
return True
def check_requirements():
"""Check that MCP is in requirements.txt."""
try:
with open("requirements.txt", "r") as f:
content = f.read()
if "mcp==" in content:
print("โ
MCP package is in requirements.txt")
return True
else:
print("โ MCP package is not in requirements.txt")
return False
except FileNotFoundError:
print("โ requirements.txt not found")
return False
def check_imports():
"""Check that MCP imports work."""
try:
# Try importing the main module using subprocess
result = subprocess.run(
[sys.executable, "-c", "import mcp; print('Success')"],
capture_output=True,
text=True
)
if result.returncode == 0:
print("โ
MCP imports work correctly")
return True
else:
print(f"โ MCP imports failed: {result.stderr}")
return False
except Exception as e:
print(f"โ MCP imports failed: {e}")
return False
def main():
"""Run all verification checks."""
print("Verifying MCP setup...")
print()
checks = [
("Files", check_files),
("Requirements", check_requirements),
("Imports", check_imports)
]
results = []
for name, check in checks:
print(f"Checking {name}...")
result = check()
results.append(result)
print()
if all(results):
print("๐ All MCP setup checks passed!")
print()
print("You can now start the MCP server with:")
print(" python mcp_server.py")
print()
print("Or start both servers with:")
print(" python start_with_mcp.py")
return 0
else:
print("โ Some MCP setup checks failed!")
return 1
if __name__ == "__main__":
sys.exit(main()) |