haive.mcp.tools.ai_assistant¶
AI-friendly MCP server selection and configuration assistant.
This module provides tools specifically designed for AI agents to automatically select, configure, and use MCP servers based on task analysis and intelligent recommendations. It minimizes the need for manual configuration while maximizing the effectiveness of server selection.
- The assistant provides:
Automatic server selection based on task analysis
Smart configuration generation with minimal setup
Performance-aware server combinations
Fallback strategies for failed servers
Context-aware capability matching
- Classes:
MCPAssistant: Main AI-friendly server selection assistant SmartConfig: Intelligent configuration generator TaskMatcher: Advanced task-to-server matching system
Example
AI agent usage:
from haive.mcp.tools import MCPAssistant
# Create assistant
assistant = MCPAssistant()
# Automatically select servers for a task
task = "I need to analyze Python code in a GitHub repo for security issues"
config = await assistant.auto_configure_for_task(task)
# Create agent with optimal configuration
agent = MCPAgent(
engine=engine,
mcp_config=config,
name="security_analysis_agent"
)
# Assistant provides reasoning
reasoning = assistant.get_selection_reasoning()
print(f"Selected servers because: {reasoning}")
Note
Designed to work seamlessly with AI agents that need to dynamically adapt their capabilities based on task requirements.
Classes¶
AI-friendly MCP server selection and configuration assistant. |
|
A server recommendation with detailed reasoning. |
|
A complete MCP configuration with metadata. |
|
Advanced task-to-server matching with learning capabilities. |
Module Contents¶
- class haive.mcp.tools.ai_assistant.MCPAssistant(cache_enabled=True)¶
AI-friendly MCP server selection and configuration assistant.
Initialize MCP assistant.
- Parameters:
cache_enabled (bool) – Whether to cache server information
- async auto_configure_for_task(task_description, prefer_simple_setup=True, max_servers=3, include_fallbacks=True)[source]¶
Automatically configure MCP servers for a task.
- Parameters:
- Returns:
SmartConfiguration with optimized setup
- Return type:
- async validate_configuration(config)[source]¶
Validate a configuration and provide feedback.
- Parameters:
config (haive.mcp.config.MCPConfig) – MCP configuration to validate
- Returns:
Validation results with issues and suggestions
- Return type:
- class haive.mcp.tools.ai_assistant.ServerRecommendation[source]¶
A server recommendation with detailed reasoning.
- class haive.mcp.tools.ai_assistant.SmartConfiguration[source]¶
A complete MCP configuration with metadata.