This is page 14 of 24. Use http://codebase.md/sparesparrow/mcp-project-orchestrator?format=md&lines=true&page={x} to view the full context.

# Directory Structure

```
├── .cursorrules
├── .env.example
├── .github
│   └── workflows
│       ├── build.yml
│       ├── ci-cd.yml
│       ├── ci.yml
│       ├── deploy.yml
│       ├── ecosystem-monitor.yml
│       ├── fan-out-orchestrator.yml
│       └── release.yml
├── .gitignore
├── .pre-commit-config.yaml
├── AUTOMOTIVE_CAMERA_SYSTEM_SUMMARY.md
├── automotive-camera-system
│   ├── docs
│   │   └── IMPLEMENTACE_CS.md
│   └── README.md
├── AWS_MCP_IMPLEMENTATION_SUMMARY.md
├── AWS_MCP_QUICKSTART.md
├── AWS_SIP_TRUNK_DEPLOYMENT_COMPLETE.md
├── aws-sip-trunk
│   ├── .gitignore
│   ├── config
│   │   ├── extensions.conf.j2
│   │   └── pjsip.conf.j2
│   ├── DEPLOYMENT_SUMMARY.md
│   ├── docs
│   │   ├── DEPLOYMENT.md
│   │   └── TROUBLESHOOTING.md
│   ├── PROJECT_INDEX.md
│   ├── pyproject.toml
│   ├── QUICKSTART.md
│   ├── README.md
│   ├── scripts
│   │   ├── deploy-asterisk-aws.sh
│   │   └── user-data.sh
│   ├── terraform
│   │   ├── ec2.tf
│   │   ├── main.tf
│   │   ├── monitoring.tf
│   │   ├── networking.tf
│   │   ├── outputs.tf
│   │   ├── storage.tf
│   │   ├── terraform.tfvars.example
│   │   └── variables.tf
│   ├── tests
│   │   └── test_sip_connectivity.py
│   └── VERIFICATION_CHECKLIST.md
├── CLAUDE.md
├── component_templates.json
├── conanfile.py
├── config
│   ├── default.json
│   └── project_orchestration.json
├── Containerfile
├── cursor-templates
│   └── openssl
│       ├── linux-dev.mdc.jinja2
│       └── shared.mdc.jinja2
├── data
│   └── prompts
│       └── templates
│           ├── advanced-multi-server-template.json
│           ├── analysis-assistant.json
│           ├── analyze-mermaid-diagram.json
│           ├── architecture-design-assistant.json
│           ├── code-diagram-documentation-creator.json
│           ├── code-refactoring-assistant.json
│           ├── code-review-assistant.json
│           ├── collaborative-development.json
│           ├── consolidated-interfaces-template.json
│           ├── could-you-interpret-the-assumed-applicat.json
│           ├── data-analysis-template.json
│           ├── database-query-assistant.json
│           ├── debugging-assistant.json
│           ├── development-system-prompt-zcna0.json
│           ├── development-system-prompt.json
│           ├── development-workflow.json
│           ├── docker-compose-prompt-combiner.json
│           ├── docker-containerization-guide.json
│           ├── docker-mcp-servers-orchestration.json
│           ├── foresight-assistant.json
│           ├── generate-different-types-of-questions-ab.json
│           ├── generate-mermaid-diagram.json
│           ├── image-1-describe-the-icon-in-one-sen.json
│           ├── initialize-project-setup-for-a-new-micro.json
│           ├── install-dependencies-build-run-test.json
│           ├── mcp-code-generator.json
│           ├── mcp-integration-assistant.json
│           ├── mcp-resources-explorer.json
│           ├── mcp-resources-integration.json
│           ├── mcp-server-configurator.json
│           ├── mcp-server-dev-prompt-combiner.json
│           ├── mcp-server-integration-template.json
│           ├── mcp-template-system.json
│           ├── mermaid-analysis-expert.json
│           ├── mermaid-class-diagram-generator.json
│           ├── mermaid-diagram-generator.json
│           ├── mermaid-diagram-modifier.json
│           ├── modify-mermaid-diagram.json
│           ├── monorepo-migration-guide.json
│           ├── multi-resource-context.json
│           ├── project-analysis-assistant.json
│           ├── prompt-combiner-interface.json
│           ├── prompt-templates.json
│           ├── repository-explorer.json
│           ├── research-assistant.json
│           ├── sequential-data-analysis.json
│           ├── solid-code-analysis-visualizer.json
│           ├── task-list-helper-8ithy.json
│           ├── template-based-mcp-integration.json
│           ├── templates.json
│           ├── test-prompt.json
│           └── you-are-limited-to-respond-yes-or-no-onl.json
├── docs
│   ├── AWS_MCP.md
│   ├── AWS.md
│   ├── CONAN.md
│   └── integration.md
├── elevenlabs-agents
│   ├── agent-prompts.json
│   └── README.md
├── IMPLEMENTATION_STATUS.md
├── integration_plan.md
├── LICENSE
├── MANIFEST.in
├── mcp-project-orchestrator
│   └── openssl
│       ├── .github
│       │   └── workflows
│       │       └── validate-cursor-config.yml
│       ├── conanfile.py
│       ├── CURSOR_DEPLOYMENT_POLISH.md
│       ├── cursor-rules
│       │   ├── mcp.json.jinja2
│       │   ├── prompts
│       │   │   ├── fips-compliance.md.jinja2
│       │   │   ├── openssl-coding-standards.md.jinja2
│       │   │   └── pr-review.md.jinja2
│       │   └── rules
│       │       ├── ci-linux.mdc.jinja2
│       │       ├── linux-dev.mdc.jinja2
│       │       ├── macos-dev.mdc.jinja2
│       │       ├── shared.mdc.jinja2
│       │       └── windows-dev.mdc.jinja2
│       ├── docs
│       │   └── cursor-configuration-management.md
│       ├── examples
│       │   └── example-workspace
│       │       ├── .cursor
│       │       │   ├── mcp.json
│       │       │   └── rules
│       │       │       ├── linux-dev.mdc
│       │       │       └── shared.mdc
│       │       ├── .gitignore
│       │       ├── CMakeLists.txt
│       │       ├── conanfile.py
│       │       ├── profiles
│       │       │   ├── linux-gcc-debug.profile
│       │       │   └── linux-gcc-release.profile
│       │       ├── README.md
│       │       └── src
│       │           ├── crypto_utils.cpp
│       │           ├── crypto_utils.h
│       │           └── main.cpp
│       ├── IMPLEMENTATION_SUMMARY.md
│       ├── mcp_orchestrator
│       │   ├── __init__.py
│       │   ├── cli.py
│       │   ├── conan_integration.py
│       │   ├── cursor_config.py
│       │   ├── cursor_deployer.py
│       │   ├── deploy_cursor.py
│       │   ├── env_config.py
│       │   ├── platform_detector.py
│       │   └── yaml_validator.py
│       ├── openssl-cursor-example-workspace-20251014_121133.zip
│       ├── pyproject.toml
│       ├── README.md
│       ├── requirements.txt
│       ├── scripts
│       │   └── create_example_workspace.py
│       ├── setup.py
│       ├── test_deployment.py
│       └── tests
│           ├── __init__.py
│           ├── test_cursor_deployer.py
│           └── test_template_validation.py
├── printcast-agent
│   ├── .env.example
│   ├── config
│   │   └── asterisk
│   │       └── extensions.conf
│   ├── Containerfile
│   ├── docker-compose.yml
│   ├── pyproject.toml
│   ├── README.md
│   ├── scripts
│   │   └── docker-entrypoint.sh
│   ├── src
│   │   ├── integrations
│   │   │   ├── __init__.py
│   │   │   ├── asterisk.py
│   │   │   ├── content.py
│   │   │   ├── delivery.py
│   │   │   ├── elevenlabs.py
│   │   │   └── printing.py
│   │   ├── mcp_server
│   │   │   ├── __init__.py
│   │   │   ├── main.py
│   │   │   └── server.py
│   │   └── orchestration
│   │       ├── __init__.py
│   │       └── workflow.py
│   └── tests
│       └── test_mcp_server.py
├── project_orchestration.json
├── project_templates.json
├── pyproject.toml
├── README.md
├── REFACTORING_COMPLETED.md
├── REFACTORING_RECOMMENDATIONS.md
├── requirements.txt
├── scripts
│   ├── archive
│   │   ├── init_claude_test.sh
│   │   ├── init_postgres.sh
│   │   ├── start_mcp_servers.sh
│   │   └── test_claude_desktop.sh
│   ├── consolidate_mermaid.py
│   ├── consolidate_prompts.py
│   ├── consolidate_resources.py
│   ├── consolidate_templates.py
│   ├── INSTRUCTIONS.md
│   ├── README.md
│   ├── setup_aws_mcp.sh
│   ├── setup_mcp.sh
│   ├── setup_orchestrator.sh
│   ├── setup_project.py
│   └── test_mcp.sh
├── src
│   └── mcp_project_orchestrator
│       ├── __init__.py
│       ├── __main__.py
│       ├── aws_mcp.py
│       ├── cli
│       │   └── __init__.py
│       ├── cli.py
│       ├── commands
│       │   └── openssl_cli.py
│       ├── core
│       │   ├── __init__.py
│       │   ├── base.py
│       │   ├── config.py
│       │   ├── exceptions.py
│       │   ├── fastmcp.py
│       │   ├── logging.py
│       │   └── managers.py
│       ├── cursor_deployer.py
│       ├── ecosystem_monitor.py
│       ├── fan_out_orchestrator.py
│       ├── fastmcp.py
│       ├── mcp-py
│       │   ├── AggregateVersions.py
│       │   ├── CustomBashTool.py
│       │   ├── FileAnnotator.py
│       │   ├── mcp-client.py
│       │   ├── mcp-server.py
│       │   ├── MermaidDiagramGenerator.py
│       │   ├── NamingAgent.py
│       │   └── solid-analyzer-agent.py
│       ├── mermaid
│       │   ├── __init__.py
│       │   ├── generator.py
│       │   ├── mermaid_orchestrator.py
│       │   ├── renderer.py
│       │   ├── templates
│       │   │   ├── AbstractFactory-diagram.json
│       │   │   ├── Adapter-diagram.json
│       │   │   ├── Analyze_Mermaid_Diagram.json
│       │   │   ├── Builder-diagram.json
│       │   │   ├── Chain-diagram.json
│       │   │   ├── Code_Diagram_Documentation_Creator.json
│       │   │   ├── Command-diagram.json
│       │   │   ├── Decorator-diagram.json
│       │   │   ├── Facade-diagram.json
│       │   │   ├── Factory-diagram.json
│       │   │   ├── flowchart
│       │   │   │   ├── AbstractFactory-diagram.json
│       │   │   │   ├── Adapter-diagram.json
│       │   │   │   ├── Analyze_Mermaid_Diagram.json
│       │   │   │   ├── Builder-diagram.json
│       │   │   │   ├── Chain-diagram.json
│       │   │   │   ├── Code_Diagram_Documentation_Creator.json
│       │   │   │   ├── Command-diagram.json
│       │   │   │   ├── Decorator-diagram.json
│       │   │   │   ├── Facade-diagram.json
│       │   │   │   ├── Factory-diagram.json
│       │   │   │   ├── Generate_Mermaid_Diagram.json
│       │   │   │   ├── generated_diagram.json
│       │   │   │   ├── integration.json
│       │   │   │   ├── Iterator-diagram.json
│       │   │   │   ├── Mediator-diagram.json
│       │   │   │   ├── Memento-diagram.json
│       │   │   │   ├── Mermaid_Analysis_Expert.json
│       │   │   │   ├── Mermaid_Class_Diagram_Generator.json
│       │   │   │   ├── Mermaid_Diagram_Generator.json
│       │   │   │   ├── Mermaid_Diagram_Modifier.json
│       │   │   │   ├── Modify_Mermaid_Diagram.json
│       │   │   │   ├── Observer-diagram.json
│       │   │   │   ├── Prototype-diagram.json
│       │   │   │   ├── Proxy-diagram.json
│       │   │   │   ├── README.json
│       │   │   │   ├── Singleton-diagram.json
│       │   │   │   ├── State-diagram.json
│       │   │   │   ├── Strategy-diagram.json
│       │   │   │   ├── TemplateMethod-diagram.json
│       │   │   │   ├── theme_dark.json
│       │   │   │   ├── theme_default.json
│       │   │   │   ├── theme_pastel.json
│       │   │   │   ├── theme_vibrant.json
│       │   │   │   └── Visitor-diagram.json
│       │   │   ├── Generate_Mermaid_Diagram.json
│       │   │   ├── generated_diagram.json
│       │   │   ├── index.json
│       │   │   ├── integration.json
│       │   │   ├── Iterator-diagram.json
│       │   │   ├── Mediator-diagram.json
│       │   │   ├── Memento-diagram.json
│       │   │   ├── Mermaid_Analysis_Expert.json
│       │   │   ├── Mermaid_Class_Diagram_Generator.json
│       │   │   ├── Mermaid_Diagram_Generator.json
│       │   │   ├── Mermaid_Diagram_Modifier.json
│       │   │   ├── Modify_Mermaid_Diagram.json
│       │   │   ├── Observer-diagram.json
│       │   │   ├── Prototype-diagram.json
│       │   │   ├── Proxy-diagram.json
│       │   │   ├── README.json
│       │   │   ├── Singleton-diagram.json
│       │   │   ├── State-diagram.json
│       │   │   ├── Strategy-diagram.json
│       │   │   ├── TemplateMethod-diagram.json
│       │   │   ├── theme_dark.json
│       │   │   ├── theme_default.json
│       │   │   ├── theme_pastel.json
│       │   │   ├── theme_vibrant.json
│       │   │   └── Visitor-diagram.json
│       │   └── types.py
│       ├── project_orchestration.py
│       ├── prompt_manager
│       │   ├── __init__.py
│       │   ├── loader.py
│       │   ├── manager.py
│       │   └── template.py
│       ├── prompts
│       │   ├── __dirname.json
│       │   ├── __image_1___describe_the_icon_in_one_sen___.json
│       │   ├── __init__.py
│       │   ├── __type.json
│       │   ├── _.json
│       │   ├── _DEFAULT_OPEN_DELIMITER.json
│       │   ├── _emojiRegex.json
│       │   ├── _UUID_CHARS.json
│       │   ├── a.json
│       │   ├── A.json
│       │   ├── Aa.json
│       │   ├── aAnnotationPadding.json
│       │   ├── absoluteThresholdGroup.json
│       │   ├── add.json
│       │   ├── ADDITIONAL_PROPERTY_FLAG.json
│       │   ├── Advanced_Multi-Server_Integration_Template.json
│       │   ├── allOptionsList.json
│       │   ├── analysis
│       │   │   ├── Data_Analysis_Template.json
│       │   │   ├── index.json
│       │   │   ├── Mermaid_Analysis_Expert.json
│       │   │   ├── Sequential_Data_Analysis_with_MCP_Integration.json
│       │   │   └── SOLID_Code_Analysis_Visualizer.json
│       │   ├── Analysis_Assistant.json
│       │   ├── Analyze_Mermaid_Diagram.json
│       │   ├── ANDROID_EVERGREEN_FIRST.json
│       │   ├── ANSI_ESCAPE_BELL.json
│       │   ├── architecture
│       │   │   ├── index.json
│       │   │   └── PromptCombiner_Interface.json
│       │   ├── Architecture_Design_Assistant.json
│       │   ├── argsTag.json
│       │   ├── ARROW.json
│       │   ├── assistant
│       │   │   ├── Analysis_Assistant.json
│       │   │   ├── Architecture_Design_Assistant.json
│       │   │   ├── Code_Refactoring_Assistant.json
│       │   │   ├── Code_Review_Assistant.json
│       │   │   ├── Database_Query_Assistant.json
│       │   │   ├── Debugging_Assistant.json
│       │   │   ├── Foresight_Assistant.json
│       │   │   ├── index.json
│       │   │   ├── MCP_Integration_Assistant.json
│       │   │   ├── Project_Analysis_Assistant.json
│       │   │   └── Research_Assistant.json
│       │   ├── astralRange.json
│       │   ├── at.json
│       │   ├── authorization_endpoint.json
│       │   ├── b.json
│       │   ├── BABELIGNORE_FILENAME.json
│       │   ├── BACKSLASH.json
│       │   ├── backupId.json
│       │   ├── BANG.json
│       │   ├── BASE64_MAP.json
│       │   ├── baseFlags.json
│       │   ├── Basic_Template.json
│       │   ├── bgModel.json
│       │   ├── bignum.json
│       │   ├── blockKeywordsStr.json
│       │   ├── BOMChar.json
│       │   ├── boundary.json
│       │   ├── brackets.json
│       │   ├── BROWSER_VAR.json
│       │   ├── bt.json
│       │   ├── BUILTIN.json
│       │   ├── BULLET.json
│       │   ├── c.json
│       │   ├── C.json
│       │   ├── CACHE_VERSION.json
│       │   ├── cacheControl.json
│       │   ├── cacheProp.json
│       │   ├── category.py
│       │   ├── CHANGE_EVENT.json
│       │   ├── CHAR_CODE_0.json
│       │   ├── chars.json
│       │   ├── cjsPattern.json
│       │   ├── cKeywords.json
│       │   ├── classForPercent.json
│       │   ├── classStr.json
│       │   ├── clientFirstMessageBare.json
│       │   ├── cmd.json
│       │   ├── Code_Diagram_Documentation_Creator.json
│       │   ├── Code_Refactoring_Assistant.json
│       │   ├── Code_Review_Assistant.json
│       │   ├── code.json
│       │   ├── coding
│       │   │   ├── __dirname.json
│       │   │   ├── _.json
│       │   │   ├── _DEFAULT_OPEN_DELIMITER.json
│       │   │   ├── _emojiRegex.json
│       │   │   ├── _UUID_CHARS.json
│       │   │   ├── a.json
│       │   │   ├── A.json
│       │   │   ├── aAnnotationPadding.json
│       │   │   ├── absoluteThresholdGroup.json
│       │   │   ├── add.json
│       │   │   ├── ADDITIONAL_PROPERTY_FLAG.json
│       │   │   ├── allOptionsList.json
│       │   │   ├── ANDROID_EVERGREEN_FIRST.json
│       │   │   ├── ANSI_ESCAPE_BELL.json
│       │   │   ├── argsTag.json
│       │   │   ├── ARROW.json
│       │   │   ├── astralRange.json
│       │   │   ├── at.json
│       │   │   ├── authorization_endpoint.json
│       │   │   ├── BABELIGNORE_FILENAME.json
│       │   │   ├── BACKSLASH.json
│       │   │   ├── BANG.json
│       │   │   ├── BASE64_MAP.json
│       │   │   ├── baseFlags.json
│       │   │   ├── bgModel.json
│       │   │   ├── bignum.json
│       │   │   ├── blockKeywordsStr.json
│       │   │   ├── BOMChar.json
│       │   │   ├── boundary.json
│       │   │   ├── brackets.json
│       │   │   ├── BROWSER_VAR.json
│       │   │   ├── bt.json
│       │   │   ├── BUILTIN.json
│       │   │   ├── BULLET.json
│       │   │   ├── c.json
│       │   │   ├── C.json
│       │   │   ├── CACHE_VERSION.json
│       │   │   ├── cacheControl.json
│       │   │   ├── cacheProp.json
│       │   │   ├── CHANGE_EVENT.json
│       │   │   ├── CHAR_CODE_0.json
│       │   │   ├── chars.json
│       │   │   ├── cjsPattern.json
│       │   │   ├── cKeywords.json
│       │   │   ├── classForPercent.json
│       │   │   ├── classStr.json
│       │   │   ├── clientFirstMessageBare.json
│       │   │   ├── cmd.json
│       │   │   ├── code.json
│       │   │   ├── colorCode.json
│       │   │   ├── comma.json
│       │   │   ├── command.json
│       │   │   ├── configJsContent.json
│       │   │   ├── connectionString.json
│       │   │   ├── cssClassStr.json
│       │   │   ├── currentBoundaryParse.json
│       │   │   ├── d.json
│       │   │   ├── data.json
│       │   │   ├── DATA.json
│       │   │   ├── dataWebpackPrefix.json
│       │   │   ├── debug.json
│       │   │   ├── decodeStateVectorV2.json
│       │   │   ├── DEFAULT_DELIMITER.json
│       │   │   ├── DEFAULT_DIAGRAM_DIRECTION.json
│       │   │   ├── DEFAULT_JS_PATTERN.json
│       │   │   ├── DEFAULT_LOG_TARGET.json
│       │   │   ├── defaultHelpOpt.json
│       │   │   ├── defaultHost.json
│       │   │   ├── deferY18nLookupPrefix.json
│       │   │   ├── DELIM.json
│       │   │   ├── delimiter.json
│       │   │   ├── DEPRECATION.json
│       │   │   ├── destMain.json
│       │   │   ├── DID_NOT_THROW.json
│       │   │   ├── direction.json
│       │   │   ├── displayValue.json
│       │   │   ├── DNS.json
│       │   │   ├── doc.json
│       │   │   ├── DOCUMENTATION_NOTE.json
│       │   │   ├── DOT.json
│       │   │   ├── DOTS.json
│       │   │   ├── dummyCompoundId.json
│       │   │   ├── e.json
│       │   │   ├── E.json
│       │   │   ├── earlyHintsLink.json
│       │   │   ├── elide.json
│       │   │   ├── EMPTY.json
│       │   │   ├── end.json
│       │   │   ├── endpoint.json
│       │   │   ├── environment.json
│       │   │   ├── ERR_CODE.json
│       │   │   ├── errMessage.json
│       │   │   ├── errMsg.json
│       │   │   ├── ERROR_MESSAGE.json
│       │   │   ├── error.json
│       │   │   ├── ERROR.json
│       │   │   ├── ERRORCLASS.json
│       │   │   ├── errorMessage.json
│       │   │   ├── es6Default.json
│       │   │   ├── ESC.json
│       │   │   ├── Escapable.json
│       │   │   ├── escapedChar.json
│       │   │   ├── escapeFuncStr.json
│       │   │   ├── escSlash.json
│       │   │   ├── ev.json
│       │   │   ├── event.json
│       │   │   ├── execaMessage.json
│       │   │   ├── EXPECTED_LABEL.json
│       │   │   ├── expected.json
│       │   │   ├── expectedString.json
│       │   │   ├── expression1.json
│       │   │   ├── EXTENSION.json
│       │   │   ├── f.json
│       │   │   ├── FAIL_TEXT.json
│       │   │   ├── FILE_BROWSER_FACTORY.json
│       │   │   ├── fill.json
│       │   │   ├── findPackageJson.json
│       │   │   ├── fnKey.json
│       │   │   ├── FORMAT.json
│       │   │   ├── formatted.json
│       │   │   ├── from.json
│       │   │   ├── fullpaths.json
│       │   │   ├── FUNC_ERROR_TEXT.json
│       │   │   ├── GenStateSuspendedStart.json
│       │   │   ├── GENSYNC_EXPECTED_START.json
│       │   │   ├── gutter.json
│       │   │   ├── h.json
│       │   │   ├── handlerFuncName.json
│       │   │   ├── HASH_UNDEFINED.json
│       │   │   ├── head.json
│       │   │   ├── helpMessage.json
│       │   │   ├── HINT_ARG.json
│       │   │   ├── HOOK_RETURNED_NOTHING_ERROR_MESSAGE.json
│       │   │   ├── i.json
│       │   │   ├── id.json
│       │   │   ├── identifier.json
│       │   │   ├── Identifier.json
│       │   │   ├── INDENT.json
│       │   │   ├── indentation.json
│       │   │   ├── index.json
│       │   │   ├── INDIRECTION_FRAGMENT.json
│       │   │   ├── input.json
│       │   │   ├── inputText.json
│       │   │   ├── insert.json
│       │   │   ├── insertPromptQuery.json
│       │   │   ├── INSPECT_MAX_BYTES.json
│       │   │   ├── intToCharMap.json
│       │   │   ├── IS_ITERABLE_SENTINEL.json
│       │   │   ├── IS_KEYED_SENTINEL.json
│       │   │   ├── isConfigType.json
│       │   │   ├── isoSentinel.json
│       │   │   ├── isSourceNode.json
│       │   │   ├── j.json
│       │   │   ├── JAKE_CMD.json
│       │   │   ├── JEST_GLOBAL_NAME.json
│       │   │   ├── JEST_GLOBALS_MODULE_NAME.json
│       │   │   ├── JSON_SYNTAX_CHAR.json
│       │   │   ├── json.json
│       │   │   ├── jsonType.json
│       │   │   ├── jupyter_namespaceObject.json
│       │   │   ├── JUPYTERLAB_DOCMANAGER_PLUGIN_ID.json
│       │   │   ├── k.json
│       │   │   ├── KERNEL_STATUS_ERROR_CLASS.json
│       │   │   ├── key.json
│       │   │   ├── l.json
│       │   │   ├── labelId.json
│       │   │   ├── LATEST_PROTOCOL_VERSION.json
│       │   │   ├── LETTERDASHNUMBER.json
│       │   │   ├── LF.json
│       │   │   ├── LIMIT_REPLACE_NODE.json
│       │   │   ├── logTime.json
│       │   │   ├── lstatkey.json
│       │   │   ├── lt.json
│       │   │   ├── m.json
│       │   │   ├── maliciousPayload.json
│       │   │   ├── mask.json
│       │   │   ├── match.json
│       │   │   ├── matchingDelim.json
│       │   │   ├── MAXIMUM_MESSAGE_SIZE.json
│       │   │   ├── mdcContent.json
│       │   │   ├── MERMAID_DOM_ID_PREFIX.json
│       │   │   ├── message.json
│       │   │   ├── messages.json
│       │   │   ├── meth.json
│       │   │   ├── minimatch.json
│       │   │   ├── MOCK_CONSTRUCTOR_NAME.json
│       │   │   ├── MOCKS_PATTERN.json
│       │   │   ├── moduleDirectory.json
│       │   │   ├── msg.json
│       │   │   ├── mtr.json
│       │   │   ├── multipartType.json
│       │   │   ├── n.json
│       │   │   ├── N.json
│       │   │   ├── name.json
│       │   │   ├── NATIVE_PLATFORM.json
│       │   │   ├── newUrl.json
│       │   │   ├── NM.json
│       │   │   ├── NO_ARGUMENTS.json
│       │   │   ├── NO_DIFF_MESSAGE.json
│       │   │   ├── NODE_MODULES.json
│       │   │   ├── nodeInternalPrefix.json
│       │   │   ├── nonASCIIidentifierStartChars.json
│       │   │   ├── nonKey.json
│       │   │   ├── NOT_A_DOT.json
│       │   │   ├── notCharacterOrDash.json
│       │   │   ├── notebookURL.json
│       │   │   ├── notSelector.json
│       │   │   ├── nullTag.json
│       │   │   ├── num.json
│       │   │   ├── NUMBER.json
│       │   │   ├── o.json
│       │   │   ├── O.json
│       │   │   ├── octChar.json
│       │   │   ├── octetStreamType.json
│       │   │   ├── operators.json
│       │   │   ├── out.json
│       │   │   ├── OUTSIDE_JEST_VM_PROTOCOL.json
│       │   │   ├── override.json
│       │   │   ├── p.json
│       │   │   ├── PACKAGE_FILENAME.json
│       │   │   ├── PACKAGE_JSON.json
│       │   │   ├── packageVersion.json
│       │   │   ├── paddedNumber.json
│       │   │   ├── page.json
│       │   │   ├── parseClass.json
│       │   │   ├── path.json
│       │   │   ├── pathExt.json
│       │   │   ├── pattern.json
│       │   │   ├── PatternBoolean.json
│       │   │   ├── pBuiltins.json
│       │   │   ├── pFloatForm.json
│       │   │   ├── pkg.json
│       │   │   ├── PLUGIN_ID_DOC_MANAGER.json
│       │   │   ├── plusChar.json
│       │   │   ├── PN_CHARS.json
│       │   │   ├── point.json
│       │   │   ├── prefix.json
│       │   │   ├── PRETTY_PLACEHOLDER.json
│       │   │   ├── property_prefix.json
│       │   │   ├── pubkey256.json
│       │   │   ├── Q.json
│       │   │   ├── qmark.json
│       │   │   ├── QO.json
│       │   │   ├── query.json
│       │   │   ├── querystringType.json
│       │   │   ├── queryText.json
│       │   │   ├── r.json
│       │   │   ├── R.json
│       │   │   ├── rangeStart.json
│       │   │   ├── re.json
│       │   │   ├── reI.json
│       │   │   ├── REQUIRED_FIELD_SYMBOL.json
│       │   │   ├── reserve.json
│       │   │   ├── resolvedDestination.json
│       │   │   ├── resolverDir.json
│       │   │   ├── responseType.json
│       │   │   ├── result.json
│       │   │   ├── ROOT_DESCRIBE_BLOCK_NAME.json
│       │   │   ├── ROOT_NAMESPACE_NAME.json
│       │   │   ├── ROOT_TASK_NAME.json
│       │   │   ├── route.json
│       │   │   ├── RUNNING_TEXT.json
│       │   │   ├── s.json
│       │   │   ├── SCHEMA_PATH.json
│       │   │   ├── se.json
│       │   │   ├── SEARCHABLE_CLASS.json
│       │   │   ├── secret.json
│       │   │   ├── selector.json
│       │   │   ├── SEMVER_SPEC_VERSION.json
│       │   │   ├── sensitiveHeaders.json
│       │   │   ├── sep.json
│       │   │   ├── separator.json
│       │   │   ├── SHAPE_STATE.json
│       │   │   ├── shape.json
│       │   │   ├── SHARED.json
│       │   │   ├── short.json
│       │   │   ├── side.json
│       │   │   ├── SNAPSHOT_VERSION.json
│       │   │   ├── SOURCE_MAPPING_PREFIX.json
│       │   │   ├── source.json
│       │   │   ├── sourceMapContent.json
│       │   │   ├── SPACE_SYMBOL.json
│       │   │   ├── SPACE.json
│       │   │   ├── sqlKeywords.json
│       │   │   ├── sranges.json
│       │   │   ├── st.json
│       │   │   ├── ST.json
│       │   │   ├── stack.json
│       │   │   ├── START_HIDING.json
│       │   │   ├── START_OF_LINE.json
│       │   │   ├── startNoTraversal.json
│       │   │   ├── STATES.json
│       │   │   ├── stats.json
│       │   │   ├── statSync.json
│       │   │   ├── storageStatus.json
│       │   │   ├── storageType.json
│       │   │   ├── str.json
│       │   │   ├── stringifiedObject.json
│       │   │   ├── stringPath.json
│       │   │   ├── stringResult.json
│       │   │   ├── stringTag.json
│       │   │   ├── strValue.json
│       │   │   ├── style.json
│       │   │   ├── SUB_NAME.json
│       │   │   ├── subkey.json
│       │   │   ├── SUBPROTOCOL.json
│       │   │   ├── SUITE_NAME.json
│       │   │   ├── symbolPattern.json
│       │   │   ├── symbolTag.json
│       │   │   ├── t.json
│       │   │   ├── T.json
│       │   │   ├── templateDir.json
│       │   │   ├── tempName.json
│       │   │   ├── text.json
│       │   │   ├── time.json
│       │   │   ├── titleSeparator.json
│       │   │   ├── tmpl.json
│       │   │   ├── tn.json
│       │   │   ├── toValue.json
│       │   │   ├── transform.json
│       │   │   ├── trustProxyDefaultSymbol.json
│       │   │   ├── typeArgumentsKey.json
│       │   │   ├── typeKey.json
│       │   │   ├── typeMessage.json
│       │   │   ├── typesRegistryPackageName.json
│       │   │   ├── u.json
│       │   │   ├── UNDEFINED.json
│       │   │   ├── unit.json
│       │   │   ├── UNMATCHED_SURROGATE_PAIR_REPLACE.json
│       │   │   ├── ur.json
│       │   │   ├── USAGE.json
│       │   │   ├── value.json
│       │   │   ├── Vr.json
│       │   │   ├── watchmanURL.json
│       │   │   ├── webkit.json
│       │   │   ├── xhtml.json
│       │   │   ├── XP_DEFAULT_PATHEXT.json
│       │   │   └── y.json
│       │   ├── Collaborative_Development_with_MCP_Integration.json
│       │   ├── colorCode.json
│       │   ├── comma.json
│       │   ├── command.json
│       │   ├── completionShTemplate.json
│       │   ├── configJsContent.json
│       │   ├── connectionString.json
│       │   ├── Consolidated_TypeScript_Interfaces_Template.json
│       │   ├── Could_you_interpret_the_assumed_applicat___.json
│       │   ├── cssClassStr.json
│       │   ├── currentBoundaryParse.json
│       │   ├── d.json
│       │   ├── Data_Analysis_Template.json
│       │   ├── data.json
│       │   ├── DATA.json
│       │   ├── Database_Query_Assistant.json
│       │   ├── dataWebpackPrefix.json
│       │   ├── debug.json
│       │   ├── Debugging_Assistant.json
│       │   ├── decodeStateVectorV2.json
│       │   ├── DEFAULT_DELIMITER.json
│       │   ├── DEFAULT_DIAGRAM_DIRECTION.json
│       │   ├── DEFAULT_INDENT.json
│       │   ├── DEFAULT_JS_PATTERN.json
│       │   ├── DEFAULT_LOG_TARGET.json
│       │   ├── defaultHelpOpt.json
│       │   ├── defaultHost.json
│       │   ├── deferY18nLookupPrefix.json
│       │   ├── DELIM.json
│       │   ├── delimiter.json
│       │   ├── DEPRECATION.json
│       │   ├── DESCENDING.json
│       │   ├── destMain.json
│       │   ├── development
│       │   │   ├── Collaborative_Development_with_MCP_Integration.json
│       │   │   ├── Consolidated_TypeScript_Interfaces_Template.json
│       │   │   ├── Development_Workflow.json
│       │   │   ├── index.json
│       │   │   ├── MCP_Server_Development_Prompt_Combiner.json
│       │   │   └── Monorepo_Migration_and_Code_Organization_Guide.json
│       │   ├── Development_System_Prompt.json
│       │   ├── Development_Workflow.json
│       │   ├── devops
│       │   │   ├── Docker_Compose_Prompt_Combiner.json
│       │   │   ├── Docker_Containerization_Guide.json
│       │   │   └── index.json
│       │   ├── DID_NOT_THROW.json
│       │   ├── direction.json
│       │   ├── displayValue.json
│       │   ├── DNS.json
│       │   ├── doc.json
│       │   ├── Docker_Compose_Prompt_Combiner.json
│       │   ├── Docker_Containerization_Guide.json
│       │   ├── Docker_MCP_Servers_Orchestration_Guide.json
│       │   ├── DOCUMENTATION_NOTE.json
│       │   ├── DOT.json
│       │   ├── DOTS.json
│       │   ├── dummyCompoundId.json
│       │   ├── e.json
│       │   ├── E.json
│       │   ├── earlyHintsLink.json
│       │   ├── elide.json
│       │   ├── EMPTY.json
│       │   ├── encoded.json
│       │   ├── end.json
│       │   ├── endpoint.json
│       │   ├── environment.json
│       │   ├── ERR_CODE.json
│       │   ├── errMessage.json
│       │   ├── errMsg.json
│       │   ├── ERROR_MESSAGE.json
│       │   ├── error.json
│       │   ├── ERROR.json
│       │   ├── ERRORCLASS.json
│       │   ├── errorMessage.json
│       │   ├── es6Default.json
│       │   ├── ESC.json
│       │   ├── Escapable.json
│       │   ├── escapedChar.json
│       │   ├── escapeFuncStr.json
│       │   ├── escSlash.json
│       │   ├── ev.json
│       │   ├── event.json
│       │   ├── execaMessage.json
│       │   ├── EXPECTED_LABEL.json
│       │   ├── expected.json
│       │   ├── expectedString.json
│       │   ├── expression1.json
│       │   ├── EXTENSION.json
│       │   ├── f.json
│       │   ├── FAIL_TEXT.json
│       │   ├── FILE_BROWSER_FACTORY.json
│       │   ├── fill.json
│       │   ├── findPackageJson.json
│       │   ├── fnKey.json
│       │   ├── Foresight_Assistant.json
│       │   ├── FORMAT.json
│       │   ├── formatted.json
│       │   ├── from.json
│       │   ├── fullpaths.json
│       │   ├── FUNC_ERROR_TEXT.json
│       │   ├── general
│       │   │   └── index.json
│       │   ├── Generate_different_types_of_questions_ab___.json
│       │   ├── Generate_Mermaid_Diagram.json
│       │   ├── GenStateSuspendedStart.json
│       │   ├── GENSYNC_EXPECTED_START.json
│       │   ├── GitHub_Repository_Explorer.json
│       │   ├── gutter.json
│       │   ├── h.json
│       │   ├── handlerFuncName.json
│       │   ├── HASH_UNDEFINED.json
│       │   ├── head.json
│       │   ├── helpMessage.json
│       │   ├── HINT_ARG.json
│       │   ├── HOOK_RETURNED_NOTHING_ERROR_MESSAGE.json
│       │   ├── i.json
│       │   ├── id.json
│       │   ├── identifier.json
│       │   ├── Identifier.json
│       │   ├── INDENT.json
│       │   ├── indentation.json
│       │   ├── index.json
│       │   ├── INDIRECTION_FRAGMENT.json
│       │   ├── Initialize_project_setup_for_a_new_micro___.json
│       │   ├── input.json
│       │   ├── inputText.json
│       │   ├── insert.json
│       │   ├── insertPromptQuery.json
│       │   ├── INSPECT_MAX_BYTES.json
│       │   ├── install_dependencies__build__run__test____.json
│       │   ├── intToCharMap.json
│       │   ├── IS_ITERABLE_SENTINEL.json
│       │   ├── IS_KEYED_SENTINEL.json
│       │   ├── isConfigType.json
│       │   ├── isoSentinel.json
│       │   ├── isSourceNode.json
│       │   ├── j.json
│       │   ├── J.json
│       │   ├── JAKE_CMD.json
│       │   ├── JEST_GLOBAL_NAME.json
│       │   ├── JEST_GLOBALS_MODULE_NAME.json
│       │   ├── JSON_SYNTAX_CHAR.json
│       │   ├── json.json
│       │   ├── jsonType.json
│       │   ├── jupyter_namespaceObject.json
│       │   ├── JUPYTERLAB_DOCMANAGER_PLUGIN_ID.json
│       │   ├── k.json
│       │   ├── KERNEL_STATUS_ERROR_CLASS.json
│       │   ├── key.json
│       │   ├── l.json
│       │   ├── labelId.json
│       │   ├── LATEST_PROTOCOL_VERSION.json
│       │   ├── LETTERDASHNUMBER.json
│       │   ├── LF.json
│       │   ├── LIMIT_REPLACE_NODE.json
│       │   ├── LINE_FEED.json
│       │   ├── logTime.json
│       │   ├── lstatkey.json
│       │   ├── lt.json
│       │   ├── m.json
│       │   ├── maliciousPayload.json
│       │   ├── manager.py
│       │   ├── marker.json
│       │   ├── mask.json
│       │   ├── match.json
│       │   ├── matchingDelim.json
│       │   ├── MAXIMUM_MESSAGE_SIZE.json
│       │   ├── MCP_Integration_Assistant.json
│       │   ├── MCP_Resources_Explorer.json
│       │   ├── MCP_Resources_Integration_Guide.json
│       │   ├── MCP_Server_Development_Prompt_Combiner.json
│       │   ├── MCP_Server_Integration_Guide.json
│       │   ├── mcp-code-generator.json
│       │   ├── mdcContent.json
│       │   ├── Mermaid_Analysis_Expert.json
│       │   ├── Mermaid_Class_Diagram_Generator.json
│       │   ├── Mermaid_Diagram_Generator.json
│       │   ├── Mermaid_Diagram_Modifier.json
│       │   ├── MERMAID_DOM_ID_PREFIX.json
│       │   ├── message.json
│       │   ├── messages.json
│       │   ├── meth.json
│       │   ├── minimatch.json
│       │   ├── MOBILE_QUERY.json
│       │   ├── MOCK_CONSTRUCTOR_NAME.json
│       │   ├── MOCKS_PATTERN.json
│       │   ├── Modify_Mermaid_Diagram.json
│       │   ├── moduleDirectory.json
│       │   ├── Monorepo_Migration_and_Code_Organization_Guide.json
│       │   ├── msg.json
│       │   ├── mtr.json
│       │   ├── Multi-Resource_Context_Assistant.json
│       │   ├── multipartType.json
│       │   ├── n.json
│       │   ├── N.json
│       │   ├── name.json
│       │   ├── NATIVE_PLATFORM.json
│       │   ├── newUrl.json
│       │   ├── NM.json
│       │   ├── NO_ARGUMENTS.json
│       │   ├── NO_DIFF_MESSAGE.json
│       │   ├── NODE_MODULES.json
│       │   ├── nodeInternalPrefix.json
│       │   ├── nonASCIIidentifierStartChars.json
│       │   ├── nonKey.json
│       │   ├── NOT_A_DOT.json
│       │   ├── notCharacterOrDash.json
│       │   ├── notebookURL.json
│       │   ├── notSelector.json
│       │   ├── nullTag.json
│       │   ├── num.json
│       │   ├── NUMBER.json
│       │   ├── o.json
│       │   ├── O.json
│       │   ├── octChar.json
│       │   ├── octetStreamType.json
│       │   ├── operators.json
│       │   ├── other
│       │   │   ├── __image_1___describe_the_icon_in_one_sen___.json
│       │   │   ├── __type.json
│       │   │   ├── Advanced_Multi-Server_Integration_Template.json
│       │   │   ├── Analyze_Mermaid_Diagram.json
│       │   │   ├── Basic_Template.json
│       │   │   ├── Code_Diagram_Documentation_Creator.json
│       │   │   ├── Collaborative_Development_with_MCP_Integration.json
│       │   │   ├── completionShTemplate.json
│       │   │   ├── Could_you_interpret_the_assumed_applicat___.json
│       │   │   ├── DEFAULT_INDENT.json
│       │   │   ├── Docker_MCP_Servers_Orchestration_Guide.json
│       │   │   ├── Generate_different_types_of_questions_ab___.json
│       │   │   ├── Generate_Mermaid_Diagram.json
│       │   │   ├── GitHub_Repository_Explorer.json
│       │   │   ├── index.json
│       │   │   ├── Initialize_project_setup_for_a_new_micro___.json
│       │   │   ├── install_dependencies__build__run__test____.json
│       │   │   ├── LINE_FEED.json
│       │   │   ├── MCP_Resources_Explorer.json
│       │   │   ├── MCP_Resources_Integration_Guide.json
│       │   │   ├── MCP_Server_Integration_Guide.json
│       │   │   ├── mcp-code-generator.json
│       │   │   ├── Mermaid_Class_Diagram_Generator.json
│       │   │   ├── Mermaid_Diagram_Generator.json
│       │   │   ├── Mermaid_Diagram_Modifier.json
│       │   │   ├── Modify_Mermaid_Diagram.json
│       │   │   ├── Multi-Resource_Context_Assistant.json
│       │   │   ├── output.json
│       │   │   ├── sseUrl.json
│       │   │   ├── string.json
│       │   │   ├── Task_List_Helper.json
│       │   │   ├── Template-Based_MCP_Integration.json
│       │   │   ├── Test_Prompt.json
│       │   │   ├── type.json
│       │   │   ├── VERSION.json
│       │   │   ├── WIN_SLASH.json
│       │   │   └── You_are_limited_to_respond_Yes_or_No_onl___.json
│       │   ├── out.json
│       │   ├── output.json
│       │   ├── OUTSIDE_JEST_VM_PROTOCOL.json
│       │   ├── override.json
│       │   ├── p.json
│       │   ├── PACKAGE_FILENAME.json
│       │   ├── PACKAGE_JSON.json
│       │   ├── packageVersion.json
│       │   ├── paddedNumber.json
│       │   ├── page.json
│       │   ├── parseClass.json
│       │   ├── PATH_NODE_MODULES.json
│       │   ├── path.json
│       │   ├── pathExt.json
│       │   ├── pattern.json
│       │   ├── PatternBoolean.json
│       │   ├── pBuiltins.json
│       │   ├── pFloatForm.json
│       │   ├── pkg.json
│       │   ├── PLUGIN_ID_DOC_MANAGER.json
│       │   ├── plusChar.json
│       │   ├── PN_CHARS.json
│       │   ├── point.json
│       │   ├── prefix.json
│       │   ├── PRETTY_PLACEHOLDER.json
│       │   ├── Project_Analysis_Assistant.json
│       │   ├── ProjectsUpdatedInBackgroundEvent.json
│       │   ├── PromptCombiner_Interface.json
│       │   ├── promptId.json
│       │   ├── property_prefix.json
│       │   ├── pubkey256.json
│       │   ├── Q.json
│       │   ├── qmark.json
│       │   ├── QO.json
│       │   ├── query.json
│       │   ├── querystringType.json
│       │   ├── queryText.json
│       │   ├── r.json
│       │   ├── R.json
│       │   ├── rangeStart.json
│       │   ├── re.json
│       │   ├── reI.json
│       │   ├── REQUIRED_FIELD_SYMBOL.json
│       │   ├── Research_Assistant.json
│       │   ├── reserve.json
│       │   ├── resolvedDestination.json
│       │   ├── resolverDir.json
│       │   ├── responseType.json
│       │   ├── result.json
│       │   ├── ROOT_DESCRIBE_BLOCK_NAME.json
│       │   ├── ROOT_NAMESPACE_NAME.json
│       │   ├── ROOT_TASK_NAME.json
│       │   ├── route.json
│       │   ├── RUNNING_TEXT.json
│       │   ├── RXstyle.json
│       │   ├── s.json
│       │   ├── SCHEMA_PATH.json
│       │   ├── schemaQuery.json
│       │   ├── se.json
│       │   ├── SEARCHABLE_CLASS.json
│       │   ├── secret.json
│       │   ├── selector.json
│       │   ├── SEMVER_SPEC_VERSION.json
│       │   ├── sensitiveHeaders.json
│       │   ├── sep.json
│       │   ├── separator.json
│       │   ├── Sequential_Data_Analysis_with_MCP_Integration.json
│       │   ├── SHAPE_STATE.json
│       │   ├── shape.json
│       │   ├── SHARED.json
│       │   ├── short.json
│       │   ├── side.json
│       │   ├── SNAPSHOT_VERSION.json
│       │   ├── SOLID_Code_Analysis_Visualizer.json
│       │   ├── SOURCE_MAPPING_PREFIX.json
│       │   ├── source.json
│       │   ├── sourceMapContent.json
│       │   ├── SPACE_SYMBOL.json
│       │   ├── SPACE.json
│       │   ├── sqlKeywords.json
│       │   ├── sranges.json
│       │   ├── sseUrl.json
│       │   ├── st.json
│       │   ├── ST.json
│       │   ├── stack.json
│       │   ├── START_HIDING.json
│       │   ├── START_OF_LINE.json
│       │   ├── startNoTraversal.json
│       │   ├── STATES.json
│       │   ├── stats.json
│       │   ├── statSync.json
│       │   ├── status.json
│       │   ├── storageStatus.json
│       │   ├── storageType.json
│       │   ├── str.json
│       │   ├── string.json
│       │   ├── stringifiedObject.json
│       │   ├── stringPath.json
│       │   ├── stringResult.json
│       │   ├── stringTag.json
│       │   ├── strValue.json
│       │   ├── style.json
│       │   ├── SUB_NAME.json
│       │   ├── subkey.json
│       │   ├── SUBPROTOCOL.json
│       │   ├── SUITE_NAME.json
│       │   ├── symbolPattern.json
│       │   ├── symbolTag.json
│       │   ├── system
│       │   │   ├── Aa.json
│       │   │   ├── b.json
│       │   │   ├── Development_System_Prompt.json
│       │   │   ├── index.json
│       │   │   ├── marker.json
│       │   │   ├── PATH_NODE_MODULES.json
│       │   │   ├── ProjectsUpdatedInBackgroundEvent.json
│       │   │   ├── RXstyle.json
│       │   │   ├── status.json
│       │   │   └── versionMajorMinor.json
│       │   ├── t.json
│       │   ├── T.json
│       │   ├── Task_List_Helper.json
│       │   ├── Template-Based_MCP_Integration.json
│       │   ├── template.py
│       │   ├── templateDir.json
│       │   ├── tempName.json
│       │   ├── Test_Prompt.json
│       │   ├── text.json
│       │   ├── time.json
│       │   ├── titleSeparator.json
│       │   ├── tmpl.json
│       │   ├── tn.json
│       │   ├── TOPBAR_FACTORY.json
│       │   ├── toValue.json
│       │   ├── transform.json
│       │   ├── trustProxyDefaultSymbol.json
│       │   ├── txt.json
│       │   ├── type.json
│       │   ├── typeArgumentsKey.json
│       │   ├── typeKey.json
│       │   ├── typeMessage.json
│       │   ├── typesRegistryPackageName.json
│       │   ├── u.json
│       │   ├── UNDEFINED.json
│       │   ├── unit.json
│       │   ├── UNMATCHED_SURROGATE_PAIR_REPLACE.json
│       │   ├── ur.json
│       │   ├── usage.json
│       │   ├── USAGE.json
│       │   ├── user
│       │   │   ├── backupId.json
│       │   │   ├── DESCENDING.json
│       │   │   ├── encoded.json
│       │   │   ├── index.json
│       │   │   ├── J.json
│       │   │   ├── MOBILE_QUERY.json
│       │   │   ├── promptId.json
│       │   │   ├── schemaQuery.json
│       │   │   ├── TOPBAR_FACTORY.json
│       │   │   ├── txt.json
│       │   │   └── usage.json
│       │   ├── value.json
│       │   ├── VERSION.json
│       │   ├── version.py
│       │   ├── versionMajorMinor.json
│       │   ├── Vr.json
│       │   ├── watchmanURL.json
│       │   ├── webkit.json
│       │   ├── WIN_SLASH.json
│       │   ├── xhtml.json
│       │   ├── XP_DEFAULT_PATHEXT.json
│       │   ├── y.json
│       │   └── You_are_limited_to_respond_Yes_or_No_onl___.json
│       ├── resources
│       │   ├── __init__.py
│       │   ├── code_examples
│       │   │   └── index.json
│       │   ├── config
│       │   │   └── index.json
│       │   ├── documentation
│       │   │   └── index.json
│       │   ├── images
│       │   │   └── index.json
│       │   ├── index.json
│       │   └── other
│       │       └── index.json
│       ├── server.py
│       ├── templates
│       │   ├── __init__.py
│       │   ├── AbstractFactory.json
│       │   ├── Adapter.json
│       │   ├── base.py
│       │   ├── Builder.json
│       │   ├── Chain.json
│       │   ├── Command.json
│       │   ├── component
│       │   │   ├── AbstractFactory.json
│       │   │   ├── Adapter.json
│       │   │   ├── Builder.json
│       │   │   ├── Chain.json
│       │   │   ├── Command.json
│       │   │   ├── Decorator.json
│       │   │   ├── Facade.json
│       │   │   ├── Factory.json
│       │   │   ├── Iterator.json
│       │   │   ├── Mediator.json
│       │   │   ├── Memento.json
│       │   │   ├── Observer.json
│       │   │   ├── Prototype.json
│       │   │   ├── Proxy.json
│       │   │   ├── Singleton.json
│       │   │   ├── State.json
│       │   │   ├── Strategy.json
│       │   │   ├── TemplateMethod.json
│       │   │   └── Visitor.json
│       │   ├── component.py
│       │   ├── Decorator.json
│       │   ├── Facade.json
│       │   ├── Factory.json
│       │   ├── index.json
│       │   ├── Iterator.json
│       │   ├── manager.py
│       │   ├── Mediator.json
│       │   ├── Memento.json
│       │   ├── Observer.json
│       │   ├── project.py
│       │   ├── Prototype.json
│       │   ├── Proxy.json
│       │   ├── renderer.py
│       │   ├── Singleton.json
│       │   ├── State.json
│       │   ├── Strategy.json
│       │   ├── template_manager.py
│       │   ├── TemplateMethod.json
│       │   ├── types.py
│       │   └── Visitor.json
│       └── utils
│           └── __init__.py
├── SUMMARY.md
├── TASK_COMPLETION_SUMMARY.md
├── templates
│   └── openssl
│       ├── files
│       │   ├── CMakeLists.txt.jinja2
│       │   ├── conanfile.py.jinja2
│       │   ├── main.cpp.jinja2
│       │   └── README.md.jinja2
│       ├── openssl-consumer.json
│       └── template.json
├── test_openssl_integration.sh
├── test_package
│   └── conanfile.py
└── tests
    ├── __init__.py
    ├── conftest.py
    ├── integration
    │   ├── test_core_integration.py
    │   ├── test_mermaid_integration.py
    │   ├── test_prompt_manager_integration.py
    │   └── test_server_integration.py
    ├── test_aws_mcp.py
    ├── test_base_classes.py
    ├── test_config.py
    ├── test_exceptions.py
    ├── test_mermaid.py
    ├── test_prompts.py
    └── test_templates.py
```

# Files

--------------------------------------------------------------------------------
/aws-sip-trunk/PROJECT_INDEX.md:
--------------------------------------------------------------------------------

```markdown
  1 | # AWS SIP Trunk Project Index
  2 | 
  3 | Complete file reference for the AWS SIP trunk deployment project.
  4 | 
  5 | ## 📋 Quick Navigation
  6 | 
  7 | - **Getting Started**: [QUICKSTART.md](QUICKSTART.md)
  8 | - **Full Deployment**: [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)
  9 | - **Troubleshooting**: [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)
 10 | - **Project Overview**: [DEPLOYMENT_SUMMARY.md](DEPLOYMENT_SUMMARY.md)
 11 | 
 12 | ## 📁 File Structure
 13 | 
 14 | ```
 15 | aws-sip-trunk/
 16 | ├── Documentation Files
 17 | │   ├── README.md                     # Project overview and introduction
 18 | │   ├── QUICKSTART.md                 # 5-minute setup guide
 19 | │   ├── DEPLOYMENT_SUMMARY.md         # Architecture and design decisions
 20 | │   ├── PROJECT_INDEX.md              # This file
 21 | │   └── docs/
 22 | │       ├── DEPLOYMENT.md             # Detailed deployment instructions
 23 | │       └── TROUBLESHOOTING.md        # Issue resolution guide
 24 | │
 25 | ├── Infrastructure as Code
 26 | │   └── terraform/
 27 | │       ├── main.tf                   # Core Terraform configuration
 28 | │       ├── variables.tf              # Input variable definitions
 29 | │       ├── outputs.tf                # Output value definitions
 30 | │       ├── networking.tf             # VPC, subnets, security groups
 31 | │       ├── ec2.tf                    # EC2 instances, IAM roles
 32 | │       ├── storage.tf                # S3 buckets, Parameter Store
 33 | │       ├── monitoring.tf             # CloudWatch alarms, dashboard
 34 | │       └── terraform.tfvars.example  # Example configuration
 35 | │
 36 | ├── Deployment Scripts
 37 | │   └── scripts/
 38 | │       ├── deploy-asterisk-aws.sh    # Manual AWS CLI deployment
 39 | │       └── user-data.sh              # EC2 bootstrap script
 40 | │
 41 | ├── Configuration Templates
 42 | │   └── config/
 43 | │       ├── pjsip.conf.j2             # PJSIP Jinja2 template
 44 | │       ├── extensions.conf.j2        # Dialplan Jinja2 template
 45 | │       └── rtp.conf                  # RTP configuration
 46 | │
 47 | ├── Testing
 48 | │   └── tests/
 49 | │       └── test_sip_connectivity.py  # Integration tests
 50 | │
 51 | └── Project Configuration
 52 |     ├── pyproject.toml                # Python project metadata
 53 |     └── .gitignore                    # Git exclusions
 54 | ```
 55 | 
 56 | ## 📄 File Descriptions
 57 | 
 58 | ### Documentation
 59 | 
 60 | #### [README.md](README.md)
 61 | - **Purpose**: Main project documentation and entry point
 62 | - **Audience**: All users
 63 | - **Contains**: 
 64 |   - Project overview and features
 65 |   - AWS services used
 66 |   - Design patterns
 67 |   - Known issues summary
 68 |   - Deployment script overview
 69 |   - Environment variables reference
 70 | 
 71 | #### [QUICKSTART.md](QUICKSTART.md)
 72 | - **Purpose**: Fast-track deployment guide
 73 | - **Audience**: Users who want to deploy quickly
 74 | - **Contains**:
 75 |   - Prerequisites checklist
 76 |   - 5-minute Terraform setup
 77 |   - ElevenLabs configuration steps
 78 |   - Quick troubleshooting
 79 |   - Production checklist
 80 |   - Cost estimates
 81 | 
 82 | #### [DEPLOYMENT_SUMMARY.md](DEPLOYMENT_SUMMARY.md)
 83 | - **Purpose**: Comprehensive project summary
 84 | - **Audience**: Technical decision makers, architects
 85 | - **Contains**:
 86 |   - Architecture diagrams
 87 |   - AWS resources detailed list
 88 |   - Configuration file explanations
 89 |   - Testing procedures
 90 |   - Security best practices
 91 |   - Maintenance procedures
 92 | 
 93 | #### [docs/DEPLOYMENT.md](docs/DEPLOYMENT.md)
 94 | - **Purpose**: Step-by-step deployment instructions
 95 | - **Audience**: DevOps engineers, system administrators
 96 | - **Contains**:
 97 |   - Detailed prerequisites
 98 |   - Two deployment methods (Terraform + Manual)
 99 |   - Post-deployment configuration
100 |   - Monitoring setup
101 |   - Backup/restore procedures
102 |   - Scaling and HA configuration
103 | 
104 | #### [docs/TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)
105 | - **Purpose**: Comprehensive issue resolution guide
106 | - **Audience**: Operations team, support engineers
107 | - **Contains**:
108 |   - Quick diagnostic commands
109 |   - 9 common issues with solutions
110 |   - Emergency procedures
111 |   - Performance tuning
112 |   - Diagnostic report script
113 | 
114 | ### Infrastructure as Code (Terraform)
115 | 
116 | #### [terraform/main.tf](terraform/main.tf)
117 | - **Purpose**: Core Terraform configuration
118 | - **Resources**: Provider, data sources, local variables
119 | - **Key Components**:
120 |   - AWS provider configuration
121 |   - Default tags
122 |   - Amazon Linux 2 AMI lookup
123 |   - Version requirements
124 | 
125 | #### [terraform/variables.tf](terraform/variables.tf)
126 | - **Purpose**: Input variable definitions with validation
127 | - **Variables** (27 total):
128 |   - AWS configuration (region, instance type)
129 |   - Network settings (VPC CIDR, subnets)
130 |   - ElevenLabs credentials
131 |   - Feature flags (HA, TLS, recordings)
132 |   - Monitoring configuration
133 |   - DNS settings
134 | 
135 | #### [terraform/outputs.tf](terraform/outputs.tf)
136 | - **Purpose**: Export deployment information
137 | - **Outputs** (20 total):
138 |   - Instance IDs and IPs
139 |   - SIP endpoint URI
140 |   - S3 bucket names
141 |   - CloudWatch resources
142 |   - SSH commands
143 |   - Deployment summary
144 | 
145 | #### [terraform/networking.tf](terraform/networking.tf)
146 | - **Purpose**: Network infrastructure
147 | - **Resources**:
148 |   - VPC with DNS enabled
149 |   - Internet Gateway
150 |   - Public subnets (2x for HA)
151 |   - Route tables
152 |   - Elastic IPs (1-2)
153 |   - Security Groups with rules
154 |   - Route 53 DNS records (optional)
155 | 
156 | #### [terraform/ec2.tf](terraform/ec2.tf)
157 | - **Purpose**: Compute resources
158 | - **Resources**:
159 |   - IAM role and policies
160 |   - Instance profile
161 |   - EC2 instances (primary + optional standby)
162 |   - EBS volumes
163 |   - CloudWatch log groups
164 |   - User data script integration
165 | 
166 | #### [terraform/storage.tf](terraform/storage.tf)
167 | - **Purpose**: Storage and secrets management
168 | - **Resources**:
169 |   - S3 bucket for recordings (encrypted, versioned)
170 |   - S3 bucket for backups (optional)
171 |   - Lifecycle policies
172 |   - Parameter Store parameters (3x)
173 |   - Public access blocks
174 | 
175 | #### [terraform/monitoring.tf](terraform/monitoring.tf)
176 | - **Purpose**: Observability infrastructure
177 | - **Resources**:
178 |   - SNS topic for alarms
179 |   - CloudWatch alarms (6x):
180 |     - Instance status check
181 |     - CPU utilization
182 |     - Memory utilization
183 |     - Disk space
184 |     - SIP registration failures
185 |     - Call failure rate
186 |   - Log metric filters
187 |   - CloudWatch dashboard
188 | 
189 | #### [terraform/terraform.tfvars.example](terraform/terraform.tfvars.example)
190 | - **Purpose**: Example configuration file
191 | - **Usage**: Copy to `terraform.tfvars` and customize
192 | - **Contains**: All configurable variables with examples
193 | 
194 | ### Deployment Scripts
195 | 
196 | #### [scripts/deploy-asterisk-aws.sh](scripts/deploy-asterisk-aws.sh)
197 | - **Purpose**: Manual deployment using AWS CLI
198 | - **When to Use**: Alternative to Terraform, one-time deployments
199 | - **Steps**:
200 |   1. Create VPC and networking (10 steps)
201 |   2. Configure Security Groups
202 |   3. Allocate Elastic IP
203 |   4. Store credentials in Parameter Store
204 |   5. Create IAM roles
205 |   6. Launch EC2 instance
206 |   7. Associate Elastic IP
207 | - **Requirements**: AWS CLI, environment variables set
208 | - **Execution Time**: ~20-25 minutes
209 | 
210 | #### [scripts/user-data.sh](scripts/user-data.sh)
211 | - **Purpose**: EC2 instance bootstrap script
212 | - **Execution**: Runs on first boot via EC2 user data
213 | - **Actions**:
214 |   1. Update system packages
215 |   2. Install build dependencies
216 |   3. Download and compile Asterisk 21
217 |   4. Configure PJSIP, RTP, dialplan
218 |   5. Set up systemd service
219 |   6. Configure Fail2Ban
220 |   7. Install CloudWatch agent
221 |   8. Create health check script
222 | - **Execution Time**: ~15-20 minutes
223 | - **Logs**: `/var/log/asterisk-setup.log`
224 | 
225 | ### Configuration Templates
226 | 
227 | #### [config/pjsip.conf.j2](config/pjsip.conf.j2)
228 | - **Purpose**: PJSIP configuration template
229 | - **Format**: Jinja2 template
230 | - **Sections**:
231 |   - Global settings
232 |   - Transport configuration (TCP/TLS)
233 |   - Endpoint definition
234 |   - AOR (Address of Record)
235 |   - Authentication
236 |   - Identify rules
237 |   - ACL (optional)
238 |   - Custom endpoints support
239 | - **Template Variables**: 20+ customizable parameters
240 | 
241 | #### [config/extensions.conf.j2](config/extensions.conf.j2)
242 | - **Purpose**: Asterisk dialplan template
243 | - **Format**: Jinja2 template
244 | - **Contexts**:
245 |   - `from-elevenlabs`: Inbound calls
246 |   - `outbound-to-elevenlabs`: Outbound calls
247 |   - `default`: Unauthorized calls
248 |   - `health-check`: Monitoring endpoint
249 |   - Custom contexts support
250 | - **Features**:
251 |   - Call recording with S3 upload
252 |   - IVR menu system
253 |   - DTMF handling
254 |   - Hangup handlers
255 |   - CDR tracking
256 | 
257 | ### Testing
258 | 
259 | #### [tests/test_sip_connectivity.py](tests/test_sip_connectivity.py)
260 | - **Purpose**: Integration test suite
261 | - **Framework**: pytest
262 | - **Test Classes**:
263 |   - `TestSIPConnectivity`: Infrastructure and connectivity (9 tests)
264 |   - `TestSIPRegistration`: SIP endpoint configuration
265 |   - `TestCallFlow`: Call establishment and audio
266 |   - `TestMonitoring`: CloudWatch alarms and dashboards
267 | - **Requirements**: boto3, AWS credentials, deployed infrastructure
268 | - **Execution**: `pytest tests/test_sip_connectivity.py`
269 | 
270 | ### Project Configuration
271 | 
272 | #### [pyproject.toml](pyproject.toml)
273 | - **Purpose**: Python project metadata and dependencies
274 | - **Build System**: setuptools >= 68
275 | - **Dependencies**:
276 |   - boto3, botocore (AWS SDK)
277 |   - pyyaml, jinja2 (configuration)
278 |   - python-dotenv (environment)
279 | - **Dev Dependencies**:
280 |   - pytest, pytest-cov (testing)
281 |   - mypy, ruff, black (linting)
282 | - **Scripts**: `aws-sip-deploy` CLI command
283 | 
284 | #### [.gitignore](.gitignore)
285 | - **Purpose**: Git exclusions for sensitive and generated files
286 | - **Excludes**:
287 |   - Terraform state files
288 |   - AWS credentials
289 |   - SSH keys
290 |   - Logs and temporary files
291 |   - IDE configurations
292 | 
293 | ## 🔗 File Relationships
294 | 
295 | ### Deployment Flow
296 | ```
297 | 1. terraform.tfvars
298 |    ↓
299 | 2. main.tf + variables.tf
300 |    ↓
301 | 3. networking.tf → ec2.tf → storage.tf → monitoring.tf
302 |    ↓
303 | 4. user-data.sh (runs on EC2)
304 |    ↓
305 | 5. pjsip.conf.j2 + extensions.conf.j2 (generated)
306 |    ↓
307 | 6. Asterisk running with SIP trunk
308 | ```
309 | 
310 | ### Documentation Flow
311 | ```
312 | README.md (overview)
313 |    ↓
314 | QUICKSTART.md (fast start)
315 |    ↓
316 | docs/DEPLOYMENT.md (detailed setup)
317 |    ↓
318 | docs/TROUBLESHOOTING.md (issue resolution)
319 | ```
320 | 
321 | ## 🎯 Use Cases by Role
322 | 
323 | ### DevOps Engineer
324 | **Primary Files:**
325 | 1. `terraform/` - Infrastructure provisioning
326 | 2. `scripts/deploy-asterisk-aws.sh` - Manual deployment
327 | 3. `docs/DEPLOYMENT.md` - Deployment procedures
328 | 4. `docs/TROUBLESHOOTING.md` - Issue resolution
329 | 
330 | ### System Administrator
331 | **Primary Files:**
332 | 1. `QUICKSTART.md` - Fast deployment
333 | 2. `config/pjsip.conf.j2` - SIP configuration
334 | 3. `config/extensions.conf.j2` - Dialplan customization
335 | 4. `docs/TROUBLESHOOTING.md` - Operations guide
336 | 
337 | ### Developer
338 | **Primary Files:**
339 | 1. `pyproject.toml` - Project setup
340 | 2. `tests/test_sip_connectivity.py` - Integration tests
341 | 3. `config/*.j2` - Configuration templates
342 | 4. `DEPLOYMENT_SUMMARY.md` - Architecture understanding
343 | 
344 | ### Technical Architect
345 | **Primary Files:**
346 | 1. `DEPLOYMENT_SUMMARY.md` - Architecture overview
347 | 2. `README.md` - Design patterns
348 | 3. `terraform/*.tf` - Infrastructure design
349 | 4. `docs/DEPLOYMENT.md` - Deployment options
350 | 
351 | ## 📊 File Statistics
352 | 
353 | - **Total Files**: 18 main files
354 | - **Terraform Files**: 7 (main + 6 modules)
355 | - **Documentation Files**: 6
356 | - **Scripts**: 2
357 | - **Configuration Templates**: 2
358 | - **Tests**: 1
359 | 
360 | ## 🔐 Security-Sensitive Files
361 | 
362 | **Never Commit to Git:**
363 | - `terraform.tfvars` (contains credentials)
364 | - `*.pem` (SSH keys)
365 | - `*.key` (TLS private keys)
366 | - `.env` (environment variables)
367 | 
368 | **Encrypted Storage:**
369 | - ElevenLabs credentials → Parameter Store (AWS)
370 | - SIP passwords → Parameter Store (AWS)
371 | - TLS certificates → S3 with encryption
372 | 
373 | ## 🔄 Update Frequency
374 | 
375 | | File | Update Frequency | Reason |
376 | |------|-----------------|--------|
377 | | `terraform/*.tf` | Quarterly | AWS provider updates |
378 | | `scripts/user-data.sh` | As needed | Asterisk version updates |
379 | | `config/*.j2` | As needed | Configuration changes |
380 | | `docs/*.md` | Monthly | Documentation improvements |
381 | | `tests/*.py` | As needed | New test scenarios |
382 | 
383 | ## 📞 Support
384 | 
385 | For questions about specific files:
386 | 1. Check file header comments
387 | 2. Review related documentation
388 | 3. Consult [TROUBLESHOOTING.md](docs/TROUBLESHOOTING.md)
389 | 4. Create issue in project repository
390 | 
391 | ---
392 | 
393 | **Last Updated**: 2025-10-01  
394 | **Project Version**: 1.0.0  
395 | **Maintained By**: MCP Project Orchestrator
396 | 
```

--------------------------------------------------------------------------------
/scripts/consolidate_templates.py:
--------------------------------------------------------------------------------

```python
  1 | #!/usr/bin/env python3
  2 | """
  3 | Template Consolidation Script for MCP Project Orchestrator.
  4 | 
  5 | This script consolidates project and component templates from various sources into a standardized format
  6 | and stores them in the target project's templates directory.
  7 | 
  8 | Sources:
  9 | 1. /home/sparrow/projects/mcp-servers/src/templates (if exists)
 10 | 2. /home/sparrow/projects/mcp-project-orchestrator/component_templates.json
 11 | 3. /home/sparrow/projects/mcp-prompts-template/templates (if exists)
 12 | 4. /home/sparrow/mcp/data/templates (if exists)
 13 | 
 14 | Target:
 15 | /home/sparrow/projects/mcp-project-orchestrator/src/mcp_project_orchestrator/templates
 16 | """
 17 | 
 18 | import os
 19 | import sys
 20 | import json
 21 | import shutil
 22 | from pathlib import Path
 23 | from typing import Dict, Any, List, Optional
 24 | 
 25 | 
 26 | # Source directories and files
 27 | SOURCES = [
 28 |     Path("/home/sparrow/projects/mcp-servers/src/templates"),
 29 |     Path("/home/sparrow/projects/mcp-project-orchestrator/component_templates.json"),
 30 |     Path("/home/sparrow/projects/mcp-prompts-template/templates"),
 31 |     Path("/home/sparrow/mcp/data/templates")
 32 | ]
 33 | 
 34 | # Target directory
 35 | TARGET = Path("/home/sparrow/projects/mcp-project-orchestrator/src/mcp_project_orchestrator/templates")
 36 | 
 37 | 
 38 | def ensure_target_directory():
 39 |     """Ensure the target directory exists with required subdirectories."""
 40 |     TARGET.mkdir(parents=True, exist_ok=True)
 41 |     (TARGET / "project").mkdir(exist_ok=True)
 42 |     (TARGET / "component").mkdir(exist_ok=True)
 43 | 
 44 | 
 45 | def get_template_files(source_dir: Path) -> List[Path]:
 46 |     """Get all template files from a source directory."""
 47 |     if not source_dir.exists():
 48 |         print(f"Source directory does not exist: {source_dir}")
 49 |         return []
 50 |         
 51 |     # Look for JSON files
 52 |     json_files = list(source_dir.glob("**/*.json"))
 53 |     
 54 |     # Look for YAML/YML files
 55 |     yaml_files = list(source_dir.glob("**/*.yaml")) + list(source_dir.glob("**/*.yml"))
 56 |     
 57 |     return json_files + yaml_files
 58 | 
 59 | 
 60 | def extract_component_templates(file_path: Path) -> List[Dict[str, Any]]:
 61 |     """Extract component templates from a component_templates.json file."""
 62 |     templates = []
 63 |     
 64 |     try:
 65 |         with open(file_path, 'r') as f:
 66 |             data = json.load(f)
 67 |             
 68 |         if file_path.name == "component_templates.json" and "component_templates" in data:
 69 |             # Process each component template
 70 |             for component in data["component_templates"]:
 71 |                 # Create a standardized template
 72 |                 template = {
 73 |                     "name": component["name"],
 74 |                     "description": component.get("description", ""),
 75 |                     "type": "component",
 76 |                     "files": component.get("files", []),
 77 |                     "dependencies": component.get("dependencies", []),
 78 |                     "variables": component.get("variables", {}),
 79 |                     "metadata": {
 80 |                         "source": str(file_path),
 81 |                         "imported": True
 82 |                     }
 83 |                 }
 84 |                 
 85 |                 # Include mermaid diagram if present
 86 |                 if "mermaid" in component and component["mermaid"]:
 87 |                     template["mermaid"] = component["mermaid"]
 88 |                     
 89 |                 templates.append(template)
 90 |     
 91 |     except Exception as e:
 92 |         print(f"Error extracting component templates from {file_path}: {str(e)}")
 93 |     
 94 |     return templates
 95 | 
 96 | 
 97 | def extract_project_template(file_path: Path) -> Optional[Dict[str, Any]]:
 98 |     """Extract a project template from a file."""
 99 |     try:
100 |         with open(file_path, 'r') as f:
101 |             if file_path.suffix == '.json':
102 |                 data = json.load(f)
103 |             else:
104 |                 # For simplicity, treat other files as JSON for now
105 |                 # In a real implementation, add YAML parsing for .yaml/.yml files
106 |                 data = json.load(f)
107 |                 
108 |         # Determine if this is a project template
109 |         if "type" in data and data["type"] == "project":
110 |             return data
111 |             
112 |         # Check if this follows project template structure
113 |         if "name" in data and "structure" in data:
114 |             # Create a standardized template
115 |             template = {
116 |                 "name": data["name"],
117 |                 "description": data.get("description", ""),
118 |                 "type": "project",
119 |                 "structure": data["structure"],
120 |                 "variables": data.get("variables", {}),
121 |                 "scripts": data.get("scripts", []),
122 |                 "metadata": {
123 |                     "source": str(file_path),
124 |                     "imported": True
125 |                 }
126 |             }
127 |             
128 |             return template
129 |                 
130 |     except Exception as e:
131 |         print(f"Error extracting project template from {file_path}: {str(e)}")
132 |         
133 |     return None
134 | 
135 | 
136 | def normalize_component_template(template: Dict[str, Any]) -> Dict[str, Any]:
137 |     """Normalize a component template to the standard format."""
138 |     # Create standardized template structure
139 |     normalized = {
140 |         "name": template["name"],
141 |         "description": template.get("description", ""),
142 |         "type": "component",
143 |         "files": template.get("files", []),
144 |         "dependencies": template.get("dependencies", []),
145 |         "variables": template.get("variables", {}),
146 |         "version": template.get("version", {
147 |             "major": 1,
148 |             "minor": 0,
149 |             "patch": 0
150 |         }),
151 |         "metadata": template.get("metadata", {
152 |             "imported": True
153 |         })
154 |     }
155 |     
156 |     # Include mermaid diagram if present
157 |     if "mermaid" in template:
158 |         normalized["mermaid"] = template["mermaid"]
159 |     
160 |     return normalized
161 | 
162 | 
163 | def normalize_project_template(template: Dict[str, Any]) -> Dict[str, Any]:
164 |     """Normalize a project template to the standard format."""
165 |     # Create standardized template structure
166 |     normalized = {
167 |         "name": template["name"],
168 |         "description": template.get("description", ""),
169 |         "type": "project",
170 |         "structure": template.get("structure", []),
171 |         "variables": template.get("variables", {}),
172 |         "scripts": template.get("scripts", []),
173 |         "version": template.get("version", {
174 |             "major": 1,
175 |             "minor": 0,
176 |             "patch": 0
177 |         }),
178 |         "metadata": template.get("metadata", {
179 |             "imported": True
180 |         })
181 |     }
182 |     
183 |     return normalized
184 | 
185 | 
186 | def save_template(template: Dict[str, Any]):
187 |     """Save a normalized template to the target directory."""
188 |     name = template["name"]
189 |     template_type = template["type"]
190 |     
191 |     # Generate safe filename
192 |     safe_name = "".join(c if c.isalnum() or c in "-_" else "_" for c in name)
193 |     
194 |     # Save to both the main directory and the type-specific directory
195 |     for save_path in [TARGET / f"{safe_name}.json", TARGET / template_type / f"{safe_name}.json"]:
196 |         with open(save_path, 'w') as f:
197 |             json.dump(template, f, indent=2)
198 |             
199 |     return safe_name
200 | 
201 | 
202 | def process_all_sources():
203 |     """Process all source files and consolidate templates."""
204 |     ensure_target_directory()
205 |     
206 |     # Track processed templates by name and type
207 |     processed = {
208 |         "component": {},
209 |         "project": {}
210 |     }
211 |     
212 |     # Process each source
213 |     for source in SOURCES:
214 |         print(f"Processing source: {source}")
215 |         
216 |         if source.is_file() and source.suffix == '.json':
217 |             # Handle component templates JSON file
218 |             if source.name == "component_templates.json":
219 |                 templates = extract_component_templates(source)
220 |                 for template in templates:
221 |                     name = template["name"]
222 |                     if name in processed["component"]:
223 |                         print(f"  Skipping duplicate component template: {name}")
224 |                         continue
225 |                     
226 |                     normalized = normalize_component_template(template)
227 |                     safe_name = save_template(normalized)
228 |                     processed["component"][name] = safe_name
229 |                     print(f"  Processed component template: {name} -> {safe_name}.json")
230 |         
231 |         elif source.is_dir():
232 |             # Handle directories
233 |             template_files = get_template_files(source)
234 |             
235 |             for file_path in template_files:
236 |                 # Try to extract as project template first
237 |                 project_template = extract_project_template(file_path)
238 |                 
239 |                 if project_template:
240 |                     name = project_template["name"]
241 |                     if name in processed["project"]:
242 |                         print(f"  Skipping duplicate project template: {name}")
243 |                         continue
244 |                     
245 |                     normalized = normalize_project_template(project_template)
246 |                     safe_name = save_template(normalized)
247 |                     processed["project"][name] = safe_name
248 |                     print(f"  Processed project template: {name} -> {safe_name}.json")
249 |                 
250 |                 # If not a project template, check if it has component templates
251 |                 elif file_path.suffix == '.json':
252 |                     try:
253 |                         with open(file_path, 'r') as f:
254 |                             data = json.load(f)
255 |                             
256 |                         # Check if this contains component templates
257 |                         if "component_templates" in data:
258 |                             for component in data["component_templates"]:
259 |                                 template = {
260 |                                     "name": component["name"],
261 |                                     "description": component.get("description", ""),
262 |                                     "type": "component",
263 |                                     "files": component.get("files", []),
264 |                                     "dependencies": component.get("dependencies", []),
265 |                                     "variables": component.get("variables", {}),
266 |                                     "metadata": {
267 |                                         "source": str(file_path),
268 |                                         "imported": True
269 |                                     }
270 |                                 }
271 |                                 
272 |                                 # Include mermaid diagram if present
273 |                                 if "mermaid" in component and component["mermaid"]:
274 |                                     template["mermaid"] = component["mermaid"]
275 |                                 
276 |                                 name = template["name"]
277 |                                 if name in processed["component"]:
278 |                                     print(f"  Skipping duplicate component template: {name}")
279 |                                     continue
280 |                                 
281 |                                 normalized = normalize_component_template(template)
282 |                                 safe_name = save_template(normalized)
283 |                                 processed["component"][name] = safe_name
284 |                                 print(f"  Processed component template: {name} -> {safe_name}.json")
285 |                     
286 |                     except Exception as e:
287 |                         print(f"Error processing file {file_path}: {str(e)}")
288 |     
289 |     # Generate an index file
290 |     index = {
291 |         "component_templates": {
292 |             "templates": list(processed["component"].keys()),
293 |             "count": len(processed["component"])
294 |         },
295 |         "project_templates": {
296 |             "templates": list(processed["project"].keys()),
297 |             "count": len(processed["project"])
298 |         }
299 |     }
300 |     
301 |     # Save index file
302 |     with open(TARGET / "index.json", 'w') as f:
303 |         json.dump(index, f, indent=2)
304 |     
305 |     print(f"\nConsolidation complete.")
306 |     print(f"Component templates: {len(processed['component'])}")
307 |     print(f"Project templates: {len(processed['project'])}")
308 | 
309 | 
310 | if __name__ == "__main__":
311 |     process_all_sources() 
```

--------------------------------------------------------------------------------
/.github/workflows/ci-cd.yml:
--------------------------------------------------------------------------------

```yaml
  1 | name: CI/CD Pipeline
  2 | 
  3 | on:
  4 |   push:
  5 |     branches: [ main ]
  6 |     tags:
  7 |       - 'v*'
  8 |   pull_request:
  9 |     branches: [ main ]
 10 |   workflow_dispatch:
 11 |     inputs:
 12 |       deploy:
 13 |         description: 'Deploy to production'
 14 |         required: false
 15 |         default: false
 16 |         type: boolean
 17 | 
 18 | jobs:
 19 |   lint:
 20 |     name: Lint Code
 21 |     runs-on: ubuntu-latest
 22 |     steps:
 23 |       - uses: actions/checkout@v4
 24 |       - name: Set up Python
 25 |         uses: actions/setup-python@v4
 26 |         with:
 27 |           python-version: '3.12'
 28 |       - name: Install dependencies
 29 |         run: |
 30 |           python -m pip install --upgrade pip
 31 |           pip install ruff mypy
 32 |           pip install -e .
 33 |       - name: Lint with ruff
 34 |         run: |
 35 |           ruff check .
 36 |       - name: Type check with mypy
 37 |         run: |
 38 |           mypy src/
 39 |       - name: Check for TODO markers
 40 |         run: |
 41 |           # Find TODO comments and report them
 42 |           TODOS=$(grep -r "TODO" --include="*.py" src/ || true)
 43 |           if [ -n "$TODOS" ]; then
 44 |             echo "::warning::Found TODO comments in code:"
 45 |             echo "$TODOS"
 46 |           fi
 47 | 
 48 |   test:
 49 |     name: Run Tests
 50 |     needs: lint
 51 |     runs-on: ubuntu-latest
 52 |     steps:
 53 |       - uses: actions/checkout@v4
 54 |       - name: Set up Python
 55 |         uses: actions/setup-python@v4
 56 |         with:
 57 |           python-version: '3.12'
 58 |       - name: Install dependencies
 59 |         run: |
 60 |           python -m pip install --upgrade pip
 61 |           pip install pytest pytest-cov
 62 |           pip install -e .
 63 |       - name: Test with pytest
 64 |         run: |
 65 |           pytest --cache-clear --cov=src/ --cov-report=xml
 66 |       - name: Upload coverage report
 67 |         uses: codecov/codecov-action@v3
 68 |         with:
 69 |           file: ./coverage.xml
 70 |       - name: Verify environment
 71 |         run: |
 72 |           # Run the environment verification script
 73 |           python scripts/verify_environment.py
 74 | 
 75 |   update-changelog:
 76 |     name: Update Changelog
 77 |     runs-on: ubuntu-latest
 78 |     if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
 79 |     steps:
 80 |       - uses: actions/checkout@v4
 81 |         with:
 82 |           fetch-depth: 0  # Fetch all history for changelog generation
 83 |       - name: Set up Python
 84 |         uses: actions/setup-python@v4
 85 |         with:
 86 |           python-version: '3.12'
 87 |       - name: Update changelog
 88 |         run: |
 89 |           python scripts/update_changelog.py
 90 |       - name: Commit updated changelog
 91 |         if: github.ref == 'refs/heads/main'
 92 |         run: |
 93 |           if git diff --name-only | grep -q "CHANGELOG.md"; then
 94 |             git config --local user.email "action@github.com"
 95 |             git config --local user.name "GitHub Action"
 96 |             git add CHANGELOG.md
 97 |             git commit -m "Update CHANGELOG.md [skip ci]"
 98 |             git push
 99 |           else
100 |             echo "No changes to CHANGELOG.md"
101 |           fi
102 | 
103 |   build:
104 |     name: Build Container
105 |     needs: test
106 |     runs-on: ubuntu-latest
107 |     steps:
108 |       - uses: actions/checkout@v4
109 |       - name: Set up Docker
110 |         uses: docker/setup-buildx-action@v3
111 |       - name: Cache Docker layers
112 |         uses: actions/cache@v3
113 |         with:
114 |           path: /tmp/.buildx-cache
115 |           key: ${{ runner.os }}-buildx-${{ github.sha }}
116 |           restore-keys: |
117 |             ${{ runner.os }}-buildx-
118 |       - name: Build container image
119 |         uses: docker/build-push-action@v5
120 |         with:
121 |           context: .
122 |           file: ./Containerfile
123 |           push: false
124 |           tags: mcp-project-orchestrator:${{ github.sha }}
125 |           cache-from: type=local,src=/tmp/.buildx-cache
126 |           cache-to: type=local,dest=/tmp/.buildx-cache-new
127 |           outputs: type=docker,dest=/tmp/mcp-image.tar
128 |       - name: Move cache
129 |         run: |
130 |           rm -rf /tmp/.buildx-cache
131 |           mv /tmp/.buildx-cache-new /tmp/.buildx-cache
132 |       - name: Upload image artifact
133 |         uses: actions/upload-artifact@v3
134 |         with:
135 |           name: container-image
136 |           path: /tmp/mcp-image.tar
137 |           retention-days: 1
138 | 
139 |   mcp-inspect:
140 |     name: Test MCP Server
141 |     needs: build
142 |     runs-on: ubuntu-latest
143 |     steps:
144 |       - uses: actions/checkout@v4
145 |       - name: Set up Node.js
146 |         uses: actions/setup-node@v3
147 |         with:
148 |           node-version: '18'
149 |       - name: Set up Docker
150 |         uses: docker/setup-buildx-action@v3
151 |       - name: Download container image
152 |         uses: actions/download-artifact@v3
153 |         with:
154 |           name: container-image
155 |           path: /tmp
156 |       - name: Load container image
157 |         run: |
158 |           docker load -i /tmp/mcp-image.tar
159 |       - name: Run MCP Server
160 |         run: |
161 |           docker run -d -p 8080:8080 \
162 |             -v ${{ github.workspace }}:/app \
163 |             --workdir /app \
164 |             --entrypoint python \
165 |             --name mcp-server \
166 |             mcp-project-orchestrator:${{ github.sha }} \
167 |             -m mcp_project_orchestrator.fastmcp
168 |       - name: Install MCP Inspector
169 |         run: |
170 |           npm install -g @modelcontextprotocol/inspector
171 |       - name: Wait for server to start
172 |         run: sleep 5
173 |       - name: Test with MCP Inspector
174 |         run: |
175 |           # Basic connectivity test
176 |           npx @modelcontextprotocol/inspector http://localhost:8080
177 |           
178 |           # Validation test
179 |           npx @modelcontextprotocol/inspector http://localhost:8080 --validate
180 |           
181 |           # Try interactive mode but exit immediately (for testing connectivity)
182 |           echo "exit" | npx @modelcontextprotocol/inspector http://localhost:8080 --interactive || true
183 |       - name: Stop MCP Server
184 |         run: |
185 |           docker stop mcp-server
186 |           docker rm mcp-server
187 | 
188 |   publish:
189 |     name: Publish Container
190 |     if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v'))
191 |     needs: [mcp-inspect, update-changelog]
192 |     runs-on: ubuntu-latest
193 |     steps:
194 |       - name: Download container image
195 |         uses: actions/download-artifact@v3
196 |         with:
197 |           name: container-image
198 |           path: /tmp
199 |       - name: Set up Docker
200 |         uses: docker/setup-buildx-action@v3
201 |       - name: Load container image
202 |         run: |
203 |           docker load -i /tmp/mcp-image.tar
204 |       - name: Extract version for tags
205 |         id: get_version
206 |         run: |
207 |           if [[ $GITHUB_REF == refs/tags/v* ]]; then
208 |             VERSION=${GITHUB_REF#refs/tags/v}
209 |             echo "version=$VERSION" >> $GITHUB_OUTPUT
210 |             echo "Using tag version: $VERSION"
211 |           else
212 |             echo "version=latest" >> $GITHUB_OUTPUT
213 |             echo "Using latest version"
214 |           fi
215 |       - name: Tag container image
216 |         run: |
217 |           if [[ "${{ steps.get_version.outputs.version }}" == "latest" ]]; then
218 |             docker tag mcp-project-orchestrator:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/mcp-project-orchestrator:latest
219 |             docker tag mcp-project-orchestrator:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/mcp-project-orchestrator:${{ github.sha }}
220 |           else
221 |             docker tag mcp-project-orchestrator:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/mcp-project-orchestrator:${{ steps.get_version.outputs.version }}
222 |             docker tag mcp-project-orchestrator:${{ github.sha }} ghcr.io/${{ github.repository_owner }}/mcp-project-orchestrator:latest
223 |           fi
224 |       - name: Login to GitHub Container Registry
225 |         uses: docker/login-action@v3
226 |         with:
227 |           registry: ghcr.io
228 |           username: ${{ github.actor }}
229 |           password: ${{ secrets.GITHUB_TOKEN }}
230 |       - name: Push container image
231 |         run: |
232 |           if [[ "${{ steps.get_version.outputs.version }}" == "latest" ]]; then
233 |             docker push ghcr.io/${{ github.repository_owner }}/mcp-project-orchestrator:latest
234 |             docker push ghcr.io/${{ github.repository_owner }}/mcp-project-orchestrator:${{ github.sha }}
235 |           else
236 |             docker push ghcr.io/${{ github.repository_owner }}/mcp-project-orchestrator:${{ steps.get_version.outputs.version }}
237 |             docker push ghcr.io/${{ github.repository_owner }}/mcp-project-orchestrator:latest
238 |           fi
239 | 
240 |   deploy:
241 |     name: Deploy to Production
242 |     if: (github.event_name == 'push' && github.ref == 'refs/heads/main' && github.event.inputs.deploy == 'true') || startsWith(github.ref, 'refs/tags/v')
243 |     needs: publish
244 |     runs-on: ubuntu-latest
245 |     steps:
246 |       - name: Deploy to production
247 |         run: |
248 |           echo "Deploying to production environment"
249 |           # Add deployment steps here, such as:
250 |           # - SSH into server
251 |           # - Pull latest container image
252 |           # - Restart services
253 |       - name: Create GitHub Release
254 |         if: startsWith(github.ref, 'refs/tags/v')
255 |         uses: actions/checkout@v4
256 |         with:
257 |           fetch-depth: 0
258 |       - name: Generate Release Notes
259 |         if: startsWith(github.ref, 'refs/tags/v')
260 |         id: generate_notes
261 |         run: |
262 |           VERSION=${GITHUB_REF#refs/tags/}
263 |           # Extract the relevant section from CHANGELOG.md
264 |           NOTES=$(awk -v ver="$VERSION" 'BEGIN{p=0} $0 ~ "^## \\[" ver "\\]" {p=1;next} $0 ~ "^## \\[" {p=0} p' CHANGELOG.md)
265 |           echo "RELEASE_NOTES<<EOF" >> $GITHUB_ENV
266 |           echo "$NOTES" >> $GITHUB_ENV
267 |           echo "EOF" >> $GITHUB_ENV
268 |       - name: Create Release
269 |         if: startsWith(github.ref, 'refs/tags/v')
270 |         uses: softprops/action-gh-release@v1
271 |         with:
272 |           body: ${{ env.RELEASE_NOTES }}
273 |           draft: false
274 |           prerelease: false
275 |         env:
276 |           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
277 | 
278 |   # Add a new job for Podman testing (if CI system supports it)
279 |   podman-test:
280 |     name: Test with Podman
281 |     if: false  # Disabled by default - enable if your CI runners support Podman
282 |     needs: build
283 |     runs-on: ubuntu-latest
284 |     steps:
285 |       - uses: actions/checkout@v3
286 |       - name: Install Podman
287 |         run: |
288 |           sudo apt-get update
289 |           sudo apt-get install -y podman
290 |       - name: Build with Podman
291 |         run: |
292 |           podman build -t mcp-project-orchestrator:${{ github.sha }} -f Containerfile .
293 |       - name: Run with Podman
294 |         run: |
295 |           podman run -d --rm -p 8080:8080 \
296 |             -v ${{ github.workspace }}:/app:Z \
297 |             --workdir /app \
298 |             --entrypoint python \
299 |             localhost/mcp-project-orchestrator:${{ github.sha }} \
300 |             -m mcp_project_orchestrator.fastmcp
301 |       - name: Set up Node.js
302 |         uses: actions/setup-node@v3
303 |         with:
304 |           node-version: '18'
305 |       - name: Install MCP Inspector
306 |         run: |
307 |           npm install -g @modelcontextprotocol/inspector
308 |       - name: Wait for server to start
309 |         run: sleep 5
310 |       - name: Test with MCP Inspector under Podman
311 |         run: |
312 |           npx @modelcontextprotocol/inspector http://localhost:8080
313 |       - name: Stop Podman containers
314 |         run: |
315 |           podman stop --all
316 | 
317 |   # Add a manual validation job that can be triggered separately
318 |   manual-mcp-validate:
319 |     name: Manual MCP Validation
320 |     if: github.event_name == 'workflow_dispatch'
321 |     needs: build
322 |     runs-on: ubuntu-latest
323 |     steps:
324 |       - uses: actions/checkout@v3
325 |       - name: Set up Node.js
326 |         uses: actions/setup-node@v3
327 |         with:
328 |           node-version: '18'
329 |       - name: Set up Docker
330 |         uses: docker/setup-buildx-action@v2
331 |       - name: Download container image
332 |         uses: actions/download-artifact@v3
333 |         with:
334 |           name: container-image
335 |       - name: Load container image
336 |         run: |
337 |           docker load -i mcp-project-orchestrator-image.tar
338 |       - name: Run MCP Server
339 |         run: |
340 |           docker run -d -p 8080:8080 \
341 |             -v ${{ github.workspace }}:/app \
342 |             --workdir /app \
343 |             --entrypoint python \
344 |             --name mcp-server \
345 |             mcp-project-orchestrator:${{ github.sha }} \
346 |             -m mcp_project_orchestrator.fastmcp
347 |       - name: Install MCP Inspector
348 |         run: |
349 |           npm install -g @modelcontextprotocol/inspector
350 |       - name: Wait for server to start
351 |         run: sleep 5
352 |       - name: Comprehensive MCP Validation
353 |         run: |
354 |           # Basic connection test
355 |           npx @modelcontextprotocol/inspector http://localhost:8080
356 |           
357 |           # Validation test
358 |           npx @modelcontextprotocol/inspector http://localhost:8080 --validate
359 |           
360 |           # Check server details with verbose output
361 |           npx @modelcontextprotocol/inspector http://localhost:8080 --verbose
362 |       - name: Stop MCP Server
363 |         run: |
364 |           docker stop mcp-server
365 |           docker rm mcp-server 
```

--------------------------------------------------------------------------------
/scripts/test_mcp.sh:
--------------------------------------------------------------------------------

```bash
  1 | #!/bin/bash
  2 | # MCP Project Orchestrator - Unified Testing Script
  3 | # Consolidates multiple testing scripts for easier testing
  4 | 
  5 | set -e
  6 | 
  7 | # Color definitions
  8 | COLOR_GREEN='\033[0;32m'
  9 | COLOR_YELLOW='\033[0;33m'
 10 | COLOR_RED='\033[0;31m'
 11 | COLOR_RESET='\033[0m'
 12 | 
 13 | # Get script and project directory
 14 | SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
 15 | PROJECT_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
 16 | MCP_DATA_DIR="/home/sparrow/mcp/data"
 17 | CLAUDE_CONFIG_DIR="$HOME/.config/Claude"
 18 | CLAUDE_LOG_DIR="$CLAUDE_CONFIG_DIR/logs"
 19 | 
 20 | # Default values
 21 | CONTAINER_ENGINE="docker"
 22 | TEST_TYPE=""
 23 | INTERACTIVE=false
 24 | SKIP_DB_INIT=false
 25 | CLAUDE_DESKTOP_BIN="$HOME/bin/run-claude.sh"
 26 | 
 27 | # Function to display help message
 28 | display_help() {
 29 |   echo "MCP Project Orchestrator - Unified Testing Script"
 30 |   echo
 31 |   echo "Usage: $0 [options]"
 32 |   echo
 33 |   echo "Options:"
 34 |   echo "  --basic            Run basic MCP server tests"
 35 |   echo "  --claude-desktop   Test Claude Desktop integration"
 36 |   echo "  --docker           Use Docker for container operations (default)"
 37 |   echo "  --podman           Use Podman for container operations"
 38 |   echo "  --interactive      Run in interactive mode"
 39 |   echo "  --skip-db-init     Skip database initialization"
 40 |   echo "  --help             Display this help message"
 41 |   echo
 42 | }
 43 | 
 44 | # Process command line arguments
 45 | while [[ $# -gt 0 ]]; do
 46 |   case "$1" in
 47 |     --basic)
 48 |       TEST_TYPE="basic"
 49 |       shift
 50 |       ;;
 51 |     --claude-desktop)
 52 |       TEST_TYPE="claude-desktop"
 53 |       shift
 54 |       ;;
 55 |     --docker)
 56 |       CONTAINER_ENGINE="docker"
 57 |       shift
 58 |       ;;
 59 |     --podman)
 60 |       CONTAINER_ENGINE="podman"
 61 |       shift
 62 |       ;;
 63 |     --interactive)
 64 |       INTERACTIVE=true
 65 |       shift
 66 |       ;;
 67 |     --skip-db-init)
 68 |       SKIP_DB_INIT=true
 69 |       shift
 70 |       ;;
 71 |     --help)
 72 |       display_help
 73 |       exit 0
 74 |       ;;
 75 |     *)
 76 |       echo -e "${COLOR_RED}Unknown option: $1${COLOR_RESET}"
 77 |       display_help
 78 |       exit 1
 79 |       ;;
 80 |   esac
 81 | done
 82 | 
 83 | # If no test type specified, ask the user
 84 | if [ -z "$TEST_TYPE" ]; then
 85 |   echo "Please select test type:"
 86 |   echo "1) Basic MCP server tests"
 87 |   echo "2) Claude Desktop integration tests"
 88 |   echo "3) Exit"
 89 |   
 90 |   read -p "Enter your choice (1-3): " choice
 91 |   
 92 |   case "$choice" in
 93 |     1)
 94 |       TEST_TYPE="basic"
 95 |       ;;
 96 |     2)
 97 |       TEST_TYPE="claude-desktop"
 98 |       ;;
 99 |     3)
100 |       echo "Exiting..."
101 |       exit 0
102 |       ;;
103 |     *)
104 |       echo -e "${COLOR_RED}Invalid choice. Exiting.${COLOR_RESET}"
105 |       exit 1
106 |       ;;
107 |   esac
108 | fi
109 | 
110 | # Function to check if container is running
111 | check_container_running() {
112 |   local container_name="$1"
113 |   if $CONTAINER_ENGINE ps --filter "name=$container_name" --format "{{.Names}}" | grep -q "$container_name"; then
114 |     echo -e "${COLOR_GREEN}✅ Container '$container_name' is running${COLOR_RESET}"
115 |     return 0
116 |   else
117 |     echo -e "${COLOR_RED}❌ Container '$container_name' is NOT running${COLOR_RESET}"
118 |     return 1
119 |   fi
120 | }
121 | 
122 | # Function to clean up existing containers
123 | cleanup_containers() {
124 |   echo -e "${COLOR_GREEN}Cleaning up existing containers...${COLOR_RESET}"
125 |   
126 |   # List of containers to clean up
127 |   containers=(
128 |     "mcp-postgres-db-container"
129 |     "pgai-vectorizer-worker"
130 |     "mcp-prompt-manager-py"
131 |     "mcp-prompts-sse"
132 |     "mcp-prompts-stdio"
133 |     "mcp-postgres-server"
134 |     "mcp-server"
135 |   )
136 |   
137 |   for container in "${containers[@]}"; do
138 |     echo "Stopping and removing container: $container"
139 |     $CONTAINER_ENGINE stop "$container" 2>/dev/null || true
140 |     $CONTAINER_ENGINE rm "$container" 2>/dev/null || true
141 |   done
142 | }
143 | 
144 | # Function to initialize PostgreSQL
145 | initialize_postgres() {
146 |   if [ "$SKIP_DB_INIT" = true ]; then
147 |     echo -e "${COLOR_YELLOW}Skipping PostgreSQL initialization as requested${COLOR_RESET}"
148 |     return 0
149 |   fi
150 |   
151 |   echo -e "${COLOR_GREEN}Initializing PostgreSQL...${COLOR_RESET}"
152 |   "$SCRIPT_DIR/setup_mcp.sh" --db-only
153 | }
154 | 
155 | # Function to check Claude Desktop logs
156 | check_claude_logs() {
157 |   echo -e "${COLOR_GREEN}Checking Claude Desktop logs...${COLOR_RESET}"
158 |   
159 |   if [ ! -d "$CLAUDE_LOG_DIR" ]; then
160 |     echo -e "${COLOR_YELLOW}No Claude Desktop logs found at $CLAUDE_LOG_DIR${COLOR_RESET}"
161 |     return 0
162 |   fi
163 |   
164 |   local error_count=$(grep -r "ERROR" "$CLAUDE_LOG_DIR" 2>/dev/null | wc -l)
165 |   
166 |   echo "Found $error_count ERROR entries in Claude Desktop logs"
167 |   if [ $error_count -gt 0 ]; then
168 |     echo -e "${COLOR_YELLOW}Most recent errors:${COLOR_RESET}"
169 |     grep -r "ERROR" "$CLAUDE_LOG_DIR" 2>/dev/null | tail -10
170 |   fi
171 |   
172 |   # Look for specific MCP server errors
173 |   echo -e "${COLOR_GREEN}Checking for specific MCP server errors:${COLOR_RESET}"
174 |   grep -r "prompt-manager-py" "$CLAUDE_LOG_DIR" 2>/dev/null | grep "ERROR" || echo "No prompt-manager-py errors"
175 |   grep -r "prompts-sse" "$CLAUDE_LOG_DIR" 2>/dev/null | grep "ERROR" || echo "No prompts-sse errors"
176 |   grep -r "prompts-stdio" "$CLAUDE_LOG_DIR" 2>/dev/null | grep "ERROR" || echo "No prompts-stdio errors"
177 |   grep -r "db" "$CLAUDE_LOG_DIR" 2>/dev/null | grep "ERROR" || echo "No db errors"
178 |   grep -r "project-orchestrator" "$CLAUDE_LOG_DIR" 2>/dev/null | grep "ERROR" || echo "No project-orchestrator errors"
179 |   
180 |   return 0
181 | }
182 | 
183 | # Function to run basic MCP server tests
184 | run_basic_tests() {
185 |   echo -e "${COLOR_GREEN}Running basic MCP server tests...${COLOR_RESET}"
186 |   
187 |   # Check if Node.js and npm are installed
188 |   if ! command -v npm &> /dev/null; then
189 |     echo -e "${COLOR_RED}Error: npm not found. Please install Node.js${COLOR_RESET}"
190 |     exit 1
191 |   fi
192 |   
193 |   # Build the container
194 |   echo -e "${COLOR_GREEN}Building container image...${COLOR_RESET}"
195 |   $CONTAINER_ENGINE build -t mcp-project-orchestrator:latest -f "$PROJECT_DIR/Containerfile" "$PROJECT_DIR"
196 |   
197 |   # Run the container with volume mounting
198 |   echo -e "${COLOR_GREEN}Starting MCP server with volume mounting...${COLOR_RESET}"
199 |   
200 |   VOLUME_OPTION=""
201 |   if [ "$CONTAINER_ENGINE" = "podman" ]; then
202 |     VOLUME_OPTION=":Z"
203 |     IMAGE_NAME="localhost/mcp-project-orchestrator:latest"
204 |   else
205 |     IMAGE_NAME="mcp-project-orchestrator:latest"
206 |   fi
207 |   
208 |   $CONTAINER_ENGINE run -d --rm -p 8080:8080 \
209 |     -v "$PROJECT_DIR:/app$VOLUME_OPTION" \
210 |     --workdir /app \
211 |     --entrypoint python \
212 |     --name mcp-server \
213 |     $IMAGE_NAME \
214 |     -m mcp_project_orchestrator.fastmcp
215 |   
216 |   # Wait for server to start
217 |   echo "Waiting for server to start..."
218 |   sleep 5
219 |   
220 |   # Verify the server is running
221 |   if ! $CONTAINER_ENGINE ps | grep -q mcp-server; then
222 |     echo -e "${COLOR_RED}Error: MCP server failed to start${COLOR_RESET}"
223 |     $CONTAINER_ENGINE logs mcp-server
224 |     exit 1
225 |   fi
226 |   
227 |   # Install MCP Inspector if needed
228 |   echo -e "${COLOR_GREEN}Setting up MCP Inspector...${COLOR_RESET}"
229 |   npm list -g @modelcontextprotocol/inspector &>/dev/null || npm install -g @modelcontextprotocol/inspector
230 |   
231 |   # Run basic test
232 |   echo -e "${COLOR_GREEN}Running basic connectivity test...${COLOR_RESET}"
233 |   npx @modelcontextprotocol/inspector http://localhost:8080 || { 
234 |     echo -e "${COLOR_RED}Basic test failed${COLOR_RESET}"; 
235 |     $CONTAINER_ENGINE stop mcp-server; 
236 |     exit 1; 
237 |   }
238 |   
239 |   # Run validation
240 |   echo -e "${COLOR_GREEN}Running validation test...${COLOR_RESET}"
241 |   npx @modelcontextprotocol/inspector http://localhost:8080 --validate || { 
242 |     echo -e "${COLOR_RED}Validation test failed${COLOR_RESET}"; 
243 |     $CONTAINER_ENGINE stop mcp-server; 
244 |     exit 1; 
245 |   }
246 |   
247 |   # Run interactive test if requested
248 |   if [ "$INTERACTIVE" = true ]; then
249 |     echo -e "${COLOR_GREEN}Running interactive test...${COLOR_RESET}"
250 |     npx @modelcontextprotocol/inspector http://localhost:8080 --interactive
251 |   fi
252 |   
253 |   # Stop the container
254 |   echo -e "${COLOR_GREEN}Tests completed successfully. Stopping container...${COLOR_RESET}"
255 |   $CONTAINER_ENGINE stop mcp-server
256 |   
257 |   echo -e "${COLOR_GREEN}All basic tests passed!${COLOR_RESET}"
258 | }
259 | 
260 | # Function to run Claude Desktop integration tests
261 | run_claude_desktop_tests() {
262 |   echo -e "${COLOR_GREEN}Running Claude Desktop integration tests...${COLOR_RESET}"
263 |   
264 |   # Kill Claude Desktop if running
265 |   echo "Killing Claude Desktop if running..."
266 |   pkill -f "Claude Desktop" || true
267 |   sleep 3  # Wait for Claude Desktop to fully terminate
268 |   
269 |   # Delete old logs
270 |   echo "Cleaning up old Claude Desktop logs..."
271 |   mkdir -p "$CLAUDE_LOG_DIR"
272 |   rm -rf "$CLAUDE_LOG_DIR"/*
273 |   
274 |   # Initialize PostgreSQL if not skipped
275 |   if [ "$SKIP_DB_INIT" = false ]; then
276 |     initialize_postgres
277 |   fi
278 |   
279 |   # Create a sample prompt template if directory is empty
280 |   if [ ! "$(ls -A $MCP_DATA_DIR/prompts)" ]; then
281 |     echo "Adding a sample prompt template..."
282 |     mkdir -p "$MCP_DATA_DIR/prompts"
283 |     cat > "$MCP_DATA_DIR/prompts/sample-template.json" << EOF
284 | {
285 |   "id": "sample-template",
286 |   "name": "Sample Template",
287 |   "description": "A sample prompt template",
288 |   "content": "This is a sample template with a {{variable}}",
289 |   "isTemplate": true,
290 |   "variables": ["variable"],
291 |   "tags": ["sample"],
292 |   "createdAt": "$(date -Iseconds)",
293 |   "updatedAt": "$(date -Iseconds)",
294 |   "version": 1
295 | }
296 | EOF
297 |   fi
298 |   
299 |   # Start prompt-manager-py container if available
300 |   echo "Checking for prompt-manager image..."
301 |   if $CONTAINER_ENGINE images | grep -q "prompt-manager"; then
302 |     echo "Starting prompt-manager-py container..."
303 |     $CONTAINER_ENGINE run -d --restart=on-failure:5 --network=host \
304 |       -v "$MCP_DATA_DIR/prompts:/data/prompts" \
305 |       --name mcp-prompt-manager-py \
306 |       -e MCP_PROMPT_MANAGER_NAME=prompt-manager-py \
307 |       -e MCP_PROMPT_MANAGER_LOG_LEVEL=debug \
308 |       -e MCP_PROMPT_MANAGER_TEMPLATE_DIR=/data/prompts/ \
309 |       -e MCP_PROMPT_MANAGER_PERSISTENCE=true \
310 |       -e MCP_PROMPT_MANAGER_PERSISTENCE_FILE=/data/prompts/prompt-templates.json \
311 |       -e PYTHONPATH=. \
312 |       -e MCP_PROMPT_MANAGER_STANDALONE=true \
313 |       prompt-manager:latest --storage-dir /data/prompts --standalone
314 |   else
315 |     echo -e "${COLOR_YELLOW}Warning: prompt-manager image not found. Skipping prompt-manager container.${COLOR_RESET}"
316 |   fi
317 |   
318 |   # Start prompts-sse container if available
319 |   echo "Checking for mcp-prompts image..."
320 |   if $CONTAINER_ENGINE images | grep -q "sparesparrow/mcp-prompts" || $CONTAINER_ENGINE images | grep -q "mcp-prompts"; then
321 |     echo "Starting prompts-sse container..."
322 |     $CONTAINER_ENGINE run -d --restart=on-failure:5 --network=host \
323 |       -v "$MCP_DATA_DIR/prompts:/app/prompts" \
324 |       -v "$MCP_DATA_DIR/backups:/app/backups" \
325 |       --name mcp-prompts-sse \
326 |       -e STORAGE_TYPE=postgres \
327 |       -e PROMPTS_DIR=/app/prompts \
328 |       -e BACKUPS_DIR=/app/backups \
329 |       -e HTTP_SERVER=true \
330 |       -e PORT=3003 \
331 |       -e HOST=0.0.0.0 \
332 |       -e ENABLE_SSE=true \
333 |       -e SSE_PORT=3003 \
334 |       -e SSE_PATH=/sse \
335 |       -e CORS_ORIGIN="*" \
336 |       -e DEBUG="mcp:*" \
337 |       -e POSTGRES_HOST=localhost \
338 |       -e POSTGRES_PORT=5432 \
339 |       -e POSTGRES_DATABASE=prompts \
340 |       -e POSTGRES_USER=postgres \
341 |       -e POSTGRES_PASSWORD=postgres \
342 |       sparesparrow/mcp-prompts:latest --sse --port=3003 --path=/sse
343 |   fi
344 |   
345 |   # Check if Claude Desktop launch script is available
346 |   if [ ! -f "$CLAUDE_DESKTOP_BIN" ]; then
347 |     echo -e "${COLOR_YELLOW}Warning: Claude Desktop binary not found at $CLAUDE_DESKTOP_BIN"
348 |     echo "Please provide the path to the Claude Desktop launch script:${COLOR_RESET}"
349 |     read -p "Claude Desktop path (leave empty to skip launch): " CLAUDE_PATH
350 |     
351 |     if [ -n "$CLAUDE_PATH" ]; then
352 |       CLAUDE_DESKTOP_BIN="$CLAUDE_PATH"
353 |     else
354 |       echo -e "${COLOR_YELLOW}Skipping Claude Desktop launch${COLOR_RESET}"
355 |       CLAUDE_DESKTOP_BIN=""
356 |     fi
357 |   fi
358 |   
359 |   # Launch Claude Desktop if binary is available
360 |   if [ -n "$CLAUDE_DESKTOP_BIN" ]; then
361 |     echo "Launching Claude Desktop..."
362 |     "$CLAUDE_DESKTOP_BIN" &
363 |     
364 |     echo "Waiting for Claude Desktop to initialize (60 seconds)..."
365 |     sleep 60
366 |     
367 |     echo "Stopping Claude Desktop..."
368 |     pkill -f "Claude Desktop" || true
369 |     sleep 5
370 |   fi
371 |   
372 |   # Check logs for errors
373 |   check_claude_logs
374 |   
375 |   # Check if all containers are running
376 |   echo -e "${COLOR_GREEN}Checking containers status...${COLOR_RESET}"
377 |   check_container_running "mcp-postgres-db-container" || echo -e "${COLOR_YELLOW}PostgreSQL container not running${COLOR_RESET}"
378 |   check_container_running "pgai-vectorizer-worker" || echo -e "${COLOR_YELLOW}Vectorizer worker not running (optional)${COLOR_RESET}"
379 |   check_container_running "mcp-postgres-server" || echo -e "${COLOR_YELLOW}Postgres server not running${COLOR_RESET}"
380 |   check_container_running "mcp-prompt-manager-py" || echo -e "${COLOR_YELLOW}Prompt manager not running${COLOR_RESET}"
381 |   check_container_running "mcp-prompts-sse" || echo -e "${COLOR_YELLOW}Prompts SSE not running${COLOR_RESET}"
382 |   
383 |   echo -e "${COLOR_GREEN}Claude Desktop tests completed!${COLOR_RESET}"
384 | }
385 | 
386 | # Main execution
387 | echo -e "${COLOR_GREEN}=== MCP Project Orchestrator Testing Script ===${COLOR_RESET}"
388 | echo "Using container engine: $CONTAINER_ENGINE"
389 | 
390 | # Clean up existing containers
391 | cleanup_containers
392 | 
393 | # Initialize PostgreSQL if needed (for basic tests)
394 | if [ "$TEST_TYPE" = "basic" ] && [ "$SKIP_DB_INIT" = false ]; then
395 |   initialize_postgres
396 | fi
397 | 
398 | # Run selected tests
399 | case "$TEST_TYPE" in
400 |   "basic")
401 |     run_basic_tests
402 |     ;;
403 |   "claude-desktop")
404 |     run_claude_desktop_tests
405 |     ;;
406 |   *)
407 |     echo -e "${COLOR_RED}Invalid test type: $TEST_TYPE${COLOR_RESET}"
408 |     exit 1
409 |     ;;
410 | esac
411 | 
412 | echo -e "${COLOR_GREEN}All tests completed successfully!${COLOR_RESET}" 
```

--------------------------------------------------------------------------------
/aws-sip-trunk/docs/TROUBLESHOOTING.md:
--------------------------------------------------------------------------------

```markdown
  1 | # AWS SIP Trunk Troubleshooting Guide
  2 | 
  3 | Comprehensive guide for diagnosing and resolving common issues with Asterisk SIP trunk deployment on AWS.
  4 | 
  5 | ## Quick Diagnostic Commands
  6 | 
  7 | ```bash
  8 | # Check Asterisk service status
  9 | sudo systemctl status asterisk
 10 | 
 11 | # Verify PJSIP endpoints
 12 | sudo asterisk -rx "pjsip show endpoints"
 13 | 
 14 | # Check transport configuration
 15 | sudo asterisk -rx "pjsip show transports"
 16 | 
 17 | # View active channels
 18 | sudo asterisk -rx "core show channels"
 19 | 
 20 | # Enable SIP debug logging
 21 | sudo asterisk -rx "pjsip set logger on"
 22 | 
 23 | # Check RTP configuration
 24 | sudo asterisk -rx "rtp show settings"
 25 | 
 26 | # View registration status
 27 | sudo asterisk -rx "pjsip show registrations"
 28 | 
 29 | # Network connectivity test
 30 | sudo tcpdump -i eth0 -n port 5060 or portrange 10000-20000
 31 | ```
 32 | 
 33 | ## Issue 1: One-Way Audio or No Audio
 34 | 
 35 | ### Symptoms
 36 | - Call connects but no audio heard
 37 | - Audio works in one direction only
 38 | - Caller hears nothing, or callee hears nothing
 39 | 
 40 | ### Root Causes
 41 | 1. **Security Group blocking RTP ports**
 42 | 2. **NAT configuration incorrect in pjsip.conf**
 43 | 3. **Firewall blocking UDP traffic**
 44 | 4. **Codec mismatch**
 45 | 
 46 | ### Diagnostic Steps
 47 | 
 48 | ```bash
 49 | # 1. Verify Security Group allows RTP
 50 | aws ec2 describe-security-groups \
 51 |   --group-ids $SG_ID \
 52 |   --query 'SecurityGroups[0].IpPermissions[?FromPort>=`10000` && ToPort<=`20000`]'
 53 | 
 54 | # 2. Check if RTP packets are flowing
 55 | sudo tcpdump -i eth0 -n udp portrange 10000-20000 -c 20
 56 | 
 57 | # 3. Verify NAT configuration
 58 | sudo asterisk -rx "pjsip show transport transport-tcp"
 59 | 
 60 | # 4. Check codec negotiation
 61 | sudo asterisk -rx "pjsip show endpoints" | grep -A 5 "elevenlabs"
 62 | ```
 63 | 
 64 | ### Solutions
 65 | 
 66 | **Solution A: Fix Security Group Rules**
 67 | ```bash
 68 | # Add RTP rule if missing
 69 | aws ec2 authorize-security-group-ingress \
 70 |   --group-id $SG_ID \
 71 |   --protocol udp \
 72 |   --port 10000-20000 \
 73 |   --cidr 0.0.0.0/0 \
 74 |   --region $AWS_REGION
 75 | ```
 76 | 
 77 | **Solution B: Fix NAT Configuration**
 78 | 
 79 | Edit `/etc/asterisk/pjsip.conf`:
 80 | ```ini
 81 | [transport-tcp]
 82 | type=transport
 83 | protocol=tcp
 84 | bind=0.0.0.0:5060
 85 | external_media_address=YOUR_ELASTIC_IP      # Must be public IP
 86 | external_signaling_address=YOUR_ELASTIC_IP  # Must be public IP
 87 | local_net=PRIVATE_IP/16                     # Your VPC CIDR
 88 | ```
 89 | 
 90 | Reload:
 91 | ```bash
 92 | sudo asterisk -rx "pjsip reload"
 93 | ```
 94 | 
 95 | **Solution C: Verify Codec Support**
 96 | 
 97 | Edit `/etc/asterisk/pjsip.conf`:
 98 | ```ini
 99 | [elevenlabs]
100 | type=endpoint
101 | allow=!all,ulaw,alaw  # Ensure these codecs are allowed
102 | ```
103 | 
104 | ## Issue 2: SIP Registration Failures
105 | 
106 | ### Symptoms
107 | - `pjsip show endpoints` shows "Unavailable"
108 | - Logs show "401 Unauthorized" or "403 Forbidden"
109 | - Cannot place calls
110 | 
111 | ### Root Causes
112 | 1. **Incorrect credentials**
113 | 2. **E.164 format issue**
114 | 3. **Network connectivity problem**
115 | 4. **ElevenLabs server unreachable**
116 | 
117 | ### Diagnostic Steps
118 | 
119 | ```bash
120 | # 1. Check endpoint status
121 | sudo asterisk -rx "pjsip show endpoint elevenlabs"
122 | 
123 | # 2. Test DNS resolution
124 | dig sip.elevenlabs.io
125 | 
126 | # 3. Test connectivity
127 | telnet sip.elevenlabs.io 5060
128 | 
129 | # 4. Check logs for auth errors
130 | sudo grep "401\|403\|Authentication" /var/log/asterisk/full | tail -20
131 | 
132 | # 5. Verify credentials in Parameter Store
133 | aws ssm get-parameter \
134 |   --name "/$PROJECT_NAME/elevenlabs/phone_e164" \
135 |   --with-decryption \
136 |   --query 'Parameter.Value' \
137 |   --output text
138 | ```
139 | 
140 | ### Solutions
141 | 
142 | **Solution A: Fix Credentials**
143 | 
144 | Update Parameter Store:
145 | ```bash
146 | aws ssm put-parameter \
147 |   --name "/$PROJECT_NAME/elevenlabs/sip_password" \
148 |   --value "NEW_PASSWORD" \
149 |   --type SecureString \
150 |   --overwrite
151 | ```
152 | 
153 | Update pjsip.conf:
154 | ```bash
155 | sudo vim /etc/asterisk/pjsip.conf
156 | # Update password in [elevenlabs-auth] section
157 | sudo asterisk -rx "pjsip reload"
158 | ```
159 | 
160 | **Solution B: Verify E.164 Format**
161 | 
162 | Ensure phone number is in correct format:
163 | - ✅ Correct: `+12025551234`
164 | - ❌ Wrong: `12025551234`, `+1 (202) 555-1234`
165 | 
166 | **Solution C: Enable Debug Logging**
167 | ```bash
168 | sudo asterisk -rx "pjsip set logger on"
169 | sudo tail -f /var/log/asterisk/full | grep -i "elevenlabs"
170 | ```
171 | 
172 | ## Issue 3: TCP Transport Not Enabling
173 | 
174 | ### Symptoms
175 | - TCP port 5060 not listening
176 | - Only UDP transport available
177 | - Cannot connect to ElevenLabs TCP endpoint
178 | 
179 | ### Root Cause
180 | TCP binding requires full system reboot, not just Asterisk reload
181 | 
182 | ### Diagnostic Steps
183 | 
184 | ```bash
185 | # Check listening ports
186 | sudo netstat -tulnp | grep 5060
187 | 
188 | # Expected output:
189 | # tcp  0  0.0.0.0:5060  0.0.0.0:*  LISTEN  asterisk
190 | # udp  0  0.0.0.0:5060  0.0.0.0:*         asterisk
191 | ```
192 | 
193 | ### Solution
194 | 
195 | **Full System Reboot Required**
196 | ```bash
197 | # Save any work
198 | sudo sync
199 | 
200 | # Reboot instance
201 | sudo reboot
202 | 
203 | # After reboot, verify
204 | sudo netstat -tulnp | grep 5060
205 | ```
206 | 
207 | **Alternative: Force Asterisk Restart**
208 | ```bash
209 | sudo systemctl stop asterisk
210 | sleep 5
211 | sudo systemctl start asterisk
212 | sudo netstat -tulnp | grep 5060
213 | ```
214 | 
215 | ## Issue 4: High CPU Usage
216 | 
217 | ### Symptoms
218 | - CPU utilization > 80%
219 | - CloudWatch alarm triggered
220 | - Asterisk becomes unresponsive
221 | 
222 | ### Root Causes
223 | 1. **SIP attack (brute force)**
224 | 2. **Too many concurrent calls**
225 | 3. **Codec transcoding overhead**
226 | 4. **Resource leak**
227 | 
228 | ### Diagnostic Steps
229 | 
230 | ```bash
231 | # 1. Check CPU usage
232 | top -b -n 1 | head -20
233 | 
234 | # 2. Check number of active channels
235 | sudo asterisk -rx "core show channels"
236 | 
237 | # 3. Check for attack patterns
238 | sudo grep "Failed to authenticate" /var/log/asterisk/full | wc -l
239 | 
240 | # 4. Check Fail2Ban status
241 | sudo fail2ban-client status asterisk
242 | 
243 | # 5. Memory usage
244 | free -h
245 | ```
246 | 
247 | ### Solutions
248 | 
249 | **Solution A: Enable/Verify Fail2Ban**
250 | ```bash
251 | # Check Fail2Ban status
252 | sudo systemctl status fail2ban
253 | 
254 | # View banned IPs
255 | sudo fail2ban-client status asterisk
256 | 
257 | # Manually ban IP
258 | sudo fail2ban-client set asterisk banip ATTACKER_IP
259 | ```
260 | 
261 | **Solution B: Optimize Asterisk Configuration**
262 | 
263 | Reduce unnecessary logging:
264 | ```bash
265 | sudo vim /etc/asterisk/logger.conf
266 | ```
267 | ```ini
268 | [logfiles]
269 | console => notice,warning,error  # Remove verbose,debug
270 | messages => notice,warning,error
271 | full => notice,warning,error     # Remove verbose
272 | ```
273 | 
274 | **Solution C: Limit Concurrent Calls**
275 | 
276 | Edit `/etc/asterisk/pjsip.conf`:
277 | ```ini
278 | [elevenlabs]
279 | type=endpoint
280 | max_audio_streams=10  # Limit concurrent calls
281 | ```
282 | 
283 | **Solution D: Disable Direct Media**
284 | ```ini
285 | [elevenlabs]
286 | type=endpoint
287 | direct_media=no  # Force RTP through Asterisk (better for NAT)
288 | ```
289 | 
290 | ## Issue 5: RTP Port Exhaustion
291 | 
292 | ### Symptoms
293 | - Calls fail after specific number of concurrent calls
294 | - "No RTP ports available" in logs
295 | - New calls cannot establish audio
296 | 
297 | ### Root Cause
298 | Default RTP port range too small for concurrent call volume
299 | 
300 | ### Solution
301 | 
302 | Edit `/etc/asterisk/rtp.conf`:
303 | ```ini
304 | [general]
305 | rtpstart=10000
306 | rtpend=20000  # Increase from default 10000-10100
307 | ```
308 | 
309 | Update Security Group:
310 | ```bash
311 | # Update to match new range
312 | aws ec2 authorize-security-group-ingress \
313 |   --group-id $SG_ID \
314 |   --protocol udp \
315 |   --port 10000-20000 \
316 |   --cidr 0.0.0.0/0
317 | ```
318 | 
319 | Reload Asterisk:
320 | ```bash
321 | sudo systemctl restart asterisk
322 | ```
323 | 
324 | ## Issue 6: Elastic IP Not Persisting After Reboot
325 | 
326 | ### Symptoms
327 | - After instance reboot, Elastic IP not associated
328 | - SIP endpoint unreachable
329 | - Public IP changed
330 | 
331 | ### Root Cause
332 | Elastic IP association lost during stop/start cycle
333 | 
334 | ### Solution
335 | 
336 | **Automatic Re-association Script**
337 | 
338 | Create `/usr/local/bin/associate-eip.sh`:
339 | ```bash
340 | #!/bin/bash
341 | INSTANCE_ID=$(ec2-metadata --instance-id | cut -d " " -f 2)
342 | AWS_REGION=$(ec2-metadata --availability-zone | cut -d " " -f 2 | sed 's/[a-z]$//')
343 | 
344 | # Get Elastic IP allocation ID
345 | ALLOCATION_ID=$(aws ec2 describe-addresses \
346 |   --region $AWS_REGION \
347 |   --filters "Name=tag:Project,Values=$PROJECT_NAME" \
348 |   --query 'Addresses[0].AllocationId' \
349 |   --output text)
350 | 
351 | # Associate EIP
352 | aws ec2 associate-address \
353 |   --instance-id $INSTANCE_ID \
354 |   --allocation-id $ALLOCATION_ID \
355 |   --region $AWS_REGION
356 | ```
357 | 
358 | Add to systemd:
359 | ```bash
360 | sudo cat > /etc/systemd/system/associate-eip.service <<EOF
361 | [Unit]
362 | Description=Associate Elastic IP on boot
363 | After=network.target
364 | 
365 | [Service]
366 | Type=oneshot
367 | ExecStart=/usr/local/bin/associate-eip.sh
368 | RemainAfterExit=yes
369 | 
370 | [Install]
371 | WantedBy=multi-user.target
372 | EOF
373 | 
374 | sudo systemctl enable associate-eip.service
375 | ```
376 | 
377 | ## Issue 7: CloudWatch Logs Not Appearing
378 | 
379 | ### Symptoms
380 | - Log group exists but no streams
381 | - Metrics not visible in CloudWatch
382 | - Alarms not triggering
383 | 
384 | ### Diagnostic Steps
385 | 
386 | ```bash
387 | # 1. Check CloudWatch agent status
388 | sudo systemctl status amazon-cloudwatch-agent
389 | 
390 | # 2. View agent logs
391 | sudo cat /opt/aws/amazon-cloudwatch-agent/logs/amazon-cloudwatch-agent.log
392 | 
393 | # 3. Verify IAM permissions
394 | aws iam get-role-policy \
395 |   --role-name $PROJECT_NAME-asterisk-role \
396 |   --policy-name $PROJECT_NAME-asterisk-policy
397 | ```
398 | 
399 | ### Solution
400 | 
401 | **Restart CloudWatch Agent**
402 | ```bash
403 | sudo systemctl restart amazon-cloudwatch-agent
404 | sudo systemctl status amazon-cloudwatch-agent
405 | ```
406 | 
407 | **Verify Log Group Permissions**
408 | ```bash
409 | # Check if log group exists
410 | aws logs describe-log-groups \
411 |   --log-group-name-prefix "/aws/ec2/$PROJECT_NAME"
412 | 
413 | # Create if missing
414 | aws logs create-log-group \
415 |   --log-group-name "/aws/ec2/$PROJECT_NAME/asterisk"
416 | ```
417 | 
418 | ## Issue 8: Call Quality Issues (Choppy Audio, Dropouts)
419 | 
420 | ### Symptoms
421 | - Audio cuts in and out
422 | - Robotic/choppy voice
423 | - High latency
424 | 
425 | ### Root Causes
426 | 1. **Network congestion**
427 | 2. **Insufficient bandwidth**
428 | 3. **Packet loss**
429 | 4. **Jitter**
430 | 
431 | ### Diagnostic Steps
432 | 
433 | ```bash
434 | # 1. Check network statistics
435 | sudo asterisk -rx "pjsip show channelstats"
436 | 
437 | # 2. Monitor RTP packets
438 | sudo tcpdump -i eth0 -n udp portrange 10000-20000 -vv
439 | 
440 | # 3. Check system performance
441 | vmstat 1 10
442 | iostat -x 1 10
443 | 
444 | # 4. Verify codec
445 | sudo asterisk -rx "core show channels verbose"
446 | ```
447 | 
448 | ### Solutions
449 | 
450 | **Solution A: QoS Configuration**
451 | 
452 | Enable QoS on instance:
453 | ```bash
454 | # Set TOS bits for RTP
455 | sudo sysctl -w net.ipv4.ip_default_ttl=64
456 | sudo sysctl -w net.ipv4.tcp_mtu_probing=1
457 | ```
458 | 
459 | **Solution B: Adjust Jitter Buffer**
460 | 
461 | Edit `/etc/asterisk/pjsip.conf`:
462 | ```ini
463 | [elevenlabs]
464 | type=endpoint
465 | use_ptime=yes
466 | allow=!all,ulaw  # Use only ulaw for consistency
467 | ```
468 | 
469 | **Solution C: Increase Instance Size**
470 | 
471 | If CPU > 60% during calls:
472 | ```bash
473 | # Stop instance
474 | aws ec2 stop-instances --instance-ids $INSTANCE_ID
475 | 
476 | # Change instance type
477 | aws ec2 modify-instance-attribute \
478 |   --instance-id $INSTANCE_ID \
479 |   --instance-type t3.large
480 | 
481 | # Start instance
482 | aws ec2 start-instances --instance-ids $INSTANCE_ID
483 | ```
484 | 
485 | ## Issue 9: Asterisk Won't Start After Reboot
486 | 
487 | ### Symptoms
488 | - `systemctl status asterisk` shows failed
489 | - No Asterisk processes running
490 | - Cannot access Asterisk CLI
491 | 
492 | ### Diagnostic Steps
493 | 
494 | ```bash
495 | # 1. Check service status
496 | sudo systemctl status asterisk -l
497 | 
498 | # 2. View Asterisk logs
499 | sudo cat /var/log/asterisk/full | tail -50
500 | 
501 | # 3. Check for configuration errors
502 | sudo asterisk -cvvvvv
503 | # Look for error messages during startup
504 | 
505 | # 4. Verify file permissions
506 | ls -la /etc/asterisk/
507 | ls -la /var/lib/asterisk/
508 | ```
509 | 
510 | ### Solutions
511 | 
512 | **Solution A: Fix Configuration Errors**
513 | ```bash
514 | # Test configuration
515 | sudo asterisk -cvvvvv
516 | 
517 | # If syntax errors, fix them
518 | sudo vim /etc/asterisk/pjsip.conf
519 | 
520 | # Restart
521 | sudo systemctl restart asterisk
522 | ```
523 | 
524 | **Solution B: Fix Permissions**
525 | ```bash
526 | sudo chown -R asterisk:asterisk /etc/asterisk
527 | sudo chown -R asterisk:asterisk /var/{lib,log,spool}/asterisk
528 | sudo systemctl restart asterisk
529 | ```
530 | 
531 | **Solution C: Rebuild Asterisk**
532 | ```bash
533 | # If all else fails, reinstall
534 | cd /usr/src/asterisk-*
535 | sudo make uninstall
536 | sudo make install
537 | sudo systemctl restart asterisk
538 | ```
539 | 
540 | ## Emergency Procedures
541 | 
542 | ### Complete System Reset
543 | 
544 | ```bash
545 | # 1. Stop Asterisk
546 | sudo systemctl stop asterisk
547 | 
548 | # 2. Backup current configuration
549 | sudo tar -czf /tmp/asterisk-backup-$(date +%Y%m%d).tar.gz /etc/asterisk/
550 | 
551 | # 3. Restore known-good configuration
552 | sudo tar -xzf /path/to/backup.tar.gz -C /
553 | 
554 | # 4. Start Asterisk
555 | sudo systemctl start asterisk
556 | ```
557 | 
558 | ### Quick Health Check Script
559 | 
560 | Save as `/usr/local/bin/asterisk-health.sh`:
561 | ```bash
562 | #!/bin/bash
563 | 
564 | echo "=== Asterisk Health Check ==="
565 | echo "Service Status:"
566 | systemctl is-active asterisk
567 | 
568 | echo -e "\nEndpoint Status:"
569 | asterisk -rx "pjsip show endpoints" | grep elevenlabs
570 | 
571 | echo -e "\nActive Channels:"
572 | asterisk -rx "core show channels" | tail -1
573 | 
574 | echo -e "\nCPU/Memory:"
575 | top -bn1 | grep "Cpu\|asterisk" | head -2
576 | 
577 | echo -e "\nRTP Ports:"
578 | netstat -an | grep -E ":(1[0-9]{4}|20000)" | wc -l
579 | 
580 | echo -e "\nRecent Errors:"
581 | tail -20 /var/log/asterisk/full | grep ERROR
582 | ```
583 | 
584 | ## Getting Help
585 | 
586 | ### Collect Diagnostic Information
587 | 
588 | Before seeking help, collect:
589 | ```bash
590 | #!/bin/bash
591 | # diagnostic-report.sh
592 | 
593 | REPORT_DIR="/tmp/asterisk-diagnostics-$(date +%Y%m%d-%H%M%S)"
594 | mkdir -p $REPORT_DIR
595 | 
596 | # System info
597 | uname -a > $REPORT_DIR/system-info.txt
598 | free -h >> $REPORT_DIR/system-info.txt
599 | df -h >> $REPORT_DIR/system-info.txt
600 | 
601 | # Asterisk status
602 | sudo asterisk -rx "core show version" > $REPORT_DIR/asterisk-version.txt
603 | sudo asterisk -rx "pjsip show endpoints" > $REPORT_DIR/endpoints.txt
604 | sudo asterisk -rx "pjsip show transports" > $REPORT_DIR/transports.txt
605 | 
606 | # Logs
607 | sudo tail -1000 /var/log/asterisk/full > $REPORT_DIR/asterisk-full.log
608 | sudo tail -1000 /var/log/asterisk/messages > $REPORT_DIR/asterisk-messages.log
609 | 
610 | # Configuration
611 | sudo cp /etc/asterisk/pjsip.conf $REPORT_DIR/
612 | sudo cp /etc/asterisk/extensions.conf $REPORT_DIR/
613 | sudo cp /etc/asterisk/rtp.conf $REPORT_DIR/
614 | 
615 | # Network
616 | sudo netstat -tulnp | grep asterisk > $REPORT_DIR/network.txt
617 | ip addr > $REPORT_DIR/ip-config.txt
618 | 
619 | # Create archive
620 | tar -czf $REPORT_DIR.tar.gz $REPORT_DIR
621 | echo "Diagnostic report created: $REPORT_DIR.tar.gz"
622 | ```
623 | 
624 | ### Community Resources
625 | 
626 | - **Asterisk Community Forum**: https://community.asterisk.org/
627 | - **ElevenLabs Support**: https://help.elevenlabs.io/
628 | - **AWS Support**: https://aws.amazon.com/premiumsupport/
629 | - **Project Issues**: File issue in project repository
630 | 
631 | ## Performance Tuning
632 | 
633 | ### Optimize for High Call Volume
634 | 
635 | ```ini
636 | # /etc/asterisk/pjsip.conf
637 | [global]
638 | max_forwards=20  # Reduce from default 70
639 | timer_t1=500     # SIP timer (default)
640 | timer_b=32000    # Transaction timeout
641 | 
642 | [transport-tcp]
643 | type=transport
644 | async_operations=10  # Increase for high concurrency
645 | ```
646 | 
647 | ### Kernel Tuning
648 | 
649 | ```bash
650 | # /etc/sysctl.conf
651 | net.ipv4.ip_local_port_range = 10000 65535
652 | net.core.rmem_default = 262144
653 | net.core.rmem_max = 16777216
654 | net.core.wmem_default = 262144
655 | net.core.wmem_max = 16777216
656 | 
657 | # Apply
658 | sudo sysctl -p
659 | ```
660 | 
661 | ---
662 | 
663 | **Last Updated**: 2025-10-01
664 | **Version**: 1.0.0
665 | 
```

--------------------------------------------------------------------------------
/data/prompts/templates/mcp-resources-integration.json:
--------------------------------------------------------------------------------

```json
1 | {
2 |   "id": "mcp-resources-integration",
3 |   "name": "MCP Resources Integration Guide",
4 |   "description": "A comprehensive guide to working with and integrating resources across multiple MCP servers",
5 |   "content": "# MCP Resources Integration Guide\\n\\nYou are an expert on the Model Context Protocol (MCP) ecosystem, specializing in resource integration across multiple MCP servers. Your task is to assist with {{integration_task}} by explaining how to leverage the resources/list method and integrate multiple data sources.\\n\\n## Understanding MCP Resources\\n\\nResources in the MCP ecosystem are named data objects that can be referenced and accessed across different MCP servers. They enable:\\n\\n1. **Cross-server data access**: Retrieving and using data from multiple specialized servers\\n2. **Contextual enrichment**: Adding relevant information to prompt templates\\n3. **Dynamic content generation**: Creating outputs based on up-to-date information\\n4. **Workflow orchestration**: Coordinating complex operations involving multiple data sources\\n\\n## The `resources/list` Method\\n\\nThe `resources/list` method is a powerful capability that enables discovery and exploration of available contextual data sources. It can be used to:\\n\\n- **Discover available resources**: List all accessible data sources across connected MCP servers\\n- **Filter resources by type**: Find specific kinds of resources (files, database records, API results)\\n- **Explore metadata**: View descriptions, timestamps, and other metadata about available resources\\n- **Support dynamic workflows**: Enable applications to adapt based on available context\\n\\n### Basic Usage\\n\\n```\\n// Example: Listing all available resources\\n{\\n  \\\\\\\"method\\\\\\\": \\\\\\\"resources/list\\\\\\\",\\n  \\\\\\\"params\\\\\\\": {}\\n}\\n\\n// Example: Filtering resources by prefix\\n{\\n  \\\\\\\"method\\\\\\\": \\\\\\\"resources/list\\\\\\\",\\n  \\\\\\\"params\\\\\\\": {\\n    \\\\\\\"prefix\\\\\\\": \\\\\\\"github://\\\\\\\"\\n  }\\n}\\n```\\n\\n## Integrating Resources from Different MCP Servers\\n\\n### Available Resource Types by Server\\n\\n| Server Type | Resource Prefix | Example URI | Description |\\n|-------------|----------------|-------------|-------------|\\n| GitHub | github:// | github://owner/repo/path/to/file | Repository files and metadata |\\n| Filesystem | file:// | file:///path/to/local/file | Local file system access |\\n| PostgreSQL | postgres:// | postgres://database/table/record | Database records and query results |\\n| Memory | memory:// | memory://session/key | Stored session context |\\n| Web | https:// | https://api.example.com/data | Web content and API responses |\\n| {{custom_server}} | {{custom_prefix}} | {{custom_example}} | {{custom_description}} |\\n\\n### Resource Integration Patterns\\n\\n#### 1. Chain of Resources Pattern\\nConnect multiple resources sequentially, where the output of one resource operation becomes the input for the next:\\n\\n```\\n// Step 1: Retrieve configuration from GitHub\\nconst config = await getResource('github://org/repo/config.json');\\n\\n// Step 2: Use config to query database\\nconst queryResults = await getResource(`postgres://database/table?query=${config.queryParams}`);\\n\\n// Step 3: Process results and store in memory\\nawait setResource('memory://session/processed_data', processData(queryResults));\\n```\\n\\n#### 2. Aggregation Pattern\\nCombine data from multiple resources to create a comprehensive context:\\n\\n```\\n// Collect data from multiple sources\\nconst codebase = await getResource('github://org/repo/src');\\nconst documentation = await getResource('file:///local/docs');\\nconst issueTracking = await getResource('https://issues.example.com/api/project');\\n\\n// Combine into unified context\\nconst projectContext = {\\n  code: codebase,\\n  docs: documentation,\\n  issues: issueTracking\\n};\\n```\\n\\n#### 3. Template Enrichment Pattern\\nUse resources to populate template variables dynamically:\\n\\n```\\n// Retrieve template\\nconst template = await getResource('prompts://templates/analysis');\\n\\n// Gather contextual data\\nconst repoStats = await getResource('github://org/repo/stats');\\nconst performanceData = await getResource('postgres://metrics/performance');\\n\\n// Apply template with resource data\\nconst enrichedPrompt = applyTemplate(template, {\\n  project_metrics: repoStats,\\n  performance_insights: performanceData\\n});\\n```\\n\\n## Implementation Guidelines for {{integration_task}}\\n\\n### Step 1: Resource Discovery\\nFirst, use the resources/list method to discover what data sources are available:\\n\\n```javascript\\n// Example resources/list implementation\\nasync function discoverResources() {\\n  const resources = await callMCP({\\n    method: 'resources/list',\\n    params: {}\\n  });\\n  \\n  console.log('Available resources:', resources);\\n  return resources;\\n}\\n```\\n\\n### Step 2: Resource Access Patterns\\nImplement standardized patterns for accessing different resource types:\\n\\n```javascript\\n// Example resource access function\\nasync function getResource(uri) {\\n  const serverType = getServerTypeFromUri(uri);\\n  \\n  const response = await callMCP({\\n    server: serverType,\\n    method: 'resources/get',\\n    params: { uri }\\n  });\\n  \\n  return response.data;\\n}\\n```\\n\\n### Step 3: Resource Integration\\nCombine resources using the appropriate integration pattern for your use case:\\n\\n{{integration_code}}\\n\\n### Step 4: Error Handling and Fallbacks\\nImplement robust error handling for cases where resources may be unavailable:\\n\\n```javascript\\ntry {\\n  const resource = await getResource('github://org/repo/file.json');\\n  // Process resource\\n} catch (error) {\\n  console.error('Error accessing resource:', error);\\n  // Use fallback resource or strategy\\n  const fallbackResource = await getResource('file:///local/fallback.json');\\n}\\n```\\n\\n## Best Practices for Resource Integration\\n\\n1. **Cache appropriately**: Some resources may be expensive to fetch repeatedly\\n2. **Handle failures gracefully**: Use fallbacks when resources are unavailable\\n3. **Consider resource formats**: Different servers may return different data structures\\n4. **Manage dependencies**: Be mindful of resource dependencies and potential circular references\\n5. **Document resource usage**: Make resource URIs and usage patterns explicit\\n6. **Security awareness**: Consider access control implications when sharing resources\\n{{additional_practices}}\\n\\n## Implementation Examples for Common Scenarios\\n\\n### Example 1: Project Analysis Dashboard\\nCombine code repository statistics, issue tracking, and documentation:\\n\\n```javascript\\nasync function buildProjectDashboard() {\\n  // Discover available resources\\n  const resources = await discoverResources();\\n  \\n  // Check if required resources are available\\n  const hasGitHub = resources.some(r => r.startsWith('github://'));\\n  const hasIssues = resources.some(r => r.startsWith('https://issues.'));\\n  \\n  // Gather data from available sources\\n  const repoData = hasGitHub ? \\n    await getResource('github://org/project/stats') : \\n    { error: 'GitHub data unavailable' };\\n    \\n  const issueData = hasIssues ?\\n    await getResource('https://issues.example.com/api/project/stats') :\\n    { error: 'Issue tracker unavailable' };\\n    \\n  // Combine into unified dashboard data\\n  return {\\n    code_metrics: repoData,\\n    issue_metrics: issueData,\\n    timestamp: new Date().toISOString()\\n  };\\n}\\n```\\n\\n### Example 2: Dynamic Document Generation\\nGenerate documentation by combining templates with real-time data:\\n\\n```javascript\\nasync function generateDocumentation() {\\n  // Get document template\\n  const template = await getResource('prompts://templates/documentation');\\n  \\n  // Gather data from multiple sources\\n  const apiSchema = await getResource('file:///api/schema.json');\\n  const usageStats = await getResource('postgres://analytics/api_usage');\\n  const exampleCode = await getResource('github://org/examples/api');\\n  \\n  // Generate documentation\\n  return applyTemplate(template, {\\n    schema: apiSchema,\\n    usage: usageStats,\\n    examples: exampleCode\\n  });\\n}\\n```\\n\\n### Example 3: {{custom_example_name}}\\n{{custom_example_description}}\\n\\n```javascript\\n{{custom_example_code}}\\n```\\n\\n## Resources/List Method in Action\\n\\nThe resources/list method serves multiple important functions:\\n\\n1. **Discovery and Exploration**: Clients can discover what contextual resources are available\\n2. **Workflow Orchestration**: Automated workflows can determine which resources to use\\n3. **Enhanced UI/UX**: User interfaces can show available resources for selection\\n4. **Integration with External Services**: Bridge between clients and external data sources\\n\\nExample implementation of a resource explorer using resources/list:\\n\\n```javascript\\nasync function exploreResources(prefix = '') {\\n  const resources = await callMCP({\\n    method: 'resources/list',\\n    params: { prefix }\\n  });\\n  \\n  // Group resources by type\\n  const resourcesByType = resources.reduce((groups, uri) => {\\n    const type = uri.split('://')[0];\\n    if (!groups[type]) groups[type] = [];\\n    groups[type].push(uri);\\n    return groups;\\n  }, {});\\n  \\n  // Display available resources by type\\n  for (const [type, uris] of Object.entries(resourcesByType)) {\\n    console.log(`${type} resources (${uris.length}):`);\\n    uris.forEach(uri => console.log(`  - ${uri}`));\\n  }\\n  \\n  return resourcesByType;\\n}\\n```\\n\\n## Conclusion\\n\\nEffective integration of resources across MCP servers is a powerful pattern that enables complex workflows, rich contextual awareness, and dynamic content generation. By understanding the resources/list method and implementing appropriate integration patterns, you can leverage the full potential of the MCP ecosystem for {{integration_task}}.\\n\\nWhat specific aspect of MCP resource integration would you like to explore further?\\\",\\n  \\\"isTemplate\\\": true,\\n  \\\"variables\\\": [\\n    \\\"integration_task\\\",\\n    \\\"custom_server\\\",\\n    \\\"custom_prefix\\\",\\n    \\\"custom_example\\\",\\n    \\\"custom_description\\\",\\n    \\\"integration_code\\\",\\n    \\\"additional_practices\\\",\\n    \\\"custom_example_name\\\",\\n    \\\"custom_example_description\\\",\\n    \\\"custom_example_code\\\"\\n  ],\\n  \\\"tags\\\": [\\n    \\\"mcp\\\",\\n    \\\"resources\\\",\\n    \\\"integration\\\",\\n    \\\"advanced\\\",\\n    \\\"multi-server\\\",\\n    \\\"template\\\"\\n  ],\\n  \\\"createdAt\\\": \\\"2025-03-15T16:00:00.000Z\\\",\\n  \\\"updatedAt\\\": \\\"2025-03-15T16:00:00.000Z\\\",\\n  \\\"version\\\": 1,\\n  \\\"metadata\\\": {\\n    \\\"recommended_servers\\\": [\\n      \\\"github\\\",\\n      \\\"filesystem\\\",\\n      \\\"postgres\\\",\\n      \\\"memory\\\",\\n      \\\"prompts\\\"\\n    ],\\n    \\\"example_variables\\\": {\\n      \\\"integration_task\\\": \\\"building a comprehensive project analysis tool\\\",\\n      \\\"custom_server\\\": \\\"TimeSeries\\\",\\n      \\\"custom_prefix\\\": \\\"timeseries://\\\",\\n      \\\"custom_example\\\": \\\"timeseries://metrics/cpu-usage/7d\\\",\\n      \\\"custom_description\\\": \\\"Historical time-series data for metrics and monitoring\\\",\\n      \\\"integration_code\\\": \\\"async function integrateProjectAnalysis() {\\\\n  // Get repository information\\\\n  const repoInfo = await getResource('github://org/repo/info');\\\\n  \\\\n  // Fetch relevant code files based on repo structure\\\\n  const codeFiles = await Promise.all(\\\\n    repoInfo.main_modules.map(module => \\\\n      getResource(`github://org/repo/src/${module}`)\\\\n    )\\\\n  );\\\\n  \\\\n  // Get database schema information\\\\n  const dbSchema = await getResource('postgres://database/information_schema');\\\\n  \\\\n  // Combine everything into a unified context\\\\n  const projectContext = {\\\\n    repository: repoInfo,\\\\n    code_modules: codeFiles,\\\\n    database_structure: dbSchema,\\\\n    analysis_timestamp: new Date().toISOString()\\\\n  };\\\\n  \\\\n  // Store the combined context in memory for future reference\\\\n  await setResource('memory://session/project_context', projectContext);\\\\n  \\\\n  return projectContext;\\\\n}\\\",\\n      \\\"additional_practices\\\": \\\"7. **Version awareness**: Consider resource version compatibility\\\\n8. **Performance tracking**: Monitor resource access patterns and optimize frequent operations\\\\n9. **Scope limitation**: Only access resources directly relevant to the current task\\\\n10. **Progressive enhancement**: Design systems that work with minimal resources but enhance capabilities when more are available\\\",\\n      \\\"custom_example_name\\\": \\\"Cross-Server Data Validation\\\",\\n      \\\"custom_example_description\\\": \\\"Validate data consistency across different storage systems by comparing repositories, databases, and local files:\\\",\\n      \\\"custom_example_code\\\": \\\"async function validateDataConsistency() {\\\\n  // Get configuration schema from repository\\\\n  const configSchema = await getResource('github://org/repo/schema/config.json');\\\\n  \\\\n  // Get actual configurations from database\\\\n  const dbConfigs = await getResource('postgres://app/configurations');\\\\n  \\\\n  // Get local configuration files\\\\n  const localConfigs = await getResource('file:///app/config/');\\\\n  \\\\n  // Compare configurations across systems\\\\n  const validationResults = {\\\\n    schema_valid: validateAgainstSchema(dbConfigs, configSchema),\\\\n    db_local_match: compareConfigurations(dbConfigs, localConfigs),\\\\n    mismatches: findMismatches(dbConfigs, localConfigs, configSchema)\\\\n  };\\\\n  \\\\n  // Store validation results in memory\\\\n  await setResource('memory://validation/config_results', validationResults);\\\\n  \\\\n  return validationResults;\\\\n}"
6 | }
```

--------------------------------------------------------------------------------
/src/mcp_project_orchestrator/prompts/MCP_Resources_Integration_Guide.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "name": "MCP Resources Integration Guide",
 3 |   "description": "A comprehensive guide to working with and integrating resources across multiple MCP servers",
 4 |   "type": "prompt",
 5 |   "category": "other",
 6 |   "content": "# MCP Resources Integration Guide\\n\\nYou are an expert on the Model Context Protocol (MCP) ecosystem, specializing in resource integration across multiple MCP servers. Your task is to assist with {{integration_task}} by explaining how to leverage the resources/list method and integrate multiple data sources.\\n\\n## Understanding MCP Resources\\n\\nResources in the MCP ecosystem are named data objects that can be referenced and accessed across different MCP servers. They enable:\\n\\n1. **Cross-server data access**: Retrieving and using data from multiple specialized servers\\n2. **Contextual enrichment**: Adding relevant information to prompt templates\\n3. **Dynamic content generation**: Creating outputs based on up-to-date information\\n4. **Workflow orchestration**: Coordinating complex operations involving multiple data sources\\n\\n## The `resources/list` Method\\n\\nThe `resources/list` method is a powerful capability that enables discovery and exploration of available contextual data sources. It can be used to:\\n\\n- **Discover available resources**: List all accessible data sources across connected MCP servers\\n- **Filter resources by type**: Find specific kinds of resources (files, database records, API results)\\n- **Explore metadata**: View descriptions, timestamps, and other metadata about available resources\\n- **Support dynamic workflows**: Enable applications to adapt based on available context\\n\\n### Basic Usage\\n\\n```\\n// Example: Listing all available resources\\n{\\n  \\\\\\\"method\\\\\\\": \\\\\\\"resources/list\\\\\\\",\\n  \\\\\\\"params\\\\\\\": {}\\n}\\n\\n// Example: Filtering resources by prefix\\n{\\n  \\\\\\\"method\\\\\\\": \\\\\\\"resources/list\\\\\\\",\\n  \\\\\\\"params\\\\\\\": {\\n    \\\\\\\"prefix\\\\\\\": \\\\\\\"github://\\\\\\\"\\n  }\\n}\\n```\\n\\n## Integrating Resources from Different MCP Servers\\n\\n### Available Resource Types by Server\\n\\n| Server Type | Resource Prefix | Example URI | Description |\\n|-------------|----------------|-------------|-------------|\\n| GitHub | github:// | github://owner/repo/path/to/file | Repository files and metadata |\\n| Filesystem | file:// | file:///path/to/local/file | Local file system access |\\n| PostgreSQL | postgres:// | postgres://database/table/record | Database records and query results |\\n| Memory | memory:// | memory://session/key | Stored session context |\\n| Web | https:// | https://api.example.com/data | Web content and API responses |\\n| {{custom_server}} | {{custom_prefix}} | {{custom_example}} | {{custom_description}} |\\n\\n### Resource Integration Patterns\\n\\n#### 1. Chain of Resources Pattern\\nConnect multiple resources sequentially, where the output of one resource operation becomes the input for the next:\\n\\n```\\n// Step 1: Retrieve configuration from GitHub\\nconst config = await getResource('github://org/repo/config.json');\\n\\n// Step 2: Use config to query database\\nconst queryResults = await getResource(`postgres://database/table?query=${config.queryParams}`);\\n\\n// Step 3: Process results and store in memory\\nawait setResource('memory://session/processed_data', processData(queryResults));\\n```\\n\\n#### 2. Aggregation Pattern\\nCombine data from multiple resources to create a comprehensive context:\\n\\n```\\n// Collect data from multiple sources\\nconst codebase = await getResource('github://org/repo/src');\\nconst documentation = await getResource('file:///local/docs');\\nconst issueTracking = await getResource('https://issues.example.com/api/project');\\n\\n// Combine into unified context\\nconst projectContext = {\\n  code: codebase,\\n  docs: documentation,\\n  issues: issueTracking\\n};\\n```\\n\\n#### 3. Template Enrichment Pattern\\nUse resources to populate template variables dynamically:\\n\\n```\\n// Retrieve template\\nconst template = await getResource('prompts://templates/analysis');\\n\\n// Gather contextual data\\nconst repoStats = await getResource('github://org/repo/stats');\\nconst performanceData = await getResource('postgres://metrics/performance');\\n\\n// Apply template with resource data\\nconst enrichedPrompt = applyTemplate(template, {\\n  project_metrics: repoStats,\\n  performance_insights: performanceData\\n});\\n```\\n\\n## Implementation Guidelines for {{integration_task}}\\n\\n### Step 1: Resource Discovery\\nFirst, use the resources/list method to discover what data sources are available:\\n\\n```javascript\\n// Example resources/list implementation\\nasync function discoverResources() {\\n  const resources = await callMCP({\\n    method: 'resources/list',\\n    params: {}\\n  });\\n  \\n  console.log('Available resources:', resources);\\n  return resources;\\n}\\n```\\n\\n### Step 2: Resource Access Patterns\\nImplement standardized patterns for accessing different resource types:\\n\\n```javascript\\n// Example resource access function\\nasync function getResource(uri) {\\n  const serverType = getServerTypeFromUri(uri);\\n  \\n  const response = await callMCP({\\n    server: serverType,\\n    method: 'resources/get',\\n    params: { uri }\\n  });\\n  \\n  return response.data;\\n}\\n```\\n\\n### Step 3: Resource Integration\\nCombine resources using the appropriate integration pattern for your use case:\\n\\n{{integration_code}}\\n\\n### Step 4: Error Handling and Fallbacks\\nImplement robust error handling for cases where resources may be unavailable:\\n\\n```javascript\\ntry {\\n  const resource = await getResource('github://org/repo/file.json');\\n  // Process resource\\n} catch (error) {\\n  console.error('Error accessing resource:', error);\\n  // Use fallback resource or strategy\\n  const fallbackResource = await getResource('file:///local/fallback.json');\\n}\\n```\\n\\n## Best Practices for Resource Integration\\n\\n1. **Cache appropriately**: Some resources may be expensive to fetch repeatedly\\n2. **Handle failures gracefully**: Use fallbacks when resources are unavailable\\n3. **Consider resource formats**: Different servers may return different data structures\\n4. **Manage dependencies**: Be mindful of resource dependencies and potential circular references\\n5. **Document resource usage**: Make resource URIs and usage patterns explicit\\n6. **Security awareness**: Consider access control implications when sharing resources\\n{{additional_practices}}\\n\\n## Implementation Examples for Common Scenarios\\n\\n### Example 1: Project Analysis Dashboard\\nCombine code repository statistics, issue tracking, and documentation:\\n\\n```javascript\\nasync function buildProjectDashboard() {\\n  // Discover available resources\\n  const resources = await discoverResources();\\n  \\n  // Check if required resources are available\\n  const hasGitHub = resources.some(r => r.startsWith('github://'));\\n  const hasIssues = resources.some(r => r.startsWith('https://issues.'));\\n  \\n  // Gather data from available sources\\n  const repoData = hasGitHub ? \\n    await getResource('github://org/project/stats') : \\n    { error: 'GitHub data unavailable' };\\n    \\n  const issueData = hasIssues ?\\n    await getResource('https://issues.example.com/api/project/stats') :\\n    { error: 'Issue tracker unavailable' };\\n    \\n  // Combine into unified dashboard data\\n  return {\\n    code_metrics: repoData,\\n    issue_metrics: issueData,\\n    timestamp: new Date().toISOString()\\n  };\\n}\\n```\\n\\n### Example 2: Dynamic Document Generation\\nGenerate documentation by combining templates with real-time data:\\n\\n```javascript\\nasync function generateDocumentation() {\\n  // Get document template\\n  const template = await getResource('prompts://templates/documentation');\\n  \\n  // Gather data from multiple sources\\n  const apiSchema = await getResource('file:///api/schema.json');\\n  const usageStats = await getResource('postgres://analytics/api_usage');\\n  const exampleCode = await getResource('github://org/examples/api');\\n  \\n  // Generate documentation\\n  return applyTemplate(template, {\\n    schema: apiSchema,\\n    usage: usageStats,\\n    examples: exampleCode\\n  });\\n}\\n```\\n\\n### Example 3: {{custom_example_name}}\\n{{custom_example_description}}\\n\\n```javascript\\n{{custom_example_code}}\\n```\\n\\n## Resources/List Method in Action\\n\\nThe resources/list method serves multiple important functions:\\n\\n1. **Discovery and Exploration**: Clients can discover what contextual resources are available\\n2. **Workflow Orchestration**: Automated workflows can determine which resources to use\\n3. **Enhanced UI/UX**: User interfaces can show available resources for selection\\n4. **Integration with External Services**: Bridge between clients and external data sources\\n\\nExample implementation of a resource explorer using resources/list:\\n\\n```javascript\\nasync function exploreResources(prefix = '') {\\n  const resources = await callMCP({\\n    method: 'resources/list',\\n    params: { prefix }\\n  });\\n  \\n  // Group resources by type\\n  const resourcesByType = resources.reduce((groups, uri) => {\\n    const type = uri.split('://')[0];\\n    if (!groups[type]) groups[type] = [];\\n    groups[type].push(uri);\\n    return groups;\\n  }, {});\\n  \\n  // Display available resources by type\\n  for (const [type, uris] of Object.entries(resourcesByType)) {\\n    console.log(`${type} resources (${uris.length}):`);\\n    uris.forEach(uri => console.log(`  - ${uri}`));\\n  }\\n  \\n  return resourcesByType;\\n}\\n```\\n\\n## Conclusion\\n\\nEffective integration of resources across MCP servers is a powerful pattern that enables complex workflows, rich contextual awareness, and dynamic content generation. By understanding the resources/list method and implementing appropriate integration patterns, you can leverage the full potential of the MCP ecosystem for {{integration_task}}.\\n\\nWhat specific aspect of MCP resource integration would you like to explore further?\\\",\\n  \\\"isTemplate\\\": true,\\n  \\\"variables\\\": [\\n    \\\"integration_task\\\",\\n    \\\"custom_server\\\",\\n    \\\"custom_prefix\\\",\\n    \\\"custom_example\\\",\\n    \\\"custom_description\\\",\\n    \\\"integration_code\\\",\\n    \\\"additional_practices\\\",\\n    \\\"custom_example_name\\\",\\n    \\\"custom_example_description\\\",\\n    \\\"custom_example_code\\\"\\n  ],\\n  \\\"tags\\\": [\\n    \\\"mcp\\\",\\n    \\\"resources\\\",\\n    \\\"integration\\\",\\n    \\\"advanced\\\",\\n    \\\"multi-server\\\",\\n    \\\"template\\\"\\n  ],\\n  \\\"createdAt\\\": \\\"2025-03-15T16:00:00.000Z\\\",\\n  \\\"updatedAt\\\": \\\"2025-03-15T16:00:00.000Z\\\",\\n  \\\"version\\\": 1,\\n  \\\"metadata\\\": {\\n    \\\"recommended_servers\\\": [\\n      \\\"github\\\",\\n      \\\"filesystem\\\",\\n      \\\"postgres\\\",\\n      \\\"memory\\\",\\n      \\\"prompts\\\"\\n    ],\\n    \\\"example_variables\\\": {\\n      \\\"integration_task\\\": \\\"building a comprehensive project analysis tool\\\",\\n      \\\"custom_server\\\": \\\"TimeSeries\\\",\\n      \\\"custom_prefix\\\": \\\"timeseries://\\\",\\n      \\\"custom_example\\\": \\\"timeseries://metrics/cpu-usage/7d\\\",\\n      \\\"custom_description\\\": \\\"Historical time-series data for metrics and monitoring\\\",\\n      \\\"integration_code\\\": \\\"async function integrateProjectAnalysis() {\\\\n  // Get repository information\\\\n  const repoInfo = await getResource('github://org/repo/info');\\\\n  \\\\n  // Fetch relevant code files based on repo structure\\\\n  const codeFiles = await Promise.all(\\\\n    repoInfo.main_modules.map(module => \\\\n      getResource(`github://org/repo/src/${module}`)\\\\n    )\\\\n  );\\\\n  \\\\n  // Get database schema information\\\\n  const dbSchema = await getResource('postgres://database/information_schema');\\\\n  \\\\n  // Combine everything into a unified context\\\\n  const projectContext = {\\\\n    repository: repoInfo,\\\\n    code_modules: codeFiles,\\\\n    database_structure: dbSchema,\\\\n    analysis_timestamp: new Date().toISOString()\\\\n  };\\\\n  \\\\n  // Store the combined context in memory for future reference\\\\n  await setResource('memory://session/project_context', projectContext);\\\\n  \\\\n  return projectContext;\\\\n}\\\",\\n      \\\"additional_practices\\\": \\\"7. **Version awareness**: Consider resource version compatibility\\\\n8. **Performance tracking**: Monitor resource access patterns and optimize frequent operations\\\\n9. **Scope limitation**: Only access resources directly relevant to the current task\\\\n10. **Progressive enhancement**: Design systems that work with minimal resources but enhance capabilities when more are available\\\",\\n      \\\"custom_example_name\\\": \\\"Cross-Server Data Validation\\\",\\n      \\\"custom_example_description\\\": \\\"Validate data consistency across different storage systems by comparing repositories, databases, and local files:\\\",\\n      \\\"custom_example_code\\\": \\\"async function validateDataConsistency() {\\\\n  // Get configuration schema from repository\\\\n  const configSchema = await getResource('github://org/repo/schema/config.json');\\\\n  \\\\n  // Get actual configurations from database\\\\n  const dbConfigs = await getResource('postgres://app/configurations');\\\\n  \\\\n  // Get local configuration files\\\\n  const localConfigs = await getResource('file:///app/config/');\\\\n  \\\\n  // Compare configurations across systems\\\\n  const validationResults = {\\\\n    schema_valid: validateAgainstSchema(dbConfigs, configSchema),\\\\n    db_local_match: compareConfigurations(dbConfigs, localConfigs),\\\\n    mismatches: findMismatches(dbConfigs, localConfigs, configSchema)\\\\n  };\\\\n  \\\\n  // Store validation results in memory\\\\n  await setResource('memory://validation/config_results', validationResults);\\\\n  \\\\n  return validationResults;\\\\n}",
 7 |   "variables": {},
 8 |   "metadata": {
 9 |     "source": "/home/sparrow/projects/mcp-prompts/prompts/mcp-resources-integration.json",
10 |     "imported": true
11 |   }
12 | }
```

--------------------------------------------------------------------------------
/src/mcp_project_orchestrator/prompts/other/MCP_Resources_Integration_Guide.json:
--------------------------------------------------------------------------------

```json
 1 | {
 2 |   "name": "MCP Resources Integration Guide",
 3 |   "description": "A comprehensive guide to working with and integrating resources across multiple MCP servers",
 4 |   "type": "prompt",
 5 |   "category": "other",
 6 |   "content": "# MCP Resources Integration Guide\\n\\nYou are an expert on the Model Context Protocol (MCP) ecosystem, specializing in resource integration across multiple MCP servers. Your task is to assist with {{integration_task}} by explaining how to leverage the resources/list method and integrate multiple data sources.\\n\\n## Understanding MCP Resources\\n\\nResources in the MCP ecosystem are named data objects that can be referenced and accessed across different MCP servers. They enable:\\n\\n1. **Cross-server data access**: Retrieving and using data from multiple specialized servers\\n2. **Contextual enrichment**: Adding relevant information to prompt templates\\n3. **Dynamic content generation**: Creating outputs based on up-to-date information\\n4. **Workflow orchestration**: Coordinating complex operations involving multiple data sources\\n\\n## The `resources/list` Method\\n\\nThe `resources/list` method is a powerful capability that enables discovery and exploration of available contextual data sources. It can be used to:\\n\\n- **Discover available resources**: List all accessible data sources across connected MCP servers\\n- **Filter resources by type**: Find specific kinds of resources (files, database records, API results)\\n- **Explore metadata**: View descriptions, timestamps, and other metadata about available resources\\n- **Support dynamic workflows**: Enable applications to adapt based on available context\\n\\n### Basic Usage\\n\\n```\\n// Example: Listing all available resources\\n{\\n  \\\\\\\"method\\\\\\\": \\\\\\\"resources/list\\\\\\\",\\n  \\\\\\\"params\\\\\\\": {}\\n}\\n\\n// Example: Filtering resources by prefix\\n{\\n  \\\\\\\"method\\\\\\\": \\\\\\\"resources/list\\\\\\\",\\n  \\\\\\\"params\\\\\\\": {\\n    \\\\\\\"prefix\\\\\\\": \\\\\\\"github://\\\\\\\"\\n  }\\n}\\n```\\n\\n## Integrating Resources from Different MCP Servers\\n\\n### Available Resource Types by Server\\n\\n| Server Type | Resource Prefix | Example URI | Description |\\n|-------------|----------------|-------------|-------------|\\n| GitHub | github:// | github://owner/repo/path/to/file | Repository files and metadata |\\n| Filesystem | file:// | file:///path/to/local/file | Local file system access |\\n| PostgreSQL | postgres:// | postgres://database/table/record | Database records and query results |\\n| Memory | memory:// | memory://session/key | Stored session context |\\n| Web | https:// | https://api.example.com/data | Web content and API responses |\\n| {{custom_server}} | {{custom_prefix}} | {{custom_example}} | {{custom_description}} |\\n\\n### Resource Integration Patterns\\n\\n#### 1. Chain of Resources Pattern\\nConnect multiple resources sequentially, where the output of one resource operation becomes the input for the next:\\n\\n```\\n// Step 1: Retrieve configuration from GitHub\\nconst config = await getResource('github://org/repo/config.json');\\n\\n// Step 2: Use config to query database\\nconst queryResults = await getResource(`postgres://database/table?query=${config.queryParams}`);\\n\\n// Step 3: Process results and store in memory\\nawait setResource('memory://session/processed_data', processData(queryResults));\\n```\\n\\n#### 2. Aggregation Pattern\\nCombine data from multiple resources to create a comprehensive context:\\n\\n```\\n// Collect data from multiple sources\\nconst codebase = await getResource('github://org/repo/src');\\nconst documentation = await getResource('file:///local/docs');\\nconst issueTracking = await getResource('https://issues.example.com/api/project');\\n\\n// Combine into unified context\\nconst projectContext = {\\n  code: codebase,\\n  docs: documentation,\\n  issues: issueTracking\\n};\\n```\\n\\n#### 3. Template Enrichment Pattern\\nUse resources to populate template variables dynamically:\\n\\n```\\n// Retrieve template\\nconst template = await getResource('prompts://templates/analysis');\\n\\n// Gather contextual data\\nconst repoStats = await getResource('github://org/repo/stats');\\nconst performanceData = await getResource('postgres://metrics/performance');\\n\\n// Apply template with resource data\\nconst enrichedPrompt = applyTemplate(template, {\\n  project_metrics: repoStats,\\n  performance_insights: performanceData\\n});\\n```\\n\\n## Implementation Guidelines for {{integration_task}}\\n\\n### Step 1: Resource Discovery\\nFirst, use the resources/list method to discover what data sources are available:\\n\\n```javascript\\n// Example resources/list implementation\\nasync function discoverResources() {\\n  const resources = await callMCP({\\n    method: 'resources/list',\\n    params: {}\\n  });\\n  \\n  console.log('Available resources:', resources);\\n  return resources;\\n}\\n```\\n\\n### Step 2: Resource Access Patterns\\nImplement standardized patterns for accessing different resource types:\\n\\n```javascript\\n// Example resource access function\\nasync function getResource(uri) {\\n  const serverType = getServerTypeFromUri(uri);\\n  \\n  const response = await callMCP({\\n    server: serverType,\\n    method: 'resources/get',\\n    params: { uri }\\n  });\\n  \\n  return response.data;\\n}\\n```\\n\\n### Step 3: Resource Integration\\nCombine resources using the appropriate integration pattern for your use case:\\n\\n{{integration_code}}\\n\\n### Step 4: Error Handling and Fallbacks\\nImplement robust error handling for cases where resources may be unavailable:\\n\\n```javascript\\ntry {\\n  const resource = await getResource('github://org/repo/file.json');\\n  // Process resource\\n} catch (error) {\\n  console.error('Error accessing resource:', error);\\n  // Use fallback resource or strategy\\n  const fallbackResource = await getResource('file:///local/fallback.json');\\n}\\n```\\n\\n## Best Practices for Resource Integration\\n\\n1. **Cache appropriately**: Some resources may be expensive to fetch repeatedly\\n2. **Handle failures gracefully**: Use fallbacks when resources are unavailable\\n3. **Consider resource formats**: Different servers may return different data structures\\n4. **Manage dependencies**: Be mindful of resource dependencies and potential circular references\\n5. **Document resource usage**: Make resource URIs and usage patterns explicit\\n6. **Security awareness**: Consider access control implications when sharing resources\\n{{additional_practices}}\\n\\n## Implementation Examples for Common Scenarios\\n\\n### Example 1: Project Analysis Dashboard\\nCombine code repository statistics, issue tracking, and documentation:\\n\\n```javascript\\nasync function buildProjectDashboard() {\\n  // Discover available resources\\n  const resources = await discoverResources();\\n  \\n  // Check if required resources are available\\n  const hasGitHub = resources.some(r => r.startsWith('github://'));\\n  const hasIssues = resources.some(r => r.startsWith('https://issues.'));\\n  \\n  // Gather data from available sources\\n  const repoData = hasGitHub ? \\n    await getResource('github://org/project/stats') : \\n    { error: 'GitHub data unavailable' };\\n    \\n  const issueData = hasIssues ?\\n    await getResource('https://issues.example.com/api/project/stats') :\\n    { error: 'Issue tracker unavailable' };\\n    \\n  // Combine into unified dashboard data\\n  return {\\n    code_metrics: repoData,\\n    issue_metrics: issueData,\\n    timestamp: new Date().toISOString()\\n  };\\n}\\n```\\n\\n### Example 2: Dynamic Document Generation\\nGenerate documentation by combining templates with real-time data:\\n\\n```javascript\\nasync function generateDocumentation() {\\n  // Get document template\\n  const template = await getResource('prompts://templates/documentation');\\n  \\n  // Gather data from multiple sources\\n  const apiSchema = await getResource('file:///api/schema.json');\\n  const usageStats = await getResource('postgres://analytics/api_usage');\\n  const exampleCode = await getResource('github://org/examples/api');\\n  \\n  // Generate documentation\\n  return applyTemplate(template, {\\n    schema: apiSchema,\\n    usage: usageStats,\\n    examples: exampleCode\\n  });\\n}\\n```\\n\\n### Example 3: {{custom_example_name}}\\n{{custom_example_description}}\\n\\n```javascript\\n{{custom_example_code}}\\n```\\n\\n## Resources/List Method in Action\\n\\nThe resources/list method serves multiple important functions:\\n\\n1. **Discovery and Exploration**: Clients can discover what contextual resources are available\\n2. **Workflow Orchestration**: Automated workflows can determine which resources to use\\n3. **Enhanced UI/UX**: User interfaces can show available resources for selection\\n4. **Integration with External Services**: Bridge between clients and external data sources\\n\\nExample implementation of a resource explorer using resources/list:\\n\\n```javascript\\nasync function exploreResources(prefix = '') {\\n  const resources = await callMCP({\\n    method: 'resources/list',\\n    params: { prefix }\\n  });\\n  \\n  // Group resources by type\\n  const resourcesByType = resources.reduce((groups, uri) => {\\n    const type = uri.split('://')[0];\\n    if (!groups[type]) groups[type] = [];\\n    groups[type].push(uri);\\n    return groups;\\n  }, {});\\n  \\n  // Display available resources by type\\n  for (const [type, uris] of Object.entries(resourcesByType)) {\\n    console.log(`${type} resources (${uris.length}):`);\\n    uris.forEach(uri => console.log(`  - ${uri}`));\\n  }\\n  \\n  return resourcesByType;\\n}\\n```\\n\\n## Conclusion\\n\\nEffective integration of resources across MCP servers is a powerful pattern that enables complex workflows, rich contextual awareness, and dynamic content generation. By understanding the resources/list method and implementing appropriate integration patterns, you can leverage the full potential of the MCP ecosystem for {{integration_task}}.\\n\\nWhat specific aspect of MCP resource integration would you like to explore further?\\\",\\n  \\\"isTemplate\\\": true,\\n  \\\"variables\\\": [\\n    \\\"integration_task\\\",\\n    \\\"custom_server\\\",\\n    \\\"custom_prefix\\\",\\n    \\\"custom_example\\\",\\n    \\\"custom_description\\\",\\n    \\\"integration_code\\\",\\n    \\\"additional_practices\\\",\\n    \\\"custom_example_name\\\",\\n    \\\"custom_example_description\\\",\\n    \\\"custom_example_code\\\"\\n  ],\\n  \\\"tags\\\": [\\n    \\\"mcp\\\",\\n    \\\"resources\\\",\\n    \\\"integration\\\",\\n    \\\"advanced\\\",\\n    \\\"multi-server\\\",\\n    \\\"template\\\"\\n  ],\\n  \\\"createdAt\\\": \\\"2025-03-15T16:00:00.000Z\\\",\\n  \\\"updatedAt\\\": \\\"2025-03-15T16:00:00.000Z\\\",\\n  \\\"version\\\": 1,\\n  \\\"metadata\\\": {\\n    \\\"recommended_servers\\\": [\\n      \\\"github\\\",\\n      \\\"filesystem\\\",\\n      \\\"postgres\\\",\\n      \\\"memory\\\",\\n      \\\"prompts\\\"\\n    ],\\n    \\\"example_variables\\\": {\\n      \\\"integration_task\\\": \\\"building a comprehensive project analysis tool\\\",\\n      \\\"custom_server\\\": \\\"TimeSeries\\\",\\n      \\\"custom_prefix\\\": \\\"timeseries://\\\",\\n      \\\"custom_example\\\": \\\"timeseries://metrics/cpu-usage/7d\\\",\\n      \\\"custom_description\\\": \\\"Historical time-series data for metrics and monitoring\\\",\\n      \\\"integration_code\\\": \\\"async function integrateProjectAnalysis() {\\\\n  // Get repository information\\\\n  const repoInfo = await getResource('github://org/repo/info');\\\\n  \\\\n  // Fetch relevant code files based on repo structure\\\\n  const codeFiles = await Promise.all(\\\\n    repoInfo.main_modules.map(module => \\\\n      getResource(`github://org/repo/src/${module}`)\\\\n    )\\\\n  );\\\\n  \\\\n  // Get database schema information\\\\n  const dbSchema = await getResource('postgres://database/information_schema');\\\\n  \\\\n  // Combine everything into a unified context\\\\n  const projectContext = {\\\\n    repository: repoInfo,\\\\n    code_modules: codeFiles,\\\\n    database_structure: dbSchema,\\\\n    analysis_timestamp: new Date().toISOString()\\\\n  };\\\\n  \\\\n  // Store the combined context in memory for future reference\\\\n  await setResource('memory://session/project_context', projectContext);\\\\n  \\\\n  return projectContext;\\\\n}\\\",\\n      \\\"additional_practices\\\": \\\"7. **Version awareness**: Consider resource version compatibility\\\\n8. **Performance tracking**: Monitor resource access patterns and optimize frequent operations\\\\n9. **Scope limitation**: Only access resources directly relevant to the current task\\\\n10. **Progressive enhancement**: Design systems that work with minimal resources but enhance capabilities when more are available\\\",\\n      \\\"custom_example_name\\\": \\\"Cross-Server Data Validation\\\",\\n      \\\"custom_example_description\\\": \\\"Validate data consistency across different storage systems by comparing repositories, databases, and local files:\\\",\\n      \\\"custom_example_code\\\": \\\"async function validateDataConsistency() {\\\\n  // Get configuration schema from repository\\\\n  const configSchema = await getResource('github://org/repo/schema/config.json');\\\\n  \\\\n  // Get actual configurations from database\\\\n  const dbConfigs = await getResource('postgres://app/configurations');\\\\n  \\\\n  // Get local configuration files\\\\n  const localConfigs = await getResource('file:///app/config/');\\\\n  \\\\n  // Compare configurations across systems\\\\n  const validationResults = {\\\\n    schema_valid: validateAgainstSchema(dbConfigs, configSchema),\\\\n    db_local_match: compareConfigurations(dbConfigs, localConfigs),\\\\n    mismatches: findMismatches(dbConfigs, localConfigs, configSchema)\\\\n  };\\\\n  \\\\n  // Store validation results in memory\\\\n  await setResource('memory://validation/config_results', validationResults);\\\\n  \\\\n  return validationResults;\\\\n}",
 7 |   "variables": {},
 8 |   "metadata": {
 9 |     "source": "/home/sparrow/projects/mcp-prompts/prompts/mcp-resources-integration.json",
10 |     "imported": true
11 |   }
12 | }
```

--------------------------------------------------------------------------------
/src/mcp_project_orchestrator/mermaid/generator.py:
--------------------------------------------------------------------------------

```python
  1 | """
  2 | Mermaid diagram generator for MCP Project Orchestrator.
  3 | 
  4 | This module provides functionality for generating Mermaid diagram
  5 | definitions from various inputs and templates.
  6 | """
  7 | 
  8 | from pathlib import Path
  9 | from typing import Any, Dict, List, Optional, Union
 10 | import json
 11 | 
 12 | from ..core import Config
 13 | from .types import DiagramType, DiagramConfig, DiagramMetadata
 14 | 
 15 | class MermaidGenerator:
 16 |     """Class for generating Mermaid diagram definitions."""
 17 |     
 18 |     def __init__(self, config: Config):
 19 |         """Initialize the Mermaid generator.
 20 |         
 21 |         Args:
 22 |             config: Configuration instance
 23 |         """
 24 |         self.config = config
 25 |         templates_base = getattr(config.settings, 'templates_dir', Path('templates'))
 26 |         self.templates_dir = templates_base / "mermaid"
 27 |         self.templates: Dict[str, Dict[str, Any]] = {}
 28 |         
 29 |     async def initialize(self) -> None:
 30 |         """Initialize the generator.
 31 |         
 32 |         Creates the templates directory if it doesn't exist and
 33 |         loads any existing templates.
 34 |         """
 35 |         self.templates_dir.mkdir(parents=True, exist_ok=True)
 36 |         await self.load_templates()
 37 |         
 38 |     async def cleanup(self) -> None:
 39 |         """Clean up resources."""
 40 |         self.templates.clear()
 41 |         
 42 |     async def load_templates(self) -> None:
 43 |         """Load Mermaid diagram templates from the templates directory."""
 44 |         for file_path in self.templates_dir.glob("*.json"):
 45 |             try:
 46 |                 with open(file_path) as f:
 47 |                     template = json.load(f)
 48 |                 self.templates[file_path.stem] = template
 49 |             except Exception as e:
 50 |                 pass  # Skip invalid templates
 51 |                 
 52 |     def generate_flowchart(
 53 |         self,
 54 |         nodes: List[Dict[str, str]] | List[tuple],
 55 |         edges: List[Dict[str, str]] | List[tuple],
 56 |         direction: str = "TD",
 57 |         config: Optional[DiagramConfig] = None,
 58 |     ) -> str:
 59 |         """Generate a flowchart diagram definition.
 60 |         
 61 |         Args:
 62 |             nodes: List of node definitions
 63 |             edges: List of edge definitions
 64 |             direction: Flow direction (TD, BT, LR, RL) - TD by default
 65 |             config: Optional diagram configuration
 66 |             
 67 |         Returns:
 68 |             Mermaid flowchart definition
 69 |         """
 70 |         if config is None:
 71 |             config = DiagramConfig(type=DiagramType.FLOWCHART)
 72 |             
 73 |         lines = [f"flowchart {direction}"]
 74 |         
 75 |         # Add nodes
 76 |         for node in nodes:
 77 |             if isinstance(node, dict):
 78 |                 node_id = node["id"]
 79 |                 node_label = node.get("label", node_id)
 80 |             else:
 81 |                 node_id, node_label = node[0], node[1]
 82 |             node_shape = ""
 83 |             
 84 |             if node_shape:
 85 |                 lines.append(f"    {node_id}[{node_label}]{{{node_shape}}}")
 86 |             else:
 87 |                 lines.append(f"    {node_id}[{node_label}]")
 88 |                 
 89 |         # Add edges
 90 |         for edge in edges:
 91 |             if isinstance(edge, dict):
 92 |                 from_node = edge["from"]
 93 |                 to_node = edge["to"]
 94 |                 edge_label = edge.get("label", "")
 95 |                 edge_style = edge.get("style", "-->")
 96 |             else:
 97 |                 from_node, to_node, edge_label = edge
 98 |                 edge_style = "-->"
 99 |             
100 |             if edge_label:
101 |                 lines.append(f"    {from_node} {edge_style}|{edge_label}| {to_node}")
102 |             else:
103 |                 lines.append(f"    {from_node} {edge_style} {to_node}")
104 |                 
105 |         return "\n".join(lines)
106 |         
107 |     def generate_class(
108 |         self,
109 |         classes: List[Dict[str, Any]],
110 |         relationships: List[tuple],
111 |         config: Optional[DiagramConfig] = None,
112 |     ) -> str:
113 |         """Generate a class diagram definition.
114 |         
115 |         Args:
116 |             classes: List of class definitions
117 |             relationships: List of class relationships
118 |             config: Optional diagram configuration
119 |             
120 |         Returns:
121 |             Mermaid class diagram definition
122 |         """
123 |         if config is None:
124 |             config = DiagramConfig(type=DiagramType.CLASS)
125 |             
126 |         lines = ["classDiagram"]
127 |         
128 |         # Add classes
129 |         for class_def in classes:
130 |             class_name = class_def["name"]
131 |             
132 |             # Class definition
133 |             lines.append(f"    class {class_name} {{")
134 |             
135 |             # Properties
136 |             for prop in class_def.get("attributes", []) or class_def.get("properties", []):
137 |                 if isinstance(prop, str):
138 |                     lines.append(f"        +{prop}")
139 |                     continue
140 |                 prop_name = prop.get("name", prop)
141 |                 prop_type = prop.get("type", "")
142 |                 prop_visibility = prop.get("visibility", "+")
143 |                 
144 |                 if prop_type:
145 |                     lines.append(f"        {prop_visibility}{prop_name}: {prop_type}")
146 |                 else:
147 |                     lines.append(f"        {prop_visibility}{prop_name}")
148 |                     
149 |             # Methods
150 |             for method in class_def.get("methods", []):
151 |                 if isinstance(method, str):
152 |                     lines.append(f"        +{method}")
153 |                     continue
154 |                 method_name = method.get("name", method)
155 |                 method_params = method.get("params", "")
156 |                 method_return = method.get("return", "")
157 |                 method_visibility = method.get("visibility", "+")
158 |                 
159 |                 if method_return:
160 |                     lines.append(
161 |                         f"        {method_visibility}{method_name}({method_params}) {method_return}"
162 |                     )
163 |                 else:
164 |                     lines.append(f"        {method_visibility}{method_name}({method_params})")
165 |                     
166 |             lines.append("    }")
167 |             
168 |         # Add relationships
169 |         for rel in relationships:
170 |             if isinstance(rel, tuple):
171 |                 from_class, to_class, rel_type = rel
172 |                 # Map relationship type to Mermaid syntax
173 |                 rel_symbol = "--"
174 |                 if rel_type == "extends":
175 |                     rel_symbol = "--|>"
176 |                 elif rel_type == "implements":
177 |                     rel_symbol = "..|>"
178 |                 elif rel_type == "composition":
179 |                     rel_symbol = "*--"
180 |                 elif rel_type == "aggregation":
181 |                     rel_symbol = "o--"
182 |                 lines.append(f"    {from_class} {rel_symbol} {to_class}")
183 |             else:
184 |                 from_class = rel["from"]
185 |                 to_class = rel["to"]
186 |                 rel_type = rel.get("type", "--")
187 |                 rel_label = rel.get("label", "")
188 |                 
189 |                 if rel_label:
190 |                     lines.append(f"    {from_class} {rel_type} {to_class}: {rel_label}")
191 |                 else:
192 |                     lines.append(f"    {from_class} {rel_type} {to_class}")
193 |                 
194 |         return "\n".join(lines)
195 |         
196 |     def generate_sequence(
197 |         self,
198 |         participants: List[str],
199 |         messages: List[tuple],
200 |         config: Optional[DiagramConfig] = None,
201 |     ) -> str:
202 |         """Generate a sequence diagram definition.
203 |         
204 |         Args:
205 |             participants: List of participant definitions
206 |             messages: List of message definitions
207 |             config: Optional diagram configuration
208 |             
209 |         Returns:
210 |             Mermaid sequence diagram definition
211 |         """
212 |         if config is None:
213 |             config = DiagramConfig(type=DiagramType.SEQUENCE)
214 |             
215 |         lines = ["sequenceDiagram"]
216 |         
217 |         # Add participants
218 |         for participant in participants:
219 |             if isinstance(participant, dict):
220 |                 participant_id = participant["id"]
221 |                 participant_label = participant.get("label", participant_id)
222 |                 lines.append(f"    participant {participant_id} as {participant_label}")
223 |             else:
224 |                 participant_id = participant
225 |                 lines.append(f"    participant {participant_id}")
226 |             
227 |         # Add messages
228 |         for message in messages:
229 |             if isinstance(message, dict):
230 |                 from_participant = message["from"]
231 |                 to_participant = message["to"]
232 |                 message_text = message["text"]
233 |                 message_type = message.get("type", "->")
234 |                 activate = message.get("activate", False)
235 |                 deactivate = message.get("deactivate", False)
236 |             else:
237 |                 # Support tuples/lists with variable lengths:
238 |                 # (from, to[, text[, type[, activate[, deactivate]]]])
239 |                 if not isinstance(message, (tuple, list)) or len(message) < 2:
240 |                     # Invalid message structure; skip safely
241 |                     continue
242 |                 from_participant = message[0]
243 |                 to_participant = message[1]
244 |                 message_text = message[2] if len(message) >= 3 else ""
245 |                 message_type = message[3] if len(message) >= 4 else ">>" if False else "->>"
246 |                 activate = bool(message[4]) if len(message) >= 5 else False
247 |                 deactivate = bool(message[5]) if len(message) >= 6 else False
248 |             
249 |             lines.append(f"    {from_participant}{message_type}{to_participant}: {message_text}")
250 |             
251 |             # Add optional activation/deactivation
252 |             if activate:
253 |                 lines.append(f"    activate {to_participant}")
254 |             if deactivate:
255 |                 lines.append(f"    deactivate {to_participant}")
256 |                 
257 |         return "\n".join(lines)
258 |         
259 |     def generate_from_template(
260 |         self,
261 |         template_name: str,
262 |         variables: Dict[str, Any],
263 |         config: Optional[DiagramConfig] = None,
264 |     ) -> Optional[str]:
265 |         """Generate a diagram definition from a template.
266 |         
267 |         Args:
268 |             template_name: Name of the template to use
269 |             variables: Variables to substitute in the template
270 |             config: Optional diagram configuration
271 |             
272 |         Returns:
273 |             Generated diagram definition or None if template not found
274 |         """
275 |         template = self.templates.get(template_name)
276 |         if not template:
277 |             return None
278 |         
279 |         return self.generate_from_template_impl(template, variables, config)
280 | 
281 |     def validate_diagram(self, definition: str, diagram_type: DiagramType) -> bool:
282 |         """Validate a diagram definition.
283 |         
284 |         Args:
285 |             definition: Diagram definition to validate
286 |             diagram_type: Expected type of diagram
287 |             
288 |         Returns:
289 |             True if valid, False otherwise
290 |         """
291 |         try:
292 |             # Basic validation - check if diagram starts with expected type
293 |             definition = definition.strip()
294 |             
295 |             if diagram_type == DiagramType.FLOWCHART:
296 |                 # Check for basic syntax errors like unclosed brackets
297 |                 if definition.count('[') != definition.count(']'):
298 |                     return False
299 |                 return definition.startswith("flowchart")
300 |             elif diagram_type == DiagramType.SEQUENCE:
301 |                 # Check for missing participants - sequence diagrams without participants are invalid
302 |                 if "participant" not in definition:
303 |                     return False
304 |                 return definition.startswith("sequenceDiagram")
305 |             elif diagram_type == DiagramType.CLASS:
306 |                 return definition.startswith("classDiagram")
307 |             
308 |             return False
309 |         except Exception:
310 |             return False
311 |     
312 |     def save_diagram(self, metadata: DiagramMetadata, definition: str, path: Path) -> None:
313 |         """Save a diagram to disk.
314 |         
315 |         Args:
316 |             metadata: Diagram metadata
317 |             definition: Diagram definition
318 |             path: Path to save to
319 |         """
320 |         path.write_text(definition)
321 | 
322 |     def load_diagram(self, path: Path) -> tuple:
323 |         """Load a diagram from disk.
324 |         
325 |         Args:
326 |             path: Path to load from
327 |             
328 |         Returns:
329 |             Tuple of (metadata, definition)
330 |         """
331 |         definition = path.read_text()
332 |         meta = DiagramMetadata(
333 |             name=path.stem,
334 |             description="",
335 |             type=DiagramType.FLOWCHART,
336 |             version="0.1.0",
337 |             author="",
338 |             tags=[],
339 |         )
340 |         return meta, definition
341 |             
342 |     def generate_from_template_impl(
343 |         self,
344 |         template: Dict[str, Any],
345 |         variables: Dict[str, Any],
346 |         config: Optional[DiagramConfig],
347 |     ) -> Optional[str]:
348 |         """Internal implementation of template generation."""
349 |         try:
350 |             # Get the template content and diagram type
351 |             content = template["content"]
352 |             diagram_type = template.get("type", "flowchart")
353 |             
354 |             # Replace variables in the template
355 |             for var_name, var_value in variables.items():
356 |                 placeholder = f"{{{var_name}}}"
357 |                 content = content.replace(placeholder, str(var_value))
358 |                 
359 |             # Add configuration if provided
360 |             if config:
361 |                 config_dict = config.to_dict()
362 |                 for key, value in config_dict.items():
363 |                     if key in template.get("config", {}):
364 |                         content = content.replace(f"{{{key}}}", str(value))
365 |                         
366 |             return content
367 |             
368 |         except Exception:
369 |             return None
370 |             
371 |     def save_template(
372 |         self,
373 |         name: str,
374 |         content: str,
375 |         diagram_type: DiagramType,
376 |         variables: Optional[Dict[str, str]] = None,
377 |     ) -> None:
378 |         """Save a new diagram template.
379 |         
380 |         Args:
381 |             name: Template name
382 |             content: Template content
383 |             diagram_type: Type of diagram
384 |             variables: Optional dictionary of variable descriptions
385 |         """
386 |         template = {
387 |             "name": name,
388 |             "type": str(diagram_type),
389 |             "content": content,
390 |             "variables": variables or {},
391 |         }
392 |         
393 |         file_path = self.templates_dir / f"{name}.json"
394 |         with open(file_path, 'w') as f:
395 |             json.dump(template, f, indent=2)
396 |         self.templates[name] = template 
```

