Skip to main content
Glama
demo_workflow.pyβ€’8.46 kB
#!/usr/bin/env python3 """ 🎯 Complete POEditor MCP System Demo Demonstrates a typical workflow using the POEditor MCP server """ import asyncio import subprocess import sys from pathlib import Path from datetime import datetime async def run_command(command: str, description: str): """Execute command and show result.""" print(f"\n{'='*60}") print(f"πŸš€ {description}") print('='*60) print(f"πŸ’» Command: {command}") print() try: # Execute command result = subprocess.run( command.split(), capture_output=True, text=True, timeout=60 ) if result.returncode == 0: print(result.stdout) print("βœ… Command executed successfully") else: print("❌ Execution error:") print(result.stderr) except subprocess.TimeoutExpired: print("⏰ Command timed out") except Exception as e: print(f"❌ Error executing command: {e}") # Pause for reading input("\nπŸ“– Press Enter to continue...") async def demo_workflow(): """Demo of complete workflow.""" print("🎯 COMPLETE WORKFLOW DEMO") print("=" * 60) print("This demo simulates a typical day working with POEditor MCP:") print("1. πŸŒ… Initial setup") print("2. πŸ” Morning monitoring") print("3. πŸ“Š Daily reports") print("4. πŸ€– Translation automation") print("5. πŸ“ˆ Workflow optimization") print("6. πŸ“¦ Export for developers") print() response = input("Continue with demo? (y/N): ").lower().strip() if response not in ['y', 'yes']: print("Demo cancelled.") return # Change to scripts directory scripts_dir = Path(__file__).parent print(f"πŸ“ Working directory: {scripts_dir}") # 1. Check MCP server status await run_command( "python -m mcp_poeditor --help", "1. πŸ”§ MCP Server Status Check" ) # 2. Run basic example await run_command( "python examples/basic_usage.py", "2. 🚨 Basic Usage Example" ) print(f"\n{'='*60}") print("πŸŽ‰ DEMO COMPLETED!") print('='*60) print("πŸ“Š Available directories:") # List available directories output_dirs = ["logs", "reports", "exports", "examples", "docs"] for dir_name in output_dirs: dir_path = scripts_dir / dir_name if dir_path.exists(): files = list(dir_path.glob("*")) if files: print(f"\nπŸ“ {dir_name}/:") for file in files[:3]: # First 3 files if file.is_file(): size = file.stat().st_size / 1024 print(f" πŸ“„ {file.name} ({size:.1f} KB)") print("\nπŸ’‘ RECOMMENDED NEXT STEPS:") print(" 1. πŸ“§ Configure notifications (SMTP/Slack)") print(" 2. πŸ•’ Set up automatic scheduling (cron)") print(" 3. 🎯 Customize thresholds for your project") print(" 4. πŸ“± Integrate exports with your CI/CD") print("\nπŸ”— USEFUL LINKS:") print(" β€’ πŸ“– Documentation: docs/INSTALLATION.md") print(" β€’ βš™οΈ Configuration: .env.template") print(" β€’ πŸ“Š Examples: examples/") print(" β€’ πŸ—‚οΈ Logs: logs/") async def demo_api_usage(): """Demo direct MCP API usage.""" print("\n" + "="*60) print("🌐 DIRECT MCP API USAGE DEMO") print("="*60) print("Running some MCP commands directly...") # Use the basic example try: await run_command( "python examples/basic_usage.py", "Running Basic Usage Example" ) except Exception as e: print(f"❌ Error running API demo: {e}") print("πŸ’‘ Make sure the MCP server is working properly") def show_project_structure(): """Show project structure.""" print("\n" + "="*60) print("πŸ“ POEDITOR MCP PROJECT STRUCTURE") print("="*60) structure = """ poeditor-mcp/ β”œβ”€β”€ πŸ“„ README.md # Main documentation β”œβ”€β”€ πŸ“„ requirements.txt # Python dependencies β”œβ”€β”€ πŸ“„ setup.py # Automated setup script β”œβ”€β”€ πŸ“„ .env.template # Environment template β”œβ”€β”€ πŸ“„ LICENSE # MIT License β”‚ β”œβ”€β”€ πŸ“ mcp_poeditor/ # Main MCP package β”‚ β”œβ”€β”€ πŸ“„ __init__.py β”‚ β”œβ”€β”€ πŸ“„ __main__.py # Entry point β”‚ β”œβ”€β”€ πŸ“„ server.py # MCP server β”‚ β”œβ”€β”€ πŸ“„ poeditor_client.py # POEditor API client β”‚ β”‚ β”‚ β”œβ”€β”€ πŸ“ tools/ # MCP tools β”‚ β”‚ β”œβ”€β”€ πŸ“„ projects.py # Project management β”‚ β”‚ β”œβ”€β”€ πŸ“„ languages.py # Language management β”‚ β”‚ β”œβ”€β”€ πŸ“„ terms.py # Term management β”‚ β”‚ β”œβ”€β”€ πŸ“„ translations.py # Translation management β”‚ β”‚ └── πŸ“„ stats.py # Statistics β”‚ β”‚ β”‚ └── πŸ“ utils/ # Utilities β”‚ β”œβ”€β”€ πŸ“„ config.py # Configuration β”‚ └── πŸ“„ helpers.py # Helper functions β”‚ β”œβ”€β”€ πŸ“ examples/ # πŸ“š USAGE EXAMPLES β”‚ └── πŸ“„ basic_usage.py # Basic usage example β”‚ β”œβ”€β”€ πŸ“ docs/ # πŸ“– DOCUMENTATION β”‚ └── πŸ“„ INSTALLATION.md # Installation guide β”‚ β”œβ”€β”€ πŸ“ scripts/ # πŸ› οΈ AUTOMATION SCRIPTS β”‚ └── πŸ“„ demo_workflow.py # This demo script β”‚ β”œβ”€β”€ πŸ“ logs/ # Execution logs (created by setup) β”œβ”€β”€ πŸ“ reports/ # Generated reports (created by setup) β”œβ”€β”€ πŸ“ exports/ # Mass exports (created by setup) └── πŸ“ backups/ # Automatic backups (created by setup) """ print(structure) print("🎯 MAIN FEATURES:") print(" β€’ πŸ”Œ Complete MCP server for POEditor") print(" β€’ πŸ› οΈ Full API client with all endpoints") print(" β€’ πŸ“Š Rich tool set for translation management") print(" β€’ 🚨 Professional project structure") print(" β€’ πŸ€– Automated setup and configuration") print(" β€’ πŸ“§ Extensible for notifications and automation") print(" β€’ πŸ•’ Ready for CI/CD integration") print(" β€’ πŸ“¦ Professional packaging and documentation") async def main(): """Main demo function.""" print("🎯 COMPLETE DEMO - POEDITOR MCP SYSTEM") print("=" * 60) print("Welcome to the complete POEditor automation system!") print() while True: print("\nπŸŽ›οΈ AVAILABLE OPTIONS:") print(" 1. πŸ“ View project structure") print(" 2. 🎯 Complete workflow demo") print(" 3. 🌐 Direct MCP API usage demo") print(" 4. πŸ†˜ Help and documentation") print(" 5. πŸšͺ Exit") choice = input("\nπŸ”’ Select an option (1-5): ").strip() if choice == "1": show_project_structure() elif choice == "2": await demo_workflow() elif choice == "3": await demo_api_usage() elif choice == "4": print("\nπŸ“– HELP AND DOCUMENTATION:") print(" β€’ Main README: README.md") print(" β€’ Installation: docs/INSTALLATION.md") print(" β€’ Basic usage: examples/basic_usage.py") print(" β€’ Configuration: .env.template") print("\nπŸ”§ SETUP:") print(" β€’ Run: python setup.py") print(" β€’ Configure: edit .env file") print(" β€’ Test: python examples/basic_usage.py") elif choice == "5": print("\nπŸ‘‹ Thanks for using POEditor MCP!") print("🌟 Hope you enjoy translation automation") break else: print("❌ Invalid option. Please select 1-5.") if __name__ == "__main__": try: asyncio.run(main()) except KeyboardInterrupt: print("\n\nπŸ‘‹ Demo interrupted. See you later!") except Exception as e: print(f"\n❌ Demo error: {e}") sys.exit(1)

Latest Blog Posts

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/r-pedraza/poeditor-mcp'

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