Skip to main content
Glama

MCP Project Orchestrator

mcp-server-dev-prompt-combiner.jsonโ€ข15.6 kB
{ "id": "mcp-server-dev-prompt-combiner", "name": "MCP Server Development Prompt Combiner", "description": "A specialized prompt combiner for MCP server development that integrates interface definitions, implementation patterns, and best practices", "content": "/**\n * MCPServerDevPromptCombiner for {{project_name}}\n * \n * A specialized implementation of the PromptCombiner interface\n * focused on combining prompts for MCP server development workflows.\n */\n\nimport { PromptCombiner, CombinerContext, CombinedPromptResult, PromptSuggestion, CombinationValidationResult, WorkflowConfig, SavedWorkflow } from './prompt-combiner-interface';\nimport { PromptService } from '../services/prompt-service';\nimport { Prompt } from '../core/types';\n\n/**\n * MCP Server Development specific context\n */\nexport interface MCPServerDevContext extends CombinerContext {\n /** Server configuration */\n serverConfig?: {\n name: string;\n version: string;\n capabilities: string[];\n };\n \n /** Core technologies being used */\n technologies: {\n language: string;\n runtime: string;\n frameworks: string[];\n };\n \n /** MCP Server SDK version */\n sdkVersion: string;\n \n /** Tools to be implemented */\n tools?: {\n name: string;\n description: string;\n parameters?: Record<string, any>;\n }[];\n \n /** Resources to be implemented */\n resources?: {\n protocol: string;\n description: string;\n }[];\n \n /** Deployment target environment */\n deploymentTarget?: 'docker' | 'kubernetes' | 'serverless' | 'standalone';\n \n /** Additional MCP-specific context */\n {{additional_mcp_context}}\n}\n\n/**\n * Specialized result for MCP Server development combinations\n */\nexport interface MCPServerDevResult extends CombinedPromptResult {\n /** Generated interface definitions */\n interfaces?: string;\n \n /** Generated MCP tools implementation */\n toolsImplementation?: string;\n \n /** Generated MCP resources implementation */\n resourcesImplementation?: string;\n \n /** Server configuration */\n serverConfiguration?: string;\n \n /** Client integration examples */\n clientExamples?: string;\n \n /** Testing approach */\n testingApproach?: string;\n \n /** Dockerfile and Docker Compose configuration */\n dockerConfiguration?: string;\n \n /** Additional MCP-specific results */\n {{additional_mcp_results}}\n}\n\n/**\n * Implementation of MCPServerDevPromptCombiner\n */\nexport class MCPServerDevPromptCombiner implements PromptCombiner {\n constructor(private promptService: PromptService) {}\n \n /**\n * Combines MCP server development prompts\n * @param promptIds Array of prompt IDs to combine\n * @param context Optional MCP server development context\n * @returns Combined MCP server development result\n */\n async combinePrompts(promptIds: string[], context?: MCPServerDevContext): Promise<MCPServerDevResult> {\n // Implementation would include:\n // 1. Validating the prompts are compatible for MCP development\n // 2. Organizing prompts into logical sections (interfaces, tools, resources, etc.)\n // 3. Resolving dependencies between prompts\n // 4. Applying variables with MCP-specific knowledge\n // 5. Generating a comprehensive server implementation guide\n \n // This is a template structure - in a real implementation, this would contain\n // the actual logic for combining MCP server development prompts\n \n // For now, we'll outline the structure of how the implementation would work\n \n // Step 1: Load and categorize all prompts\n const prompts = await Promise.all(promptIds.map(id => this.promptService.getPrompt(id)));\n \n const interfacePrompts = prompts.filter(p => p.tags?.includes('interfaces'));\n const toolPrompts = prompts.filter(p => p.tags?.includes('tools'));\n const resourcePrompts = prompts.filter(p => p.tags?.includes('resources'));\n const configPrompts = prompts.filter(p => p.tags?.includes('configuration'));\n const deploymentPrompts = prompts.filter(p => p.tags?.includes('deployment'));\n \n // Step 2: Apply variables to each prompt category\n const variables = context?.variables || {};\n \n // Combine interface definitions\n const interfaces = await this.combineCategory(interfacePrompts, variables);\n \n // Combine tool implementations\n const toolsImplementation = await this.combineCategory(toolPrompts, variables);\n \n // Combine resource implementations\n const resourcesImplementation = await this.combineCategory(resourcePrompts, variables);\n \n // Combine server configuration\n const serverConfiguration = await this.combineCategory(configPrompts, variables);\n \n // Combine deployment configuration\n const dockerConfiguration = await this.combineCategory(deploymentPrompts, variables);\n \n // Step 3: Create combined content with logical sections\n const combinedContent = `\n# MCP Server Implementation for ${variables.project_name || 'Your Project'}\n\n## Overview\n\nThis guide provides a comprehensive implementation plan for an MCP server using ${variables.language || 'TypeScript'} and the MCP SDK version ${context?.sdkVersion || 'latest'}.\n\n## Interface Definitions\n\n${interfaces.content}\n\n## Tools Implementation\n\n${toolsImplementation.content}\n\n## Resources Implementation\n\n${resourcesImplementation.content}\n\n## Server Configuration\n\n${serverConfiguration.content}\n\n## Deployment Configuration\n\n${dockerConfiguration.content}\n\n## Implementation Steps\n\n1. Set up the project structure\n2. Implement the interfaces\n3. Implement the MCP tools\n4. Implement the MCP resources\n5. Configure the server\n6. Set up deployment\n7. Implement tests\n8. Document the server\n `;\n \n // Step 4: Return the comprehensive result\n return {\n content: combinedContent,\n components: [\n ...interfaces.components,\n ...toolsImplementation.components,\n ...resourcesImplementation.components,\n ...serverConfiguration.components,\n ...dockerConfiguration.components\n ],\n appliedVariables: variables,\n interfaces: interfaces.content,\n toolsImplementation: toolsImplementation.content,\n resourcesImplementation: resourcesImplementation.content,\n serverConfiguration: serverConfiguration.content,\n dockerConfiguration: dockerConfiguration.content,\n // Add suggestion for what to implement first\n nextSteps: [\n { action: 'implement_interfaces', description: 'Start by implementing the core interfaces' },\n { action: 'implement_tools', description: 'Implement the MCP tools using the SDK' },\n { action: 'implement_resources', description: 'Implement the MCP resources' },\n { action: 'configure_server', description: 'Set up the server configuration' },\n { action: 'setup_deployment', description: 'Configure Docker and deployment' }\n ]\n };\n }\n \n /**\n * Helper method to combine prompts in a specific category\n * @param prompts Prompts in the category\n * @param variables Variables to apply\n * @returns Combined result for the category\n */\n private async combineCategory(prompts: Prompt[], variables: Record<string, any>): Promise<CombinedPromptResult> {\n // Implementation would combine prompts within a category\n // This is a simplified placeholder\n let content = '';\n const components: {id: string; name: string; contribution: string}[] = [];\n \n for (const prompt of prompts) {\n const result = await this.promptService.applyTemplate(prompt.id, variables);\n content += result.content + '\\n\\n';\n components.push({\n id: prompt.id,\n name: prompt.name,\n contribution: result.content\n });\n }\n \n return {\n content: content.trim(),\n components,\n appliedVariables: variables\n };\n }\n \n /**\n * Gets MCP server development prompt suggestions\n * @param category Optional category to filter by\n * @param context Current MCP context to inform suggestions\n * @returns Array of prompt suggestions for MCP development\n */\n async getPromptSuggestions(category?: string, context?: MCPServerDevContext): Promise<PromptSuggestion[]> {\n // Implementation would suggest prompts based on the current MCP development context\n // For example, if building a tool-heavy server, suggest more tool-related prompts\n // This is a placeholder for demonstration\n \n // In a real implementation, this would query the prompt service for relevant prompts\n // based on the specific MCP development needs\n \n return [\n {\n id: 'consolidated-interfaces-template',\n name: 'Consolidated TypeScript Interfaces',\n relevance: 95,\n compatibleWith: ['mcp-server-tools-implementation', 'docker-containerization-guide'],\n reason: 'Provides the interface foundation for your MCP server'\n },\n {\n id: 'mcp-server-tools-implementation',\n name: 'MCP Server Tools Implementation',\n relevance: 90,\n compatibleWith: ['consolidated-interfaces-template', 'mcp-server-resources-implementation'],\n reason: `${context?.tools?.length || 0} tools need implementation in your server`\n },\n {\n id: 'mcp-server-resources-implementation',\n name: 'MCP Server Resources Implementation',\n relevance: 85,\n compatibleWith: ['consolidated-interfaces-template', 'mcp-server-tools-implementation'],\n reason: `${context?.resources?.length || 0} resources need implementation in your server`\n },\n {\n id: 'docker-containerization-guide',\n name: 'Docker Containerization Guide',\n relevance: context?.deploymentTarget === 'docker' ? 100 : 70,\n compatibleWith: ['consolidated-interfaces-template'],\n reason: 'Provides Docker deployment configuration for your MCP server'\n },\n {\n id: 'development-system-prompt',\n name: 'Development System Prompt',\n relevance: 60,\n compatibleWith: [],\n reason: 'Helps with general development assistance for your MCP server'\n }\n ];\n }\n \n /**\n * Validates if the prompts can be combined for MCP server development\n * @param promptIds Array of prompt IDs to validate\n * @returns Validation result with any issues specific to MCP development\n */\n async validateCombination(promptIds: string[]): Promise<CombinationValidationResult> {\n // Implementation would validate that the prompts make sense for MCP development\n // For example, ensuring there are no conflicting tool definitions\n // This is a placeholder for demonstration\n \n const prompts = await Promise.all(promptIds.map(id => this.promptService.getPrompt(id)));\n \n // Check for interface prompt\n const hasInterface = prompts.some(p => p.tags?.includes('interfaces'));\n if (!hasInterface) {\n return {\n isValid: false,\n issues: [{\n promptId: '',\n issue: 'Missing interface definition prompt',\n severity: 'error',\n suggestion: 'Add a prompt with interface definitions, such as consolidated-interfaces-template'\n }],\n suggestions: [{\n promptIds: [...promptIds, 'consolidated-interfaces-template'],\n reason: 'Adding interface definitions is essential for MCP server development'\n }]\n };\n }\n \n // In a real implementation, would do more validation specific to MCP development\n \n return {\n isValid: true\n };\n }\n \n /**\n * Creates a saved MCP server development workflow\n * @param name Name for the new workflow\n * @param promptIds Component prompt IDs\n * @param config Configuration for the combination\n * @returns The created MCP workflow\n */\n async saveWorkflow(name: string, promptIds: string[], config: WorkflowConfig): Promise<SavedWorkflow> {\n // Implementation would save an MCP development workflow\n // This is a placeholder for demonstration\n \n return {\n id: `mcp-dev-workflow-${Date.now()}`,\n name,\n promptIds,\n config,\n createdAt: new Date().toISOString(),\n updatedAt: new Date().toISOString(),\n version: 1,\n category: 'mcp-development',\n tags: ['mcp', 'development', 'server']\n };\n }\n \n /**\n * Loads a previously saved MCP server development workflow\n * @param workflowId ID of the saved workflow\n * @returns The loaded MCP workflow\n */\n async loadWorkflow(workflowId: string): Promise<SavedWorkflow> {\n // Implementation would load an MCP development workflow\n // This is a placeholder for demonstration\n \n throw new Error(`Workflow ${workflowId} not found or not implemented yet`);\n }\n}\n\n/**\n * Usage Examples\n * \n * ```typescript\n * // Creating a combiner\n * const promptService = new PromptService(storageAdapter);\n * const mcpCombiner = new MCPServerDevPromptCombiner(promptService);\n * \n * // Getting prompt suggestions for MCP development\n * const suggestions = await mcpCombiner.getPromptSuggestions('tools', {\n * technologies: {\n * language: 'TypeScript',\n * runtime: 'Node.js',\n * frameworks: ['Express']\n * },\n * sdkVersion: '1.6.0',\n * tools: [\n * { name: 'get_document', description: 'Retrieve a document by ID' },\n * { name: 'search_documents', description: 'Search for documents' }\n * ],\n * resources: [\n * { protocol: 'document', description: 'Document resource protocol' }\n * ],\n * deploymentTarget: 'docker'\n * });\n * \n * // Combining prompts for MCP development\n * const result = await mcpCombiner.combinePrompts([\n * 'consolidated-interfaces-template',\n * 'mcp-server-tools-implementation',\n * 'docker-containerization-guide'\n * ], {\n * variables: {\n * project_name: 'Document Management MCP Server',\n * language: 'TypeScript',\n * primary_entity: 'Document',\n * node_version: '20'\n * },\n * technologies: {\n * language: 'TypeScript',\n * runtime: 'Node.js',\n * frameworks: ['Express']\n * },\n * sdkVersion: '1.6.0',\n * deploymentTarget: 'docker'\n * });\n * \n * // Using the specialized result properties\n * console.log(result.interfaces); // Get just the interface definitions\n * console.log(result.toolsImplementation); // Get just the tools implementation\n * console.log(result.dockerConfiguration); // Get just the Docker configuration\n * ```\n */\n\n// ============================\n// Extension Guidelines\n// ============================\n\n/**\n * When extending MCPServerDevPromptCombiner, consider:\n * \n * 1. Adding support for specific MCP server types (e.g., FileSystem, GitHub, Memory)\n * 2. Enhancing the context with more MCP-specific properties\n * 3. Improving suggestion logic based on the development context\n * 4. Adding template validation specific to MCP compatibility\n * 5. {{additional_extension_guidelines}}\n */", "isTemplate": true, "variables": [ "project_name", "additional_mcp_context", "additional_mcp_results", "additional_extension_guidelines" ], "tags": [ "development", "mcp", "server", "prompt-engineering", "integration" ], "category": "development", "createdAt": "2024-08-08T17:15:00.000Z", "updatedAt": "2024-08-08T17:15:00.000Z", "version": 1 }

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/sparesparrow/mcp-project-orchestrator'

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