stringray-ai 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mcp.json +68 -0
- package/LICENSE +21 -0
- package/README.md +618 -0
- package/dist/agents/architect.d.ts +3 -0
- package/dist/agents/architect.d.ts.map +1 -0
- package/dist/agents/architect.js +84 -0
- package/dist/agents/architect.js.map +1 -0
- package/dist/agents/bug-triage-specialist.d.ts +3 -0
- package/dist/agents/bug-triage-specialist.d.ts.map +1 -0
- package/dist/agents/bug-triage-specialist.js +66 -0
- package/dist/agents/bug-triage-specialist.js.map +1 -0
- package/dist/agents/code-reviewer.d.ts +3 -0
- package/dist/agents/code-reviewer.d.ts.map +1 -0
- package/dist/agents/code-reviewer.js +66 -0
- package/dist/agents/code-reviewer.js.map +1 -0
- package/dist/agents/enforcer.d.ts +3 -0
- package/dist/agents/enforcer.d.ts.map +1 -0
- package/dist/agents/enforcer.js +109 -0
- package/dist/agents/enforcer.js.map +1 -0
- package/dist/agents/index.d.ts +15 -0
- package/dist/agents/index.d.ts.map +1 -0
- package/dist/agents/index.js +26 -0
- package/dist/agents/index.js.map +1 -0
- package/dist/agents/librarian.d.ts +3 -0
- package/dist/agents/librarian.d.ts.map +1 -0
- package/dist/agents/librarian.js +70 -0
- package/dist/agents/librarian.js.map +1 -0
- package/dist/agents/log-monitor.d.ts +3 -0
- package/dist/agents/log-monitor.d.ts.map +1 -0
- package/dist/agents/log-monitor.js +102 -0
- package/dist/agents/log-monitor.js.map +1 -0
- package/dist/agents/orchestrator.d.ts +3 -0
- package/dist/agents/orchestrator.d.ts.map +1 -0
- package/dist/agents/orchestrator.js +85 -0
- package/dist/agents/orchestrator.js.map +1 -0
- package/dist/agents/refactorer.d.ts +3 -0
- package/dist/agents/refactorer.d.ts.map +1 -0
- package/dist/agents/refactorer.js +67 -0
- package/dist/agents/refactorer.js.map +1 -0
- package/dist/agents/security-auditor.d.ts +3 -0
- package/dist/agents/security-auditor.d.ts.map +1 -0
- package/dist/agents/security-auditor.js +66 -0
- package/dist/agents/security-auditor.js.map +1 -0
- package/dist/agents/sisyphus.d.ts +3 -0
- package/dist/agents/sisyphus.d.ts.map +1 -0
- package/dist/agents/sisyphus.js +53 -0
- package/dist/agents/sisyphus.js.map +1 -0
- package/dist/agents/test-architect.d.ts +3 -0
- package/dist/agents/test-architect.d.ts.map +1 -0
- package/dist/agents/test-architect.js +81 -0
- package/dist/agents/test-architect.js.map +1 -0
- package/dist/agents/types.d.ts +29 -0
- package/dist/agents/types.d.ts.map +1 -0
- package/dist/agents/types.js +2 -0
- package/dist/agents/types.js.map +1 -0
- package/dist/mcps/architect-tools.server.d.ts +40 -0
- package/dist/mcps/architect-tools.server.d.ts.map +1 -0
- package/dist/mcps/architect-tools.server.js +563 -0
- package/dist/mcps/architect-tools.server.js.map +1 -0
- package/dist/mcps/auto-format.server.d.ts +20 -0
- package/dist/mcps/auto-format.server.d.ts.map +1 -0
- package/dist/mcps/auto-format.server.js +391 -0
- package/dist/mcps/auto-format.server.js.map +1 -0
- package/dist/mcps/boot-orchestrator.server.d.ts +50 -0
- package/dist/mcps/boot-orchestrator.server.d.ts.map +1 -0
- package/dist/mcps/boot-orchestrator.server.js +871 -0
- package/dist/mcps/boot-orchestrator.server.js.map +1 -0
- package/dist/mcps/enforcer-tools.server.d.ts +26 -0
- package/dist/mcps/enforcer-tools.server.d.ts.map +1 -0
- package/dist/mcps/enforcer-tools.server.js +627 -0
- package/dist/mcps/enforcer-tools.server.js.map +1 -0
- package/dist/mcps/enhanced-orchestrator.server.d.ts +14 -0
- package/dist/mcps/enhanced-orchestrator.server.d.ts.map +1 -0
- package/dist/mcps/enhanced-orchestrator.server.js +250 -0
- package/dist/mcps/enhanced-orchestrator.server.js.map +1 -0
- package/dist/mcps/framework-compliance-audit.server.d.ts +23 -0
- package/dist/mcps/framework-compliance-audit.server.d.ts.map +1 -0
- package/dist/mcps/framework-compliance-audit.server.js +511 -0
- package/dist/mcps/framework-compliance-audit.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/api-design.server.d.ts +16 -0
- package/dist/mcps/knowledge-skills/api-design.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/api-design.server.js +120 -0
- package/dist/mcps/knowledge-skills/api-design.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts +16 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js +110 -0
- package/dist/mcps/knowledge-skills/architecture-patterns.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/code-review.server.d.ts +32 -0
- package/dist/mcps/knowledge-skills/code-review.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/code-review.server.js +777 -0
- package/dist/mcps/knowledge-skills/code-review.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/database-design.server.d.ts +44 -0
- package/dist/mcps/knowledge-skills/database-design.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/database-design.server.js +818 -0
- package/dist/mcps/knowledge-skills/database-design.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts +44 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.js +1178 -0
- package/dist/mcps/knowledge-skills/devops-deployment.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/documentation-generation.server.d.ts +48 -0
- package/dist/mcps/knowledge-skills/documentation-generation.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/documentation-generation.server.js +1188 -0
- package/dist/mcps/knowledge-skills/documentation-generation.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.d.ts +16 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.js +112 -0
- package/dist/mcps/knowledge-skills/git-workflow.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts +16 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.js +108 -0
- package/dist/mcps/knowledge-skills/performance-optimization.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.d.ts +34 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.js +710 -0
- package/dist/mcps/knowledge-skills/project-analysis.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts +34 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js +794 -0
- package/dist/mcps/knowledge-skills/refactoring-strategies.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/security-audit.server.d.ts +34 -0
- package/dist/mcps/knowledge-skills/security-audit.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/security-audit.server.js +769 -0
- package/dist/mcps/knowledge-skills/security-audit.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts +37 -0
- package/dist/mcps/knowledge-skills/testing-best-practices.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js +865 -0
- package/dist/mcps/knowledge-skills/testing-best-practices.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts +47 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.js +672 -0
- package/dist/mcps/knowledge-skills/testing-strategy.server.js.map +1 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts +42 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.d.ts.map +1 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js +1016 -0
- package/dist/mcps/knowledge-skills/ui-ux-design.server.js.map +1 -0
- package/dist/mcps/lint.server.d.ts +18 -0
- package/dist/mcps/lint.server.d.ts.map +1 -0
- package/dist/mcps/lint.server.js +334 -0
- package/dist/mcps/lint.server.js.map +1 -0
- package/dist/mcps/model-health-check.server.d.ts +17 -0
- package/dist/mcps/model-health-check.server.d.ts.map +1 -0
- package/dist/mcps/model-health-check.server.js +226 -0
- package/dist/mcps/model-health-check.server.js.map +1 -0
- package/dist/mcps/orchestrator.server.d.ts +39 -0
- package/dist/mcps/orchestrator.server.d.ts.map +1 -0
- package/dist/mcps/orchestrator.server.js +908 -0
- package/dist/mcps/orchestrator.server.js.map +1 -0
- package/dist/mcps/performance-analysis.server.d.ts +28 -0
- package/dist/mcps/performance-analysis.server.d.ts.map +1 -0
- package/dist/mcps/performance-analysis.server.js +514 -0
- package/dist/mcps/performance-analysis.server.js.map +1 -0
- package/dist/mcps/processor-pipeline.server.d.ts +29 -0
- package/dist/mcps/processor-pipeline.server.d.ts.map +1 -0
- package/dist/mcps/processor-pipeline.server.js +520 -0
- package/dist/mcps/processor-pipeline.server.js.map +1 -0
- package/dist/mcps/security-scan.server.d.ts +20 -0
- package/dist/mcps/security-scan.server.d.ts.map +1 -0
- package/dist/mcps/security-scan.server.js +404 -0
- package/dist/mcps/security-scan.server.js.map +1 -0
- package/dist/mcps/state-manager.server.d.ts +29 -0
- package/dist/mcps/state-manager.server.d.ts.map +1 -0
- package/dist/mcps/state-manager.server.js +620 -0
- package/dist/mcps/state-manager.server.js.map +1 -0
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.d.ts +109 -0
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.d.ts.map +1 -0
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.js +337 -0
- package/dist/orchestrator/enhanced-multi-agent-orchestrator.js.map +1 -0
- package/dist/orchestrator/intelligent-commit-batcher.d.ts +112 -0
- package/dist/orchestrator/intelligent-commit-batcher.d.ts.map +1 -0
- package/dist/orchestrator/intelligent-commit-batcher.js +330 -0
- package/dist/orchestrator/intelligent-commit-batcher.js.map +1 -0
- package/dist/plugin/agents/architect.d.ts +3 -0
- package/dist/plugin/agents/architect.d.ts.map +1 -0
- package/dist/plugin/agents/architect.js +84 -0
- package/dist/plugin/agents/architect.js.map +1 -0
- package/dist/plugin/agents/bug-triage-specialist.d.ts +3 -0
- package/dist/plugin/agents/bug-triage-specialist.d.ts.map +1 -0
- package/dist/plugin/agents/bug-triage-specialist.js +66 -0
- package/dist/plugin/agents/bug-triage-specialist.js.map +1 -0
- package/dist/plugin/agents/code-reviewer.d.ts +3 -0
- package/dist/plugin/agents/code-reviewer.d.ts.map +1 -0
- package/dist/plugin/agents/code-reviewer.js +66 -0
- package/dist/plugin/agents/code-reviewer.js.map +1 -0
- package/dist/plugin/agents/enforcer.d.ts +3 -0
- package/dist/plugin/agents/enforcer.d.ts.map +1 -0
- package/dist/plugin/agents/enforcer.js +109 -0
- package/dist/plugin/agents/enforcer.js.map +1 -0
- package/dist/plugin/agents/index.d.ts +15 -0
- package/dist/plugin/agents/index.d.ts.map +1 -0
- package/dist/plugin/agents/index.js +26 -0
- package/dist/plugin/agents/index.js.map +1 -0
- package/dist/plugin/agents/librarian.d.ts +3 -0
- package/dist/plugin/agents/librarian.d.ts.map +1 -0
- package/dist/plugin/agents/librarian.js +70 -0
- package/dist/plugin/agents/librarian.js.map +1 -0
- package/dist/plugin/agents/log-monitor.d.ts +3 -0
- package/dist/plugin/agents/log-monitor.d.ts.map +1 -0
- package/dist/plugin/agents/log-monitor.js +102 -0
- package/dist/plugin/agents/log-monitor.js.map +1 -0
- package/dist/plugin/agents/orchestrator.d.ts +3 -0
- package/dist/plugin/agents/orchestrator.d.ts.map +1 -0
- package/dist/plugin/agents/orchestrator.js +85 -0
- package/dist/plugin/agents/orchestrator.js.map +1 -0
- package/dist/plugin/agents/refactorer.d.ts +3 -0
- package/dist/plugin/agents/refactorer.d.ts.map +1 -0
- package/dist/plugin/agents/refactorer.js +67 -0
- package/dist/plugin/agents/refactorer.js.map +1 -0
- package/dist/plugin/agents/security-auditor.d.ts +3 -0
- package/dist/plugin/agents/security-auditor.d.ts.map +1 -0
- package/dist/plugin/agents/security-auditor.js +66 -0
- package/dist/plugin/agents/security-auditor.js.map +1 -0
- package/dist/plugin/agents/sisyphus.d.ts +3 -0
- package/dist/plugin/agents/sisyphus.d.ts.map +1 -0
- package/dist/plugin/agents/sisyphus.js +53 -0
- package/dist/plugin/agents/sisyphus.js.map +1 -0
- package/dist/plugin/agents/test-architect.d.ts +3 -0
- package/dist/plugin/agents/test-architect.d.ts.map +1 -0
- package/dist/plugin/agents/test-architect.js +81 -0
- package/dist/plugin/agents/test-architect.js.map +1 -0
- package/dist/plugin/agents/types.d.ts +29 -0
- package/dist/plugin/agents/types.d.ts.map +1 -0
- package/dist/plugin/agents/types.js +2 -0
- package/dist/plugin/agents/types.js.map +1 -0
- package/dist/plugin/config-loader.d.ts +67 -0
- package/dist/plugin/config-loader.d.ts.map +1 -0
- package/dist/plugin/config-loader.js +125 -0
- package/dist/plugin/config-loader.js.map +1 -0
- package/dist/plugin/context-loader.d.ts +122 -0
- package/dist/plugin/context-loader.d.ts.map +1 -0
- package/dist/plugin/context-loader.js +273 -0
- package/dist/plugin/context-loader.js.map +1 -0
- package/dist/plugin/delegation/agent-delegator.d.ts +217 -0
- package/dist/plugin/delegation/agent-delegator.d.ts.map +1 -0
- package/dist/plugin/delegation/agent-delegator.js +928 -0
- package/dist/plugin/delegation/agent-delegator.js.map +1 -0
- package/dist/plugin/delegation/codebase-context-analyzer.d.ts +157 -0
- package/dist/plugin/delegation/codebase-context-analyzer.d.ts.map +1 -0
- package/dist/plugin/delegation/codebase-context-analyzer.js +1029 -0
- package/dist/plugin/delegation/codebase-context-analyzer.js.map +1 -0
- package/dist/plugin/delegation/complexity-analyzer.d.ts +61 -0
- package/dist/plugin/delegation/complexity-analyzer.d.ts.map +1 -0
- package/dist/plugin/delegation/complexity-analyzer.js +253 -0
- package/dist/plugin/delegation/complexity-analyzer.js.map +1 -0
- package/dist/plugin/enforcement/enforcer-tools.d.ts +62 -0
- package/dist/plugin/enforcement/enforcer-tools.d.ts.map +1 -0
- package/dist/plugin/enforcement/enforcer-tools.js +407 -0
- package/dist/plugin/enforcement/enforcer-tools.js.map +1 -0
- package/dist/plugin/enforcement/rule-enforcer.d.ts +171 -0
- package/dist/plugin/enforcement/rule-enforcer.d.ts.map +1 -0
- package/dist/plugin/enforcement/rule-enforcer.js +1342 -0
- package/dist/plugin/enforcement/rule-enforcer.js.map +1 -0
- package/dist/plugin/enforcement/test-auto-healing.d.ts +78 -0
- package/dist/plugin/enforcement/test-auto-healing.d.ts.map +1 -0
- package/dist/plugin/enforcement/test-auto-healing.js +318 -0
- package/dist/plugin/enforcement/test-auto-healing.js.map +1 -0
- package/dist/plugin/framework-logger.d.ts +20 -0
- package/dist/plugin/framework-logger.d.ts.map +1 -0
- package/dist/plugin/framework-logger.js +79 -0
- package/dist/plugin/framework-logger.js.map +1 -0
- package/dist/plugin/logging-config.d.ts +11 -0
- package/dist/plugin/logging-config.d.ts.map +1 -0
- package/dist/plugin/logging-config.js +44 -0
- package/dist/plugin/logging-config.js.map +1 -0
- package/dist/plugin/mcps/architect-tools.server.d.ts +40 -0
- package/dist/plugin/mcps/architect-tools.server.d.ts.map +1 -0
- package/dist/plugin/mcps/architect-tools.server.js +563 -0
- package/dist/plugin/mcps/architect-tools.server.js.map +1 -0
- package/dist/plugin/mcps/auto-format.server.d.ts +20 -0
- package/dist/plugin/mcps/auto-format.server.d.ts.map +1 -0
- package/dist/plugin/mcps/auto-format.server.js +391 -0
- package/dist/plugin/mcps/auto-format.server.js.map +1 -0
- package/dist/plugin/mcps/boot-orchestrator.server.d.ts +50 -0
- package/dist/plugin/mcps/boot-orchestrator.server.d.ts.map +1 -0
- package/dist/plugin/mcps/boot-orchestrator.server.js +871 -0
- package/dist/plugin/mcps/boot-orchestrator.server.js.map +1 -0
- package/dist/plugin/mcps/enforcer-tools.server.d.ts +26 -0
- package/dist/plugin/mcps/enforcer-tools.server.d.ts.map +1 -0
- package/dist/plugin/mcps/enforcer-tools.server.js +627 -0
- package/dist/plugin/mcps/enforcer-tools.server.js.map +1 -0
- package/dist/plugin/mcps/enhanced-orchestrator.server.d.ts +14 -0
- package/dist/plugin/mcps/enhanced-orchestrator.server.d.ts.map +1 -0
- package/dist/plugin/mcps/enhanced-orchestrator.server.js +250 -0
- package/dist/plugin/mcps/enhanced-orchestrator.server.js.map +1 -0
- package/dist/plugin/mcps/framework-compliance-audit.server.d.ts +23 -0
- package/dist/plugin/mcps/framework-compliance-audit.server.d.ts.map +1 -0
- package/dist/plugin/mcps/framework-compliance-audit.server.js +511 -0
- package/dist/plugin/mcps/framework-compliance-audit.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/api-design.server.d.ts +16 -0
- package/dist/plugin/mcps/knowledge-skills/api-design.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/api-design.server.js +120 -0
- package/dist/plugin/mcps/knowledge-skills/api-design.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/architecture-patterns.server.d.ts +16 -0
- package/dist/plugin/mcps/knowledge-skills/architecture-patterns.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/architecture-patterns.server.js +110 -0
- package/dist/plugin/mcps/knowledge-skills/architecture-patterns.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/code-review.server.d.ts +32 -0
- package/dist/plugin/mcps/knowledge-skills/code-review.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/code-review.server.js +777 -0
- package/dist/plugin/mcps/knowledge-skills/code-review.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/database-design.server.d.ts +44 -0
- package/dist/plugin/mcps/knowledge-skills/database-design.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/database-design.server.js +818 -0
- package/dist/plugin/mcps/knowledge-skills/database-design.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/devops-deployment.server.d.ts +44 -0
- package/dist/plugin/mcps/knowledge-skills/devops-deployment.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/devops-deployment.server.js +1178 -0
- package/dist/plugin/mcps/knowledge-skills/devops-deployment.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/documentation-generation.server.d.ts +48 -0
- package/dist/plugin/mcps/knowledge-skills/documentation-generation.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/documentation-generation.server.js +1188 -0
- package/dist/plugin/mcps/knowledge-skills/documentation-generation.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/git-workflow.server.d.ts +16 -0
- package/dist/plugin/mcps/knowledge-skills/git-workflow.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/git-workflow.server.js +112 -0
- package/dist/plugin/mcps/knowledge-skills/git-workflow.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/performance-optimization.server.d.ts +16 -0
- package/dist/plugin/mcps/knowledge-skills/performance-optimization.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/performance-optimization.server.js +108 -0
- package/dist/plugin/mcps/knowledge-skills/performance-optimization.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/project-analysis.server.d.ts +34 -0
- package/dist/plugin/mcps/knowledge-skills/project-analysis.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/project-analysis.server.js +710 -0
- package/dist/plugin/mcps/knowledge-skills/project-analysis.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/refactoring-strategies.server.d.ts +34 -0
- package/dist/plugin/mcps/knowledge-skills/refactoring-strategies.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/refactoring-strategies.server.js +794 -0
- package/dist/plugin/mcps/knowledge-skills/refactoring-strategies.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/security-audit.server.d.ts +34 -0
- package/dist/plugin/mcps/knowledge-skills/security-audit.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/security-audit.server.js +769 -0
- package/dist/plugin/mcps/knowledge-skills/security-audit.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/testing-best-practices.server.d.ts +37 -0
- package/dist/plugin/mcps/knowledge-skills/testing-best-practices.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/testing-best-practices.server.js +865 -0
- package/dist/plugin/mcps/knowledge-skills/testing-best-practices.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/testing-strategy.server.d.ts +47 -0
- package/dist/plugin/mcps/knowledge-skills/testing-strategy.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/testing-strategy.server.js +672 -0
- package/dist/plugin/mcps/knowledge-skills/testing-strategy.server.js.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/ui-ux-design.server.d.ts +42 -0
- package/dist/plugin/mcps/knowledge-skills/ui-ux-design.server.d.ts.map +1 -0
- package/dist/plugin/mcps/knowledge-skills/ui-ux-design.server.js +1016 -0
- package/dist/plugin/mcps/knowledge-skills/ui-ux-design.server.js.map +1 -0
- package/dist/plugin/mcps/lint.server.d.ts +18 -0
- package/dist/plugin/mcps/lint.server.d.ts.map +1 -0
- package/dist/plugin/mcps/lint.server.js +334 -0
- package/dist/plugin/mcps/lint.server.js.map +1 -0
- package/dist/plugin/mcps/model-health-check.server.d.ts +17 -0
- package/dist/plugin/mcps/model-health-check.server.d.ts.map +1 -0
- package/dist/plugin/mcps/model-health-check.server.js +226 -0
- package/dist/plugin/mcps/model-health-check.server.js.map +1 -0
- package/dist/plugin/mcps/orchestrator.server.d.ts +39 -0
- package/dist/plugin/mcps/orchestrator.server.d.ts.map +1 -0
- package/dist/plugin/mcps/orchestrator.server.js +908 -0
- package/dist/plugin/mcps/orchestrator.server.js.map +1 -0
- package/dist/plugin/mcps/performance-analysis.server.d.ts +28 -0
- package/dist/plugin/mcps/performance-analysis.server.d.ts.map +1 -0
- package/dist/plugin/mcps/performance-analysis.server.js +514 -0
- package/dist/plugin/mcps/performance-analysis.server.js.map +1 -0
- package/dist/plugin/mcps/processor-pipeline.server.d.ts +29 -0
- package/dist/plugin/mcps/processor-pipeline.server.d.ts.map +1 -0
- package/dist/plugin/mcps/processor-pipeline.server.js +520 -0
- package/dist/plugin/mcps/processor-pipeline.server.js.map +1 -0
- package/dist/plugin/mcps/security-scan.server.d.ts +20 -0
- package/dist/plugin/mcps/security-scan.server.d.ts.map +1 -0
- package/dist/plugin/mcps/security-scan.server.js +404 -0
- package/dist/plugin/mcps/security-scan.server.js.map +1 -0
- package/dist/plugin/mcps/state-manager.server.d.ts +29 -0
- package/dist/plugin/mcps/state-manager.server.d.ts.map +1 -0
- package/dist/plugin/mcps/state-manager.server.js +620 -0
- package/dist/plugin/mcps/state-manager.server.js.map +1 -0
- package/dist/plugin/monitoring/advanced-profiler.d.ts +48 -0
- package/dist/plugin/monitoring/advanced-profiler.d.ts.map +1 -0
- package/dist/plugin/monitoring/advanced-profiler.js +216 -0
- package/dist/plugin/monitoring/advanced-profiler.js.map +1 -0
- package/dist/plugin/monitoring/enterprise-monitoring-system.d.ts +331 -0
- package/dist/plugin/monitoring/enterprise-monitoring-system.d.ts.map +1 -0
- package/dist/plugin/monitoring/enterprise-monitoring-system.js +797 -0
- package/dist/plugin/monitoring/enterprise-monitoring-system.js.map +1 -0
- package/dist/plugin/orchestrator/enhanced-multi-agent-orchestrator.d.ts +111 -0
- package/dist/plugin/orchestrator/enhanced-multi-agent-orchestrator.d.ts.map +1 -0
- package/dist/plugin/orchestrator/enhanced-multi-agent-orchestrator.js +339 -0
- package/dist/plugin/orchestrator/enhanced-multi-agent-orchestrator.js.map +1 -0
- package/dist/plugin/orchestrator/intelligent-commit-batcher.d.ts +112 -0
- package/dist/plugin/orchestrator/intelligent-commit-batcher.d.ts.map +1 -0
- package/dist/plugin/orchestrator/intelligent-commit-batcher.js +330 -0
- package/dist/plugin/orchestrator/intelligent-commit-batcher.js.map +1 -0
- package/dist/plugin/orchestrator.d.ts +91 -0
- package/dist/plugin/orchestrator.d.ts.map +1 -0
- package/dist/plugin/orchestrator.js +444 -0
- package/dist/plugin/orchestrator.js.map +1 -0
- package/dist/plugin/plugins/marketplace/marketplace-service.d.ts +108 -0
- package/dist/plugin/plugins/marketplace/marketplace-service.d.ts.map +1 -0
- package/dist/plugin/plugins/marketplace/marketplace-service.js +620 -0
- package/dist/plugin/plugins/marketplace/marketplace-service.js.map +1 -0
- package/dist/plugin/plugins/marketplace/marketplace-types.d.ts +468 -0
- package/dist/plugin/plugins/marketplace/marketplace-types.d.ts.map +1 -0
- package/dist/plugin/plugins/marketplace/marketplace-types.js +11 -0
- package/dist/plugin/plugins/marketplace/marketplace-types.js.map +1 -0
- package/dist/plugin/plugins/plugin-system.d.ts +152 -0
- package/dist/plugin/plugins/plugin-system.d.ts.map +1 -0
- package/dist/plugin/plugins/plugin-system.js +405 -0
- package/dist/plugin/plugins/plugin-system.js.map +1 -0
- package/dist/plugin/plugins/stringray-codex-injection.d.ts +68 -0
- package/dist/plugin/plugins/stringray-codex-injection.d.ts.map +1 -0
- package/dist/plugin/plugins/stringray-codex-injection.js +225 -0
- package/dist/plugin/plugins/stringray-codex-injection.js.map +1 -0
- package/dist/plugin/plugins/strray-codex-injection.d.ts +68 -0
- package/dist/plugin/plugins/strray-codex-injection.d.ts.map +1 -0
- package/dist/plugin/plugins/strray-codex-injection.js +225 -0
- package/dist/plugin/plugins/strray-codex-injection.js.map +1 -0
- package/dist/plugin/processors/index.d.ts +12 -0
- package/dist/plugin/processors/index.d.ts.map +1 -0
- package/dist/plugin/processors/index.js +12 -0
- package/dist/plugin/processors/index.js.map +1 -0
- package/dist/plugin/processors/processor-manager.d.ts +113 -0
- package/dist/plugin/processors/processor-manager.d.ts.map +1 -0
- package/dist/plugin/processors/processor-manager.js +498 -0
- package/dist/plugin/processors/processor-manager.js.map +1 -0
- package/dist/plugin/processors/processor-types.d.ts +50 -0
- package/dist/plugin/processors/processor-types.d.ts.map +1 -0
- package/dist/plugin/processors/processor-types.js +10 -0
- package/dist/plugin/processors/processor-types.js.map +1 -0
- package/dist/plugin/processors/refactoring-logging-processor.d.ts +61 -0
- package/dist/plugin/processors/refactoring-logging-processor.d.ts.map +1 -0
- package/dist/plugin/processors/refactoring-logging-processor.js +257 -0
- package/dist/plugin/processors/refactoring-logging-processor.js.map +1 -0
- package/dist/plugin/reporting/framework-reporting-system.d.ts +157 -0
- package/dist/plugin/reporting/framework-reporting-system.d.ts.map +1 -0
- package/dist/plugin/reporting/framework-reporting-system.js +783 -0
- package/dist/plugin/reporting/framework-reporting-system.js.map +1 -0
- package/dist/plugin/security/security-hardening-system.d.ts +220 -0
- package/dist/plugin/security/security-hardening-system.d.ts.map +1 -0
- package/dist/plugin/security/security-hardening-system.js +605 -0
- package/dist/plugin/security/security-hardening-system.js.map +1 -0
- package/dist/plugin/state/context-providers.d.ts +5 -0
- package/dist/plugin/state/context-providers.d.ts.map +1 -0
- package/dist/plugin/state/context-providers.js +2 -0
- package/dist/plugin/state/context-providers.js.map +1 -0
- package/dist/plugin/state/index.d.ts +5 -0
- package/dist/plugin/state/index.d.ts.map +1 -0
- package/dist/plugin/state/index.js +8 -0
- package/dist/plugin/state/index.js.map +1 -0
- package/dist/plugin/state/state-manager.d.ts +29 -0
- package/dist/plugin/state/state-manager.d.ts.map +1 -0
- package/dist/plugin/state/state-manager.js +153 -0
- package/dist/plugin/state/state-manager.js.map +1 -0
- package/dist/plugin/state/state-types.d.ts +6 -0
- package/dist/plugin/state/state-types.d.ts.map +1 -0
- package/dist/plugin/state/state-types.js +2 -0
- package/dist/plugin/state/state-types.js.map +1 -0
- package/dist/plugin/utils/codex-parser.d.ts +62 -0
- package/dist/plugin/utils/codex-parser.d.ts.map +1 -0
- package/dist/plugin/utils/codex-parser.js +396 -0
- package/dist/plugin/utils/codex-parser.js.map +1 -0
- package/dist/plugin/utils/command-runner.d.ts +24 -0
- package/dist/plugin/utils/command-runner.d.ts.map +1 -0
- package/dist/plugin/utils/command-runner.js +44 -0
- package/dist/plugin/utils/command-runner.js.map +1 -0
- package/dist/plugin/utils/import-resolver.d.ts +55 -0
- package/dist/plugin/utils/import-resolver.d.ts.map +1 -0
- package/dist/plugin/utils/import-resolver.js +198 -0
- package/dist/plugin/utils/import-resolver.js.map +1 -0
- package/dist/plugin/utils/memory-pool.d.ts +90 -0
- package/dist/plugin/utils/memory-pool.d.ts.map +1 -0
- package/dist/plugin/utils/memory-pool.js +245 -0
- package/dist/plugin/utils/memory-pool.js.map +1 -0
- package/dist/plugin/utils/path-resolver.d.ts +49 -0
- package/dist/plugin/utils/path-resolver.d.ts.map +1 -0
- package/dist/plugin/utils/path-resolver.js +126 -0
- package/dist/plugin/utils/path-resolver.js.map +1 -0
- package/dist/plugin/utils/test-template-generator.d.ts +26 -0
- package/dist/plugin/utils/test-template-generator.d.ts.map +1 -0
- package/dist/plugin/utils/test-template-generator.js +178 -0
- package/dist/plugin/utils/test-template-generator.js.map +1 -0
- package/dist/processors/index.d.ts +12 -0
- package/dist/processors/index.d.ts.map +1 -0
- package/dist/processors/index.js +12 -0
- package/dist/processors/index.js.map +1 -0
- package/dist/processors/processor-manager.d.ts +113 -0
- package/dist/processors/processor-manager.d.ts.map +1 -0
- package/dist/processors/processor-manager.js +498 -0
- package/dist/processors/processor-manager.js.map +1 -0
- package/dist/processors/processor-types.d.ts +50 -0
- package/dist/processors/processor-types.d.ts.map +1 -0
- package/dist/processors/processor-types.js +10 -0
- package/dist/processors/processor-types.js.map +1 -0
- package/dist/processors/refactoring-logging-processor.d.ts +61 -0
- package/dist/processors/refactoring-logging-processor.d.ts.map +1 -0
- package/dist/processors/refactoring-logging-processor.js +257 -0
- package/dist/processors/refactoring-logging-processor.js.map +1 -0
- package/dist/state/context-providers.d.ts +5 -0
- package/dist/state/context-providers.d.ts.map +1 -0
- package/dist/state/context-providers.js +2 -0
- package/dist/state/context-providers.js.map +1 -0
- package/dist/state/index.d.ts +5 -0
- package/dist/state/index.d.ts.map +1 -0
- package/dist/state/index.js +8 -0
- package/dist/state/index.js.map +1 -0
- package/dist/state/state-manager.d.ts +29 -0
- package/dist/state/state-manager.d.ts.map +1 -0
- package/dist/state/state-manager.js +153 -0
- package/dist/state/state-manager.js.map +1 -0
- package/dist/state/state-types.d.ts +6 -0
- package/dist/state/state-types.d.ts.map +1 -0
- package/dist/state/state-types.js +2 -0
- package/dist/state/state-types.js.map +1 -0
- package/dist/utils/codex-parser.d.ts +62 -0
- package/dist/utils/codex-parser.d.ts.map +1 -0
- package/dist/utils/codex-parser.js +396 -0
- package/dist/utils/codex-parser.js.map +1 -0
- package/dist/utils/command-runner.d.ts +24 -0
- package/dist/utils/command-runner.d.ts.map +1 -0
- package/dist/utils/command-runner.js +44 -0
- package/dist/utils/command-runner.js.map +1 -0
- package/dist/utils/import-resolver.d.ts +55 -0
- package/dist/utils/import-resolver.d.ts.map +1 -0
- package/dist/utils/import-resolver.js +198 -0
- package/dist/utils/import-resolver.js.map +1 -0
- package/dist/utils/memory-pool.d.ts +90 -0
- package/dist/utils/memory-pool.d.ts.map +1 -0
- package/dist/utils/memory-pool.js +245 -0
- package/dist/utils/memory-pool.js.map +1 -0
- package/dist/utils/path-resolver.d.ts +49 -0
- package/dist/utils/path-resolver.d.ts.map +1 -0
- package/dist/utils/path-resolver.js +126 -0
- package/dist/utils/path-resolver.js.map +1 -0
- package/dist/utils/test-template-generator.d.ts +26 -0
- package/dist/utils/test-template-generator.d.ts.map +1 -0
- package/dist/utils/test-template-generator.js +178 -0
- package/dist/utils/test-template-generator.js.map +1 -0
- package/package.json +138 -0
- package/scripts/analysis/analyze-context-awareness.ts +219 -0
- package/scripts/analysis/analyze-framework-usage.ts +208 -0
- package/scripts/analysis/analyzer-agent-runner.js +328 -0
- package/scripts/analysis/context-awareness-report.ts +250 -0
- package/scripts/analyze-imports.mjs +147 -0
- package/scripts/basic-security-audit.cjs +261 -0
- package/scripts/boot-check.cjs +188 -0
- package/scripts/build/check-syntax.sh +1 -0
- package/scripts/build/check-tsc.sh +1 -0
- package/scripts/build/check-types.sh +1 -0
- package/scripts/build/compile-single.sh +1 -0
- package/scripts/build/copy-plugin.sh +1 -0
- package/scripts/build/manual-build.sh +1 -0
- package/scripts/build/run-build-after-copy.sh +1 -0
- package/scripts/build/run-build-attempt.sh +1 -0
- package/scripts/build/run-build-errors-grep.sh +1 -0
- package/scripts/build/run-build-errors.sh +1 -0
- package/scripts/build/run-build-limited.sh +1 -0
- package/scripts/build/run-build-list.sh +1 -0
- package/scripts/build/run-build.sh +1 -0
- package/scripts/build/run-limited.sh +1 -0
- package/scripts/build/run-tsc-direct.sh +1 -0
- package/scripts/build/run-type-check.sh +1 -0
- package/scripts/build/run-typecheck.sh +1 -0
- package/scripts/build/test-build.sh +1 -0
- package/scripts/check-logs.sh +62 -0
- package/scripts/debug/debug-context-enhancement.ts +116 -0
- package/scripts/debug/debug-rules.mjs +23 -0
- package/scripts/demo/demo-clickable-monitoring.mjs +116 -0
- package/scripts/demo/profiling-demo.js +108 -0
- package/scripts/demo/profiling-demo.ts +126 -0
- package/scripts/demo/reporting-demonstration.ts +184 -0
- package/scripts/demo/reporting-examples.ts +105 -0
- package/scripts/dependency-scan.cjs +111 -0
- package/scripts/deploy-stringray-plugin.sh +323 -0
- package/scripts/disable-logging.sh +20 -0
- package/scripts/extract-framework.sh +405 -0
- package/scripts/fix-mcp-capabilities.js +83 -0
- package/scripts/framework/advanced-profiling-integration.sh +384 -0
- package/scripts/framework/check-agent-orchestration-health.sh +113 -0
- package/scripts/framework/enterprise-analysis-test.sh +174 -0
- package/scripts/framework/implement-analyzer-agent.sh +393 -0
- package/scripts/framework/merge-mcp-configs.sh +201 -0
- package/scripts/framework/validate-multi-agent-orchestration.sh +195 -0
- package/scripts/framework/validate-profiling.sh +64 -0
- package/scripts/github-actions-monitor.cjs +289 -0
- package/scripts/init.ts +121 -0
- package/scripts/monitoring/initialize-monitoring-pipeline.sh +89 -0
- package/scripts/monitoring/memory-dashboard.sh +52 -0
- package/scripts/monitoring/monitoring-daemon.mjs +67 -0
- package/scripts/monitoring/monitoring-daemon.sh +190 -0
- package/scripts/monitoring/profiling-dashboard.sh +69 -0
- package/scripts/performance-report.js +56 -0
- package/scripts/postinstall.cjs +240 -0
- package/scripts/profile-performance.sh +263 -0
- package/scripts/register-mcp-servers-fixed.sh +74 -0
- package/scripts/register-mcp-servers.sh +96 -0
- package/scripts/reporting/generate-phase1-report.js +28 -0
- package/scripts/reporting/run-postprocessor.js +59 -0
- package/scripts/reporting/trigger-report.js +15 -0
- package/scripts/run-simulations.mjs +29 -0
- package/scripts/scenario-data-processor.py +122 -0
- package/scripts/scenarios/scenario-security-check.ts +60 -0
- package/scripts/scenarios/scenario-user-management.ts +123 -0
- package/scripts/setup.cjs +128 -0
- package/scripts/simulation/run-simulations.js +84 -0
- package/scripts/simulation/simulate-full-orchestrator.ts +239 -0
- package/scripts/strray-triage.sh +349 -0
- package/scripts/test/run-memory-regression.sh +45 -0
- package/scripts/test/run-test.sh +2 -0
- package/scripts/test/test-deployment.sh +552 -0
- package/scripts/test/test-enhanced-report.ts +24 -0
- package/scripts/test/test-graceful-shutdown.sh +35 -0
- package/scripts/test/test-integration.mjs +79 -0
- package/scripts/test/test-manual-orchestration.sh +168 -0
- package/scripts/test/test-max-agents.sh +70 -0
- package/scripts/test/test-memory-monitor.sh +40 -0
- package/scripts/test/test-memory-pools.sh +58 -0
- package/scripts/test/test-module.ts +1 -0
- package/scripts/test/test-multi-agent-trigger.sh +251 -0
- package/scripts/test/test-orchestrator.txt +1 -0
- package/scripts/test/test-postinstall.js +1 -0
- package/scripts/test/test-security-module.ts +27 -0
- package/scripts/test/test-session-management.js +135 -0
- package/scripts/test/test-simulation.mjs +14 -0
- package/scripts/test/test-user-service.ts +111 -0
- package/scripts/test-comprehensive-path-resolution.mjs +62 -0
- package/scripts/test-data-processor.py +51 -0
- package/scripts/test-enforcement-e2e.mjs +127 -0
- package/scripts/test-full-plugin-no-timeout.sh +30 -0
- package/scripts/test-path-resolver.mjs +32 -0
- package/scripts/test-rules.mjs +128 -0
- package/scripts/test-stringray-plugin.mjs +66 -0
- package/scripts/test-utils/smart-test-runner.mjs +609 -0
- package/scripts/test-utils/test-quarantine.mjs +246 -0
- package/scripts/validate-codex.js +60 -0
- package/scripts/validate-phase1.mjs +189 -0
- package/scripts/validation/run-validators.js +114 -0
- package/scripts/validation/validate-external-processes.js +240 -0
- package/scripts/validation/validate-mcp-connectivity.js +165 -0
- package/scripts/validation/validate-oh-my-opencode-integration.js +200 -0
- package/scripts/validation/validate-reports.ts +114 -0
- package/scripts/verify-phase1.js +144 -0
|
@@ -0,0 +1,818 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* StrRay Database Design MCP Server
|
|
3
|
+
*
|
|
4
|
+
* Knowledge skill for database architecture, schema optimization,
|
|
5
|
+
* query performance analysis, and data modeling best practices
|
|
6
|
+
*/
|
|
7
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
8
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
9
|
+
import { CallToolRequestSchema, ListToolsRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
10
|
+
import * as fs from "fs";
|
|
11
|
+
import * as path from "path";
|
|
12
|
+
class StrRayDatabaseDesignServer {
|
|
13
|
+
server;
|
|
14
|
+
constructor() {
|
|
15
|
+
this.server = new Server({
|
|
16
|
+
name: "strray-database-design",
|
|
17
|
+
version: "1.0.0",
|
|
18
|
+
}, {
|
|
19
|
+
capabilities: {
|
|
20
|
+
tools: {},
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
this.setupToolHandlers();
|
|
24
|
+
console.log("StrRay Database Design MCP Server initialized");
|
|
25
|
+
}
|
|
26
|
+
setupToolHandlers() {
|
|
27
|
+
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
28
|
+
return {
|
|
29
|
+
tools: [
|
|
30
|
+
{
|
|
31
|
+
name: "analyze_schema",
|
|
32
|
+
description: "Analyze database schema for optimization opportunities and best practices",
|
|
33
|
+
inputSchema: {
|
|
34
|
+
type: "object",
|
|
35
|
+
properties: {
|
|
36
|
+
schemaFile: {
|
|
37
|
+
type: "string",
|
|
38
|
+
description: "Path to schema definition file (SQL, migration, or ORM model)",
|
|
39
|
+
},
|
|
40
|
+
databaseType: {
|
|
41
|
+
type: "string",
|
|
42
|
+
enum: ["postgresql", "mysql", "sqlite", "mongodb", "redis"],
|
|
43
|
+
description: "Database type for specific optimizations",
|
|
44
|
+
},
|
|
45
|
+
includeIndexes: {
|
|
46
|
+
type: "boolean",
|
|
47
|
+
description: "Include index recommendations in analysis",
|
|
48
|
+
default: true,
|
|
49
|
+
},
|
|
50
|
+
},
|
|
51
|
+
required: ["schemaFile"],
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "optimize_query",
|
|
56
|
+
description: "Analyze and optimize SQL queries for better performance",
|
|
57
|
+
inputSchema: {
|
|
58
|
+
type: "object",
|
|
59
|
+
properties: {
|
|
60
|
+
query: {
|
|
61
|
+
type: "string",
|
|
62
|
+
description: "SQL query to analyze and optimize",
|
|
63
|
+
},
|
|
64
|
+
schemaContext: {
|
|
65
|
+
type: "string",
|
|
66
|
+
description: "Schema context or file path for better analysis",
|
|
67
|
+
},
|
|
68
|
+
databaseType: {
|
|
69
|
+
type: "string",
|
|
70
|
+
enum: ["postgresql", "mysql", "sqlite"],
|
|
71
|
+
description: "Database type for query optimization",
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
required: ["query"],
|
|
75
|
+
},
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: "design_data_model",
|
|
79
|
+
description: "Design optimal data model for given requirements",
|
|
80
|
+
inputSchema: {
|
|
81
|
+
type: "object",
|
|
82
|
+
properties: {
|
|
83
|
+
requirements: {
|
|
84
|
+
type: "string",
|
|
85
|
+
description: "Business requirements and data access patterns",
|
|
86
|
+
},
|
|
87
|
+
entities: {
|
|
88
|
+
type: "array",
|
|
89
|
+
items: { type: "string" },
|
|
90
|
+
description: "List of main entities/business objects",
|
|
91
|
+
},
|
|
92
|
+
relationships: {
|
|
93
|
+
type: "array",
|
|
94
|
+
items: {
|
|
95
|
+
type: "object",
|
|
96
|
+
properties: {
|
|
97
|
+
from: { type: "string" },
|
|
98
|
+
to: { type: "string" },
|
|
99
|
+
type: {
|
|
100
|
+
type: "string",
|
|
101
|
+
enum: ["one-to-one", "one-to-many", "many-to-many"],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
},
|
|
105
|
+
description: "Entity relationships",
|
|
106
|
+
},
|
|
107
|
+
databaseType: {
|
|
108
|
+
type: "string",
|
|
109
|
+
enum: ["postgresql", "mysql", "mongodb", "redis"],
|
|
110
|
+
description: "Target database type",
|
|
111
|
+
},
|
|
112
|
+
},
|
|
113
|
+
required: ["requirements", "entities"],
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
name: "migrate_schema",
|
|
118
|
+
description: "Generate migration scripts for schema changes",
|
|
119
|
+
inputSchema: {
|
|
120
|
+
type: "object",
|
|
121
|
+
properties: {
|
|
122
|
+
currentSchema: {
|
|
123
|
+
type: "string",
|
|
124
|
+
description: "Current schema definition",
|
|
125
|
+
},
|
|
126
|
+
targetSchema: {
|
|
127
|
+
type: "string",
|
|
128
|
+
description: "Target schema definition",
|
|
129
|
+
},
|
|
130
|
+
databaseType: {
|
|
131
|
+
type: "string",
|
|
132
|
+
enum: ["postgresql", "mysql", "sqlite"],
|
|
133
|
+
description: "Database type for migration",
|
|
134
|
+
},
|
|
135
|
+
safeMode: {
|
|
136
|
+
type: "boolean",
|
|
137
|
+
description: "Generate rollback scripts and safety checks",
|
|
138
|
+
default: true,
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
required: ["currentSchema", "targetSchema"],
|
|
142
|
+
},
|
|
143
|
+
},
|
|
144
|
+
],
|
|
145
|
+
};
|
|
146
|
+
});
|
|
147
|
+
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
148
|
+
const { name, arguments: args } = request.params;
|
|
149
|
+
switch (name) {
|
|
150
|
+
case "analyze_schema":
|
|
151
|
+
return await this.analyzeSchema(args);
|
|
152
|
+
case "optimize_query":
|
|
153
|
+
return await this.optimizeQuery(args);
|
|
154
|
+
case "design_data_model":
|
|
155
|
+
return await this.designDataModel(args);
|
|
156
|
+
case "migrate_schema":
|
|
157
|
+
return await this.migrateSchema(args);
|
|
158
|
+
default:
|
|
159
|
+
throw new Error(`Unknown tool: ${name}`);
|
|
160
|
+
}
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
async analyzeSchema(args) {
|
|
164
|
+
const { schemaFile, databaseType = "postgresql", includeIndexes = true, } = args;
|
|
165
|
+
try {
|
|
166
|
+
if (!fs.existsSync(schemaFile)) {
|
|
167
|
+
throw new Error(`Schema file not found: ${schemaFile}`);
|
|
168
|
+
}
|
|
169
|
+
const content = fs.readFileSync(schemaFile, "utf-8");
|
|
170
|
+
const extension = path.extname(schemaFile).toLowerCase();
|
|
171
|
+
const schema = this.parseSchema(content, extension, databaseType);
|
|
172
|
+
const analysis = this.analyzeSchemaDesign(schema, databaseType);
|
|
173
|
+
if (includeIndexes) {
|
|
174
|
+
analysis.indexes = this.generateIndexRecommendations(schema, databaseType);
|
|
175
|
+
}
|
|
176
|
+
const issues = this.identifySchemaIssues(schema, databaseType);
|
|
177
|
+
const recommendations = this.generateSchemaRecommendations(issues, schema, databaseType);
|
|
178
|
+
return {
|
|
179
|
+
content: [
|
|
180
|
+
{
|
|
181
|
+
type: "text",
|
|
182
|
+
text: `Database Schema Analysis for ${schemaFile}:\n\n` +
|
|
183
|
+
`📊 SCHEMA OVERVIEW\n` +
|
|
184
|
+
`Database Type: ${databaseType.toUpperCase()}\n` +
|
|
185
|
+
`Tables: ${schema.tables.length}\n` +
|
|
186
|
+
`Relationships: ${schema.relationships.length}\n` +
|
|
187
|
+
`Constraints: ${schema.constraints.length}\n` +
|
|
188
|
+
(includeIndexes
|
|
189
|
+
? `Index Recommendations: ${analysis.indexes.length}\n\n`
|
|
190
|
+
: "\n") +
|
|
191
|
+
`🔍 KEY FINDINGS\n${issues
|
|
192
|
+
.slice(0, 5)
|
|
193
|
+
.map((issue) => `${this.getIssueSeverityIcon(issue.severity)} ${issue.table ? `${issue.table}.` : ""}${issue.column || "Schema"}: ${issue.description}`)
|
|
194
|
+
.join("\n")}\n\n` +
|
|
195
|
+
`💡 OPTIMIZATION RECOMMENDATIONS\n${recommendations
|
|
196
|
+
.slice(0, 5)
|
|
197
|
+
.map((rec, i) => `${i + 1}. ${rec}`)
|
|
198
|
+
.join("\n")}\n\n` +
|
|
199
|
+
`📈 PERFORMANCE METRICS\n` +
|
|
200
|
+
`Normalization Score: ${this.calculateNormalizationScore(schema)}/100\n` +
|
|
201
|
+
`Indexing Coverage: ${this.calculateIndexingCoverage(analysis.indexes, schema)}%\n` +
|
|
202
|
+
`Relationship Complexity: ${this.assessRelationshipComplexity(schema.relationships)}`,
|
|
203
|
+
},
|
|
204
|
+
],
|
|
205
|
+
data: { schema, analysis, issues, recommendations },
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
catch (error) {
|
|
209
|
+
return {
|
|
210
|
+
content: [
|
|
211
|
+
{
|
|
212
|
+
type: "text",
|
|
213
|
+
text: `Error analyzing schema: ${error instanceof Error ? error.message : String(error)}`,
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
};
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async optimizeQuery(args) {
|
|
220
|
+
const { query, schemaContext, databaseType = "postgresql" } = args;
|
|
221
|
+
try {
|
|
222
|
+
const analysis = this.analyzeQuery(query, databaseType);
|
|
223
|
+
// Load schema context if provided
|
|
224
|
+
let schema = null;
|
|
225
|
+
if (schemaContext) {
|
|
226
|
+
try {
|
|
227
|
+
if (fs.existsSync(schemaContext)) {
|
|
228
|
+
const schemaContent = fs.readFileSync(schemaContext, "utf-8");
|
|
229
|
+
const extension = path.extname(schemaContext).toLowerCase();
|
|
230
|
+
schema = this.parseSchema(schemaContent, extension, databaseType);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch (e) {
|
|
234
|
+
// Schema context loading failed, continue without it
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
const optimizations = this.generateQueryOptimizations(analysis, schema, databaseType);
|
|
238
|
+
const performanceScore = this.calculateQueryPerformanceScore(analysis, optimizations);
|
|
239
|
+
return {
|
|
240
|
+
content: [
|
|
241
|
+
{
|
|
242
|
+
type: "text",
|
|
243
|
+
text: `Query Optimization Analysis:\n\n` +
|
|
244
|
+
`🔍 QUERY ANALYSIS\n` +
|
|
245
|
+
`Database: ${databaseType.toUpperCase()}\n` +
|
|
246
|
+
`Tables Involved: ${analysis.tables.join(", ") || "None identified"}\n` +
|
|
247
|
+
`Operations: ${analysis.operations.join(", ") || "None identified"}\n` +
|
|
248
|
+
`Estimated Cost: ${analysis.estimatedCost}\n\n` +
|
|
249
|
+
`📊 PERFORMANCE SCORE: ${performanceScore}/100\n\n` +
|
|
250
|
+
`⚡ OPTIMIZATION OPPORTUNITIES\n${optimizations
|
|
251
|
+
.slice(0, 5)
|
|
252
|
+
.map((opt, i) => `${i + 1}. ${opt}`)
|
|
253
|
+
.join("\n")}\n\n` +
|
|
254
|
+
`🔧 RECOMMENDED IMPROVEMENTS\n${analysis.recommendations
|
|
255
|
+
.slice(0, 3)
|
|
256
|
+
.map((rec, i) => `${i + 1}. ${rec}`)
|
|
257
|
+
.join("\n")}`,
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
data: { analysis, optimizations, performanceScore },
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
catch (error) {
|
|
264
|
+
return {
|
|
265
|
+
content: [
|
|
266
|
+
{
|
|
267
|
+
type: "text",
|
|
268
|
+
text: `Error optimizing query: ${error instanceof Error ? error.message : String(error)}`,
|
|
269
|
+
},
|
|
270
|
+
],
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
async designDataModel(args) {
|
|
275
|
+
const { requirements, entities, relationships = [], databaseType = "postgresql", } = args;
|
|
276
|
+
try {
|
|
277
|
+
const model = this.generateDataModel(requirements, entities, relationships, databaseType);
|
|
278
|
+
const validation = this.validateDataModel(model, databaseType);
|
|
279
|
+
const recommendations = this.generateModelRecommendations(model, validation);
|
|
280
|
+
return {
|
|
281
|
+
content: [
|
|
282
|
+
{
|
|
283
|
+
type: "text",
|
|
284
|
+
text: `Data Model Design for ${databaseType.toUpperCase()}:\n\n` +
|
|
285
|
+
`📋 REQUIREMENTS SUMMARY\n${requirements.substring(0, 200)}${requirements.length > 200 ? "..." : ""}\n\n` +
|
|
286
|
+
`🏗️ PROPOSED DATA MODEL\n` +
|
|
287
|
+
`Entities: ${model.tables.length}\n` +
|
|
288
|
+
`Relationships: ${model.relationships.length}\n` +
|
|
289
|
+
`Indexes: ${model.indexes.length}\n\n` +
|
|
290
|
+
`📊 TABLES\n${model.tables
|
|
291
|
+
.map((table) => `• ${table.name} (${table.columns.length} columns, ~${table.estimatedRows} rows)`)
|
|
292
|
+
.join("\n")}\n\n` +
|
|
293
|
+
`🔗 RELATIONSHIPS\n${model.relationships
|
|
294
|
+
.map((rel) => `• ${rel.fromTable} → ${rel.toTable} (${rel.type})`)
|
|
295
|
+
.join("\n")}\n\n` +
|
|
296
|
+
`💡 DESIGN RECOMMENDATIONS\n${recommendations
|
|
297
|
+
.slice(0, 5)
|
|
298
|
+
.map((rec, i) => `${i + 1}. ${rec}`)
|
|
299
|
+
.join("\n")}`,
|
|
300
|
+
},
|
|
301
|
+
],
|
|
302
|
+
data: { model, validation, recommendations },
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
catch (error) {
|
|
306
|
+
return {
|
|
307
|
+
content: [
|
|
308
|
+
{
|
|
309
|
+
type: "text",
|
|
310
|
+
text: `Error designing data model: ${error instanceof Error ? error.message : String(error)}`,
|
|
311
|
+
},
|
|
312
|
+
],
|
|
313
|
+
};
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
async migrateSchema(args) {
|
|
317
|
+
const { currentSchema, targetSchema, databaseType = "postgresql", safeMode = true, } = args;
|
|
318
|
+
try {
|
|
319
|
+
const current = this.parseSchemaString(currentSchema, databaseType);
|
|
320
|
+
const target = this.parseSchemaString(targetSchema, databaseType);
|
|
321
|
+
const changes = this.compareSchemas(current, target);
|
|
322
|
+
const migrationScript = this.generateMigrationScript(changes, databaseType, safeMode);
|
|
323
|
+
const rollbackScript = safeMode
|
|
324
|
+
? this.generateRollbackScript(changes, databaseType)
|
|
325
|
+
: null;
|
|
326
|
+
return {
|
|
327
|
+
content: [
|
|
328
|
+
{
|
|
329
|
+
type: "text",
|
|
330
|
+
text: `Schema Migration Script (${databaseType.toUpperCase()}):\n\n` +
|
|
331
|
+
`📊 CHANGES DETECTED\n` +
|
|
332
|
+
`Tables to Add: ${changes.addTables.length}\n` +
|
|
333
|
+
`Tables to Drop: ${changes.dropTables.length}\n` +
|
|
334
|
+
`Columns to Add: ${changes.addColumns.length}\n` +
|
|
335
|
+
`Columns to Modify: ${changes.modifyColumns.length}\n` +
|
|
336
|
+
`Indexes to Add: ${changes.addIndexes.length}\n\n` +
|
|
337
|
+
`🔄 MIGRATION SCRIPT\n\`\`\`sql\n${migrationScript}\n\`\`\`\n\n` +
|
|
338
|
+
(rollbackScript
|
|
339
|
+
? `↩️ ROLLBACK SCRIPT\n\`\`\`sql\n${rollbackScript}\n\`\`\`\n\n`
|
|
340
|
+
: "") +
|
|
341
|
+
`⚠️ SAFETY NOTES\n` +
|
|
342
|
+
`• Always backup data before running migrations\n` +
|
|
343
|
+
`• Test migrations on staging environment first\n` +
|
|
344
|
+
`• Review generated scripts carefully\n` +
|
|
345
|
+
(changes.hasDataLoss
|
|
346
|
+
? `• ⚠️ This migration may result in data loss!\n`
|
|
347
|
+
: ""),
|
|
348
|
+
},
|
|
349
|
+
],
|
|
350
|
+
data: {
|
|
351
|
+
changes,
|
|
352
|
+
migrationScript,
|
|
353
|
+
rollbackScript,
|
|
354
|
+
hasDataLoss: changes.hasDataLoss,
|
|
355
|
+
},
|
|
356
|
+
};
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
return {
|
|
360
|
+
content: [
|
|
361
|
+
{
|
|
362
|
+
type: "text",
|
|
363
|
+
text: `Error generating migration: ${error instanceof Error ? error.message : String(error)}`,
|
|
364
|
+
},
|
|
365
|
+
],
|
|
366
|
+
};
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
parseSchema(content, extension, databaseType) {
|
|
370
|
+
// Simplified schema parsing - in production this would be more sophisticated
|
|
371
|
+
const tables = [];
|
|
372
|
+
const relationships = [];
|
|
373
|
+
if (extension === ".sql") {
|
|
374
|
+
// Parse SQL CREATE TABLE statements
|
|
375
|
+
const createTableRegex = /CREATE\s+TABLE\s+(\w+)\s*\(([\s\S]*?)\);/gi;
|
|
376
|
+
let match;
|
|
377
|
+
while ((match = createTableRegex.exec(content)) !== null) {
|
|
378
|
+
const tableName = match[1];
|
|
379
|
+
const tableContent = match[2];
|
|
380
|
+
if (!tableName || !tableContent)
|
|
381
|
+
continue;
|
|
382
|
+
const columns = this.parseTableColumns(tableContent, databaseType);
|
|
383
|
+
const primaryKey = this.extractPrimaryKey(tableContent);
|
|
384
|
+
tables.push({
|
|
385
|
+
name: tableName,
|
|
386
|
+
columns,
|
|
387
|
+
primaryKey,
|
|
388
|
+
estimatedRows: 1000, // Default estimate
|
|
389
|
+
accessPatterns: [],
|
|
390
|
+
});
|
|
391
|
+
}
|
|
392
|
+
// Extract foreign keys for relationships
|
|
393
|
+
relationships.push(...this.extractRelationships(content, databaseType));
|
|
394
|
+
}
|
|
395
|
+
return {
|
|
396
|
+
tables,
|
|
397
|
+
relationships,
|
|
398
|
+
indexes: [],
|
|
399
|
+
constraints: [],
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
parseSchemaString(schemaString, databaseType) {
|
|
403
|
+
return this.parseSchema(schemaString, ".sql", databaseType);
|
|
404
|
+
}
|
|
405
|
+
parseTableColumns(tableContent, databaseType) {
|
|
406
|
+
const columns = [];
|
|
407
|
+
const columnRegex = /(\w+)\s+([A-Z]+(?:\([^)]*\))?)(?:\s+(NOT\s+NULL|NULL|PRIMARY\s+KEY|UNIQUE|REFERENCES\s+\w+\([^)]*\)))*/gi;
|
|
408
|
+
let match;
|
|
409
|
+
while ((match = columnRegex.exec(tableContent)) !== null) {
|
|
410
|
+
const [, name, type, constraints] = match;
|
|
411
|
+
if (name && type) {
|
|
412
|
+
columns.push({
|
|
413
|
+
name,
|
|
414
|
+
type,
|
|
415
|
+
nullable: !constraints || !constraints.includes("NOT NULL"),
|
|
416
|
+
constraints: constraints
|
|
417
|
+
? constraints.split(/\s+/).filter((c) => c)
|
|
418
|
+
: [],
|
|
419
|
+
usage: constraints && constraints.includes("PRIMARY KEY")
|
|
420
|
+
? "primary"
|
|
421
|
+
: constraints && constraints.includes("REFERENCES")
|
|
422
|
+
? "foreign"
|
|
423
|
+
: "data",
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
return columns;
|
|
428
|
+
}
|
|
429
|
+
extractPrimaryKey(tableContent) {
|
|
430
|
+
const pkRegex = /PRIMARY\s+KEY\s*\(([^)]+)\)/i;
|
|
431
|
+
const match = pkRegex.exec(tableContent);
|
|
432
|
+
return match && match[1]
|
|
433
|
+
? match[1].split(",").map((col) => col.trim())
|
|
434
|
+
: [];
|
|
435
|
+
}
|
|
436
|
+
extractRelationships(content, databaseType) {
|
|
437
|
+
const relationships = [];
|
|
438
|
+
const fkRegex = /FOREIGN\s+KEY\s*\(([^)]+)\)\s*REFERENCES\s+(\w+)\s*\(([^)]+)\)/gi;
|
|
439
|
+
let match;
|
|
440
|
+
while ((match = fkRegex.exec(content)) !== null) {
|
|
441
|
+
const [, fromCol, toTable, toCol] = match;
|
|
442
|
+
if (fromCol && toTable && toCol) {
|
|
443
|
+
relationships.push({
|
|
444
|
+
fromTable: "", // Would need table context
|
|
445
|
+
toTable,
|
|
446
|
+
fromColumn: fromCol,
|
|
447
|
+
toColumn: toCol,
|
|
448
|
+
type: "one-to-many", // Default assumption
|
|
449
|
+
cardinality: "1:N",
|
|
450
|
+
});
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
return relationships;
|
|
454
|
+
}
|
|
455
|
+
analyzeSchemaDesign(schema, databaseType) {
|
|
456
|
+
return {
|
|
457
|
+
normalizationLevel: this.assessNormalization(schema),
|
|
458
|
+
indexingStrategy: this.evaluateIndexing(schema),
|
|
459
|
+
relationshipComplexity: this.assessRelationshipComplexity(schema.relationships),
|
|
460
|
+
performanceConsiderations: this.identifyPerformanceIssues(schema, databaseType),
|
|
461
|
+
};
|
|
462
|
+
}
|
|
463
|
+
assessNormalization(schema) {
|
|
464
|
+
// Simplified normalization assessment
|
|
465
|
+
let score = 100;
|
|
466
|
+
// Check for repeating groups (denormalization)
|
|
467
|
+
schema.tables.forEach((table) => {
|
|
468
|
+
const dataColumns = table.columns.filter((col) => col.usage === "data");
|
|
469
|
+
if (dataColumns.length > 15) {
|
|
470
|
+
score -= 20; // Too many columns in one table
|
|
471
|
+
}
|
|
472
|
+
});
|
|
473
|
+
return Math.max(0, score);
|
|
474
|
+
}
|
|
475
|
+
evaluateIndexing(schema) {
|
|
476
|
+
const tablesWithIndexes = schema.tables.filter((table) => table.columns.some((col) => col.usage === "primary" || col.usage === "foreign")).length;
|
|
477
|
+
const indexCoverage = (tablesWithIndexes / schema.tables.length) * 100;
|
|
478
|
+
return `${indexCoverage.toFixed(1)}% of tables have indexed relationships`;
|
|
479
|
+
}
|
|
480
|
+
assessRelationshipComplexity(relationships) {
|
|
481
|
+
const complexity = relationships.length;
|
|
482
|
+
if (complexity < 5)
|
|
483
|
+
return "Simple";
|
|
484
|
+
if (complexity < 15)
|
|
485
|
+
return "Moderate";
|
|
486
|
+
return "Complex - Consider denormalization or CQRS";
|
|
487
|
+
}
|
|
488
|
+
identifyPerformanceIssues(schema, databaseType) {
|
|
489
|
+
const issues = [];
|
|
490
|
+
schema.tables.forEach((table) => {
|
|
491
|
+
if (table.columns.length > 50) {
|
|
492
|
+
issues.push(`${table.name} has ${table.columns.length} columns - consider vertical partitioning`);
|
|
493
|
+
}
|
|
494
|
+
const textColumns = table.columns.filter((col) => col.type.toLowerCase().includes("text") ||
|
|
495
|
+
col.type.toLowerCase().includes("varchar"));
|
|
496
|
+
if (textColumns.length > 5) {
|
|
497
|
+
issues.push(`${table.name} has ${textColumns.length} text columns - monitor for performance`);
|
|
498
|
+
}
|
|
499
|
+
});
|
|
500
|
+
return issues;
|
|
501
|
+
}
|
|
502
|
+
generateIndexRecommendations(schema, databaseType) {
|
|
503
|
+
const recommendations = [];
|
|
504
|
+
schema.relationships.forEach((rel) => {
|
|
505
|
+
recommendations.push({
|
|
506
|
+
table: rel.fromTable,
|
|
507
|
+
columns: [rel.fromColumn],
|
|
508
|
+
type: "btree",
|
|
509
|
+
reason: `Foreign key relationship to ${rel.toTable}`,
|
|
510
|
+
impact: "high",
|
|
511
|
+
});
|
|
512
|
+
});
|
|
513
|
+
// Add recommendations for common query patterns
|
|
514
|
+
schema.tables.forEach((table) => {
|
|
515
|
+
const indexedColumns = table.columns.filter((col) => col.usage === "primary" || col.usage === "foreign");
|
|
516
|
+
// Recommend composite indexes for common patterns
|
|
517
|
+
if (indexedColumns.length > 1) {
|
|
518
|
+
recommendations.push({
|
|
519
|
+
table: table.name,
|
|
520
|
+
columns: indexedColumns.map((col) => col.name),
|
|
521
|
+
type: "btree",
|
|
522
|
+
reason: "Composite index for primary/foreign key queries",
|
|
523
|
+
impact: "medium",
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
});
|
|
527
|
+
return recommendations;
|
|
528
|
+
}
|
|
529
|
+
identifySchemaIssues(schema, databaseType) {
|
|
530
|
+
const issues = [];
|
|
531
|
+
schema.tables.forEach((table) => {
|
|
532
|
+
// Check for missing primary keys
|
|
533
|
+
if (table.primaryKey.length === 0) {
|
|
534
|
+
issues.push({
|
|
535
|
+
table: table.name,
|
|
536
|
+
column: null,
|
|
537
|
+
description: "Table missing primary key",
|
|
538
|
+
severity: "error",
|
|
539
|
+
});
|
|
540
|
+
}
|
|
541
|
+
// Check for nullable foreign keys
|
|
542
|
+
table.columns.forEach((col) => {
|
|
543
|
+
if (col.usage === "foreign" && col.nullable) {
|
|
544
|
+
issues.push({
|
|
545
|
+
table: table.name,
|
|
546
|
+
column: col.name,
|
|
547
|
+
description: "Foreign key column allows NULL values",
|
|
548
|
+
severity: "warning",
|
|
549
|
+
});
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
// Check for tables with too many columns
|
|
553
|
+
if (table.columns.length > 30) {
|
|
554
|
+
issues.push({
|
|
555
|
+
table: table.name,
|
|
556
|
+
column: null,
|
|
557
|
+
description: `Table has ${table.columns.length} columns - consider normalization`,
|
|
558
|
+
severity: "info",
|
|
559
|
+
});
|
|
560
|
+
}
|
|
561
|
+
});
|
|
562
|
+
return issues;
|
|
563
|
+
}
|
|
564
|
+
generateSchemaRecommendations(issues, schema, databaseType) {
|
|
565
|
+
const recommendations = [];
|
|
566
|
+
const errorCount = issues.filter((i) => i.severity === "error").length;
|
|
567
|
+
const warningCount = issues.filter((i) => i.severity === "warning").length;
|
|
568
|
+
if (errorCount > 0) {
|
|
569
|
+
recommendations.push(`Fix ${errorCount} critical schema issues before deployment`);
|
|
570
|
+
}
|
|
571
|
+
if (warningCount > 0) {
|
|
572
|
+
recommendations.push(`Address ${warningCount} schema warnings for better performance`);
|
|
573
|
+
}
|
|
574
|
+
if (schema.tables.length > 20) {
|
|
575
|
+
recommendations.push("Consider microservices architecture for large schemas");
|
|
576
|
+
}
|
|
577
|
+
const relationshipCount = schema.relationships.length;
|
|
578
|
+
if (relationshipCount > 10) {
|
|
579
|
+
recommendations.push("Review complex relationships - consider denormalization for read-heavy workloads");
|
|
580
|
+
}
|
|
581
|
+
return recommendations;
|
|
582
|
+
}
|
|
583
|
+
calculateNormalizationScore(schema) {
|
|
584
|
+
return this.assessNormalization(schema);
|
|
585
|
+
}
|
|
586
|
+
calculateIndexingCoverage(indexes, schema) {
|
|
587
|
+
const tablesWithIndexes = new Set(indexes.map((idx) => idx.table)).size;
|
|
588
|
+
return Math.round((tablesWithIndexes / schema.tables.length) * 100);
|
|
589
|
+
}
|
|
590
|
+
analyzeQuery(query, databaseType) {
|
|
591
|
+
const analysis = {
|
|
592
|
+
query,
|
|
593
|
+
tables: [],
|
|
594
|
+
operations: [],
|
|
595
|
+
estimatedCost: 0,
|
|
596
|
+
recommendations: [],
|
|
597
|
+
optimizationOpportunities: [],
|
|
598
|
+
};
|
|
599
|
+
// Extract tables
|
|
600
|
+
const tableRegex = /(?:FROM|JOIN|UPDATE|INSERT\s+INTO|DELETE\s+FROM)\s+(\w+)/gi;
|
|
601
|
+
let match;
|
|
602
|
+
while ((match = tableRegex.exec(query)) !== null) {
|
|
603
|
+
if (match[1] && !analysis.tables.includes(match[1])) {
|
|
604
|
+
analysis.tables.push(match[1]);
|
|
605
|
+
}
|
|
606
|
+
}
|
|
607
|
+
// Identify operations
|
|
608
|
+
if (query.toUpperCase().includes("SELECT"))
|
|
609
|
+
analysis.operations.push("SELECT");
|
|
610
|
+
if (query.toUpperCase().includes("INSERT"))
|
|
611
|
+
analysis.operations.push("INSERT");
|
|
612
|
+
if (query.toUpperCase().includes("UPDATE"))
|
|
613
|
+
analysis.operations.push("UPDATE");
|
|
614
|
+
if (query.toUpperCase().includes("DELETE"))
|
|
615
|
+
analysis.operations.push("DELETE");
|
|
616
|
+
// Check for common issues
|
|
617
|
+
if (query.toUpperCase().includes("SELECT *")) {
|
|
618
|
+
analysis.recommendations.push("Avoid SELECT * - specify required columns");
|
|
619
|
+
analysis.optimizationOpportunities.push("Column selection optimization");
|
|
620
|
+
}
|
|
621
|
+
if (query.toUpperCase().includes("WHERE") &&
|
|
622
|
+
!query.toUpperCase().includes("INDEX")) {
|
|
623
|
+
analysis.recommendations.push("Consider adding indexes for WHERE clause columns");
|
|
624
|
+
analysis.optimizationOpportunities.push("Index optimization");
|
|
625
|
+
}
|
|
626
|
+
// Estimate cost (simplified)
|
|
627
|
+
analysis.estimatedCost = query.length * 0.1 + analysis.tables.length * 10;
|
|
628
|
+
return analysis;
|
|
629
|
+
}
|
|
630
|
+
generateQueryOptimizations(analysis, schema, databaseType) {
|
|
631
|
+
const optimizations = [];
|
|
632
|
+
if (analysis.query.toUpperCase().includes("SELECT *")) {
|
|
633
|
+
optimizations.push("Replace SELECT * with specific column names to reduce data transfer");
|
|
634
|
+
}
|
|
635
|
+
if (analysis.operations.includes("SELECT") && analysis.tables.length > 3) {
|
|
636
|
+
optimizations.push("Consider breaking complex joins into smaller queries or use denormalized views");
|
|
637
|
+
}
|
|
638
|
+
if (analysis.query.toUpperCase().match(/WHERE\s+.*\s+LIKE\s+['"]%.*%['"]/)) {
|
|
639
|
+
optimizations.push("LIKE queries with leading wildcards cannot use indexes - consider full-text search");
|
|
640
|
+
}
|
|
641
|
+
if (schema) {
|
|
642
|
+
// Schema-aware optimizations would go here
|
|
643
|
+
optimizations.push("Consider query result caching for frequently accessed data");
|
|
644
|
+
}
|
|
645
|
+
return optimizations;
|
|
646
|
+
}
|
|
647
|
+
calculateQueryPerformanceScore(analysis, optimizations) {
|
|
648
|
+
let score = 100;
|
|
649
|
+
// Deduct for each optimization opportunity
|
|
650
|
+
score -= optimizations.length * 10;
|
|
651
|
+
// Deduct for complex operations
|
|
652
|
+
if (analysis.operations.length > 2)
|
|
653
|
+
score -= 10;
|
|
654
|
+
if (analysis.tables.length > 4)
|
|
655
|
+
score -= 15;
|
|
656
|
+
return Math.max(0, Math.min(100, score));
|
|
657
|
+
}
|
|
658
|
+
generateDataModel(requirements, entities, relationships, databaseType) {
|
|
659
|
+
const tables = entities.map((entity) => ({
|
|
660
|
+
name: this.toTableName(entity),
|
|
661
|
+
columns: [
|
|
662
|
+
{
|
|
663
|
+
name: "id",
|
|
664
|
+
type: databaseType === "postgresql" ? "SERIAL" : "INT AUTO_INCREMENT",
|
|
665
|
+
nullable: false,
|
|
666
|
+
constraints: ["PRIMARY KEY"],
|
|
667
|
+
usage: "primary",
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
name: "created_at",
|
|
671
|
+
type: "TIMESTAMP",
|
|
672
|
+
nullable: false,
|
|
673
|
+
defaultValue: "CURRENT_TIMESTAMP",
|
|
674
|
+
constraints: [],
|
|
675
|
+
usage: "data",
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
name: "updated_at",
|
|
679
|
+
type: "TIMESTAMP",
|
|
680
|
+
nullable: false,
|
|
681
|
+
defaultValue: "CURRENT_TIMESTAMP",
|
|
682
|
+
constraints: [],
|
|
683
|
+
usage: "data",
|
|
684
|
+
},
|
|
685
|
+
],
|
|
686
|
+
primaryKey: ["id"],
|
|
687
|
+
estimatedRows: 1000,
|
|
688
|
+
accessPatterns: ["CRUD operations"],
|
|
689
|
+
}));
|
|
690
|
+
const schemaRelationships = relationships.map((rel) => ({
|
|
691
|
+
fromTable: this.toTableName(rel.from),
|
|
692
|
+
toTable: this.toTableName(rel.to),
|
|
693
|
+
fromColumn: "id",
|
|
694
|
+
toColumn: `${this.toTableName(rel.from)}_id`,
|
|
695
|
+
type: rel.type,
|
|
696
|
+
cardinality: rel.type === "one-to-one"
|
|
697
|
+
? "1:1"
|
|
698
|
+
: rel.type === "one-to-many"
|
|
699
|
+
? "1:N"
|
|
700
|
+
: "N:M",
|
|
701
|
+
}));
|
|
702
|
+
return {
|
|
703
|
+
tables,
|
|
704
|
+
relationships: schemaRelationships,
|
|
705
|
+
indexes: [],
|
|
706
|
+
constraints: [],
|
|
707
|
+
};
|
|
708
|
+
}
|
|
709
|
+
validateDataModel(model, databaseType) {
|
|
710
|
+
const validation = {
|
|
711
|
+
issues: [],
|
|
712
|
+
score: 100,
|
|
713
|
+
};
|
|
714
|
+
// Check for naming conventions
|
|
715
|
+
model.tables.forEach((table) => {
|
|
716
|
+
if (!/^[a-z][a-z0-9_]*$/.test(table.name)) {
|
|
717
|
+
validation.issues.push(`${table.name} does not follow naming conventions`);
|
|
718
|
+
validation.score -= 5;
|
|
719
|
+
}
|
|
720
|
+
});
|
|
721
|
+
return validation;
|
|
722
|
+
}
|
|
723
|
+
generateModelRecommendations(model, validation) {
|
|
724
|
+
const recommendations = [];
|
|
725
|
+
if (model.tables.length > 10) {
|
|
726
|
+
recommendations.push("Consider microservices architecture for large data models");
|
|
727
|
+
}
|
|
728
|
+
if (model.relationships.length > model.tables.length) {
|
|
729
|
+
recommendations.push("Review relationship complexity - consider denormalization");
|
|
730
|
+
}
|
|
731
|
+
recommendations.push("Add appropriate indexes based on query patterns");
|
|
732
|
+
recommendations.push("Implement proper constraints and validations");
|
|
733
|
+
recommendations.push("Document data retention and archival policies");
|
|
734
|
+
return recommendations;
|
|
735
|
+
}
|
|
736
|
+
compareSchemas(current, target) {
|
|
737
|
+
const changes = {
|
|
738
|
+
addTables: [],
|
|
739
|
+
dropTables: [],
|
|
740
|
+
addColumns: [],
|
|
741
|
+
modifyColumns: [],
|
|
742
|
+
dropColumns: [],
|
|
743
|
+
addIndexes: [],
|
|
744
|
+
dropIndexes: [],
|
|
745
|
+
hasDataLoss: false,
|
|
746
|
+
};
|
|
747
|
+
// Compare tables
|
|
748
|
+
const currentTableNames = new Set(current.tables.map((t) => t.name));
|
|
749
|
+
const targetTableNames = new Set(target.tables.map((t) => t.name));
|
|
750
|
+
changes.addTables = [...targetTableNames].filter((name) => !currentTableNames.has(name));
|
|
751
|
+
changes.dropTables = [...currentTableNames].filter((name) => !targetTableNames.has(name));
|
|
752
|
+
// Data loss check
|
|
753
|
+
changes.hasDataLoss = changes.dropTables.length > 0;
|
|
754
|
+
return changes;
|
|
755
|
+
}
|
|
756
|
+
generateMigrationScript(changes, databaseType, safeMode) {
|
|
757
|
+
let script = `-- Migration generated at ${new Date().toISOString()}\n\n`;
|
|
758
|
+
if (safeMode) {
|
|
759
|
+
script += `-- Safety checks\n`;
|
|
760
|
+
script += `DO $$\nBEGIN\n`;
|
|
761
|
+
script += ` -- Add your safety checks here\n`;
|
|
762
|
+
script += `END\n$$;\n\n`;
|
|
763
|
+
}
|
|
764
|
+
// Add tables
|
|
765
|
+
changes.addTables.forEach((tableName) => {
|
|
766
|
+
script += `-- Add table ${tableName}\n`;
|
|
767
|
+
script += `CREATE TABLE ${tableName} (\n`;
|
|
768
|
+
script += ` id SERIAL PRIMARY KEY,\n`;
|
|
769
|
+
script += ` created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n`;
|
|
770
|
+
script += ` updated_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP\n`;
|
|
771
|
+
script += `);\n\n`;
|
|
772
|
+
});
|
|
773
|
+
// Drop tables (with safety)
|
|
774
|
+
if (changes.dropTables.length > 0 && safeMode) {
|
|
775
|
+
script += `-- WARNING: Dropping tables with data loss potential\n`;
|
|
776
|
+
changes.dropTables.forEach((tableName) => {
|
|
777
|
+
script += `-- DROP TABLE ${tableName}; -- Uncomment only if data loss is acceptable\n`;
|
|
778
|
+
});
|
|
779
|
+
script += `\n`;
|
|
780
|
+
}
|
|
781
|
+
return script;
|
|
782
|
+
}
|
|
783
|
+
generateRollbackScript(changes, databaseType) {
|
|
784
|
+
let script = `-- Rollback script generated at ${new Date().toISOString()}\n\n`;
|
|
785
|
+
// Rollback logic would reverse the changes
|
|
786
|
+
changes.addTables.forEach((tableName) => {
|
|
787
|
+
script += `-- Rollback: Drop table ${tableName}\n`;
|
|
788
|
+
script += `-- DROP TABLE IF EXISTS ${tableName};\n\n`;
|
|
789
|
+
});
|
|
790
|
+
return script;
|
|
791
|
+
}
|
|
792
|
+
toTableName(entity) {
|
|
793
|
+
return entity
|
|
794
|
+
.toLowerCase()
|
|
795
|
+
.replace(/\s+/g, "_")
|
|
796
|
+
.replace(/[^a-z0-9_]/g, "");
|
|
797
|
+
}
|
|
798
|
+
getIssueSeverityIcon(severity) {
|
|
799
|
+
const icons = {
|
|
800
|
+
error: "🚨",
|
|
801
|
+
warning: "⚠️",
|
|
802
|
+
info: "ℹ️",
|
|
803
|
+
};
|
|
804
|
+
return icons[severity] || "❓";
|
|
805
|
+
}
|
|
806
|
+
async run() {
|
|
807
|
+
const transport = new StdioServerTransport();
|
|
808
|
+
await this.server.connect(transport);
|
|
809
|
+
console.log("StrRay Database Design MCP Server running...");
|
|
810
|
+
}
|
|
811
|
+
}
|
|
812
|
+
// Run the server if this file is executed directly
|
|
813
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
814
|
+
const server = new StrRayDatabaseDesignServer();
|
|
815
|
+
server.run().catch(console.error);
|
|
816
|
+
}
|
|
817
|
+
export { StrRayDatabaseDesignServer };
|
|
818
|
+
//# sourceMappingURL=database-design.server.js.map
|