Skip to main content
Glama

Employee Management MCP Server

by y735832496
deploy.py3.86 kB
#!/usr/bin/env python3 """ MCP服务器部署脚本 帮助用户快速部署员工管理系统MCP服务器 """ import os import sys import subprocess import shutil from pathlib import Path def check_python_version(): """检查Python版本""" print("🐍 检查Python版本...") version = sys.version_info if version.major < 3 or (version.major == 3 and version.minor < 8): print("❌ Python版本过低,需要Python 3.8或更高版本") return False print(f"✅ Python版本: {version.major}.{version.minor}.{version.micro}") return True def install_dependencies(): """安装依赖""" print("\n📦 安装项目依赖...") try: subprocess.run([sys.executable, "-m", "pip", "install", "-r", "requirements.txt"], check=True, capture_output=True, text=True) print("✅ 依赖安装成功") return True except subprocess.CalledProcessError as e: print(f"❌ 依赖安装失败: {e}") print(f"错误输出: {e.stderr}") return False def create_env_file(): """创建环境配置文件""" print("\n⚙️ 配置环境变量...") env_file = Path(".env") env_example = Path("env.example") if env_file.exists(): print("✅ .env文件已存在") return True if env_example.exists(): shutil.copy(env_example, env_file) print("✅ 已创建.env文件,请根据需要修改配置") return True else: print("❌ 未找到env.example文件") return False def check_backend_api(): """检查后端API服务""" print("\n🔍 检查后端API服务...") print("⚠️ 请确保后端API服务已启动 (http://localhost:10086)") print(" 如果后端服务地址不同,请修改.env文件中的MCP_API_BASE_URL") return True def run_tests(): """运行测试""" print("\n🧪 运行测试...") try: result = subprocess.run([sys.executable, "test_mcp_server.py"], capture_output=True, text=True) if result.returncode == 0: print("✅ 测试通过") return True else: print("❌ 测试失败") print(f"错误输出: {result.stderr}") return False except Exception as e: print(f"❌ 运行测试时出错: {e}") return False def show_usage(): """显示使用说明""" print("\n📖 使用说明") print("=" * 50) print("1. 启动MCP服务器:") print(" python start_server.py") print() print("2. 测试客户端连接:") print(" python client_example.py") print() print("3. 查看项目文档:") print(" cat README.md") print() print("4. 配置说明:") print(" - 修改.env文件中的MCP_API_BASE_URL指向您的后端API") print(" - 如需API认证,在.env中设置MCP_API_KEY") print(" - 修改MCP_HOST和MCP_PORT来改变服务器地址") print() print("🎉 部署完成!") def main(): """主函数""" print("🚀 MCP服务器部署脚本") print("=" * 50) # 检查Python版本 if not check_python_version(): sys.exit(1) # 安装依赖 if not install_dependencies(): sys.exit(1) # 创建环境配置 if not create_env_file(): sys.exit(1) # 检查后端API check_backend_api() # 运行测试 if not run_tests(): print("⚠️ 测试失败,但部署可以继续") # 显示使用说明 show_usage() if __name__ == "__main__": try: main() except KeyboardInterrupt: print("\n🛑 部署被用户中断") sys.exit(1) except Exception as e: print(f"❌ 部署过程中出现错误: {e}") sys.exit(1)

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/y735832496/mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server