Skip to main content
Glama
configuration-tools.ts6.13 kB
// Configuration Management MCP Tools import { ServerConfig, CONFIGURATION_MODES, getConfigSummary, validateConfig } from '../config/server-config.js'; import { validateWordPressConfig, WordPressConfig } from '../config/wordpress-config.js'; import { logger } from '../utils/logger.js'; export function createConfigurationTools(serverConfig: ServerConfig) { const tools: any[] = []; // ========== CONFIGURATION INFO ========== tools.push({ name: 'get_server_config', description: 'Get current server configuration and enabled features', inputSchema: { type: 'object', properties: { detailed: { type: 'boolean', description: 'Include detailed feature breakdown (default: false)', default: false } } }, handler: async (args: any) => { const configData: any = { mode: serverConfig.mode, totalEnabledFeatures: serverConfig.getTotalEnabledFeatures(), summary: getConfigSummary(serverConfig) }; if (args.detailed) { configData.enabledFeatures = (serverConfig as any).getEnabledFeatures(); configData.disabledFeatures = (serverConfig as any).getDisabledFeatures(); configData.features = (serverConfig as any).toJSON().features; } return { content: [{ type: 'text', text: JSON.stringify(configData, null, 2) }] }; } }); tools.push({ name: 'list_configuration_modes', description: 'List all available configuration modes and their features', inputSchema: { type: 'object', properties: {} }, handler: async (args: any) => { const modes = Object.entries(CONFIGURATION_MODES).map(([name, config]) => ({ name, mode: config.mode, enabledFeatures: Object.entries(config) .filter(([key, value]) => typeof value === 'boolean' && value && key !== 'mode') .length, features: config })); return { content: [{ type: 'text', text: JSON.stringify({ currentMode: serverConfig.mode, availableModes: modes }, null, 2) }] }; } }); tools.push({ name: 'validate_configuration', description: 'Validate a configuration object', inputSchema: { type: 'object', properties: { config: { type: 'object', description: 'Configuration object to validate' } }, required: ['config'] }, handler: async (args: any) => { const validation = validateConfig(args.config); return { content: [{ type: 'text', text: JSON.stringify(validation, null, 2) }] }; } }); tools.push({ name: 'get_feature_description', description: 'Get description of configuration features', inputSchema: { type: 'object', properties: {} }, handler: async (args: any) => { const descriptions = { basicWordPressOperations: 'Posts, pages, and media CRUD operations', basicElementorOperations: 'Basic Elementor data get/update operations', sectionContainerCreation: 'Create sections and containers', widgetAddition: 'Add and manage widgets', elementManagement: 'Delete, reorder, and copy elements', pageStructure: 'Page structure analysis tools', performanceOptimization: 'Caching and performance tools', advancedElementOperations: 'Advanced search and bulk operations', templateManagement: 'Elementor template operations', globalSettings: 'Global colors and fonts management', customFieldsIntegration: 'Custom fields integration', revisionHistory: 'Revision and history management' }; return { content: [{ type: 'text', text: JSON.stringify({ currentMode: serverConfig.mode, features: descriptions, enabledInCurrentMode: (serverConfig as any).getEnabledFeatures() }, null, 2) }] }; } }); // ========== WORDPRESS CONFIGURATION ========== tools.push({ name: 'configure_wordpress', description: 'Configure or reconfigure WordPress connection (runtime configuration)', inputSchema: { type: 'object', properties: { baseUrl: { type: 'string', description: 'WordPress site base URL (e.g., https://yoursite.com)' }, username: { type: 'string', description: 'WordPress username' }, applicationPassword: { type: 'string', description: 'WordPress application password (not regular password)' } }, required: ['baseUrl', 'username', 'applicationPassword'] }, handler: async (args: any) => { const wpConfig: WordPressConfig = { baseUrl: args.baseUrl.replace(/\/$/, ''), username: args.username, applicationPassword: args.applicationPassword }; try { validateWordPressConfig(wpConfig); logger.info('WordPress configuration validated successfully'); return { content: [{ type: 'text', text: 'WordPress connection configured successfully. Note: Server restart required to apply changes.' }] }; } catch (error: any) { return { content: [{ type: 'text', text: `Configuration validation failed: ${error.message}` }] }; } } }); tools.push({ name: 'test_wordpress_connection', description: 'Test WordPress connection with current configuration', inputSchema: { type: 'object', properties: {} }, handler: async (args: any) => { // This would test the actual connection // For now, we'll return a status message return { content: [{ type: 'text', text: 'WordPress connection test tool - would test connection here' }] }; } }); return tools; }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/mbrown1837/Ultimate-Elementor-MCP'

If you have feedback or need assistance with the MCP directory API, please join our Discord server