#!/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())