troubleshooting-mcp-server

troubleshooting-mcp-server

A comprehensive MCP server that provides system troubleshooting and diagnostic tools, enabling LLMs to diagnose system issues, monitor resources, check logs, and test connectivity.

Category
Visit Server

README

Troubleshooting MCP Server

A Model Context Protocol (MCP) server that provides comprehensive system troubleshooting and diagnostic tools for developers and system administrators. This server enables LLMs to help diagnose system issues, monitor resources, check logs, test connectivity, and more.

Version: 1.0.0 | License: MIT | Python: 3.10+


šŸ“‹ Table of Contents


✨ Features

šŸ–„ļø System Information

Get comprehensive details about the operating system, hardware specifications, CPU architecture, memory capacity, and installed software versions.

šŸ“Š Resource Monitoring

Real-time monitoring of system resources including:

  • CPU usage (overall and per-core)
  • Memory utilization (RAM and swap)
  • Disk I/O statistics
  • Network I/O metrics

šŸ“‹ Log File Access

Read and analyze system log files with:

  • Tail-like functionality to read last N lines
  • Pattern-based filtering (similar to grep)
  • Common log location discovery
  • Support for various log formats

🌐 Network Diagnostics

Test network connectivity with:

  • DNS resolution testing
  • TCP port connectivity checks
  • Connection timing measurements
  • Timeout configuration

āš™ļø Process Management

Search and monitor running processes:

  • Pattern-based process search
  • CPU and memory usage per process
  • Process status and command line details
  • Sorted by resource usage

šŸ”§ Environment Analysis

Inspect system environment including:

  • Environment variables (with pattern filtering)
  • Installed development tools and versions
  • PATH configuration
  • Common tool version checks (git, docker, python, node, etc.)

šŸ›”ļø Safe Command Execution

Execute whitelisted diagnostic commands with:

  • Strict command whitelist for security
  • Timeout protection
  • Safe diagnostic operations only
  • Real-time output capture

šŸ“ Project Structure

troubleshooting_mcp/
ā”œā”€ā”€ src/
│   └── troubleshooting_mcp/          # Main package
│       ā”œā”€ā”€ __init__.py               # Package initialization
│       ā”œā”€ā”€ server.py                 # MCP server entry point
│       ā”œā”€ā”€ constants.py              # Shared constants
│       ā”œā”€ā”€ models.py                 # Pydantic input validation models
│       ā”œā”€ā”€ utils.py                  # Utility functions
│       └── tools/                    # Individual diagnostic tools
│           ā”œā”€ā”€ __init__.py           # Tool registration
│           ā”œā”€ā”€ system_info.py        # System information tool
│           ā”œā”€ā”€ resource_monitor.py   # Resource monitoring tool
│           ā”œā”€ā”€ log_reader.py         # Log file reader tool
│           ā”œā”€ā”€ network_diagnostic.py # Network diagnostic tool
│           ā”œā”€ā”€ process_search.py     # Process search tool
│           ā”œā”€ā”€ environment_inspect.py # Environment inspection tool
│           └── safe_command.py       # Safe command execution tool
│
ā”œā”€ā”€ tests/                            # Test suite
│   ā”œā”€ā”€ __init__.py
│   └── test_server.py                # Server validation tests
│
ā”œā”€ā”€ docs/                             # Documentation
│   ā”œā”€ā”€ QUICKSTART.md                 # Quick start guide
│   ā”œā”€ā”€ EXAMPLES.md                   # Detailed usage examples
│   └── CHANGELOG.md                  # Version history
│
ā”œā”€ā”€ config/                           # Configuration files
│   └── claude_desktop_config.example.json # Claude Desktop example config
│
ā”œā”€ā”€ troubleshooting_mcp.py            # Backward compatibility entry point
ā”œā”€ā”€ setup.py                          # Package setup script
ā”œā”€ā”€ pyproject.toml                    # Modern Python project configuration
ā”œā”€ā”€ requirements.txt                  # Python dependencies
ā”œā”€ā”€ .gitignore                        # Git ignore rules
ā”œā”€ā”€ LICENSE                           # MIT License
└── README.md                         # This file

šŸŽÆ Key Design Principles

  1. Modular Architecture: Each diagnostic tool is in its own module for easy maintenance and testing
  2. Clear Separation: Constants, models, utilities, and tools are separated for clarity
  3. Backward Compatibility: The root troubleshooting_mcp.py maintains compatibility with existing configurations
  4. Installable Package: Can be installed with pip install -e . for system-wide access
  5. Type Safety: Uses Pydantic v2 for comprehensive input validation
  6. Security First: Strict whitelists, timeout protection, and input validation throughout

šŸš€ Quick Start

1ļøāƒ£ Install Dependencies (1 minute)

# Navigate to the project directory
cd troubleshooting_mcp

# Install required packages
pip install -r requirements.txt

# Or install as a package (recommended)
pip install -e .

2ļøāƒ£ Test the Server (1 minute)

# Method 1: Run directly (backward compatible)
python troubleshooting_mcp.py --help

# Method 2: Run as module
python -m troubleshooting_mcp.server --help

# Method 3: If installed as package
troubleshooting-mcp --help

# Run validation tests
python tests/test_server.py

3ļøāƒ£ Configure Claude Desktop (2 minutes)

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json

{
  "mcpServers": {
    "troubleshooting": {
      "command": "python",
      "args": ["/absolute/path/to/troubleshooting_mcp.py"]
    }
  }
}

Alternative (if installed as package):

{
  "mcpServers": {
    "troubleshooting": {
      "command": "troubleshooting-mcp"
    }
  }
}

4ļøāƒ£ Restart Claude Desktop

  1. Completely quit Claude Desktop
  2. Restart Claude Desktop
  3. Look for the šŸ”Œ icon indicating MCP servers are connected

šŸ“¦ Installation Methods

Method 1: Direct Use (No Installation)

python troubleshooting_mcp.py

Pros: Simple, no installation needed Cons: Not accessible system-wide

Method 2: Editable Install (Development)

pip install -e .
troubleshooting-mcp

Pros: System-wide access, easy to modify, auto-updates Cons: Requires pip install

Method 3: Standard Install (Production)

pip install .
troubleshooting-mcp

Pros: Clean installation, system-wide access Cons: Requires reinstall after changes

Method 4: Module Execution

python -m troubleshooting_mcp.server

Pros: No installation, proper Python module syntax Cons: Requires being in parent directory


šŸ›  Available Tools

Tool Description Example Usage
troubleshooting_get_system_info Get comprehensive system details "What are the system specs?"
troubleshooting_monitor_resources Monitor CPU, memory, disk, network "Show current resource usage"
troubleshooting_read_log_file Read and filter log files "Show last 100 lines of syslog"
troubleshooting_test_network_connectivity Test host/port connectivity "Can I reach google.com?"
troubleshooting_search_processes Search running processes "Is nginx running?"
troubleshooting_inspect_environment Check environment variables & tools "What dev tools are installed?"
troubleshooting_execute_safe_command Run whitelisted commands "Run df -h to check disk space"

For detailed tool documentation and examples, see docs/EXAMPLES.md.


āš™ļø Configuration

Dependencies

  • mcp>=1.0.0 - MCP Python SDK with FastMCP framework
  • psutil>=5.9.0 - System and process monitoring
  • pydantic>=2.0.0 - Input validation

Environment Variables

The server respects standard Python environment variables:

  • PYTHONPATH - For module resolution
  • PATH - For locating diagnostic commands

Customization

Log Paths: Edit src/troubleshooting_mcp/constants.py:

COMMON_LOG_PATHS = [
    "/var/log/syslog",
    "/custom/app/logs/error.log",
    # Add your custom paths
]

Safe Commands: Edit src/troubleshooting_mcp/constants.py:

SAFE_COMMANDS = {
    "ping", "traceroute", "netstat",
    # Add approved commands only
}

Character Limit: Edit src/troubleshooting_mcp/constants.py:

CHARACTER_LIMIT = 25000  # Adjust as needed

šŸ”’ Security

Command Whitelist

Only pre-approved diagnostic commands can be executed. The whitelist includes common troubleshooting tools but excludes any commands that could:

  • Modify system state
  • Delete or overwrite files
  • Change permissions
  • Install software
  • Execute arbitrary code

Default Whitelist: ping, traceroute, nslookup, dig, netstat, ss, ip, ifconfig, df, du, free, uptime, uname, lsblk, lsof, whoami, hostname

Timeout Protection

All long-running operations have configurable timeouts:

  • Command execution: 30 seconds default, 300 seconds maximum
  • Network tests: 5 seconds default, 30 seconds maximum

Permission Handling

  • No privilege escalation
  • Clear error messages for permission-denied scenarios
  • Read-only operations where possible

Input Validation

All inputs are validated using Pydantic models with:

  • Type checking
  • Range constraints
  • Pattern validation
  • Whitelist verification

šŸ’» Development

Setting Up Development Environment

# Clone the repository
git clone <repository-url>
cd troubleshooting_mcp

# Create virtual environment (optional but recommended)
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install in editable mode with dev dependencies
pip install -e .

# Run tests
python tests/test_server.py

Adding New Tools

  1. Create new tool module in src/troubleshooting_mcp/tools/:
# src/troubleshooting_mcp/tools/my_tool.py
def register_my_tool(mcp):
    @mcp.tool(name="troubleshooting_my_tool", annotations={...})
    async def troubleshooting_my_tool(params: MyInput) -> str:
        # Implementation
        pass
  1. Add input model in src/troubleshooting_mcp/models.py:
class MyInput(BaseModel):
    model_config = ConfigDict(str_strip_whitespace=True)
    param: str = Field(..., description="...")
  1. Register in tools package src/troubleshooting_mcp/tools/__init__.py:
from .my_tool import register_my_tool

def register_all_tools(mcp):
    # ... existing registrations ...
    register_my_tool(mcp)

Code Style

  • Follow PEP 8 style guidelines
  • Use type hints where appropriate
  • Add comprehensive docstrings to all functions
  • Keep tools modular and focused
  • Use the shared utility functions

Testing

# Run all tests
python tests/test_server.py

# Test specific functionality
python -c "from src.troubleshooting_mcp import mcp; print('Import successful')"

šŸ“š Documentation

Document Description
README.md This file - Overview and getting started
docs/QUICKSTART.md 5-minute quick start guide
docs/EXAMPLES.md Detailed usage examples for each tool
docs/CHANGELOG.md Version history and changes
config/claude_desktop_config.example.json Example Claude Desktop configuration

šŸŽÆ Example Usage

Once configured in Claude Desktop, try these prompts:

System Diagnostics

"What operating system and hardware does this machine have?"
"Show me current CPU and memory usage"

Log Analysis

"What log files are available on this system?"
"Search nginx error logs for 500 errors in the last 200 lines"

Network Testing

"Can this server reach google.com?"
"Test if port 443 is open on api.example.com"

Process Management

"Is docker running on this system?"
"Show me the top 10 processes by CPU usage"

Environment Inspection

"What development tools are installed?"
"Show me all AWS-related environment variables"

šŸ› Troubleshooting

Server Not Appearing in Claude Desktop

  1. Check file path is absolute in config
  2. Verify JSON syntax (no trailing commas)
  3. Check Claude Desktop logs:
    • macOS: ~/Library/Logs/Claude/mcp*.log
    • Windows: %APPDATA%\Claude\logs\mcp*.log

"Module not found" Error

# Reinstall dependencies
pip install --upgrade -r requirements.txt

# Or use virtual environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -e .

"Command not found" Error

# Check Python is in PATH
which python  # macOS/Linux
where python  # Windows

# Or use full path in config
# "command": "/usr/bin/python3"  # macOS/Linux
# "command": "C:/Python310/python.exe"  # Windows

šŸ¤ Contributing

Contributions are welcome! When contributing:

  1. Follow the existing code style and modular architecture
  2. Add comprehensive docstrings and type hints
  3. Include input validation using Pydantic
  4. Implement proper error handling
  5. Update documentation
  6. Test on multiple platforms (Linux, macOS, Windows)

šŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.


šŸ™ Acknowledgments

Built using:


šŸ“ž Support

For issues, questions, or suggestions:


Made for developers and system administrators

Last Updated: 2025-11-05 | Version: 1.0.0

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured