定制 wachterjohannes/debug-mcp-tools 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wachterjohannes/debug-mcp-tools

Composer 安装命令:

composer require wachterjohannes/debug-mcp-tools

包简介

Debugging tools for debug-mcp server (clock, PHP configuration)

README 文档

README

⚠️ PROTOTYPE - FOR TESTING AND DISCUSSION PURPOSES ONLY

Development and debugging tools for the debug-mcp MCP server.

Purpose

Provides two essential debugging tools:

  • ClockTool: Get current time with customizable format and timezone
  • PhpConfigTool: Inspect PHP configuration, extensions, and environment

Features

  • Current time retrieval with timezone support
  • PHP configuration inspection (version, extensions, paths, memory limits)
  • Automatic discovery by debug-mcp server
  • Attribute-based registration using PHP 8

Installation

composer require wachterjohannes/debug-mcp-tools

The tools will be automatically discovered when debug-mcp server starts.

Available Tools

clock

Get the current time in a specified format and timezone.

Parameters:

  • format (optional, default: 'Y-m-d H:i:s'): PHP date format string
  • timezone (optional, default: 'UTC'): Valid timezone identifier

Example:

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "clock",
    "arguments": {
      "format": "c",
      "timezone": "Europe/Berlin"
    }
  },
  "id": 1
}

Returns:

{
  "time": "2024-11-29T15:30:45+01:00"
}

php_config

Get PHP configuration information about the development environment.

Parameters:

  • section (optional, default: 'general'): One of:
    • general: PHP version, memory limit, max execution time
    • extensions: List of loaded PHP extensions
    • paths: Include paths and configuration file locations
    • all: All information combined

Example:

{
  "jsonrpc": "2.0",
  "method": "tools/call",
  "params": {
    "name": "php_config",
    "arguments": {
      "section": "general"
    }
  },
  "id": 1
}

Returns:

{
  "php_version": "8.2.12",
  "memory_limit": "256M",
  "max_execution_time": "30",
  "zend_version": "4.2.12"
}

Registration

Tools are registered via composer.json extra configuration:

{
  "extra": {
    "wachterjohannes/debug-mcp": {
      "classes": [
        "Wachterjohannes\\DebugMcp\\Tools\\ClockTool",
        "Wachterjohannes\\DebugMcp\\Tools\\PhpConfigTool"
      ]
    }
  }
}

The debug-mcp server scans installed packages for this configuration and automatically loads the tools.

Adding New Tools

To add a new tool to this package:

  1. Create a class in src/ with the tool logic
  2. Add #[McpTool] attribute from the SDK
  3. Add the class name to composer.json extra config
  4. Update this README with tool documentation

Example tool structure:

<?php
namespace Wachterjohannes\DebugMcp\Tools;

use Mcp\Capability\Attribute\McpTool;

class MyNewTool
{
    #[McpTool(
        name: 'my_new_tool',
        description: 'Description of what this tool does'
    )]
    public function execute(string $param): array
    {
        return ['result' => 'value'];
    }
}

Development

Code Quality

Format code before committing:

composer cs-fix

Testing Tools

Test individual tools by installing into a debug-mcp instance and using Claude Desktop or direct JSON-RPC messages.

Requirements

  • PHP 8.1 or higher
  • modelcontextprotocol/php-sdk
  • wachterjohannes/debug-mcp (for testing)

Repository

GitHub: https://github.com/wachterjohannes/debug-mcp-tools

License

MIT

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 1
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 1
  • Watchers: 0
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2025-11-29