UNPKG

vme-mcp-server

Version:

An intelligent Model Context Protocol (MCP) server that transforms HPE VM Essentials (VME) infrastructure management into natural language conversations. Provision VMs, manage resources, and control your infrastructure through simple English commands with

76 lines (75 loc) 2.89 kB
import { capabilityDiscovery } from "../lib/capability-discovery.js"; export const discoverCapabilitiesTool = { name: "discover_capabilities", description: "⚡ RECOMMENDED FIRST STEP: Discover VME infrastructure capabilities to learn available resources. Run this tool at least once per session to cache environment data for optimal performance with other tools.", inputSchema: { type: "object", properties: { domain: { type: "string", enum: ["compute", "storage", "networking", "platform", "all"], description: "Which capability domain to discover (default: all)", default: "all" }, refresh: { type: "boolean", description: "Force refresh of cached data (default: false)", default: false }, include_limits: { type: "boolean", description: "Include license/quota limits (default: true)", default: true } }, required: [] } }; export async function handleDiscoverCapabilities(args) { try { const { domain = "all", refresh = false, include_limits = true } = args; // Convert single domain to array for discovery engine const domains = domain === "all" ? ["all"] : [domain]; const capabilities = await capabilityDiscovery.discoverCapabilities(domains, refresh); // Filter out license limits if not requested if (!include_limits && capabilities.platform) { delete capabilities.platform.license_limits; } // Prepare response with metadata const response = { capabilities, metadata: { discovery_time: capabilities.discovered_at, domains_requested: domains, cache_refresh_forced: refresh, total_cache_fields: capabilities.cache_status.length, fresh_cache_fields: capabilities.cache_status.filter(s => s.fresh).length, token_optimization: "Field-level TTL caching reduces response size by 90%+" } }; return { content: [ { type: "text", text: JSON.stringify(response, null, 2) } ], isError: false }; } catch (error) { return { content: [ { type: "text", text: JSON.stringify({ error: "Capability discovery failed", message: error.message, suggestion: "Check VME API connectivity and authentication" }, null, 2) } ], isError: true }; } }