enhanced-mcp-tools/examples/demo_modular_architecture.py
Ryan Malloy 92b158b847
Some checks failed
CI / Code Quality (push) Failing after 17s
CI / Test (ubuntu-latest, 3.10) (push) Failing after 5s
CI / Test (ubuntu-latest, 3.11) (push) Failing after 4s
CI / Test (ubuntu-latest, 3.12) (push) Failing after 4s
CI / Test (ubuntu-latest, 3.13) (push) Failing after 4s
CI / Coverage (push) Failing after 25s
CI / Test (macos-latest, 3.13) (push) Has been cancelled
CI / Test (macos-latest, 3.10) (push) Has been cancelled
CI / Test (macos-latest, 3.11) (push) Has been cancelled
CI / Test (macos-latest, 3.12) (push) Has been cancelled
CI / Test (windows-latest, 3.10) (push) Has been cancelled
CI / Test (windows-latest, 3.11) (push) Has been cancelled
CI / Test (windows-latest, 3.12) (push) Has been cancelled
CI / Test (windows-latest, 3.13) (push) Has been cancelled
🚀 Initial release: Enhanced MCP Tools v1.0.0
 Features:
- 50+ development tools across 13 specialized categories
-  Sneller Analytics: High-performance vectorized SQL (TB/s throughput)
- 🎬 Asciinema Integration: Terminal recording and sharing
- 🧠 AI-Powered Recommendations: Intelligent tool suggestions
- 🔀 Advanced Git Integration: Smart operations with AI suggestions
- 📁 Enhanced File Operations: Monitoring, bulk ops, backups
- 🔍 Semantic Code Search: AST-based intelligent analysis
- 🏗️ Development Workflow: Testing, linting, formatting
- 🌐 Network & API Tools: HTTP client, mock servers
- 📦 Archive & Compression: Multi-format operations
- 🔬 Process Tracing: System call monitoring
- 🌍 Environment Management: Virtual envs, dependencies

🎯 Ready for production with comprehensive documentation and MCP Inspector support!
2025-06-23 02:33:23 -06:00

147 lines
4.9 KiB
Python

#!/usr/bin/env python3
"""
Demo script showing the Enhanced MCP Tools modular structure in action
This demonstrates how to use individual modules and the composed server.
"""
import asyncio
import sys
from pathlib import Path
# Add the project root to the Python path
project_root = Path(__file__).parent
sys.path.insert(0, str(project_root))
async def demo_individual_modules():
"""Demonstrate using individual modules"""
print("🔧 Testing Individual Modules")
print("=" * 50)
# Test Intelligent Completion
from enhanced_mcp.intelligent_completion import IntelligentCompletion
completion = IntelligentCompletion()
print(f"✅ Intelligent Completion: {len(completion.tool_categories)} categories")
# Test a recommendation
task = "I want to search for Python functions in my git repository"
result = await completion.recommend_tools(task, max_recommendations=3)
if "recommendations" in result:
print(f"🧠 Recommendations for: '{task}'")
for rec in result["recommendations"][:2]: # Show first 2
print(f" - {rec['tool_name']}: {rec['primary_reason']}")
# Test Asciinema Integration
from enhanced_mcp.asciinema_integration import AsciinemaIntegration
asciinema = AsciinemaIntegration()
print(f"✅ Asciinema Integration: {len(asciinema.config)} config options")
# Test File Operations
from enhanced_mcp.file_operations import EnhancedFileOperations
file_ops = EnhancedFileOperations()
print("✅ File Operations: Ready for file monitoring and backup")
print()
async def demo_composed_server():
"""Demonstrate using the composed server"""
print("🚀 Testing Composed Server")
print("=" * 50)
from enhanced_mcp import MCPToolServer
# Create the composed server
server = MCPToolServer("Demo Server")
print(f"✅ Server created with {len(server.tools)} tool modules:")
for name, tool in server.tools.items():
print(f" - {name}: {tool.__class__.__name__}")
# Test accessing tools through the server
print(f"\n🧠 AI Completion categories: {len(server.completion.tool_categories)}")
print(f"🎬 Asciinema config keys: {list(server.asciinema.config.keys())}")
print(f"📁 File ops watchers: {len(server.file_ops._watchers)}")
# Test a tool recommendation through the server
task = "backup important files and record the process"
result = await server.completion.recommend_tools(task, max_recommendations=2)
if "recommendations" in result:
print(f"\n💡 Server recommendation for: '{task}'")
for rec in result["recommendations"]:
print(f" - {rec['tool_name']}: {rec['primary_reason']}")
print()
async def demo_workflow():
"""Demonstrate a complete workflow using multiple modules"""
print("🔄 Testing Complete Workflow")
print("=" * 50)
from enhanced_mcp import MCPToolServer
server = MCPToolServer("Workflow Demo")
# Step 1: Get recommendations for a complex task
goal = "analyze my Python project structure and create a backup"
print(f"📋 Goal: {goal}")
# Get tool recommendations
recommendations = await server.completion.recommend_tools(
goal, working_directory=str(project_root), max_recommendations=3
)
if "recommendations" in recommendations:
print("🎯 Recommended workflow:")
for i, rec in enumerate(recommendations["recommendations"], 1):
print(f" {i}. {rec['tool_name']}: {rec['primary_reason']}")
# Step 2: Get a complete workflow
workflow = await server.completion.suggest_workflow(goal, automation_level="semi-automated")
if "workflow_steps" in workflow:
print(f"\n📝 Generated {workflow['total_steps']}-step workflow:")
for step in workflow["workflow_steps"][:3]: # Show first 3 steps
print(f" Step {step['step_number']}: {step['step_description']}")
print(f" Tools: {', '.join(step['recommended_tools'])}")
print(f"\n⏱️ Estimated time: {workflow.get('estimated_total_time', 'Unknown')}")
print()
async def main():
"""Run all demonstrations"""
print("🎭 Enhanced MCP Tools - Modular Architecture Demo")
print("=" * 60)
print()
try:
await demo_individual_modules()
await demo_composed_server()
await demo_workflow()
print("🎉 All demonstrations completed successfully!")
print("\n📦 The modular architecture is working perfectly!")
print(" - Individual modules can be used independently")
print(" - Composed server provides unified access")
print(" - Complex workflows can be generated intelligently")
print(" - All functionality is preserved from the original")
except Exception as e:
print(f"❌ Demo failed: {e}")
import traceback
traceback.print_exc()
if __name__ == "__main__":
asyncio.run(main())