Simple MCP

Simple MCP

A modular MCP server that provides comprehensive system automation capabilities including file operations, Telegram integration, job scheduling, system control, and YouTube downloads. Features persistent data storage and a clean architecture for easy extension and maintenance.

Category
访问服务器

README

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

  1. Install dependencies:

    pip install -r requirements.txt
    
  2. Create environment file:

    # Create .env file with your configuration
    TG_TOKEN=your_telegram_bot_token
    ADMIN_ID=your_telegram_chat_id
    
  3. Run the server:

    python main.py
    

📋 Available Tools

Basic Tools

  • echo — Echo back input text

File Tools

  • read_file — Read the contents of a file
  • write_file — Write content to a file
  • create_file — Create a new empty file
  • create_folder — Create a new directory
  • list_files — List files and folders in a directory
  • delete_file — Delete a file
  • rename_file — Rename or move a file
  • move_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 output
  • install_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 time
  • schedule_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 details
  • cancel_scheduled_job — Cancel a scheduled job by its ID
  • get_available_functions — List all functions available for scheduling
  • get_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 storage
  • get_persistent_info — Retrieve all persistent data, or a specific key's value
  • delete_persistent_info_key — Delete a key from persistent storage

Control Tools

  • type_text — Simulate typing text using the keyboard
  • press_hotkey — Press a combination of keys as a hotkey (e.g., Ctrl+Tab)
  • switch_to_window — Switch focus to a window with a specified title
  • list_open_windows — List the titles of all currently open windows
  • move_mouse_to — Move the mouse cursor to specified screen coordinates
  • click_mouse — Click the mouse at specified coordinates or at the current position

YouTube Tools

  • youtube_download_video — Download a YouTube video as MP4
  • youtube_download_audio — Download YouTube audio as MP3
  • youtube_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 definitions
  • job_execution_log.json — Execution history
  • persistent_info.json — Custom data
  • main.log — Application logs
  • error.log — Error logs

🛠️ Development

Adding New Tools

  1. Create a new module in tools/
  2. Import the shared MCP instance: from . import mcp
  3. Define your tool function with @mcp.tool() decorator
  4. Register the function in tools/__init__.py if needed

Adding New Persistence Functions

  1. Add functions to persistence.py
  2. Import and use them in your tools
  3. Follow the existing pattern for error handling

🔍 Troubleshooting

  • Check logs in main.log and error.log
  • Verify environment variables in .env
  • Ensure all dependencies are installed
  • Check file permissions for persistence

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选