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
✨ 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!
92 lines
1.9 KiB
Python
92 lines
1.9 KiB
Python
"""
|
|
Base module with common imports and utilities for Enhanced MCP Tools
|
|
"""
|
|
|
|
# Standard library imports
|
|
import ast
|
|
import asyncio
|
|
import json
|
|
import os
|
|
import re
|
|
import shutil
|
|
import subprocess
|
|
import sys
|
|
import time
|
|
from collections import defaultdict
|
|
from datetime import datetime
|
|
from pathlib import Path
|
|
from typing import Any, Literal, Optional, Union
|
|
|
|
# Third-party imports
|
|
import aiofiles
|
|
import psutil
|
|
from fastmcp import Context, FastMCP
|
|
|
|
# FastMCP imports
|
|
from fastmcp.contrib.mcp_mixin import MCPMixin, mcp_prompt, mcp_resource, mcp_tool
|
|
|
|
|
|
# Common utility functions that multiple modules will use
|
|
class MCPBase:
|
|
"""Base class with common functionality for all MCP tool classes"""
|
|
|
|
def __init__(self):
|
|
pass
|
|
|
|
async def log_info(self, message: str, ctx: Context | None = None):
|
|
"""Helper to log info messages"""
|
|
if ctx:
|
|
await ctx.log_info(message)
|
|
else:
|
|
print(f"INFO: {message}")
|
|
|
|
async def log_warning(self, message: str, ctx: Context | None = None):
|
|
"""Helper to log warning messages"""
|
|
if ctx:
|
|
await ctx.log_warning(message)
|
|
else:
|
|
print(f"WARNING: {message}")
|
|
|
|
async def log_error(self, message: str, ctx: Context | None = None):
|
|
"""Helper to log error messages"""
|
|
if ctx:
|
|
await ctx.log_error(message)
|
|
else:
|
|
print(f"ERROR: {message}")
|
|
|
|
|
|
# Export common dependencies for use by other modules
|
|
__all__ = [
|
|
# Standard library
|
|
"os",
|
|
"sys",
|
|
"re",
|
|
"ast",
|
|
"json",
|
|
"time",
|
|
"shutil",
|
|
"asyncio",
|
|
"subprocess",
|
|
# Typing
|
|
"Optional",
|
|
"Any",
|
|
"Union",
|
|
"Literal",
|
|
# Path and datetime
|
|
"Path",
|
|
"datetime",
|
|
"defaultdict",
|
|
# Third-party
|
|
"aiofiles",
|
|
"psutil",
|
|
# FastMCP
|
|
"MCPMixin",
|
|
"mcp_tool",
|
|
"mcp_resource",
|
|
"mcp_prompt",
|
|
"FastMCP",
|
|
"Context",
|
|
# Base class
|
|
"MCPBase",
|
|
]
|