mirror of
https://github.com/hanzoai/mcp.git
synced 2026-11-03 01:31:11 +00:00
🎨 **Tool Palette System** - Created palette system for organizing development tools by ecosystem - Pre-defined palettes: Python (Guido), Ruby (Matz), JavaScript, Go, Rust, DevOps, Full Stack, Minimal - `palette` tool to list, activate, and manage tool sets - Environment variables applied from active palette - Keeps MCP interface clean while supporting specialized workflows 🔧 **Unified Process Tools with OO Design** - Refactored all process execution to use clean base class hierarchy - `BaseProcessTool`, `BaseBinaryTool`, `BaseScriptTool` for consistent interface - Unified `bash`, `npx`, `uvx` tools with action-based approach (run/background) - `process` tool for managing background processes - All tools use same execution pipeline internally 🐚 **Smart Shell Detection** - Shell tool now detects user's preferred shell from $SHELL environment - Automatically uses zsh if .zshrc exists (perfect for your setup\!) - Falls back to bash if no special configuration found - All zsh aliases, functions, and configurations now available in MCP 🚀 **Development Mode with Hot Reload** - Added `--dev` flag to hanzo-mcp CLI for development mode - File watching with automatic reload detection using watchdog - `hanzo-mcp-dev` command for dedicated dev server - Watches Python files and config changes - Debounced reloading to prevent spam 🛠️ **New Tools Added** - `open`: Opens files/URLs in default application (platform-aware) - `watch`: Monitors files/directories for changes with pattern matching - `diff`: Compares files with unified/context diff formats - `config`: Git-style configuration management 📚 **Documentation & Infrastructure** - Comprehensive Sphinx documentation with black theme - Automated deployment to mcp.hanzo.ai via Cloudflare Pages - GitHub Actions workflow for docs deployment - 25+ documentation pages organized by category ⚙️ **Configuration Improvements** - Tool enable/disable system with palette override - Per-project vs global indexing configuration - Environment variable management through palettes - Clean separation of concerns in tool registration This release provides a much cleaner, more extensible architecture while maintaining backward compatibility. The palette system makes it easy to switch between development environments, and the unified process tools eliminate code duplication while providing consistent behavior. Co-authored-by: Hanzo Dev <[email protected]>
99 lines
3.1 KiB
Python
99 lines
3.1 KiB
Python
"""Unix command aliases for common tools.
|
|
|
|
Provides familiar Unix command names that map to MCP tools.
|
|
"""
|
|
|
|
from typing import Dict, Type
|
|
from hanzo_mcp.tools.common.base import BaseTool
|
|
|
|
|
|
def get_unix_aliases() -> Dict[str, str]:
|
|
"""Get mapping of Unix commands to MCP tool names.
|
|
|
|
Returns:
|
|
Dictionary mapping Unix command names to MCP tool names
|
|
"""
|
|
return {
|
|
# File operations
|
|
"ls": "list_directory",
|
|
"cat": "read_file",
|
|
"head": "read_file", # With line limit
|
|
"tail": "read_file", # With offset
|
|
"cp": "copy_path",
|
|
"mv": "move_path",
|
|
"rm": "delete_path",
|
|
"mkdir": "create_directory",
|
|
"touch": "write_file", # Create empty file
|
|
|
|
# Search operations
|
|
"grep": "find", # Our unified find tool
|
|
"find": "glob", # For finding files by name
|
|
"ffind": "find", # Fast file content search
|
|
"rg": "find", # Ripgrep alias
|
|
"ag": "find", # Silver searcher alias
|
|
"ack": "find", # Ack alias
|
|
|
|
# Directory operations
|
|
"tree": "tree", # Already named correctly
|
|
"pwd": "get_working_directory",
|
|
"cd": "change_directory",
|
|
|
|
# Git operations (if git tools enabled)
|
|
"git": "git_command",
|
|
|
|
# Process operations
|
|
"ps": "list_processes",
|
|
"kill": "kill_process",
|
|
|
|
# Archive operations
|
|
"tar": "archive",
|
|
"unzip": "extract",
|
|
|
|
# Network operations
|
|
"curl": "http_request",
|
|
"wget": "download_file",
|
|
}
|
|
|
|
|
|
class UnixAliasRegistry:
|
|
"""Registry for Unix command aliases."""
|
|
|
|
def __init__(self):
|
|
self.aliases = get_unix_aliases()
|
|
|
|
def register_aliases(self, mcp_server, tools: Dict[str, BaseTool]) -> None:
|
|
"""Register Unix aliases for tools.
|
|
|
|
Args:
|
|
mcp_server: The MCP server instance
|
|
tools: Dictionary of tool name to tool instance
|
|
"""
|
|
for alias, tool_name in self.aliases.items():
|
|
if tool_name in tools:
|
|
tool = tools[tool_name]
|
|
# Register the tool under its alias name
|
|
self._register_alias(mcp_server, alias, tool)
|
|
|
|
def _register_alias(self, mcp_server, alias: str, tool: BaseTool) -> None:
|
|
"""Register a single alias for a tool.
|
|
|
|
Args:
|
|
mcp_server: The MCP server instance
|
|
alias: The Unix command alias
|
|
tool: The tool instance
|
|
"""
|
|
# Create a wrapper that preserves the original tool's functionality
|
|
# but registers under the alias name
|
|
original_name = tool.name
|
|
original_description = tool.description
|
|
|
|
# Temporarily change the tool's name for registration
|
|
tool.name = alias
|
|
tool.description = f"{original_description}\n\n(Unix alias for {original_name})"
|
|
|
|
# Register the tool
|
|
tool.register(mcp_server)
|
|
|
|
# Restore original name
|
|
tool.name = original_name
|
|
tool.description = original_description |