Skip to main content
Glama

MCP PII Tools

by czangyeob
setup_env.py4.77 kB
#!/usr/bin/env python3 """ 환경변수 설정 도우미 스크립트 사용자가 쉽게 .env 파일을 생성할 수 있도록 도와줍니다. """ import os import secrets import sys def generate_master_key(): """안전한 마스터 키를 생성합니다.""" return secrets.token_urlsafe(32) def get_master_key(): """마스터 키를 입력받거나 기본값을 사용합니다.""" print("PII 암호화용 마스터 키를 설정하세요:") print("1. 자동 생성 (권장)") print("2. 기본값 사용 (pii_master_key_1!smartmind)") print("3. 직접 입력") choice = input("선택 (1, 2, 또는 3): ").strip() if choice == "2": return "pii_master_key_1!smartmind" elif choice == "3": master_key = input("마스터 키를 입력하세요 (32자 이상 권장): ").strip() if not master_key: print("❌ 마스터 키는 필수입니다. 기본값을 사용합니다.") return "pii_master_key_1!smartmind" return master_key else: # choice == "1" or default return generate_master_key() def setup_openai(): """OpenAI 설정을 위한 환경변수를 수집합니다.""" print("\n=== OpenAI 설정 ===") api_key = input("OpenAI API 키를 입력하세요: ").strip() if not api_key: print("❌ API 키는 필수입니다.") return None model_id = input("모델 ID를 입력하세요 (기본값: gpt-4o): ").strip() or "gpt-4o" return { "PII_PROVIDER": "openai", "OPENAI_API_KEY": api_key, "PII_MODEL_ID": model_id } def setup_vllm(): """vLLM 설정을 위한 환경변수를 수집합니다.""" print("\n=== vLLM 설정 ===") api_key = input("vLLM API 키를 입력하세요: ").strip() if not api_key: print("❌ API 키는 필수입니다.") return None base_url = input("vLLM 서버 URL을 입력하세요 (기본값: https://qwen.smartmind.team/v1): ").strip() or "https://qwen.smartmind.team/v1" model_id = input("모델 ID를 입력하세요 (기본값: qwen3-235b-awq): ").strip() or "qwen3-235b-awq" timeout = input("요청 타임아웃(초)을 입력하세요 (기본값: 600): ").strip() or "600" temperature = input("온도를 입력하세요 (기본값: 0.0): ").strip() or "0.0" max_tokens = input("최대 토큰 수를 입력하세요 (기본값: 4096): ").strip() or "4096" return { "PII_PROVIDER": "vllm", "VLLM_API_KEY": api_key, "VLLM_BASE_URL": base_url, "PII_MODEL_ID": model_id, "VLLM_TIMEOUT": timeout, "VLLM_TEMPERATURE": temperature, "VLLM_MAX_TOKENS": max_tokens } def main(): """메인 설정 함수""" print("🔧 MCP PII Tools 환경변수 설정") print("=" * 50) # 마스터 키 설정 master_key = get_master_key() if master_key == "pii_master_key_1!smartmind": print(f"✅ PII 마스터 키가 기본값으로 설정되었습니다: {master_key}") else: print(f"✅ PII 마스터 키가 설정되었습니다: {master_key[:8]}...") # Provider 선택 print("\n사용할 AI Provider를 선택하세요:") print("1. OpenAI (기본)") print("2. vLLM") choice = input("선택 (1 또는 2): ").strip() if choice == "2": config = setup_vllm() else: config = setup_openai() if not config: print("❌ 설정이 취소되었습니다.") return # 공통 설정 추가 config["PII_MASTER_KEY"] = master_key # .env 파일 생성 env_content = [] env_content.append("# MCP PII Tools 환경변수") env_content.append("# 이 파일은 자동으로 생성되었습니다.") env_content.append("") for key, value in config.items(): env_content.append(f"{key}={value}") env_content.append("") env_content.append("# 선택적 설정") env_content.append("# LOG_LEVEL=INFO") env_content.append("# PII_SENSITIVITY=0.8") # 파일 쓰기 try: with open(".env", "w", encoding="utf-8") as f: f.write("\n".join(env_content)) print(f"\n✅ .env 파일이 성공적으로 생성되었습니다!") print(f"📁 위치: {os.path.abspath('.env')}") print(f"🔧 Provider: {config['PII_PROVIDER'].upper()}") print(f"🤖 Model: {config['PII_MODEL_ID']}") print("\n🚀 이제 다음 명령으로 MCP 서버를 실행할 수 있습니다:") print(" uv run python mcp_pii_tools.py") except Exception as e: print(f"❌ .env 파일 생성 실패: {e}") if __name__ == "__main__": main()

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/czangyeob/mcp-pii-tools'

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