# MCP Clients
This folder contains various MCP (Model Context Protocol) client implementations that demonstrate different aspects of automation with the Cheat Engine Server.
## ๐ Client Structure
```
clients/
โโโ __init__.py # Package initialization
โโโ README.md # This documentation
โโโ simple_client.py # Basic MCP client implementation
โโโ enhanced_client.py # Advanced client with comprehensive features
โโโ reliable_client.py # Focused on working automation
โโโ working_client.py # Demonstrates successful workflow
โโโ complete_client.py # Final comprehensive implementation
```
## ๐ Client Types
### 1. Simple Client (`simple_client.py`)
**Purpose**: Basic MCP client with fundamental automation
**Features**:
- Basic GUI automation using PyAutoGUI integration
- Simple memory scanning capabilities
- Process management
- Fundamental error handling
**Use Case**: Learning and understanding basic MCP automation concepts
### 2. Enhanced Client (`enhanced_client.py`)
**Purpose**: Advanced client with comprehensive error handling and features
**Features**:
- Advanced memory scanning with multiple encodings
- Comprehensive error handling and recovery
- Enhanced process management
- Detailed logging and reporting
- Multiple scanning strategies
**Use Case**: Production-ready automation with robust error handling
### 3. Reliable Client (`reliable_client.py`)
**Purpose**: Focused on working automation with memory scanning
**Features**:
- Streamlined automation workflow
- Simple but effective memory scanning
- Windows API integration
- Reliable process operations
- Clear success/failure reporting
**Use Case**: Proven working automation for consistent results
### 4. Working Client (`working_client.py`)
**Purpose**: Demonstrates successful MCP automation workflow
**Features**:
- Complete automation demonstration
- Process memory analysis
- UTF-16 scanning concepts
- Comprehensive workflow validation
- Success verification
**Use Case**: Reference implementation showing all operations working
### 5. Complete Client (`complete_client.py`)
**Purpose**: Final comprehensive implementation with all features
**Features**:
- Complete end-to-end automation
- Advanced memory scanning framework
- Full Windows API integration
- Comprehensive UTF-16 memory analysis
- Production-ready implementation
**Use Case**: Full-featured client for complex automation tasks
## ๐ ๏ธ Usage
### Running Clients
All clients should be run from the project root directory:
```bash
# From project root
python clients/simple_client.py
python clients/enhanced_client.py
python clients/reliable_client.py
python clients/working_client.py
python clients/complete_client.py
```
### Common Workflow
All clients follow a similar automation workflow:
1. **Initialize**: Set up MCP components and GUI automation
2. **Launch**: Open target application (Notepad)
3. **Automate**: Send keystrokes and text input
4. **Scan**: Search for text patterns in memory
5. **Report**: Display results and memory addresses
6. **Cleanup**: Close application and clean up resources
## ๐ง Configuration
### Server Integration
All clients automatically configure themselves to work with the MCP server:
```python
# Automatic server path configuration
project_root = os.path.dirname(os.path.dirname(__file__))
server_path = os.path.join(project_root, 'server')
sys.path.insert(0, server_path)
# Import server components
from server.gui_automation.core.integration import PyAutoGUIController
```
### Import Structure
The clients use the organized server module structure:
```python
# GUI Automation
from server.gui_automation.core.integration import PyAutoGUIController
from server.gui_automation.tools.mcp_tools import ALL_PYAUTOGUI_TOOLS
# Memory and Process Management
from memory.scanner import MemoryScanner
from process.manager import ProcessManager
```
## ๐งช Testing
### Quick Test
Test any client with:
```bash
python clients/reliable_client.py
```
Expected output:
```
๐ฏ Starting Reliable MCP Automation Workflow
============================================================
โ
Notepad opened successfully (PID: XXXX)
โ
Text sent successfully
โ
Found Notepad process: PID XXXX
๐ฏ Memory Scan Results:
โ
Found X memory locations
๐ RELIABLE MCP AUTOMATION SUCCESSFUL!
```
### Validation
All clients include:
- โ
Automatic server component detection
- โ
Fallback PyAutoGUI initialization
- โ
Comprehensive error handling
- โ
Success/failure reporting
- โ
Process cleanup
## ๐ Comparison
| Feature | Simple | Enhanced | Reliable | Working | Complete |
|---------|--------|----------|----------|---------|----------|
| Basic Automation | โ
| โ
| โ
| โ
| โ
|
| Memory Scanning | Basic | Advanced | Simple | Demo | Full |
| Error Handling | Basic | Comprehensive | Good | Good | Full |
| Windows API | Limited | Yes | Yes | Yes | Complete |
| UTF-16 Support | No | Yes | Yes | Yes | Yes |
| Production Ready | No | Yes | Yes | No | Yes |
## ๐ Security
All clients implement:
- Process validation and whitelisting
- Safe memory access patterns
- Error boundary protection
- Resource cleanup
- Comprehensive logging
## ๐ Performance
**Memory Usage**: Clients are optimized for efficient memory scanning
**Speed**: Fast automation with configurable timing
**Reliability**: Robust error handling and recovery
**Scalability**: Modular design for easy extension
## ๐ฏ Best Practices
1. **Always run from project root** to ensure correct import paths
2. **Check logs** for detailed operation information
3. **Use reliable_client.py** for consistent automation
4. **Use complete_client.py** for advanced features
5. **Review error messages** for troubleshooting
## ๐ Development
### Adding New Clients
1. Create new client file in `clients/` folder
2. Follow the path configuration pattern:
```python
project_root = os.path.dirname(os.path.dirname(__file__))
server_path = os.path.join(project_root, 'server')
sys.path.insert(0, server_path)
```
3. Import from server modules
4. Implement the standard workflow
5. Add comprehensive error handling
### Extending Existing Clients
- All clients are modular and extensible
- Add new methods for specific automation tasks
- Leverage existing memory scanning frameworks
- Follow established logging patterns
---
**Ready for Automation** โ
All clients are production-ready and demonstrate the full capabilities of the MCP Cheat Engine Server automation system.