karar-hayder/Simple-MCP
3.2
If you are the rightful owner of Simple-MCP and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
The MCP Server is designed with a modular architecture to ensure maintainability, scalability, and robustness in development.
Tools
5
Resources
0
Prompts
0
MCP Server - Modular Architecture
This MCP (Model Context Protocol) server is built with a clean, modular architecture for maintainable, scalable, and robust development.
š Project Structure
MCP-test/
āāā main.py # Main entry point
āāā config.py # Configuration and constants
āāā persistence.py # Data persistence layer
āāā scheduler.py # Job scheduling functionality
āāā tools/ # MCP tools organized by concern
ā āāā __init__.py # Tools package initialization and registry
ā āāā basic_tools.py # Basic utility tools
ā āāā control_tools.py # Server control tools (restart, shutdown, etc)
ā āāā file_tools.py # File system operations
ā āāā persistence_tools.py # Persistence management tools
ā āāā scheduling_tools.py # Scheduling-related tools
ā āāā system_tools.py # System information and commands
ā āāā telegram_tools.py # Telegram integration
ā āāā youtube_tools.py # YouTube-related tools
āāā requirements.txt # Python dependencies
āāā .env # Environment variables (create this)
āāā README.md # This file
š Quick Start
-
Install dependencies:
pip install -r requirements.txt
-
Create environment file:
# Create .env file with your configuration TG_TOKEN=your_telegram_bot_token ADMIN_ID=your_telegram_chat_id
-
Run the server:
python main.py
š Available Tools
Basic Tools
echo
ā Echo back input text
File Tools
read_file
ā Read the contents of a filewrite_file
ā Write content to a filecreate_file
ā Create a new empty filecreate_folder
ā Create a new directorylist_files
ā List files and folders in a directorydelete_file
ā Delete a filerename_file
ā Rename or move a filemove_folder
ā Move a folder (directory) to a new location
System Tools
system_info
ā Get basic system information (platform, memory, CPU, etc.)list_processes
ā List running processes (PID, name, user)run_python_code
ā Execute a Python code snippet and return the outputinstall_python_library
ā Install a Python library (via pip) and update requirements.txt
Telegram Integration
send_telegram_message
ā Send Telegram messages, audio, video, or documents (with optional metadata)receive_telegram_updates
ā Receive and download incoming Telegram messages and files
Scheduling & Job Tools (still in testing)
schedule_telegram_message
ā Schedule a Telegram message to be sent at a specific time (supports ISO datetime or relative times like "in 10 minutes")schedule_function_call
ā Schedule any registered function to run once at a specified timeschedule_recurring_job
ā Schedule recurring jobs using cron expressions or intervals (e.g., "every 5 minutes", "0 9 ** 1-5")list_scheduled_jobs
ā List all currently scheduled jobs with detailscancel_scheduled_job
ā Cancel a scheduled job by its IDget_available_functions
ā List all functions available for schedulingget_job_execution_log
ā View the execution history and results of scheduled jobs
Persistence Tools
update_persistent_info
ā Add or update a key-value pair in persistent storageget_persistent_info
ā Retrieve all persistent data, or a specific key's valuedelete_persistent_info_key
ā Delete a key from persistent storage
Control Tools
type_text
ā Simulate typing text using the keyboardpress_hotkey
ā Press a combination of keys as a hotkey (e.g., Ctrl+Tab)switch_to_window
ā Switch focus to a window with a specified titlelist_open_windows
ā List the titles of all currently open windowsmove_mouse_to
ā Move the mouse cursor to specified screen coordinatesclick_mouse
ā Click the mouse at specified coordinates or at the current position
YouTube Tools
youtube_download_video
ā Download a YouTube video as MP4youtube_download_audio
ā Download YouTube audio as MP3youtube_video_info
ā Get detailed YouTube video information
š§ Architecture Benefits
Separation of Concerns
- config.py: Centralized configuration
- persistence.py: Data storage abstraction
- scheduler.py: Scheduling logic isolated
- tools/: Tools organized by functionality
Maintainability
- Add new tools by creating new modules
- Clear dependencies between components
- Consistent error handling and logging
Scalability
- Modular design for easy extension
- Shared MCP instance prevents conflicts
- Function registry enables dynamic scheduling
š Data Persistence
The server automatically persists:
- Scheduled Jobs: Survives server restarts
- Execution Logs: Detailed job run history
- Persistent Info: Custom key-value storage
Files created:
scheduled_jobs.json
ā Job definitionsjob_execution_log.json
ā Execution historypersistent_info.json
ā Custom datamain.log
ā Application logserror.log
ā Error logs
š ļø Development
Adding New Tools
- Create a new module in
tools/
- Import the shared MCP instance:
from . import mcp
- Define your tool function with
@mcp.tool()
decorator - Register the function in
tools/__init__.py
if needed
Adding New Persistence Functions
- Add functions to
persistence.py
- Import and use them in your tools
- Follow the existing pattern for error handling
š Troubleshooting
- Check logs in
main.log
anderror.log
- Verify environment variables in
.env
- Ensure all dependencies are installed
- Check file permissions for persistence