This is page 496 of 496. Use http://codebase.md/tosin2013/mcp-adr-analysis-server?lines=true&page={x} to view the full context.
# Directory Structure
```
├── .commitlintrc.json
├── .copilot-summary.md
├── .editorconfig
├── .eslintrc.json
├── .github
│ ├── agents
│ │ ├── ai-executor-integration.yml
│ │ ├── deployment-pattern-validation.yml
│ │ ├── esm-module-validation.yml
│ │ ├── knowledge-graph-validation.yml
│ │ ├── mcp-server-validation.yml
│ │ ├── README.md
│ │ └── tool-chain-orchestrator-validation.yml
│ ├── AUTO-RELEASE-GUIDE.md
│ ├── auto-release.config.json
│ ├── copilot-instructions.md
│ ├── dependabot.yml
│ ├── release-drafter.yml
│ └── workflows
│ ├── ai-release-notes.yml
│ ├── auto-release-on-merge.yml
│ ├── build.yml
│ ├── codeql-analysis.yml
│ ├── create-issue-on-failure.yml
│ ├── dependabot-auto-release.yml
│ ├── dependencies.yml
│ ├── deploy-docusaurus.yml
│ ├── lint.yml
│ ├── publish.yml
│ ├── release-drafter.yml
│ ├── security-scanning.yml
│ ├── test.yml
│ ├── update-dashboard.yml.disabled
│ └── validate-patterns.yml
├── .gitignore
├── .gitleaks.toml
├── .husky
│ ├── pre-commit
│ └── pre-push
├── .npm-cache
│ ├── _cacache
│ │ ├── content-v2
│ │ │ └── sha512
│ │ │ ├── 03
│ │ │ │ └── aa
│ │ │ │ └── 7fa6effa7f205c0354d1cff1aa5983d58a996b7ed716da0642f6aefd9e0342280791fd7de070475740797828d5d5fb7c20209d423e4250dc81ccea572cc8
│ │ │ ├── 04
│ │ │ │ └── 72
│ │ │ │ └── 7f10aaee348a897ff41a86fc704195caca0390db9ea6c9e37f130f931dc01ae6af8f8f24d330c78d402e03670e40c1fbde96c52b03a07aecd28ca970dbcd
│ │ │ ├── 05
│ │ │ │ └── 1e
│ │ │ │ └── 43b4d472f80b30589102c80d7baa1503bebac267acd73827e4418e734a66fde815546e9540bf4dd6a5c8dcc2d0b088b6c800dc7781e6c739c5d89f5107a3
│ │ │ ├── 06
│ │ │ │ ├── 36
│ │ │ │ │ └── ac5238b13c5752f8d2a4ca9732c8de4f9a0f373a5b2dd3e73abc6a2fd1d8b04c4a3a9a076a551ea1c5c12016e87842b02ced173ef4ab8627d4d50a3d19ce
│ │ │ │ └── ce
│ │ │ │ └── 31fb3fed118c646f6e00945cceb9a34fecdd5adcad388f7f5669a78f520f94152c7b9705050d2b75271ad435ef9a02ef0076d755fb4a971560ee12af01aa
│ │ │ ├── 07
│ │ │ │ └── 9c
│ │ │ │ └── 64367edfde90cc006ec5f3bb7de4729249d8a6109e6623a81d91a3352eae9898510906396501c4ade6c1218f61a2a89bbd181585d158fc7f4821631e91b3
│ │ │ ├── 0a
│ │ │ │ └── e5
│ │ │ │ └── 1eac2045db1c8aebb0151acc0ca1816a3be8edf3c55498ca5db667c882c91dcdb2d06b3275d5f2f7b2d3a899ac30a2eda148d0b6de8a8b7bab545b939c25
│ │ │ ├── 0c
│ │ │ │ ├── 4b
│ │ │ │ │ └── d5d99176af6ffadd5fad2bc850beb4766469f5d2cac76d7be24e572fecaa73c3c8d688d4ea6d58233b7218f11c6bace505f153cc410172b18618bf4619c7
│ │ │ │ └── f7
│ │ │ │ └── b9a5515a02c8a749a57a42343a81d89e7560dc4426d4ba241f41adb099657bfb10bd6c6ba5188f3e4dd466a059003da05793c0ab01b9e56362129e2278ed
│ │ │ ├── 0d
│ │ │ │ ├── 45
│ │ │ │ │ └── 89af7f942e9e335e6a25fd266415fdc91ac4bdfd222ff98dd1b7ddff5233e90e99250797f57abe0edcf3886d4b9427715782ab5ed90ed2ad4eb302ac24f3
│ │ │ │ ├── 6b
│ │ │ │ │ └── 4980e8d959c39aa171daa68623bfec5c3d968e5d78a0d9d2773930f4d67dd7e0916e81dbf5740ca364b6e316d1866355a0a728d2f4ab857acfe89a0fbc3d
│ │ │ │ ├── a8
│ │ │ │ │ └── 60c4a2eb1b2e30279d36798085e5e115a314910a1d1d21efb968601a78bfac7b2cca627390009fa368b3d36ef75f0f53bb7ab05a745704f5440c96bb70e2
│ │ │ │ └── c4
│ │ │ │ └── 630c2ba32bf90293f7147bc5f3f194a99bc992de634da6d6be8c6080e944840df92d94dbe6d7e22e67d7937036cd938d411f0a471de5be37594a0b3e333b
│ │ │ ├── 0e
│ │ │ │ └── 84
│ │ │ │ └── ba988a9e094e474eedc514f9cc47bab77688bad0caf4ecd3b9661705bc3adc6f0a83799741b7753ef2ac98f307f4b80126e8caa67cdd487afd1facf842d5
│ │ │ ├── 11
│ │ │ │ └── 3c
│ │ │ │ └── d5f5465209faebee25f63e9010bca5a554329ecb0d2da692e3f85001c26a19be9576bd25986d6d89965521d8cf21826a95862f6846645a97866ddaebc8f7
│ │ │ ├── 13
│ │ │ │ └── fe
│ │ │ │ └── 41ffc9210c7229cb80999a03c1c4ea99e9c57b3bad67b57950b352fd0d5e2c8599a3dac95f26e215279550e4c24123b4bf4164476ce6d5eea9277a2ce45e
│ │ │ ├── 14
│ │ │ │ └── 98
│ │ │ │ └── 584680da89ab5f12450af072a589c9aeff7486143e75ab78ad2831a8493cac4090677ce7315391b19e113513ab2807be8c6d3d0c06d9ca26e5f2031fbde9
│ │ │ ├── 15
│ │ │ │ ├── d5
│ │ │ │ │ └── 9bc5ffd5b08ba922af15c5bede73eff1e4e91ea1fe37ecfd69c1b77566679c911d4211fb42c58b3967095cd58dcbc24f20436f4130241e1de1468365610d
│ │ │ │ ├── e7
│ │ │ │ │ └── 70d1a66f921ca7a0f625039597acc080326fa7496759b7a973250ece93c4ba43e56c1e61e94569dd55127c05ed196e47cf7392d1607fb95ebcd770478b45
│ │ │ │ └── f2
│ │ │ │ └── a8e7b707e5e9518303c730748c6ee0a0140aac2c0c1c360e3a7e09c3973c78a2d38f23929df83daee2fe7aea3568f9a19705d2f5ce53d3a701c0498f3264
│ │ │ ├── 16
│ │ │ │ ├── 1f
│ │ │ │ │ └── 6b18dd0ca08e191543727c554d538cbd2d4cfddeef7fd0afb22e00366f04688f133c254d43cafbcc05a6e764f060316444009bd4da38d5ceaf8bac552097
│ │ │ │ ├── 40
│ │ │ │ │ └── 4cc03faa6c641e32ed5c3879ee181eb1e32ccf8e1a3c6a9e56b5b109dbaba6860a955db85e90a5103be85910bd6f53dd9adf01f0769d0701ca80505e620e
│ │ │ │ ├── 76
│ │ │ │ │ └── 62b03e9b3ac2ad016d1c2e26de5d25f280e9f820e5333eb411c7320ad87d8fd403b83797bb1f53c0ae988397e083c5a2c30338d5f551502047d079ad6620
│ │ │ │ └── 90
│ │ │ │ └── c3f63e1e16b74a41b3552260bcd4e17f30731bcbc70d5170b5b885b1514c6949190b345113994f940dd20289e16008cca66d9f36df967a08025e6ddc15d7
│ │ │ ├── 17
│ │ │ │ ├── a7
│ │ │ │ │ └── a82deef4e79206e8790cdfaf87f07ccfde91a8387651bafd6d2097ee237b48abea1f9d4c29dbfbf95578912441b579fa6312bc2cf178543fe8a663fecb7e
│ │ │ │ └── e3
│ │ │ │ └── 35b4b84efa695068e5aca44f16b2d83ecfa3f0c7045df2843c21771e5b3f7691f0266a54d17f4123ae8b907a8ed0b2c10f7c29f4e41e0886cd4af5643fef
│ │ │ ├── 18
│ │ │ │ ├── 17
│ │ │ │ │ └── 2c6f66933d8224db098964aaebb84a14c275ad10bda78ae0d6066b062e3f676c3acc3457d01605912d328043e2b8af2affafa904fb4205724e71d0189edd
│ │ │ │ └── cc
│ │ │ │ └── 46c566c580d2b56df24eb14f496c62d30cc42ea9879071b0028c9404d1cca53c7f27e7b05b92922605872b322b7e9109391143c39757ff9cee0c5ee96bd4
│ │ │ ├── 1c
│ │ │ │ └── fc
│ │ │ │ └── 29188ce4976f265b266a1b9da38aa0c9d76c1a3f5d4f6b5946a22c9490812e30b04fd2878afc2f3d7ac6d7af1b24cb9c1eedd7ddf14e7c9e6d128005a957
│ │ │ ├── 1d
│ │ │ │ └── 38
│ │ │ │ └── 605604f39c56109b865b34b66e0bfeb2f6b04d676074fbc378d1983d84cf2c58603121897c729da17ba39321fc7831535a0670947ab1bc2b11455a98dbc8
│ │ │ ├── 1e
│ │ │ │ └── 93
│ │ │ │ └── 21f3ea1a86621d3ae4b968528a63a3f2a20f8535a655fd7c893aaedbe18170b051dee7261f75b21a948e24def5369d20ea97b62c92652c787b11ac9a883c
│ │ │ ├── 1f
│ │ │ │ └── 1b
│ │ │ │ └── e177266c2b98bff3d459b4e608fa2437800ac9b4dd6e69f1b8cde4c8435319f627ca5417a0c62131c11ab8ddab308c01bbcdded77501b31478037d52a2c4
│ │ │ ├── 20
│ │ │ │ └── de
│ │ │ │ └── b0e0f4f8d27d6a4f04764ae0520cf3dd978c855f06065f84e0e7591f6e4fb14688f083a26c0ab279d66799273bce2f96abdf74c0a9d6db9b290a7443aaa6
│ │ │ ├── 21
│ │ │ │ └── c8
│ │ │ │ └── 4d7fa74de2d1e8305227ffb384f0b599d7d63aabfebb0667fabe719112ff1149b0556fd2cf27111c9f0adcc17ea2c52bda886a2898052fbb8612c57ad583
│ │ │ ├── 22
│ │ │ │ ├── 5d
│ │ │ │ │ └── 3e6e813bc3f5de6d41f2063ae813e0db072391191f4a2a6213cdb47b3324386a4a4e4583ff6666e102bd031bb466981aa83a765dcb6425bda8c9d90039f6
│ │ │ │ └── df
│ │ │ │ └── bd43e119bfcdc65fadc88ec5d0e51220fc5160d3683f632fbe344309e1ee65344c0125a61caa86902199070998d5fa2046a296ce310a76bda954f2ab7ecc
│ │ │ ├── 23
│ │ │ │ └── 7d
│ │ │ │ └── 11c9d3be6e79f63d0cedbe8db9b6cc0f1fec050637a1546b666a0914efcc8c7704f055fd76c2700e17e01e3fc4b637cc43fb950f6c686451f3f2bd3fa6c1
│ │ │ ├── 24
│ │ │ │ ├── 6e
│ │ │ │ │ └── 701d2dbef953d94fc775ac26e8374d60c74e5e221e452dab052146a41e5b65eaa638e4bba6b2be1ff23951e04fd0d7e3481dc3290517fc4f227d48d0063f
│ │ │ │ └── 91
│ │ │ │ └── 3565ad4d45f0f351efc14f7d18e388db111fd7528201d413f939472e5a090b71720982f2cd78636067b5fdb154787e13b0198bd5a97b086d7db432edb8c0
│ │ │ ├── 25
│ │ │ │ └── 31
│ │ │ │ └── 7df54ffa5c88c2068d30aa4539b0ad7482561edbb31146c7f0a22ab9cf338464b1d4dc0dca08c6b95ff6b37a4611089d0797023472b0174bfe5d1074f30e
│ │ │ ├── 27
│ │ │ │ ├── ba
│ │ │ │ │ └── 7ade1462023c35343130c355bb8b7efe07222b3963b95d0400cd9dd539c2f43cdc9bc297e657f374e73140cf043d512c84717eaddd43be2b96aa0503881f
│ │ │ │ └── cc
│ │ │ │ └── 7ff9f02546d7f9b76029a3c43c960234a1c7afcecf2b1219560c52a7796787359a0657587250b34bf3167b668259f47ba5b7bc63a8c09f7e808103fc5901
│ │ │ ├── 28
│ │ │ │ ├── 5a
│ │ │ │ │ └── 94f127c3ab2e4cf2543dcf54148bba1a2436a0fdb2befabecbbdd43c121d33494a8b14a0f401b1362d03d6063c01f93a0b7c5039ddfe45671cbbd31e006c
│ │ │ │ └── 86
│ │ │ │ └── 0b08226085f1d9c6a8d8044eeb132d0e06e4dde710874bbb47560bc22e4c7b4ad2286b1c0d5b784200b80452315f79193e306fd0c66a7fbed113105ded44
│ │ │ ├── 29
│ │ │ │ ├── af
│ │ │ │ │ └── bd4ebbadbfb1bc33a593e927a2456cfbf762b9a84a881841b35ca84013ac4e58063aa4f1fc53ef48637a0232fea4a9398bb2fed787fdb0d918a091e3ccb2
│ │ │ │ └── b9
│ │ │ │ └── b63de994402dfb4aa2bebf8c8c4e7f85ef10a2d1432f36a3fcc355a9b86f1d6c7a1d23df0f9cf31de30cf4450d8a753e0592af3c5c5d2740953da44fad5d
│ │ │ ├── 2b
│ │ │ │ └── c4
│ │ │ │ └── 318a283459760f3737be2a0420bf3bd97864683ea1b7d5e3552be33ccd92d13186a76151c06c0426cd1a9b440c2310ccbe2812d7bdd5a1189a3054915f04
│ │ │ ├── 2f
│ │ │ │ └── 43
│ │ │ │ └── aba62f2a1a9446fff35df87f74bc507ede21e7b9ed734921a634e38287518b27bad4295c15d87be28e9846412d949a15197b04bd560bf1608760afe7c6d4
│ │ │ ├── 32
│ │ │ │ ├── 42
│ │ │ │ │ └── 82c319574e0cfa085a09c77a42c27d3b18aa77ebe699caefeed8b9f656b0390dc7720999004840c14ddf31e708534102f90a261fe29ad728b72041dbf6f6
│ │ │ │ ├── 50
│ │ │ │ │ └── a0bf72bb8f50802b1bc27dcdcbb2b57cdcfc7bbb7a08fd31f5b0c86082afbed10fa778ad4970f5dd0917df0c0680c1f9ddcf6af8948357afa9178ccbe6c4
│ │ │ │ ├── 95
│ │ │ │ │ └── 043763a876d533c6f29097bd9c505ed14391221ec1af4ac546d226bd73945b5862f6088e02ec4a4f4bc513048a659e5cd988db95e7ac3e16e371cb7b72d9
│ │ │ │ └── fe
│ │ │ │ └── d03dc4f0f2db74f9cdcce912a7b1e396ece6a35e14ecbb79361548bf368e5efa879c26b1794557b4796dc917d1ce9eead2d58df006ed72fa7db186976806
│ │ │ ├── 35
│ │ │ │ └── 64
│ │ │ │ └── 36ff779dce8c7028d4aa782f582b6ea57d5f3314ae9c284778255b682c3024b33a7516328f5df85e55ab35fa0239880111b0ea824e974922956f42a65f18
│ │ │ ├── 36
│ │ │ │ └── a7
│ │ │ │ └── 29fade5c4c1f018a71646605e23099e2407d0fb14b76939d455216dd7de2af738002706dae427898ffcfa1d58bfa2b36b843b943ecf415d33d2889c13432
│ │ │ ├── 37
│ │ │ │ └── e3
│ │ │ │ └── 1e5d8a2aaf7a4e827f317f244f44437b8076a42d88e1b07856193ddf58088be08900b74883c35e108a2126d9b137d1ce575f9ab416d000dc22b97fdfc152
│ │ │ ├── 38
│ │ │ │ └── e7
│ │ │ │ └── 210e087817609c84e5fde1c455aa1bf2edbdc015bfbfad05f2b309b39866a445f90c8285958df9cb5a4462adf2c47ee0f8cac556d7a797cf0b778c723328
│ │ │ ├── 39
│ │ │ │ └── b9
│ │ │ │ └── a7205e215cd83506a8671e681b0c44c5f1d2cf0a08195818e441f859a5bb3366762eaf90d49634dc0878a2e4b0b7279134c9e3bfd4b20cc87f94bc7420cb
│ │ │ ├── 3a
│ │ │ │ └── a9
│ │ │ │ └── 4b2189b9033e8e0452f291bf1628d8a260a95c48549720363efa716f86c7a0b0ce583f321496abdf76a10a5ae3c37b4b158a6ae3b60487d43a3f2dc91979
│ │ │ ├── 3c
│ │ │ │ └── 42
│ │ │ │ └── 06098e6d4a552de7472ac8c5df0b35fea0e3ea374bee1aa5b36dc276c6f9e4ce4ab8ea83a9cfb7506930c175f2026f8375e3e1804540f0d97576378b6fce
│ │ │ ├── 3d
│ │ │ │ ├── 70
│ │ │ │ │ └── 9e407e6f3f59d8bf9189580edf77bce75b0d73d1eaae1ea7f0c20e364f8f0fa94d555a9a24e394123b4417de5981f73d033b4512e2756c93bb197a62d026
│ │ │ │ └── f1
│ │ │ │ └── 792d00bfabe4a782198843daef29cf196e00d6be6021d201339cc4dff8375656be6fd60ee482860da519ccbdda237852e681b925604272bb81d8d6f4257c
│ │ │ ├── 3f
│ │ │ │ └── e5
│ │ │ │ └── 6ed6a5dfcde7628ab987382df1286018799b4f715f60efa5fec60d850f8b58811ef57b0300df9637b02cf7ce188dfddc1e7d1a495f4c81720c22d5f5cd40
│ │ │ ├── 40
│ │ │ │ └── 6c
│ │ │ │ └── 5d5813cf17bfca0a5e9bc1958f2a9dcb625db6c63d171adcb4846a4f33b0a08a831263cdf57fbfa19f97a06866a6aedab04b56eee9f213f453da1fe24f3c
│ │ │ ├── 41
│ │ │ │ └── 36
│ │ │ │ └── 2e0deb12d15b6e1cd36f321f828e5289e0b26272408c500aa3944dfe8fcc3e465469c325f76a91102861736d919da3b5cd1b5b576be6d0a8813b1c85d3db
│ │ │ ├── 42
│ │ │ │ └── 9f
│ │ │ │ └── 166d93817be6e5829b944fe970db185e2cff2ad286ad73d5299a27a61080b11af14b6261e6f50a30559187b499466d2e80eb227789589a77fd9c5639ce88
│ │ │ ├── 43
│ │ │ │ └── 46
│ │ │ │ └── b3719a32898bc593e5539cc01a560fbb1f2e869f334b88933568e90365a6817382299f68b60d5533d4631c22fb0bb778f3473fea6ca5e4a0fa752e1a66ba
│ │ │ ├── 45
│ │ │ │ └── b2
│ │ │ │ └── 514b85164059331d34f057298c4d4bfc12a6213a9f1d38ebe22e3dae82d4e25d1691412ec62c6c594cb2f58d684c7a84827f9ce671992a4e5f488987d771
│ │ │ ├── 47
│ │ │ │ └── 96
│ │ │ │ └── 71f6670946a78202c3ff887c52b9e731adf421cb47d1a5282140115de89f3a26448a89769a3059920fa60903de08c132f78ce0990db0b1eb376340ad1d6d
│ │ │ ├── 4b
│ │ │ │ └── b3
│ │ │ │ └── 88f6f6507f3628937e2977e64b60c8827c40969944b9fc4872e672a4c1f1af2c8c5088ebc1c912b8d3b98ae381869d5b789210d4c5ce3976fc52e02c6f36
│ │ │ ├── 4c
│ │ │ │ └── 28
│ │ │ │ └── 25551b7395f7d137144c132477e831812c9a5ebac15c80c543f4f644cc02a752cd65282817e6ef41982d9883e2cbf4c8190ee80516cd5597e269e2dfcf1b
│ │ │ ├── 50
│ │ │ │ └── e4
│ │ │ │ └── a1b0fc33ecdacc52a851eadd215a315dbaf3b36edbfbb680c7d7f848adf44d2030679c159dd02c094c6bd3a67815966c0609d3fdfd997fb55ac3a9cb98cd
│ │ │ ├── 51
│ │ │ │ └── c5
│ │ │ │ └── 5f55f68ae127389bb5f77544a81e8a3340604415e0c2fb3568d3ab7df317bc0b31d265905e90d5c7fadbb435a947a25709fd0006a92e3a1de7fb41704833
│ │ │ ├── 52
│ │ │ │ └── a9
│ │ │ │ └── 3e82c7f2c883d4ae09b0914cd26570a6eb14a5630f94eaff12e10cd6a445b42447a99e88451a3ec2585462a33a0df5de21124cecadbcace20fc819ef6f24
│ │ │ ├── 53
│ │ │ │ ├── 1e
│ │ │ │ │ └── 328065acbb673b8ac1567bc62ed5896e266a95871a8ad9c2d735003901c0b741f6c636933b7eed18f1bff3d7aa572e7171658bd685dddf84163d0cb982e9
│ │ │ │ └── 67
│ │ │ │ └── 3524cf804eb4a5a184fd2a5cb1c74ff43800a3b0b150bff1e03d9b5c17b20da7ccc388c7b4370b9f56d1a4fb68322457012d332d0f98728b420a950195db
│ │ │ ├── 54
│ │ │ │ └── 76
│ │ │ │ └── f38d9361ee93db65ec9e436476815c59fa45ad7ba18f8d2784b84e42a140d509f482d9bd8985073bcb5e2dd7695ae91e0d118e2b5d51c1f9a50dfa4209c5
│ │ │ ├── 56
│ │ │ │ └── cb
│ │ │ │ └── fb9056979bea6d1c3319ee2cda46c3fbd0682b5bd341346b30b7d39969504b944d123690eaf1ebbf5465f217dafb3346b32b75b2ece9585ecbb260b1731e
│ │ │ ├── 58
│ │ │ │ └── 42
│ │ │ │ └── e747c96d01e41476955b36960cdedd5179094ccd826e3c32a65468132a18f093f6db9655401ad49693f38cdbc20d31d5f978e8a69476ddea6b767c28d38e
│ │ │ ├── 59
│ │ │ │ ├── 01
│ │ │ │ │ └── 3c1d8e5428225103af34c913eae58ea0145d6932ee45bbf5014bef3d76912a96fcfe1006fa88d749cc57d159304cb378a7d177c01699fdac050cb048ff74
│ │ │ │ └── 8f
│ │ │ │ └── f74d4304d31dca3d875147110926f5d11d5e0fc8fa14b31b596bbf25c08b7045044785dd94f713ac71a4ff6137fcb825c8023789385055121ffb16d0fc5e
│ │ │ ├── 5f
│ │ │ │ └── 11
│ │ │ │ └── 407da4bcd54592ed39c7394f97f3b2fb205152456ead1fd34f89b2645e365d41703af669ef2540da0d08c99e450563440dac5d917f71eae214069883e9b1
│ │ │ ├── 61
│ │ │ │ └── 3d
│ │ │ │ └── 46a8f48bf24267db47637a5317eff713469fd8f70e48647bdfc504d51eb3aa6b6c8c97b8bf51f32a29153957b984c8a4eb5158095e13503d5086f0f04ba1
│ │ │ ├── 62
│ │ │ │ ├── 00
│ │ │ │ │ └── 697491cfc90d94139c7e8654977277a3cc0bc3d1bdb65363ae00ffbc3a79494fe3e358fc6d8261aa28a73e4604cceb753d80dd18ceb61cef5476593fe14c
│ │ │ │ └── 5c
│ │ │ │ └── 559b200fce09df6b6d7d026e684db52cfed15974235f7ee9b98206b82334f452e29f9e014f64e554b3aa61020003ec3bc31df28911e4b58c3e60efce4577
│ │ │ ├── 64
│ │ │ │ └── 19
│ │ │ │ └── a11350bd2dc3e81fd5d949dc223ed6cf1d944ec009cccbe90815056b9cc0b16380ae765cf78013a9ce29607348ce8116a24f7b0859fa4ca265b66abda8ad
│ │ │ ├── 68
│ │ │ │ ├── 64
│ │ │ │ │ └── f16e96e0f3f6f925f5351d74ab6c7df05d9b8b3c970d11c65014cc4bb37a12ce0b55bba9c53e46db18652f05c523295d98c81f56c7169ba3e1c41fdb5c45
│ │ │ │ └── c5
│ │ │ │ └── 933533de497fc54cbd70cd6feb0b322bac19a5400a287def6dcf6da202936e4d5adebd8d659df4e6ff66c732eb11074d53cd8357ae000135570a67d2f1b7
│ │ │ ├── 69
│ │ │ │ └── e3
│ │ │ │ └── 661e70716e2d92b746aee950550bb25716584b94e9ef20895e3cd9e2c943400a5ce6b4050463cfe90622b78878ee7ce97003e736d3ff239e0a3bc5cae0f0
│ │ │ ├── 6a
│ │ │ │ ├── 61
│ │ │ │ │ └── 84cabafdddcaf7f155acaf643b8e274cf2b3b0f6d4e3f2b3966012d50d977b74abcf00e70cd30d7e604cffd62539a3825d5075b7190dda35e960c0c092ff
│ │ │ │ └── 6a
│ │ │ │ └── 5357458344d33ab7d8a6c73b040d35996b0669cdf7100c5a0f6f2b6eb79633dccea6546372802233aecff1d2f8fb786751c173855c3e057ddcc36f9471da
│ │ │ ├── 6c
│ │ │ │ └── 1c
│ │ │ │ └── b3af5f9ea75ce4e15b9b784555895e7ddafbb69471360596393a7cde859a8e3a0a2037cd3e98db42a8f9219f6824949a8ea715a03e86134a78410aaa4e5d
│ │ │ ├── 6e
│ │ │ │ ├── 92
│ │ │ │ │ └── 31bead3789fe943705d9f874caef524b87800fbe75e7b4373a5ce5fc515ab85d039597b970a24d00bc897e6fcce00b0ddf49a55364ca403cf6a05db2a61d
│ │ │ │ └── e7
│ │ │ │ └── b01f332f60bdbd8dd7904d520b79c49a64a9edfd12568e8642179396eb467aeff1a648b06438533baa1d4f237cc536d25b6992f9790bb5bcb7daccec23e2
│ │ │ ├── 6f
│ │ │ │ └── a8
│ │ │ │ └── d2bf1bd59f2a6d0222e36e458b13f94e9d1e257d3b43025f9e502ed1672f9041673ac11cc8576084eb106e3260f1736a888a1b430990f934f38597b7d105
│ │ │ ├── 70
│ │ │ │ └── f1
│ │ │ │ └── 8d93b90989f0ea548b6fee279cc7109402a57c6d1c0466f79c2f19c2e8f4579e1a83507bf35f7ef365bc35cbc4d80a80ec4f9c3b0613e85884fcee89f2fe
│ │ │ ├── 72
│ │ │ │ └── a7
│ │ │ │ └── 9fb91b21d76a56c86b08a0128903d96e16ede6471080f8e459bc0e24b4b4b322e094b56571188b978a01303b9ff2c1614c67640418a5af9191b5cc33136a
│ │ │ ├── 74
│ │ │ │ └── d0
│ │ │ │ └── 2fb0045ff1cb4285d2d1716050b44ab3155593ae35372fabc4d5ad65d2240e88fa417fbf25e754d5f01cce0b1b10b94de1db3ae6db536dec534b31fe7771
│ │ │ ├── 75
│ │ │ │ ├── 10
│ │ │ │ │ └── 7bf2cacdfe5ea0a96ba56a1f52af17989f179d7481b7d3e18ea8affd3a52d5c8b8371cf9ebe92a8e59358e5ca4700b6786602919e7d34db9282f4aba6038
│ │ │ │ ├── a3
│ │ │ │ │ └── a3f7440c563aba907ae0516c81759a218da2b906da1989ec63393ec9b20606733d03c27756cf1662a0525a68327d5efde0804d2937381f608cfcc872f800
│ │ │ │ └── c2
│ │ │ │ └── 855f78e7d0ca486978e2b2846f7b12095442b36aaef3dab64ac5ff8c4abf5391d9879ac5389b695c2e88eb8ff14797c9a4e55c4c99803e7ed4643ffde829
│ │ │ ├── 76
│ │ │ │ └── 12
│ │ │ │ └── 9ff74dd4fcf41963a6e834db4019d59b1bce5601b8d3ff5c58a19202ec5018d3259aa4e05056c56b0e5e7c5bcebffded55a4c341b5157831a5df74cc9214
│ │ │ ├── 77
│ │ │ │ ├── 62
│ │ │ │ │ └── 562c28af999613488a207bd32c805099aede7bd418a47161989230b59219656d3783946a99d83f2f0fc13f9496bc58659b6fb3e59bcfd725857b2091d967
│ │ │ │ └── 97
│ │ │ │ └── 4b4ed1a5c47e3b8cfe73cd5529ab55029854420395ff865b9735647a32741aa3ff3502cd830ba2df80b1bdee0aa454c8bb96de2db8f016f005b47b479357
│ │ │ ├── 78
│ │ │ │ └── c0
│ │ │ │ └── 6b11b047b69af1116cdc8c7416a1601f7402d3acda0d1bbbde0aa3dec9b8a3e7e9e626c78a8e7787d83316de4dc12ccd9b73053f7beb7a485de0d521975b
│ │ │ ├── 79
│ │ │ │ ├── 7d
│ │ │ │ │ └── b6e1fca9606766d0dde9da715c03323e25af187d1cfbcf8495257703bdb476d278f0aae4bbc55483ad6db2767f1381b31619e334c12071e1d137366b7b2e
│ │ │ │ └── 89
│ │ │ │ └── b441606d52b0566561b4777f3a386030d7a67df793e2395a3607b6e35926c779d1a5e5ed1959aabae6438681448d7ac1080e407d2126d383f24af5d84264
│ │ │ ├── 7a
│ │ │ │ └── 58
│ │ │ │ └── dc8040e5127b3fec05c5a2c0792bfda708ce0fec540f90673f0d62f2e6b985116bd96b21ab8a4d5df7f4086399c9e1ff58b15bc1900ea42691e7f6b21275
│ │ │ ├── 7b
│ │ │ │ ├── 0a
│ │ │ │ │ └── d74434c0a805e5925eadfdf91758d021157f48f8290a970eb38c4c24f3a4523cac19af7c69051b28eb9e5aa9869fc2d9dba472e3eada05ce677ac5d569b5
│ │ │ │ └── 82
│ │ │ │ └── 092aa37cb3662a311779faa568fb5378b34db475209553248505bbac1d4bffff9f78e6a241a159fde805f205a1d1a978290d0783e32a55f8cf71a357e93f
│ │ │ ├── 7c
│ │ │ │ └── 95
│ │ │ │ └── e3148786596741652419f62b7050f594580fe637e4bd092b38980d4dd6846c59e026e8229584e8b17770b35ad310916bed3729e9d0fc0db589153a3e0b29
│ │ │ ├── 7d
│ │ │ │ ├── 3a
│ │ │ │ │ └── fed3ed3b4eb6ed9e6214fac0edb28d53c3f3a08072b0fbb5f07feb16409c5e200137afaff9f0ab664666d2288c52c18936c0f3f1be80ece3d7bab2b1ae1e
│ │ │ │ └── ea
│ │ │ │ └── bdbede422630fa52908016aa17d4f671f25457aa01d2536ea80bfb35a8e4181420bdef7176655b118af4cf701de6cabce22e2129e1876139552b6a053339
│ │ │ ├── 7e
│ │ │ │ └── c7
│ │ │ │ └── eb3b433157ae199e8cbcfe5d6f5488e31dadbd499cb2a8f8100708620dc696f3025cd96dd7595386c78337a09067bffcdd519208a75803792f7c1b33fc36
│ │ │ ├── 7f
│ │ │ │ ├── 24
│ │ │ │ │ └── 088460e1cdf73da4ada41fa3e5f5ce010c919f3243ea932220603b61c8d628360df0561a0930c875f564b8529ff528c3c556936c4f6ab75a65e7d8dd66ea
│ │ │ │ ├── 41
│ │ │ │ │ └── 45a4875c1e09fccdc3d26dfd5d45ebf0b74e3b60c9da889337bb6c3645ec2b07e7e86ffcde3d972b3b24282cc30eeda04875d2dc40810ae5d62390b9c6ad
│ │ │ │ └── 72
│ │ │ │ └── 9d5113edc958d59fe45617ba62bafb6c0cfc8e074e5fd0fd94df0768ab589726b5d3dcbf315addd14f7e6f4fd37eb139796bf15d7b27a9d3fb25c6f152bb
│ │ │ ├── 80
│ │ │ │ ├── 13
│ │ │ │ │ └── b20a2571ad76a461bb0810cfc3ee5ab35d5d27837b68b7ebba141ab227d0aebc3009ab0f979b11f9f2919bfa1980466cecf60f5319d18e8c6672ee5ce16e
│ │ │ │ └── e2
│ │ │ │ └── 879241f4307f0e5a82afac4d57ac9a294e7152edd7234c37cce8e9991e85f545996c735b8d146092668b171ca3639638f4b661454f0a895195085cf04fde
│ │ │ ├── 81
│ │ │ │ └── 34
│ │ │ │ └── 2159872524c81acd6fe2bfecfa09ae0309057356f3cd16746072e23309de6079f18391e5b666a924ddbd1848ec65924e38b515318909593644389af6a8f2
│ │ │ ├── 82
│ │ │ │ └── 06
│ │ │ │ └── 35fc6a4769192719292c0abf2b072d271c2aff9c6977daed1b00ca945ca4350ec4f88cd6d5c213ac83647a105b42f59605fcd1826144b5ee690a06d17cc6
│ │ │ ├── 84
│ │ │ │ ├── 79
│ │ │ │ │ └── 4d3a41a02d827d4087dcd49a2f9328190acc7549f0033f7d81c2886e36003dbaa4254da63c5adca84d9b69b4fdcc27aaa8ed08d91be06ec61f2855ed6a8b
│ │ │ │ └── b1
│ │ │ │ └── c971ecc90c5fac945891d7d8677fa7178bf6fccc23b853378d0d5209bb8150d0c7e968a5095df5ad6049e82a07d6bdc52cd310f81f211930b9c3e66c742a
│ │ │ ├── 87
│ │ │ │ ├── 51
│ │ │ │ │ └── c8274b42245cfba0f50963b50f4e0c1822647ef67eac0b1f19aef5f2be17651e402f82b24cde8aeddfb34c58b02a07ba6605fbc37f987cd1a4c706c553ed
│ │ │ │ └── 71
│ │ │ │ └── 5b8ac6b69ca18fc42a66f3d1e4df79412ec9da181bdcb50a2968148e5bfb88b3a1537b5013c809ca149af356cf6fa4676c4deef7585dd5e2522c93819a73
│ │ │ ├── 89
│ │ │ │ └── 83
│ │ │ │ └── 4ecc75316bff72be6a6ff571991467ee0999b790cdc344e13b9b699401301382e6f36f484e96b62191c8600c9ef62a15d3f2f7c2800e1b6ffef0db64cf8e
│ │ │ ├── 8a
│ │ │ │ ├── 4d
│ │ │ │ │ └── d9802f5d63f95855533ef8e212b1a6037a0d6d6f456d3f9b8bde8ba1d64a0639a50c0cfa5b1487a2e099058a659414f9fdd2c6cc34c5d000854e96760a24
│ │ │ │ └── 97
│ │ │ │ └── 1f9c6fe9e382d2b35525df2f2f42927626596f77609512fff85ab306c45b554a1645809137769b0f9d225c5dd00ecbfb1208bb9417a6fe6eed3f8ee575d8
│ │ │ ├── 8b
│ │ │ │ └── 24
│ │ │ │ └── 57649cc4cc2d8bfaf6bf56dd7d3ee5000820cbdc9b7a9a8699063ff5b0cc59d283f106057e573a80b237c49f1f7316aad99a7fa500c3467d74720661b904
│ │ │ ├── 8c
│ │ │ │ └── 28
│ │ │ │ └── bf40a50cdabd49bb96b727ae131f60394a9280821d0ba649f2a9d4389ba0c2574c49d871b5c40451c0d18f41f8b548b74b599d4e273e85e0e30104d88624
│ │ │ ├── 8d
│ │ │ │ └── 02
│ │ │ │ └── f79519e871a16dbb7574d094e8633ff8424356b30c628c368254d6518914cedc74032ec76ed59b66214bd5e323e9fabbd69b98f4cb44c6fd2eb572e8a34e
│ │ │ ├── 8f
│ │ │ │ ├── 45
│ │ │ │ │ └── bda0c24c37e625fa1587c9283016b66e926b7cd38cd4f86790f318b07d951687a9f63eb43e5f07d589e09df82b387ee6d19016db83ecd7126329377eef45
│ │ │ │ └── 77
│ │ │ │ └── d52e0bd3a39dbb6a7c98c893864d825b1bebe79d062f1349b99a691cd532be9f1029a6408b3082f4699e1d6e55423681928619be933138654ca4068320e2
│ │ │ ├── 90
│ │ │ │ ├── 0e
│ │ │ │ │ └── 56428355a38b7d94dc769103450b129e065e486db48d065d4cfed2e4c3d5829fe871341016e5087c81d86ceb70899e18c9db3416168a8f24fdac2b5015e4
│ │ │ │ └── 69
│ │ │ │ └── 067a0608750b0e6f85e3b1f33deeb5ec887681c1ca3e84523aea83b8b3d2d4f8f2c00b9a09ee485d395171921b2695ba54a8302f5f0d750a5b973fe8e41e
│ │ │ ├── 91
│ │ │ │ └── 11
│ │ │ │ └── 91670ddb2e5148483060c13480d5330114de89e865837ae6e60c4dc017edfec972fc8535aff2be6b90b6ea6176384633e4fc4cc79c2948df341fd5c1661c
│ │ │ ├── 92
│ │ │ │ └── bd
│ │ │ │ └── 17dbee98cbfbc9ccb60950f09911cf127d071ffb508e16802a6ae266ef8ba6421b5af4cee53491cfed0412def92f7062d051b5a9333c2b5d8c2b633b4728
│ │ │ ├── 94
│ │ │ │ └── 6e
│ │ │ │ └── ccd41785b69a3cbe6733bab9c3cb8311092f5d44d32d9d86157b712c156f3dc877209bed0d1511c6d366687506a1b17ccd1f1fb86fac924ce266825906fe
│ │ │ ├── 95
│ │ │ │ ├── 88
│ │ │ │ │ └── 86f66880d649a434abc280f67605abbb47711d06bfdea32cea11a9429704d0564033bbe4f9d5c883412b9525389f7f29fc9865f553762c9f263680b74248
│ │ │ │ └── cf
│ │ │ │ └── da6a19feb78fd2595fea726ba6623ca62ec59f37710b869995b9416382c391aeeb993d54b0010af2abe1c71af3bf488d8a557dba6f1f849fece133c83c85
│ │ │ ├── 97
│ │ │ │ ├── 2b
│ │ │ │ │ └── b13c6aff59f86b95e9b608bfd472751cd7372a280226043cee918ed8e45ff242235d928ebe7d12debe5c351e03324b0edfeb5d54218e34f04b71452a0add
│ │ │ │ └── 9b
│ │ │ │ └── 930ca6e7be7018e79ca9e2f88256e0094e45700f6042e4f4b7be887dc897ddb413ed3d5f1c7cab977e75d565d9d5a36a2335aab01309f3246a780e66ba06
│ │ │ ├── 98
│ │ │ │ ├── 9a
│ │ │ │ │ └── 68e84545cf186953b6927c75871a5e5f661d07ef805b585fa7c3a0c5be109626fd58145345d8bb858e94e1b66b59937dc1c3d4eb628c1c660dea5c352de7
│ │ │ │ └── ac
│ │ │ │ └── 864ad4b45e218c1f4de4d9f3b6c472c17387abd03684f2342e86b2ad5e72f68852c8c6e8ecce321554dbbecfb4675963f590d69a590ed55a1a6caef56aed
│ │ │ ├── 99
│ │ │ │ └── 98
│ │ │ │ └── 448f12378f9292ce130fc418d98bbf63a156f6d27e8eed850861153c0edcb5e811bad603432cc61b4f94549f2d43e8c48367de701b7ae30eca763af6018a
│ │ │ ├── 9b
│ │ │ │ ├── 3e
│ │ │ │ │ └── f67c86d00bc662f0c2cbed99d6642875488172be12158566b611303af794512f2efbf85a10234e59382d58b563f336d50407396c650a1f409d4af467e88e
│ │ │ │ ├── d6
│ │ │ │ │ └── 15ca4945a64c3bf495423b7131b87e3a97bee25d335e002733b2994ad038333639a7227df838fbdbb1c2c77dc3c1de199a53731445c081b4fd0c6973eade
│ │ │ │ └── d8
│ │ │ │ └── 13c11921cb696f08f7ba409a787771b54d81141e7fc5cc952dabd3231f8e9a9f5c0953e19da060b954ba1ff115fc16dfc3969b21029921b300cb6731c871
│ │ │ ├── a0
│ │ │ │ └── a9
│ │ │ │ └── db845c91217a54b9ecfc881326c846b89db8f820e432ba173fc32f6463bfd654f73020ef5503aebc3eef1190eefed06efa48b44e7b2c3d0a9434eb58b898
│ │ │ ├── a1
│ │ │ │ └── 16
│ │ │ │ └── 42c6790ed2f6bb0d8a2fa3d42ec39ae52b1f8c51fd99266c3eb50ad3f93da11c955666ddd334a871eb7e5d32df2d95fe4b411dc952edc2ec440075d2e4c7
│ │ │ ├── a2
│ │ │ │ └── 81
│ │ │ │ └── e7e49fbe8656a387fddebf50395ed76f90be5bde0d8da3e071dbaffa84d3fe80032b33ce9dc72a6feccd310b2b6c0ff2cb4e3b96afa5f64be198029a2977
│ │ │ ├── a3
│ │ │ │ └── 07
│ │ │ │ └── a03949db85191d4909f468f63cea33e3f1165e5851039ea92a6fdfe71c1a212684a0e979a2c59001a5d077f9627e64ac9808c3c23101d3e903dd678b2360
│ │ │ ├── a4
│ │ │ │ ├── c8
│ │ │ │ │ └── 4e7c50cf8aff6de638c85e41e8b169a44b241bbec80454d933d044476ee2e1d93ffb8f832aaa9cf9db715ef0c558f3d282e9287f41f4b6b0cf928e014373
│ │ │ │ └── d8
│ │ │ │ └── d31dae18a09757cdcfbf9ddfbba4eb2ced665dbc390b2319d6d3458cfe3931794c1bd7d09c8fd0990c0a836ac2b52e4c7a32da40824f2c2e9ad2828e9633
│ │ │ ├── a5
│ │ │ │ └── d9
│ │ │ │ └── d16d0e1c40b653ae71d75bbe980854d13737e87032bb5a41cab0335e2c19e80fdd1b630c2916090388deafd50c7901422926898f1dc9ee2272e2f790c246
│ │ │ ├── a6
│ │ │ │ ├── 45
│ │ │ │ │ └── 2e8a52ed9bc6f424126dd4d7da19cb119632aed03ca6dd744311f5edcc3b07a99242b1ac823c861dbc4ccb33ef1cc3f1b4a158438644851d2e6cc467b931
│ │ │ │ └── 5b
│ │ │ │ └── f44a23e04004f4fcb8c2d0c986b28a3fb1da52e95e13a4e500c4ee09dc39ef9cb2da2279cd87d8625354a51a00a3b11bf49cdf53bd7f69591a959d91fd93
│ │ │ ├── a7
│ │ │ │ ├── 32
│ │ │ │ │ └── 6ad76b4469a221aa36f3a42baffceca9258fc13dabcea1f9be75b69bf8c1cb6a3cb6efbfb594b9ba245706805e5eb2427a9aab868ab857636183ffcbbc52
│ │ │ │ ├── 7f
│ │ │ │ │ └── 3b7e7150102a863fe3f0c7edf01b5ebed441e1c485f1b97a3ac58ab37da80e535b9cde6231a3b7f09c4b2f1b566035d0610bfe0557ac9ae62216f1c01a50
│ │ │ │ └── d8
│ │ │ │ └── ff298663e8ee2d918a19a0a00435a7537ce757a337e6dd8597e213c9e56d4ce61b5be30c4b719c5054fed981c51f78a88f5389a1922dab4dcf5248e83c4c
│ │ │ ├── aa
│ │ │ │ └── 90
│ │ │ │ └── 80bd197db2db8e1ef78ab27ec79dc251befe74d6a21a70acd094effe2f0c5cf7ed2adb02f2bf80dfbedf34fc33e7da9a8e06c25d0e2a205c647df8ebf047
│ │ │ ├── ab
│ │ │ │ ├── 20
│ │ │ │ │ └── 87e36d5840f4b65850f10e37ed7dcd5947958a433573aaca789fd3369108553a8fc1c9a845a143497e5e7c90e70419f43fffbc1e1530e19beb2cf0473183
│ │ │ │ └── 90
│ │ │ │ └── a0dc68efd52e822d9d3b85754d0fdfcbf354308c8deba163bd0d9a25aa2ff3ffa91a4f516c78729887b3f82207b16c569db31b0fcfda64172e02808adf01
│ │ │ ├── ac
│ │ │ │ ├── 1c
│ │ │ │ │ └── 7865a5ac22a0bb027fcfbce2f71d4397d8847e951d782302ffd6e7dc65b329403a8408bddfe2410655ebc3a9e60ba4322b2930e6d32a039078654b548e94
│ │ │ │ ├── 51
│ │ │ │ │ └── e187fe9d41cda368bfed295f36e4ae7ad00117f4fd4cabc1ae41877ea3efc3cb5e620033fcab4d2b81c9906697165c165c9eb06d09c3f255e6bb627c3839
│ │ │ │ └── d5
│ │ │ │ └── 1ada8215399d75d02c07b0f09d6312f36af582cf44d1c5602926e26a7c8ec08371d2d44f9d457f4118c891f13f54ee29cc1f09f193c8a7148fddf9901d61
│ │ │ ├── ad
│ │ │ │ └── 48
│ │ │ │ └── d0a32ede8194fd5d855704ad637bd724067369eeacd164e84b431e51704a767421a55e8fa6bfabdfec09b82e29847050492086734867e04ea73d402acf4b
│ │ │ ├── af
│ │ │ │ └── 39
│ │ │ │ └── 5d2143741ba08238f96ddff36759c58c63b72cb2ace9b9d61da859fad9b26bb3996e4ff4755f8d512979dae21b107a1b67fbf120fa53187890dd08590d35
│ │ │ ├── b0
│ │ │ │ ├── 69
│ │ │ │ │ └── ef6f9766ac968a119f8b0c8a60baf757ddb0e5125966bf8fc2950f5ac1c98266b971e63432c8c58533990123e13234e0830e22a4f22974cdeb97dd9960ff
│ │ │ │ ├── c0
│ │ │ │ │ └── 6287fba94763d8f3bc9319dc82b1dcedef258efaf60c010e7ed197574d26380855104a640b6e1789895d846c1f52d4eb20267e7c0f1fc6687bdb0502bf99
│ │ │ │ ├── c4
│ │ │ │ │ └── 86eae8813cc26b7dfb5c095299e8d9b392c4d3b26e95a0736a0e93e14e5a532b33da47ecb9f8c6756f22a21ea62399d17e15f3c3819ecaa7043faa2e8914
│ │ │ │ └── da
│ │ │ │ └── 8dedbdab711791e11403743c443259923b3cfd3c763ac2b6dac038489319c7af46f4e0247e6e42be79aea56dc8e06bb9181ea26bdf8bfe4ff5e3ceb61c32
│ │ │ ├── b3
│ │ │ │ ├── 1a
│ │ │ │ │ └── 7f56449634bc6e62aad466db2af6562e57fda7258e005182788e3cd7642e657eb8cc865a4aaa3e607779c9076547a315a3328ee124b9c3d889af9f2a814b
│ │ │ │ ├── dc
│ │ │ │ │ └── 2c7145ba3c560a768d1533825be8d86c4f0afbf5ab6f4e664f0cd18f995a035188194d8495b01f2313f3cfdabbe528a40ef97c4127901e9e647b28e19f5a
│ │ │ │ └── eb
│ │ │ │ └── 39f998983a92db61bac89488a0adce33ed82cc1956815b337a97ee86515ad142f4d3d45ad1e332c7c5713591623b4b4017b0fd21eaaabe2843c2c69fbeb9
│ │ │ ├── b4
│ │ │ │ └── fb
│ │ │ │ └── 863930d065d0bb76f5651b3768e84387f4152d72303c3bd9761825cfa8c81d4e2c9c938025b8679f319c4b8d611f9626ba4d029f8475dc6ff586fe5979fd
│ │ │ ├── b5
│ │ │ │ ├── 37
│ │ │ │ │ └── cf317838766ab773d9617270de8511dd367bf7467f2b2288457a4bda388fdd00f3b1dc6a77e57848299423f08c9195f61ce16ae9d89f77798b9bc8cc57dd
│ │ │ │ └── 8e
│ │ │ │ └── ec56dd722fda33231be66ed379aad987da4ad770109f8c488280a18baae9c91ef82f646d8f725da843791b7190116f50461077642f371818ef329d59627a
│ │ │ ├── b6
│ │ │ │ ├── 3c
│ │ │ │ │ └── 0ce5ec4c83a046448fa43664e7b4db2f7594b55fc045612ead9c9da1747d2457133afde559db1cbe16a4ad496bd89ad7c53032c8c6eae8ac7c0329f0f3e5
│ │ │ │ └── 47
│ │ │ │ └── c51185189afee296af509cd342d0b1db64f8e4429ebd9b6a73eb6e59d67b5aa459b73c785beab5152061562876c7b4f09cfd2d913c0d1fa4e78814d23d63
│ │ │ ├── b7
│ │ │ │ ├── 63
│ │ │ │ │ └── 839645c14329fb8e497a4cd6b0fccb55115bc819e9490c21b8d4e92afcac14b090704385d566c1c055490ae2606fddec22012dcf1ae516b98d81a0ae1953
│ │ │ │ └── 85
│ │ │ │ └── 3df3088c6764797e7a179e32a80030fa7cbf022fef63c8c7f3ec5a65aa06d7ca593d705bde0d7b806cf0f7f944fdb66541229b42fe8d10525f7d39c896ce
│ │ │ ├── b8
│ │ │ │ └── 24
│ │ │ │ └── 3c28a65d120aeac2fb2d4de11c5f6593118bb868cbc14a7c4c3c8c10a707a0d9b55ff09e592f29a2f3f2075cf6d3db5a2a9d1edbf4e9dce27ae4e5b903a1
│ │ │ ├── b9
│ │ │ │ └── e1
│ │ │ │ └── 1ea67ba3a6a79eda8e5a2189ef1d4e82d00e3630d76c2037aacb907276b92e0b947566e5059e6dbb11e1491a8107250827dee95e46f9935da2607d76ede2
│ │ │ ├── bb
│ │ │ │ └── cc
│ │ │ │ └── 7c0db6fc0e8b37e0cecdf29e1ee0017ef818b50fe96af9d9110af2e2e50b9bfdd23be59ed84c85c17b30382db2084a5cbe11c9f4e5f7687f3670ab23afa6
│ │ │ ├── bc
│ │ │ │ └── 5b
│ │ │ │ └── f1455b099cabb9d8a6727135517bc28c43a223700d02c2cea588290de796c471d64d7cc6c97b7b6483d75b3fc88fedce342dbef7bafbcd492b7596a3134a
│ │ │ ├── be
│ │ │ │ └── 60
│ │ │ │ └── c3d7e8b035532cd971773988d125be5d9f3a7a698705b0a413fd08f7a91ae9efbbfab450561406f519cbe50fd85e2505f8be0a06dad1cc9e82b0c5a61a1e
│ │ │ ├── bf
│ │ │ │ └── 18
│ │ │ │ └── 54cb827c9727b28a71fb033975a5d778dc6261647fed3f6c1e37c4e7b506e5398f80d176d3f03264d7fa023ee38eca0fc96bbe7bac6d028077160bc39f30
│ │ │ ├── c0
│ │ │ │ ├── 0c
│ │ │ │ │ └── 6be3097ad962bee4229c4963415041ba3e48c57906c8c41a44937e26387be6882937d0d4ecc066ddbb4d152f7b2470c4b1448494dbb0a965e9876f6159f1
│ │ │ │ ├── 16
│ │ │ │ │ └── e9bfe3507ed1c3746f3a41cd292325e4e48477b4cf157749d62ca0dc5fc9cd9f89d714e170b0abaac36a2403fd43fe6a5a0249aeca776b3c94d80cd66d17
│ │ │ │ └── 1f
│ │ │ │ └── 0e75de3b862a4efcce4709d870b00fe43a864938289e23df5d43fe767ff3b8e2581e0eaa4feccf7d226fea861e9fa9f59a0e0470e42d2929412aaca5ae8a
│ │ │ ├── c1
│ │ │ │ ├── 2f
│ │ │ │ │ └── a1020252851d0a844bcf240adfb8f54dd7e1f3d6dd18ea7e632eb1906e46f8bab80f13fd11bdefb590c075bffa16807826e1621c57e8bb176a53563fb689
│ │ │ │ └── ae
│ │ │ │ └── d88f25067cd667808fefb4ad141c037e9600c2c413c2ca55571a9d33bb9f45cf96a21ad3576aadc3848a2fd3adcca2b07e55fb9f2e1dc9945d8a7532b7c6
│ │ │ ├── c5
│ │ │ │ ├── 23
│ │ │ │ │ └── 32519743bdedde63440ebffface305fc949686914dfcc2075cb850df6d2d7e4880f9d2c802eb2a8dc6d157eb74cb4442d5b2280cc8b486369e7e83e7d1bc
│ │ │ │ └── b6
│ │ │ │ └── c21f9742614e53f0b704861ba1ec727cf075ee5b7aac237634cce64529f6441dca5688753f271ce4eb6f41aec69bfe63221d0b62f7030ffbce3944f7b756
│ │ │ ├── c6
│ │ │ │ └── 4a
│ │ │ │ └── 67867eda208dceb36587eb399998dfd962207f9a25345a6c58e4d905c66c7330b2808b28d74afa4d79e91cf4d17769eb04d23d57f905b347b51db9143e02
│ │ │ ├── c7
│ │ │ │ ├── 94
│ │ │ │ │ └── 4bf58da9e7e4a1dc3dfc161f62fe243964af9ee31b9745dfe919b3380f5ded828fcc1b06edb5493c7a6cad72bd58633058b3e6a99d49e00431587e98cfb9
│ │ │ │ └── 9c
│ │ │ │ └── 4fab30e96ea730f3dd6b17884ae570f6a995a64029b6f853539b45c9fb64aa09540c15d496b4035a767b9b922f6c61c05ad88cba5a2e82f1cfa0a26c605a
│ │ │ ├── c9
│ │ │ │ ├── 0f
│ │ │ │ │ └── 42a371464ab760d591f588236bbdb498921141ee5849b2f5dfe4ce0e73fcdf4490c75edbfc83d0ca321b2b502c8ec705d8e66dc9414c5792531d550ebe2d
│ │ │ │ └── b0
│ │ │ │ └── 7244d7a1418095d97556fee24a89d1a3715b1b33d5845c4d53389f9dbcc6f9de8e2f983971f95732a5a2b90f1bd0d170d34359cf7dd294eb7a72f30a3002
│ │ │ ├── ca
│ │ │ │ ├── 87
│ │ │ │ │ └── 4a20524d4b42f751277b655d217ceeb1056a3c4319403050c7c8ff0667257b3a951e95ddd1ce7934cf7d1593e4af44057aa38fdfc44c54b3b33453189c66
│ │ │ │ ├── 97
│ │ │ │ │ └── 66254fd36c16f2d83c626eebfb64b5b706cd5012633b9c78c400d7e88492ef1345d5ba38ac9f5a8f25c67183ea83b9cb2bf9b3fa7cb0f5acf4b702127b11
│ │ │ │ ├── c4
│ │ │ │ │ └── fc9a1762c562ba1f0de2d55d80791a99e567d78351b8de6aa86253369dceb7f3c16ae63717cabe6646ca9588bc7f18961da0bd1b7d70fc9e617e667fc8a3
│ │ │ │ ├── d4
│ │ │ │ │ └── 080544005e733d3410ee04a580ae76e113c7c96cf6c46ef911e81db70436e4c5e31aeee0c4390aa643707d5df971f8f640d2b3cbbe2d6ba72d998a391b9d
│ │ │ │ └── ee
│ │ │ │ └── 294450a70a4b84bf3b89e152404c8f083f74a4ba786211b0155a743137bbf8eae432a8c53c73d6901f31714e573a3eade2972c4440e3a31bf1c8e3cbd1eb
│ │ │ ├── cb
│ │ │ │ └── 86
│ │ │ │ └── 2d309376a857f6fcfc38277e510b28f343876db7c89627103f93c9e61d4b32837103654fad9dfc59b28e3c41256aa36b70d43f5ca9e1d686c000cb8d04f3
│ │ │ ├── cd
│ │ │ │ └── b0
│ │ │ │ └── 7dac22404f5adb8e25436f686a2851cd60bc60b64f0d511c59dc86700f717a36dc5b5d94029e74a2d4b931f880e885d3e5169db6db05402c885e64941212
│ │ │ ├── cf
│ │ │ │ └── 87
│ │ │ │ └── aa26f7e236714c1c822f5cfdc2639ef2d9626ce60dafdd7d339bd984264ae436fe2b0f1bbeb20f4987c1245f27aa06407b48e71ba28f5d315aa1cab00222
│ │ │ ├── d0
│ │ │ │ └── d2
│ │ │ │ └── 50e0b14552e5a413b3b17f486d04a4baccb9248c11fe84cd6e93b360ef4e51791f26fee7a576ecb50c1a343f20573ca567040e9806553de0c0465eb4810b
│ │ │ ├── d1
│ │ │ │ └── 1f
│ │ │ │ └── 629116faebc1c1ed00f14f5be4a6e501b6a739dd8c80c0cc0679414a4688d8fcd58abdd67ef5462d45f1a686a35b4644d256931b9b28578a9145bf671bfc
│ │ │ ├── d2
│ │ │ │ └── b1
│ │ │ │ └── 60fd18f643ad8d0a6eb68d9c34417edadeccfa402414d0ba5974dac95fc6f2446686553a9bad6f630282001f2310aac369799f356204a2cceb79597ab43f
│ │ │ ├── d3
│ │ │ │ └── 40
│ │ │ │ └── 2ad23a9449077c89d8b4bbd6bf341d1ea1cf3711c191c9e4bb1f529d607c1f16c85709b8afcbcf0beb01181c36cd694b424413bfb590016508a7b4c3b0d2
│ │ │ ├── d5
│ │ │ │ └── 41
│ │ │ │ └── 16457ea39ce036cb81f959ccd9e3880e3a34c49a5aafd6e356e0600910ee7e6dab82061bfcb2763ae48c39fd5392fe084a37d82bd8a8e72cac6bb2fa0c57
│ │ │ ├── d9
│ │ │ │ └── d1
│ │ │ │ └── df4e80a3fe9cdc6b60a4ef6e0e6792f4115aebdde1d136c1bf6f7c5024b036859a55092f7d6cb017fa19b52075c3127cd4e9bcb9cffe4c218efde3f6bc35
│ │ │ ├── dc
│ │ │ │ ├── 17
│ │ │ │ │ └── a5b7ab5d73c6cf800b5b72676d349962ad5a139846f97b6802f783e7930116f6323a0801d47a81bce6d8d63f95aabaa7dabe832d330886e0ff76e9928ab9
│ │ │ │ ├── d6
│ │ │ │ │ └── 84b678e2efff1539dd12f7425ef76630d3778113ad0ec39e45589e122824507d3a7094f30c0542a0834a23f485fdd982d6bb91213f5ace9f249af4b49c6c
│ │ │ │ └── e4
│ │ │ │ └── b3dd369c516cb85ad397577f03820c31a2a24ae3e78390d325e59fcc2596a850f68fe3ff657fcd715cc7b523645e4c0a6dbdead95296cf638c16c16c8be6
│ │ │ ├── df
│ │ │ │ └── b6
│ │ │ │ └── 709849a279c02c19b1b4bdb6a81743d23ca14c40b8bdadcd835424e4c0b6afdfccc3f9421aa8be1837a5e111d4d5533ded5d7cf3f22830beb9a31bd60bfd
│ │ │ ├── e0
│ │ │ │ ├── 95
│ │ │ │ │ └── faac46ad404be59a053cd30672abd453f7a1d925af3cabc869d2905df8badccde0c8e28eae03633ebafc678151e8e0886bf2e89b5f11fafbbd3384016b57
│ │ │ │ └── a5
│ │ │ │ └── adbacd54192a2fe66c7b8f4ab78998b920ad0f70a69c47dd0de48302d7e4d32f017f420d92a8080765b0e0ed11759d04da6c85f6e30d6f992c8e0ff3a427
│ │ │ ├── e1
│ │ │ │ └── 71
│ │ │ │ └── f77479e68534ec1a2b93d8fc47c7a1399a534f50e98fda4e5c47d2d7210a51a869c271f2732f74df3aba4c3cbc0a5e2d47cc03390b056afb8d95767b0a3c
│ │ │ ├── e2
│ │ │ │ └── c4
│ │ │ │ └── e4fe3527435943bfd91bc759cde394aca00a43c56f218ca2ca7079c787d9df45510df525beca552336f5420cfef8c523690fcbf9a7a349c955ad6587cf58
│ │ │ ├── e6
│ │ │ │ ├── 31
│ │ │ │ │ └── c208522e3a132e9adde8101848478efcfdbd9d9dedef1a3498f8528e2e3bd63e9b03c11b1b689f80ef79cc3007e9d8113692b75d99b6cc8fd4fc524f3f15
│ │ │ │ └── 6e
│ │ │ │ └── 2740aa7ead945bd3d2cd1f9f463380714e1f76e75ff295b2886e97bb4e91b17c9fbd92fe812e42c15c88e3b296e06e720136a948db7b519d3593d2c9d423
│ │ │ ├── e7
│ │ │ │ ├── c4
│ │ │ │ │ └── bd403a86d17c76ed8c0f4adf5f2718af8d8978df6602c1f0cc7d9fbbd5102a52b65e7fb2eb2906772c72cec024b814b341a653f9df7671f3de5278e087bc
│ │ │ │ └── c9
│ │ │ │ └── 66c4a480e013722f3f871cc53394e129834f4557e7afe9931edef262860771ce073067c5681043e600b0991bd2e6a9f56834c30aa6db48613546eae0d8ec
│ │ │ ├── ea
│ │ │ │ └── 6a
│ │ │ │ └── e08b4fd9ee6e6504f13f3cdc682341d990770d134d9cb9eea062db05dbdeedec59beac621234d04aec080e7ecc761a0cb5ba6fb176d12a4c594e1affe34d
│ │ │ ├── eb
│ │ │ │ └── fb
│ │ │ │ └── f002c3c2e7371e2c96b7c632a51ed57545731aaaf1d2a2f7e4e81436dbbe703688886d65cad4a0e67a70677a5dd18e30f11710b5405773110be17ec09295
│ │ │ ├── ec
│ │ │ │ └── 0e
│ │ │ │ └── 92f634a09bf4beecc76d34349bf8853ce7dbd0a89fd002d71841c7c50ba5bc452e08c4864395d2d1d31a82159e830b2ad02e32cfb31b5335c8798d503894
│ │ │ ├── ee
│ │ │ │ └── 49
│ │ │ │ └── 3ab8e198f724a0085b11b91a655b3be3884c2e946f3bea97e78d0c6a681240714969dcdd72aceb7b61030166cc6fa29f911b0e7421e8623ee1acfbba21fb
│ │ │ ├── ef
│ │ │ │ ├── 17
│ │ │ │ │ └── 5c6ad83bfd4fbbf94772a23db3a1db48f47fc8228a6aa3e60e21c64eab59c9c1758167da7cc62bb99655e57a40db66471aefd6bf7e8cc46105c8038b16e8
│ │ │ │ └── 20
│ │ │ │ └── 10a43d94309ccb8b50eabfba856273db68fc7b65f14ae8f888c50e0f7e418fc8dca5d94831f9afee994a2798aaa384ce039df6ccbdd5faa2d5eaf37b2841
│ │ │ ├── f0
│ │ │ │ └── e4
│ │ │ │ └── a5493e3c7cf613ac0c16fb8ab8e0f240eec72decd3f67282dbb7528a041e4f509299294bd218553aa13f8255c4410e359acc0da417ab748ddb7f9e84870c
│ │ │ ├── f3
│ │ │ │ └── 3f
│ │ │ │ └── 5f545883735913820f7b9388c4bb8f5506d3a5342991621e9eb2d29c70ead7e24ed11fd239488463723f922bd375fd8cb1aeaf5d0118c7475cb516a11090
│ │ │ ├── f5
│ │ │ │ └── 3f
│ │ │ │ └── 548d6debd145b973543b193c25969b57c21bd8984cc587331f67d1fb1505adfae65e3e364f8c13ff5b5644c99d6dc065a89b9ff9e9317894f72a8e70c772
│ │ │ ├── f6
│ │ │ │ └── bf
│ │ │ │ └── b28bdfa6814df700a723e886d3f684423bbf16ae24a3eadfdc17c0d605927d68e18f393103bdd503cf51702a29bb4175b0987aad7479d125f840c441b8e9
│ │ │ ├── f8
│ │ │ │ └── 6d
│ │ │ │ └── ad94b9e6993772c5d9a05196731ca28aab1cec43bc63c70e16720eeb8905183896317bf54f03b08ead598d1c8574e8fd07f97f2344e801d4d99bb9997ac1
│ │ │ ├── fb
│ │ │ │ └── 07
│ │ │ │ └── 5b4f51db21cf13bb2531a41b5bb56490f2bdef064219525582fbc6edb0ace29922fb8613e7bf811cccabea9bf8bf817f3504b3cad598254fc5d28abfb7e4
│ │ │ ├── fc
│ │ │ │ └── cc
│ │ │ │ └── 2b4a058cdaf75b3dad8ffb7f2072d0d69160ad6b6cdddabfd348d4defb96799baa61adc2ad9c254944e9c3286516534e61c34ffd2bc242537aa40b056d5a
│ │ │ ├── fe
│ │ │ │ ├── 32
│ │ │ │ │ └── 99a0ca70d05f06470978fde2d138f03771f717b4b0293f44332e6513fc7b8f0995b207b218f59acc78ac363bf9c522a3d00773d533d6989b4177d760170d
│ │ │ │ ├── 37
│ │ │ │ │ └── c4c0d0dd41504236f8e41a2b7887aa4c3b3abc6c7928a6ae39f1d3edda5323c7e781414a2164d1bd03b0ed3bf3b9ba449bc6e68d1973231e2720c32eab41
│ │ │ │ └── b1
│ │ │ │ └── 5e0a934941b852663195c0ef51155df13ea6e71114bc326210cc2b43ff397a82926e57f6cc2ee37dda81b717b77ca031071d1aee8d25cd52bf1fa639ed2b
│ │ │ └── ff
│ │ │ └── 2e
│ │ │ └── ed24a00b559d653f3799641f636279adacbeddd0ddb3928ae28b96bbafb7611e4588b8b4f36696733092cad5d9984605ff34273889aad33b717b052d9cfc
│ │ └── index-v5
│ │ ├── 00
│ │ │ ├── b0
│ │ │ │ └── a5285b1dd41927c25a437d6e06e180ad401616f52c278cd64474969fb3e1
│ │ │ └── df
│ │ │ └── 216782e75230fb7e8d7057093e134da919f2d56aa9db5f6f7258b3b537d3
│ │ ├── 01
│ │ │ ├── 3c
│ │ │ │ └── 9305c09d5789a41fefc7aa0cd3a8a3813243d247f506487c2f66e9ff5971
│ │ │ ├── 85
│ │ │ │ └── ac002ce9e68821cd39a876c92f3e1be8caeddcf6419d6bc324f70d32b4e9
│ │ │ └── a9
│ │ │ └── b0d0d67beda769e84926f207549943c0bc17abbf66bc20099aaa1bb51736
│ │ ├── 02
│ │ │ └── 3d
│ │ │ └── 7ff49953c213d0e9070efaadaaf3c5ec6740893a6f3704b4f14e805bcfa2
│ │ ├── 03
│ │ │ └── 48
│ │ │ └── 75977735688016c583178c5e6055c5d811bf783ee09da9fe4b1137891c98
│ │ ├── 04
│ │ │ └── bb
│ │ │ └── e70e70e0cbc9b00841927b0c23c58d97f21063208f3e872c3e04db58c13b
│ │ ├── 06
│ │ │ ├── 5a
│ │ │ │ └── 98f8c4232b39b6ac68023a0bc186c128dffdec812a144648c26dac71f91a
│ │ │ └── 5e
│ │ │ └── 2009163f0b101c063269056e566eec4bbc4ec9c8e69f769867337a8ed57b
│ │ ├── 07
│ │ │ └── 2f
│ │ │ └── c26409f0f3f5f0a9723c9865acfaf682ce8a5f593e491d912d58f53f9ae7
│ │ ├── 08
│ │ │ └── b9
│ │ │ └── 8c0c17709bc08fb63e5f0c39c65b93c80c9663f548e949eb55cb434a357a
│ │ ├── 09
│ │ │ └── 8b
│ │ │ └── 0ac0d0ead7b0eee61d826bc69cca1c7d40e187e8282c876253d740b9e9f0
│ │ ├── 0a
│ │ │ ├── 08
│ │ │ │ └── 7555feef8088d2832129af7ce022f6637283712a9ecd731e4a9ef4932c14
│ │ │ ├── 2c
│ │ │ │ └── 10ae97cc0ddca9e23bc5e1c1a10c38f60b99fa734eb5749276bb78987586
│ │ │ └── a2
│ │ │ └── 6a45098c63203072b3c3abfd9346c85ac9bc463e9506bc2bdf17478905a3
│ │ ├── 0d
│ │ │ └── b3
│ │ │ └── 097d1aa2272aa0a4559d84bc3e8aa1b5438104f60d0a303dd8cf4a4919e2
│ │ ├── 0f
│ │ │ └── f7
│ │ │ └── ef3ad5111001a610f814d854d1ce9853e9d6d710a41430d086d07a0986cb
│ │ ├── 10
│ │ │ └── 17
│ │ │ └── fba3d249f38fffb6e9b99fc904d81622ca3edbd864d546795aece3329bb4
│ │ ├── 11
│ │ │ ├── 42
│ │ │ │ └── 63f22fbcf0c21b1e268e7098ba936a48f7ddd6c06761a6c5b4a5fe434ebf
│ │ │ └── d4
│ │ │ └── 2f9f9df8a204a306e5baed8f658a43e437792315d561c5eb0315c7a97d50
│ │ ├── 16
│ │ │ └── cb
│ │ │ └── 5a69d7ce799d5fc7d26a2056473c94a7bb373b72395bb56a9b740dffd152
│ │ ├── 1c
│ │ │ └── 65
│ │ │ └── 74c26755259935f238329c24af2f3305f57b1107f720cc0082e513d83ebb
│ │ ├── 1d
│ │ │ └── 59
│ │ │ └── c56cdb49f40694dc6b984bd43ff53d96f6ea1dbb06ee467a00e4a697e664
│ │ ├── 1f
│ │ │ └── 85
│ │ │ └── 3e0b21cc5deb10a0dc51ed6dace9f5ae0f08f66b5c064b262517165cfa2f
│ │ ├── 27
│ │ │ └── ef
│ │ │ └── 452a94b385f28d524a6fd9178863fe32cc70bc3d94033a3dda9c91b2e128
│ │ ├── 2b
│ │ │ ├── 0f
│ │ │ │ └── b8787add1f0675f7298f5d4e498f1c0091c7438fd73df02d649bbcc9c1ce
│ │ │ └── 2e
│ │ │ └── aa61c0bc2734278e23d60eeeab1fd752744ea5536b3ba08b35b3a667d229
│ │ ├── 2d
│ │ │ ├── 80
│ │ │ │ └── b5e9ca2e40744e7fa089861626d2a29c62363c01729964f4cf0c3e8ee632
│ │ │ └── f4
│ │ │ └── 9196d70f82f15d107105ed433fd462721c91b1594984d87b54d57730cb20
│ │ ├── 2e
│ │ │ └── 5e
│ │ │ └── 52bb770674006416c55571d38721a1575036bc260e9debd40db850bc0b20
│ │ ├── 2f
│ │ │ └── 2c
│ │ │ └── 2a12420aab34889ed2c64b80f9b722e2e90e139a130f13e34a1c7a0e1e29
│ │ ├── 31
│ │ │ ├── 7a
│ │ │ │ └── 9c96d52885c2170f2365ba2c1bb1035008b9daa92b20f4c5e52f16b85113
│ │ │ └── ca
│ │ │ └── a8c3ab0670811a3887ede187dcd3856d14272349a18f6844f7c8007cc05e
│ │ ├── 33
│ │ │ ├── 19
│ │ │ │ └── a311e591a2b51610ed276fe9968065a74c2f19efd7f917616967040ce127
│ │ │ └── f9
│ │ │ └── 071d7d949ade71febc395082397753f9a225031462df3ac9c8ff4104bbad
│ │ ├── 34
│ │ │ ├── 05
│ │ │ │ └── 127f37b0ff3cd9c76b1497b5838d265a8a2b7ef495b7f9841f5d4665ba67
│ │ │ └── 9e
│ │ │ └── 35f5913aa7a542b3357025e12a2a126c13ab15a9bfbb40721b56f89ecb48
│ │ ├── 35
│ │ │ ├── 45
│ │ │ │ └── acc6960018d880bf033f23b050a6c442be8b02eb6cd96e01c7ef7b61b640
│ │ │ └── fd
│ │ │ └── 45154839db33174def1653b1ca377b1d2a65a4c4e56564fe11d85b67a96e
│ │ ├── 38
│ │ │ ├── 04
│ │ │ │ └── a49ce7d19c6d98ec2d5f259e71f17a5727961200c4cf22a88e33ff7bbe5c
│ │ │ └── 36
│ │ │ └── 08fcd3ee98bd9b00bb28cc7d417209f374feb4bb23f9093fdab5ff57857b
│ │ ├── 3a
│ │ │ ├── 10
│ │ │ │ └── 33ebb16ca229c4cbdad65ac0947fbeb3765befe98674faa960578851637f
│ │ │ ├── 21
│ │ │ │ └── 946df9356ae372c19a7700e322d8d0276a406143c7375ce22124fad7dfcd
│ │ │ └── 46
│ │ │ └── 4a802da9ee2134f8f76df15df8ddd2d0f2b05e7de9b1d7e01669c4278824
│ │ ├── 3c
│ │ │ └── f6
│ │ │ └── 26a7f7dccb969c764b8bdecb3667023c64bc1159e674fbeeca633c54964c
│ │ ├── 3d
│ │ │ └── 2f
│ │ │ └── f8441bbef005e18fb70c8e8654894abf17ac44b2140cfd60f172246d894f
│ │ ├── 3e
│ │ │ └── 49
│ │ │ └── fc9a5a5b33508297834c9a4acf4d4de5b46348df8093fa7d0a6f82aba3d5
│ │ ├── 3f
│ │ │ ├── 3a
│ │ │ │ └── 2f0714110028b8f228c7c95100ea873c5a00ea03a97ed1d1f555cd404e1f
│ │ │ └── 55
│ │ │ └── a551d4620944369d858a04648adf3994a33934840d738144392e51784ac1
│ │ ├── 40
│ │ │ ├── 17
│ │ │ │ └── 8828f1bc3c004a75e5f93ab594b7418ca18ac8660a28916cc6e51643994d
│ │ │ └── 1e
│ │ │ └── 89f0b89d2ca92cd54ff481086fdd599c67170ea69eb9b22d37e34638d25e
│ │ ├── 42
│ │ │ └── 8b
│ │ │ └── c02d827ace565a38508b184eec46432a592ba2550cdb1930cd90b866d766
│ │ ├── 43
│ │ │ ├── 5f
│ │ │ │ └── 110819c5903563df1824b2214749ef7781289e80d4a600347e3901aac1c4
│ │ │ └── b0
│ │ │ └── 1da35d6e384e0146648258aa5ea61333fd10d6d00300adf4aac974f6d1e2
│ │ ├── 44
│ │ │ └── 10
│ │ │ └── 7cf4f1b3974687000c3e81a7b9d017adb6b8416e32f27309b764b12b8be5
│ │ ├── 45
│ │ │ └── 2e
│ │ │ └── 93eac58d3d5aa3f5721ac09fa7c3b814ccb98bc5000550243f4497f78a67
│ │ ├── 46
│ │ │ └── 98
│ │ │ └── 3144eac06844196da14c933cccc766b529c8917a7efc1c6c79bba5651a6e
│ │ ├── 47
│ │ │ └── 12
│ │ │ └── 2b0123c780f4536fbd0b803d54bb573a256230046b95fd342da9df92dc8d
│ │ ├── 48
│ │ │ ├── 7f
│ │ │ │ └── 4f4a841cc66ee33998620da1f4f341e422d9ebb37bb00178f3707927db1b
│ │ │ ├── ae
│ │ │ │ ├── 1499701156e55c38f37c319e42d8ee632f62ee16e676fb96bf268dc03e39
│ │ │ │ └── f6dae96ac72c3518cd54e6a1cf5ac3bc59c80cfdc62d65a101a0cb67304a
│ │ │ └── dd
│ │ │ └── 8c8b3dd9e0048fc9974197e48fdfa5ceb084560780473574323b9bfdebd4
│ │ ├── 4e
│ │ │ ├── 45
│ │ │ │ └── 17bdb2bc7c0f1b72ba954a40424fb4a9ef5929f88e922704c80b3d264ccc
│ │ │ └── be
│ │ │ └── da18b216664b1e58df4ffd6782d77f3c28a3f61355544535ff7704cc1b2d
│ │ ├── 50
│ │ │ ├── 85
│ │ │ │ └── a29f2ec233233dedaf6d110ada83bf22af3e52848fda04a91b64f889f53a
│ │ │ └── bb
│ │ │ └── 1a5b513e51544ef3ffcb8dade26b2fd155f2f50104e8ac073030a9d119ee
│ │ ├── 51
│ │ │ └── 89
│ │ │ └── 3d02d342de41905761accac02260bce79c49652be9e6066da254d77ba04d
│ │ ├── 52
│ │ │ ├── 20
│ │ │ │ └── 702ec5d12a1e111e2534ce89eb0f33f79fe3ffee0e80a428299cdaa0d007
│ │ │ ├── a2
│ │ │ │ └── ba77c6a126c66982a48c1fb49ac1ca7f841619a89a1f0fc5de3512a4b7f0
│ │ │ └── bd
│ │ │ └── 1b45d5168ed8296f6d5d5167fe2f8076e2cd5e5d67d2766935784d3e798d
│ │ ├── 53
│ │ │ └── e1
│ │ │ └── 0dc9829fd62522b01d70c6eff1025e862877619ba63ab3f1445df0451b8c
│ │ ├── 56
│ │ │ ├── 4b
│ │ │ │ └── 859813b09e1e5020654bf65fb2f19970c51f08f788d3c4f2ea5137051e1e
│ │ │ ├── 71
│ │ │ │ └── fa4fe23b6bc134c60d26da3033c87003fb50204af907f8ec32c9a7c9e48c
│ │ │ └── 9b
│ │ │ └── 5bc545281ee1f49775ff8b0f2921a08251d503d559ff3f999be9886f1712
│ │ ├── 57
│ │ │ └── b7
│ │ │ └── 2772f8c4daa4b31074e03545f8e473b547e88ef3141501fe2a54e1abdfc4
│ │ ├── 58
│ │ │ ├── 92
│ │ │ │ └── 5799a11997482f78a71307f2134a84b508b74d7faa3535d40d26c6261638
│ │ │ └── f0
│ │ │ └── 4fe556f104b09be642895a82afa463fe560d9a0dc8f507efeef825a6905e
│ │ ├── 5b
│ │ │ └── 42
│ │ │ └── b4487d788874a06f49235360174f1ba8832e8f6a83cb8533883b8fa09f4b
│ │ ├── 5d
│ │ │ ├── 58
│ │ │ │ └── 39fdc57612a04067ef7ec1c141646752e6563b84430cd56ba1df2434de91
│ │ │ └── ad
│ │ │ └── 1cb61ae613816d5f049cd87dd24009e364126f73726b1f8eab2350fec505
│ │ ├── 60
│ │ │ └── df
│ │ │ └── 89f1345cb5849d888a2cce2e6d6ddc0014eb3d6722956a06241f6e7f3d58
│ │ ├── 63
│ │ │ └── d3
│ │ │ └── bb861348e4b5fc53b62454cd498b01af8a51c93c0ebb3f9ca712ca253566
│ │ ├── 69
│ │ │ ├── 33
│ │ │ │ └── b968e19e42cda755b43c4bd1e354056b2be0e8ff44896e82e4bc9fdb6322
│ │ │ ├── 7f
│ │ │ │ └── ee4d73554ca4b3320cb01b422b9a9d45f388513d8fd2ccf4df9187578ce1
│ │ │ └── 97
│ │ │ └── dc07bc0d29ed2880b0e39905e8bc8a24a0344155c90a7ca65c8093d51295
│ │ ├── 6a
│ │ │ ├── 86
│ │ │ │ └── 14653864a77b7c8644710834018401ea9fd5653744bbbea2201a6af48a9f
│ │ │ └── a7
│ │ │ └── 23f89bea37ae703ce622e7188ccb889113f1d355f754c11544a1caec4cc6
│ │ ├── 6d
│ │ │ ├── 40
│ │ │ │ └── 0b02ee474cc305b6d0da00248cfa61780731440b4f237c6251314258b9bd
│ │ │ ├── 61
│ │ │ │ └── c9e7e8446341cea439547eb023fbf47c954ba932e6944a3fd50413c1e861
│ │ │ └── 65
│ │ │ └── 05c74d488e52e860b9de3668e482a62f5796264d2bf9f2700cf9423add5e
│ │ ├── 6e
│ │ │ └── 9e
│ │ │ └── 2004cc0984629401a6a3d3fa16900d49ac70112df7a8c515ec028b34c59d
│ │ ├── 6f
│ │ │ └── 9f
│ │ │ └── 4244544732d3e784c8fd360e0ea256a943488c53a834da3d0ddf3e83af9b
│ │ ├── 73
│ │ │ ├── c1
│ │ │ │ └── d8bbb109a8fa2903d912518bf54776b7794c8f6f0a759234283c3c2eefab
│ │ │ └── e2
│ │ │ └── 434e6cce71a37629e1945f6d35d5e52c1e34aa88ef24d1915846c72775f1
│ │ ├── 77
│ │ │ ├── 59
│ │ │ │ └── 986079464467eb2c4f1c178bf1c9fa9179b3c8384bd1eff68534419250ea
│ │ │ └── d8
│ │ │ └── 4c73393b4c86b064a434ecae7c4c202784cc49493fdc99469a7dc797494b
│ │ ├── 79
│ │ │ └── 0e
│ │ │ └── e6e294a39cc9407b6358b7284df63feda5d4f96e51519630d06219175167
│ │ ├── 7a
│ │ │ ├── 05
│ │ │ │ └── 8c39e8b9b5af7db5ea9983334f3ee2532aae9b7973de1dbb581781947ed3
│ │ │ ├── 1d
│ │ │ │ └── aa5b15d3f974ebd32c44778518e0984265598aa1e2dddc4ded4feb2a11b1
│ │ │ └── 23
│ │ │ └── df8deeb6de869825106ce68786ba9e16686f20a8b4f1c626c9635a5bc8da
│ │ ├── 7b
│ │ │ └── 1d
│ │ │ └── 314b6515b77b62a66c8a2ac140ac4a6926135c5866837fddded37acb1acf
│ │ ├── 7c
│ │ │ ├── 20
│ │ │ │ └── cba9852dc5e0811d9e6e24e74108bf7727a0c2730516ec8f41a08f13116b
│ │ │ └── 9a
│ │ │ └── 13a1f5cfe2738ebf2558b3fc8173e47bffd478a46c35ee5e0fc6e72e511d
│ │ ├── 7d
│ │ │ └── e8
│ │ │ └── 5446c5cdae0493e4ad3b10347b77c8df4b17b5fbe14834f5c6b06faa9f95
│ │ ├── 7f
│ │ │ ├── d5
│ │ │ │ └── 36068d8df17b31ccdbeedbb62ae94e354f6d768324e0dd6578917b8ecc16
│ │ │ └── f6
│ │ │ └── 5e3925b158405271b2f44be4d1ecbb5c60b3b7da87819ce03956b759b051
│ │ ├── 83
│ │ │ └── ef
│ │ │ └── aff47278d7ef72e864717a2bb5e09eca947c1b761d2a3f590af1b5f1b379
│ │ ├── 85
│ │ │ ├── 20
│ │ │ │ └── 71a0d0584d5ae3631b6b48b18785908616327f10115d683585b05072ca1b
│ │ │ ├── d3
│ │ │ │ └── 1b45f9b1e17b38c211d236888c737ca95cd5b9ca0e42c51cff12aece643f
│ │ │ └── d8
│ │ │ └── 7da2d1eaa517a5e80f7a1a8d7dee184babfd49523097c7b2ea907d755944
│ │ ├── 86
│ │ │ └── df
│ │ │ └── f30ac40daf6afa3c806cd525ffbf33eaad06c5f38e08f7ce9428a303241e
│ │ ├── 87
│ │ │ └── eb
│ │ │ └── ab402da37b8ea447b0cac7c54cf3452aae056ac8c63514cb6730629409a8
│ │ ├── 89
│ │ │ ├── 0b
│ │ │ │ └── e2ba88ed525834b932f3ddb5624a540e279742a3c6851ec4ee466890a5ed
│ │ │ ├── 0c
│ │ │ │ └── 98d70e9e25b9a23c255f11b8acd5d9ebed836d0004871577846f3bc3f03f
│ │ │ ├── 39
│ │ │ │ └── d7518a088b510f892a8355a21e2971328f68a8ef26d1962bbcfc70c84725
│ │ │ └── 58
│ │ │ └── 62a9a2b49fd26f8d788adbe5cc377e776463c3a01839945896d96fa48d4f
│ │ ├── 8a
│ │ │ ├── e9
│ │ │ │ └── f78a927b119d27ece8b731dfde1470b48159f26c89ce35d5fe0fc80122ed
│ │ │ └── ea
│ │ │ └── a9d2d6ff75cba71d63171f51aa258a77d99513740280af3884c1dea1f7cd
│ │ ├── 8b
│ │ │ ├── 4c
│ │ │ │ └── 6c0c483d470762dc61c704d8d07e1edd6421400f274c32ea22f543bfdb16
│ │ │ ├── d9
│ │ │ │ └── 617f84454e0342f885f6cbdd2661990c9060f183e29553e39e0506dbd847
│ │ │ └── ee
│ │ │ └── c2ea22c4bf9c5ddcd0333850e543442de3364478847c7ebc382b1ff3a70d
│ │ ├── 8c
│ │ │ └── 9a
│ │ │ └── e014072a08e7ba0b90a6897c5737bc438be37650b0470bfd7c0b83e18e23
│ │ ├── 8e
│ │ │ ├── 58
│ │ │ │ └── 1ce1355f39c75fa063f8dc1c958c11d57446438253b206afc18efb9f28c9
│ │ │ └── ff
│ │ │ └── fc9a834a298aa364d38f286bfc395217fe0559c9b322231ff5f6265ba504
│ │ ├── 91
│ │ │ └── 08
│ │ │ └── 56fc6b8aa67287e6e60a90a5e8bd6500ef9e97a317a38b324cca616a7d25
│ │ ├── 93
│ │ │ └── 31
│ │ │ └── 9f96e29572a9b3bd880f19dde2e443b99ec81a4258f3e56ce1c4fff64852
│ │ ├── 94
│ │ │ ├── 07
│ │ │ │ └── a7c22ba183764c0c27f706d74812444c27c14a97fc43669b7dd7c32a717f
│ │ │ └── 49
│ │ │ └── 0c8e6bfaa289aa93424dc1f6f28b3decc9f59cb08be977c3040f7d244ac3
│ │ ├── 96
│ │ │ ├── 7c
│ │ │ │ └── 454eb1ff3ec3546d35165170f771ff1c65f055203c5ab9f907e6af7067a8
│ │ │ └── c5
│ │ │ └── cfd4f290453cd7201716a3217433fe76e994d06ad3a598a6ab5772d5280f
│ │ ├── 98
│ │ │ └── fe
│ │ │ └── c68a85433f7c743aa9b9427fb21be6fd8c25f9e7893bd5cf65537496008d
│ │ ├── 9a
│ │ │ ├── 76
│ │ │ │ └── 06192603daebdeebec6ad6e070357bb297b864354a3998c359fa50ad570b
│ │ │ └── bc
│ │ │ └── 143ae50ba22ddec235347ed6a62762b673eddb52cb1939aea401679de36b
│ │ ├── 9d
│ │ │ └── 0d
│ │ │ └── cb301e666cb1b3f23405c9a023a97e35e0b646458b0dc07d4e4c45f072d2
│ │ ├── 9e
│ │ │ └── 24
│ │ │ └── 74490f75d8dec7ba5051c2fb1e3119fa15abb79366ea7664e5fbb2977153
│ │ ├── 9f
│ │ │ └── 43
│ │ │ └── 3636172cbc03abf2262c921f9f71572e6b049aa3db8c65d166bcfe5aca5f
│ │ ├── a1
│ │ │ └── 78
│ │ │ └── ee48142ac207e21a1a2eac9ca7111587ce699eebdc565abb3dfe976abf96
│ │ ├── a2
│ │ │ ├── 60
│ │ │ │ └── ea4e9555df962e8a55d27858ec6e935db7b0356b46d10718029046780c27
│ │ │ ├── 68
│ │ │ │ └── b7b4c1f69b4b4ff6c19e7de1b75dfa3eefbab3d36b6ce4ef15d6f64afb9c
│ │ │ └── b5
│ │ │ └── f2c35332a5ab256ee9271034e3b3b301ece6931e6e92531ca0bd8c08fe9a
│ │ ├── a3
│ │ │ └── 50
│ │ │ └── b739b1f6f936987c26973cec93f36482ed240ab90158c0d04899bab0de13
│ │ ├── a4
│ │ │ └── b7
│ │ │ └── a7cebac941d6c47ac2f6fde93c17edf93f4ae4aa6b051499d8f2ffeab614
│ │ ├── a5
│ │ │ ├── 87
│ │ │ │ └── bc838260e09216f01f45e48f0f96cb7691d978001a792540928b1153baa5
│ │ │ └── b8
│ │ │ └── 454c882933ab15d532e2493b0bd7ce7019f1caca2abb46f076ca0855330b
│ │ ├── a6
│ │ │ └── 54
│ │ │ └── c1733144b73a0422b1daf6390b4562d52ec887d209b643d8b0b789a2e4b1
│ │ ├── a7
│ │ │ └── 04
│ │ │ └── d0646f5e87aed79d9f0ad28e40eff59b4872fd92336c436b29f7280a9d3a
│ │ ├── a9
│ │ │ ├── 92
│ │ │ │ └── c230215c94371d341f1b38927e5f481994a870132101fd50efb0449f27c2
│ │ │ └── f7
│ │ │ └── 4c2a9fe6575921726a5579be73ddb2a3e8a7abbbb66a28c50ca8deaeccc5
│ │ ├── aa
│ │ │ └── cb
│ │ │ └── eb7e78deaaf4e5eba36039b514bbe6541a5e440f56bda5447a6a0c81f2aa
│ │ ├── ab
│ │ │ └── f0
│ │ │ └── 041961d523d853b40e4e55be33fe676651a97b630d01af1b06b28abc5697
│ │ ├── ac
│ │ │ ├── 5d
│ │ │ │ └── bac3965880e0e18bc7d1e21519c9073430f53c69821d54a4aeb5c313357f
│ │ │ └── 86
│ │ │ └── c0732592365d753d382502d91754a3c88f8b20e22cc25a0327beb9429687
│ │ ├── ad
│ │ │ ├── 5c
│ │ │ │ └── 217f4a9502eed2896935b005b187e4713d93ba3dc76eff284b00a1a8b92a
│ │ │ └── 7c
│ │ │ └── cc598261aa7c1f089fdcd0478664f8f5c80f8f02f241f08e3be264a9e616
│ │ ├── ae
│ │ │ └── 78
│ │ │ └── cedd14d309b153583ec33b511626642a5b2cecfae082a664e1e6a368bc97
│ │ ├── af
│ │ │ └── 8a
│ │ │ └── d90cfcd33a9895fbbb880406407aee65cd5b37556b94baafb95ba5cb93dd
│ │ ├── b0
│ │ │ └── 4a
│ │ │ └── c18a99a2710b49b5a3a1121226be4940f623f8ba056f8108a634ed347da9
│ │ ├── b1
│ │ │ ├── 4a
│ │ │ │ └── 6796e751962cdc0f1d356f7c34ae7e66a41858d769156329b5bd4379d591
│ │ │ └── 8f
│ │ │ └── 5767f914aa664f32503df614481bac973784e2bcd2b8af02e84faabe168d
│ │ ├── b2
│ │ │ └── 53
│ │ │ └── a51760f3239bd143eb2f11ec8f083702e47b0ca67ac04a9a45e7336f6cde
│ │ ├── b3
│ │ │ └── 63
│ │ │ └── f693e1cbbd8c651339dc83ea677e236d61935b81de6396cb4847fd5b08e4
│ │ ├── b4
│ │ │ └── d4
│ │ │ └── aa802aaebfa5cce97b6f2e688062d965ef9940c20866c45eb34a72b47d05
│ │ ├── b7
│ │ │ ├── 38
│ │ │ │ └── 992d3e6c01fc9098d137f7dbccfcaa5f5124ba9c487e582e6e0d83f99d30
│ │ │ └── fe
│ │ │ └── e66fb9a38a1ef7da481d041bc0dd117c0c2bddfa61bcf516da1e1486c290
│ │ ├── bd
│ │ │ └── e8
│ │ │ └── 7741857e809594830141a639d3d54110945a88bb85691de2f9dc97402c84
│ │ ├── be
│ │ │ ├── a3
│ │ │ │ └── c0779c8e0be92c748c91a7dad4e6f0fe57ba0158b6bb1bcfddd8fc56c934
│ │ │ └── f0
│ │ │ └── 1030b67d1c2d501a0e14ff9aea82addbf8b2e760ef58a5be510d7b4bad3c
│ │ ├── bf
│ │ │ ├── 03
│ │ │ │ └── d5dd5fa44593b3e2d24e270c89a4ebe5809a69837946acbe11b5f9ab29d0
│ │ │ └── 7c
│ │ │ └── 375aec77f76404d91225e72006a0105b2a6ec04bb02cfa365ebcd4a0232b
│ │ ├── c0
│ │ │ └── 83
│ │ │ └── 1295af917239a2fbe94404f49d472949b2a2519701a35e8dc9841f02ae34
│ │ ├── c1
│ │ │ ├── 3e
│ │ │ │ └── 4c4d082623156529b4fa73601a4ac92e33a6b20f963f1096cee31b6d9010
│ │ │ └── 8c
│ │ │ └── e4e9afe177a9d6771d71fe96d51887f262a8fede9d9d3e06ca7ddcf20990
│ │ ├── c2
│ │ │ └── d9
│ │ │ └── 7fb959fc2a833b8e68b8306a1b7d4cd5f15c8b4e0c9d6b46a6765796482e
│ │ ├── c3
│ │ │ └── c6
│ │ │ └── be9e8d92e3e1f8898fedbe33cae4e67f0352de1b0d48fee9cb29ecc1d6ab
│ │ ├── c4
│ │ │ ├── 11
│ │ │ │ └── bf2dd5bf2d9b9006f82aeedaffc7f69ad64358a9a08afe81cbcdca1766f2
│ │ │ ├── 68
│ │ │ │ └── b71baf5025326649162df1bd325b5637dd1e72f59a32177b49318d5efeac
│ │ │ ├── ac
│ │ │ │ └── 4511be3eecea50ee9cadc09a612f9be8598d7b29d5c8b1253c75fa283cc5
│ │ │ └── ca
│ │ │ └── df46b5b6c6148487b1afb20084da52f2838a08143f9b0ebd217d2a229e9a
│ │ ├── ca
│ │ │ ├── 98
│ │ │ │ └── 29ae16b7b413d7a609c6beba2ab22ac51a8f88aa3c3a36759292907ce3ac
│ │ │ └── f8
│ │ │ └── 5fdf8973f1896e77c07a4919f6166c6a04ef8354c5efb0156670a06d24e3
│ │ ├── cb
│ │ │ └── c7
│ │ │ └── 8dc870ee1a760dfda5ed1c13aec5056dae100cec5c9af892474d802a65b0
│ │ ├── cc
│ │ │ ├── 25
│ │ │ │ └── 0a0ad2d0308b6807a70e488194992de068d68b749910eee4847c38629984
│ │ │ ├── 60
│ │ │ │ └── ca5eb4c028e64ab99a3a71e5e6cff685d49a0052a23f473310db7d984f23
│ │ │ └── fb
│ │ │ └── 96cd6e2c34dfd1fc2a68d5b85c353ec81fec75a8e0856070c12777141d13
│ │ ├── d0
│ │ │ ├── 12
│ │ │ │ └── 0e893a332c0e07c4e6ad382322604cf61f86ba7822a3e02b24d4105846cb
│ │ │ ├── 39
│ │ │ │ └── f3ea46b7a48d1b108681523c9e802f48f2779894068bc9b984863ca18939
│ │ │ ├── 57
│ │ │ │ └── 3aa5d94761ad382e1a1acc61203736494009e20422bce1dd1433666dd012
│ │ │ └── f3
│ │ │ └── 570007f66e0a594c21201eb3e8f15d7a4d92bcb97b59246e5b7194b3b290
│ │ ├── d1
│ │ │ ├── 34
│ │ │ │ └── dd11aca2ddd3aeb854849cd81cab78174fc5ea935c0fd552de94684f90a8
│ │ │ ├── 3b
│ │ │ │ └── 5d145862c809774efedb998cae0b11c4062b94265112f8db93a55edb929e
│ │ │ └── 91
│ │ │ └── 1ea8e1c5735aa7333775abaea09cba50e98296556053fba7d4dd227c6732
│ │ ├── d2
│ │ │ ├── 3c
│ │ │ │ └── 9b2e81a9ef349bd31c3c94f1c2d4040643ee96b8128c972db597415d555c
│ │ │ └── 53
│ │ │ └── 0423c306fc66318eb336eeb4033781a7b495f0aa3ba92eec00f34069f13e
│ │ ├── d4
│ │ │ ├── 42
│ │ │ │ └── dcecd9ea33544599eb1e71ac0fd23e843f4caf0dd35ae634e5a1e2bca450
│ │ │ ├── 8f
│ │ │ │ └── 715a86aa779da41ab634b8f3191069d4b2966a3c5b47cb739ab6a9b93aec
│ │ │ └── a2
│ │ │ └── 61ef4c73c2a4a1a021b2b9d9d54cd0acbea9f5e44cebff230278f27bd92a
│ │ ├── d5
│ │ │ └── f4
│ │ │ └── 0913a74f5e223a4fe6108493dd3b03c2d47259df459926160659513c9ad3
│ │ ├── d6
│ │ │ ├── 3c
│ │ │ │ └── 3fd6a899c59ae533d9a5bb44570ada1eddb5802483d3e7812df2c207a7e1
│ │ │ ├── 47
│ │ │ │ └── 2d4e4b363564f0b3d6e59012bb07573fb947a866841f5259a96439aa3964
│ │ │ └── 4d
│ │ │ └── 95351bd7b1c4630fa6590049d83b56ced950f5f2fd281f27e28527249cee
│ │ ├── d7
│ │ │ └── 98
│ │ │ └── 895bffa858148e74eb0bae5ede536d11e4eb6ba643223069874bea4f6498
│ │ ├── d8
│ │ │ ├── 62
│ │ │ │ └── fa9d7982c1af34cc1664c1504cdcf5728bee5cbfba341507a5c033098737
│ │ │ └── f2
│ │ │ └── dfd78c09b8752f2fd7100ea4a9f64cec29a053d57d72983420eb853b3e6a
│ │ ├── dc
│ │ │ ├── 47
│ │ │ │ └── 9e3985de44e70129e4e28c25bdc69a204acabcbdd5962cf5109db4ca7aa5
│ │ │ └── 8a
│ │ │ └── 4dc2a1bdf5b195e99648a945ce742de5f6d0b1aac410a6fe3e7155933cc7
│ │ ├── e1
│ │ │ └── 53
│ │ │ └── 4da55a553f57b5ef4eb84d567d8d4fbd67732c8c090da290c199e0ac2ed4
│ │ ├── e3
│ │ │ └── c5
│ │ │ └── ad2fd86fe0c1b9f233d92c25e56b1a582b8425b52db4767f8d72410c021f
│ │ ├── e4
│ │ │ └── f2
│ │ │ └── 0b57f65571788559ed93ba6d26cacaac21da8e4adfe374787669e431e875
│ │ ├── e6
│ │ │ ├── 37
│ │ │ │ └── c9e69f5074e9a22c766ffcc622280d4e580d2ee0238f670f28199487dd44
│ │ │ └── f1
│ │ │ └── aa87087a727f6fb26b60b78c06c2b830f509c809c7b1752ab1bcab0a15af
│ │ ├── e7
│ │ │ ├── 40
│ │ │ │ └── 70186a6ceaad19b6b11ac1bccf00fa5e038b8151d455127f9868f0051d57
│ │ │ ├── 6f
│ │ │ │ └── 6df2d13a4e315af18cce3e1c8a09c911262fc54f57e6fc47d361ddcf408d
│ │ │ ├── 9e
│ │ │ │ └── 9df988403d9266b9610bf520678520e200090b726c2ea164a0fe727500ba
│ │ │ ├── a3
│ │ │ │ └── 60cfc8947cb925b4deffc13cf15258a667e1653daa12cf0001b2e0083bfb
│ │ │ └── e9
│ │ │ └── d2369beb18730dc4f30e1c9dcdf5bf16ac9bd28dec641b81ff8e8616e7fc
│ │ ├── e9
│ │ │ ├── 6e
│ │ │ │ └── ba29811d787f0fd92ce7f4bc3a6827dc6d66c47153d50683c80d6e7a9a6f
│ │ │ ├── 9a
│ │ │ │ └── b309e8b758264ef32fd578a2928ad1ac4a3241e8c570a5c275e121dd7ee1
│ │ │ ├── bf
│ │ │ │ └── 0bfc4abc982e4aecac42d77dbded146ef0ce46649865b55d62144af5a96d
│ │ │ ├── cb
│ │ │ │ └── b6d58aac267a95803951157a42d29db6c17ef57c66eb59c48684c280e4e8
│ │ │ └── df
│ │ │ └── 500f6d65c0cf35c0f7c0635f953b37393168aa27cb55c7b0ce3399c0d7f2
│ │ ├── ec
│ │ │ ├── 87
│ │ │ │ └── d81e1e7b2d776e609dbfaa2175a5825c0a63a9bcc70fdb5694b81e7f4fc3
│ │ │ └── 8e
│ │ │ └── 97eeecddd26637708519813d42ee2a5ec256bd4831ffa02269e8993e19b7
│ │ ├── ed
│ │ │ └── 40
│ │ │ └── e67da4ad085eef0344d8e253e4455423e0efc042d3898be0a399d1a76b79
│ │ ├── ee
│ │ │ ├── 3d
│ │ │ │ └── 1ab77d088759d13cd44eab2a2f7764233b7908340d97282d9765e014f29c
│ │ │ ├── 60
│ │ │ │ └── 850558038dbacbcba5202b181a0a0c4f947405cf3682df3e1c20dec79137
│ │ │ └── 7a
│ │ │ └── ee0e1b8bea3f05c1b42f1fe4a17fdc2aa37be14405f4e293de10bd30eb80
│ │ ├── f1
│ │ │ ├── 53
│ │ │ │ └── 8aee994a2b5c701755cdc5660748a90199cf48437f5f93fdd0572344f2f1
│ │ │ └── a1
│ │ │ └── 1de8ff1c9230508fdf1c71b3faa1a9d2aade80a7e0b0d4daa6f4040d8ba2
│ │ ├── f3
│ │ │ ├── 2c
│ │ │ │ └── 80267cf9b394a43404ccabe3e574f5fd89b769b43be625b75ff9b1b4a2ee
│ │ │ ├── 8b
│ │ │ │ └── 4a6b7b0714b6f1c94fff48ad31ee18cb6aa93ed63612067b4de30efd43f8
│ │ │ └── f5
│ │ │ └── d11839881d6df2061b642074ebfaf84ce0d4b1d8e227ad335d364cf6a913
│ │ ├── f4
│ │ │ └── 47
│ │ │ └── 8cb011f7e5de40eae9588617e8f3bce662a0ba2d60796b559a420b44783a
│ │ ├── f6
│ │ │ └── c7
│ │ │ └── c2aee6453a94a772577d770a438f34805af27cbf0c7a776b19d6850307b5
│ │ ├── f9
│ │ │ └── 82
│ │ │ └── 228120d240455dd412cb68cbe2007319fbf91d96bb998e7f24c45faadc0b
│ │ ├── fa
│ │ │ ├── 88
│ │ │ │ └── 31cbd6ca584e75edf3642c6f8b079c1f2b5eca1d7b2780ce2e86c24f1e84
│ │ │ └── a1
│ │ │ └── dd9e9a25a0a13875f496dfc7b415ddc641f6b30648050accc001be4635ee
│ │ ├── fb
│ │ │ └── fc
│ │ │ └── 6282476d454ca3b17e0ba6cf70a4b6a87142bd8f3139517d572b2f9911a4
│ │ ├── fc
│ │ │ └── ee
│ │ │ └── fc3e1dd6706bd557d2840d92ff10cdd6928b92fb8c46d2195dfbd8d4b2be
│ │ ├── fd
│ │ │ └── 60
│ │ │ └── 528c5445a438483b66270e6a4dddfa6e9bdcceb2b998cb6f7580d23ceb1b
│ │ └── ff
│ │ ├── 9f
│ │ │ └── 48b5354df0d5feb3420245101c38efe5fb13f171ce2093c16eeb4ba41c7e
│ │ └── d6
│ │ └── 9ea5f7eac400baceca422723dd933d7c505c100130f066f787943d1ac679
│ └── _update-notifier-last-checked
├── .pre-commit-config.yaml
├── .pre-commit-setup.md
├── .prettierrc.json
├── .progress-marker.txt
├── .tmp
│ └── temp-1758247471070.ts
├── ANSIBLE_QUICKSTART.md
├── ANSIBLE_SETUP.md
├── ansible-requirements.yml
├── ansible.cfg
├── archive
│ └── ebook
│ └── enterprise_architecture_mcp_ebook.pdf
├── CHANGELOG.md
├── CODE_OF_CONDUCT.md
├── CONTRIBUTING.md
├── custom
│ ├── dir
│ │ └── adr-0001-complete-decision.md
│ └── research
│ ├── dir
│ │ └── perform_research_test_research_001.md
│ └── README.md
├── debug_test.js
├── docker-compose.docs.yml
├── docs
│ ├── .dockerignore
│ ├── .gitignore
│ ├── .vitepress
│ │ └── config.js
│ ├── adrs
│ │ ├── adr-0001-test-decision.md
│ │ ├── adr-001-mcp-protocol-implementation-strategy.md
│ │ ├── adr-002-ai-integration-and-advanced-prompting-strategy.md
│ │ ├── adr-003-memory-centric-architecture.md
│ │ ├── adr-004-security-and-content-masking-strategy.md
│ │ ├── adr-005-testing-and-quality-assurance-strategy.md
│ │ ├── adr-006-tree-sitter-integration-strategy.md
│ │ ├── adr-007-cicd-pipeline-strategy.md
│ │ ├── adr-008-development-workflow-strategy.md
│ │ ├── adr-009-package-distribution-strategy.md
│ │ ├── adr-010-bootstrap-deployment-architecture.md
│ │ ├── adr-011-adr-timeline-tracking-and-context-aware-analysis.md
│ │ ├── adr-012-validated-patterns-framework.md
│ │ ├── adr-013-documentation-platform-strategy.md
│ │ ├── adr-014-ce-mcp-architecture.md
│ │ ├── adr-015-ape-optimization-strategy.md
│ │ ├── adr-017-tree-sitter-version-strategy.md
│ │ ├── adr-018-atomic-tools-architecture.md
│ │ ├── adr-018-mcp-tasks-integration-strategy.md
│ │ ├── adr-019-vitest-migration.md
│ │ ├── adr-020-mcp-tasks-integration-strategy.md
│ │ └── README.md
│ ├── api-styles.css
│ ├── atomic-tool-template.md
│ ├── bootstrap-and-mermaid-implementation-summary.md
│ ├── CODE_OF_CONDUCT.md
│ ├── community
│ │ ├── .github
│ │ │ ├── ISSUE_TEMPLATE
│ │ │ │ ├── bug_report.yml
│ │ │ │ └── feature_request.yml
│ │ │ └── PULL_REQUEST_TEMPLATE.md
│ │ ├── CODE_OF_CONDUCT.md
│ │ ├── CONTRIBUTING.md
│ │ ├── README-library.md
│ │ └── SECURITY.md
│ ├── configuration.md
│ ├── context
│ │ └── README.md
│ ├── CONTRIBUTING.md
│ ├── CONVERSION_CHECKLIST.md
│ ├── DEPENDABOT.md
│ ├── DEPLOYMENT_GUIDE.md
│ ├── development.md
│ ├── DOCKER_SETUP.md
│ ├── DOCKER_TEST_SUCCESS.txt
│ ├── docker-compose.yml
│ ├── Dockerfile
│ ├── DOCUMENTATION_IMPROVEMENT_PLAN.md
│ ├── DOCUMENTATION_REVIEW_PROGRESS.md
│ ├── DOCUMENTATION_SYNC_SUMMARY.md
│ ├── DOCUMENTATION-UPDATE-PLAN.md
│ ├── DOCUSAURUS_MIGRATION.md
│ ├── DOCUSAURUS_QUICKSTART.md
│ ├── docusaurus.config.js
│ ├── examples
│ │ ├── bootstrap-adr-template.md
│ │ └── bootstrap-workflow-guide-for-users.md
│ ├── explanation
│ │ ├── adr-philosophy.md
│ │ ├── ai-architecture-concepts.md
│ │ ├── ai-workflow-concepts.md
│ │ ├── ape-framework-design.md
│ │ ├── architecture-overview.md
│ │ ├── context-file-tool-coverage.md
│ │ ├── index.md
│ │ ├── knowledge-generation-framework-design.md
│ │ ├── knowledge-graph.md
│ │ ├── mcp-architecture-flow.md
│ │ ├── mcp-concepts.md
│ │ ├── performance-design.md
│ │ ├── prompt-engineering.md
│ │ ├── reflexion-framework-design.md
│ │ ├── security-philosophy.md
│ │ ├── self-learning-architecture.md
│ │ ├── server-architecture.md
│ │ └── tool-design.md
│ ├── how-to
│ │ ├── deploy-to-production.md
│ │ └── index.md
│ ├── how-to-guides
│ │ ├── ape-implementation-strategy.md
│ │ ├── ape-usage-guide.md
│ │ ├── bootstrap-architecture-docs.md
│ │ ├── cicd-integration.md
│ │ ├── contribute.md
│ │ ├── custom-rules.md
│ │ ├── deploy-your-own-server.md
│ │ ├── deployment-readiness.md
│ │ ├── dynamic-pattern-configuration-system.md
│ │ ├── firecrawl-setup.md
│ │ ├── generate-adrs-from-prd.md
│ │ ├── getting-started-workflow-guidance.md
│ │ ├── hybrid-dag-bootstrap-design.md
│ │ ├── installation-guide.md
│ │ ├── interactive-adr-planning.md
│ │ ├── knowledge-generation-usage-guide.md
│ │ ├── large-team-scaling.md
│ │ ├── llm-context-file-configuration.md
│ │ ├── mcp-client-compatibility.md
│ │ ├── performance-testing.md
│ │ ├── prompting-guide.md
│ │ ├── push-tags-to-npm.md
│ │ ├── reflexion-implementation-strategy.md
│ │ ├── reflexion-usage-guide.md
│ │ ├── research-integration.md
│ │ ├── security-analysis.md
│ │ ├── server-context-file.md
│ │ ├── testing-guide.md
│ │ ├── tool-context-documentation-plan.md
│ │ ├── tool-development.md
│ │ ├── troubleshooting.md
│ │ ├── using-validated-patterns-with-live-sources.md
│ │ ├── validated-patterns-implementation.md
│ │ └── work-with-existing-adrs.md
│ ├── ide-rules
│ │ ├── additional-workflows.md
│ │ ├── command-structure.md
│ │ ├── environment-validation-workflow.md
│ │ ├── ide-specific
│ │ │ ├── cursor
│ │ │ │ └── cursor-rules-template.md
│ │ │ ├── jetbrains
│ │ │ │ └── jetbrains-rules-template.md
│ │ │ ├── vscode
│ │ │ │ └── vscode-rules-template.md
│ │ │ └── windsurf
│ │ │ └── windsurf-rules-template.md
│ │ ├── quickstart-guide.md
│ │ ├── README.md
│ │ ├── standalone-usage.md
│ │ └── universal-workflows.md
│ ├── IMPLEMENTATION-PLAN.md
│ ├── index.md
│ ├── knowledge-graph-resource-tool.md
│ ├── LOGO_DESIGN_PROMPT.md
│ ├── Makefile
│ ├── mcp-planning-tool-usage.md
│ ├── MIGRATION_GUIDE.md
│ ├── nginx.conf
│ ├── notes
│ │ ├── DEVELOPER_GUIDANCE.md
│ │ ├── knowledge-graph.md
│ │ ├── media
│ │ │ ├── 01-first-steps.md
│ │ │ ├── install-rhel.sh
│ │ │ ├── LICENSE
│ │ │ ├── mcp-client-config.md
│ │ │ ├── mcp-concepts.md
│ │ │ ├── performance-design.md
│ │ │ ├── security-philosophy.md
│ │ │ └── troubleshooting.md
│ │ ├── performance-design.md
│ │ ├── prompt-engineering.md
│ │ ├── README.md
│ │ ├── RESEARCH-DRIVEN-ARCHITECTURE.md
│ │ ├── RESEARCH-DRIVEN-INTEGRATION-ANALYSIS.md
│ │ ├── research-driven-workflow.md
│ │ ├── research-integration.md
│ │ ├── technical-debt
│ │ │ └── LINT_CLEANUP_PLAN.md
│ │ ├── tool-design.md
│ │ └── USER_GUIDANCE.md
│ ├── package-lock.json
│ ├── package.json
│ ├── patterns
│ │ └── firebase-patterns-comparison.md
│ ├── public
│ │ └── logo.png
│ ├── QUICK_START.md
│ ├── README_SCRIPTS.md
│ ├── README-library.md
│ ├── README.md
│ ├── reference
│ │ ├── analysis-tools.md
│ │ ├── api-documentation.md
│ │ ├── api-reference-updated.md
│ │ ├── api-reference.md
│ │ ├── comprehensive-api-reference.md
│ │ ├── environment-config.md
│ │ ├── generation-tools.md
│ │ ├── index.md
│ │ ├── mcp-client-config.md
│ │ ├── mermaid-diagrams-reference.md
│ │ ├── security-tools.md
│ │ ├── usage-examples.md
│ │ └── validation-tools.md
│ ├── release-dashboard.md
│ ├── research
│ │ └── README.md
│ ├── SECURITY.md
│ ├── setup-docusaurus.sh
│ ├── setup-website.sh
│ ├── sidebars.js
│ ├── sitemap.xml
│ ├── src
│ │ └── css
│ │ └── custom.css
│ ├── static
│ │ └── img
│ │ ├── logo.png
│ │ └── og-image.png
│ ├── technical.md
│ ├── test-infrastructure-simplification-summary.md
│ ├── TESTING_GUIDE.md
│ ├── testing-improvements-adr-018.md
│ ├── TODO_MANAGEMENT_FIX.md
│ ├── tsconfig.json
│ ├── tutorials
│ │ ├── 01-first-steps.md
│ │ ├── 02-existing-projects.md
│ │ ├── 03-advanced-analysis.md
│ │ ├── index.md
│ │ ├── security-focused-workflow.md
│ │ └── team-collaboration.md
│ ├── VERSION_MANAGEMENT.md
│ └── WEBSITE_SETUP.md
├── eslint.config.js
├── jest.config.js
├── LICENSE
├── Makefile
├── mcp-inspector-config.json
├── mcp-test-results.json
├── package-lock.json
├── package.json
├── patterns
│ ├── CONTRIBUTING.md
│ ├── infrastructure
│ │ ├── aws.yaml
│ │ ├── firebase-emulators.yaml
│ │ ├── firebase.yaml
│ │ ├── kubernetes.yaml
│ │ └── openshift.yaml
│ ├── README.md
│ └── schema.json
├── playbooks
│ ├── inventory.ini
│ ├── README.md
│ ├── TEST_RESULTS.md
│ ├── test-mcp-server-enhanced.yml
│ ├── test-mcp-server-with-ollama.yml
│ ├── test-mcp-server.yml
│ ├── test-workflows.yml
│ ├── VAULT_SETUP.md
│ └── vault.yml.example
├── README.md
├── reports
│ ├── comprehensive-validation_20251003_185155.json
│ ├── link-summary_20251003_185121.json
│ ├── link-validation_20250922_151241.txt
│ ├── link-validation_20250922_151242.txt
│ ├── link-validation_20251003_184136.txt
│ ├── link-validation_20251003_184141.txt
│ ├── link-validation_20251003_184945.txt
│ ├── link-validation_20251003_185000.txt
│ ├── link-validation_20251003_185121.txt
│ └── markdown-validation_20251003_185155.txt
├── requirements.txt
├── sample-project
│ ├── docs
│ │ └── adrs
│ │ ├── 001-database-architecture.md
│ │ ├── 002-api-authentication.md
│ │ └── 003-legacy-data-migration.md
│ ├── package.json
│ ├── README.md
│ └── server.js
├── scripts
│ ├── ai-release-notes.ts
│ ├── check-docs-links.sh
│ ├── check-duplicate-links.ts
│ ├── check-ripgrep.sh
│ ├── cleanup-template-docs.sh
│ ├── docs-workflow.sh
│ ├── fix-broken-links.py
│ ├── fix-docs-accuracy.sh
│ ├── fix-docs-content-accuracy.sh
│ ├── install-rhel.sh
│ ├── migrate-to-vitest.sh
│ ├── pre-commit-check.sh
│ ├── pre-commit-checklist.sh
│ ├── remove-duplicate-docs.sh
│ ├── sync-tags-to-npm.sh
│ ├── test-advanced-prompting.sh
│ ├── test-infrastructure.sh
│ ├── test-mcp-functionality.sh
│ ├── test-mcp-logging.ts
│ ├── test-mcp-server.sh
│ ├── test-node-compatibility.js
│ ├── test-npm-package.sh
│ ├── test-release-integration.sh
│ ├── validate-build.js
│ ├── validate-docs.sh
│ └── validate-links-with-sitemap.ts
├── SECURITY.md
├── src
│ ├── config
│ │ ├── ai-config.ts
│ │ └── ape-descriptions.ts
│ ├── index.ts
│ ├── prompts
│ │ ├── adr-suggestion-prompts.ts
│ │ ├── analysis-prompts.ts
│ │ ├── deployment-analysis-prompts.ts
│ │ ├── environment-analysis-prompts.ts
│ │ ├── index.ts
│ │ ├── prompt-catalog.ts
│ │ ├── research-integration-prompts.ts
│ │ ├── research-question-prompts.ts
│ │ ├── rule-generation-prompts.ts
│ │ ├── security-prompts.ts
│ │ └── validated-pattern-prompts.ts
│ ├── resources
│ │ ├── adr-by-id-resource.ts
│ │ ├── adrs-discovered-resource.ts
│ │ ├── adrs-review-resource.ts
│ │ ├── architectural-context-resource.ts
│ │ ├── code-quality-resource.ts
│ │ ├── conversation-snapshot-resource.ts
│ │ ├── deployment-history-resource.ts
│ │ ├── deployment-status-resource.ts
│ │ ├── environment-analysis-resource.ts
│ │ ├── index.ts
│ │ ├── knowledge-graph-resource.ts
│ │ ├── memory-expand-resource.ts
│ │ ├── memory-snapshots-resource.ts
│ │ ├── memory-stats-resource.ts
│ │ ├── pattern-base-code-by-platform-resource.ts
│ │ ├── pattern-by-name-resource.ts
│ │ ├── pattern-sources-by-platform-resource.ts
│ │ ├── project-metrics-resource.ts
│ │ ├── project-status-resource.ts
│ │ ├── research-by-topic-resource.ts
│ │ ├── research-index-resource.ts
│ │ ├── resource-cache.ts
│ │ ├── resource-router.ts
│ │ ├── rule-by-id-resource.ts
│ │ ├── rule-catalog-resource.ts
│ │ ├── rule-generation-resource.ts
│ │ ├── server-context-resource.ts
│ │ ├── technology-by-name-resource.ts
│ │ ├── todo-by-id-resource.ts
│ │ ├── todo-list-resource.ts
│ │ ├── tool-catalog-resource.ts
│ │ ├── validated-pattern-by-platform-resource.ts
│ │ └── validated-patterns-catalog-resource.ts
│ ├── templates
│ │ └── domain-knowledge-templates.ts
│ ├── tools
│ │ ├── adr-aggregator-tools.ts
│ │ ├── adr-bootstrap-validation-tool.ts
│ │ ├── adr-suggestion-tool.ts
│ │ ├── adr-validation-tool.ts
│ │ ├── analyze-gaps-tool.ts
│ │ ├── bootstrap-validation-loop-tool.ts
│ │ ├── ce-mcp-tools.ts
│ │ ├── content-masking-tool.ts
│ │ ├── conversation-memory-tool.ts
│ │ ├── deployment-analysis-tool.ts
│ │ ├── deployment-guidance-tool.ts
│ │ ├── deployment-readiness-tool.ts
│ │ ├── environment-analysis-tool.ts
│ │ ├── expand-analysis-tool.ts
│ │ ├── get-server-context-tool.ts
│ │ ├── interactive-adr-planning-tool.ts
│ │ ├── llm-cloud-management-tool.ts
│ │ ├── llm-database-management-tool.ts
│ │ ├── llm-web-search-tool.ts
│ │ ├── mcp-planning-tool.ts
│ │ ├── memory-loading-tool.ts
│ │ ├── perform-research-tool.ts
│ │ ├── research-integration-tool.ts
│ │ ├── research-question-tool.ts
│ │ ├── review-existing-adrs-tool.ts
│ │ ├── rule-generation-tool.ts
│ │ ├── search-codebase-tool.ts
│ │ ├── smart-git-push-tool-v2.ts
│ │ ├── tool-catalog.ts
│ │ ├── tool-chain-orchestrator.ts
│ │ ├── tool-dispatcher.ts
│ │ ├── tree-sitter-code-tools.ts
│ │ ├── troubleshoot-guided-workflow-tool.ts
│ │ └── update-knowledge-tool.ts
│ ├── types
│ │ ├── adr-aggregator.ts
│ │ ├── ape-framework.ts
│ │ ├── ce-mcp.ts
│ │ ├── conversation-context.ts
│ │ ├── conversation-memory.ts
│ │ ├── enhanced-errors.ts
│ │ ├── index.ts
│ │ ├── knowledge-generation.ts
│ │ ├── knowledge-graph-schemas.ts
│ │ ├── memory-entities.ts
│ │ ├── reflexion-framework.ts
│ │ ├── state-reinforcement.ts
│ │ ├── tiered-response.ts
│ │ ├── tool-arguments.ts
│ │ └── tool-context.ts
│ └── utils
│ ├── actual-file-operations.ts
│ ├── adr-action-analyzer.ts
│ ├── adr-aggregator-client.ts
│ ├── adr-context-detector.ts
│ ├── adr-discovery.ts
│ ├── adr-knowledge-initializer.ts
│ ├── adr-planning-task-integration.ts
│ ├── adr-suggestions.ts
│ ├── adr-timeline-extractor.ts
│ ├── adr-timeline-types.ts
│ ├── ai-executor.ts
│ ├── apply-cot-enhancement.ts
│ ├── automatic-prompt-engineering.ts
│ ├── bootstrap-task-integration.ts
│ ├── cache.ts
│ ├── chain-of-thought-template.ts
│ ├── conditional-request.ts
│ ├── config.ts
│ ├── content-masking.ts
│ ├── context-document-manager.ts
│ ├── conversation-memory-manager.ts
│ ├── dag-executor.ts
│ ├── deployment-analysis.ts
│ ├── deployment-task-integration.ts
│ ├── deployment-type-registry.ts
│ ├── directory-compat.ts
│ ├── dynamic-deployment-intelligence.ts
│ ├── enhanced-logging.ts
│ ├── environment-analysis.ts
│ ├── environment-capability-registry.ts
│ ├── file-system.ts
│ ├── file-system.ts.backup
│ ├── git-remote-detector.ts
│ ├── gitleaks-detector.ts
│ ├── index.ts
│ ├── interactive-approval.ts
│ ├── json-safe.ts
│ ├── knowledge-generation.ts
│ ├── knowledge-graph-manager.ts
│ ├── llm-artifact-detector.ts
│ ├── location-filter.ts
│ ├── mcp-response-validator.ts
│ ├── memory-entity-manager.ts
│ ├── memory-health-scoring.ts
│ ├── memory-migration-manager.ts
│ ├── memory-relationship-mapper.ts
│ ├── memory-rollback-manager.ts
│ ├── memory-transformation.ts
│ ├── mermaid-diagrams.ts
│ ├── monitoring.ts
│ ├── output-masking.ts
│ ├── pattern-contribution-helper.ts
│ ├── pattern-loader.ts
│ ├── pattern-research-utility.ts
│ ├── pattern-to-dag-converter.ts
│ ├── platform-detector.ts
│ ├── prompt-composition.ts
│ ├── prompt-execution.ts
│ ├── reflexion.ts
│ ├── release-readiness-detector.ts
│ ├── research-documentation.ts
│ ├── research-integration.ts
│ ├── research-orchestrator.ts
│ ├── research-questions.ts
│ ├── research-task-integration.ts
│ ├── resource-extractor.ts
│ ├── resource-versioning.ts
│ ├── ripgrep-wrapper.ts
│ ├── root-manager.ts
│ ├── rule-format.ts
│ ├── rule-generation.ts
│ ├── sandbox-executor.ts
│ ├── server-context-generator.ts
│ ├── state-reinforcement-manager.ts
│ ├── system-card-manager.ts
│ ├── task-manager.ts
│ ├── task-persistence.ts
│ ├── test-aware-defaults.ts
│ ├── tiered-response-manager.ts
│ ├── tree-sitter-analyzer.ts
│ └── validated-pattern-definitions.ts
├── tests
│ ├── __mocks__
│ │ ├── @tree-sitter-grammars
│ │ │ └── tree-sitter-hcl.ts
│ │ ├── child_process.ts
│ │ ├── tree-sitter-bash.ts
│ │ ├── tree-sitter-dockerfile.ts
│ │ ├── tree-sitter-javascript.ts
│ │ ├── tree-sitter-json.ts
│ │ ├── tree-sitter-python.ts
│ │ ├── tree-sitter-typescript.ts
│ │ ├── tree-sitter-yaml.ts
│ │ └── tree-sitter.ts
│ ├── ape.test.ts
│ ├── cache-architecture-analysis.md
│ ├── cache.test.ts
│ ├── config
│ │ └── ai-config.test.ts
│ ├── config.test.ts
│ ├── index.test.ts
│ ├── integration
│ │ ├── adr-aggregator.test.ts
│ │ ├── ce-mcp-flow.test.ts
│ │ ├── dependency-injection.test.ts
│ │ ├── esm-mocking-poc.test.ts
│ │ ├── hybrid-dag-kubernetes.test.ts
│ │ ├── memory-migration-integration.test.ts
│ │ ├── memory-migration-simple.test.ts
│ │ ├── memory-system-integration.test.ts
│ │ ├── smart-code-linking.test.ts
│ │ └── systemcard-bootstrap.test.ts
│ ├── knowledge-generation.test.ts
│ ├── mcp-server.test.ts
│ ├── performance
│ │ └── memory-performance.test.ts
│ ├── performance-effectiveness.test.ts
│ ├── prompts
│ │ ├── deployment-analysis-prompts.test.ts
│ │ ├── environment-analysis-prompts.test.ts
│ │ ├── prompt-catalog.test.ts
│ │ ├── research-integration-prompts.test.ts
│ │ ├── research-question-prompts.test.ts
│ │ ├── rule-generation-prompts.test.ts
│ │ └── security-prompts.test.ts
│ ├── README.md
│ ├── reflexion.test.ts
│ ├── research-question-tool.test.ts
│ ├── resources
│ │ ├── adrs-discovered-resource.test.ts
│ │ ├── adrs-review-resource.test.ts
│ │ ├── architectural-context-resource.test.ts
│ │ ├── code-quality-resource.test.ts
│ │ ├── conversation-snapshot-resource.test.ts
│ │ ├── deployment-history-resource.test.ts
│ │ ├── knowledge-graph-resource.test.ts
│ │ ├── memory-expand-resource.test.ts
│ │ ├── memory-stats-resource.test.ts
│ │ ├── server-context-resource.test.ts
│ │ └── tool-catalog-resource.test.ts
│ ├── setup.ts
│ ├── smoke.test.ts
│ ├── templates
│ │ └── domain-knowledge-templates.test.ts
│ ├── tools
│ │ ├── adr-bootstrap-validation-tool.test.ts
│ │ ├── adr-suggestion-tool.test.ts
│ │ ├── adr-validation-tool.test.ts
│ │ ├── bootstrap-validation-loop-tool.test.ts
│ │ ├── ce-mcp-tools.test.ts
│ │ ├── content-masking-tool.test.ts
│ │ ├── deployment-analysis-tool.test.ts
│ │ ├── deployment-guidance-tool.test.ts
│ │ ├── deployment-guidance-tool.vitest.ts
│ │ ├── deployment-readiness-tool.test.ts
│ │ ├── environment-analysis-tool.test.ts
│ │ ├── interactive-adr-planning-tool.test.ts
│ │ ├── mcp-planning-tool.test.ts
│ │ ├── memory-loading-tool.test.ts
│ │ ├── perform-research-tool.test.ts.backup
│ │ ├── research-integration-tool.test.ts
│ │ ├── review-existing-adrs-tool.test.ts
│ │ ├── rule-generation-tool.test.ts
│ │ ├── search-codebase-tool.test.ts
│ │ ├── smart-git-push-tool-v2.test.ts
│ │ ├── tool-catalog.test.ts
│ │ ├── tool-chain-orchestrator.test.ts
│ │ ├── tool-dispatcher.test.ts
│ │ ├── troubleshoot-guided-workflow-tool.test.ts
│ │ └── update-knowledge-tool.test.ts
│ ├── types
│ │ ├── ce-mcp.test.ts
│ │ └── conversation-context.test.ts
│ ├── types.test.ts
│ ├── utils
│ │ ├── adr-knowledge-initializer.test.ts
│ │ ├── adr-planning-task-integration.test.ts
│ │ ├── advanced-prompting-test-utils.ts
│ │ ├── ai-executor.test.ts
│ │ ├── bootstrap-task-integration.test.ts
│ │ ├── conditional-request.test.ts
│ │ ├── context-document-manager.test.ts
│ │ ├── dag-executor.test.ts
│ │ ├── deployment-analysis.test.ts
│ │ ├── deployment-task-integration.test.ts
│ │ ├── environment-capability-registry.test.ts
│ │ ├── esm-mock-helper.ts
│ │ ├── file-system.test.ts
│ │ ├── find-related-code.test.ts
│ │ ├── gitleaks-detector.test.ts
│ │ ├── interactive-approval.test.ts
│ │ ├── llm-artifact-detector.test.ts
│ │ ├── location-filter.test.ts
│ │ ├── mcp-response-validator.test.ts
│ │ ├── memory-entity-manager.test.ts
│ │ ├── memory-relationship-mapper.test.ts
│ │ ├── memory-rollback-manager.test.ts
│ │ ├── memory-transformation.test.ts
│ │ ├── monitoring-smoke.test.ts
│ │ ├── monitoring.test.ts
│ │ ├── output-masking.test.ts
│ │ ├── pattern-loader.test.ts
│ │ ├── pattern-validation.test.ts
│ │ ├── prompt-composition.test.ts
│ │ ├── prompt-execution.test.ts
│ │ ├── release-readiness-detector.test.ts
│ │ ├── research-documentation.test.ts
│ │ ├── research-integration.test.ts
│ │ ├── research-orchestrator-delegation.test.ts
│ │ ├── research-questions.test.ts
│ │ ├── research-task-integration.test.ts
│ │ ├── resource-extractor.test.ts
│ │ ├── resource-versioning.test.ts
│ │ ├── rule-format.test.ts
│ │ ├── rule-generation.test.ts
│ │ ├── sandbox-executor.test.ts
│ │ ├── system-card-manager.test.ts
│ │ ├── task-manager.test.ts
│ │ ├── test-aware-defaults.test.ts
│ │ ├── test-config.ts
│ │ ├── test-helpers.test.ts
│ │ ├── test-helpers.ts
│ │ ├── test-infrastructure.test.ts
│ │ ├── test-infrastructure.ts
│ │ ├── tree-sitter-analyzer.test.ts
│ │ └── tree-sitter-jest-integration.test.ts
│ ├── version.test.ts
│ └── vitest.setup.ts
├── tsconfig.json
├── typedoc.json
└── vitest.config.ts
```
# Files
--------------------------------------------------------------------------------
/src/index.ts:
--------------------------------------------------------------------------------
```typescript
1 | #!/usr/bin/env node
2 |
3 | /**
4 | * MCP ADR Analysis Server
5 | * Main entry point for the Model Context Protocol server
6 | *
7 | * This server provides Tools, Resources, and Prompts for analyzing
8 | * Architectural Decision Records and project architecture.
9 | */
10 |
11 | import { Server } from '@modelcontextprotocol/sdk/server/index.js';
12 | import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
13 | import {
14 | CallToolRequestSchema,
15 | ListToolsRequestSchema,
16 | ListResourcesRequestSchema,
17 | ReadResourceRequestSchema,
18 | ListPromptsRequestSchema,
19 | GetPromptRequestSchema,
20 | type CallToolResult,
21 | } from '@modelcontextprotocol/sdk/types.js';
22 |
23 | import { readFileSync } from 'fs';
24 | import { join } from 'path';
25 | import { getCurrentDirCompat } from './utils/directory-compat.js';
26 | import { McpAdrError } from './types/index.js';
27 | import { CONVERSATION_CONTEXT_SCHEMA } from './types/conversation-context.js';
28 | import {
29 | maskMcpResponse,
30 | createMaskingConfig,
31 | type MaskingConfig,
32 | } from './utils/output-masking.js';
33 | import {
34 | loadConfig,
35 | validateProjectPath,
36 | createLogger,
37 | printConfigSummary,
38 | type ServerConfig,
39 | } from './utils/config.js';
40 | import { KnowledgeGraphManager } from './utils/knowledge-graph-manager.js';
41 | import {
42 | getEnhancedModeDefault,
43 | getKnowledgeEnhancementDefault,
44 | } from './utils/test-aware-defaults.js';
45 | import { StateReinforcementManager } from './utils/state-reinforcement-manager.js';
46 | import { ConversationMemoryManager } from './utils/conversation-memory-manager.js';
47 | import { MemoryEntityManager } from './utils/memory-entity-manager.js';
48 | import { RootManager } from './utils/root-manager.js';
49 | import { ServerContextGenerator } from './utils/server-context-generator.js';
50 | import { type ToolContext, createNoOpContext } from './types/tool-context.js';
51 | import {
52 | type GetWorkflowGuidanceArgs,
53 | type GetArchitecturalContextArgs,
54 | type GetDevelopmentGuidanceArgs,
55 | type GenerateAdrFromDecisionArgs,
56 | type ValidateRulesArgs,
57 | type CreateRuleSetArgs,
58 | type ToolChainOrchestratorArgs,
59 | type ReadFileArgs,
60 | type WriteFileArgs,
61 | type AnalyzeProjectEcosystemArgs,
62 | type ArchitecturalDomain,
63 | type AnalyzeContentSecurityArgs,
64 | type GenerateContentMaskingArgs,
65 | type ConfigureCustomPatternsArgs,
66 | type ApplyBasicContentMaskingArgs,
67 | type ValidateContentMaskingArgs,
68 | type ActionArgs,
69 | type TodoManagementV2Args,
70 | type GenerateArchitecturalKnowledgeFunction,
71 | type ExecuteWithReflexionFunction,
72 | type RetrieveRelevantMemoriesFunction,
73 | type CreateToolReflexionConfigFunction,
74 | } from './types/tool-arguments.js';
75 | import {
76 | executeSearchTools,
77 | getSearchToolsDefinition,
78 | type SearchToolsArgs,
79 | } from './tools/tool-dispatcher.js';
80 | import {
81 | shouldUseCEMCPDirective,
82 | getCEMCPDirective,
83 | formatDirectiveResponse,
84 | } from './tools/ce-mcp-tools.js';
85 | import { loadAIConfig, isCEMCPEnabled } from './config/ai-config.js';
86 |
87 | /**
88 | * Get version from package.json
89 | */
90 | function getPackageVersion(): string {
91 | try {
92 | // Handle both Jest environment and normal execution
93 | const currentDir = getCurrentDirCompat();
94 |
95 | // Strategy 1: Try multiple possible locations for package.json
96 | const possiblePaths = [
97 | join(currentDir, 'package.json'),
98 | join(currentDir, '..', 'package.json'),
99 | join(currentDir, '..', '..', 'package.json'),
100 | join(process.cwd(), 'package.json'),
101 | ];
102 |
103 | for (const packageJsonPath of possiblePaths) {
104 | try {
105 | const packageJson = JSON.parse(readFileSync(packageJsonPath, 'utf-8'));
106 | if (packageJson.name === 'mcp-adr-analysis-server') {
107 | return packageJson.version;
108 | }
109 | } catch {
110 | // Try next path
111 | }
112 | }
113 |
114 | // Strategy 2: Use process.env.npm_package_version if available (during npm scripts)
115 | if (process.env['npm_package_version']) {
116 | return process.env['npm_package_version'];
117 | }
118 |
119 | // Final fallback: Use generic version instead of hardcoded specific version
120 | // This prevents the need to update this code when version changes
121 | return 'unknown'; // Generic fallback - no longer tied to specific version
122 | } catch (error) {
123 | console.error('Error reading package.json:', error);
124 | return 'unknown'; // Generic fallback - no longer tied to specific version
125 | }
126 | }
127 |
128 | /**
129 | * Server configuration
130 | */
131 | const SERVER_INFO = {
132 | name: 'mcp-adr-analysis-server',
133 | version: getPackageVersion(),
134 | description: 'MCP server for analyzing Architectural Decision Records and project architecture',
135 | };
136 |
137 | /**
138 | * Main server class
139 | */
140 | export class McpAdrAnalysisServer {
141 | private server: Server;
142 | private maskingConfig: MaskingConfig;
143 | private config: ServerConfig;
144 | private logger: ReturnType<typeof createLogger>;
145 | private kgManager: KnowledgeGraphManager;
146 | private stateReinforcementManager: StateReinforcementManager;
147 | private conversationMemoryManager: ConversationMemoryManager;
148 | private memoryEntityManager: MemoryEntityManager;
149 | private rootManager: RootManager;
150 | private contextGenerator: ServerContextGenerator;
151 |
152 | constructor() {
153 | // Load and validate configuration
154 | this.config = loadConfig();
155 | this.logger = createLogger(this.config);
156 | this.kgManager = new KnowledgeGraphManager();
157 | this.stateReinforcementManager = new StateReinforcementManager(this.kgManager);
158 | this.conversationMemoryManager = new ConversationMemoryManager(this.kgManager);
159 | this.memoryEntityManager = new MemoryEntityManager();
160 |
161 | // Initialize root manager for file access control
162 | this.rootManager = new RootManager(this.config.projectPath, this.config.adrDirectory);
163 |
164 | // Initialize server context generator
165 | this.contextGenerator = new ServerContextGenerator();
166 |
167 | // Print configuration summary
168 | printConfigSummary(this.config);
169 |
170 | // Note: Validation will be done during startup
171 |
172 | this.server = new Server(SERVER_INFO, {
173 | capabilities: {
174 | tools: {},
175 | resources: {},
176 | prompts: {},
177 | },
178 | });
179 |
180 | this.maskingConfig = createMaskingConfig();
181 | this.setupHandlers();
182 | }
183 |
184 | /**
185 | * Validate configuration and project setup
186 | */
187 | private async validateConfiguration(): Promise<void> {
188 | try {
189 | await validateProjectPath(this.config.projectPath);
190 | this.logger.info(`Project path validated: ${this.config.projectPath}`);
191 | } catch (error: unknown) {
192 | const errorMessage = error instanceof Error ? error.message : String(error);
193 | this.logger.error(`Configuration validation failed: ${errorMessage}`);
194 | throw error;
195 | }
196 | }
197 |
198 | /**
199 | * Public health check method for testing
200 | */
201 | async healthCheck(): Promise<void> {
202 | await this.validateConfiguration();
203 | this.logger.info('Health check completed successfully');
204 | }
205 |
206 | /**
207 | * Setup MCP protocol handlers
208 | *
209 | * @description Configures all Model Context Protocol request handlers for the ADR Analysis Server.
210 | * Implements the complete MCP specification including tools, resources, and prompts.
211 | *
212 | * @private
213 | * @since 2.0.0
214 | * @category MCP Protocol
215 | */
216 | private setupHandlers(): void {
217 | /**
218 | * List Tools Handler - MCP Protocol Endpoint
219 | *
220 | * @description Returns the complete catalog of available tools for ADR analysis,
221 | * research, validation, and deployment operations. Each tool includes comprehensive
222 | * input schemas and descriptions for client integration.
223 | *
224 | * @returns {Promise<{tools: Array}>} Complete tool catalog with schemas
225 | *
226 | * @example
227 | * ```typescript
228 | * // MCP Client usage
229 | * const tools = await mcpClient.listTools();
230 | * console.log(tools.tools.length); // 20+ available tools
231 | *
232 | * // Find specific tool
233 | * const researchTool = tools.tools.find(t => t.name === 'perform_research');
234 | * console.log(researchTool.description); // Tool description
235 | * ```
236 | *
237 | * @mcp-endpoint
238 | * @category Tools
239 | */
240 | this.server.setRequestHandler(ListToolsRequestSchema, async () => {
241 | return {
242 | tools: [
243 | // Meta-tool for dynamic tool discovery (CE-MCP Phase 3)
244 | getSearchToolsDefinition(),
245 | {
246 | name: 'analyze_project_ecosystem',
247 | description:
248 | 'Comprehensive recursive project ecosystem analysis with advanced prompting techniques (Knowledge Generation + Reflexion)',
249 | inputSchema: {
250 | type: 'object',
251 | properties: {
252 | projectPath: {
253 | type: 'string',
254 | description:
255 | 'Path to the project directory to analyze (optional, uses configured PROJECT_PATH if not provided)',
256 | },
257 | includePatterns: {
258 | type: 'array',
259 | items: { type: 'string' },
260 | description: 'File patterns to include in analysis',
261 | },
262 | enhancedMode: {
263 | type: 'boolean',
264 | description:
265 | 'Enable advanced prompting features (Knowledge Generation + Reflexion)',
266 | default: true,
267 | },
268 | knowledgeEnhancement: {
269 | type: 'boolean',
270 | description: 'Enable Knowledge Generation for technology-specific insights',
271 | default: true,
272 | },
273 | learningEnabled: {
274 | type: 'boolean',
275 | description: 'Enable Reflexion learning from past analysis outcomes',
276 | default: true,
277 | },
278 | technologyFocus: {
279 | type: 'array',
280 | items: { type: 'string' },
281 | description:
282 | 'Specific technologies to focus analysis on (auto-detected if not provided)',
283 | },
284 | analysisDepth: {
285 | type: 'string',
286 | enum: ['basic', 'detailed', 'comprehensive'],
287 | description: 'Depth of ecosystem analysis',
288 | default: 'comprehensive',
289 | },
290 | includeEnvironment: {
291 | type: 'boolean',
292 | description:
293 | 'Automatically include comprehensive environment analysis (default: true)',
294 | default: true,
295 | },
296 | recursiveDepth: {
297 | type: 'string',
298 | description: 'Depth of recursive project analysis',
299 | enum: ['shallow', 'moderate', 'deep', 'comprehensive'],
300 | default: 'comprehensive',
301 | },
302 | analysisScope: {
303 | type: 'array',
304 | items: { type: 'string' },
305 | description:
306 | 'Specific analysis areas to focus on (e.g., ["security", "performance", "architecture", "dependencies"])',
307 | },
308 | conversationContext: CONVERSATION_CONTEXT_SCHEMA,
309 | },
310 | required: [],
311 | },
312 | },
313 | {
314 | name: 'get_architectural_context',
315 | description:
316 | 'Get detailed architectural context for specific files or the entire project, automatically sets up ADR infrastructure if missing, and provides outcome-focused workflow for project success',
317 | inputSchema: {
318 | type: 'object',
319 | properties: {
320 | filePath: {
321 | type: 'string',
322 | description:
323 | 'Specific file path to analyze (optional, analyzes entire project if not provided)',
324 | },
325 | includeCompliance: {
326 | type: 'boolean',
327 | description: 'Include compliance checks in the analysis',
328 | default: true,
329 | },
330 | conversationContext: CONVERSATION_CONTEXT_SCHEMA,
331 | },
332 | },
333 | },
334 | {
335 | name: 'generate_adrs_from_prd',
336 | description:
337 | 'Generate Architectural Decision Records from a Product Requirements Document with advanced prompting techniques (APE + Knowledge Generation)',
338 | inputSchema: {
339 | type: 'object',
340 | properties: {
341 | prdPath: {
342 | type: 'string',
343 | description: 'Path to the PRD.md file',
344 | },
345 | outputDirectory: {
346 | type: 'string',
347 | description:
348 | 'Directory to output generated ADRs (optional, uses configured ADR_DIRECTORY if not provided)',
349 | },
350 | enhancedMode: {
351 | type: 'boolean',
352 | description: 'Enable advanced prompting features (APE + Knowledge Generation)',
353 | default: true,
354 | },
355 | promptOptimization: {
356 | type: 'boolean',
357 | description: 'Enable Automatic Prompt Engineering for optimized ADR generation',
358 | default: true,
359 | },
360 | knowledgeEnhancement: {
361 | type: 'boolean',
362 | description: 'Enable Knowledge Generation for domain-specific insights',
363 | default: true,
364 | },
365 | prdType: {
366 | type: 'string',
367 | enum: [
368 | 'web-application',
369 | 'mobile-app',
370 | 'microservices',
371 | 'data-platform',
372 | 'api-service',
373 | 'general',
374 | ],
375 | description: 'Type of PRD for optimized knowledge generation',
376 | default: 'general',
377 | },
378 | conversationContext: CONVERSATION_CONTEXT_SCHEMA,
379 | },
380 | required: ['prdPath'],
381 | },
382 | },
383 | {
384 | name: 'compare_adr_progress',
385 | description:
386 | 'Compare TODO.md progress against ADRs and current environment to validate implementation status',
387 | inputSchema: {
388 | type: 'object',
389 | properties: {
390 | todoPath: {
391 | type: 'string',
392 | description: 'Path to TODO.md file to analyze',
393 | default: 'TODO.md',
394 | },
395 | adrDirectory: {
396 | type: 'string',
397 | description: 'Directory containing ADR files',
398 | default: 'docs/adrs',
399 | },
400 | projectPath: {
401 | type: 'string',
402 | description: 'Path to project root for environment analysis',
403 | default: '.',
404 | },
405 | environment: {
406 | type: 'string',
407 | enum: ['development', 'staging', 'production', 'testing', 'auto-detect'],
408 | description:
409 | 'Target environment context for validation (auto-detect will infer from project structure)',
410 | default: 'auto-detect',
411 | },
412 | environmentConfig: {
413 | type: 'object',
414 | description: 'Environment-specific configuration and requirements',
415 | properties: {
416 | requiredFiles: {
417 | type: 'array',
418 | items: { type: 'string' },
419 | description: 'Files required for this environment',
420 | },
421 | requiredServices: {
422 | type: 'array',
423 | items: { type: 'string' },
424 | description: 'Services that must be implemented for this environment',
425 | },
426 | securityLevel: {
427 | type: 'string',
428 | enum: ['low', 'medium', 'high', 'critical'],
429 | description: 'Required security level for this environment',
430 | },
431 | performanceRequirements: {
432 | type: 'object',
433 | description: 'Performance requirements for this environment',
434 | },
435 | },
436 | },
437 | validationType: {
438 | type: 'string',
439 | enum: ['full', 'todo-only', 'adr-only', 'environment-only'],
440 | description: 'Type of validation to perform',
441 | default: 'full',
442 | },
443 | includeFileChecks: {
444 | type: 'boolean',
445 | description: 'Include file existence and implementation checks',
446 | default: true,
447 | },
448 | includeRuleValidation: {
449 | type: 'boolean',
450 | description: 'Include architectural rule compliance validation',
451 | default: true,
452 | },
453 | deepCodeAnalysis: {
454 | type: 'boolean',
455 | description:
456 | 'Perform deep code analysis to distinguish mock from production implementations',
457 | default: true,
458 | },
459 | functionalValidation: {
460 | type: 'boolean',
461 | description:
462 | 'Validate that code actually functions according to ADR goals, not just exists',
463 | default: true,
464 | },
465 | strictMode: {
466 | type: 'boolean',
467 | description:
468 | 'Enable strict validation mode with reality-check mechanisms against overconfident assessments',
469 | default: true,
470 | },
471 | environmentValidation: {
472 | type: 'boolean',
473 | description: 'Enable environment-specific validation rules and checks',
474 | default: true,
475 | },
476 | },
477 | },
478 | },
479 | {
480 | name: 'analyze_content_security',
481 | description:
482 | 'Analyze content for sensitive information using AI-powered detection with optional memory integration for security pattern learning',
483 | inputSchema: {
484 | type: 'object',
485 | properties: {
486 | content: {
487 | type: 'string',
488 | description: 'Content to analyze for sensitive information',
489 | },
490 | contentType: {
491 | type: 'string',
492 | enum: ['code', 'documentation', 'configuration', 'logs', 'general'],
493 | description: 'Type of content being analyzed',
494 | default: 'general',
495 | },
496 | userDefinedPatterns: {
497 | type: 'array',
498 | items: { type: 'string' },
499 | description: 'User-defined sensitive patterns to detect',
500 | },
501 | enableMemoryIntegration: {
502 | type: 'boolean',
503 | description:
504 | 'Enable memory entity storage for security pattern learning and institutional knowledge building',
505 | default: true,
506 | },
507 | knowledgeEnhancement: {
508 | type: 'boolean',
509 | description:
510 | 'Enable Generated Knowledge Prompting for security and privacy expertise',
511 | default: true,
512 | },
513 | enhancedMode: {
514 | type: 'boolean',
515 | description: 'Enable advanced prompting features',
516 | default: true,
517 | },
518 | },
519 | required: ['content'],
520 | },
521 | },
522 | {
523 | name: 'generate_content_masking',
524 | description: 'Generate masking instructions for detected sensitive content',
525 | inputSchema: {
526 | type: 'object',
527 | properties: {
528 | content: {
529 | type: 'string',
530 | description: 'Content to mask',
531 | },
532 | detectedItems: {
533 | type: 'array',
534 | items: {
535 | type: 'object',
536 | properties: {
537 | type: { type: 'string' },
538 | content: { type: 'string' },
539 | startPosition: { type: 'number' },
540 | endPosition: { type: 'number' },
541 | severity: { type: 'string' },
542 | },
543 | },
544 | description: 'Detected sensitive items to mask',
545 | },
546 | maskingStrategy: {
547 | type: 'string',
548 | enum: ['full', 'partial', 'placeholder', 'environment'],
549 | description: 'Strategy for masking content',
550 | default: 'full',
551 | },
552 | },
553 | required: ['content', 'detectedItems'],
554 | },
555 | },
556 | {
557 | name: 'configure_custom_patterns',
558 | description: 'Configure custom sensitive patterns for a project',
559 | inputSchema: {
560 | type: 'object',
561 | properties: {
562 | projectPath: {
563 | type: 'string',
564 | description: 'Path to the project directory',
565 | },
566 | existingPatterns: {
567 | type: 'array',
568 | items: { type: 'string' },
569 | description: 'Existing patterns to consider',
570 | },
571 | },
572 | required: ['projectPath'],
573 | },
574 | },
575 | {
576 | name: 'apply_basic_content_masking',
577 | description: 'Apply basic content masking (fallback when AI is not available)',
578 | inputSchema: {
579 | type: 'object',
580 | properties: {
581 | content: {
582 | type: 'string',
583 | description: 'Content to mask',
584 | },
585 | maskingStrategy: {
586 | type: 'string',
587 | enum: ['full', 'partial', 'placeholder'],
588 | description: 'Strategy for masking content',
589 | default: 'full',
590 | },
591 | },
592 | required: ['content'],
593 | },
594 | },
595 | {
596 | name: 'validate_content_masking',
597 | description: 'Validate that content masking was applied correctly',
598 | inputSchema: {
599 | type: 'object',
600 | properties: {
601 | originalContent: {
602 | type: 'string',
603 | description: 'Original content before masking',
604 | },
605 | maskedContent: {
606 | type: 'string',
607 | description: 'Content after masking',
608 | },
609 | },
610 | required: ['originalContent', 'maskedContent'],
611 | },
612 | },
613 | {
614 | name: 'manage_cache',
615 | description: 'Manage MCP resource cache (clear, stats, cleanup)',
616 | inputSchema: {
617 | type: 'object',
618 | properties: {
619 | action: {
620 | type: 'string',
621 | enum: ['clear', 'stats', 'cleanup', 'invalidate'],
622 | description: 'Cache management action to perform',
623 | },
624 | key: {
625 | type: 'string',
626 | description: 'Specific cache key to invalidate (for invalidate action)',
627 | },
628 | },
629 | required: ['action'],
630 | },
631 | },
632 | {
633 | name: 'configure_output_masking',
634 | description: 'Configure content masking for all MCP outputs',
635 | inputSchema: {
636 | type: 'object',
637 | properties: {
638 | enabled: {
639 | type: 'boolean',
640 | description: 'Enable or disable output masking',
641 | },
642 | strategy: {
643 | type: 'string',
644 | enum: ['full', 'partial', 'placeholder', 'environment'],
645 | description: 'Masking strategy to use',
646 | },
647 | customPatterns: {
648 | type: 'array',
649 | items: { type: 'string' },
650 | description: 'Custom patterns to mask',
651 | },
652 | action: {
653 | type: 'string',
654 | enum: ['get', 'set', 'reset'],
655 | description: 'Configuration action',
656 | default: 'get',
657 | },
658 | },
659 | },
660 | },
661 | {
662 | name: 'suggest_adrs',
663 | description:
664 | 'Suggest architectural decisions with advanced prompting techniques (Knowledge Generation + Reflexion). TIP: Read @.mcp-server-context.md first for project history, patterns, and previous ADRs to ensure consistency.',
665 | inputSchema: {
666 | type: 'object',
667 | properties: {
668 | projectPath: {
669 | type: 'string',
670 | description: 'Path to the project directory',
671 | default: '.',
672 | },
673 | analysisType: {
674 | type: 'string',
675 | enum: ['implicit_decisions', 'code_changes', 'comprehensive'],
676 | description: 'Type of analysis to perform',
677 | default: 'comprehensive',
678 | },
679 | beforeCode: {
680 | type: 'string',
681 | description: 'Code before changes (for code_changes analysis)',
682 | },
683 | afterCode: {
684 | type: 'string',
685 | description: 'Code after changes (for code_changes analysis)',
686 | },
687 | changeDescription: {
688 | type: 'string',
689 | description: 'Description of the changes (for code_changes analysis)',
690 | },
691 | commitMessages: {
692 | type: 'array',
693 | items: { type: 'string' },
694 | description: 'Related commit messages (for code_changes analysis)',
695 | },
696 | existingAdrs: {
697 | type: 'array',
698 | items: { type: 'string' },
699 | description: 'List of existing ADR titles to avoid duplication',
700 | },
701 | enhancedMode: {
702 | type: 'boolean',
703 | description:
704 | 'Enable advanced prompting features (Knowledge Generation + Reflexion)',
705 | default: true,
706 | },
707 | learningEnabled: {
708 | type: 'boolean',
709 | description: 'Enable Reflexion learning from past experiences',
710 | default: true,
711 | },
712 | knowledgeEnhancement: {
713 | type: 'boolean',
714 | description: 'Enable Knowledge Generation for domain-specific insights',
715 | default: true,
716 | },
717 | conversationContext: CONVERSATION_CONTEXT_SCHEMA,
718 | },
719 | },
720 | },
721 | {
722 | name: 'generate_adr_from_decision',
723 | description:
724 | 'Generate a complete ADR from decision data. TIP: Reference @.mcp-server-context.md to align with existing architectural patterns and decisions.',
725 | inputSchema: {
726 | type: 'object',
727 | properties: {
728 | decisionData: {
729 | type: 'object',
730 | properties: {
731 | title: { type: 'string', description: 'Decision title' },
732 | context: { type: 'string', description: 'Decision context and problem' },
733 | decision: { type: 'string', description: 'The architectural decision' },
734 | consequences: { type: 'string', description: 'Decision consequences' },
735 | alternatives: {
736 | type: 'array',
737 | items: { type: 'string' },
738 | description: 'Alternative approaches considered',
739 | },
740 | evidence: {
741 | type: 'array',
742 | items: { type: 'string' },
743 | description: 'Supporting evidence for the decision',
744 | },
745 | },
746 | required: ['title', 'context', 'decision', 'consequences'],
747 | },
748 | templateFormat: {
749 | type: 'string',
750 | enum: ['nygard', 'madr', 'custom'],
751 | description: 'ADR template format to use',
752 | default: 'nygard',
753 | },
754 | existingAdrs: {
755 | type: 'array',
756 | items: { type: 'string' },
757 | description: 'List of existing ADRs for numbering and references',
758 | },
759 | adrDirectory: {
760 | type: 'string',
761 | description: 'Directory where ADRs are stored',
762 | default: 'docs/adrs',
763 | },
764 | },
765 | required: ['decisionData'],
766 | },
767 | },
768 | {
769 | name: 'generate_adr_bootstrap',
770 | description:
771 | "Generate bootstrap.sh and validate_bootstrap.sh scripts to ensure deployed code follows ADR requirements. **CRITICAL**: Before generating scripts, use WebFetch to query the base code repository (e.g., https://github.com/validatedpatterns/common for OpenShift) and authoritative pattern documentation (e.g., https://play.validatedpatterns.io/). Merge the base repository code into your project and have bootstrap.sh call the pattern's scripts rather than generating everything from scratch. This ensures compliance with validated deployment patterns.",
772 | inputSchema: {
773 | type: 'object',
774 | properties: {
775 | projectPath: {
776 | type: 'string',
777 | description: 'Path to the project directory',
778 | default: '.',
779 | },
780 | adrDirectory: {
781 | type: 'string',
782 | description: 'Directory where ADRs are stored',
783 | default: 'docs/adrs',
784 | },
785 | outputPath: {
786 | type: 'string',
787 | description: 'Directory where to generate scripts',
788 | default: '.',
789 | },
790 | scriptType: {
791 | type: 'string',
792 | enum: ['bootstrap', 'validate', 'both'],
793 | description: 'Which scripts to generate',
794 | default: 'both',
795 | },
796 | includeTests: {
797 | type: 'boolean',
798 | description: 'Include test execution in bootstrap',
799 | default: true,
800 | },
801 | includeDeployment: {
802 | type: 'boolean',
803 | description: 'Include deployment steps in bootstrap',
804 | default: true,
805 | },
806 | customValidations: {
807 | type: 'array',
808 | items: { type: 'string' },
809 | description: 'Custom validation commands to include',
810 | },
811 | conversationContext: CONVERSATION_CONTEXT_SCHEMA,
812 | },
813 | },
814 | },
815 | {
816 | name: 'bootstrap_validation_loop',
817 | description:
818 | '**GUIDED EXECUTION MODE**: This tool guides you through an interactive, step-by-step deployment validation workflow. It does NOT execute commands internally - instead, it tells YOU what commands to run and processes the results iteratively. **Workflow**: (1) First call with iteration=0: Detects platform (OpenShift/K8s/Docker), validates environment connection, and requests human approval for target platform. (2) Subsequent calls: After running each command and reporting back with output, the tool provides next steps. **Environment Validation**: Before deployment, the tool verifies connection to the target platform (e.g., `oc status` for OpenShift, `kubectl cluster-info` for K8s) and requires explicit human confirmation. **Validated Patterns Integration**: Automatically identifies base code repositories (e.g., validatedpatterns/common for OpenShift) and guides you to merge them into your project. **Deployment Cleanup**: Supports CI/CD-style workflows with deployment teardown/restart guidance. **Call this tool iteratively**, passing previous command output back each time.',
819 | inputSchema: {
820 | type: 'object',
821 | properties: {
822 | projectPath: {
823 | type: 'string',
824 | description: 'Path to the project directory',
825 | default: '.',
826 | },
827 | adrDirectory: {
828 | type: 'string',
829 | description: 'Directory where ADRs are stored',
830 | default: 'docs/adrs',
831 | },
832 | targetEnvironment: {
833 | type: 'string',
834 | enum: ['development', 'staging', 'production', 'testing'],
835 | description: 'Target deployment environment',
836 | default: 'development',
837 | },
838 | maxIterations: {
839 | type: 'number',
840 | description: 'Maximum validation/fix iterations',
841 | default: 5,
842 | },
843 | autoFix: {
844 | type: 'boolean',
845 | description: 'Whether to generate auto-fix suggestions in guidance',
846 | default: true,
847 | },
848 | updateAdrsWithLearnings: {
849 | type: 'boolean',
850 | description: 'Update ADRs with deployment learnings (non-sensitive)',
851 | default: true,
852 | },
853 | currentIteration: {
854 | type: 'number',
855 | description:
856 | 'Current iteration number (0 for initial call, then increment). Used to track workflow progress.',
857 | default: 0,
858 | },
859 | previousExecutionOutput: {
860 | type: 'string',
861 | description:
862 | 'Output from the previous command execution. Paste the stdout/stderr from running the command that was recommended in the previous iteration.',
863 | default: '',
864 | },
865 | previousExecutionSuccess: {
866 | type: 'boolean',
867 | description:
868 | 'Whether the previous command execution succeeded (exit code 0). Set to true if command succeeded, false if it failed.',
869 | default: false,
870 | },
871 | deploymentCleanupRequested: {
872 | type: 'boolean',
873 | description:
874 | 'Set to true to request deployment cleanup/teardown guidance (for CI/CD workflows that need to delete and restart deployments).',
875 | default: false,
876 | },
877 | conversationContext: CONVERSATION_CONTEXT_SCHEMA,
878 | },
879 | },
880 | },
881 | {
882 | name: 'discover_existing_adrs',
883 | description: 'Discover and catalog existing ADRs in the project',
884 | inputSchema: {
885 | type: 'object',
886 | properties: {
887 | adrDirectory: {
888 | type: 'string',
889 | description: 'Directory to search for ADRs',
890 | default: 'docs/adrs',
891 | },
892 | includeContent: {
893 | type: 'boolean',
894 | description: 'Whether to include ADR content in analysis',
895 | default: false,
896 | },
897 | },
898 | },
899 | },
900 | {
901 | name: 'analyze_adr_timeline',
902 | description:
903 | 'Analyze ADR timeline with smart time tracking, adaptive thresholds, and actionable recommendations. Auto-detects project context (startup/growth/mature) and generates prioritized work queue based on staleness, implementation lag, and technical debt.',
904 | inputSchema: {
905 | type: 'object',
906 | properties: {
907 | projectPath: {
908 | type: 'string',
909 | description: 'Path to the project directory',
910 | default: '.',
911 | },
912 | adrDirectory: {
913 | type: 'string',
914 | description: 'Directory containing ADR files',
915 | default: 'docs/adrs',
916 | },
917 | generateActions: {
918 | type: 'boolean',
919 | description: 'Generate actionable work items with priority and effort estimates',
920 | default: true,
921 | },
922 | thresholdProfile: {
923 | type: 'string',
924 | enum: ['startup', 'growth', 'mature', 'maintenance', 'feature_development'],
925 | description:
926 | 'Threshold profile for action generation (auto-detected if not specified)',
927 | },
928 | autoDetectContext: {
929 | type: 'boolean',
930 | description: 'Auto-detect project phase from git activity and ADR patterns',
931 | default: true,
932 | },
933 | includeContent: {
934 | type: 'boolean',
935 | description: 'Include ADR content for better analysis',
936 | default: true,
937 | },
938 | forceExtract: {
939 | type: 'boolean',
940 | description: 'Force timeline extraction even if ADRs have dates',
941 | default: false,
942 | },
943 | },
944 | },
945 | },
946 | {
947 | name: 'review_existing_adrs',
948 | description:
949 | 'Review existing ADRs against actual code implementation with cloud/DevOps expertise. TIP: After review, call get_server_context to update @.mcp-server-context.md with findings.',
950 | inputSchema: {
951 | type: 'object',
952 | properties: {
953 | adrDirectory: {
954 | type: 'string',
955 | description: 'Directory containing ADR files',
956 | default: 'docs/adrs',
957 | },
958 | projectPath: {
959 | type: 'string',
960 | description: 'Path to the project directory',
961 | default: '.',
962 | },
963 | specificAdr: {
964 | type: 'string',
965 | description: 'Specific ADR filename or title to review (optional)',
966 | },
967 | analysisDepth: {
968 | type: 'string',
969 | enum: ['basic', 'detailed', 'comprehensive'],
970 | description: 'Depth of analysis to perform',
971 | default: 'detailed',
972 | },
973 | includeTreeSitter: {
974 | type: 'boolean',
975 | description: 'Use tree-sitter for enhanced code analysis',
976 | default: true,
977 | },
978 | generateUpdatePlan: {
979 | type: 'boolean',
980 | description: 'Generate action plan for updating non-compliant ADRs',
981 | default: true,
982 | },
983 | conversationContext: CONVERSATION_CONTEXT_SCHEMA,
984 | },
985 | },
986 | },
987 | {
988 | name: 'validate_adr',
989 | description:
990 | 'Validate an existing ADR against actual infrastructure reality using research-driven analysis. TIP: Compare findings against patterns in @.mcp-server-context.md for consistency checks.',
991 | inputSchema: {
992 | type: 'object',
993 | properties: {
994 | adrPath: {
995 | type: 'string',
996 | description: 'Path to the ADR file to validate (relative or absolute)',
997 | },
998 | projectPath: {
999 | type: 'string',
1000 | description: 'Path to the project directory',
1001 | default: '.',
1002 | },
1003 | adrDirectory: {
1004 | type: 'string',
1005 | description: 'Directory containing ADR files',
1006 | default: 'docs/adrs',
1007 | },
1008 | includeEnvironmentCheck: {
1009 | type: 'boolean',
1010 | description: 'Include live environment verification in validation',
1011 | default: true,
1012 | },
1013 | confidenceThreshold: {
1014 | type: 'number',
1015 | description: 'Minimum research confidence threshold (0-1)',
1016 | default: 0.6,
1017 | },
1018 | },
1019 | required: ['adrPath'],
1020 | },
1021 | },
1022 | {
1023 | name: 'validate_all_adrs',
1024 | description: 'Validate all ADRs in a directory against actual infrastructure reality',
1025 | inputSchema: {
1026 | type: 'object',
1027 | properties: {
1028 | projectPath: {
1029 | type: 'string',
1030 | description: 'Path to the project directory',
1031 | default: '.',
1032 | },
1033 | adrDirectory: {
1034 | type: 'string',
1035 | description: 'Directory containing ADR files',
1036 | default: 'docs/adrs',
1037 | },
1038 | includeEnvironmentCheck: {
1039 | type: 'boolean',
1040 | description: 'Include live environment verification in validation',
1041 | default: true,
1042 | },
1043 | minConfidence: {
1044 | type: 'number',
1045 | description: 'Minimum research confidence for validation (0-1)',
1046 | default: 0.6,
1047 | },
1048 | },
1049 | },
1050 | },
1051 | {
1052 | name: 'incorporate_research',
1053 | description: 'Incorporate research findings into architectural decisions',
1054 | inputSchema: {
1055 | type: 'object',
1056 | properties: {
1057 | researchPath: {
1058 | type: 'string',
1059 | description: 'Path to research directory',
1060 | default: 'docs/research',
1061 | },
1062 | adrDirectory: {
1063 | type: 'string',
1064 | description: 'Path to ADR directory',
1065 | default: 'docs/adrs',
1066 | },
1067 | analysisType: {
1068 | type: 'string',
1069 | enum: [
1070 | 'monitor',
1071 | 'extract_topics',
1072 | 'evaluate_impact',
1073 | 'generate_updates',
1074 | 'comprehensive',
1075 | ],
1076 | description: 'Type of research analysis to perform',
1077 | default: 'comprehensive',
1078 | },
1079 | existingTopics: {
1080 | type: 'array',
1081 | items: { type: 'string' },
1082 | description: 'Previously identified research topics',
1083 | },
1084 | researchTopics: {
1085 | type: 'array',
1086 | items: {
1087 | type: 'object',
1088 | properties: {
1089 | id: { type: 'string' },
1090 | title: { type: 'string' },
1091 | category: { type: 'string' },
1092 | keyFindings: { type: 'array', items: { type: 'string' } },
1093 | relevanceScore: { type: 'number' },
1094 | },
1095 | },
1096 | description: 'Research topics for impact evaluation',
1097 | },
1098 | adrId: {
1099 | type: 'string',
1100 | description: 'ADR ID for update generation',
1101 | },
1102 | updateType: {
1103 | type: 'string',
1104 | enum: ['content', 'status', 'consequences', 'alternatives', 'deprecation'],
1105 | description: 'Type of ADR update to generate',
1106 | },
1107 | researchFindings: {
1108 | type: 'array',
1109 | items: {
1110 | type: 'object',
1111 | properties: {
1112 | finding: { type: 'string' },
1113 | evidence: { type: 'array', items: { type: 'string' } },
1114 | impact: { type: 'string' },
1115 | },
1116 | },
1117 | description: 'Research findings for update generation',
1118 | },
1119 | },
1120 | },
1121 | },
1122 | {
1123 | name: 'create_research_template',
1124 | description: 'Create a research template file for documenting findings',
1125 | inputSchema: {
1126 | type: 'object',
1127 | properties: {
1128 | title: {
1129 | type: 'string',
1130 | description: 'Title of the research',
1131 | },
1132 | category: {
1133 | type: 'string',
1134 | description: 'Research category',
1135 | default: 'general',
1136 | },
1137 | researchPath: {
1138 | type: 'string',
1139 | description: 'Path to research directory',
1140 | default: 'docs/research',
1141 | },
1142 | },
1143 | required: ['title'],
1144 | },
1145 | },
1146 | {
1147 | name: 'request_action_confirmation',
1148 | description: 'Request confirmation before applying research-based changes',
1149 | inputSchema: {
1150 | type: 'object',
1151 | properties: {
1152 | action: {
1153 | type: 'string',
1154 | description: 'Description of the action to be performed',
1155 | },
1156 | details: {
1157 | type: 'string',
1158 | description: 'Detailed information about the action',
1159 | },
1160 | impact: {
1161 | type: 'string',
1162 | enum: ['low', 'medium', 'high', 'critical'],
1163 | description: 'Impact level of the action',
1164 | default: 'medium',
1165 | },
1166 | },
1167 | required: ['action', 'details'],
1168 | },
1169 | },
1170 | {
1171 | name: 'generate_rules',
1172 | description: 'Generate architectural rules from ADRs and code patterns',
1173 | inputSchema: {
1174 | type: 'object',
1175 | properties: {
1176 | source: {
1177 | type: 'string',
1178 | enum: ['adrs', 'patterns', 'both'],
1179 | description: 'Source for rule generation',
1180 | default: 'both',
1181 | },
1182 | adrDirectory: {
1183 | type: 'string',
1184 | description: 'Directory containing ADR files',
1185 | default: 'docs/adrs',
1186 | },
1187 | projectPath: {
1188 | type: 'string',
1189 | description: 'Path to project for pattern analysis',
1190 | default: '.',
1191 | },
1192 | existingRules: {
1193 | type: 'array',
1194 | items: {
1195 | type: 'object',
1196 | properties: {
1197 | id: { type: 'string' },
1198 | name: { type: 'string' },
1199 | description: { type: 'string' },
1200 | },
1201 | },
1202 | description: 'Existing rules to avoid duplication',
1203 | },
1204 | outputFormat: {
1205 | type: 'string',
1206 | enum: ['json', 'yaml', 'both'],
1207 | description: 'Output format for rules',
1208 | default: 'json',
1209 | },
1210 | },
1211 | },
1212 | },
1213 | {
1214 | name: 'validate_rules',
1215 | description: 'Validate code against architectural rules',
1216 | inputSchema: {
1217 | type: 'object',
1218 | properties: {
1219 | filePath: {
1220 | type: 'string',
1221 | description: 'Path to file to validate',
1222 | },
1223 | fileContent: {
1224 | type: 'string',
1225 | description: 'Content to validate (alternative to filePath)',
1226 | },
1227 | fileName: {
1228 | type: 'string',
1229 | description: 'Name of file being validated (when using fileContent)',
1230 | },
1231 | rules: {
1232 | type: 'array',
1233 | items: {
1234 | type: 'object',
1235 | properties: {
1236 | id: { type: 'string' },
1237 | name: { type: 'string' },
1238 | description: { type: 'string' },
1239 | pattern: { type: 'string' },
1240 | severity: { type: 'string' },
1241 | message: { type: 'string' },
1242 | },
1243 | required: ['id', 'name', 'pattern', 'severity', 'message'],
1244 | },
1245 | description: 'Rules to validate against',
1246 | },
1247 | validationType: {
1248 | type: 'string',
1249 | enum: ['file', 'function', 'component', 'module'],
1250 | description: 'Type of validation to perform',
1251 | default: 'file',
1252 | },
1253 | reportFormat: {
1254 | type: 'string',
1255 | enum: ['summary', 'detailed', 'json'],
1256 | description: 'Format for validation report',
1257 | default: 'detailed',
1258 | },
1259 | },
1260 | required: ['rules'],
1261 | },
1262 | },
1263 | {
1264 | name: 'create_rule_set',
1265 | description: 'Create machine-readable rule set in JSON/YAML format',
1266 | inputSchema: {
1267 | type: 'object',
1268 | properties: {
1269 | name: {
1270 | type: 'string',
1271 | description: 'Name of the rule set',
1272 | },
1273 | description: {
1274 | type: 'string',
1275 | description: 'Description of the rule set',
1276 | default: 'Generated architectural rule set',
1277 | },
1278 | adrRules: {
1279 | type: 'array',
1280 | items: { type: 'object' },
1281 | description: 'Rules extracted from ADRs',
1282 | },
1283 | patternRules: {
1284 | type: 'array',
1285 | items: { type: 'object' },
1286 | description: 'Rules generated from code patterns',
1287 | },
1288 | rules: {
1289 | type: 'array',
1290 | items: { type: 'object' },
1291 | description: 'Additional rules to include',
1292 | },
1293 | outputFormat: {
1294 | type: 'string',
1295 | enum: ['json', 'yaml', 'both'],
1296 | description: 'Output format for rule set',
1297 | default: 'json',
1298 | },
1299 | author: {
1300 | type: 'string',
1301 | description: 'Author of the rule set',
1302 | default: 'MCP ADR Analysis Server',
1303 | },
1304 | },
1305 | required: ['name'],
1306 | },
1307 | },
1308 | {
1309 | name: 'analyze_environment',
1310 | description:
1311 | 'Analyze environment context and provide optimization recommendations with optional memory integration for environment snapshot tracking',
1312 | inputSchema: {
1313 | type: 'object',
1314 | properties: {
1315 | projectPath: {
1316 | type: 'string',
1317 | description: 'Path to project directory',
1318 | default: '.',
1319 | },
1320 | adrDirectory: {
1321 | type: 'string',
1322 | description: 'Directory containing ADR files',
1323 | default: 'docs/adrs',
1324 | },
1325 | analysisType: {
1326 | type: 'string',
1327 | enum: [
1328 | 'specs',
1329 | 'containerization',
1330 | 'requirements',
1331 | 'compliance',
1332 | 'comprehensive',
1333 | ],
1334 | description: 'Type of environment analysis to perform',
1335 | default: 'comprehensive',
1336 | },
1337 | currentEnvironment: {
1338 | type: 'object',
1339 | description: 'Current environment specifications (for compliance analysis)',
1340 | },
1341 | requirements: {
1342 | type: 'object',
1343 | description: 'Environment requirements (for compliance analysis)',
1344 | },
1345 | industryStandards: {
1346 | type: 'array',
1347 | items: { type: 'string' },
1348 | description: 'Industry standards to assess compliance against',
1349 | },
1350 | enableMemoryIntegration: {
1351 | type: 'boolean',
1352 | description:
1353 | 'Enable memory entity storage for environment snapshot tracking and historical analysis',
1354 | default: true,
1355 | },
1356 | enableTrendAnalysis: {
1357 | type: 'boolean',
1358 | description:
1359 | 'Enable analysis of environment changes over time using stored snapshots',
1360 | default: true,
1361 | },
1362 | },
1363 | },
1364 | },
1365 | {
1366 | name: 'generate_research_questions',
1367 | description:
1368 | 'Generate context-aware research questions and create research tracking system',
1369 | inputSchema: {
1370 | type: 'object',
1371 | properties: {
1372 | analysisType: {
1373 | type: 'string',
1374 | enum: ['correlation', 'relevance', 'questions', 'tracking', 'comprehensive'],
1375 | description: 'Type of research analysis to perform',
1376 | default: 'comprehensive',
1377 | },
1378 | researchContext: {
1379 | type: 'object',
1380 | properties: {
1381 | topic: { type: 'string' },
1382 | category: { type: 'string' },
1383 | scope: { type: 'string' },
1384 | objectives: { type: 'array', items: { type: 'string' } },
1385 | constraints: { type: 'array', items: { type: 'string' } },
1386 | timeline: { type: 'string' },
1387 | },
1388 | description: 'Research context and objectives',
1389 | },
1390 | problems: {
1391 | type: 'array',
1392 | items: {
1393 | type: 'object',
1394 | properties: {
1395 | id: { type: 'string' },
1396 | description: { type: 'string' },
1397 | category: { type: 'string' },
1398 | severity: { type: 'string' },
1399 | context: { type: 'string' },
1400 | },
1401 | },
1402 | description: 'Problems to correlate with knowledge graph',
1403 | },
1404 | knowledgeGraph: {
1405 | type: 'object',
1406 | properties: {
1407 | technologies: { type: 'array', items: { type: 'object' } },
1408 | patterns: { type: 'array', items: { type: 'object' } },
1409 | adrs: { type: 'array', items: { type: 'object' } },
1410 | relationships: { type: 'array', items: { type: 'object' } },
1411 | },
1412 | description: 'Architectural knowledge graph',
1413 | },
1414 | relevantKnowledge: {
1415 | type: 'object',
1416 | properties: {
1417 | adrs: { type: 'array', items: { type: 'object' } },
1418 | patterns: { type: 'array', items: { type: 'object' } },
1419 | gaps: { type: 'array', items: { type: 'object' } },
1420 | opportunities: { type: 'array', items: { type: 'object' } },
1421 | },
1422 | description: 'Relevant knowledge for question generation',
1423 | },
1424 | researchQuestions: {
1425 | type: 'array',
1426 | items: {
1427 | type: 'object',
1428 | properties: {
1429 | id: { type: 'string' },
1430 | question: { type: 'string' },
1431 | type: { type: 'string' },
1432 | priority: { type: 'string' },
1433 | timeline: { type: 'string' },
1434 | methodology: { type: 'string' },
1435 | },
1436 | },
1437 | description: 'Research questions for task tracking',
1438 | },
1439 | currentProgress: {
1440 | type: 'array',
1441 | items: {
1442 | type: 'object',
1443 | properties: {
1444 | questionId: { type: 'string' },
1445 | status: { type: 'string' },
1446 | progress: { type: 'number' },
1447 | findings: { type: 'array', items: { type: 'string' } },
1448 | blockers: { type: 'array', items: { type: 'string' } },
1449 | },
1450 | },
1451 | description: 'Current research progress',
1452 | },
1453 | projectPath: {
1454 | type: 'string',
1455 | description: 'Path to project directory',
1456 | default: '.',
1457 | },
1458 | adrDirectory: {
1459 | type: 'string',
1460 | description: 'Directory containing ADR files',
1461 | default: 'docs/adrs',
1462 | },
1463 | },
1464 | },
1465 | },
1466 | {
1467 | name: 'perform_research',
1468 | description:
1469 | 'Perform research using cascading sources: project files → knowledge graph → environment resources → web search (fallback)',
1470 | inputSchema: {
1471 | type: 'object',
1472 | properties: {
1473 | question: {
1474 | type: 'string',
1475 | description: 'The research question to answer',
1476 | },
1477 | projectPath: {
1478 | type: 'string',
1479 | description: 'Path to project directory',
1480 | default: '.',
1481 | },
1482 | adrDirectory: {
1483 | type: 'string',
1484 | description: 'Directory containing ADR files',
1485 | default: 'docs/adrs',
1486 | },
1487 | confidenceThreshold: {
1488 | type: 'number',
1489 | description: 'Minimum confidence threshold (0-1) before suggesting web search',
1490 | default: 0.6,
1491 | minimum: 0,
1492 | maximum: 1,
1493 | },
1494 | performWebSearch: {
1495 | type: 'boolean',
1496 | description: 'Enable web search recommendations when confidence is low',
1497 | default: true,
1498 | },
1499 | },
1500 | required: ['question'],
1501 | },
1502 | },
1503 | {
1504 | name: 'search_codebase',
1505 | description:
1506 | 'Atomic tool for searching codebase files based on query patterns. Returns raw file matches with relevance scores. Extracted from ResearchOrchestrator per ADR-018.',
1507 | inputSchema: {
1508 | type: 'object',
1509 | properties: {
1510 | query: {
1511 | type: 'string',
1512 | description: 'Search query (e.g., "Docker configuration", "authentication")',
1513 | },
1514 | projectPath: {
1515 | type: 'string',
1516 | description: 'Path to project root',
1517 | default: '.',
1518 | },
1519 | scope: {
1520 | type: 'array',
1521 | items: { type: 'string' },
1522 | description: 'Optional file scope patterns (e.g., ["src/**", "config/**"])',
1523 | },
1524 | includeContent: {
1525 | type: 'boolean',
1526 | description: 'Include file content in results',
1527 | default: false,
1528 | },
1529 | maxFiles: {
1530 | type: 'number',
1531 | description: 'Maximum files to return',
1532 | default: 20,
1533 | minimum: 1,
1534 | maximum: 100,
1535 | },
1536 | enableTreeSitter: {
1537 | type: 'boolean',
1538 | description: 'Use tree-sitter for enhanced analysis',
1539 | default: true,
1540 | },
1541 | relevanceThreshold: {
1542 | type: 'number',
1543 | description: 'Minimum relevance threshold (0-1)',
1544 | default: 0.2,
1545 | minimum: 0,
1546 | maximum: 1,
1547 | },
1548 | },
1549 | required: ['query'],
1550 | },
1551 | },
1552 | {
1553 | name: 'llm_web_search',
1554 | description: 'LLM-managed web search using Firecrawl for cross-platform support',
1555 | inputSchema: {
1556 | type: 'object',
1557 | properties: {
1558 | query: {
1559 | type: 'string',
1560 | description: 'The search query to execute',
1561 | },
1562 | maxResults: {
1563 | type: 'number',
1564 | description: 'Maximum results to return',
1565 | default: 5,
1566 | minimum: 1,
1567 | maximum: 20,
1568 | },
1569 | includeContent: {
1570 | type: 'boolean',
1571 | description: 'Include full content in results',
1572 | default: true,
1573 | },
1574 | llmInstructions: {
1575 | type: 'string',
1576 | description: 'LLM instructions for search optimization',
1577 | },
1578 | projectPath: {
1579 | type: 'string',
1580 | description: 'Path to project directory',
1581 | default: '.',
1582 | },
1583 | adrDirectory: {
1584 | type: 'string',
1585 | description: 'Directory containing ADR files',
1586 | default: 'docs/adrs',
1587 | },
1588 | },
1589 | required: ['query'],
1590 | },
1591 | },
1592 | {
1593 | name: 'llm_cloud_management',
1594 | description: 'LLM-managed cloud provider operations with research-driven approach',
1595 | inputSchema: {
1596 | type: 'object',
1597 | properties: {
1598 | provider: {
1599 | type: 'string',
1600 | enum: ['aws', 'azure', 'gcp', 'redhat', 'ubuntu', 'macos'],
1601 | description: 'Cloud provider to use',
1602 | },
1603 | action: {
1604 | type: 'string',
1605 | description: 'Action to perform',
1606 | },
1607 | parameters: {
1608 | type: 'object',
1609 | description: 'Action parameters',
1610 | },
1611 | llmInstructions: {
1612 | type: 'string',
1613 | description: 'LLM instructions for command generation',
1614 | },
1615 | researchFirst: {
1616 | type: 'boolean',
1617 | description: 'Research best approach first',
1618 | default: true,
1619 | },
1620 | projectPath: {
1621 | type: 'string',
1622 | description: 'Path to project directory',
1623 | default: '.',
1624 | },
1625 | adrDirectory: {
1626 | type: 'string',
1627 | description: 'Directory containing ADR files',
1628 | default: 'docs/adrs',
1629 | },
1630 | },
1631 | required: ['provider', 'action', 'llmInstructions'],
1632 | },
1633 | },
1634 | {
1635 | name: 'llm_database_management',
1636 | description: 'LLM-managed database operations with research-driven approach',
1637 | inputSchema: {
1638 | type: 'object',
1639 | properties: {
1640 | database: {
1641 | type: 'string',
1642 | enum: ['postgresql', 'mongodb', 'redis', 'mysql', 'mariadb'],
1643 | description: 'Database type to use',
1644 | },
1645 | action: {
1646 | type: 'string',
1647 | description: 'Database action to perform',
1648 | },
1649 | parameters: {
1650 | type: 'object',
1651 | description: 'Action parameters',
1652 | },
1653 | llmInstructions: {
1654 | type: 'string',
1655 | description: 'LLM instructions for command generation',
1656 | },
1657 | researchFirst: {
1658 | type: 'boolean',
1659 | description: 'Research best approach first',
1660 | default: true,
1661 | },
1662 | projectPath: {
1663 | type: 'string',
1664 | description: 'Path to project directory',
1665 | default: '.',
1666 | },
1667 | adrDirectory: {
1668 | type: 'string',
1669 | description: 'Directory containing ADR files',
1670 | default: 'docs/adrs',
1671 | },
1672 | },
1673 | required: ['database', 'action', 'llmInstructions'],
1674 | },
1675 | },
1676 | {
1677 | name: 'analyze_deployment_progress',
1678 | description: 'Analyze deployment progress and verify completion with outcome rules',
1679 | inputSchema: {
1680 | type: 'object',
1681 | properties: {
1682 | analysisType: {
1683 | type: 'string',
1684 | enum: ['tasks', 'cicd', 'progress', 'completion', 'comprehensive'],
1685 | description: 'Type of deployment analysis to perform',
1686 | default: 'comprehensive',
1687 | },
1688 | adrDirectory: {
1689 | type: 'string',
1690 | description: 'Directory containing ADR files',
1691 | default: 'docs/adrs',
1692 | },
1693 | todoPath: {
1694 | type: 'string',
1695 | description: 'Path to TODO.md file for task identification',
1696 | default: 'TODO.md',
1697 | },
1698 | cicdLogs: {
1699 | type: 'string',
1700 | description: 'CI/CD pipeline logs for analysis',
1701 | },
1702 | pipelineConfig: {
1703 | type: 'string',
1704 | description: 'CI/CD pipeline configuration',
1705 | },
1706 | deploymentTasks: {
1707 | type: 'array',
1708 | items: {
1709 | type: 'object',
1710 | properties: {
1711 | taskId: { type: 'string' },
1712 | taskName: { type: 'string' },
1713 | status: { type: 'string' },
1714 | progress: { type: 'number' },
1715 | category: { type: 'string' },
1716 | priority: { type: 'string' },
1717 | verificationCriteria: { type: 'array', items: { type: 'string' } },
1718 | expectedOutcome: { type: 'string' },
1719 | },
1720 | },
1721 | description: 'Deployment tasks for progress calculation',
1722 | },
1723 | outcomeRules: {
1724 | type: 'array',
1725 | items: {
1726 | type: 'object',
1727 | properties: {
1728 | ruleId: { type: 'string' },
1729 | description: { type: 'string' },
1730 | criteria: { type: 'array', items: { type: 'string' } },
1731 | verificationMethod: { type: 'string' },
1732 | },
1733 | },
1734 | description: 'Outcome rules for completion verification',
1735 | },
1736 | actualOutcomes: {
1737 | type: 'array',
1738 | items: {
1739 | type: 'object',
1740 | properties: {
1741 | taskId: { type: 'string' },
1742 | outcome: { type: 'string' },
1743 | evidence: { type: 'array', items: { type: 'string' } },
1744 | timestamp: { type: 'string' },
1745 | },
1746 | },
1747 | description: 'Actual deployment outcomes',
1748 | },
1749 | cicdStatus: {
1750 | type: 'object',
1751 | description: 'CI/CD pipeline status data',
1752 | },
1753 | environmentStatus: {
1754 | type: 'object',
1755 | description: 'Environment status data',
1756 | },
1757 | },
1758 | },
1759 | },
1760 | {
1761 | name: 'check_ai_execution_status',
1762 | description:
1763 | 'Check AI execution configuration and status for debugging prompt-only mode issues',
1764 | inputSchema: {
1765 | type: 'object',
1766 | properties: {},
1767 | required: [],
1768 | },
1769 | },
1770 | {
1771 | name: 'get_workflow_guidance',
1772 | description:
1773 | 'Get intelligent workflow guidance and tool recommendations based on your goals and project context to achieve expected outcomes efficiently',
1774 | inputSchema: {
1775 | type: 'object',
1776 | properties: {
1777 | goal: {
1778 | type: 'string',
1779 | description:
1780 | 'What you want to accomplish (e.g., "analyze new project", "document existing decisions", "security audit", "modernize legacy system")',
1781 | },
1782 | projectContext: {
1783 | type: 'string',
1784 | description:
1785 | 'Current state of your project (e.g., "new project", "existing project with ADRs", "legacy codebase", "greenfield development")',
1786 | enum: [
1787 | 'new_project',
1788 | 'existing_with_adrs',
1789 | 'existing_without_adrs',
1790 | 'legacy_codebase',
1791 | 'greenfield',
1792 | 'maintenance_mode',
1793 | 'unknown',
1794 | ],
1795 | },
1796 | availableAssets: {
1797 | type: 'array',
1798 | items: { type: 'string' },
1799 | description:
1800 | 'What assets you already have (e.g., ["PRD.md", "existing ADRs", "codebase", "documentation", "test suite"])',
1801 | },
1802 | timeframe: {
1803 | type: 'string',
1804 | description: 'Available time/effort level',
1805 | enum: [
1806 | 'quick_analysis',
1807 | 'thorough_review',
1808 | 'comprehensive_audit',
1809 | 'ongoing_process',
1810 | ],
1811 | },
1812 | primaryConcerns: {
1813 | type: 'array',
1814 | items: { type: 'string' },
1815 | description:
1816 | 'Main areas of concern (e.g., ["security", "performance", "maintainability", "scalability", "compliance"])',
1817 | },
1818 | },
1819 | required: ['goal', 'projectContext'],
1820 | },
1821 | },
1822 | {
1823 | name: 'get_development_guidance',
1824 | description:
1825 | 'Get comprehensive development guidance that translates architectural decisions and workflow recommendations into specific coding tasks, implementation patterns, and development roadmap',
1826 | inputSchema: {
1827 | type: 'object',
1828 | properties: {
1829 | developmentPhase: {
1830 | type: 'string',
1831 | description: 'Current development phase',
1832 | enum: [
1833 | 'planning',
1834 | 'setup',
1835 | 'implementation',
1836 | 'testing',
1837 | 'deployment',
1838 | 'maintenance',
1839 | 'refactoring',
1840 | ],
1841 | },
1842 | adrsToImplement: {
1843 | type: 'array',
1844 | items: { type: 'string' },
1845 | description:
1846 | 'List of ADR titles or file paths that need to be implemented in code',
1847 | },
1848 | technologyStack: {
1849 | type: 'array',
1850 | items: { type: 'string' },
1851 | description:
1852 | 'Current technology stack (e.g., ["TypeScript", "React", "Node.js", "PostgreSQL", "Docker"])',
1853 | },
1854 | currentProgress: {
1855 | type: 'string',
1856 | description: 'What has already been implemented or current state of development',
1857 | },
1858 | teamContext: {
1859 | type: 'object',
1860 | properties: {
1861 | size: {
1862 | type: 'string',
1863 | enum: ['solo', 'small_team', 'medium_team', 'large_team'],
1864 | },
1865 | experienceLevel: {
1866 | type: 'string',
1867 | enum: ['junior', 'mixed', 'senior', 'expert'],
1868 | },
1869 | },
1870 | },
1871 | timeline: {
1872 | type: 'string',
1873 | description: 'Development timeline or deadline constraints',
1874 | },
1875 | focusAreas: {
1876 | type: 'array',
1877 | items: { type: 'string' },
1878 | description:
1879 | 'Specific areas to focus on (e.g., ["API design", "database schema", "testing strategy", "deployment pipeline"])',
1880 | },
1881 | },
1882 | required: ['developmentPhase'],
1883 | },
1884 | },
1885 | {
1886 | name: 'list_roots',
1887 | description:
1888 | 'List available file system roots that can be accessed. Use this to discover what directories are available before reading files.',
1889 | inputSchema: {
1890 | type: 'object',
1891 | properties: {},
1892 | },
1893 | },
1894 | {
1895 | name: 'read_directory',
1896 | description:
1897 | 'List files and folders in a directory. Use this to explore the file structure within accessible roots.',
1898 | inputSchema: {
1899 | type: 'object',
1900 | properties: {
1901 | path: {
1902 | type: 'string',
1903 | description:
1904 | 'Directory path to list (relative to project root or absolute within roots)',
1905 | },
1906 | },
1907 | required: ['path'],
1908 | },
1909 | },
1910 | {
1911 | name: 'read_file',
1912 | description: 'Read contents of a file',
1913 | inputSchema: {
1914 | type: 'object',
1915 | properties: {
1916 | filePath: {
1917 | type: 'string',
1918 | description: 'Path to the file to read',
1919 | },
1920 | path: {
1921 | type: 'string',
1922 | description: 'Path to the file to read (alias for filePath)',
1923 | },
1924 | },
1925 | required: [],
1926 | },
1927 | },
1928 | {
1929 | name: 'write_file',
1930 | description: 'Write content to a file',
1931 | inputSchema: {
1932 | type: 'object',
1933 | properties: {
1934 | path: {
1935 | type: 'string',
1936 | description: 'Path to the file to write',
1937 | },
1938 | content: {
1939 | type: 'string',
1940 | description: 'Content to write to the file',
1941 | },
1942 | },
1943 | required: ['path', 'content'],
1944 | },
1945 | },
1946 | {
1947 | name: 'list_directory',
1948 | description: 'List contents of a directory',
1949 | inputSchema: {
1950 | type: 'object',
1951 | properties: {
1952 | path: {
1953 | type: 'string',
1954 | description: 'Path to the directory to list',
1955 | },
1956 | },
1957 | required: ['path'],
1958 | },
1959 | },
1960 | {
1961 | name: 'generate_deployment_guidance',
1962 | description:
1963 | 'Generate deployment guidance and instructions from ADRs with environment-specific configurations',
1964 | inputSchema: {
1965 | type: 'object',
1966 | properties: {
1967 | adrDirectory: {
1968 | type: 'string',
1969 | default: 'docs/adrs',
1970 | description: 'Directory containing ADR files',
1971 | },
1972 | environment: {
1973 | type: 'string',
1974 | enum: ['development', 'staging', 'production', 'all'],
1975 | default: 'production',
1976 | description: 'Target deployment environment',
1977 | },
1978 | format: {
1979 | type: 'string',
1980 | enum: ['markdown', 'scripts', 'structured', 'all'],
1981 | default: 'markdown',
1982 | description: 'Output format for guidance',
1983 | },
1984 | projectPath: {
1985 | type: 'string',
1986 | description:
1987 | 'Project root path (optional, uses configured PROJECT_PATH if not provided)',
1988 | },
1989 | includeScripts: {
1990 | type: 'boolean',
1991 | default: true,
1992 | description: 'Generate deployment scripts',
1993 | },
1994 | includeConfigs: {
1995 | type: 'boolean',
1996 | default: true,
1997 | description: 'Generate configuration files',
1998 | },
1999 | includeValidation: {
2000 | type: 'boolean',
2001 | default: true,
2002 | description: 'Include validation and health checks',
2003 | },
2004 | technologyFilter: {
2005 | type: 'array',
2006 | items: {
2007 | type: 'string',
2008 | enum: [
2009 | 'containerization',
2010 | 'database',
2011 | 'web-server',
2012 | 'cache',
2013 | 'message-queue',
2014 | 'monitoring',
2015 | 'security',
2016 | 'ci-cd',
2017 | 'infrastructure',
2018 | ],
2019 | },
2020 | description: 'Filter by specific technology categories',
2021 | },
2022 | customRequirements: {
2023 | type: 'array',
2024 | items: { type: 'string' },
2025 | description: 'Additional custom requirements',
2026 | },
2027 | includeRollback: {
2028 | type: 'boolean',
2029 | default: true,
2030 | description: 'Include rollback procedures',
2031 | },
2032 | generateFiles: {
2033 | type: 'boolean',
2034 | default: false,
2035 | description: 'Actually generate files (vs just guidance)',
2036 | },
2037 | },
2038 | required: [],
2039 | },
2040 | },
2041 | {
2042 | name: 'smart_git_push',
2043 | description:
2044 | 'AI-driven security-focused git push with credential detection, file filtering, and deployment metrics tracking. Tests should be run by calling AI and results provided.',
2045 | inputSchema: {
2046 | type: 'object',
2047 | properties: {
2048 | branch: {
2049 | type: 'string',
2050 | description:
2051 | 'Target branch for push (optional, uses current branch if not specified)',
2052 | },
2053 | message: {
2054 | type: 'string',
2055 | description: 'Commit message (optional, commits staged files if provided)',
2056 | },
2057 | testResults: {
2058 | type: 'object',
2059 | description:
2060 | 'Test results from AI-executed tests (required for proper deployment tracking)',
2061 | properties: {
2062 | success: {
2063 | type: 'boolean',
2064 | description: 'Whether all tests passed',
2065 | },
2066 | testsRun: {
2067 | type: 'number',
2068 | description: 'Total number of tests executed',
2069 | },
2070 | testsPassed: {
2071 | type: 'number',
2072 | description: 'Number of tests that passed',
2073 | },
2074 | testsFailed: {
2075 | type: 'number',
2076 | description: 'Number of tests that failed',
2077 | },
2078 | duration: {
2079 | type: 'number',
2080 | description: 'Test execution duration in seconds',
2081 | },
2082 | command: {
2083 | type: 'string',
2084 | description: 'Test command that was executed by AI',
2085 | },
2086 | output: {
2087 | type: 'string',
2088 | description: 'Test execution output',
2089 | },
2090 | failureDetails: {
2091 | type: 'array',
2092 | items: { type: 'string' },
2093 | description: 'Details of test failures',
2094 | },
2095 | testTypes: {
2096 | type: 'object',
2097 | description: 'Results broken down by test type (unit, integration, etc.)',
2098 | additionalProperties: {
2099 | type: 'object',
2100 | properties: {
2101 | passed: { type: 'number' },
2102 | failed: { type: 'number' },
2103 | },
2104 | },
2105 | },
2106 | },
2107 | required: ['success', 'testsRun', 'testsPassed', 'testsFailed'],
2108 | },
2109 | skipSecurity: {
2110 | type: 'boolean',
2111 | default: false,
2112 | description: 'Skip security scanning (NOT RECOMMENDED)',
2113 | },
2114 | dryRun: {
2115 | type: 'boolean',
2116 | default: false,
2117 | description: 'Show what would be pushed without actually pushing',
2118 | },
2119 | projectPath: {
2120 | type: 'string',
2121 | description: 'Path to project directory (defaults to current working directory)',
2122 | },
2123 | forceUnsafe: {
2124 | type: 'boolean',
2125 | default: false,
2126 | description: 'Override security blocks and test failures (DANGEROUS)',
2127 | },
2128 | },
2129 | },
2130 | },
2131 | {
2132 | name: 'deployment_readiness',
2133 | description:
2134 | 'Comprehensive deployment readiness validation with test failure tracking, deployment history analysis, and hard blocking for unsafe deployments. Integrates with smart_git_push for deployment gating.',
2135 | inputSchema: {
2136 | type: 'object',
2137 | properties: {
2138 | operation: {
2139 | type: 'string',
2140 | enum: [
2141 | 'check_readiness',
2142 | 'validate_production',
2143 | 'test_validation',
2144 | 'deployment_history',
2145 | 'full_audit',
2146 | 'emergency_override',
2147 | ],
2148 | description: 'Type of deployment readiness check to perform',
2149 | },
2150 | projectPath: {
2151 | type: 'string',
2152 | description: 'Path to project directory (defaults to current working directory)',
2153 | },
2154 | targetEnvironment: {
2155 | type: 'string',
2156 | enum: ['staging', 'production', 'integration'],
2157 | default: 'production',
2158 | description: 'Target deployment environment',
2159 | },
2160 | strictMode: {
2161 | type: 'boolean',
2162 | default: true,
2163 | description: 'Enable strict validation (recommended for production)',
2164 | },
2165 | allowMockCode: {
2166 | type: 'boolean',
2167 | default: false,
2168 | description: 'Allow mock code in deployment (NOT RECOMMENDED)',
2169 | },
2170 | productionCodeThreshold: {
2171 | type: 'number',
2172 | default: 85,
2173 | description: 'Minimum production code quality score (0-100)',
2174 | },
2175 | mockCodeMaxAllowed: {
2176 | type: 'number',
2177 | default: 0,
2178 | description: 'Maximum mock code indicators allowed',
2179 | },
2180 | maxTestFailures: {
2181 | type: 'number',
2182 | default: 0,
2183 | description: 'Maximum test failures allowed (0 = zero tolerance)',
2184 | },
2185 | requireTestCoverage: {
2186 | type: 'number',
2187 | default: 80,
2188 | description: 'Minimum test coverage percentage required',
2189 | },
2190 | blockOnFailingTests: {
2191 | type: 'boolean',
2192 | default: true,
2193 | description: 'Block deployment if tests are failing',
2194 | },
2195 | testSuiteRequired: {
2196 | type: 'array',
2197 | items: { type: 'string' },
2198 | default: [],
2199 | description: 'Required test suites that must pass',
2200 | },
2201 | maxRecentFailures: {
2202 | type: 'number',
2203 | default: 2,
2204 | description: 'Maximum recent deployment failures allowed',
2205 | },
2206 | deploymentSuccessThreshold: {
2207 | type: 'number',
2208 | default: 80,
2209 | description: 'Minimum deployment success rate required (%)',
2210 | },
2211 | blockOnRecentFailures: {
2212 | type: 'boolean',
2213 | default: true,
2214 | description: 'Block if recent deployments failed',
2215 | },
2216 | rollbackFrequencyThreshold: {
2217 | type: 'number',
2218 | default: 20,
2219 | description: 'Maximum rollback frequency allowed (%)',
2220 | },
2221 | requireAdrCompliance: {
2222 | type: 'boolean',
2223 | default: true,
2224 | description: 'Require ADR compliance validation',
2225 | },
2226 | integrateTodoTasks: {
2227 | type: 'boolean',
2228 | default: true,
2229 | description: 'Auto-create blocking tasks for issues',
2230 | },
2231 | updateHealthScoring: {
2232 | type: 'boolean',
2233 | default: true,
2234 | description: 'Update project health scores',
2235 | },
2236 | triggerSmartGitPush: {
2237 | type: 'boolean',
2238 | default: false,
2239 | description: 'Trigger smart git push validation',
2240 | },
2241 | emergencyBypass: {
2242 | type: 'boolean',
2243 | default: false,
2244 | description: 'Emergency bypass for critical fixes',
2245 | },
2246 | businessJustification: {
2247 | type: 'string',
2248 | description:
2249 | 'Business justification for overrides (required for emergency_override)',
2250 | },
2251 | approvalRequired: {
2252 | type: 'boolean',
2253 | default: true,
2254 | description: 'Require approval for overrides',
2255 | },
2256 | enableMemoryIntegration: {
2257 | type: 'boolean',
2258 | description:
2259 | 'Enable memory entity storage for deployment assessment tracking and historical analysis',
2260 | default: true,
2261 | },
2262 | migrateExistingHistory: {
2263 | type: 'boolean',
2264 | description: 'Migrate existing JSON-based deployment history to memory entities',
2265 | default: true,
2266 | },
2267 | },
2268 | required: ['operation'],
2269 | },
2270 | },
2271 | {
2272 | name: 'troubleshoot_guided_workflow',
2273 | description:
2274 | 'Structured failure analysis and test plan generation with memory integration for troubleshooting session tracking and intelligent ADR/research suggestion capabilities - provide JSON failure info to get specific test commands',
2275 | inputSchema: {
2276 | type: 'object',
2277 | properties: {
2278 | operation: {
2279 | type: 'string',
2280 | enum: ['analyze_failure', 'generate_test_plan', 'full_workflow'],
2281 | description: 'Type of troubleshooting operation',
2282 | },
2283 | failure: {
2284 | type: 'object',
2285 | properties: {
2286 | failureType: {
2287 | type: 'string',
2288 | enum: [
2289 | 'test_failure',
2290 | 'deployment_failure',
2291 | 'build_failure',
2292 | 'runtime_error',
2293 | 'performance_issue',
2294 | 'security_issue',
2295 | 'other',
2296 | ],
2297 | description: 'Type of failure',
2298 | },
2299 | failureDetails: {
2300 | type: 'object',
2301 | properties: {
2302 | command: {
2303 | type: 'string',
2304 | description: 'Command that failed (optional)',
2305 | },
2306 | exitCode: {
2307 | type: 'number',
2308 | description: 'Exit code of failed process (optional)',
2309 | },
2310 | errorMessage: {
2311 | type: 'string',
2312 | description: 'Primary error message',
2313 | },
2314 | stackTrace: {
2315 | type: 'string',
2316 | description: 'Stack trace if available (optional)',
2317 | },
2318 | logOutput: {
2319 | type: 'string',
2320 | description: 'Relevant log output (optional)',
2321 | },
2322 | environment: {
2323 | type: 'string',
2324 | description: 'Environment where failure occurred (optional)',
2325 | },
2326 | timestamp: {
2327 | type: 'string',
2328 | description: 'When the failure occurred (optional)',
2329 | },
2330 | affectedFiles: {
2331 | type: 'array',
2332 | items: { type: 'string' },
2333 | description: 'Files involved in the failure (optional)',
2334 | },
2335 | },
2336 | required: ['errorMessage'],
2337 | description: 'Detailed failure information',
2338 | },
2339 | context: {
2340 | type: 'object',
2341 | properties: {
2342 | recentChanges: {
2343 | type: 'string',
2344 | description: 'Recent changes that might be related (optional)',
2345 | },
2346 | reproducible: {
2347 | type: 'boolean',
2348 | description: 'Whether the failure is reproducible (optional)',
2349 | },
2350 | frequency: {
2351 | type: 'string',
2352 | description: 'How often this failure occurs (optional)',
2353 | },
2354 | impact: {
2355 | type: 'string',
2356 | enum: ['low', 'medium', 'high', 'critical'],
2357 | description: 'Impact level of the failure (optional)',
2358 | },
2359 | },
2360 | description: 'Additional context about the failure (optional)',
2361 | },
2362 | },
2363 | required: ['failureType', 'failureDetails'],
2364 | description:
2365 | 'Structured failure information (required for analyze_failure and generate_test_plan)',
2366 | },
2367 | projectPath: {
2368 | type: 'string',
2369 | description: 'Path to project directory (optional)',
2370 | },
2371 | adrDirectory: {
2372 | type: 'string',
2373 | description: 'ADR directory path',
2374 | default: 'docs/adrs',
2375 | },
2376 | todoPath: {
2377 | type: 'string',
2378 | description: 'Path to TODO.md file',
2379 | default: 'TODO.md',
2380 | },
2381 | enableMemoryIntegration: {
2382 | type: 'boolean',
2383 | description:
2384 | 'Enable memory entity storage for troubleshooting session tracking and pattern recognition',
2385 | default: true,
2386 | },
2387 | enablePatternRecognition: {
2388 | type: 'boolean',
2389 | description: 'Enable automatic pattern recognition and failure classification',
2390 | default: true,
2391 | },
2392 | enableAdrSuggestion: {
2393 | type: 'boolean',
2394 | description: 'Enable automatic ADR suggestion based on recurring failures',
2395 | default: true,
2396 | },
2397 | enableResearchGeneration: {
2398 | type: 'boolean',
2399 | description:
2400 | 'Enable automatic research question generation for persistent problems',
2401 | default: true,
2402 | },
2403 | conversationContext: CONVERSATION_CONTEXT_SCHEMA,
2404 | },
2405 | required: ['operation'],
2406 | },
2407 | },
2408 | {
2409 | name: 'smart_score',
2410 | description:
2411 | 'Central coordination for project health scoring system - recalculate, sync, diagnose, optimize, and reset scores across all MCP tools',
2412 | inputSchema: {
2413 | type: 'object',
2414 | properties: {
2415 | operation: {
2416 | type: 'string',
2417 | enum: [
2418 | 'recalculate_scores',
2419 | 'sync_scores',
2420 | 'diagnose_scores',
2421 | 'optimize_weights',
2422 | 'reset_scores',
2423 | 'get_score_trends',
2424 | 'get_intent_scores',
2425 | ],
2426 | description: 'Smart scoring operation to perform',
2427 | },
2428 | projectPath: {
2429 | type: 'string',
2430 | description: 'Path to project directory',
2431 | },
2432 | components: {
2433 | type: 'array',
2434 | items: {
2435 | type: 'string',
2436 | enum: [
2437 | 'task_completion',
2438 | 'deployment_readiness',
2439 | 'architecture_compliance',
2440 | 'security_posture',
2441 | 'code_quality',
2442 | 'all',
2443 | ],
2444 | },
2445 | default: ['all'],
2446 | description: 'Score components to recalculate (for recalculate_scores operation)',
2447 | },
2448 | forceUpdate: {
2449 | type: 'boolean',
2450 | default: false,
2451 | description: 'Force update even if data is fresh',
2452 | },
2453 | updateSources: {
2454 | type: 'boolean',
2455 | default: true,
2456 | description: 'Trigger source tool updates before recalculating',
2457 | },
2458 | todoPath: {
2459 | type: 'string',
2460 | default: 'TODO.md',
2461 | description: 'Path to TODO.md file (for sync_scores operation)',
2462 | },
2463 | triggerTools: {
2464 | type: 'array',
2465 | items: {
2466 | type: 'string',
2467 | enum: [
2468 | 'smart_git_push',
2469 | 'compare_adr_progress',
2470 | 'analyze_content_security',
2471 | 'validate_rules',
2472 | ],
2473 | },
2474 | description: 'Tools to trigger for fresh data (for sync_scores operation)',
2475 | },
2476 | rebalanceWeights: {
2477 | type: 'boolean',
2478 | default: false,
2479 | description: 'Recalculate optimal scoring weights (for sync_scores operation)',
2480 | },
2481 | includeHistory: {
2482 | type: 'boolean',
2483 | default: true,
2484 | description: 'Include score history analysis (for diagnose_scores operation)',
2485 | },
2486 | checkDataFreshness: {
2487 | type: 'boolean',
2488 | default: true,
2489 | description:
2490 | 'Validate data freshness across tools (for diagnose_scores operation)',
2491 | },
2492 | suggestImprovements: {
2493 | type: 'boolean',
2494 | default: true,
2495 | description:
2496 | 'Provide score improvement suggestions (for diagnose_scores operation)',
2497 | },
2498 | analysisMode: {
2499 | type: 'string',
2500 | enum: ['current_state', 'historical_data', 'project_type'],
2501 | default: 'current_state',
2502 | description: 'Method for weight optimization (for optimize_weights operation)',
2503 | },
2504 | customWeights: {
2505 | type: 'object',
2506 | properties: {
2507 | taskCompletion: { type: 'number', minimum: 0, maximum: 1 },
2508 | deploymentReadiness: { type: 'number', minimum: 0, maximum: 1 },
2509 | architectureCompliance: { type: 'number', minimum: 0, maximum: 1 },
2510 | securityPosture: { type: 'number', minimum: 0, maximum: 1 },
2511 | codeQuality: { type: 'number', minimum: 0, maximum: 1 },
2512 | },
2513 | description: 'Custom weight overrides (for optimize_weights operation)',
2514 | },
2515 | previewOnly: {
2516 | type: 'boolean',
2517 | default: false,
2518 | description: 'Preview changes without applying (for optimize_weights operation)',
2519 | },
2520 | component: {
2521 | type: 'string',
2522 | enum: [
2523 | 'task_completion',
2524 | 'deployment_readiness',
2525 | 'architecture_compliance',
2526 | 'security_posture',
2527 | 'code_quality',
2528 | 'all',
2529 | ],
2530 | default: 'all',
2531 | description: 'Score component to reset (for reset_scores operation)',
2532 | },
2533 | preserveHistory: {
2534 | type: 'boolean',
2535 | default: true,
2536 | description: 'Preserve score history in backup (for reset_scores operation)',
2537 | },
2538 | recalculateAfterReset: {
2539 | type: 'boolean',
2540 | default: true,
2541 | description: 'Immediately recalculate after reset (for reset_scores operation)',
2542 | },
2543 | intentId: {
2544 | type: 'string',
2545 | description:
2546 | 'Intent ID to get score trends for (for get_intent_scores operation)',
2547 | },
2548 | },
2549 | required: ['operation', 'projectPath'],
2550 | },
2551 | },
2552 | {
2553 | name: 'mcp_planning',
2554 | description:
2555 | 'Enhanced project planning and workflow management tool - phase-based project management, team resource allocation, progress tracking, risk analysis, and executive reporting',
2556 | inputSchema: {
2557 | type: 'object',
2558 | properties: {
2559 | operation: {
2560 | type: 'string',
2561 | enum: [
2562 | 'create_project',
2563 | 'manage_phases',
2564 | 'track_progress',
2565 | 'manage_resources',
2566 | 'risk_analysis',
2567 | 'generate_reports',
2568 | ],
2569 | description: 'Project planning operation to perform',
2570 | },
2571 | projectPath: {
2572 | type: 'string',
2573 | description: 'Project root path',
2574 | },
2575 | projectName: {
2576 | type: 'string',
2577 | description: 'Project name (for create_project operation)',
2578 | },
2579 | description: {
2580 | type: 'string',
2581 | description: 'Project description (for create_project operation)',
2582 | },
2583 | phases: {
2584 | type: 'array',
2585 | items: {
2586 | type: 'object',
2587 | properties: {
2588 | name: { type: 'string' },
2589 | duration: { type: 'string' },
2590 | dependencies: {
2591 | type: 'array',
2592 | items: { type: 'string' },
2593 | default: [],
2594 | },
2595 | milestones: {
2596 | type: 'array',
2597 | items: { type: 'string' },
2598 | default: [],
2599 | },
2600 | },
2601 | required: ['name', 'duration'],
2602 | },
2603 | description: 'Initial project phases (for create_project operation)',
2604 | },
2605 | team: {
2606 | type: 'array',
2607 | items: {
2608 | type: 'object',
2609 | properties: {
2610 | name: { type: 'string' },
2611 | role: { type: 'string' },
2612 | skills: {
2613 | type: 'array',
2614 | items: { type: 'string' },
2615 | default: [],
2616 | },
2617 | capacity: { type: 'string' },
2618 | },
2619 | required: ['name', 'role', 'capacity'],
2620 | },
2621 | default: [],
2622 | description: 'Team structure (for create_project operation)',
2623 | },
2624 | importFromAdrs: {
2625 | type: 'boolean',
2626 | default: true,
2627 | description: 'Import phases from existing ADRs (for create_project operation)',
2628 | },
2629 | importFromTodos: {
2630 | type: 'boolean',
2631 | default: true,
2632 | description: 'Import tasks from TODO system (for create_project operation)',
2633 | },
2634 | action: {
2635 | type: 'string',
2636 | enum: [
2637 | 'list',
2638 | 'create',
2639 | 'update',
2640 | 'delete',
2641 | 'transition',
2642 | 'add',
2643 | 'remove',
2644 | 'allocate',
2645 | 'optimize',
2646 | ],
2647 | description: 'Management action (for manage_phases/manage_resources operations)',
2648 | },
2649 | phaseId: {
2650 | type: 'string',
2651 | description: 'Phase ID for phase operations',
2652 | },
2653 | phaseData: {
2654 | type: 'object',
2655 | properties: {
2656 | name: { type: 'string' },
2657 | description: { type: 'string' },
2658 | estimatedDuration: { type: 'string' },
2659 | dependencies: {
2660 | type: 'array',
2661 | items: { type: 'string' },
2662 | },
2663 | milestones: {
2664 | type: 'array',
2665 | items: { type: 'string' },
2666 | },
2667 | linkedAdrs: {
2668 | type: 'array',
2669 | items: { type: 'string' },
2670 | },
2671 | },
2672 | description: 'Phase data for create/update operations',
2673 | },
2674 | targetStatus: {
2675 | type: 'string',
2676 | enum: ['planning', 'active', 'completed', 'blocked', 'cancelled'],
2677 | description: 'Target status for phase transition',
2678 | },
2679 | reportType: {
2680 | type: 'string',
2681 | enum: [
2682 | 'summary',
2683 | 'detailed',
2684 | 'gantt',
2685 | 'milestones',
2686 | 'risks',
2687 | 'executive',
2688 | 'status',
2689 | 'health',
2690 | 'team_performance',
2691 | 'milestone_tracking',
2692 | ],
2693 | default: 'summary',
2694 | description: 'Type of progress report or generated report',
2695 | },
2696 | timeframe: {
2697 | type: 'string',
2698 | enum: [
2699 | 'current',
2700 | 'weekly',
2701 | 'monthly',
2702 | 'quarterly',
2703 | 'week',
2704 | 'month',
2705 | 'quarter',
2706 | 'project',
2707 | ],
2708 | default: 'current',
2709 | description: 'Time frame for reports and tracking',
2710 | },
2711 | includeVisuals: {
2712 | type: 'boolean',
2713 | default: true,
2714 | description: 'Include visual progress indicators',
2715 | },
2716 | updateTaskProgress: {
2717 | type: 'boolean',
2718 | default: true,
2719 | description: 'Sync progress from TODO system',
2720 | },
2721 | memberId: {
2722 | type: 'string',
2723 | description: 'Team member ID for resource operations',
2724 | },
2725 | memberData: {
2726 | type: 'object',
2727 | properties: {
2728 | name: { type: 'string' },
2729 | role: { type: 'string' },
2730 | skills: {
2731 | type: 'array',
2732 | items: { type: 'string' },
2733 | },
2734 | capacity: { type: 'string' },
2735 | },
2736 | description: 'Team member data for resource operations',
2737 | },
2738 | allocationData: {
2739 | type: 'object',
2740 | properties: {
2741 | phaseId: { type: 'string' },
2742 | allocation: {
2743 | type: 'number',
2744 | minimum: 0,
2745 | maximum: 100,
2746 | },
2747 | },
2748 | required: ['phaseId', 'allocation'],
2749 | description: 'Resource allocation data',
2750 | },
2751 | analysisType: {
2752 | type: 'string',
2753 | enum: ['automated', 'manual', 'comprehensive'],
2754 | default: 'comprehensive',
2755 | description: 'Type of risk analysis',
2756 | },
2757 | includeAdrRisks: {
2758 | type: 'boolean',
2759 | default: true,
2760 | description: 'Analyze risks from ADR complexity',
2761 | },
2762 | includeDependencyRisks: {
2763 | type: 'boolean',
2764 | default: true,
2765 | description: 'Analyze dependency chain risks',
2766 | },
2767 | includeResourceRisks: {
2768 | type: 'boolean',
2769 | default: true,
2770 | description: 'Analyze resource allocation risks',
2771 | },
2772 | generateMitigation: {
2773 | type: 'boolean',
2774 | default: true,
2775 | description: 'Generate mitigation strategies',
2776 | },
2777 | format: {
2778 | type: 'string',
2779 | enum: ['markdown', 'json', 'html'],
2780 | default: 'markdown',
2781 | description: 'Report output format',
2782 | },
2783 | includeCharts: {
2784 | type: 'boolean',
2785 | default: true,
2786 | description: 'Include progress charts and graphs',
2787 | },
2788 | },
2789 | required: ['operation', 'projectPath'],
2790 | },
2791 | },
2792 | {
2793 | name: 'interactive_adr_planning',
2794 | description:
2795 | 'Interactive guided ADR planning and creation tool - walks users through structured decision-making process with research integration, option evaluation, and automatic ADR generation. TIP: Start by reading @.mcp-server-context.md to understand project context and previous decisions.',
2796 | inputSchema: {
2797 | type: 'object',
2798 | properties: {
2799 | operation: {
2800 | type: 'string',
2801 | enum: [
2802 | 'start_session',
2803 | 'continue_session',
2804 | 'provide_input',
2805 | 'request_research',
2806 | 'evaluate_options',
2807 | 'make_decision',
2808 | 'assess_impact',
2809 | 'plan_implementation',
2810 | 'generate_adr',
2811 | 'update_todos',
2812 | 'get_guidance',
2813 | 'save_session',
2814 | 'complete_session',
2815 | ],
2816 | description: 'Interactive planning operation to perform',
2817 | },
2818 | sessionId: {
2819 | type: 'string',
2820 | description:
2821 | 'Planning session ID (required for all operations except start_session)',
2822 | },
2823 | input: {
2824 | type: 'string',
2825 | description: 'User input for the current phase (varies by phase)',
2826 | },
2827 | projectPath: {
2828 | type: 'string',
2829 | description: 'Project root path',
2830 | },
2831 | autoResearch: {
2832 | type: 'boolean',
2833 | default: true,
2834 | description: 'Automatically trigger research when needed',
2835 | },
2836 | generateTodos: {
2837 | type: 'boolean',
2838 | default: true,
2839 | description: 'Automatically generate TODO items from decisions',
2840 | },
2841 | },
2842 | required: ['operation', 'projectPath'],
2843 | },
2844 | },
2845 | {
2846 | name: 'memory_loading',
2847 | description:
2848 | 'Advanced memory loading tool for the memory-centric architecture. Query, explore, and manage memory entities and relationships. Load ADRs into memory system and perform intelligent queries.',
2849 | inputSchema: {
2850 | type: 'object',
2851 | properties: {
2852 | action: {
2853 | type: 'string',
2854 | enum: [
2855 | 'load_adrs',
2856 | 'query_entities',
2857 | 'get_entity',
2858 | 'find_related',
2859 | 'get_intelligence',
2860 | 'create_snapshot',
2861 | ],
2862 | description: 'Memory operation to perform',
2863 | default: 'query_entities',
2864 | },
2865 | query: {
2866 | type: 'object',
2867 | properties: {
2868 | entityTypes: {
2869 | type: 'array',
2870 | items: {
2871 | type: 'string',
2872 | enum: [
2873 | 'architectural_decision',
2874 | 'code_component',
2875 | 'business_requirement',
2876 | 'technical_constraint',
2877 | 'quality_concern',
2878 | 'implementation_pattern',
2879 | 'environmental_factor',
2880 | 'stakeholder_input',
2881 | 'knowledge_artifact',
2882 | 'decision_context',
2883 | ],
2884 | },
2885 | description: 'Filter by entity types',
2886 | },
2887 | tags: {
2888 | type: 'array',
2889 | items: { type: 'string' },
2890 | description: 'Filter by tags',
2891 | },
2892 | textQuery: {
2893 | type: 'string',
2894 | description: 'Full-text search query',
2895 | },
2896 | relationshipTypes: {
2897 | type: 'array',
2898 | items: {
2899 | type: 'string',
2900 | enum: [
2901 | 'depends_on',
2902 | 'influences',
2903 | 'conflicts_with',
2904 | 'implements',
2905 | 'supersedes',
2906 | 'relates_to',
2907 | 'originated_from',
2908 | 'impacts',
2909 | 'constrains',
2910 | ],
2911 | },
2912 | description: 'Filter by relationship types',
2913 | },
2914 | confidenceThreshold: {
2915 | type: 'number',
2916 | minimum: 0,
2917 | maximum: 1,
2918 | description: 'Minimum confidence threshold',
2919 | },
2920 | relevanceThreshold: {
2921 | type: 'number',
2922 | minimum: 0,
2923 | maximum: 1,
2924 | description: 'Minimum relevance threshold',
2925 | },
2926 | timeRange: {
2927 | type: 'object',
2928 | properties: {
2929 | from: { type: 'string', description: 'Start date (ISO 8601)' },
2930 | to: { type: 'string', description: 'End date (ISO 8601)' },
2931 | },
2932 | description: 'Filter by time range',
2933 | },
2934 | contextFilters: {
2935 | type: 'object',
2936 | properties: {
2937 | projectPhase: { type: 'string', description: 'Project phase filter' },
2938 | businessDomain: { type: 'string', description: 'Business domain filter' },
2939 | technicalStack: {
2940 | type: 'array',
2941 | items: { type: 'string' },
2942 | description: 'Technical stack filter',
2943 | },
2944 | environmentalFactors: {
2945 | type: 'array',
2946 | items: { type: 'string' },
2947 | description: 'Environmental factors filter',
2948 | },
2949 | },
2950 | description: 'Context-based filters',
2951 | },
2952 | limit: {
2953 | type: 'number',
2954 | minimum: 1,
2955 | description: 'Maximum number of results',
2956 | },
2957 | sortBy: {
2958 | type: 'string',
2959 | enum: ['relevance', 'confidence', 'lastModified', 'created', 'accessCount'],
2960 | description: 'Sort field',
2961 | default: 'relevance',
2962 | },
2963 | includeRelated: {
2964 | type: 'boolean',
2965 | description: 'Include related entities and relationships',
2966 | default: false,
2967 | },
2968 | relationshipDepth: {
2969 | type: 'number',
2970 | minimum: 1,
2971 | maximum: 5,
2972 | description: 'Maximum relationship traversal depth',
2973 | default: 2,
2974 | },
2975 | },
2976 | description: 'Query parameters for entity search',
2977 | },
2978 | entityId: {
2979 | type: 'string',
2980 | description: 'Entity ID for get_entity and find_related actions',
2981 | },
2982 | maxDepth: {
2983 | type: 'number',
2984 | minimum: 1,
2985 | maximum: 5,
2986 | description: 'Maximum depth for relationship traversal (find_related action)',
2987 | default: 2,
2988 | },
2989 | forceReload: {
2990 | type: 'boolean',
2991 | description: 'Force reload of ADRs (load_adrs action)',
2992 | default: false,
2993 | },
2994 | },
2995 | },
2996 | },
2997 | {
2998 | name: 'expand_analysis_section',
2999 | description:
3000 | 'Retrieve full analysis content from tiered responses. Expand entire analysis or specific sections stored in memory. Use this when a tool returns a summary with an expandable ID.',
3001 | inputSchema: {
3002 | type: 'object',
3003 | properties: {
3004 | expandableId: {
3005 | type: 'string',
3006 | description: 'ID of the expandable analysis (provided in tiered response)',
3007 | },
3008 | section: {
3009 | type: 'string',
3010 | description:
3011 | 'Optional: Specific section to expand (omit to get full analysis). Available sections are listed in the tiered response.',
3012 | },
3013 | format: {
3014 | type: 'string',
3015 | enum: ['markdown', 'json'],
3016 | description: 'Output format (default: markdown)',
3017 | default: 'markdown',
3018 | },
3019 | },
3020 | required: ['expandableId'],
3021 | },
3022 | },
3023 | {
3024 | name: 'tool_chain_orchestrator',
3025 | description:
3026 | 'AI-powered dynamic tool sequencing - intelligently analyze user requests and generate structured tool execution plans',
3027 | inputSchema: {
3028 | type: 'object',
3029 | properties: {
3030 | userRequest: {
3031 | type: 'string',
3032 | description: 'User request to analyze and create tool execution plan for',
3033 | },
3034 | availableTools: {
3035 | type: 'array',
3036 | items: { type: 'string' },
3037 | description: 'List of available MCP tools to orchestrate',
3038 | },
3039 | executionMode: {
3040 | type: 'string',
3041 | enum: ['plan_only', 'plan_and_execute', 'validate_plan'],
3042 | description: 'Orchestration mode',
3043 | default: 'plan_only',
3044 | },
3045 | maxSteps: {
3046 | type: 'number',
3047 | description: 'Maximum number of steps in the execution plan',
3048 | default: 10,
3049 | },
3050 | allowParallel: {
3051 | type: 'boolean',
3052 | description: 'Allow parallel execution of independent steps',
3053 | default: true,
3054 | },
3055 | contextHints: {
3056 | type: 'array',
3057 | items: { type: 'string' },
3058 | description: 'Additional context hints for better plan generation',
3059 | },
3060 | },
3061 | required: ['userRequest'],
3062 | },
3063 | },
3064 | {
3065 | name: 'expand_memory',
3066 | description:
3067 | 'Phase 3: Retrieve and expand stored content from a tiered response using its expandable ID',
3068 | inputSchema: {
3069 | type: 'object',
3070 | properties: {
3071 | expandableId: {
3072 | type: 'string',
3073 | description: 'Expandable ID from a tiered response',
3074 | },
3075 | section: {
3076 | type: 'string',
3077 | description: 'Optional: specific section to expand',
3078 | },
3079 | includeContext: {
3080 | type: 'boolean',
3081 | description: 'Include related conversation context and knowledge graph state',
3082 | default: true,
3083 | },
3084 | },
3085 | required: ['expandableId'],
3086 | },
3087 | },
3088 | {
3089 | name: 'query_conversation_history',
3090 | description: 'Phase 3: Search and retrieve conversation sessions based on filters',
3091 | inputSchema: {
3092 | type: 'object',
3093 | properties: {
3094 | projectPath: {
3095 | type: 'string',
3096 | description: 'Filter by project path',
3097 | },
3098 | dateRange: {
3099 | type: 'object',
3100 | properties: {
3101 | start: { type: 'string', description: 'Start date (ISO 8601)' },
3102 | end: { type: 'string', description: 'End date (ISO 8601)' },
3103 | },
3104 | description: 'Filter by date range',
3105 | },
3106 | toolsUsed: {
3107 | type: 'array',
3108 | items: { type: 'string' },
3109 | description: 'Filter by tools used in the session',
3110 | },
3111 | keyword: {
3112 | type: 'string',
3113 | description: 'Search keyword in conversation turns',
3114 | },
3115 | limit: {
3116 | type: 'number',
3117 | description: 'Maximum number of sessions to return',
3118 | default: 10,
3119 | },
3120 | },
3121 | },
3122 | },
3123 | {
3124 | name: 'get_conversation_snapshot',
3125 | description:
3126 | 'Phase 3: Get current conversation context snapshot for resumption or analysis',
3127 | inputSchema: {
3128 | type: 'object',
3129 | properties: {
3130 | recentTurnCount: {
3131 | type: 'number',
3132 | description: 'Number of recent turns to include',
3133 | default: 5,
3134 | },
3135 | },
3136 | },
3137 | },
3138 | {
3139 | name: 'get_memory_stats',
3140 | description: 'Phase 3: Get statistics about stored conversation memory',
3141 | inputSchema: {
3142 | type: 'object',
3143 | properties: {},
3144 | },
3145 | },
3146 | {
3147 | name: 'update_knowledge',
3148 | description:
3149 | 'ADR-018: Simple CRUD operations for knowledge graph. Add/remove entities (intents, ADRs, tools, code) and relationships. Use knowledge://graph resource to read current state (zero token cost).',
3150 | inputSchema: {
3151 | type: 'object',
3152 | properties: {
3153 | operation: {
3154 | type: 'string',
3155 | enum: ['add_entity', 'remove_entity', 'add_relationship', 'remove_relationship'],
3156 | description: 'Type of operation to perform on the knowledge graph',
3157 | },
3158 | entity: {
3159 | type: 'string',
3160 | description: 'Entity ID (for add_entity/remove_entity operations)',
3161 | },
3162 | entityType: {
3163 | type: 'string',
3164 | enum: ['intent', 'adr', 'code', 'tool', 'decision'],
3165 | description: 'Type of entity (required for add_entity operation)',
3166 | },
3167 | relationship: {
3168 | type: 'string',
3169 | enum: ['implements', 'uses', 'created', 'depends-on', 'supersedes'],
3170 | description: 'Relationship type (for add_relationship/remove_relationship)',
3171 | },
3172 | source: {
3173 | type: 'string',
3174 | description: 'Source node ID (for relationship operations)',
3175 | },
3176 | target: {
3177 | type: 'string',
3178 | description: 'Target node ID (for relationship operations)',
3179 | },
3180 | metadata: {
3181 | type: 'object',
3182 | description: 'Additional metadata for the entity or relationship',
3183 | additionalProperties: true,
3184 | },
3185 | },
3186 | required: ['operation'],
3187 | },
3188 | },
3189 | {
3190 | name: 'get_server_context',
3191 | description:
3192 | "Generate a comprehensive context file showing the server's current state, memory, and capabilities. Creates .mcp-server-context.md that can be @ referenced in conversations for instant LLM awareness",
3193 | inputSchema: {
3194 | type: 'object',
3195 | properties: {
3196 | writeToFile: {
3197 | type: 'boolean',
3198 | description: 'Whether to write the context to .mcp-server-context.md file',
3199 | default: true,
3200 | },
3201 | outputPath: {
3202 | type: 'string',
3203 | description: 'Custom output path for the context file',
3204 | },
3205 | includeDetailed: {
3206 | type: 'boolean',
3207 | description: 'Include detailed information',
3208 | default: true,
3209 | },
3210 | maxRecentItems: {
3211 | type: 'number',
3212 | description: 'Maximum number of recent items to show',
3213 | default: 5,
3214 | },
3215 | },
3216 | },
3217 | },
3218 | {
3219 | name: 'get_current_datetime',
3220 | description:
3221 | 'Get the current date and time in various formats. Useful for timestamping ADRs, research documents, and other architectural artifacts. Returns ISO 8601, human-readable, and ADR-specific date formats.',
3222 | inputSchema: {
3223 | type: 'object',
3224 | properties: {
3225 | timezone: {
3226 | type: 'string',
3227 | description:
3228 | 'Timezone for the datetime (e.g., "UTC", "America/New_York", "Europe/London"). Defaults to UTC.',
3229 | default: 'UTC',
3230 | },
3231 | format: {
3232 | type: 'string',
3233 | enum: ['iso', 'human', 'adr', 'all'],
3234 | description:
3235 | 'Output format: "iso" for ISO 8601, "human" for human-readable, "adr" for ADR date format (YYYY-MM-DD), "all" for all formats',
3236 | default: 'all',
3237 | },
3238 | includeTimestamp: {
3239 | type: 'boolean',
3240 | description: 'Include Unix timestamp in milliseconds',
3241 | default: true,
3242 | },
3243 | },
3244 | },
3245 | },
3246 | // Session management tool for dynamic project switching
3247 | {
3248 | name: 'set_project_path',
3249 | description:
3250 | 'Dynamically set the active project path for the current session. Call this at the start of a session to switch between projects without restarting the server or modifying environment variables. All subsequent tool calls will use this path as the default.',
3251 | inputSchema: {
3252 | type: 'object',
3253 | properties: {
3254 | path: {
3255 | type: 'string',
3256 | description:
3257 | 'Absolute path to the project directory. Must be an existing directory.',
3258 | },
3259 | validatePath: {
3260 | type: 'boolean',
3261 | description:
3262 | 'Whether to validate that the path exists and is a directory (default: true)',
3263 | default: true,
3264 | },
3265 | },
3266 | required: ['path'],
3267 | },
3268 | },
3269 | // CE-MCP Phase 4: Lazy Prompt Loading Tool
3270 | {
3271 | name: 'load_prompt',
3272 | description:
3273 | 'Load a specific prompt or prompt section on-demand. Part of CE-MCP lazy loading system that reduces token usage by ~96% by loading prompts only when needed. Use this to retrieve prompt templates for ADR generation, analysis, deployment, and other operations.',
3274 | inputSchema: {
3275 | type: 'object',
3276 | properties: {
3277 | promptName: {
3278 | type: 'string',
3279 | description:
3280 | 'Name of the prompt to load (e.g., "adr-suggestion", "deployment-analysis", "environment-analysis", "research-question", "rule-generation", "analysis", "security")',
3281 | enum: [
3282 | 'adr-suggestion',
3283 | 'deployment-analysis',
3284 | 'environment-analysis',
3285 | 'research-question',
3286 | 'rule-generation',
3287 | 'analysis',
3288 | 'research-integration',
3289 | 'validated-pattern',
3290 | 'security',
3291 | ],
3292 | },
3293 | section: {
3294 | type: 'string',
3295 | description:
3296 | 'Specific section within the prompt to load. If not provided, loads the entire prompt. Available sections depend on the prompt.',
3297 | },
3298 | estimateOnly: {
3299 | type: 'boolean',
3300 | description:
3301 | 'If true, returns only token estimate without loading the full prompt content',
3302 | default: false,
3303 | },
3304 | },
3305 | required: ['promptName'],
3306 | },
3307 | },
3308 | // ADR Aggregator Integration Tools (https://adraggregator.com)
3309 | {
3310 | name: 'sync_to_aggregator',
3311 | description:
3312 | 'Sync ADRs to ADR Aggregator platform (https://adraggregator.com) for centralized tracking, visualization, and team collaboration. Supports incremental and full sync modes with optional metadata.',
3313 | inputSchema: {
3314 | type: 'object',
3315 | properties: {
3316 | full_sync: {
3317 | type: 'boolean',
3318 | description: 'Replace all ADRs instead of incremental sync',
3319 | default: false,
3320 | },
3321 | include_metadata: {
3322 | type: 'boolean',
3323 | description: 'Include analysis metadata in sync',
3324 | default: true,
3325 | },
3326 | include_diagrams: {
3327 | type: 'boolean',
3328 | description: 'Include Mermaid diagrams (Pro+ tier)',
3329 | default: false,
3330 | },
3331 | include_timeline: {
3332 | type: 'boolean',
3333 | description: 'Include timeline/staleness data',
3334 | default: false,
3335 | },
3336 | include_security_scan: {
3337 | type: 'boolean',
3338 | description: 'Include security scan results',
3339 | default: false,
3340 | },
3341 | include_code_links: {
3342 | type: 'boolean',
3343 | description: 'Include AST-based code links (Pro+ tier)',
3344 | default: false,
3345 | },
3346 | adr_paths: {
3347 | type: 'array',
3348 | items: { type: 'string' },
3349 | description: 'Specific ADR paths to sync (syncs all if not provided)',
3350 | },
3351 | projectPath: {
3352 | type: 'string',
3353 | description: 'Project path (defaults to PROJECT_PATH)',
3354 | },
3355 | },
3356 | },
3357 | },
3358 | {
3359 | name: 'get_adr_context',
3360 | description:
3361 | 'Fetch ADR context from ADR Aggregator including summaries, diagrams, timeline data, and code links. Useful for getting a consolidated view of architectural decisions.',
3362 | inputSchema: {
3363 | type: 'object',
3364 | properties: {
3365 | include_diagrams: {
3366 | type: 'boolean',
3367 | description: 'Include Mermaid diagrams (Pro+ tier)',
3368 | default: false,
3369 | },
3370 | include_timeline: {
3371 | type: 'boolean',
3372 | description: 'Include timeline data',
3373 | default: true,
3374 | },
3375 | include_code_links: {
3376 | type: 'boolean',
3377 | description: 'Include code links (Pro+ tier)',
3378 | default: false,
3379 | },
3380 | include_research: {
3381 | type: 'boolean',
3382 | description: 'Include research context (Pro+ tier)',
3383 | default: false,
3384 | },
3385 | staleness_filter: {
3386 | type: 'string',
3387 | enum: ['all', 'fresh', 'stale', 'very_stale'],
3388 | description: 'Filter by staleness level',
3389 | default: 'all',
3390 | },
3391 | graph_depth: {
3392 | type: 'number',
3393 | description: 'Knowledge graph depth (Team tier)',
3394 | minimum: 1,
3395 | maximum: 5,
3396 | },
3397 | projectPath: {
3398 | type: 'string',
3399 | description: 'Project path (defaults to PROJECT_PATH)',
3400 | },
3401 | },
3402 | },
3403 | },
3404 | {
3405 | name: 'get_staleness_report',
3406 | description:
3407 | 'Get ADR staleness report from ADR Aggregator with review compliance metrics. Identifies stale ADRs that need attention and provides governance insights.',
3408 | inputSchema: {
3409 | type: 'object',
3410 | properties: {
3411 | threshold: {
3412 | type: 'number',
3413 | description: 'Days threshold for staleness',
3414 | default: 90,
3415 | },
3416 | projectPath: {
3417 | type: 'string',
3418 | description: 'Project path (defaults to PROJECT_PATH)',
3419 | },
3420 | },
3421 | },
3422 | },
3423 | {
3424 | name: 'get_adr_templates',
3425 | description:
3426 | 'Get domain-specific ADR templates and anti-patterns from ADR Aggregator. Includes best practices for web applications, microservices, APIs, and more. No authentication required.',
3427 | inputSchema: {
3428 | type: 'object',
3429 | properties: {
3430 | domain: {
3431 | type: 'string',
3432 | description:
3433 | 'Domain filter (web_application, microservices, api, data_platform, etc.)',
3434 | },
3435 | },
3436 | },
3437 | },
3438 | {
3439 | name: 'get_adr_diagrams',
3440 | description:
3441 | 'Get Mermaid diagrams for ADRs from ADR Aggregator. Includes workflow, relationship, and impact diagrams. Requires Pro+ tier.',
3442 | inputSchema: {
3443 | type: 'object',
3444 | properties: {
3445 | adr_path: {
3446 | type: 'string',
3447 | description: 'Specific ADR path (returns all if not specified)',
3448 | },
3449 | projectPath: {
3450 | type: 'string',
3451 | description: 'Project path (defaults to PROJECT_PATH)',
3452 | },
3453 | },
3454 | },
3455 | },
3456 | {
3457 | name: 'validate_adr_compliance',
3458 | description:
3459 | 'Validate ADR compliance against implementation via ADR Aggregator. Checks that code actually implements documented decisions. Requires Pro+ tier.',
3460 | inputSchema: {
3461 | type: 'object',
3462 | properties: {
3463 | adr_paths: {
3464 | type: 'array',
3465 | items: { type: 'string' },
3466 | description: 'Specific ADR paths to validate',
3467 | },
3468 | validation_type: {
3469 | type: 'string',
3470 | enum: ['implementation', 'architecture', 'security', 'all'],
3471 | description: 'Type of validation to perform',
3472 | default: 'all',
3473 | },
3474 | projectPath: {
3475 | type: 'string',
3476 | description: 'Project path (defaults to PROJECT_PATH)',
3477 | },
3478 | },
3479 | },
3480 | },
3481 | {
3482 | name: 'get_knowledge_graph',
3483 | description:
3484 | 'Get cross-repository knowledge graph from ADR Aggregator with analytics and insights. Visualize ADR relationships across repositories. Requires Team tier.',
3485 | inputSchema: {
3486 | type: 'object',
3487 | properties: {
3488 | scope: {
3489 | type: 'string',
3490 | enum: ['repository', 'organization'],
3491 | description: 'Scope of the graph',
3492 | default: 'repository',
3493 | },
3494 | include_analytics: {
3495 | type: 'boolean',
3496 | description: 'Include graph analytics and insights',
3497 | default: true,
3498 | },
3499 | projectPath: {
3500 | type: 'string',
3501 | description: 'Project path (defaults to PROJECT_PATH)',
3502 | },
3503 | },
3504 | },
3505 | },
3506 | {
3507 | name: 'analyze_gaps',
3508 | description:
3509 | 'Scan local codebase and compare with ADRs to detect bi-directional gaps. Finds: (1) ADR-to-code gaps: file references in ADRs that do not exist, (2) Code-to-ADR gaps: technologies in package.json and architectural patterns without ADR coverage. Reports gaps to ADR Aggregator for tracking.',
3510 | inputSchema: {
3511 | type: 'object',
3512 | properties: {
3513 | projectPath: {
3514 | type: 'string',
3515 | description: 'Project path (defaults to PROJECT_PATH)',
3516 | },
3517 | reportToAggregator: {
3518 | type: 'boolean',
3519 | description: 'Whether to report gaps to ADR Aggregator',
3520 | default: true,
3521 | },
3522 | includeDismissed: {
3523 | type: 'boolean',
3524 | description: 'Include previously dismissed gaps in analysis',
3525 | default: false,
3526 | },
3527 | scanDirectories: {
3528 | type: 'array',
3529 | items: { type: 'string' },
3530 | description: 'Specific directories to scan (defaults to src, lib, app, packages)',
3531 | },
3532 | includePatterns: {
3533 | type: 'array',
3534 | items: { type: 'string' },
3535 | description: 'File patterns to include in scan (regex)',
3536 | },
3537 | excludePatterns: {
3538 | type: 'array',
3539 | items: { type: 'string' },
3540 | description: 'File patterns to exclude from scan (regex)',
3541 | },
3542 | },
3543 | },
3544 | },
3545 | {
3546 | name: 'get_gaps',
3547 | description:
3548 | 'Get current code gaps from ADR Aggregator. Returns gaps with their status (open, dismissed, resolved) for tracking and management.',
3549 | inputSchema: {
3550 | type: 'object',
3551 | properties: {
3552 | projectPath: {
3553 | type: 'string',
3554 | description: 'Project path (defaults to PROJECT_PATH)',
3555 | },
3556 | includeDismissed: {
3557 | type: 'boolean',
3558 | description: 'Include dismissed gaps',
3559 | default: false,
3560 | },
3561 | includeResolved: {
3562 | type: 'boolean',
3563 | description: 'Include resolved gaps',
3564 | default: false,
3565 | },
3566 | },
3567 | },
3568 | },
3569 | ],
3570 | };
3571 | });
3572 |
3573 | /**
3574 | * Call Tool Handler - MCP Protocol Endpoint
3575 | *
3576 | * @description Executes specific tools with provided arguments. This is the core
3577 | * execution endpoint that routes tool calls to their respective implementations.
3578 | * Includes comprehensive error handling, argument validation, and response masking.
3579 | *
3580 | * @param {CallToolRequest} request - MCP tool execution request
3581 | * @param {string} request.params.name - Tool name to execute
3582 | * @param {Object} request.params.arguments - Tool-specific arguments
3583 | *
3584 | * @returns {Promise<CallToolResult>} Tool execution result with content and metadata
3585 | *
3586 | * @throws {McpAdrError} When tool execution fails or arguments are invalid
3587 | *
3588 | * @example
3589 | * ```typescript
3590 | * // Execute research tool
3591 | * const result = await mcpClient.callTool('perform_research', {
3592 | * question: 'What authentication methods are used?',
3593 | * projectPath: '/path/to/project'
3594 | * });
3595 | *
3596 | * console.log(result.content); // Research findings
3597 | * ```
3598 | *
3599 | * @example
3600 | * ```typescript
3601 | * // Execute ADR validation
3602 | * const validation = await mcpClient.callTool('validate_adr', {
3603 | * adrPath: 'docs/adrs/0001-auth-choice.md',
3604 | * includeEnvironmentCheck: true
3605 | * });
3606 | *
3607 | * console.log(validation.isValid); // true/false
3608 | * console.log(validation.findings); // Validation issues
3609 | * ```
3610 | *
3611 | * @mcp-endpoint
3612 | * @category Tools
3613 | * @category Execution
3614 | */
3615 | this.server.setRequestHandler(CallToolRequestSchema, async request => {
3616 | const { name, arguments: args } = request.params;
3617 |
3618 | // Create context for progress notifications and logging
3619 | const context: ToolContext = {
3620 | info: (message: string) => {
3621 | this.logger.info(message);
3622 | // Note: MCP progress notifications will be available in future SDK versions
3623 | // For now, we log to server console for visibility
3624 | },
3625 | report_progress: (progress: number, total?: number) => {
3626 | const percentage = total ? Math.round((progress / total) * 100) : progress;
3627 | this.logger.info(`Progress: ${percentage}%${total ? ` (${progress}/${total})` : ''}`);
3628 | },
3629 | warn: (message: string) => {
3630 | this.logger.warn(message);
3631 | },
3632 | error: (message: string) => {
3633 | this.logger.error(message);
3634 | },
3635 | };
3636 |
3637 | try {
3638 | let response: CallToolResult;
3639 | const safeArgs = args || {};
3640 |
3641 | // CE-MCP Mode: Check if tool should return directive instead of executing
3642 | const aiConfig = loadAIConfig();
3643 | if (
3644 | isCEMCPEnabled(aiConfig) &&
3645 | shouldUseCEMCPDirective(name, { mode: aiConfig.executionMode })
3646 | ) {
3647 | const directive = getCEMCPDirective(name, safeArgs);
3648 | if (directive) {
3649 | this.logger.info(`[CE-MCP] Returning directive for tool: ${name}`);
3650 | return formatDirectiveResponse(directive);
3651 | }
3652 | // Fall through to legacy execution if no directive available
3653 | this.logger.info(`[CE-MCP] No directive available for ${name}, using legacy path`);
3654 | }
3655 |
3656 | switch (name) {
3657 | case 'analyze_project_ecosystem':
3658 | response = await this.analyzeProjectEcosystem(
3659 | safeArgs as unknown as AnalyzeProjectEcosystemArgs,
3660 | context
3661 | );
3662 | break;
3663 | case 'get_architectural_context':
3664 | response = await this.getArchitecturalContext(
3665 | safeArgs as unknown as GetArchitecturalContextArgs
3666 | );
3667 | break;
3668 | case 'generate_adrs_from_prd':
3669 | response = await this.generateAdrsFromPrd(safeArgs, context);
3670 | break;
3671 | case 'compare_adr_progress':
3672 | response = await this.compareAdrProgress(safeArgs);
3673 | break;
3674 | case 'analyze_content_security':
3675 | response = await this.analyzeContentSecurity(
3676 | safeArgs as unknown as AnalyzeContentSecurityArgs
3677 | );
3678 | break;
3679 | case 'generate_content_masking':
3680 | response = await this.generateContentMasking(
3681 | safeArgs as unknown as GenerateContentMaskingArgs
3682 | );
3683 | break;
3684 | case 'configure_custom_patterns':
3685 | response = await this.configureCustomPatterns(
3686 | safeArgs as unknown as ConfigureCustomPatternsArgs
3687 | );
3688 | break;
3689 | case 'apply_basic_content_masking':
3690 | response = await this.applyBasicContentMasking(
3691 | safeArgs as unknown as ApplyBasicContentMaskingArgs
3692 | );
3693 | break;
3694 | case 'validate_content_masking':
3695 | response = await this.validateContentMasking(
3696 | safeArgs as unknown as ValidateContentMaskingArgs
3697 | );
3698 | break;
3699 | case 'manage_cache':
3700 | response = await this.manageCache(safeArgs);
3701 | break;
3702 | case 'configure_output_masking':
3703 | response = await this.configureOutputMasking(safeArgs);
3704 | break;
3705 | case 'suggest_adrs':
3706 | response = await this.suggestAdrs(safeArgs);
3707 | break;
3708 | case 'generate_adr_from_decision':
3709 | response = await this.generateAdrFromDecision(
3710 | safeArgs as unknown as GenerateAdrFromDecisionArgs
3711 | );
3712 | break;
3713 | case 'generate_adr_bootstrap':
3714 | response = await this.generateAdrBootstrap(safeArgs);
3715 | break;
3716 | case 'bootstrap_validation_loop':
3717 | response = await this.bootstrapValidationLoop(safeArgs);
3718 | break;
3719 | case 'discover_existing_adrs':
3720 | response = await this.discoverExistingAdrs(safeArgs, context);
3721 | break;
3722 | case 'analyze_adr_timeline':
3723 | response = await this.analyzeAdrTimeline(safeArgs);
3724 | break;
3725 | case 'review_existing_adrs':
3726 | response = await this.reviewExistingAdrs(safeArgs);
3727 | break;
3728 | case 'validate_adr':
3729 | response = await this.validateAdr(safeArgs);
3730 | break;
3731 | case 'validate_all_adrs':
3732 | response = await this.validateAllAdrs(safeArgs);
3733 | break;
3734 | case 'incorporate_research':
3735 | response = await this.incorporateResearch(safeArgs);
3736 | break;
3737 | case 'create_research_template':
3738 | response = await this.createResearchTemplate(safeArgs);
3739 | break;
3740 | case 'request_action_confirmation':
3741 | response = await this.requestActionConfirmation(safeArgs);
3742 | break;
3743 | case 'generate_rules':
3744 | response = await this.generateRules(safeArgs);
3745 | break;
3746 | case 'validate_rules':
3747 | response = await this.validateRules(safeArgs as unknown as ValidateRulesArgs);
3748 | break;
3749 | case 'create_rule_set':
3750 | response = await this.createRuleSet(safeArgs as unknown as CreateRuleSetArgs);
3751 | break;
3752 | case 'analyze_environment':
3753 | response = await this.analyzeEnvironment(safeArgs);
3754 | break;
3755 | case 'generate_research_questions':
3756 | response = await this.generateResearchQuestions(safeArgs);
3757 | break;
3758 | case 'perform_research':
3759 | response = await this.performResearch(safeArgs, context);
3760 | break;
3761 | case 'search_codebase':
3762 | response = await this.searchCodebase(safeArgs);
3763 | break;
3764 | case 'llm_web_search':
3765 | response = await this.llmWebSearch(safeArgs);
3766 | break;
3767 | case 'llm_cloud_management':
3768 | response = await this.llmCloudManagement(safeArgs);
3769 | break;
3770 | case 'llm_database_management':
3771 | response = await this.llmDatabaseManagement(safeArgs);
3772 | break;
3773 | case 'analyze_deployment_progress':
3774 | response = await this.analyzeDeploymentProgress(safeArgs);
3775 | break;
3776 | case 'check_ai_execution_status':
3777 | response = await this.checkAIExecutionStatus(safeArgs);
3778 | break;
3779 | case 'get_workflow_guidance':
3780 | response = await this.getWorkflowGuidance(
3781 | safeArgs as unknown as GetWorkflowGuidanceArgs
3782 | );
3783 | break;
3784 | case 'get_development_guidance':
3785 | response = await this.getDevelopmentGuidance(
3786 | safeArgs as unknown as GetDevelopmentGuidanceArgs
3787 | );
3788 | break;
3789 | case 'list_roots':
3790 | response = await this.listRoots();
3791 | break;
3792 | case 'read_directory':
3793 | response = await this.readDirectory(safeArgs);
3794 | break;
3795 | case 'read_file': {
3796 | // Map 'path' parameter to 'filePath' for compatibility
3797 | const readFileArgs = safeArgs as { path?: string; filePath?: string };
3798 | response = await this.readFile({
3799 | filePath: readFileArgs.filePath || readFileArgs.path || '',
3800 | } as ReadFileArgs);
3801 | break;
3802 | }
3803 | case 'write_file':
3804 | response = await this.writeFile(safeArgs as unknown as WriteFileArgs);
3805 | break;
3806 | case 'list_directory':
3807 | response = await this.listDirectory(safeArgs);
3808 | break;
3809 | case 'generate_deployment_guidance':
3810 | response = await this.generateDeploymentGuidance(safeArgs);
3811 | break;
3812 | case 'smart_git_push':
3813 | response = await this.smartGitPush(safeArgs);
3814 | break;
3815 | case 'deployment_readiness':
3816 | response = await this.deploymentReadiness(safeArgs);
3817 | break;
3818 | case 'troubleshoot_guided_workflow':
3819 | response = await this.troubleshootGuidedWorkflow(safeArgs);
3820 | break;
3821 | case 'smart_score':
3822 | response = await this.smartScore(safeArgs);
3823 | break;
3824 | case 'mcp_planning':
3825 | response = await this.mcpPlanning(safeArgs);
3826 | break;
3827 | case 'memory_loading':
3828 | response = await this.memoryLoading(safeArgs);
3829 | break;
3830 | case 'expand_analysis_section':
3831 | response = await this.expandAnalysisSection(safeArgs);
3832 | break;
3833 | case 'interactive_adr_planning':
3834 | response = await this.interactiveAdrPlanning(safeArgs);
3835 | break;
3836 | case 'tool_chain_orchestrator':
3837 | response = await this.toolChainOrchestrator(
3838 | safeArgs as unknown as ToolChainOrchestratorArgs
3839 | );
3840 | break;
3841 | case 'expand_memory':
3842 | response = await this.expandMemory(safeArgs);
3843 | break;
3844 | case 'query_conversation_history':
3845 | response = await this.queryConversationHistory(safeArgs);
3846 | break;
3847 | case 'get_conversation_snapshot':
3848 | response = await this.getConversationSnapshot(safeArgs);
3849 | break;
3850 | case 'get_memory_stats':
3851 | response = await this.getMemoryStats();
3852 | break;
3853 | case 'update_knowledge':
3854 | response = await this.updateKnowledge(safeArgs);
3855 | break;
3856 | case 'get_server_context':
3857 | response = await this.getServerContext(safeArgs);
3858 | break;
3859 | case 'get_current_datetime':
3860 | response = await this.getCurrentDatetime(safeArgs);
3861 | break;
3862 | case 'search_tools':
3863 | response = {
3864 | content: [
3865 | {
3866 | type: 'text',
3867 | text: JSON.stringify(
3868 | executeSearchTools(safeArgs as unknown as SearchToolsArgs),
3869 | null,
3870 | 2
3871 | ),
3872 | },
3873 | ],
3874 | };
3875 | break;
3876 | case 'set_project_path':
3877 | response = await this.setProjectPath(
3878 | safeArgs as unknown as {
3879 | path: string;
3880 | validatePath?: boolean;
3881 | }
3882 | );
3883 | break;
3884 | case 'load_prompt':
3885 | response = await this.loadPrompt(
3886 | safeArgs as unknown as {
3887 | promptName: string;
3888 | section?: string;
3889 | estimateOnly?: boolean;
3890 | }
3891 | );
3892 | break;
3893 | // ADR Aggregator Integration Tools
3894 | case 'sync_to_aggregator': {
3895 | const { syncToAggregator } = await import('./tools/adr-aggregator-tools.js');
3896 | response = { ...(await syncToAggregator(safeArgs, context)) };
3897 | break;
3898 | }
3899 | case 'get_adr_context': {
3900 | const { getAdrContext } = await import('./tools/adr-aggregator-tools.js');
3901 | response = { ...(await getAdrContext(safeArgs, context)) };
3902 | break;
3903 | }
3904 | case 'get_staleness_report': {
3905 | const { getStalenessReport } = await import('./tools/adr-aggregator-tools.js');
3906 | response = { ...(await getStalenessReport(safeArgs, context)) };
3907 | break;
3908 | }
3909 | case 'get_adr_templates': {
3910 | const { getAdrTemplates } = await import('./tools/adr-aggregator-tools.js');
3911 | response = { ...(await getAdrTemplates(safeArgs, context)) };
3912 | break;
3913 | }
3914 | case 'get_adr_diagrams': {
3915 | const { getAdrDiagrams } = await import('./tools/adr-aggregator-tools.js');
3916 | response = { ...(await getAdrDiagrams(safeArgs, context)) };
3917 | break;
3918 | }
3919 | case 'validate_adr_compliance': {
3920 | const { validateAdrCompliance } = await import('./tools/adr-aggregator-tools.js');
3921 | response = { ...(await validateAdrCompliance(safeArgs, context)) };
3922 | break;
3923 | }
3924 | case 'get_knowledge_graph': {
3925 | const { getKnowledgeGraph } = await import('./tools/adr-aggregator-tools.js');
3926 | response = { ...(await getKnowledgeGraph(safeArgs, context)) };
3927 | break;
3928 | }
3929 | case 'analyze_gaps': {
3930 | const { analyzeGaps } = await import('./tools/analyze-gaps-tool.js');
3931 | response = { ...(await analyzeGaps(safeArgs, context)) };
3932 | break;
3933 | }
3934 | case 'get_gaps': {
3935 | const { getGaps } = await import('./tools/analyze-gaps-tool.js');
3936 | response = { ...(await getGaps(safeArgs, context)) };
3937 | break;
3938 | }
3939 | default:
3940 | throw new McpAdrError(`Unknown tool: ${name}`, 'UNKNOWN_TOOL');
3941 | }
3942 |
3943 | // Track tool execution in knowledge graph
3944 | await this.trackToolExecution(name, args, response, true);
3945 |
3946 | // Apply state reinforcement (Phase 2: Context Decay Mitigation) and content masking
3947 | // Also record conversation turn (Phase 3: Structured External Memory)
3948 | return await this.enrichResponseWithStateReinforcement(response, name, args);
3949 | } catch (error) {
3950 | // Track failed execution
3951 | await this.trackToolExecution(
3952 | name,
3953 | args,
3954 | {},
3955 | false,
3956 | error instanceof Error ? error.message : String(error)
3957 | );
3958 |
3959 | if (error instanceof McpAdrError) {
3960 | throw error;
3961 | }
3962 | throw new McpAdrError(
3963 | `Tool execution failed: ${error instanceof Error ? error.message : String(error)}`,
3964 | 'TOOL_EXECUTION_ERROR'
3965 | );
3966 | }
3967 | });
3968 |
3969 | /**
3970 | * List Resources Handler - MCP Protocol Endpoint
3971 | *
3972 | * @description Returns available resources for client access including the
3973 | * architectural knowledge graph and project analysis data. Resources provide
3974 | * read-only access to server-managed data structures.
3975 | *
3976 | * @returns {Promise<{resources: Array}>} Available resources with URIs and descriptions
3977 | *
3978 | * @example
3979 | * ```typescript
3980 | * // List available resources
3981 | * const resources = await mcpClient.listResources();
3982 | * console.log(resources.resources.length); // Available resources
3983 | *
3984 | * // Find knowledge graph resource
3985 | * const kgResource = resources.resources.find(r =>
3986 | * r.uri === 'adr://architectural_knowledge_graph'
3987 | * );
3988 | * console.log(kgResource.name); // "Architectural Knowledge Graph"
3989 | * ```
3990 | *
3991 | * @mcp-endpoint
3992 | * @category Resources
3993 | */
3994 | this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
3995 | return {
3996 | resources: [
3997 | // Existing resources (refactored to return data)
3998 | {
3999 | uri: 'adr://architectural_knowledge_graph',
4000 | name: 'Architectural Knowledge Graph',
4001 | description:
4002 | 'Complete architectural knowledge graph with technologies, patterns, and relationships',
4003 | mimeType: 'application/json',
4004 | },
4005 | {
4006 | uri: 'adr://analysis_report',
4007 | name: 'Analysis Report',
4008 | description: 'Comprehensive project analysis report with metrics and recommendations',
4009 | mimeType: 'application/json',
4010 | },
4011 | {
4012 | uri: 'adr://adr_list',
4013 | name: 'ADR List',
4014 | description: 'List of all Architectural Decision Records with status and metadata',
4015 | mimeType: 'application/json',
4016 | },
4017 | // NEW Phase 1 Resources
4018 | {
4019 | uri: 'adr://todo_list',
4020 | name: 'Todo List',
4021 | description: 'Current project task list with status, priorities, and dependencies',
4022 | mimeType: 'application/json',
4023 | },
4024 | {
4025 | uri: 'adr://research_index',
4026 | name: 'Research Index',
4027 | description: 'Index of all research documents and findings with metadata',
4028 | mimeType: 'application/json',
4029 | },
4030 | {
4031 | uri: 'adr://rule_catalog',
4032 | name: 'Rule Catalog',
4033 | description: 'Catalog of all architectural and validation rules from ADRs and code',
4034 | mimeType: 'application/json',
4035 | },
4036 | {
4037 | uri: 'adr://rule_generation',
4038 | name: 'Rule Generation',
4039 | description:
4040 | 'AI-powered rule generation from ADRs and code patterns. Supports query parameters: ?operation=generate|validate|create_set, ?source=adrs|patterns|both, ?knowledge=true|false, ?enhanced=true|false, ?format=json|yaml|both, ?comprehensive=true|false',
4041 | mimeType: 'application/json',
4042 | },
4043 | {
4044 | uri: 'adr://project_status',
4045 | name: 'Project Status',
4046 | description: 'Current project status and health metrics aggregated from all sources',
4047 | mimeType: 'application/json',
4048 | },
4049 | // NEW Phase 2 Templated Resources
4050 | {
4051 | uri: 'adr://adr/{id}',
4052 | name: 'ADR by ID',
4053 | description: 'Individual Architectural Decision Record by ID or title match',
4054 | mimeType: 'application/json',
4055 | },
4056 | {
4057 | uri: 'adr://research/{topic}',
4058 | name: 'Research by Topic',
4059 | description: 'Research documents filtered by topic with full content',
4060 | mimeType: 'application/json',
4061 | },
4062 | {
4063 | uri: 'adr://todo/{task_id}',
4064 | name: 'Todo by Task ID',
4065 | description:
4066 | 'Individual task details by ID or title match with dependencies and history',
4067 | mimeType: 'application/json',
4068 | },
4069 | {
4070 | uri: 'adr://rule/{rule_id}',
4071 | name: 'Rule by ID',
4072 | description:
4073 | 'Individual architectural rule by ID or name match with violations and usage stats',
4074 | mimeType: 'application/json',
4075 | },
4076 | // NEW Phase 3 Advanced Resources
4077 | {
4078 | uri: 'adr://deployment_status',
4079 | name: 'Deployment Status',
4080 | description:
4081 | 'Current deployment state with health checks, build status, and readiness score',
4082 | mimeType: 'application/json',
4083 | },
4084 | {
4085 | uri: 'adr://environment_analysis',
4086 | name: 'Environment Analysis',
4087 | description:
4088 | 'System environment details including platform, dependencies, and capabilities',
4089 | mimeType: 'application/json',
4090 | },
4091 | {
4092 | uri: 'adr://memory_snapshots',
4093 | name: 'Memory Snapshots',
4094 | description:
4095 | 'Knowledge graph snapshots with statistics, insights, and relationship data',
4096 | mimeType: 'application/json',
4097 | },
4098 | {
4099 | uri: 'adr://project_metrics',
4100 | name: 'Project Metrics',
4101 | description:
4102 | 'Code metrics and quality scores including codebase stats, quality assessment, and git metrics',
4103 | mimeType: 'application/json',
4104 | },
4105 | {
4106 | uri: 'adr://technology/{name}',
4107 | name: 'Technology by Name',
4108 | description:
4109 | 'Individual technology analysis by name with usage, relationships, and adoption status',
4110 | mimeType: 'application/json',
4111 | },
4112 | {
4113 | uri: 'adr://pattern/{name}',
4114 | name: 'Pattern by Name',
4115 | description:
4116 | 'Individual pattern analysis by name with quality metrics, relationships, and examples',
4117 | mimeType: 'application/json',
4118 | },
4119 | // NEW Phase 4 Final Resources
4120 | {
4121 | uri: 'adr://deployment_history',
4122 | name: 'Deployment History',
4123 | description:
4124 | 'Historical deployment data with trends, failure analysis, and patterns. Supports query parameters: ?period=7d|30d|90d|1y|all, ?environment=production|staging|development|all, ?includeFailures=true|false, ?includeMetrics=true|false, ?format=summary|detailed',
4125 | mimeType: 'application/json',
4126 | },
4127 | {
4128 | uri: 'adr://code_quality',
4129 | name: 'Code Quality',
4130 | description:
4131 | 'Comprehensive code quality assessment with metrics, issues, and recommendations. Supports query parameters: ?scope=full|changes|critical, ?includeMetrics=true|false, ?includeRecommendations=true|false, ?threshold=0-100, ?format=summary|detailed',
4132 | mimeType: 'application/json',
4133 | },
4134 | // NEW Phase 5 Validated Pattern Resources
4135 | {
4136 | uri: 'adr://validated_patterns',
4137 | name: 'Validated Patterns Catalog',
4138 | description:
4139 | 'Complete catalog of validated deployment patterns for different platforms (OpenShift, Kubernetes, Docker, Node.js, Python, MCP, A2A) with bill of materials, deployment phases, validation checks, and authoritative sources',
4140 | mimeType: 'application/json',
4141 | },
4142 | {
4143 | uri: 'adr://validated_pattern/{platform}',
4144 | name: 'Validated Pattern by Platform',
4145 | description:
4146 | 'Individual validated pattern by platform type (openshift, kubernetes, docker, nodejs, python, mcp, a2a) with complete bill of materials, deployment phases, validation checks, health checks, and authoritative sources for LLM research',
4147 | mimeType: 'application/json',
4148 | },
4149 | {
4150 | uri: 'adr://pattern_sources/{platform}',
4151 | name: 'Pattern Authoritative Sources',
4152 | description:
4153 | 'Authoritative documentation and repository sources for a specific platform pattern, prioritized by importance with query instructions for LLMs',
4154 | mimeType: 'application/json',
4155 | },
4156 | {
4157 | uri: 'adr://pattern_base_code/{platform}',
4158 | name: 'Pattern Base Code Repository',
4159 | description:
4160 | 'Base code repository information for a platform pattern including URL, integration instructions, required files, and script entrypoint',
4161 | mimeType: 'application/json',
4162 | },
4163 | // NEW Knowledge Graph Resource (ADR-018)
4164 | {
4165 | uri: 'knowledge://graph',
4166 | name: 'Knowledge Graph',
4167 | description:
4168 | 'Read-only knowledge graph structure with nodes (intents, ADRs, tools, code files) and edges (relationships). Zero token cost for querying graph state. Use update_knowledge tool to modify.',
4169 | mimeType: 'application/json',
4170 | },
4171 | ],
4172 | };
4173 | });
4174 |
4175 | /**
4176 | * Read Resource Handler - MCP Protocol Endpoint
4177 | *
4178 | * @description Reads specific resource content by URI. Provides access to
4179 | * architectural knowledge graphs, project analysis data, and other server-managed
4180 | * resources with appropriate content masking applied.
4181 | *
4182 | * @param {ReadResourceRequest} request - MCP resource read request
4183 | * @param {string} request.params.uri - Resource URI to read
4184 | *
4185 | * @returns {Promise<ReadResourceResult>} Resource content with metadata
4186 | *
4187 | * @throws {McpAdrError} When resource URI is invalid or access fails
4188 | *
4189 | * @example
4190 | * ```typescript
4191 | * // Read knowledge graph resource
4192 | * const kgData = await mcpClient.readResource(
4193 | * 'adr://architectural_knowledge_graph'
4194 | * );
4195 | * console.log(kgData.contents); // Knowledge graph JSON
4196 | * ```
4197 | *
4198 | * @mcp-endpoint
4199 | * @category Resources
4200 | */
4201 | this.server.setRequestHandler(ReadResourceRequestSchema, async request => {
4202 | const { uri } = request.params;
4203 |
4204 | try {
4205 | const response = await this.readResource(uri);
4206 | return await this.applyOutputMasking(response);
4207 | } catch (error) {
4208 | if (error instanceof McpAdrError) {
4209 | throw error;
4210 | }
4211 | throw new McpAdrError(
4212 | `Resource reading failed: ${error instanceof Error ? error.message : String(error)}`,
4213 | 'RESOURCE_ERROR'
4214 | );
4215 | }
4216 | });
4217 |
4218 | /**
4219 | * List Prompts Handler - MCP Protocol Endpoint
4220 | *
4221 | * @description Returns available prompt templates for ADR analysis, research,
4222 | * and architectural decision support. Prompts can be executed directly or
4223 | * used as templates for custom implementations.
4224 | *
4225 | * @returns {Promise<{prompts: Array}>} Available prompt templates with metadata
4226 | *
4227 | * @example
4228 | * ```typescript
4229 | * // List available prompts
4230 | * const prompts = await mcpClient.listPrompts();
4231 | * console.log(prompts.prompts.length); // Available prompt templates
4232 | *
4233 | * // Find ADR analysis prompt
4234 | * const adrPrompt = prompts.prompts.find(p =>
4235 | * p.name === 'adr_analysis_prompt'
4236 | * );
4237 | * console.log(adrPrompt.description); // Prompt description
4238 | * ```
4239 | *
4240 | * @mcp-endpoint
4241 | * @category Prompts
4242 | */
4243 | this.server.setRequestHandler(ListPromptsRequestSchema, async () => {
4244 | const { allPrompts } = await import('./prompts/index.js');
4245 |
4246 | return {
4247 | prompts: allPrompts.map(prompt => ({
4248 | name: prompt.name,
4249 | description: prompt.description,
4250 | arguments: prompt.arguments,
4251 | })),
4252 | };
4253 | });
4254 |
4255 | /**
4256 | * Get Prompt Handler - MCP Protocol Endpoint
4257 | *
4258 | * @description Executes specific prompt templates with provided arguments.
4259 | * Returns formatted prompts ready for AI execution or further processing.
4260 | * Supports dynamic argument injection and template customization.
4261 | *
4262 | * @param {GetPromptRequest} request - MCP prompt execution request
4263 | * @param {string} request.params.name - Prompt template name
4264 | * @param {Object} request.params.arguments - Template-specific arguments
4265 | *
4266 | * @returns {Promise<GetPromptResult>} Formatted prompt with metadata
4267 | *
4268 | * @throws {McpAdrError} When prompt template is not found or arguments are invalid
4269 | *
4270 | * @example
4271 | * ```typescript
4272 | * // Execute ADR analysis prompt
4273 | * const prompt = await mcpClient.getPrompt('adr_analysis_prompt', {
4274 | * adrPath: 'docs/adrs/0001-auth.md',
4275 | * projectContext: 'microservices architecture'
4276 | * });
4277 | *
4278 | * console.log(prompt.messages); // Formatted prompt messages
4279 | * ```
4280 | *
4281 | * @example
4282 | * ```typescript
4283 | * // Execute research prompt
4284 | * const researchPrompt = await mcpClient.getPrompt('research_question_prompt', {
4285 | * domain: 'authentication',
4286 | * complexity: 'advanced'
4287 | * });
4288 | *
4289 | * console.log(researchPrompt.messages[0].content); // Research prompt
4290 | * ```
4291 | *
4292 | * @mcp-endpoint
4293 | * @category Prompts
4294 | * @category Execution
4295 | */
4296 | this.server.setRequestHandler(GetPromptRequestSchema, async request => {
4297 | const { name, arguments: args } = request.params;
4298 |
4299 | try {
4300 | const { allPrompts } = await import('./prompts/index.js');
4301 | const prompt = allPrompts.find(p => p.name === name);
4302 |
4303 | if (!prompt) {
4304 | throw new McpAdrError(`Unknown prompt: ${name}`, 'UNKNOWN_PROMPT');
4305 | }
4306 |
4307 | // Simple template rendering (replace {{variable}} with values)
4308 | let renderedTemplate = prompt.template;
4309 | if (args) {
4310 | for (const [key, value] of Object.entries(args)) {
4311 | const regex = new RegExp(`{{${key}}}`, 'g');
4312 | renderedTemplate = renderedTemplate.replace(regex, String(value));
4313 | }
4314 | }
4315 |
4316 | const response = {
4317 | description: prompt.description,
4318 | messages: [
4319 | {
4320 | role: 'user',
4321 | content: {
4322 | type: 'text',
4323 | text: renderedTemplate,
4324 | },
4325 | },
4326 | ],
4327 | };
4328 |
4329 | return await this.applyOutputMasking(response);
4330 | } catch (error) {
4331 | if (error instanceof McpAdrError) {
4332 | throw error;
4333 | }
4334 | throw new McpAdrError(
4335 | `Prompt execution failed: ${error instanceof Error ? error.message : String(error)}`,
4336 | 'PROMPT_EXECUTION_ERROR'
4337 | );
4338 | }
4339 | });
4340 | }
4341 |
4342 | /**
4343 | * Tool implementations
4344 | */
4345 | private async checkAIExecutionStatus(_args: Record<string, unknown>): Promise<CallToolResult> {
4346 | try {
4347 | const { getAIExecutionStatus } = await import('./utils/prompt-execution.js');
4348 | const status = getAIExecutionStatus();
4349 |
4350 | return {
4351 | content: [
4352 | {
4353 | type: 'text',
4354 | text: `# AI Execution Status Diagnostic
4355 |
4356 | > **Note**: As of Phase 5, this server uses CE-MCP (Claude-Enriched MCP) mode by default.
4357 | > In CE-MCP mode, tools return orchestration directives that the host LLM executes directly,
4358 | > eliminating the need for external API calls. The configuration below applies to legacy mode only.
4359 |
4360 | ## Current Configuration
4361 | - **AI Execution Enabled**: ${status.isEnabled ? '✅ YES' : '❌ NO'}
4362 | - **Has API Key**: ${status.hasApiKey ? '✅ YES' : '❌ NO'}
4363 | - **Execution Mode**: ${status.executionMode}
4364 | - **AI Model**: ${status.model}
4365 |
4366 | ${
4367 | status.reason
4368 | ? `## ⚠️ Issue Detected
4369 | **Problem**: ${status.reason}
4370 |
4371 | ## Solution
4372 | ${
4373 | !status.hasApiKey
4374 | ? `
4375 | 1. Get an OpenRouter API key from https://openrouter.ai/keys
4376 | 2. Add it to your MCP configuration:
4377 | \`\`\`json
4378 | {
4379 | "mcpServers": {
4380 | "adr-analysis": {
4381 | "command": "mcp-adr-analysis-server",
4382 | "env": {
4383 | "OPENROUTER_API_KEY": "your_api_key_here",
4384 | "EXECUTION_MODE": "full",
4385 | "AI_MODEL": "anthropic/claude-3-sonnet"
4386 | }
4387 | }
4388 | }
4389 | }
4390 | \`\`\`
4391 | 3. Restart your MCP client (Claude Desktop, etc.)
4392 | `
4393 | : status.executionMode !== 'full'
4394 | ? `
4395 | 1. Update your MCP configuration to set EXECUTION_MODE to "full":
4396 | \`\`\`json
4397 | {
4398 | "mcpServers": {
4399 | "adr-analysis": {
4400 | "env": {
4401 | "EXECUTION_MODE": "full"
4402 | }
4403 | }
4404 | }
4405 | }
4406 | \`\`\`
4407 | 2. Restart your MCP client
4408 | `
4409 | : ''
4410 | }`
4411 | : `## ✅ Configuration Looks Good!
4412 |
4413 | AI execution is properly configured. Tools should return actual results instead of prompts.
4414 |
4415 | If you're still seeing prompts instead of results, try:
4416 | 1. Restart your MCP client
4417 | 2. Check your OpenRouter API key has sufficient credits
4418 | 3. Verify network connectivity to OpenRouter.ai`
4419 | }
4420 |
4421 | ## Environment Variables Expected
4422 | - **OPENROUTER_API_KEY**: Your OpenRouter API key
4423 | - **EXECUTION_MODE**: Set to "full" for AI execution
4424 | - **AI_MODEL**: AI model to use (optional, defaults to claude-3-sonnet)
4425 |
4426 | ## Testing
4427 | After fixing the configuration, try calling \`suggest_adrs\` - it should return actual ADR suggestions instead of prompts.
4428 | `,
4429 | },
4430 | ],
4431 | };
4432 | } catch (error) {
4433 | return {
4434 | content: [
4435 | {
4436 | type: 'text',
4437 | text: `# AI Execution Status Check Failed
4438 |
4439 | **Error**: ${error instanceof Error ? error.message : String(error)}
4440 |
4441 | This diagnostic tool helps identify why tools return prompts instead of actual results.
4442 |
4443 | ## Manual Check
4444 | Verify these environment variables are set in your MCP configuration:
4445 | - OPENROUTER_API_KEY
4446 | - EXECUTION_MODE=full
4447 | - AI_MODEL (optional)
4448 | `,
4449 | },
4450 | ],
4451 | };
4452 | }
4453 | }
4454 |
4455 | private async getWorkflowGuidance(args: GetWorkflowGuidanceArgs): Promise<CallToolResult> {
4456 | const {
4457 | goal,
4458 | projectContext,
4459 | availableAssets = [],
4460 | timeframe = 'thorough_review',
4461 | primaryConcerns = [],
4462 | } = args;
4463 |
4464 | try {
4465 | const workflowPrompt = `
4466 | # Workflow Guidance & Tool Recommendation System
4467 |
4468 | ## User Context Analysis
4469 | - **Goal**: ${goal}
4470 | - **Project Context**: ${projectContext}
4471 | - **Available Assets**: ${availableAssets.length > 0 ? availableAssets.join(', ') : 'None specified'}
4472 | - **Timeframe**: ${timeframe}
4473 | - **Primary Concerns**: ${primaryConcerns.length > 0 ? primaryConcerns.join(', ') : 'General analysis'}
4474 |
4475 | ## Available MCP Tools (24 Total)
4476 |
4477 | ### 🎯 **Core Analysis Tools** (AI-Powered ✅)
4478 | 1. **analyze_project_ecosystem** - Comprehensive technology and pattern detection
4479 | 2. **get_architectural_context** - Generate intelligent architectural insights + ADR setup
4480 | 3. **generate_adrs_from_prd** - Convert requirements to structured ADRs
4481 | 4. **analyze_content_security** - Detect sensitive information patterns
4482 |
4483 | ### 📋 **ADR Management Tools** (AI-Powered ✅)
4484 | 5. **suggest_adrs** - Auto-suggest ADRs from implicit decisions
4485 | 6. **generate_adr_from_decision** - Create ADRs from specific decisions
4486 | 7. **discover_existing_adrs** - Intelligent ADR discovery and analysis
4487 |
4488 | ### 🔍 **Research & Documentation Tools** (AI-Powered ✅)
4489 | 8. **generate_research_questions** - Create context-aware research questions
4490 | 9. **incorporate_research** - Integrate research findings into decisions
4491 | 10. **create_research_template** - Generate research documentation templates
4492 |
4493 | ### 🛡️ **Security & Compliance Tools** (AI-Powered ✅)
4494 | 11. **generate_content_masking** - Intelligent content masking and protection
4495 | 12. **configure_custom_patterns** - Customize security and masking settings
4496 | 13. **apply_basic_content_masking** - Basic content masking (fallback)
4497 | 14. **validate_content_masking** - Validate masking effectiveness
4498 |
4499 | ### 🏗️ **Rule & Governance Tools** (AI-Powered ✅)
4500 | 16. **generate_rules** - Extract architectural rules from ADRs
4501 | 17. **validate_rules** - Validate code against architectural rules
4502 | 18. **create_rule_set** - Create comprehensive rule management systems
4503 |
4504 | ### 🚀 **Deployment & Environment Tools** (AI-Powered ✅)
4505 | 19. **analyze_environment** - Environment analysis and optimization
4506 | 20. **analyze_deployment_progress** - Deployment tracking and verification
4507 |
4508 | ### ⚙️ **Utility & Management Tools**
4509 | 21. **manage_cache** - Cache management and optimization
4510 | 22. **configure_output_masking** - Configure global output masking
4511 | 23. **request_action_confirmation** - Interactive user confirmation workflows
4512 | 24. **get_workflow_guidance** - This tool - intelligent workflow advisor
4513 |
4514 | ## Workflow Recommendation Instructions
4515 |
4516 | Based on the user's goal, project context, available assets, timeframe, and concerns, provide:
4517 |
4518 | ### 1. **Recommended Tool Sequence**
4519 | Provide a step-by-step workflow with:
4520 | - **Tool Name**: Exact tool to call
4521 | - **Purpose**: Why this tool is needed
4522 | - **Expected Outcome**: What it will deliver
4523 | - **Parameters**: Suggested parameters for the tool call
4524 | - **Success Criteria**: How to know it worked
4525 |
4526 | ### 2. **Alternative Workflows**
4527 | Provide 2-3 alternative approaches based on:
4528 | - Different time constraints
4529 | - Different priorities
4530 | - Different starting points
4531 |
4532 | ### 3. **Expected Timeline & Effort**
4533 | For each recommended workflow:
4534 | - **Estimated Time**: How long each step takes
4535 | - **Effort Level**: Low/Medium/High effort required
4536 | - **Dependencies**: Which steps must be completed first
4537 |
4538 | ### 4. **Success Metrics**
4539 | Define how to measure success:
4540 | - **Immediate Indicators**: Quick wins and early signals
4541 | - **Progress Milestones**: Key checkpoints
4542 | - **Final Outcomes**: Ultimate success criteria
4543 |
4544 | ### 5. **Common Pitfalls & Tips**
4545 | - **What to Avoid**: Common mistakes in this workflow
4546 | - **Pro Tips**: Best practices for maximum effectiveness
4547 | - **Troubleshooting**: What to do if steps fail
4548 |
4549 | ## Common Workflow Patterns
4550 |
4551 | ### **New Project Setup**
4552 | 1. analyze_project_ecosystem → 2. get_architectural_context → 3. suggest_adrs → 4. generate_adr_from_decision
4553 |
4554 | ### **Existing Project Analysis**
4555 | 1. discover_existing_adrs → 2. get_architectural_context → 3. validate_rules
4556 |
4557 | ### **Security Audit**
4558 | 1. analyze_content_security → 2. generate_content_masking → 3. configure_custom_patterns → 4. validate_content_masking
4559 |
4560 | ### **PRD to Implementation**
4561 | 1. generate_adrs_from_prd → 2. analyze_deployment_progress
4562 |
4563 | ### **Legacy Modernization**
4564 | 1. analyze_project_ecosystem → 2. get_architectural_context → 3. suggest_adrs → 4. generate_rules → 5. validate_rules
4565 |
4566 | ## Output Format
4567 |
4568 | Provide a comprehensive workflow guide that includes:
4569 |
4570 | 1. **🎯 Recommended Primary Workflow** (step-by-step with tool calls)
4571 | 2. **🔄 Alternative Approaches** (2-3 different paths)
4572 | 3. **⏱️ Timeline & Effort Estimates** (realistic expectations)
4573 | 4. **📊 Success Metrics** (how to measure progress)
4574 | 5. **💡 Pro Tips & Best Practices** (maximize effectiveness)
4575 | 6. **⚠️ Common Pitfalls** (what to avoid)
4576 |
4577 | Make the guidance **actionable, specific, and outcome-focused** so the user can immediately start executing the recommended workflow.
4578 | `;
4579 |
4580 | // Execute the workflow guidance with AI if enabled
4581 | const { executePromptWithFallback, formatMCPResponse } =
4582 | await import('./utils/prompt-execution.js');
4583 | const executionResult = await executePromptWithFallback(
4584 | workflowPrompt,
4585 | 'Analyze the user context and provide intelligent workflow guidance with specific tool recommendations.',
4586 | {
4587 | temperature: 0.1,
4588 | maxTokens: 6000,
4589 | systemPrompt: `You are an expert workflow advisor for the MCP ADR Analysis Server.
4590 | Your role is to analyze user goals and project context, then recommend the optimal sequence of tools to achieve their objectives efficiently.
4591 | Provide specific, actionable guidance with clear tool sequences, expected outcomes, and success criteria.
4592 | Focus on practical workflows that deliver measurable results.`,
4593 | }
4594 | );
4595 |
4596 | if (executionResult.isAIGenerated) {
4597 | // AI execution successful - return actual workflow guidance
4598 | return formatMCPResponse({
4599 | ...executionResult,
4600 | content: `# Workflow Guidance & Tool Recommendations
4601 |
4602 | ## Your Context
4603 | - **Goal**: ${goal}
4604 | - **Project Context**: ${projectContext}
4605 | - **Available Assets**: ${availableAssets.length > 0 ? availableAssets.join(', ') : 'None specified'}
4606 | - **Timeframe**: ${timeframe}
4607 | - **Primary Concerns**: ${primaryConcerns.length > 0 ? primaryConcerns.join(', ') : 'General analysis'}
4608 |
4609 | ## AI-Generated Workflow Guidance
4610 |
4611 | ${executionResult.content}
4612 |
4613 | ## Quick Reference: Available Tools
4614 |
4615 | **Core Analysis**: analyze_project_ecosystem, get_architectural_context, generate_adrs_from_prd, analyze_content_security
4616 | **ADR Management**: suggest_adrs, generate_adr_from_decision, discover_existing_adrs
4617 | **Security**: generate_content_masking, configure_custom_patterns, validate_content_masking
4618 | **Governance**: generate_rules, validate_rules, create_rule_set
4619 | **Environment**: analyze_environment, analyze_deployment_progress
4620 | **Utilities**: manage_cache, configure_output_masking, check_ai_execution_status
4621 |
4622 | ## Next Steps
4623 |
4624 | 1. **Start with the recommended primary workflow** above
4625 | 2. **Call the first tool** with the suggested parameters
4626 | 3. **Review the results** and proceed to the next step
4627 | 4. **Track progress** using the success metrics provided
4628 | 5. **Adjust as needed** based on your specific findings
4629 |
4630 | This guidance is tailored to your specific context and goals for maximum effectiveness!
4631 | `,
4632 | });
4633 | } else {
4634 | // Fallback to prompt-only mode
4635 | return {
4636 | content: [
4637 | {
4638 | type: 'text',
4639 | text: workflowPrompt,
4640 | },
4641 | ],
4642 | };
4643 | }
4644 | } catch (error) {
4645 | throw new McpAdrError(
4646 | `Failed to generate workflow guidance: ${error instanceof Error ? error.message : String(error)}`,
4647 | 'WORKFLOW_ERROR'
4648 | );
4649 | }
4650 | }
4651 |
4652 | private async getDevelopmentGuidance(args: GetDevelopmentGuidanceArgs): Promise<CallToolResult> {
4653 | const {
4654 | developmentPhase,
4655 | adrsToImplement = [],
4656 | technologyStack = [],
4657 | currentProgress = '',
4658 | teamContext = { size: 'small_team', experienceLevel: 'mixed' },
4659 | timeline = '',
4660 | focusAreas = [],
4661 | } = args;
4662 |
4663 | try {
4664 | // Use actual ADR discovery if ADRs are specified
4665 | let adrAnalysisPrompt = '';
4666 |
4667 | if (adrsToImplement.length > 0) {
4668 | const { getAdrDirectoryPath } = await import('./utils/config.js');
4669 | const { discoverAdrsInDirectory } = await import('./utils/adr-discovery.js');
4670 | const absoluteAdrPath = getAdrDirectoryPath(this.config);
4671 |
4672 | const discoveryResult = await discoverAdrsInDirectory(
4673 | absoluteAdrPath,
4674 | this.config.projectPath,
4675 | {
4676 | includeContent: true,
4677 | includeTimeline: false,
4678 | }
4679 | );
4680 |
4681 | // Filter ADRs to only those specified for implementation
4682 | const targetAdrs = discoveryResult.adrs.filter(adr =>
4683 | adrsToImplement.some(
4684 | (target: string) =>
4685 | adr.title.toLowerCase().includes(target.toLowerCase()) ||
4686 | adr.filename.toLowerCase().includes(target.toLowerCase())
4687 | )
4688 | );
4689 |
4690 | adrAnalysisPrompt = `
4691 | ## ADR Analysis for Implementation
4692 |
4693 | **ADRs to Implement**: ${adrsToImplement.join(', ')}
4694 | **ADR Directory**: ${absoluteAdrPath}
4695 | **Found ${targetAdrs.length} matching ADRs**
4696 |
4697 | ${targetAdrs
4698 | .map(
4699 | adr => `
4700 | ### ${adr.title}
4701 | - **File**: ${adr.filename}
4702 | - **Status**: ${adr.status}
4703 | - **Context**: ${adr.context}
4704 | - **Decision**: ${adr.decision}
4705 | - **Consequences**: ${adr.consequences}
4706 | `
4707 | )
4708 | .join('\n')}
4709 | `;
4710 | }
4711 |
4712 | const developmentPrompt = `
4713 | # Development Guidance & Implementation Roadmap
4714 |
4715 | ## Development Context
4716 | - **Development Phase**: ${developmentPhase}
4717 | - **Technology Stack**: ${technologyStack.length > 0 ? technologyStack.join(', ') : 'Not specified'}
4718 | - **Current Progress**: ${currentProgress || 'Starting fresh'}
4719 | - **Team Size**: ${teamContext.size}
4720 | - **Team Experience**: ${teamContext.experienceLevel}
4721 | - **Timeline**: ${timeline || 'Not specified'}
4722 | - **Focus Areas**: ${focusAreas.length > 0 ? focusAreas.join(', ') : 'General development'}
4723 |
4724 | ${adrAnalysisPrompt}
4725 |
4726 | ## Development Guidance Instructions
4727 |
4728 | Based on the development context, ADRs to implement, and technology stack, provide comprehensive development guidance including:
4729 |
4730 | ### 1. **Implementation Roadmap**
4731 | Create a detailed development plan with:
4732 | - **Phase-by-Phase Breakdown**: Logical development phases
4733 | - **Task Prioritization**: Order tasks by dependencies and impact
4734 | - **Milestone Definition**: Clear checkpoints and deliverables
4735 | - **Risk Assessment**: Potential blockers and mitigation strategies
4736 |
4737 | ### 2. **Code Structure & Architecture**
4738 | Provide specific guidance on:
4739 | - **Project Structure**: How to organize code files and directories
4740 | - **Module Architecture**: How to structure components/modules
4741 | - **Design Patterns**: Which patterns to use and where
4742 | - **Code Organization**: Separation of concerns and layering
4743 |
4744 | ### 3. **Implementation Patterns & Best Practices**
4745 | For each technology in the stack, provide:
4746 | - **Framework-Specific Patterns**: Best practices for the chosen frameworks
4747 | - **API Design**: How to structure APIs and endpoints
4748 | - **Data Layer**: Database schema and data access patterns
4749 | - **State Management**: How to handle application state
4750 | - **Error Handling**: Consistent error handling strategies
4751 |
4752 | ### 4. **ADR-to-Code Translation**
4753 | For each ADR to implement:
4754 | - **Implementation Tasks**: Specific coding tasks derived from the ADR
4755 | - **Code Examples**: Pseudo-code or pattern examples
4756 | - **Integration Points**: How this ADR affects other parts of the system
4757 | - **Validation Criteria**: How to verify the ADR is properly implemented
4758 |
4759 | ### 5. **Testing Strategy**
4760 | Comprehensive testing approach:
4761 | - **Unit Testing**: What to test and how
4762 | - **Integration Testing**: API and component integration tests
4763 | - **End-to-End Testing**: User workflow testing
4764 | - **Performance Testing**: Load and performance validation
4765 | - **Security Testing**: Security validation approaches
4766 |
4767 | ### 6. **Development Workflow**
4768 | Team-specific guidance:
4769 | - **Git Workflow**: Branching strategy and code review process
4770 | - **CI/CD Pipeline**: Automated testing and deployment
4771 | - **Code Quality**: Linting, formatting, and quality gates
4772 | - **Documentation**: What to document and how
4773 |
4774 | ### 7. **Quality Gates & Checkpoints**
4775 | Define success criteria:
4776 | - **Code Quality Metrics**: Coverage, complexity, maintainability
4777 | - **Performance Benchmarks**: Response times, throughput targets
4778 | - **Security Checkpoints**: Security validation at each phase
4779 | - **Architectural Compliance**: Adherence to ADR decisions
4780 |
4781 | ### 8. **Technology-Specific Implementation**
4782 | For each technology in the stack, provide:
4783 | - **Setup Instructions**: Environment and tooling setup
4784 | - **Configuration**: Framework and tool configuration
4785 | - **Optimization**: Performance and build optimization
4786 | - **Deployment**: Technology-specific deployment considerations
4787 |
4788 | ## Expected Output Format
4789 |
4790 | Provide a comprehensive development guide that includes:
4791 |
4792 | ### 📋 **1. Development Roadmap**
4793 | - **Phase 1-N**: Logical development phases with tasks
4794 | - **Dependencies**: Task dependencies and critical path
4795 | - **Timeline**: Estimated effort and duration
4796 | - **Milestones**: Key deliverables and checkpoints
4797 |
4798 | ### 🏗️ **2. Implementation Guide**
4799 | - **Code Structure**: Detailed project organization
4800 | - **Design Patterns**: Specific patterns to implement
4801 | - **API Design**: Endpoint structure and conventions
4802 | - **Data Architecture**: Database and data flow design
4803 |
4804 | ### 🧪 **3. Testing & Quality Strategy**
4805 | - **Test Types**: Unit, integration, e2e testing approach
4806 | - **Quality Gates**: Code quality and performance criteria
4807 | - **Automation**: CI/CD and automated testing setup
4808 |
4809 | ### 🚀 **4. Deployment & Operations**
4810 | - **Environment Setup**: Development, staging, production
4811 | - **Deployment Pipeline**: Automated deployment process
4812 | - **Monitoring**: Logging, metrics, and alerting
4813 | - **Maintenance**: Ongoing maintenance and updates
4814 |
4815 | ### 📊 **5. Progress Tracking**
4816 | - **Success Metrics**: How to measure development progress
4817 | - **Quality Indicators**: Code quality and performance metrics
4818 | - **Milestone Validation**: How to verify milestone completion
4819 | - **Risk Monitoring**: Early warning signs and mitigation
4820 |
4821 | ### 💡 **6. Team-Specific Recommendations**
4822 | Based on team size (${teamContext.size}) and experience (${teamContext.experienceLevel}):
4823 | - **Workflow Adaptations**: Process adjustments for team context
4824 | - **Skill Development**: Areas for team skill building
4825 | - **Tool Recommendations**: Development tools and practices
4826 | - **Communication**: Coordination and documentation practices
4827 |
4828 | ## Integration with Architectural Decisions
4829 |
4830 | Ensure all development guidance:
4831 | - **Aligns with ADRs**: Every recommendation supports architectural decisions
4832 | - **Maintains Consistency**: Consistent patterns across the codebase
4833 | - **Enables Evolution**: Flexible design for future changes
4834 | - **Supports Quality**: Built-in quality and maintainability
4835 |
4836 | Make the guidance **actionable, specific, and immediately implementable** so developers can start coding with confidence and architectural alignment.
4837 | `;
4838 |
4839 | // Execute the development guidance with AI if enabled
4840 | const { executePromptWithFallback, formatMCPResponse } =
4841 | await import('./utils/prompt-execution.js');
4842 | const executionResult = await executePromptWithFallback(
4843 | developmentPrompt,
4844 | 'Analyze the development context and provide comprehensive implementation guidance that translates architectural decisions into specific coding tasks and development roadmap.',
4845 | {
4846 | temperature: 0.1,
4847 | maxTokens: 8000,
4848 | systemPrompt: `You are an expert software development advisor specializing in translating architectural decisions into practical implementation guidance.
4849 | Your role is to bridge the gap between architectural planning and actual code development.
4850 | Provide specific, actionable development guidance with clear implementation steps, code patterns, and quality criteria.
4851 | Focus on practical guidance that ensures architectural decisions are properly implemented in code.
4852 | Consider team context, technology stack, and development phase to provide tailored recommendations.`,
4853 | }
4854 | );
4855 |
4856 | if (executionResult.isAIGenerated) {
4857 | // AI execution successful - return actual development guidance
4858 | return formatMCPResponse({
4859 | ...executionResult,
4860 | content: `# Development Guidance & Implementation Roadmap
4861 |
4862 | ## Your Development Context
4863 | - **Development Phase**: ${developmentPhase}
4864 | - **Technology Stack**: ${technologyStack.length > 0 ? technologyStack.join(', ') : 'Not specified'}
4865 | - **Current Progress**: ${currentProgress || 'Starting fresh'}
4866 | - **Team Context**: ${teamContext.size} team with ${teamContext.experienceLevel} experience
4867 | - **Timeline**: ${timeline || 'Not specified'}
4868 | - **Focus Areas**: ${focusAreas.length > 0 ? focusAreas.join(', ') : 'General development'}
4869 | - **ADRs to Implement**: ${adrsToImplement.length > 0 ? adrsToImplement.join(', ') : 'None specified'}
4870 |
4871 | ## AI-Generated Development Guidance
4872 |
4873 | ${executionResult.content}
4874 |
4875 | ## Integration with Workflow Tools
4876 |
4877 | This development guidance works seamlessly with other MCP tools:
4878 |
4879 | ### **Workflow Integration**
4880 | 1. **get_workflow_guidance** → Recommends architectural process
4881 | 2. **get_development_guidance** → Guides implementation (this tool)
4882 | 3. **validate_rules** → Ensures code follows architectural decisions
4883 | 4. **analyze_deployment_progress** → Tracks implementation progress
4884 |
4885 | ### **Quality Assurance Tools**
4886 | - **generate_rules** → Extract coding standards from ADRs
4887 | - **validate_rules** → Validate code against architectural rules
4888 | - **analyze_content_security** → Security validation during development
4889 |
4890 | ### **Documentation Tools**
4891 | - **discover_existing_adrs** → Reference existing architectural decisions
4892 |
4893 | ## Next Steps: From Architecture to Code
4894 |
4895 | 1. **📋 Review the Development Roadmap** above
4896 | 2. **🏗️ Set Up Project Structure** as recommended
4897 | 3. **🧪 Implement Testing Strategy** early in development
4898 | 4. **📊 Track Progress** using the success metrics provided
4899 | 5. **🔄 Iterate and Refine** based on implementation learnings
4900 |
4901 | This guidance ensures your development work is **architecturally aligned**, **quality-focused**, and **efficiently executed**!
4902 | `,
4903 | });
4904 | } else {
4905 | // Fallback to prompt-only mode
4906 | return {
4907 | content: [
4908 | {
4909 | type: 'text',
4910 | text: developmentPrompt,
4911 | },
4912 | ],
4913 | };
4914 | }
4915 | } catch (error) {
4916 | throw new McpAdrError(
4917 | `Failed to generate development guidance: ${error instanceof Error ? error.message : String(error)}`,
4918 | 'DEVELOPMENT_ERROR'
4919 | );
4920 | }
4921 | }
4922 |
4923 | private async analyzeProjectEcosystem(
4924 | args: AnalyzeProjectEcosystemArgs,
4925 | context?: ToolContext
4926 | ): Promise<CallToolResult> {
4927 | const ctx = context || createNoOpContext();
4928 |
4929 | // Use configured project path if not provided in args
4930 | const projectPath = args.projectPath || this.config.projectPath;
4931 | const {
4932 | includePatterns,
4933 | enhancedMode = getEnhancedModeDefault(), // Environment-aware default
4934 | knowledgeEnhancement = getKnowledgeEnhancementDefault(), // Environment-aware default
4935 | learningEnabled = true,
4936 | technologyFocus = [],
4937 | analysisDepth = 'comprehensive',
4938 | includeEnvironment = true,
4939 | recursiveDepth = 'comprehensive',
4940 | analysisScope = [],
4941 | // conversationContext - TODO: implement context integration for ecosystem analysis
4942 | } = args;
4943 |
4944 | this.logger.info(`Generating comprehensive ecosystem analysis for project at: ${projectPath}`);
4945 | this.logger.info(
4946 | `Analysis configuration - Depth: ${analysisDepth}, Recursive: ${recursiveDepth}, Environment: ${includeEnvironment}`
4947 | );
4948 | this.logger.info(
4949 | `Enhancement features - Knowledge: ${knowledgeEnhancement}, Learning: ${learningEnabled}`
4950 | );
4951 | this.logger.info(
4952 | `Analysis scope: ${analysisScope.length > 0 ? analysisScope.join(', ') : 'Full ecosystem analysis'}`
4953 | );
4954 |
4955 | ctx.info(`🌐 Starting comprehensive ecosystem analysis: ${projectPath}`);
4956 | ctx.report_progress(0, 100);
4957 |
4958 | try {
4959 | ctx.info('📊 Phase 1: Analyzing project structure');
4960 | ctx.report_progress(10, 100);
4961 |
4962 | // Import utilities dynamically to avoid circular dependencies
4963 | const { analyzeProjectStructureCompat: analyzeProjectStructure } =
4964 | await import('./utils/file-system.js');
4965 |
4966 | // Initialize ADR knowledge base on first run
4967 | ctx.info('📚 Phase 1.5: Initializing ADR knowledge base');
4968 | ctx.report_progress(15, 100);
4969 |
4970 | try {
4971 | const { initializeAdrKnowledgeBase, isAdrKnowledgeBaseInitialized } =
4972 | await import('./utils/adr-knowledge-initializer.js');
4973 |
4974 | const isInitialized = await isAdrKnowledgeBaseInitialized(this.kgManager);
4975 |
4976 | if (!isInitialized) {
4977 | this.logger.info('First run detected - initializing ADR knowledge base');
4978 | const initResult = await initializeAdrKnowledgeBase(
4979 | this.kgManager,
4980 | this.config.adrDirectory,
4981 | projectPath
4982 | );
4983 |
4984 | if (initResult.success) {
4985 | this.logger.info(
4986 | `✅ ADR knowledge base initialized with ${initResult.adrsIndexed} ADRs`
4987 | );
4988 | ctx.info(`📚 Indexed ${initResult.adrsIndexed} existing ADRs to knowledge base`);
4989 | } else {
4990 | this.logger.warn(
4991 | `ADR knowledge base initialization completed with errors: ${initResult.errors.join(', ')}`
4992 | );
4993 | }
4994 | } else {
4995 | this.logger.info('ADR knowledge base already initialized - skipping');
4996 | }
4997 | } catch (error) {
4998 | this.logger.warn('Failed to initialize ADR knowledge base:', error);
4999 | // Don't fail the entire analysis if ADR initialization fails
5000 | }
5001 |
5002 | // DEPRECATED: Legacy context assembly for enhanced mode
5003 | // This section is part of the OpenRouter execution path and will be removed
5004 | // in a future release. For CE-MCP mode, use createAnalyzeProjectEcosystemDirective()
5005 | // from src/tools/ce-mcp-tools.ts instead. See ADR-014.
5006 | let generateArchitecturalKnowledge: GenerateArchitecturalKnowledgeFunction | null = null;
5007 | let executeWithReflexion: ExecuteWithReflexionFunction | null = null;
5008 | let retrieveRelevantMemories: RetrieveRelevantMemoriesFunction | null = null;
5009 | let createToolReflexionConfig: CreateToolReflexionConfigFunction | null = null;
5010 |
5011 | if (enhancedMode) {
5012 | if (knowledgeEnhancement) {
5013 | const knowledgeModule = await import('./utils/knowledge-generation.js');
5014 | generateArchitecturalKnowledge = knowledgeModule.generateArchitecturalKnowledge;
5015 | }
5016 |
5017 | if (learningEnabled) {
5018 | const reflexionModule = await import('./utils/reflexion.js');
5019 | executeWithReflexion = reflexionModule.executeWithReflexion;
5020 | retrieveRelevantMemories = reflexionModule.retrieveRelevantMemories;
5021 | createToolReflexionConfig = reflexionModule.createToolReflexionConfig;
5022 | }
5023 | }
5024 |
5025 | // Step 1: Generate technology-specific knowledge if enabled
5026 | ctx.info('🧠 Phase 2: Generating architectural knowledge');
5027 | ctx.report_progress(25, 100);
5028 |
5029 | let knowledgeContext = '';
5030 | if (enhancedMode && knowledgeEnhancement && generateArchitecturalKnowledge) {
5031 | try {
5032 | const knowledgeResult = await generateArchitecturalKnowledge(
5033 | {
5034 | projectPath,
5035 | technologies: technologyFocus,
5036 | patterns: [],
5037 | projectType: 'ecosystem-analysis',
5038 | existingAdrs: [],
5039 | },
5040 | {
5041 | domains: this.getEcosystemAnalysisDomains(technologyFocus) as ArchitecturalDomain[],
5042 | depth: analysisDepth === 'basic' ? 'basic' : 'intermediate',
5043 | cacheEnabled: true,
5044 | }
5045 | );
5046 |
5047 | knowledgeContext = `
5048 | ## Technology-Specific Knowledge Enhancement
5049 |
5050 | The following architectural knowledge has been generated to enhance ecosystem analysis:
5051 |
5052 | ${knowledgeResult.prompt}
5053 |
5054 | ---
5055 | `;
5056 | } catch (error) {
5057 | this.logger.warn('Knowledge generation failed:', error);
5058 | knowledgeContext = '<!-- Knowledge generation unavailable -->\n';
5059 | }
5060 | }
5061 |
5062 | // Step 2: Retrieve relevant memories if learning is enabled
5063 | let reflexionContext = '';
5064 | if (enhancedMode && learningEnabled && retrieveRelevantMemories) {
5065 | try {
5066 | const memoryResult = await retrieveRelevantMemories(
5067 | 'ecosystem-analysis',
5068 | { projectPath, analysisDepth, technologyFocus },
5069 | { maxResults: 5, relevanceThreshold: 0.6 }
5070 | );
5071 |
5072 | reflexionContext = `
5073 | ## Learning from Past Analyses
5074 |
5075 | The following insights from past ecosystem analysis tasks will inform this analysis:
5076 |
5077 | ${memoryResult.prompt}
5078 |
5079 | ---
5080 | `;
5081 | } catch (error) {
5082 | this.logger.warn('Reflexion memory retrieval failed:', error);
5083 | reflexionContext = '<!-- Learning context unavailable -->\n';
5084 | }
5085 | }
5086 |
5087 | // Step 3: Generate base project analysis prompt with recursive depth
5088 | ctx.info('📁 Phase 3: Scanning project files and structure');
5089 | ctx.report_progress(40, 100);
5090 |
5091 | const baseProjectAnalysisPrompt = await analyzeProjectStructure(projectPath);
5092 |
5093 | // Step 4: Generate environment analysis if enabled
5094 | ctx.info('🔧 Phase 4: Analyzing environment and infrastructure');
5095 | ctx.report_progress(55, 100);
5096 | let environmentAnalysisContext = '';
5097 | if (includeEnvironment) {
5098 | try {
5099 | this.logger.info('Including comprehensive environment analysis in ecosystem analysis');
5100 | const { analyzeEnvironment } = await import('./tools/environment-analysis-tool.js');
5101 |
5102 | // Call environment analysis with comprehensive scope
5103 | const environmentResult = await analyzeEnvironment({
5104 | projectPath,
5105 | adrDirectory: this.config.adrDirectory,
5106 | analysisType: 'comprehensive',
5107 | });
5108 |
5109 | // Extract environment analysis content
5110 | if (environmentResult.content && environmentResult.content[0]) {
5111 | environmentAnalysisContext = `
5112 | ## Integrated Environment Analysis
5113 |
5114 | ${environmentResult.content[0].text}
5115 |
5116 | ---
5117 | `;
5118 | }
5119 | } catch (error) {
5120 | this.logger.warn('Environment analysis integration failed:', error);
5121 | environmentAnalysisContext = `
5122 | ## Environment Analysis
5123 | <!-- Environment analysis unavailable: ${error instanceof Error ? error.message : 'Unknown error'} -->
5124 |
5125 | ---
5126 | `;
5127 | }
5128 | }
5129 |
5130 | // Step 5: Apply Reflexion execution if learning is enabled
5131 | ctx.info('🧪 Phase 5: Applying learning and reflexion');
5132 | ctx.report_progress(70, 100);
5133 |
5134 | let enhancedAnalysisPrompt = baseProjectAnalysisPrompt.prompt + environmentAnalysisContext;
5135 | if (enhancedMode && learningEnabled && executeWithReflexion && createToolReflexionConfig) {
5136 | try {
5137 | const reflexionConfig = createToolReflexionConfig('analyze_project_ecosystem', {
5138 | reflectionDepth: analysisDepth === 'basic' ? 'basic' : 'detailed',
5139 | evaluationCriteria: ['task-success', 'accuracy', 'completeness'],
5140 | learningRate: 0.7,
5141 | });
5142 |
5143 | const reflexionResult = await executeWithReflexion(
5144 | {
5145 | prompt:
5146 | baseProjectAnalysisPrompt.prompt + knowledgeContext + environmentAnalysisContext,
5147 | instructions: baseProjectAnalysisPrompt.instructions,
5148 | context: {
5149 | projectPath,
5150 | analysisDepth,
5151 | recursiveDepth,
5152 | technologyFocus,
5153 | includePatterns,
5154 | includeEnvironment,
5155 | analysisScope,
5156 | knowledgeEnhanced: knowledgeEnhancement,
5157 | learningEnabled: true,
5158 | },
5159 | },
5160 | reflexionConfig
5161 | );
5162 |
5163 | enhancedAnalysisPrompt = reflexionResult.prompt;
5164 | } catch (error) {
5165 | this.logger.warn('Reflexion execution failed:', error);
5166 | enhancedAnalysisPrompt =
5167 | baseProjectAnalysisPrompt.prompt + knowledgeContext + environmentAnalysisContext;
5168 | }
5169 | } else {
5170 | enhancedAnalysisPrompt =
5171 | baseProjectAnalysisPrompt.prompt + knowledgeContext + environmentAnalysisContext;
5172 | }
5173 |
5174 | // Execute the analysis with AI if enabled, otherwise return prompt
5175 | ctx.info('🤖 Phase 6: Executing AI-powered ecosystem analysis');
5176 | ctx.report_progress(85, 100);
5177 |
5178 | const { executeEcosystemAnalysisPrompt, formatMCPResponse } =
5179 | await import('./utils/prompt-execution.js');
5180 | const executionResult = await executeEcosystemAnalysisPrompt(
5181 | enhancedAnalysisPrompt,
5182 | baseProjectAnalysisPrompt.instructions,
5183 | {
5184 | temperature: 0.1,
5185 | maxTokens: 6000,
5186 | }
5187 | );
5188 |
5189 | // Step 6: Record project structure to knowledge graph
5190 | try {
5191 | this.logger.info('Recording project structure to knowledge graph');
5192 |
5193 | const projectStructureSnapshot = {
5194 | projectPath,
5195 | analysisDepth,
5196 | recursiveDepth,
5197 | technologyFocus,
5198 | analysisScope,
5199 | includeEnvironment,
5200 | timestamp: new Date().toISOString(),
5201 | structureData: baseProjectAnalysisPrompt.context || {},
5202 | };
5203 |
5204 | await this.kgManager.recordProjectStructure(projectStructureSnapshot);
5205 | this.logger.info('✅ Project structure recorded to knowledge graph');
5206 | } catch (kgError) {
5207 | this.logger.warn('Failed to record project structure to knowledge graph:', kgError);
5208 | // Don't fail the entire analysis if KG recording fails
5209 | }
5210 |
5211 | ctx.info('✅ Ecosystem analysis completed successfully');
5212 | ctx.report_progress(100, 100);
5213 |
5214 | // Return appropriate response based on execution result
5215 | if (executionResult.isAIGenerated) {
5216 | // AI execution successful - return actual analysis results
5217 | return formatMCPResponse({
5218 | ...executionResult,
5219 | content: `# Comprehensive Project Ecosystem Analysis Results
5220 |
5221 | ## Analysis Configuration
5222 | - **Project Path**: ${projectPath}
5223 | - **Analysis Depth**: ${analysisDepth}
5224 | - **Recursive Depth**: ${recursiveDepth}
5225 | - **Environment Analysis**: ${includeEnvironment ? '✅ Included' : '❌ Excluded'}
5226 | - **Analysis Scope**: ${analysisScope.length > 0 ? analysisScope.join(', ') : 'Full ecosystem analysis'}
5227 |
5228 | ## Enhancement Features
5229 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled' : '❌ Disabled'}
5230 | - **Reflexion Learning**: ${enhancedMode && learningEnabled ? '✅ Enabled' : '❌ Disabled'}
5231 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled' : '❌ Disabled'}
5232 | - **Technology Focus**: ${technologyFocus.length > 0 ? technologyFocus.join(', ') : 'Auto-detect'}
5233 | - **Knowledge Graph**: ✅ Project structure recorded
5234 |
5235 | ${knowledgeContext}
5236 |
5237 | ${reflexionContext}
5238 |
5239 | ## Comprehensive Ecosystem Analysis Results
5240 |
5241 | ${executionResult.content}
5242 |
5243 | ${
5244 | includeEnvironment
5245 | ? `
5246 |
5247 | ## Environment Integration Summary
5248 |
5249 | The analysis above includes comprehensive environment analysis covering:
5250 | - **Infrastructure Specifications**: Deployment and runtime environment details
5251 | - **Containerization**: Docker, Kubernetes, and container orchestration analysis
5252 | - **Environment Requirements**: Configuration and dependency requirements
5253 | - **Compliance Assessment**: Security and regulatory compliance evaluation
5254 |
5255 | This integrated approach provides complete understanding of both codebase patterns AND operational environment.
5256 | `
5257 | : ''
5258 | }
5259 |
5260 | ## Next Steps: Complete Ecosystem Understanding
5261 |
5262 | Based on the comprehensive analysis above:
5263 |
5264 | ### **Immediate Actions**
5265 | 1. **Review Ecosystem Overview**: Examine the complete technology stack and environment context
5266 | 2. **Assess Integration Points**: Understand how code patterns relate to operational environment
5267 | 3. **Identify Critical Dependencies**: Focus on key dependencies between code and infrastructure
5268 |
5269 | ### **Strategic Planning**
5270 | 4. **Address Architectural Issues**: Prioritize improvements based on both code and environment analysis
5271 | 5. **Plan Environment Optimization**: Optimize deployment and operational configurations
5272 | 6. **Update Documentation**: Document both architectural decisions and environment specifications
5273 |
5274 | ### **Implementation Roadmap**
5275 | 7. **Implement Code Improvements**: Execute code-level architectural enhancements
5276 | 8. **Optimize Environment**: Improve infrastructure and deployment configurations
5277 | 9. **Monitor Integration**: Ensure code and environment changes work together effectively
5278 |
5279 | This comprehensive ecosystem analysis provides the foundation for informed architectural and operational decisions.
5280 | `,
5281 | });
5282 | } else {
5283 | // Fallback to prompt-only mode
5284 | return {
5285 | content: [
5286 | {
5287 | type: 'text',
5288 | text: `# Comprehensive Project Ecosystem Analysis
5289 |
5290 | This comprehensive analysis provides deep recursive project understanding with integrated environment analysis.
5291 |
5292 | ## Analysis Configuration
5293 | - **Project Path**: ${projectPath}
5294 | - **Analysis Depth**: ${analysisDepth}
5295 | - **Recursive Depth**: ${recursiveDepth}
5296 | - **Environment Analysis**: ${includeEnvironment ? '✅ Included' : '❌ Excluded'}
5297 | - **Analysis Scope**: ${analysisScope.length > 0 ? analysisScope.join(', ') : 'Full ecosystem analysis'}
5298 |
5299 | ## Enhancement Features
5300 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled' : '❌ Disabled'}
5301 | - **Reflexion Learning**: ${enhancedMode && learningEnabled ? '✅ Enabled' : '❌ Disabled'}
5302 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled' : '❌ Disabled'}
5303 | - **Technology Focus**: ${technologyFocus.length > 0 ? technologyFocus.join(', ') : 'Auto-detect'}
5304 | - **Include Patterns**: ${includePatterns?.length ? includePatterns.join(', ') : 'Default patterns'}
5305 | - **Knowledge Graph**: ✅ Project structure recorded
5306 |
5307 | ${knowledgeContext}
5308 |
5309 | ${reflexionContext}
5310 |
5311 | ## Enhanced Analysis Prompt
5312 |
5313 | ${enhancedAnalysisPrompt}
5314 |
5315 | ## Enhanced Implementation Instructions
5316 |
5317 | ${baseProjectAnalysisPrompt.instructions}
5318 |
5319 | ### Enhancement-Specific Instructions
5320 |
5321 | ${
5322 | enhancedMode && knowledgeEnhancement
5323 | ? `
5324 | #### Knowledge Enhancement
5325 | - Apply technology-specific knowledge to ecosystem analysis
5326 | - Use domain expertise to identify patterns and anti-patterns
5327 | - Leverage architectural best practices for technology stack evaluation
5328 | `
5329 | : ''
5330 | }
5331 |
5332 | ${
5333 | enhancedMode && learningEnabled
5334 | ? `
5335 | #### Learning Integration
5336 | - Apply lessons learned from past ecosystem analyses
5337 | - Use memory insights to improve pattern recognition accuracy
5338 | - Incorporate feedback from previous analysis outcomes
5339 | `
5340 | : ''
5341 | }
5342 |
5343 | ## Expected Enhanced Output
5344 |
5345 | The enhanced analysis should provide:
5346 | 1. **Technology Stack Analysis** with domain knowledge context
5347 | 2. **Architectural Pattern Detection** informed by past experiences
5348 | 3. **Ecosystem Health Assessment** using learned evaluation criteria
5349 | 4. **Improvement Recommendations** based on domain best practices
5350 | 5. **Learning Insights** for future analysis improvement
5351 |
5352 | ## Quality Assurance
5353 |
5354 | - Ensure analysis leverages all available enhancement features
5355 | - Verify technology-specific knowledge is properly applied
5356 | - Confirm learning insights improve analysis accuracy
5357 | - Validate recommendations align with domain best practices`,
5358 | },
5359 | ],
5360 | };
5361 | }
5362 | } catch (error) {
5363 | throw new McpAdrError(
5364 | `Failed to analyze project ecosystem: ${error instanceof Error ? error.message : String(error)}`,
5365 | 'ANALYSIS_ERROR'
5366 | );
5367 | }
5368 | }
5369 |
5370 | private async getArchitecturalContext(
5371 | args: GetArchitecturalContextArgs
5372 | ): Promise<CallToolResult> {
5373 | const { filePath, includeCompliance = true } = args;
5374 |
5375 | try {
5376 | const {
5377 | analyzeProjectStructureCompat: analyzeProjectStructure,
5378 | fileExistsCompat: fileExists,
5379 | ensureDirectoryCompat: ensureDirectory,
5380 | } = await import('./utils/file-system.js');
5381 | const path = await import('path');
5382 |
5383 | // Determine project path
5384 | const projectPath = filePath
5385 | ? filePath.split('/').slice(0, -1).join('/')
5386 | : this.config.projectPath;
5387 | const adrDirectory = path.join(projectPath, this.config.adrDirectory);
5388 |
5389 | // Generate prompts for ADR directory setup
5390 | const adrDirectoryCheckPrompt = await fileExists(adrDirectory);
5391 | const adrDirectorySetupPrompt = await ensureDirectory(adrDirectory);
5392 |
5393 | // Generate architectural analysis prompt
5394 | const projectAnalysisPrompt = await analyzeProjectStructure(projectPath);
5395 |
5396 | const architecturalPrompt = `
5397 | # Architectural Context Analysis & Project Setup
5398 |
5399 | ## Project Overview
5400 | **Project Path**: ${projectPath}
5401 | **Analysis Scope**: ${filePath ? `Specific file: ${filePath}` : 'Entire project'}
5402 | **ADR Directory**: ${this.config.adrDirectory}
5403 | **Include Compliance**: ${includeCompliance ? 'Yes' : 'No'}
5404 |
5405 | ## 🚀 ADR Infrastructure Setup
5406 |
5407 | This analysis will include setting up ADR infrastructure if needed:
5408 |
5409 | ### ADR Directory Check
5410 | ${adrDirectoryCheckPrompt.prompt}
5411 |
5412 | ### ADR Directory Setup (if needed)
5413 | ${adrDirectorySetupPrompt.prompt}
5414 |
5415 | ## Comprehensive Project Analysis
5416 |
5417 | ${projectAnalysisPrompt.prompt}
5418 |
5419 | ## Enhanced Architectural Focus
5420 |
5421 | Please provide a **comprehensive, outcome-focused analysis** including:
5422 |
5423 | ### 1. Technology Stack & Infrastructure Analysis
5424 | - **Core Technologies**: Programming languages, frameworks, runtime environments
5425 | - **Dependencies**: Package managers, third-party libraries, version constraints
5426 | - **Build & Deployment**: CI/CD pipelines, build tools, deployment strategies
5427 | - **Data Layer**: Databases, caching, data storage and retrieval patterns
5428 |
5429 | ### 2. Architectural Pattern & Design Analysis
5430 | - **System Architecture**: Monolith, microservices, serverless, hybrid patterns
5431 | - **Code Organization**: Module structure, separation of concerns, layering
5432 | - **API Design**: REST, GraphQL, RPC patterns and conventions
5433 | - **Data Flow**: Request/response cycles, event handling, state management
5434 | ${filePath ? `- **File-specific Context**: How ${filePath} fits into the overall architecture` : ''}
5435 |
5436 | ### 3. Quality, Security & Performance Assessment
5437 | - **Code Quality**: Structure, naming, documentation, testing strategies
5438 | - **Security Implementation**: Authentication, authorization, data protection
5439 | - **Performance Patterns**: Caching, optimization, scalability considerations
5440 | - **Monitoring & Observability**: Logging, metrics, error tracking
5441 |
5442 | ### 4. Architectural Decision Discovery & Documentation
5443 | - **Explicit Decisions**: Find existing documentation and decision records
5444 | - **Implicit Decisions**: Identify significant undocumented architectural choices
5445 | - **Technology Rationale**: Understand selection criteria and trade-offs
5446 | - **Evolution Path**: How the architecture has changed over time
5447 |
5448 | ${
5449 | includeCompliance
5450 | ? `### 5. Compliance & Standards Assessment
5451 | - **Industry Standards**: Adherence to relevant industry standards and best practices
5452 | - **Security Compliance**: Security standards compliance (OWASP, SOC2, etc.)
5453 | - **Code Standards**: Coding standards and style guide compliance
5454 | - **Architectural Compliance**: Adherence to established architectural principles
5455 | - **Regulatory Requirements**: Any regulatory compliance requirements (GDPR, HIPAA, etc.)`
5456 | : ''
5457 | }
5458 |
5459 | ## Expected Output: Outcome-Focused Architectural Context
5460 |
5461 | Provide a **comprehensive architectural context** with **clear project outcomes**:
5462 |
5463 | ### 📋 **1. Executive Summary & Project Outcomes**
5464 | - **Current State**: What the project is and what it does
5465 | - **Architectural Maturity**: Assessment of current architectural practices
5466 | - **Key Strengths**: What's working well architecturally
5467 | - **Critical Gaps**: What needs immediate attention
5468 | - **Success Metrics**: How to measure architectural improvements
5469 |
5470 | ### 🔧 **2. Technology & Infrastructure Inventory**
5471 | - **Technology Stack**: Complete inventory with versions and purposes
5472 | - **Infrastructure Components**: Deployment, monitoring, data storage
5473 | - **Dependencies**: Critical dependencies and potential risks
5474 | - **Tool Chain**: Development, testing, and deployment tools
5475 |
5476 | ### 🏗️ **3. Architectural Patterns & Design Decisions**
5477 | - **System Design**: Overall architectural approach and patterns
5478 | - **Component Architecture**: How major components interact
5479 | - **Data Architecture**: How data flows and is managed
5480 | - **Integration Patterns**: How external systems are integrated
5481 |
5482 | ### 📊 **4. Quality & Compliance Assessment**
5483 | - **Code Quality Score**: Assessment of current code quality
5484 | - **Security Posture**: Security implementation and gaps
5485 | - **Performance Profile**: Current performance characteristics
5486 | - **Maintainability Index**: How easy the system is to maintain and evolve
5487 |
5488 | ### 🎯 **5. Outcome-Focused Action Plan**
5489 | Based on the analysis, provide a **clear workflow** with **projected outcomes**:
5490 |
5491 | #### **Immediate Actions (Next 1-2 weeks)**
5492 | - **Priority 1**: Most critical architectural issues to address
5493 | - **Quick Wins**: Low-effort, high-impact improvements
5494 | - **Documentation**: Essential decisions that need immediate documentation
5495 |
5496 | #### **Short-term Goals (Next 1-3 months)**
5497 | - **Architectural Improvements**: Planned enhancements with expected outcomes
5498 | - **Technical Debt**: Priority technical debt to address
5499 | - **Process Improvements**: Development workflow enhancements
5500 |
5501 | #### **Long-term Vision (3-12 months)**
5502 | - **Strategic Architecture**: Long-term architectural evolution
5503 | - **Scalability Roadmap**: How to scale the system effectively
5504 | - **Innovation Opportunities**: Areas for architectural innovation
5505 |
5506 | ### 📈 **6. Success Metrics & Outcomes**
5507 | Define **measurable outcomes** for architectural improvements:
5508 |
5509 | - **Performance Metrics**: Response times, throughput, resource utilization
5510 | - **Quality Metrics**: Code coverage, bug rates, maintainability scores
5511 | - **Developer Experience**: Build times, deployment frequency, developer satisfaction
5512 | - **Business Impact**: Feature delivery speed, system reliability, cost efficiency
5513 |
5514 | ### 🏗️ **7. ADR Infrastructure & Documentation Plan**
5515 |
5516 | If ADR directory doesn't exist, also provide:
5517 |
5518 | 1. **Create Directory Structure**:
5519 | \`\`\`
5520 | ${this.config.adrDirectory}/
5521 | ├── 0001-record-architecture-decisions.md (template)
5522 | ├── README.md (ADR process guide)
5523 | └── template.md (ADR template)
5524 | \`\`\`
5525 |
5526 | 2. **Generate Initial ADRs** for discovered architectural decisions
5527 | 3. **Create ADR Process Guide** for the team
5528 | 4. **Establish ADR Workflow** for future decisions
5529 |
5530 | ### 🔄 **8. Continuous Improvement Workflow**
5531 | Establish ongoing architectural governance:
5532 |
5533 | - **Regular Reviews**: Monthly architectural health checks
5534 | - **Decision Documentation**: Process for documenting new architectural decisions
5535 | - **Compliance Monitoring**: Ongoing adherence to architectural standards
5536 | - **Evolution Planning**: Quarterly architectural roadmap updates
5537 |
5538 | ## Next Steps: Grounded Project Workflow
5539 |
5540 | After this analysis, follow this **outcome-focused workflow**:
5541 |
5542 | 1. **📋 Review Analysis**: Examine the architectural context and recommendations
5543 | 2. **🎯 Set Priorities**: Choose 3-5 most impactful improvements based on outcomes
5544 | 3. **📝 Document Decisions**: Create ADRs for significant architectural choices
5545 | 4. **🔧 Implement Changes**: Execute improvements in priority order
5546 | 5. **📊 Measure Progress**: Track success metrics and outcomes
5547 | 6. **🔄 Iterate**: Regular reviews and continuous improvement
5548 |
5549 | This approach ensures that architectural work is **grounded in measurable outcomes** and **aligned with project success**.
5550 | `;
5551 |
5552 | // Execute the analysis with AI if enabled, otherwise return prompt
5553 | const { executeEcosystemAnalysisPrompt, formatMCPResponse } =
5554 | await import('./utils/prompt-execution.js');
5555 | const executionResult = await executeEcosystemAnalysisPrompt(
5556 | architecturalPrompt,
5557 | projectAnalysisPrompt.instructions,
5558 | {
5559 | temperature: 0.1,
5560 | maxTokens: 5000,
5561 | systemPrompt: `You are a senior software architect specializing in architectural context analysis.
5562 | Analyze the provided project to understand its architectural patterns, design decisions, and structural organization.
5563 | Focus on providing actionable insights about the architecture that can guide development decisions.`,
5564 | }
5565 | );
5566 |
5567 | if (executionResult.isAIGenerated) {
5568 | // AI execution successful - return actual analysis results
5569 | return formatMCPResponse({
5570 | ...executionResult,
5571 | content: `# Architectural Context Analysis Results
5572 |
5573 | ${filePath ? `## Target File: ${filePath}` : '## Project-wide Analysis'}
5574 |
5575 | ## Project Information
5576 | - **Project Path**: ${projectPath}
5577 | - **Analysis Scope**: ${filePath ? 'File-specific' : 'Project-wide'}
5578 | - **ADR Directory**: ${this.config.adrDirectory}
5579 |
5580 | ## ADR Infrastructure Setup
5581 |
5582 | The analysis includes automatic ADR infrastructure setup:
5583 |
5584 | ${adrDirectoryCheckPrompt.instructions}
5585 |
5586 | ${adrDirectorySetupPrompt.instructions}
5587 |
5588 | ## AI Analysis Results
5589 |
5590 | ${executionResult.content}
5591 |
5592 | ## Outcome-Focused Next Steps
5593 |
5594 | Based on the architectural analysis, follow this **grounded workflow**:
5595 |
5596 | ### **Immediate Actions (This Week)**
5597 | 1. **Review Analysis**: Examine the architectural context and recommendations above
5598 | 2. **Set Up ADRs**: Ensure ADR directory structure is created and ready
5599 | 3. **Identify Quick Wins**: Focus on low-effort, high-impact improvements
5600 |
5601 | ### **Short-term Goals (Next Month)**
5602 | 4. **Document Key Decisions**: Create ADRs for the most significant architectural choices
5603 | 5. **Address Critical Issues**: Tackle the highest-priority architectural concerns
5604 | 6. **Establish Metrics**: Set up measurement for the success metrics identified
5605 |
5606 | ### **Long-term Vision (Next Quarter)**
5607 | 7. **Implement Roadmap**: Execute the architectural improvement plan
5608 | 8. **Monitor Progress**: Track success metrics and adjust approach as needed
5609 | 9. **Continuous Improvement**: Establish regular architectural reviews
5610 |
5611 | This **outcome-focused approach** ensures architectural work delivers **measurable value** and keeps the project **grounded in clear objectives**.
5612 | `,
5613 | });
5614 | } else {
5615 | // Fallback to prompt-only mode
5616 | return {
5617 | content: [
5618 | {
5619 | type: 'text',
5620 | text: architecturalPrompt,
5621 | },
5622 | ],
5623 | };
5624 | }
5625 | } catch (error) {
5626 | throw new McpAdrError(
5627 | `Failed to get architectural context: ${error instanceof Error ? error.message : String(error)}`,
5628 | 'ANALYSIS_ERROR'
5629 | );
5630 | }
5631 | }
5632 |
5633 | private async generateAdrsFromPrd(
5634 | args: Record<string, unknown>,
5635 | context?: ToolContext
5636 | ): Promise<CallToolResult> {
5637 | const ctx = context || createNoOpContext();
5638 |
5639 | const {
5640 | prdPath,
5641 | enhancedMode = getEnhancedModeDefault(), // Environment-aware default
5642 | promptOptimization = true,
5643 | knowledgeEnhancement = getKnowledgeEnhancementDefault(), // Environment-aware default
5644 | prdType = 'general',
5645 | } = args;
5646 | const outputDirectory = args['outputDirectory'] || this.config.adrDirectory;
5647 |
5648 | this.logger.info(`Generating enhanced ADRs from PRD: ${prdPath} to ${outputDirectory}`);
5649 | this.logger.info(
5650 | `Enhancement features - APE: ${promptOptimization}, Knowledge: ${knowledgeEnhancement}, Type: ${prdType}`
5651 | );
5652 |
5653 | ctx.info(`📝 Starting ADR generation from PRD: ${prdPath}`);
5654 | ctx.report_progress(0, 100);
5655 |
5656 | try {
5657 | ctx.info('📂 Phase 1: Validating PRD file');
5658 | ctx.report_progress(10, 100);
5659 | const { readFileContentCompat: readFileContent, fileExistsCompat: fileExists } =
5660 | await import('./utils/file-system.js');
5661 |
5662 | // Import advanced prompting utilities if enhanced mode is enabled
5663 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
5664 | let generateArchitecturalKnowledge: any = null;
5665 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
5666 | let optimizePromptWithAPE: any = null;
5667 | // eslint-disable-next-line @typescript-eslint/no-explicit-any
5668 | let createToolAPEConfig: any = null;
5669 |
5670 | if (enhancedMode) {
5671 | if (knowledgeEnhancement) {
5672 | const knowledgeModule = await import('./utils/knowledge-generation.js');
5673 | generateArchitecturalKnowledge = knowledgeModule.generateArchitecturalKnowledge;
5674 | }
5675 |
5676 | if (promptOptimization) {
5677 | const apeModule = await import('./utils/automatic-prompt-engineering.js');
5678 | optimizePromptWithAPE = apeModule.optimizePromptWithAPE;
5679 | createToolAPEConfig = apeModule.createToolAPEConfig;
5680 | }
5681 | }
5682 |
5683 | // Generate file existence check prompt
5684 | const fileExistsPrompt = await fileExists(prdPath as string);
5685 |
5686 | // Generate file content reading prompt
5687 | const fileContentPrompt = await readFileContent(prdPath as string);
5688 |
5689 | ctx.info('📚 Phase 2: Reading PRD content');
5690 | ctx.report_progress(25, 100);
5691 |
5692 | // Step 1: Generate domain-specific knowledge if enabled
5693 | ctx.info('🧠 Phase 3: Generating domain knowledge');
5694 | ctx.report_progress(40, 100);
5695 |
5696 | let knowledgeContext = '';
5697 | if (enhancedMode && knowledgeEnhancement && generateArchitecturalKnowledge) {
5698 | try {
5699 | const knowledgeResult = await generateArchitecturalKnowledge(
5700 | {
5701 | projectPath: outputDirectory,
5702 | technologies: [],
5703 | patterns: [],
5704 | projectType: prdType,
5705 | existingAdrs: [],
5706 | },
5707 | {
5708 | domains: this.getPrdTypeDomains(prdType as string),
5709 | depth: 'intermediate',
5710 | cacheEnabled: true,
5711 | }
5712 | );
5713 |
5714 | knowledgeContext = `
5715 | ## Domain-Specific Knowledge Enhancement
5716 |
5717 | The following architectural knowledge has been generated to enhance PRD analysis and ADR creation:
5718 |
5719 | ${knowledgeResult.prompt}
5720 |
5721 | ---
5722 | `;
5723 | } catch (error) {
5724 | this.logger.warn('Knowledge generation failed:', error);
5725 | knowledgeContext = '<!-- Knowledge generation unavailable -->\n';
5726 | }
5727 | }
5728 |
5729 | // Step 2: Create base ADR generation prompt
5730 | ctx.info('📋 Phase 4: Creating base ADR prompts');
5731 | ctx.report_progress(60, 100);
5732 |
5733 | const baseAdrPrompt = this.createBaseAdrPrompt(
5734 | prdPath as string,
5735 | outputDirectory as string,
5736 | knowledgeContext
5737 | );
5738 |
5739 | // Step 3: Apply APE optimization if enabled
5740 | ctx.info('⚡ Phase 5: Optimizing prompts with APE');
5741 | ctx.report_progress(75, 100);
5742 |
5743 | let finalAdrPrompt = baseAdrPrompt;
5744 | if (enhancedMode && promptOptimization && optimizePromptWithAPE && createToolAPEConfig) {
5745 | try {
5746 | const apeConfig = createToolAPEConfig('generate_adrs_from_prd', {
5747 | candidateCount: 5,
5748 | evaluationCriteria: ['task-completion', 'clarity', 'specificity'],
5749 | optimizationRounds: 2,
5750 | qualityThreshold: 0.75,
5751 | });
5752 |
5753 | const apeResult = await optimizePromptWithAPE(
5754 | {
5755 | prompt: baseAdrPrompt,
5756 | instructions: 'Generate comprehensive ADRs from PRD analysis',
5757 | context: {
5758 | prdPath,
5759 | outputDirectory,
5760 | prdType,
5761 | knowledgeEnhanced: knowledgeEnhancement,
5762 | },
5763 | },
5764 | apeConfig
5765 | );
5766 |
5767 | finalAdrPrompt = apeResult.prompt;
5768 | } catch (error) {
5769 | this.logger.warn('APE optimization failed:', error);
5770 | finalAdrPrompt = baseAdrPrompt;
5771 | }
5772 | }
5773 |
5774 | // Generate comprehensive ADR creation prompt that includes file operations
5775 | const adrPrompt = `
5776 | # Enhanced ADR Generation from PRD Request
5777 |
5778 | This is a comprehensive prompt-driven ADR generation process enhanced with advanced prompting techniques.
5779 |
5780 | ## Enhancement Status
5781 | - **APE Optimization**: ${enhancedMode && promptOptimization ? '✅ Enabled' : '❌ Disabled'}
5782 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled' : '❌ Disabled'}
5783 | - **PRD Type**: ${prdType}
5784 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled' : '❌ Disabled'}
5785 |
5786 | ## Step 1: File Validation
5787 | ${fileExistsPrompt.prompt}
5788 |
5789 | **Instructions**: First, execute the file existence check above. If the file does not exist, stop the process and report the error. Only proceed to Step 2 if the file exists.
5790 |
5791 | ## Step 2: PRD Content Reading
5792 | ${fileContentPrompt.prompt}
5793 |
5794 | **Instructions**: Execute the file reading operation above to obtain the PRD content. Use the content from this step for the enhanced ADR generation in Step 3.
5795 |
5796 | ## Step 3: Enhanced ADR Generation
5797 |
5798 | ${
5799 | enhancedMode && promptOptimization
5800 | ? `
5801 | ### APE-Optimized Analysis
5802 | This prompt has been optimized using Automatic Prompt Engineering for superior ADR generation quality.
5803 | The optimization focused on task completion, clarity, and specificity for PRD analysis.
5804 |
5805 | `
5806 | : ''
5807 | }
5808 |
5809 | ${finalAdrPrompt}
5810 |
5811 | ### File Creation Instructions
5812 |
5813 | For each generated ADR, create a file creation prompt using the following pattern:
5814 | - **File Path**: ${outputDirectory}/[number]-[decision-title].md
5815 | - **Content**: The complete enhanced ADR markdown content
5816 | - **Action Confirmation**: Require user confirmation before creating files
5817 | - **Security Validation**: Ensure output directory is safe and authorized
5818 |
5819 | ### Enhanced Quality Assurance
5820 |
5821 | - Ensure each ADR leverages domain knowledge when available
5822 | - Verify decisions align with PRD type best practices
5823 | - Check that enhancement features are properly utilized
5824 | - Validate that ADR content exceeds baseline quality expectations
5825 | - Confirm all decisions are traceable back to PRD requirements with domain context
5826 | `;
5827 |
5828 | // Execute the ADR generation with AI if enabled, otherwise return prompt
5829 | ctx.info('🤖 Phase 6: Executing AI-powered ADR generation');
5830 | ctx.report_progress(90, 100);
5831 |
5832 | const { executeADRGenerationPrompt, formatMCPResponse } =
5833 | await import('./utils/prompt-execution.js');
5834 | const executionResult = await executeADRGenerationPrompt(
5835 | adrPrompt,
5836 | 'Generate comprehensive ADRs from PRD analysis with enhanced domain knowledge and optimization',
5837 | {
5838 | temperature: 0.1,
5839 | maxTokens: 8000,
5840 | systemPrompt: `You are an expert software architect who creates comprehensive Architectural Decision Records (ADRs) from Product Requirements Documents (PRDs).
5841 | Generate well-structured ADRs that follow best practices and include all necessary sections.
5842 | Focus on extracting architectural decisions from the PRD and creating actionable ADRs with clear reasoning.`,
5843 | }
5844 | );
5845 |
5846 | ctx.info('✅ ADR generation completed successfully');
5847 | ctx.report_progress(100, 100);
5848 |
5849 | if (executionResult.isAIGenerated) {
5850 | // AI execution successful - return actual ADR generation results
5851 | return formatMCPResponse({
5852 | ...executionResult,
5853 | content: `# ADR Generation from PRD Results
5854 |
5855 | ## Enhancement Features
5856 | - **APE Optimization**: ${enhancedMode && promptOptimization ? '✅ Enabled' : '❌ Disabled'}
5857 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled' : '❌ Disabled'}
5858 | - **PRD Type Optimization**: ${prdType}
5859 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled' : '❌ Disabled'}
5860 |
5861 | ## Source Information
5862 | - **PRD Path**: ${prdPath}
5863 | - **Output Directory**: ${outputDirectory}
5864 |
5865 | ## Generated ADRs
5866 |
5867 | ${executionResult.content}
5868 |
5869 | ## Next Steps
5870 |
5871 | 1. **Review Generated ADRs**: Examine each ADR for completeness and accuracy
5872 | 2. **Save ADR Files**: Create individual .md files for each ADR in ${outputDirectory}
5873 | 3. **Update ADR Index**: Add new ADRs to your project's ADR catalog
5874 | 4. **Stakeholder Review**: Share ADRs with team for feedback and approval
5875 | 5. **Implementation Planning**: Create tasks for implementing the architectural decisions
5876 |
5877 | ## File Creation Commands
5878 |
5879 | To save the generated ADRs, create individual files in ${outputDirectory}:
5880 |
5881 | \`\`\`bash
5882 | # Create ADR directory if it doesn't exist
5883 | mkdir -p ${outputDirectory}
5884 |
5885 | # Save each ADR as a separate file (example)
5886 | # Replace [NUMBER] and [TITLE] with actual values from generated ADRs
5887 | # cat > "${outputDirectory}/001-example-decision.md" << 'EOF'
5888 | # [ADR content here]
5889 | # EOF
5890 | \`\`\`
5891 | `,
5892 | });
5893 | } else {
5894 | // Fallback to prompt-only mode
5895 | return {
5896 | content: [
5897 | {
5898 | type: 'text',
5899 | text: `# Enhanced ADR Generation from PRD: ${prdPath}
5900 |
5901 | ## Advanced Prompt-Driven ADR Generation Process
5902 |
5903 | This tool uses a 100% prompt-driven architecture enhanced with advanced prompting techniques:
5904 |
5905 | ### Enhancement Features
5906 | - **APE Optimization**: ${enhancedMode && promptOptimization ? '✅ Enabled - Prompts optimized for superior quality' : '❌ Disabled'}
5907 | - **Knowledge Generation**: ${enhancedMode && knowledgeEnhancement ? '✅ Enabled - Domain knowledge enhanced analysis' : '❌ Disabled'}
5908 | - **PRD Type Optimization**: ${prdType} - Tailored for specific domain requirements
5909 | - **Enhanced Mode**: ${enhancedMode ? '✅ Enabled - All advanced features active' : '❌ Disabled - Basic mode'}
5910 |
5911 | ### Enhanced AI Agent Workflow
5912 |
5913 | 1. **Validate PRD file existence** using secure file system operations
5914 | 2. **Read PRD content** safely with proper security validation
5915 | 3. **Apply domain knowledge** to enhance understanding (if enabled)
5916 | 4. **Generate optimized ADRs** using APE-enhanced prompts (if enabled)
5917 | 5. **Create enhanced ADR files** in the specified output directory: ${outputDirectory}
5918 |
5919 | ## Execution Instructions
5920 |
5921 | Please execute the following enhanced comprehensive prompt:
5922 |
5923 | ${adrPrompt}
5924 |
5925 | ## Advanced Features
5926 |
5927 | ${
5928 | enhancedMode && knowledgeEnhancement
5929 | ? `
5930 | ### Knowledge Enhancement
5931 | - Domain-specific architectural knowledge has been generated
5932 | - PRD analysis is enhanced with ${prdType} domain expertise
5933 | - ADR decisions leverage domain best practices and patterns
5934 | `
5935 | : ''
5936 | }
5937 |
5938 | ${
5939 | enhancedMode && promptOptimization
5940 | ? `
5941 | ### APE Optimization
5942 | - Prompts have been automatically optimized for quality
5943 | - Enhanced evaluation criteria ensure superior ADR generation
5944 | - Optimization focused on task completion, clarity, and specificity
5945 | `
5946 | : ''
5947 | }
5948 |
5949 | ## Security and Validation
5950 |
5951 | - All file operations include security validation
5952 | - Path traversal protection is enabled
5953 | - System directory access is prevented
5954 | - User confirmation is required for file creation
5955 | - Content validation ensures safe enhanced ADR generation
5956 |
5957 | ## Expected Enhanced Workflow
5958 |
5959 | 1. Execute file existence check for: ${prdPath}
5960 | 2. If file exists, read PRD content securely
5961 | 3. Apply domain knowledge to enhance PRD understanding
5962 | 4. Analyze PRD content using optimized prompts
5963 | 5. Generate domain-enhanced individual ADRs for each decision
5964 | 6. Create file creation prompts for each enhanced ADR
5965 | 7. Confirm with user before writing files to: ${outputDirectory}
5966 |
5967 | The enhanced process maintains full traceability from PRD requirements to generated ADRs while providing superior quality through advanced prompting techniques and ensuring security and user control over file operations.`,
5968 | },
5969 | ],
5970 | };
5971 | }
5972 | } catch (error) {
5973 | throw new McpAdrError(
5974 | `Failed to generate ADR prompts from PRD: ${error instanceof Error ? error.message : String(error)}`,
5975 | 'PROMPT_GENERATION_ERROR'
5976 | );
5977 | }
5978 | }
5979 |
5980 | private async compareAdrProgress(args: Record<string, unknown>): Promise<CallToolResult> {
5981 | const {
5982 | todoPath = 'TODO.md',
5983 | adrDirectory = this.config.adrDirectory,
5984 | projectPath = this.config.projectPath,
5985 | environment = 'auto-detect',
5986 | environmentConfig = {},
5987 | validationType = 'full',
5988 | includeFileChecks = true,
5989 | includeRuleValidation = true,
5990 | deepCodeAnalysis = true,
5991 | functionalValidation = true,
5992 | strictMode = true,
5993 | environmentValidation = true,
5994 | } = args;
5995 |
5996 | const { getAdrDirectoryPath } = await import('./utils/config.js');
5997 | const path = await import('path');
5998 |
5999 | // Resolve paths
6000 | const absoluteTodoPath = path.resolve(projectPath as string, todoPath as string);
6001 | const absoluteAdrPath = adrDirectory
6002 | ? path.resolve(projectPath as string, adrDirectory as string)
6003 | : getAdrDirectoryPath(this.config);
6004 |
6005 | this.logger.info(
6006 | `Comparing ADR progress: TODO(${absoluteTodoPath}) vs ADRs(${absoluteAdrPath}) vs Environment(${projectPath}) [env: ${environment}]`
6007 | );
6008 |
6009 | // Environment validation and auto-detection
6010 | let detectedEnvironment = environment;
6011 | let finalEnvironmentConfig = { ...(environmentConfig as Record<string, unknown>) };
6012 |
6013 | if (
6014 | environmentValidation &&
6015 | (validationType === 'full' || validationType === 'environment-only')
6016 | ) {
6017 | try {
6018 | const envResult = await this.detectAndValidateEnvironment(
6019 | projectPath as string,
6020 | environment as string,
6021 | environmentConfig as Record<string, unknown>
6022 | );
6023 | detectedEnvironment = envResult.detectedEnvironment;
6024 | finalEnvironmentConfig = { ...finalEnvironmentConfig, ...envResult.environmentConfig };
6025 | this.logger.info(`Environment detection result: ${detectedEnvironment}`);
6026 | } catch (error) {
6027 | this.logger.warn(
6028 | `Environment detection failed: ${error instanceof Error ? error.message : String(error)}`
6029 | );
6030 | }
6031 | }
6032 |
6033 | try {
6034 | // Step 1: Read TODO.md file directly
6035 | let todoContent = '';
6036 | if (validationType === 'full' || validationType === 'todo-only') {
6037 | try {
6038 | const fs = await import('fs/promises');
6039 | todoContent = await fs.readFile(absoluteTodoPath, 'utf-8');
6040 | } catch (error) {
6041 | this.logger.warn(
6042 | `Could not read TODO.md file: ${error instanceof Error ? error.message : String(error)}`
6043 | );
6044 | }
6045 | }
6046 |
6047 | // Step 2: Use actual project structure scanning
6048 | let projectStructure = null;
6049 | if (validationType === 'full' || validationType === 'environment-only') {
6050 | try {
6051 | const { scanProjectStructure } = await import('./utils/actual-file-operations.js');
6052 | const includeContent = (deepCodeAnalysis as boolean) || (functionalValidation as boolean);
6053 | projectStructure = await scanProjectStructure(projectPath as string, {
6054 | readContent: includeContent,
6055 | maxFileSize: includeContent ? 10000 : 0,
6056 | });
6057 | } catch (error) {
6058 | this.logger.warn(
6059 | `Could not scan project structure: ${error instanceof Error ? error.message : String(error)}`
6060 | );
6061 | }
6062 | }
6063 |
6064 | // Perform actual analysis locally instead of relying on AI execution
6065 | let discoveryResult: unknown = null;
6066 | if (validationType === 'full' || validationType === 'adr-only') {
6067 | const { discoverAdrsInDirectory } = await import('./utils/adr-discovery.js');
6068 | discoveryResult = await discoverAdrsInDirectory(
6069 | absoluteAdrPath as string,
6070 | projectPath as string,
6071 | {
6072 | includeContent: true,
6073 | includeTimeline: false,
6074 | }
6075 | );
6076 | }
6077 | const analysis = await this.performLocalAdrProgressAnalysis({
6078 | todoContent,
6079 | todoPath: absoluteTodoPath,
6080 | discoveredAdrs: (discoveryResult as { adrs?: unknown[] })?.adrs || [],
6081 | adrDirectory: absoluteAdrPath,
6082 | projectStructure: projectStructure || null,
6083 | projectPath: projectPath as string,
6084 | validationType: validationType as string,
6085 | includeFileChecks: includeFileChecks as boolean,
6086 | includeRuleValidation: includeRuleValidation as boolean,
6087 | deepCodeAnalysis: deepCodeAnalysis as boolean,
6088 | functionalValidation: functionalValidation as boolean,
6089 | strictMode: strictMode as boolean,
6090 | environment: detectedEnvironment as string,
6091 | environmentConfig: finalEnvironmentConfig,
6092 | environmentValidation: environmentValidation as boolean,
6093 | });
6094 |
6095 | return {
6096 | content: [
6097 | {
6098 | type: 'text',
6099 | text: analysis,
6100 | },
6101 | ],
6102 | };
6103 | } catch (error) {
6104 | throw new McpAdrError(
6105 | `Failed to compare ADR progress: ${error instanceof Error ? error.message : String(error)}`,
6106 | 'VALIDATION_ERROR'
6107 | );
6108 | }
6109 | }
6110 |
6111 | /**
6112 | * Detect and validate environment context
6113 | */
6114 | private async detectAndValidateEnvironment(
6115 | projectPath: string,
6116 | environment: string,
6117 | environmentConfig: Record<string, unknown>
6118 | ): Promise<{ detectedEnvironment: string; environmentConfig: Record<string, unknown> }> {
6119 | const path = await import('path');
6120 | const fs = await import('fs/promises');
6121 |
6122 | let detectedEnvironment = environment;
6123 | let finalConfig = { ...environmentConfig };
6124 |
6125 | if (environment === 'auto-detect') {
6126 | // Auto-detect environment based on project structure
6127 | try {
6128 | // Check for environment indicator files
6129 | const envFiles = [
6130 | '.env.development',
6131 | '.env.staging',
6132 | '.env.production',
6133 | '.env.test',
6134 | 'package.json',
6135 | 'docker-compose.yml',
6136 | 'Dockerfile',
6137 | ];
6138 |
6139 | const existingFiles: string[] = [];
6140 | for (const file of envFiles) {
6141 | try {
6142 | await fs.access(path.join(projectPath, file));
6143 | existingFiles.push(file);
6144 | } catch {
6145 | // File doesn't exist, continue
6146 | }
6147 | }
6148 |
6149 | // Environment detection logic
6150 | if (existingFiles.includes('.env.production') || existingFiles.includes('Dockerfile')) {
6151 | detectedEnvironment = 'production';
6152 | } else if (existingFiles.includes('.env.staging')) {
6153 | detectedEnvironment = 'staging';
6154 | } else if (existingFiles.includes('.env.test')) {
6155 | detectedEnvironment = 'testing';
6156 | } else {
6157 | detectedEnvironment = 'development';
6158 | }
6159 |
6160 | // Set environment-specific default configurations
6161 | switch (detectedEnvironment) {
6162 | case 'production':
6163 | finalConfig = {
6164 | securityLevel: 'critical',
6165 | requiredFiles: ['package.json', 'README.md'],
6166 | requiredServices: ['monitoring', 'logging'],
6167 | performanceRequirements: { minUptime: 99.9 },
6168 | ...finalConfig,
6169 | };
6170 | break;
6171 | case 'staging':
6172 | finalConfig = {
6173 | securityLevel: 'high',
6174 | requiredFiles: ['package.json'],
6175 | requiredServices: ['testing', 'monitoring'],
6176 | performanceRequirements: { minUptime: 95 },
6177 | ...finalConfig,
6178 | };
6179 | break;
6180 | case 'testing':
6181 | finalConfig = {
6182 | securityLevel: 'medium',
6183 | requiredFiles: ['package.json'],
6184 | requiredServices: ['testing'],
6185 | performanceRequirements: {},
6186 | ...finalConfig,
6187 | };
6188 | break;
6189 | default: // development
6190 | finalConfig = {
6191 | securityLevel: 'medium',
6192 | requiredFiles: ['package.json'],
6193 | requiredServices: [],
6194 | performanceRequirements: {},
6195 | ...finalConfig,
6196 | };
6197 | }
6198 | } catch (error) {
6199 | this.logger.warn(
6200 | `Environment auto-detection failed: ${error instanceof Error ? error.message : String(error)}`
6201 | );
6202 | detectedEnvironment = 'development'; // fallback
6203 | }
6204 | }
6205 |
6206 | return { detectedEnvironment, environmentConfig: finalConfig };
6207 | }
6208 |
6209 | /**
6210 | * Perform local ADR progress analysis without relying on AI execution
6211 | */
6212 | private async performLocalAdrProgressAnalysis(params: {
6213 | todoContent: string;
6214 | todoPath: string;
6215 | discoveredAdrs: unknown[];
6216 | adrDirectory: string;
6217 | projectStructure: unknown;
6218 | projectPath: string;
6219 | validationType: string;
6220 | includeFileChecks: boolean;
6221 | includeRuleValidation: boolean;
6222 | deepCodeAnalysis: boolean;
6223 | functionalValidation: boolean;
6224 | strictMode: boolean;
6225 | environment: string;
6226 | environmentConfig: unknown;
6227 | environmentValidation: boolean;
6228 | }): Promise<string> {
6229 | const {
6230 | todoContent,
6231 | todoPath,
6232 | discoveredAdrs,
6233 | adrDirectory,
6234 | projectStructure,
6235 | projectPath,
6236 | validationType,
6237 | includeFileChecks,
6238 | includeRuleValidation,
6239 | deepCodeAnalysis,
6240 | functionalValidation,
6241 | strictMode,
6242 | environment,
6243 | environmentConfig,
6244 | environmentValidation,
6245 | } = params;
6246 |
6247 | const currentDate = new Date().toISOString().split('T')[0];
6248 |
6249 | // Parse TODO content to extract tasks
6250 | const todoTasks = this.parseTodoTasks(todoContent);
6251 |
6252 | // Basic analysis
6253 | const totalAdrs = discoveredAdrs.length;
6254 | const totalTasks = todoTasks.length;
6255 | const completedTasks = todoTasks.filter(task => task.completed).length;
6256 |
6257 | // Calculate alignment score (simplified, now environment-aware)
6258 | const adrTaskMapping = this.mapTasksToAdrs(
6259 | todoTasks,
6260 | discoveredAdrs,
6261 | environment,
6262 | environmentConfig
6263 | );
6264 | const alignedTasks = adrTaskMapping.aligned.length;
6265 | let alignmentScore = totalTasks > 0 ? Math.round((alignedTasks / totalTasks) * 100) : 0;
6266 |
6267 | // Environment-aware scoring adjustments
6268 | if (environmentValidation && environmentConfig) {
6269 | const envScore = this.calculateEnvironmentScore(
6270 | projectStructure,
6271 | environment,
6272 | environmentConfig
6273 | );
6274 | alignmentScore = Math.round((alignmentScore + envScore) / 2); // Blend scores
6275 | }
6276 |
6277 | // File existence checks
6278 | let fileCheckResults = '';
6279 | if (includeFileChecks && projectStructure) {
6280 | fileCheckResults = this.performFileExistenceChecks(todoTasks, projectStructure);
6281 | }
6282 |
6283 | // Environment compliance checks
6284 | let environmentAnalysisResults = '';
6285 | if (environmentValidation && environmentConfig) {
6286 | environmentAnalysisResults = this.performEnvironmentComplianceAnalysis(
6287 | projectStructure,
6288 | environment,
6289 | environmentConfig,
6290 | strictMode
6291 | );
6292 | }
6293 |
6294 | // Mock vs Production analysis
6295 | let mockAnalysisResults = '';
6296 | if (deepCodeAnalysis && projectStructure) {
6297 | mockAnalysisResults = this.performMockVsProductionAnalysis(projectStructure, strictMode);
6298 | }
6299 |
6300 | return `# ADR Progress Validation Report
6301 |
6302 | **Validation Date**: ${currentDate}
6303 | **Validation Type**: ${validationType}
6304 | **Project Path**: ${projectPath}
6305 | **TODO Path**: ${todoPath}
6306 | **ADR Directory**: ${adrDirectory}
6307 | **Environment**: ${environment}${environmentValidation ? ` (validation enabled)` : ''}
6308 |
6309 | ## Summary
6310 | - **Total ADRs**: ${totalAdrs}
6311 | - **Total TODO Tasks**: ${totalTasks}
6312 | - **Completed Tasks**: ${completedTasks}
6313 | - **Alignment Score**: ${alignmentScore}%
6314 | - **Compliance Score**: ${Math.max(alignmentScore - 10, 0)}%
6315 | - **Environment**: ${environment}
6316 |
6317 | ## Configuration
6318 | - **File Checks**: ${includeFileChecks ? 'Enabled' : 'Disabled'}
6319 | - **Rule Validation**: ${includeRuleValidation ? 'Enabled' : 'Disabled'}
6320 | - **Deep Code Analysis**: ${deepCodeAnalysis ? 'Enabled' : 'Disabled'}
6321 | - **Functional Validation**: ${functionalValidation ? 'Enabled' : 'Disabled'}
6322 | - **Strict Mode**: ${strictMode ? 'Enabled - High scrutiny for mock vs production' : 'Disabled'}
6323 | - **Environment Validation**: ${environmentValidation ? 'Enabled' : 'Disabled'}
6324 |
6325 | ## Environment Context
6326 | - **Target Environment**: ${environment}
6327 | - **Security Level**: ${(environmentConfig as Record<string, unknown>)?.['securityLevel'] || 'Not specified'}
6328 | - **Required Files**: ${((environmentConfig as Record<string, unknown>)?.['requiredFiles'] as unknown[] | undefined)?.length || 0} files
6329 | - **Required Services**: ${((environmentConfig as Record<string, unknown>)?.['requiredServices'] as unknown[] | undefined)?.length || 0} services
6330 |
6331 | ## ADR Discovery Results
6332 | ${
6333 | totalAdrs > 0
6334 | ? `Found ${totalAdrs} ADRs:\n${discoveredAdrs
6335 | .map((adr, i) => {
6336 | const adrRecord = adr as Record<string, unknown>;
6337 | return `${i + 1}. **${adrRecord['title']}** (${adrRecord['status']}) - ${adrRecord['filename']}`;
6338 | })
6339 | .join('\n')}`
6340 | : 'No ADRs found in the specified directory.'
6341 | }
6342 |
6343 | ## TODO Task Analysis
6344 | ${
6345 | totalTasks > 0
6346 | ? `Found ${totalTasks} tasks:\n${todoTasks
6347 | .map((task, i) => `${i + 1}. ${task.completed ? '✅' : '⏳'} ${task.title}`)
6348 | .join('\n')}`
6349 | : 'No tasks found in TODO.md file.'
6350 | }
6351 |
6352 | ## Alignment Analysis
6353 |
6354 | ### ✅ Properly Aligned Tasks
6355 | ${
6356 | adrTaskMapping.aligned.length > 0
6357 | ? adrTaskMapping.aligned
6358 | .map(task => `- ${task.title}: Corresponds to ADR requirements`)
6359 | .join('\n')
6360 | : '- No aligned tasks identified'
6361 | }
6362 |
6363 | ### ⚠️ Misaligned Tasks
6364 | ${
6365 | adrTaskMapping.misaligned.length > 0
6366 | ? adrTaskMapping.misaligned
6367 | .map(task => `- ${task.title}: May not fully align with ADR specifications`)
6368 | .join('\n')
6369 | : '- No misaligned tasks identified'
6370 | }
6371 |
6372 | ### ❌ Missing Tasks
6373 | ${
6374 | adrTaskMapping.missing.length > 0
6375 | ? adrTaskMapping.missing.map(gap => `- ${gap}: Required by ADRs but not in TODO`).join('\n')
6376 | : '- No obvious missing tasks identified'
6377 | }
6378 |
6379 | ## Implementation Status
6380 |
6381 | ${fileCheckResults || '### File Existence Validation\n- File checks disabled or no project structure available'}
6382 |
6383 | ${environmentAnalysisResults || ''}
6384 |
6385 | ${mockAnalysisResults || ''}
6386 |
6387 | ## Recommendations
6388 |
6389 | ### High Priority Actions
6390 | ${
6391 | alignmentScore < 70
6392 | ? '1. **Improve ADR-TODO Alignment**: Review TODO tasks against ADR requirements\n2. **Add Missing Tasks**: Identify and add tasks required by ADRs'
6393 | : '1. **Maintain Current Alignment**: Continue following ADR specifications'
6394 | }
6395 | ${
6396 | completedTasks < totalTasks * 0.5
6397 | ? '\n3. **Accelerate Implementation**: Focus on completing pending tasks'
6398 | : ''
6399 | }
6400 | ${
6401 | environmentValidation && environment === 'production' && alignmentScore < 90
6402 | ? '\n4. **⚠️ Production Environment Warning**: Current alignment may not meet production requirements'
6403 | : ''
6404 | }
6405 |
6406 | ### Medium Priority Actions
6407 | 1. **Review Implementation Quality**: ${strictMode ? 'Strict mode analysis above shows' : 'Consider enabling strict mode for'} detailed quality assessment
6408 | 2. **Update Documentation**: Ensure TODO.md reflects current project state
6409 | ${
6410 | environmentValidation
6411 | ? `3. **Environment Compliance**: Ensure ${environment} environment requirements are met`
6412 | : ''
6413 | }
6414 |
6415 | ### Low Priority Actions
6416 | 1. **Optimize Workflow**: Consider tools for automated ADR-TODO synchronization
6417 | 2. **Regular Validation**: Schedule periodic ADR progress reviews
6418 |
6419 | ## Next Steps
6420 | 1. Address high-priority alignment issues identified above
6421 | 2. ${totalTasks === 0 ? 'Create initial TODO.md from ADR requirements' : 'Update TODO.md with missing tasks'}
6422 | 3. ${includeFileChecks ? 'Verify implementation of completed tasks' : 'Enable file checks for detailed implementation verification'}
6423 | 4. ${includeRuleValidation ? 'Resolve architectural rule compliance violations' : 'Enable rule validation for compliance checking'}
6424 | \`\`\`
6425 |
6426 | To re-run this validation with strict mode:
6427 | \`\`\`json
6428 | {
6429 | "tool": "compare_adr_progress",
6430 | "args": {
6431 | "todoPath": "${todoPath}",
6432 | "adrDirectory": "${adrDirectory}",
6433 | "validationType": "full",
6434 | "deepCodeAnalysis": true,
6435 | "functionalValidation": true,
6436 | "strictMode": true
6437 | }
6438 | }
6439 | \`\`\`
6440 | `;
6441 | }
6442 |
6443 | /**
6444 | * Parse TODO.md content to extract tasks
6445 | */
6446 | private parseTodoTasks(
6447 | todoContent: string
6448 | ): Array<{ title: string; completed: boolean; description?: string }> {
6449 | if (!todoContent) return [];
6450 |
6451 | const lines = todoContent.split('\n');
6452 | const tasks: Array<{ title: string; completed: boolean; description?: string }> = [];
6453 |
6454 | for (const line of lines) {
6455 | // Look for markdown checkbox patterns
6456 | const taskMatch = line.match(/^\s*[-*]\s*\[([x\s])\]\s*(.+)$/i);
6457 | if (taskMatch && taskMatch[1] && taskMatch[2]) {
6458 | const checkbox = taskMatch[1];
6459 | const title = taskMatch[2];
6460 | tasks.push({
6461 | title: title.trim(),
6462 | completed: checkbox.toLowerCase() === 'x',
6463 | });
6464 | }
6465 | // Also look for simple list items that might be tasks
6466 | else if (line.match(/^\s*[-*]\s+\w+/)) {
6467 | const title = line.replace(/^\s*[-*]\s+/, '').trim();
6468 | if (title.length > 3) {
6469 | // Avoid very short items
6470 | tasks.push({
6471 | title,
6472 | completed: false,
6473 | });
6474 | }
6475 | }
6476 | }
6477 |
6478 | return tasks;
6479 | }
6480 |
6481 | /**
6482 | * Map TODO tasks to ADRs to identify alignment (now environment-aware)
6483 | */
6484 | private mapTasksToAdrs(
6485 | tasks: Array<{ title: string; completed: boolean }>,
6486 | adrs: unknown[],
6487 | environment?: string,
6488 | environmentConfig?: unknown
6489 | ): {
6490 | aligned: typeof tasks;
6491 | misaligned: typeof tasks;
6492 | missing: string[];
6493 | } {
6494 | const aligned: typeof tasks = [];
6495 | const misaligned: typeof tasks = [];
6496 | const missing: string[] = [];
6497 |
6498 | // Simple keyword matching for alignment detection
6499 | const adrKeywords = adrs.flatMap(adr => {
6500 | const adrRecord = adr as Record<string, unknown>;
6501 | return [
6502 | String(adrRecord['title'] || '').toLowerCase(),
6503 | ...String(adrRecord['decision'] || '')
6504 | .toLowerCase()
6505 | .split(/\s+/)
6506 | .filter((w: string) => w.length > 4),
6507 | ...String(adrRecord['context'] || '')
6508 | .toLowerCase()
6509 | .split(/\s+/)
6510 | .filter((w: string) => w.length > 4),
6511 | ];
6512 | });
6513 |
6514 | // Environment-specific keywords that should be prioritized
6515 | const envKeywords: string[] = [];
6516 | if (environment && environmentConfig) {
6517 | if (environment === 'production') {
6518 | envKeywords.push('deploy', 'production', 'monitoring', 'security', 'performance');
6519 | } else if (environment === 'staging') {
6520 | envKeywords.push('test', 'staging', 'integration', 'validation');
6521 | } else if (environment === 'development') {
6522 | envKeywords.push('setup', 'development', 'local', 'debug');
6523 | }
6524 | }
6525 |
6526 | for (const task of tasks) {
6527 | const taskLower = task.title.toLowerCase();
6528 | const firstWord = taskLower.split(' ')[0] || '';
6529 | const hasKeywordMatch = adrKeywords.some(
6530 | keyword => taskLower.includes(keyword) || keyword.includes(firstWord)
6531 | );
6532 |
6533 | // Environment-aware alignment scoring
6534 | const hasEnvKeywordMatch = envKeywords.some(keyword => taskLower.includes(keyword));
6535 |
6536 | if (hasKeywordMatch || hasEnvKeywordMatch) {
6537 | aligned.push(task);
6538 | } else {
6539 | misaligned.push(task);
6540 | }
6541 | }
6542 |
6543 | // Identify potential missing tasks based on ADR content
6544 | for (const adr of adrs) {
6545 | const adrRecord = adr as Record<string, unknown>;
6546 | if (adrRecord['status'] === 'accepted' && adrRecord['decision']) {
6547 | const decisionWords = String(adrRecord['decision']).toLowerCase().split(/\s+/);
6548 | const implementationWords = [
6549 | 'implement',
6550 | 'create',
6551 | 'build',
6552 | 'develop',
6553 | 'add',
6554 | 'setup',
6555 | 'configure',
6556 | ];
6557 |
6558 | if (implementationWords.some(word => decisionWords.includes(word))) {
6559 | const adrTitle = String(adrRecord['title'] || '');
6560 | const adrFirstWord = adrTitle.toLowerCase().split(' ')[0] || '';
6561 | const hasCorrespondingTask = tasks.some(task =>
6562 | task.title.toLowerCase().includes(adrFirstWord)
6563 | );
6564 |
6565 | if (!hasCorrespondingTask) {
6566 | missing.push(`Implement ${adrTitle}`);
6567 | }
6568 | }
6569 | }
6570 | }
6571 |
6572 | // Environment-specific missing tasks
6573 | if (environment && environmentConfig) {
6574 | const envConfig = environmentConfig as Record<string, unknown>;
6575 | if (envConfig['requiredFiles']) {
6576 | for (const file of envConfig['requiredFiles'] as string[]) {
6577 | const hasFileTask = tasks.some(task =>
6578 | task.title.toLowerCase().includes(file.toLowerCase())
6579 | );
6580 | if (!hasFileTask) {
6581 | missing.push(`Create ${file} for ${environment} environment`);
6582 | }
6583 | }
6584 | }
6585 |
6586 | if (envConfig['requiredServices']) {
6587 | for (const service of envConfig['requiredServices'] as string[]) {
6588 | const hasServiceTask = tasks.some(task =>
6589 | task.title.toLowerCase().includes(service.toLowerCase())
6590 | );
6591 | if (!hasServiceTask) {
6592 | missing.push(`Setup ${service} service for ${environment}`);
6593 | }
6594 | }
6595 | }
6596 | }
6597 |
6598 | return { aligned, misaligned, missing };
6599 | }
6600 |
6601 | /**
6602 | * Check file existence for completed tasks
6603 | */
6604 | private performFileExistenceChecks(
6605 | tasks: Array<{ title: string; completed: boolean }>,
6606 | projectStructure: any
6607 | ): string {
6608 | if (!projectStructure) return '- Project structure not available';
6609 |
6610 | const allFiles = [
6611 | ...(projectStructure.packageFiles || []),
6612 | ...(projectStructure.configFiles || []),
6613 | ...(projectStructure.buildFiles || []),
6614 | ...(projectStructure.dockerFiles || []),
6615 | ...(projectStructure.ciFiles || []),
6616 | ...(projectStructure.scriptFiles || []),
6617 | ];
6618 |
6619 | let results = '### File Existence Validation\n';
6620 | let checkCount = 0;
6621 |
6622 | for (const task of tasks) {
6623 | if (task.completed) {
6624 | // Simple heuristic: look for files mentioned in task title
6625 | const taskLower = task.title.toLowerCase();
6626 | const mentionedFiles = allFiles.filter(
6627 | file =>
6628 | taskLower.includes(file.filename.toLowerCase()) ||
6629 | taskLower.includes(file.filename.replace(/\.[^.]+$/, '').toLowerCase())
6630 | );
6631 |
6632 | if (mentionedFiles.length > 0) {
6633 | results += `- ✅ **${task.title}**: Found related files (${mentionedFiles.map(f => f.filename).join(', ')})\n`;
6634 | checkCount++;
6635 | } else if (
6636 | taskLower.includes('file') ||
6637 | taskLower.includes('create') ||
6638 | taskLower.includes('implement')
6639 | ) {
6640 | results += `- ⚠️ **${task.title}**: No clearly related files found\n`;
6641 | checkCount++;
6642 | }
6643 | }
6644 | }
6645 |
6646 | if (checkCount === 0) {
6647 | results += '- No file-related completed tasks to validate\n';
6648 | }
6649 |
6650 | return results;
6651 | }
6652 |
6653 | /**
6654 | * Analyze code for mock vs production implementation
6655 | */
6656 | private performMockVsProductionAnalysis(projectStructure: any, strictMode: boolean): string {
6657 | if (!projectStructure) return '';
6658 |
6659 | const codeFiles = [
6660 | ...(projectStructure.buildFiles || []),
6661 | ...(projectStructure.configFiles || []),
6662 | ].filter(file => file.content && file.content !== '[Binary or unreadable file]');
6663 |
6664 | if (codeFiles.length === 0) return '';
6665 |
6666 | let results = '\n### Mock vs Production Code Analysis\n';
6667 | let mockIndicators = 0;
6668 | let productionIndicators = 0;
6669 |
6670 | const mockPatterns = [
6671 | /TODO:/gi,
6672 | /FIXME:/gi,
6673 | /NotImplementedException/gi,
6674 | /throw.*not.*implement/gi,
6675 | /return.*mock/gi,
6676 | /placeholder/gi,
6677 | /stub/gi,
6678 | /return\s+null;/gi,
6679 | /return\s+""/gi,
6680 | /return\s+\[\]/gi,
6681 | /return\s+{}/gi,
6682 | ];
6683 |
6684 | const productionPatterns = [
6685 | /error\s+handling/gi,
6686 | /try\s*{/gi,
6687 | /catch\s*\(/gi,
6688 | /validate/gi,
6689 | /authentication/gi,
6690 | /authorization/gi,
6691 | /database/gi,
6692 | /api/gi,
6693 | /config/gi,
6694 | ];
6695 |
6696 | for (const file of codeFiles.slice(0, 10)) {
6697 | // Limit analysis to prevent overwhelming output
6698 | const content = file.content;
6699 | const fileMockCount = mockPatterns.reduce(
6700 | (count, pattern) => count + (content.match(pattern) || []).length,
6701 | 0
6702 | );
6703 | const fileProdCount = productionPatterns.reduce(
6704 | (count, pattern) => count + (content.match(pattern) || []).length,
6705 | 0
6706 | );
6707 |
6708 | mockIndicators += fileMockCount;
6709 | productionIndicators += fileProdCount;
6710 |
6711 | if (fileMockCount > 0 || fileProdCount > 2) {
6712 | const status =
6713 | fileMockCount > fileProdCount
6714 | ? '❌ **Mock/Stub**'
6715 | : fileProdCount > fileMockCount * 2
6716 | ? '✅ **Production Ready**'
6717 | : '⚠️ **Partial Implementation**';
6718 |
6719 | results += `- ${status}: ${file.filename} `;
6720 | if (fileMockCount > 0) {
6721 | results += `(${fileMockCount} mock indicators) `;
6722 | }
6723 | if (fileProdCount > 0) {
6724 | results += `(${fileProdCount} production indicators)`;
6725 | }
6726 | results += '\n';
6727 | }
6728 | }
6729 |
6730 | results += `\n#### Overall Code Quality Assessment\n`;
6731 | results += `- **Mock Indicators Found**: ${mockIndicators} instances\n`;
6732 | results += `- **Production Indicators Found**: ${productionIndicators} instances\n`;
6733 |
6734 | if (strictMode) {
6735 | const qualityScore =
6736 | productionIndicators > mockIndicators * 2
6737 | ? 'Good'
6738 | : productionIndicators > mockIndicators
6739 | ? 'Fair'
6740 | : 'Needs Improvement';
6741 | results += `- **Quality Assessment**: ${qualityScore}\n`;
6742 |
6743 | if (mockIndicators > 0) {
6744 | results += `- **⚠️ Strict Mode Warning**: Found ${mockIndicators} potential mock/stub indicators\n`;
6745 | }
6746 | }
6747 |
6748 | return results;
6749 | }
6750 |
6751 | /**
6752 | * Calculate environment-specific compliance score
6753 | */
6754 | private calculateEnvironmentScore(
6755 | projectStructure: any,
6756 | environment: string,
6757 | environmentConfig: any
6758 | ): number {
6759 | if (!projectStructure || !environmentConfig) return 0;
6760 |
6761 | let score = 100; // Start with perfect score
6762 |
6763 | // Check required files
6764 | if (environmentConfig.requiredFiles) {
6765 | const allFiles = [
6766 | ...(projectStructure.packageFiles || []),
6767 | ...(projectStructure.configFiles || []),
6768 | ...(projectStructure.buildFiles || []),
6769 | ...(projectStructure.dockerFiles || []),
6770 | ...(projectStructure.ciFiles || []),
6771 | ...(projectStructure.scriptFiles || []),
6772 | ];
6773 |
6774 | const existingFiles = allFiles.map(f => f.filename);
6775 | const missingFiles = environmentConfig.requiredFiles.filter(
6776 | (file: string) => !existingFiles.includes(file)
6777 | );
6778 |
6779 | // Deduct 10 points per missing required file
6780 | score -= missingFiles.length * 10;
6781 | }
6782 |
6783 | // Environment-specific penalties
6784 | if (environment === 'production') {
6785 | // Production requires higher standards
6786 | if (!projectStructure.dockerFiles?.length) score -= 15;
6787 | if (!projectStructure.ciFiles?.length) score -= 10;
6788 | }
6789 |
6790 | return Math.max(score, 0);
6791 | }
6792 |
6793 | /**
6794 | * Perform environment compliance analysis
6795 | */
6796 | private performEnvironmentComplianceAnalysis(
6797 | projectStructure: any,
6798 | environment: string,
6799 | environmentConfig: any,
6800 | strictMode: boolean
6801 | ): string {
6802 | if (!projectStructure || !environmentConfig) {
6803 | return '\n### Environment Compliance Analysis\n- Environment analysis disabled or no project structure available\n';
6804 | }
6805 |
6806 | let results = '\n### Environment Compliance Analysis\n';
6807 |
6808 | // Required files analysis
6809 | if (environmentConfig.requiredFiles) {
6810 | results += `#### Required Files for ${environment} Environment\n`;
6811 | const allFiles = [
6812 | ...(projectStructure.packageFiles || []),
6813 | ...(projectStructure.configFiles || []),
6814 | ...(projectStructure.buildFiles || []),
6815 | ...(projectStructure.dockerFiles || []),
6816 | ...(projectStructure.ciFiles || []),
6817 | ...(projectStructure.scriptFiles || []),
6818 | ];
6819 |
6820 | const existingFiles = allFiles.map(f => f.filename);
6821 |
6822 | for (const requiredFile of environmentConfig.requiredFiles) {
6823 | const exists = existingFiles.includes(requiredFile);
6824 | results += `- ${exists ? '✅' : '❌'} **${requiredFile}**: ${exists ? 'Found' : 'Missing'}\n`;
6825 | }
6826 | }
6827 |
6828 | // Security level compliance
6829 | if (environmentConfig.securityLevel) {
6830 | results += `\n#### Security Level: ${environmentConfig.securityLevel}\n`;
6831 |
6832 | const securityIndicators = this.analyzeSecurityCompliance(
6833 | projectStructure,
6834 | environmentConfig.securityLevel
6835 | );
6836 | results += securityIndicators;
6837 | }
6838 |
6839 | // Environment-specific recommendations
6840 | results += `\n#### ${environment} Environment Recommendations\n`;
6841 | switch (environment) {
6842 | case 'production':
6843 | results +=
6844 | '- ⚠️ **Production Critical**: Ensure monitoring, logging, and backup strategies are implemented\n';
6845 | results += '- 🔒 **Security**: Implement comprehensive security measures\n';
6846 | results += '- 📊 **Performance**: Monitor and optimize for production workloads\n';
6847 | if (strictMode) {
6848 | results +=
6849 | '- 🔍 **Strict Mode**: Enhanced validation enabled for production environment\n';
6850 | }
6851 | break;
6852 | case 'staging':
6853 | results += '- 🧪 **Testing**: Ensure comprehensive test coverage and validation\n';
6854 | results += '- 📋 **Validation**: Implement environment parity checks\n';
6855 | break;
6856 | case 'development':
6857 | results += '- 🛠️ **Development**: Focus on developer experience and debugging tools\n';
6858 | results += '- 🔄 **Iteration**: Ensure fast feedback loops\n';
6859 | break;
6860 | }
6861 |
6862 | return results;
6863 | }
6864 |
6865 | /**
6866 | * Analyze security compliance based on security level
6867 | */
6868 | private analyzeSecurityCompliance(projectStructure: any, securityLevel: string): string {
6869 | let results = '';
6870 |
6871 | const securityFiles = [
6872 | ...(projectStructure.configFiles || []),
6873 | ...(projectStructure.dockerFiles || []),
6874 | ].filter(
6875 | file =>
6876 | file.filename.includes('security') ||
6877 | file.filename.includes('auth') ||
6878 | file.filename.includes('.env') ||
6879 | file.filename === 'Dockerfile'
6880 | );
6881 |
6882 | const hasSecurityConfig = securityFiles.length > 0;
6883 |
6884 | switch (securityLevel) {
6885 | case 'critical':
6886 | results += `- ${hasSecurityConfig ? '✅' : '❌'} **Critical Security**: ${hasSecurityConfig ? 'Security configuration found' : 'No security configuration detected'}\n`;
6887 | if (!hasSecurityConfig) {
6888 | results += ' - **Action Required**: Implement comprehensive security measures\n';
6889 | }
6890 | break;
6891 | case 'high':
6892 | results += `- ${hasSecurityConfig ? '✅' : '⚠️'} **High Security**: ${hasSecurityConfig ? 'Some security configuration found' : 'Limited security configuration'}\n`;
6893 | break;
6894 | case 'medium':
6895 | results += `- ℹ️ **Medium Security**: Basic security measures recommended\n`;
6896 | break;
6897 | default:
6898 | results += `- ℹ️ **Security Level**: ${securityLevel} (consider increasing for production)\n`;
6899 | }
6900 |
6901 | return results;
6902 | }
6903 |
6904 | /**
6905 | * Content masking tool implementations
6906 | */
6907 | private async analyzeContentSecurity(args: AnalyzeContentSecurityArgs): Promise<CallToolResult> {
6908 | const { analyzeContentSecurity } = await import('./tools/content-masking-tool.js');
6909 | return await analyzeContentSecurity(args);
6910 | }
6911 |
6912 | private async generateContentMasking(args: GenerateContentMaskingArgs): Promise<CallToolResult> {
6913 | const { generateContentMasking } = await import('./tools/content-masking-tool.js');
6914 | return await generateContentMasking(args);
6915 | }
6916 |
6917 | private async configureCustomPatterns(
6918 | args: ConfigureCustomPatternsArgs
6919 | ): Promise<CallToolResult> {
6920 | const { configureCustomPatterns } = await import('./tools/content-masking-tool.js');
6921 | return await configureCustomPatterns(args);
6922 | }
6923 |
6924 | private async applyBasicContentMasking(
6925 | args: ApplyBasicContentMaskingArgs
6926 | ): Promise<CallToolResult> {
6927 | const { applyBasicContentMasking } = await import('./tools/content-masking-tool.js');
6928 | return await applyBasicContentMasking(args);
6929 | }
6930 |
6931 | private async validateContentMasking(args: ValidateContentMaskingArgs): Promise<CallToolResult> {
6932 | const { validateContentMasking } = await import('./tools/content-masking-tool.js');
6933 | return await validateContentMasking(args);
6934 | }
6935 |
6936 | private async manageCache(args: Record<string, unknown>): Promise<CallToolResult> {
6937 | const { action, key } = args;
6938 |
6939 | try {
6940 | const { clearCache, getCacheStats, cleanupCache, invalidateCache } =
6941 | await import('./utils/cache.js');
6942 |
6943 | switch (action) {
6944 | case 'clear': {
6945 | const clearPrompt = await clearCache();
6946 | return {
6947 | content: [
6948 | {
6949 | type: 'text',
6950 | text: `# Cache Clear Operation
6951 |
6952 | ## AI Delegation Required
6953 |
6954 | Please execute the following cache clearing operation:
6955 |
6956 | ${clearPrompt.prompt}
6957 |
6958 | ## Implementation Instructions
6959 |
6960 | ${clearPrompt.instructions}
6961 |
6962 | ## Expected Result
6963 |
6964 | After successful execution, all cache entries will be removed while preserving the cache directory structure and metadata.json file.`,
6965 | },
6966 | ],
6967 | };
6968 | }
6969 |
6970 | case 'stats': {
6971 | const statsPrompt = await getCacheStats();
6972 | return {
6973 | content: [
6974 | {
6975 | type: 'text',
6976 | text: `# Cache Statistics Collection
6977 |
6978 | ## AI Delegation Required
6979 |
6980 | Please execute the following cache statistics collection operation:
6981 |
6982 | ${statsPrompt.prompt}
6983 |
6984 | ## Implementation Instructions
6985 |
6986 | ${statsPrompt.instructions}
6987 |
6988 | ## Expected Information
6989 |
6990 | The AI agent will provide:
6991 | - **Total Entries**: Number of cache files
6992 | - **Total Size**: Combined size of all cache files
6993 | - **Oldest Entry**: Cache key of the oldest entry
6994 | - **Newest Entry**: Cache key of the newest entry
6995 |
6996 | ## Cache Directory
6997 | \`.mcp-adr-cache/\`
6998 |
6999 | ## Cache Types
7000 | - **Knowledge Graph**: Architectural analysis results (TTL: 1 hour)
7001 | - **Analysis Report**: Project analysis reports (TTL: 30 minutes)
7002 | - **ADR List**: ADR inventory and metadata (TTL: 15 minutes)
7003 |
7004 | ## Management
7005 | Use \`manage_cache\` tool with different actions:
7006 | - \`clear\`: Remove all cache entries
7007 | - \`cleanup\`: Remove expired entries only
7008 | - \`invalidate\`: Remove specific cache entry`,
7009 | },
7010 | ],
7011 | };
7012 | }
7013 |
7014 | case 'cleanup': {
7015 | const cleanupPrompt = await cleanupCache();
7016 | return {
7017 | content: [
7018 | {
7019 | type: 'text',
7020 | text: `# Cache Cleanup Operation
7021 |
7022 | ## AI Delegation Required
7023 |
7024 | Please execute the following cache cleanup operation:
7025 |
7026 | ${cleanupPrompt.prompt}
7027 |
7028 | ## Implementation Instructions
7029 |
7030 | ${cleanupPrompt.instructions}
7031 |
7032 | ## Expected Result
7033 |
7034 | The AI agent will remove expired cache entries and provide a count of cleaned files.`,
7035 | },
7036 | ],
7037 | };
7038 | }
7039 |
7040 | case 'invalidate': {
7041 | if (!key) {
7042 | throw new McpAdrError('Cache key is required for invalidate action', 'INVALID_INPUT');
7043 | }
7044 |
7045 | const invalidatePrompt = await invalidateCache(key as string);
7046 | return {
7047 | content: [
7048 | {
7049 | type: 'text',
7050 | text: `# Cache Invalidation Operation
7051 |
7052 | ## AI Delegation Required
7053 |
7054 | Please execute the following cache invalidation operation:
7055 |
7056 | ${invalidatePrompt.prompt}
7057 |
7058 | ## Implementation Instructions
7059 |
7060 | ${invalidatePrompt.instructions}
7061 |
7062 | ## Target Cache Entry
7063 |
7064 | **Cache Key**: ${key}
7065 |
7066 | The AI agent will safely remove the specified cache entry.`,
7067 | },
7068 | ],
7069 | };
7070 | }
7071 |
7072 | default:
7073 | throw new McpAdrError(`Unknown cache action: ${action}`, 'INVALID_INPUT');
7074 | }
7075 | } catch (error) {
7076 | throw new McpAdrError(
7077 | `Cache management failed: ${error instanceof Error ? error.message : String(error)}`,
7078 | 'CACHE_ERROR'
7079 | );
7080 | }
7081 | }
7082 |
7083 | private async configureOutputMasking(args: Record<string, unknown>): Promise<CallToolResult> {
7084 | const { action = 'get', enabled, strategy, customPatterns } = args;
7085 |
7086 | try {
7087 | const { validateMaskingConfig } = await import('./utils/output-masking.js');
7088 |
7089 | switch (action) {
7090 | case 'get': {
7091 | return {
7092 | content: [
7093 | {
7094 | type: 'text',
7095 | text: `# Current Output Masking Configuration
7096 |
7097 | ## Settings
7098 | - **Enabled**: ${this.maskingConfig.enabled}
7099 | - **Strategy**: ${this.maskingConfig.strategy}
7100 | - **Custom Patterns**: ${this.maskingConfig.customPatterns?.length || 0} patterns
7101 | - **Skip Patterns**: ${this.maskingConfig.skipPatterns?.length || 0} patterns
7102 |
7103 | ## Available Strategies
7104 | - **full**: Replace entire sensitive content with [REDACTED]
7105 | - **partial**: Show safe prefix/suffix, mask middle (e.g., sk-...****)
7106 | - **placeholder**: Replace with descriptive placeholders (e.g., <YOUR_API_KEY>)
7107 | - **environment**: Replace with environment variable references (e.g., \${API_KEY})
7108 |
7109 | ## Configuration
7110 | Use \`configure_output_masking\` tool with:
7111 | - \`action: "set"\` to update configuration
7112 | - \`action: "reset"\` to restore defaults
7113 |
7114 | ## Current Status
7115 | ${this.maskingConfig.enabled ? '✅ Output masking is ACTIVE' : '⚠️ Output masking is DISABLED'}
7116 | `,
7117 | },
7118 | ],
7119 | };
7120 | }
7121 |
7122 | case 'set': {
7123 | const newConfig = { ...this.maskingConfig };
7124 |
7125 | if (typeof enabled === 'boolean') {
7126 | newConfig.enabled = enabled;
7127 | }
7128 |
7129 | if (
7130 | strategy &&
7131 | ['full', 'partial', 'placeholder', 'environment'].includes(strategy as string)
7132 | ) {
7133 | newConfig.strategy = strategy as 'full' | 'partial' | 'placeholder' | 'environment';
7134 | }
7135 |
7136 | if (Array.isArray(customPatterns)) {
7137 | newConfig.customPatterns = customPatterns;
7138 | }
7139 |
7140 | const validation = validateMaskingConfig(newConfig);
7141 | if (!validation.isValid) {
7142 | throw new McpAdrError(
7143 | `Invalid masking configuration: ${validation.errors.join(', ')}`,
7144 | 'INVALID_CONFIG'
7145 | );
7146 | }
7147 |
7148 | this.maskingConfig = newConfig;
7149 |
7150 | return {
7151 | content: [
7152 | {
7153 | type: 'text',
7154 | text: `✅ Output masking configuration updated successfully!
7155 |
7156 | ## New Settings
7157 | - **Enabled**: ${newConfig.enabled}
7158 | - **Strategy**: ${newConfig.strategy}
7159 | - **Custom Patterns**: ${newConfig.customPatterns?.length || 0} patterns
7160 |
7161 | ${
7162 | newConfig.enabled
7163 | ? '🔒 All MCP tool and resource outputs will now be masked according to the new configuration.'
7164 | : '⚠️ Output masking is disabled. Sensitive information may be exposed in responses.'
7165 | }
7166 | `,
7167 | },
7168 | ],
7169 | };
7170 | }
7171 |
7172 | case 'reset': {
7173 | const { createMaskingConfig } = await import('./utils/output-masking.js');
7174 | this.maskingConfig = createMaskingConfig();
7175 |
7176 | return {
7177 | content: [
7178 | {
7179 | type: 'text',
7180 | text: `✅ Output masking configuration reset to defaults!
7181 |
7182 | ## Default Settings
7183 | - **Enabled**: ${this.maskingConfig.enabled}
7184 | - **Strategy**: ${this.maskingConfig.strategy}
7185 | - **Custom Patterns**: ${this.maskingConfig.customPatterns?.length || 0} patterns
7186 | - **Skip Patterns**: ${this.maskingConfig.skipPatterns?.length || 0} patterns
7187 |
7188 | 🔒 Default masking is now active for all outputs.
7189 | `,
7190 | },
7191 | ],
7192 | };
7193 | }
7194 |
7195 | default:
7196 | throw new McpAdrError(`Unknown masking action: ${action}`, 'INVALID_INPUT');
7197 | }
7198 | } catch (error) {
7199 | throw new McpAdrError(
7200 | `Output masking configuration failed: ${error instanceof Error ? error.message : String(error)}`,
7201 | 'CONFIG_ERROR'
7202 | );
7203 | }
7204 | }
7205 |
7206 | /**
7207 | * Helper method to get domains based on PRD type
7208 | */
7209 | private getPrdTypeDomains(prdType: string): string[] {
7210 | const domainMap: Record<string, string[]> = {
7211 | 'web-application': ['api-design', 'frontend-architecture', 'database-design', 'security'],
7212 | 'mobile-app': ['mobile-architecture', 'api-design', 'performance-optimization', 'security'],
7213 | microservices: ['microservices', 'api-design', 'distributed-systems', 'database-design'],
7214 | 'data-platform': [
7215 | 'database-design',
7216 | 'data-architecture',
7217 | 'performance-optimization',
7218 | 'scalability',
7219 | ],
7220 | 'api-service': ['api-design', 'microservices', 'security', 'performance-optimization'],
7221 | general: ['api-design', 'database-design', 'security'],
7222 | };
7223 |
7224 | return (
7225 | domainMap[prdType] || domainMap['general'] || ['api-design', 'database-design', 'security']
7226 | );
7227 | }
7228 |
7229 | /**
7230 | * Helper method to get domains for ecosystem analysis based on technology focus
7231 | */
7232 | private getEcosystemAnalysisDomains(technologyFocus: string[]): string[] {
7233 | // Base domains for ecosystem analysis
7234 | const baseDomains = ['api-design', 'database-design', 'security', 'performance-optimization'];
7235 |
7236 | // Technology-specific domain mapping
7237 | const technologyDomainMap: Record<string, string[]> = {
7238 | react: ['frontend-architecture', 'web-applications'],
7239 | vue: ['frontend-architecture', 'web-applications'],
7240 | angular: ['frontend-architecture', 'web-applications'],
7241 | node: ['api-design', 'microservices'],
7242 | express: ['api-design', 'web-applications'],
7243 | fastify: ['api-design', 'performance-optimization'],
7244 | nestjs: ['api-design', 'microservices'],
7245 | spring: ['api-design', 'microservices'],
7246 | django: ['api-design', 'web-applications'],
7247 | flask: ['api-design', 'web-applications'],
7248 | rails: ['api-design', 'web-applications'],
7249 | laravel: ['api-design', 'web-applications'],
7250 | docker: ['containerization', 'microservices'],
7251 | kubernetes: ['containerization', 'distributed-systems'],
7252 | mongodb: ['database-design', 'data-architecture'],
7253 | postgresql: ['database-design', 'data-architecture'],
7254 | mysql: ['database-design', 'data-architecture'],
7255 | redis: ['database-design', 'performance-optimization'],
7256 | elasticsearch: ['database-design', 'data-architecture'],
7257 | kafka: ['distributed-systems', 'data-architecture'],
7258 | rabbitmq: ['distributed-systems', 'microservices'],
7259 | aws: ['cloud-architecture', 'scalability'],
7260 | azure: ['cloud-architecture', 'scalability'],
7261 | gcp: ['cloud-architecture', 'scalability'],
7262 | terraform: ['infrastructure-as-code', 'cloud-architecture'],
7263 | ansible: ['infrastructure-as-code', 'automation'],
7264 | jenkins: ['ci-cd', 'automation'],
7265 | 'github-actions': ['ci-cd', 'automation'],
7266 | 'gitlab-ci': ['ci-cd', 'automation'],
7267 | };
7268 |
7269 | // Collect domains based on technology focus
7270 | const technologyDomains = new Set<string>();
7271 | for (const tech of technologyFocus) {
7272 | const techLower = tech.toLowerCase();
7273 | const domains = technologyDomainMap[techLower];
7274 | if (domains) {
7275 | domains.forEach(domain => technologyDomains.add(domain));
7276 | }
7277 | }
7278 |
7279 | // Combine base domains with technology-specific domains
7280 | const allDomains = [...baseDomains, ...Array.from(technologyDomains)];
7281 |
7282 | // Remove duplicates and limit to reasonable number
7283 | const uniqueDomains = [...new Set(allDomains)];
7284 |
7285 | // Return up to 6 most relevant domains
7286 | return uniqueDomains.slice(0, 6);
7287 | }
7288 |
7289 | /**
7290 | * Helper method to create base ADR generation prompt
7291 | */
7292 | private createBaseAdrPrompt(
7293 | prdPath: string,
7294 | outputDirectory: string,
7295 | knowledgeContext: string
7296 | ): string {
7297 | return `
7298 | # Enhanced ADR Generation from PRD Request
7299 |
7300 | This is a comprehensive prompt-driven ADR generation process enhanced with domain knowledge and optimized prompting.
7301 |
7302 | ${knowledgeContext}
7303 |
7304 | ## Step 1: File Validation
7305 | Please verify that the PRD file exists at: ${prdPath}
7306 |
7307 | ## Step 2: PRD Content Reading
7308 | Read and analyze the PRD content from: ${prdPath}
7309 |
7310 | ## Step 3: Enhanced ADR Generation and Creation
7311 |
7312 | Once you have successfully read the PRD content, analyze it using the domain knowledge above and generate Architectural Decision Records (ADRs).
7313 |
7314 | ### Enhanced Analysis Requirements
7315 |
7316 | 1. **Extract Key Decisions**: Identify all architectural decisions implied or stated in the PRD
7317 | 2. **Apply Domain Knowledge**: Use the generated domain knowledge to enhance decision analysis
7318 | 3. **Decision Categorization**: Group decisions by:
7319 | - Technology stack choices (informed by domain best practices)
7320 | - Architectural patterns (leveraging domain-specific patterns)
7321 | - Infrastructure decisions (considering domain requirements)
7322 | - Security considerations (applying domain security knowledge)
7323 | - Performance requirements (using domain performance insights)
7324 | - Integration approaches (following domain integration patterns)
7325 |
7326 | ### Enhanced ADR Generation Requirements
7327 |
7328 | 1. **Follow ADR Format**: Use standard ADR template with domain-enhanced content
7329 | 2. **Number Sequentially**: Use format 001-decision-title.md, 002-next-decision.md, etc.
7330 | 3. **Output Directory**: Place ADRs in ${outputDirectory}/
7331 | 4. **Domain Context**: Include relevant domain knowledge in each ADR
7332 | 5. **File Creation**: Generate file creation prompts for each ADR
7333 |
7334 | ### Enhanced ADR Template Format
7335 |
7336 | \`\`\`markdown
7337 | # [Number]. [Title]
7338 |
7339 | **Status**: [Proposed/Accepted/Deprecated/Superseded]
7340 | **Date**: [YYYY-MM-DD]
7341 | **Domain**: [Relevant domain from knowledge enhancement]
7342 |
7343 | ## Context
7344 | [Describe the context and problem statement from PRD, enhanced with domain knowledge]
7345 |
7346 | ## Decision
7347 | [Describe the architectural decision, informed by domain best practices]
7348 |
7349 | ## Consequences
7350 | [Describe positive and negative consequences, considering domain-specific implications]
7351 |
7352 | ## Domain Considerations
7353 | [Specific considerations from the domain knowledge that influenced this decision]
7354 |
7355 | ## Implementation Plan
7356 | [Steps to implement this decision, leveraging domain expertise]
7357 |
7358 | ## Related PRD Sections
7359 | [Reference specific sections from the PRD that led to this decision]
7360 |
7361 | ## Domain References
7362 | [References to domain knowledge that informed this decision]
7363 | \`\`\`
7364 |
7365 | ### Expected Enhanced Output
7366 |
7367 | Please provide:
7368 | 1. **File Validation Results**: Confirmation that PRD file exists and is readable
7369 | 2. **PRD Content Summary**: Brief summary enhanced with domain context
7370 | 3. **Domain Analysis**: How domain knowledge applies to this PRD
7371 | 4. **Identified Decisions**: List of all architectural decisions with domain context
7372 | 5. **Generated ADRs**: Complete enhanced ADR content for each decision
7373 | 6. **File Creation Plan**: File names, directory structure, and creation order
7374 | 7. **Implementation Priority**: Recommended order considering domain best practices
7375 |
7376 | ### Quality Assurance with Domain Enhancement
7377 |
7378 | - Ensure each ADR leverages relevant domain knowledge
7379 | - Verify decisions align with domain best practices
7380 | - Check that domain considerations are properly documented
7381 | - Validate that ADR content is enhanced beyond basic analysis
7382 | `;
7383 | }
7384 |
7385 | /**
7386 | * ADR suggestion tool implementations
7387 | */
7388 | private async suggestAdrs(args: Record<string, unknown>): Promise<CallToolResult> {
7389 | const { suggestAdrs } = await import('./tools/adr-suggestion-tool.js');
7390 | return await suggestAdrs(args);
7391 | }
7392 |
7393 | private async generateAdrFromDecision(
7394 | args: GenerateAdrFromDecisionArgs
7395 | ): Promise<CallToolResult> {
7396 | const { generateAdrFromDecision } = await import('./tools/adr-suggestion-tool.js');
7397 | return await generateAdrFromDecision(args);
7398 | }
7399 |
7400 | private async generateAdrBootstrap(args: Record<string, unknown>): Promise<CallToolResult> {
7401 | const { default: generateAdrBootstrapScripts } =
7402 | await import('./tools/adr-bootstrap-validation-tool.js');
7403 | return await generateAdrBootstrapScripts(args);
7404 | }
7405 |
7406 | private async bootstrapValidationLoop(args: Record<string, unknown>): Promise<CallToolResult> {
7407 | const { default: bootstrapValidationLoop } =
7408 | await import('./tools/bootstrap-validation-loop-tool.js');
7409 | return await bootstrapValidationLoop(args);
7410 | }
7411 |
7412 | private async discoverExistingAdrs(
7413 | args: Record<string, unknown>,
7414 | context?: ToolContext
7415 | ): Promise<CallToolResult> {
7416 | const ctx = context || createNoOpContext();
7417 |
7418 | try {
7419 | ctx.info('🔍 Starting ADR discovery process...');
7420 | ctx.report_progress(0, 100);
7421 |
7422 | ctx.info('📂 Phase 1: Scanning ADR directory');
7423 | ctx.report_progress(30, 100);
7424 |
7425 | const { discoverExistingAdrs } = await import('./tools/adr-suggestion-tool.js');
7426 |
7427 | ctx.info('📄 Phase 2: Analyzing ADR files');
7428 | ctx.report_progress(60, 100);
7429 |
7430 | const result = await discoverExistingAdrs(args);
7431 |
7432 | ctx.info('✅ ADR discovery completed successfully');
7433 | ctx.report_progress(100, 100);
7434 |
7435 | return result;
7436 | } catch (error) {
7437 | ctx.error?.(
7438 | `❌ ADR discovery failed: ${error instanceof Error ? error.message : String(error)}`
7439 | );
7440 | throw error;
7441 | }
7442 | }
7443 |
7444 | private async analyzeAdrTimeline(args: Record<string, unknown>): Promise<CallToolResult> {
7445 | try {
7446 | const projectPath = (args['projectPath'] as string) || this.config.projectPath;
7447 | const adrDirectory = (args['adrDirectory'] as string) || 'docs/adrs';
7448 | const generateActions = (args['generateActions'] as boolean) ?? true;
7449 | const thresholdProfile = args['thresholdProfile'] as string | undefined;
7450 | const autoDetectContext = (args['autoDetectContext'] as boolean) ?? true;
7451 | const includeContent = (args['includeContent'] as boolean) ?? true;
7452 | const forceExtract = (args['forceExtract'] as boolean) ?? false;
7453 |
7454 | const { discoverAdrsInDirectory } = await import('./utils/adr-discovery.js');
7455 | const { formatActionReport } = await import('./utils/adr-action-analyzer.js');
7456 |
7457 | // Discover ADRs with timeline analysis
7458 | const result = await discoverAdrsInDirectory(adrDirectory, projectPath, {
7459 | includeContent,
7460 | includeTimeline: true,
7461 | timelineOptions: {
7462 | forceExtract,
7463 | useCache: true,
7464 | cacheTTL: 3600,
7465 | },
7466 | generateActions,
7467 | ...(thresholdProfile ? { thresholdProfile } : {}),
7468 | autoDetectContext,
7469 | });
7470 |
7471 | // Format response
7472 | let responseText = `# ADR Timeline Analysis\n\n`;
7473 | responseText += `**Project:** ${projectPath}\n`;
7474 | responseText += `**ADR Directory:** ${adrDirectory}\n`;
7475 | responseText += `**Total ADRs:** ${result.totalAdrs}\n\n`;
7476 |
7477 | // Add timeline summary
7478 | if (result.adrs.some(adr => adr.timeline)) {
7479 | const withTimeline = result.adrs.filter(adr => adr.timeline).length;
7480 | responseText += `## Timeline Data\n\n`;
7481 | responseText += `- **ADRs with Timeline:** ${withTimeline}/${result.totalAdrs}\n`;
7482 |
7483 | const ages = result.adrs.filter(adr => adr.timeline).map(adr => adr.timeline!.age_days);
7484 | if (ages.length > 0) {
7485 | const avgAge = Math.floor(ages.reduce((a, b) => a + b, 0) / ages.length);
7486 | const oldestAge = Math.max(...ages);
7487 | responseText += `- **Average ADR Age:** ${avgAge} days\n`;
7488 | responseText += `- **Oldest ADR:** ${oldestAge} days\n`;
7489 | }
7490 | responseText += `\n`;
7491 | }
7492 |
7493 | // Add action queue report
7494 | if (result.actionQueue) {
7495 | responseText += `---\n\n`;
7496 | responseText += formatActionReport(result.actionQueue, {
7497 | projectPath,
7498 | thresholdProfile: thresholdProfile || 'auto-detected',
7499 | });
7500 | } else if (generateActions) {
7501 | responseText += `## No Actions Required\n\n`;
7502 | responseText += `All ADRs are up to date and within acceptable thresholds.\n`;
7503 | }
7504 |
7505 | // Add summary stats
7506 | if (result.summary.byStatus) {
7507 | responseText += `\n---\n\n## ADR Status Distribution\n\n`;
7508 | Object.entries(result.summary.byStatus).forEach(([status, count]) => {
7509 | responseText += `- **${status}:** ${count}\n`;
7510 | });
7511 | }
7512 |
7513 | return {
7514 | content: [
7515 | {
7516 | type: 'text',
7517 | text: responseText,
7518 | },
7519 | ],
7520 | };
7521 | } catch (error) {
7522 | return {
7523 | content: [
7524 | {
7525 | type: 'text',
7526 | text: `# ADR Timeline Analysis Failed\n\n**Error:** ${error instanceof Error ? error.message : String(error)}\n\nPlease check that the ADR directory exists and contains valid ADR files.`,
7527 | },
7528 | ],
7529 | isError: true,
7530 | };
7531 | }
7532 | }
7533 |
7534 | private async reviewExistingAdrs(args: Record<string, unknown>): Promise<CallToolResult> {
7535 | const { reviewExistingAdrs } = await import('./tools/review-existing-adrs-tool.js');
7536 | return await reviewExistingAdrs(args);
7537 | }
7538 |
7539 | /**
7540 | * ADR validation tool implementations
7541 | */
7542 | private async validateAdr(args: Record<string, unknown>): Promise<CallToolResult> {
7543 | const { validateAdr } = await import('./tools/adr-validation-tool.js');
7544 | return await validateAdr(args as any);
7545 | }
7546 |
7547 | private async validateAllAdrs(args: Record<string, unknown>): Promise<CallToolResult> {
7548 | const { validateAllAdrs } = await import('./tools/adr-validation-tool.js');
7549 | return await validateAllAdrs(args as any);
7550 | }
7551 |
7552 | /**
7553 | * Research integration tool implementations
7554 | */
7555 | private async incorporateResearch(args: Record<string, unknown>): Promise<CallToolResult> {
7556 | const { incorporateResearch } = await import('./tools/research-integration-tool.js');
7557 | return await incorporateResearch(args);
7558 | }
7559 |
7560 | private async createResearchTemplate(args: Record<string, unknown>): Promise<CallToolResult> {
7561 | const { createResearchTemplate } = await import('./tools/research-integration-tool.js');
7562 | return await createResearchTemplate(args);
7563 | }
7564 |
7565 | private async requestActionConfirmation(args: Record<string, unknown>): Promise<CallToolResult> {
7566 | const { requestActionConfirmation } = await import('./tools/research-integration-tool.js');
7567 | return await requestActionConfirmation(args as unknown as ActionArgs);
7568 | }
7569 |
7570 | /**
7571 | * Rule generation and validation tool implementations
7572 | */
7573 | private async generateRules(args: Record<string, unknown>): Promise<CallToolResult> {
7574 | const { generateRules } = await import('./tools/rule-generation-tool.js');
7575 | return await generateRules(args);
7576 | }
7577 |
7578 | private async validateRules(args: ValidateRulesArgs): Promise<CallToolResult> {
7579 | const { validateRules } = await import('./tools/rule-generation-tool.js');
7580 | return await validateRules(args);
7581 | }
7582 |
7583 | private async createRuleSet(args: CreateRuleSetArgs): Promise<CallToolResult> {
7584 | const { createRuleSet } = await import('./tools/rule-generation-tool.js');
7585 | return await createRuleSet(args);
7586 | }
7587 |
7588 | /**
7589 | * Environment analysis tool implementation
7590 | */
7591 | private async analyzeEnvironment(args: Record<string, unknown>): Promise<CallToolResult> {
7592 | const { analyzeEnvironment } = await import('./tools/environment-analysis-tool.js');
7593 | return await analyzeEnvironment(args);
7594 | }
7595 |
7596 | /**
7597 | * Research question generation tool implementation
7598 | */
7599 | private async generateResearchQuestions(args: Record<string, unknown>): Promise<CallToolResult> {
7600 | const { generateResearchQuestions } = await import('./tools/research-question-tool.js');
7601 | return await generateResearchQuestions(args);
7602 | }
7603 |
7604 | /**
7605 | * Perform research tool implementation
7606 | */
7607 | private async performResearch(
7608 | args: Record<string, unknown>,
7609 | context?: ToolContext
7610 | ): Promise<CallToolResult> {
7611 | const ctx = context || createNoOpContext();
7612 |
7613 | if (!('question' in args) || typeof args['question'] !== 'string') {
7614 | throw new McpAdrError('Missing required parameter: question', 'INVALID_ARGUMENTS');
7615 | }
7616 |
7617 | try {
7618 | ctx.info('🔍 Starting research process...');
7619 | ctx.report_progress(0, 100);
7620 |
7621 | ctx.info('📊 Phase 1: Initializing research framework');
7622 | ctx.report_progress(10, 100);
7623 |
7624 | const { performResearch } = await import('./tools/perform-research-tool.js');
7625 |
7626 | ctx.info('📚 Phase 2: Executing research orchestration');
7627 | ctx.report_progress(20, 100);
7628 |
7629 | const result = await performResearch(
7630 | args as {
7631 | question: string;
7632 | projectPath?: string;
7633 | adrDirectory?: string;
7634 | confidenceThreshold?: number;
7635 | performWebSearch?: boolean;
7636 | },
7637 | ctx // ✅ Pass context to tool function for progress updates
7638 | );
7639 |
7640 | return result;
7641 | } catch (error) {
7642 | ctx.error?.(
7643 | `❌ Research execution failed: ${error instanceof Error ? error.message : String(error)}`
7644 | );
7645 | throw new McpAdrError(
7646 | `Failed to perform research: ${error instanceof Error ? error.message : String(error)}`,
7647 | 'RESEARCH_EXECUTION_ERROR'
7648 | );
7649 | }
7650 | }
7651 |
7652 | /**
7653 | * Search codebase tool implementation
7654 | */
7655 | private async searchCodebase(args: Record<string, unknown>): Promise<CallToolResult> {
7656 | if (!('query' in args) || typeof args['query'] !== 'string') {
7657 | throw new McpAdrError('Missing required parameter: query', 'INVALID_ARGUMENTS');
7658 | }
7659 |
7660 | try {
7661 | const { searchCodebaseTool } = await import('./tools/search-codebase-tool.js');
7662 | return await searchCodebaseTool(
7663 | args as {
7664 | query: string;
7665 | projectPath?: string;
7666 | scope?: string[];
7667 | includeContent?: boolean;
7668 | maxFiles?: number;
7669 | enableTreeSitter?: boolean;
7670 | relevanceThreshold?: number;
7671 | }
7672 | );
7673 | } catch (error) {
7674 | throw new McpAdrError(
7675 | `Failed to search codebase: ${error instanceof Error ? error.message : String(error)}`,
7676 | 'SEARCH_ERROR'
7677 | );
7678 | }
7679 | }
7680 |
7681 | /**
7682 | * LLM web search tool implementation
7683 | */
7684 | private async llmWebSearch(
7685 | args: Record<string, unknown>,
7686 | context?: ToolContext
7687 | ): Promise<CallToolResult> {
7688 | const ctx = context || createNoOpContext();
7689 |
7690 | if (!('query' in args) || typeof args['query'] !== 'string') {
7691 | throw new McpAdrError('Missing required parameter: query', 'INVALID_ARGUMENTS');
7692 | }
7693 |
7694 | ctx.info('🌐 Starting LLM-managed web search...');
7695 | ctx.report_progress(0, 100);
7696 |
7697 | const { llmWebSearch } = await import('./tools/llm-web-search-tool.js');
7698 | return await llmWebSearch(
7699 | args as {
7700 | query: string;
7701 | maxResults?: number;
7702 | includeContent?: boolean;
7703 | llmInstructions?: string;
7704 | projectPath?: string;
7705 | adrDirectory?: string;
7706 | },
7707 | ctx // ✅ Pass context to tool function for progress updates
7708 | );
7709 | }
7710 |
7711 | /**
7712 | * LLM cloud management tool implementation
7713 | */
7714 | private async llmCloudManagement(
7715 | args: Record<string, unknown>,
7716 | context?: ToolContext
7717 | ): Promise<CallToolResult> {
7718 | const ctx = context || createNoOpContext();
7719 |
7720 | if (!('provider' in args) || !('action' in args) || !('llmInstructions' in args)) {
7721 | throw new McpAdrError(
7722 | 'Missing required parameters: provider, action, llmInstructions',
7723 | 'INVALID_ARGUMENTS'
7724 | );
7725 | }
7726 |
7727 | ctx.info('🔧 Starting LLM-managed cloud operation...');
7728 | ctx.report_progress(0, 100);
7729 |
7730 | const { llmCloudManagement } = await import('./tools/llm-cloud-management-tool.js');
7731 | return await llmCloudManagement(
7732 | args as {
7733 | provider: 'aws' | 'azure' | 'gcp' | 'redhat' | 'ubuntu' | 'macos';
7734 | action: string;
7735 | parameters?: Record<string, any>;
7736 | llmInstructions: string;
7737 | researchFirst?: boolean;
7738 | projectPath?: string;
7739 | adrDirectory?: string;
7740 | },
7741 | ctx // ✅ Pass context to tool function for progress updates
7742 | );
7743 | }
7744 |
7745 | /**
7746 | * LLM database management tool implementation
7747 | */
7748 | private async llmDatabaseManagement(
7749 | args: Record<string, unknown>,
7750 | context?: ToolContext
7751 | ): Promise<CallToolResult> {
7752 | const ctx = context || createNoOpContext();
7753 |
7754 | if (!('database' in args) || !('action' in args) || !('llmInstructions' in args)) {
7755 | throw new McpAdrError(
7756 | 'Missing required parameters: database, action, llmInstructions',
7757 | 'INVALID_ARGUMENTS'
7758 | );
7759 | }
7760 |
7761 | ctx.info('🗄️ Starting LLM-managed database operation...');
7762 | ctx.report_progress(0, 100);
7763 |
7764 | const { llmDatabaseManagement } = await import('./tools/llm-database-management-tool.js');
7765 | return await llmDatabaseManagement(
7766 | args as {
7767 | database: 'postgresql' | 'mongodb' | 'redis' | 'mysql' | 'mariadb';
7768 | action: string;
7769 | parameters?: Record<string, any>;
7770 | llmInstructions: string;
7771 | researchFirst?: boolean;
7772 | projectPath?: string;
7773 | adrDirectory?: string;
7774 | },
7775 | ctx // ✅ Pass context to tool function for progress updates
7776 | );
7777 | }
7778 |
7779 | /**
7780 | * Deployment analysis tool implementation
7781 | */
7782 | private async analyzeDeploymentProgress(args: Record<string, unknown>): Promise<CallToolResult> {
7783 | const { analyzeDeploymentProgress } = await import('./tools/deployment-analysis-tool.js');
7784 | return await analyzeDeploymentProgress(args);
7785 | }
7786 |
7787 | /**
7788 | * Apply content masking to MCP response
7789 | */
7790 | /**
7791 | * Track memory operations performed by tools
7792 | */
7793 | private async trackMemoryOperations(
7794 | toolName: string,
7795 | parameters: any,
7796 | result: any,
7797 | success: boolean
7798 | ): Promise<void> {
7799 | try {
7800 | // Check if memory integration was enabled and used
7801 | if (parameters?.enableMemoryIntegration === false) {
7802 | return; // Memory integration was explicitly disabled
7803 | }
7804 |
7805 | // Extract memory operation information from result
7806 | const memoryOps = this.extractMemoryOperations(toolName, parameters, result);
7807 |
7808 | if (memoryOps.length > 0) {
7809 | // Store memory operation tracking in knowledge graph
7810 | for (const op of memoryOps) {
7811 | await this.kgManager.addMemoryExecution(
7812 | toolName,
7813 | op.action,
7814 | op.entityType,
7815 | success && op.success,
7816 | op.details
7817 | );
7818 | }
7819 | }
7820 | } catch (error) {
7821 | // Don't let memory tracking errors break execution
7822 | console.error('[WARN] Memory operation tracking failed:', error);
7823 | }
7824 | }
7825 |
7826 | /**
7827 | * Extract memory operation details from tool execution
7828 | */
7829 | private extractMemoryOperations(toolName: string, parameters: any, result: any): any[] {
7830 | const operations: any[] = [];
7831 |
7832 | // Define memory-enabled tools and their expected operations
7833 | const memoryEnabledTools = {
7834 | analyze_content_security: {
7835 | entityType: 'security_pattern',
7836 | actions: ['store_pattern', 'analyze_institutional_security', 'track_evolution'],
7837 | },
7838 | analyze_environment: {
7839 | entityType: 'environment_snapshot',
7840 | actions: ['store_snapshot', 'analyze_trends', 'compare_configurations'],
7841 | },
7842 | deployment_readiness: {
7843 | entityType: 'deployment_assessment',
7844 | actions: ['store_assessment', 'migrate_history', 'analyze_patterns'],
7845 | },
7846 | troubleshoot_guided_workflow: {
7847 | entityType: 'troubleshooting_session',
7848 | actions: ['store_session', 'pattern_recognition', 'suggest_adrs', 'generate_research'],
7849 | },
7850 | };
7851 |
7852 | // Check if this tool supports memory operations
7853 | const toolConfig = memoryEnabledTools[toolName as keyof typeof memoryEnabledTools];
7854 | if (!toolConfig) {
7855 | return operations; // Tool doesn't support memory operations
7856 | }
7857 |
7858 | // Extract memory operation details from result
7859 | if (result?.memoryIntegration) {
7860 | const memoryInfo = result.memoryIntegration;
7861 |
7862 | // Pattern entity storage operation
7863 | if (memoryInfo.entityStored || memoryInfo.patternStored) {
7864 | operations.push({
7865 | action: 'entity_storage',
7866 | entityType: toolConfig.entityType,
7867 | success: memoryInfo.storageSuccess !== false,
7868 | details: {
7869 | entityId: memoryInfo.entityId || memoryInfo.patternId,
7870 | entityCount: memoryInfo.entityCount || 1,
7871 | storageMethod: memoryInfo.storageMethod || 'standard',
7872 | },
7873 | });
7874 | }
7875 |
7876 | // Historical analysis operation
7877 | if (memoryInfo.historicalAnalysis || memoryInfo.trendAnalysis) {
7878 | operations.push({
7879 | action: 'historical_analysis',
7880 | entityType: toolConfig.entityType,
7881 | success: memoryInfo.analysisSuccess !== false,
7882 | details: {
7883 | analysisType: memoryInfo.analysisType || 'trend_analysis',
7884 | entitiesAnalyzed: memoryInfo.entitiesAnalyzed || 0,
7885 | insights: memoryInfo.insights || [],
7886 | },
7887 | });
7888 | }
7889 |
7890 | // Evolution tracking operation
7891 | if (memoryInfo.evolutionTracking) {
7892 | operations.push({
7893 | action: 'evolution_tracking',
7894 | entityType: toolConfig.entityType,
7895 | success: memoryInfo.evolutionSuccess !== false,
7896 | details: {
7897 | improvements: memoryInfo.improvements || [],
7898 | degradations: memoryInfo.degradations || [],
7899 | recommendations: memoryInfo.recommendations || [],
7900 | },
7901 | });
7902 | }
7903 |
7904 | // Migration operation (for deployment readiness)
7905 | if (memoryInfo.migrationCompleted) {
7906 | operations.push({
7907 | action: 'data_migration',
7908 | entityType: toolConfig.entityType,
7909 | success: memoryInfo.migrationSuccess !== false,
7910 | details: {
7911 | migratedRecords: memoryInfo.migratedRecords || 0,
7912 | migrationMethod: memoryInfo.migrationMethod || 'json_to_memory',
7913 | },
7914 | });
7915 | }
7916 | }
7917 |
7918 | // If no specific memory integration info, infer from parameters
7919 | if (operations.length === 0 && parameters?.enableMemoryIntegration !== false) {
7920 | // Default assumption: entity was stored
7921 | operations.push({
7922 | action: 'entity_storage',
7923 | entityType: toolConfig.entityType,
7924 | success: true, // Assume success if no explicit info
7925 | details: {
7926 | entityCount: 1,
7927 | storageMethod: 'inferred',
7928 | note: 'Memory operation inferred from tool execution',
7929 | },
7930 | });
7931 | }
7932 |
7933 | return operations;
7934 | }
7935 |
7936 | /**
7937 | * Track tool execution in knowledge graph
7938 | */
7939 | private async trackToolExecution(
7940 | toolName: string,
7941 | parameters: any,
7942 | result: any,
7943 | success: boolean,
7944 | error?: string
7945 | ): Promise<void> {
7946 | try {
7947 | // Extract intentId from metadata if available
7948 | let intentId: string | undefined;
7949 |
7950 | if (result?.metadata?.intentId) {
7951 | intentId = result.metadata.intentId;
7952 | } else {
7953 | // Check for active intents that might be related to this tool execution
7954 | const activeIntents = await this.kgManager.getActiveIntents();
7955 | if (activeIntents.length > 0) {
7956 | // Use the most recent active intent
7957 | const latestIntent = activeIntents[activeIntents.length - 1];
7958 | if (latestIntent) {
7959 | intentId = latestIntent.intentId;
7960 | }
7961 | }
7962 | }
7963 |
7964 | // If no intent found, create a standalone execution record
7965 | if (!intentId) {
7966 | // Extract human request from conversation context if available
7967 | let humanRequest = `Standalone tool execution: ${toolName}`;
7968 | if (parameters?.conversationContext?.humanRequest) {
7969 | humanRequest = parameters.conversationContext.humanRequest;
7970 | }
7971 |
7972 | intentId = await this.kgManager.createIntent(
7973 | humanRequest,
7974 | [`Execute ${toolName}`, 'Complete tool operation'],
7975 | 'medium'
7976 | );
7977 | }
7978 |
7979 | // Determine tasks created/modified from tool operation
7980 | const todoTasksCreated: string[] = [];
7981 | const todoTasksModified: string[] = [];
7982 |
7983 | // Extract task information from result metadata
7984 | if (result?.metadata) {
7985 | if (result.metadata.tasksCreated) {
7986 | todoTasksCreated.push(...result.metadata.tasksCreated);
7987 | }
7988 | if (result.metadata.tasksModified) {
7989 | todoTasksModified.push(...result.metadata.tasksModified);
7990 | }
7991 | if (result.metadata.taskIds) {
7992 | todoTasksModified.push(...result.metadata.taskIds);
7993 | }
7994 | }
7995 |
7996 | // Track memory operations if present
7997 | await this.trackMemoryOperations(toolName, parameters, result, success);
7998 |
7999 | // Store execution in knowledge graph
8000 | await this.kgManager.addToolExecution(
8001 | intentId,
8002 | toolName,
8003 | parameters,
8004 | result,
8005 | success,
8006 | todoTasksCreated,
8007 | todoTasksModified,
8008 | error
8009 | );
8010 |
8011 | // If execution completed successfully, update intent status
8012 | if (success && !error) {
8013 | // Check if this might be the final tool in a chain
8014 | const intent = await this.kgManager.getIntentById(intentId);
8015 | if (intent && intent.currentStatus === 'executing') {
8016 | // Simple heuristic: if tool is a "completion" type tool, mark intent as completed
8017 | const completionTools = ['smart_git_push', 'generate_deployment_guidance', 'smart_score'];
8018 | if (completionTools.includes(toolName)) {
8019 | await this.kgManager.updateIntentStatus(intentId, 'completed');
8020 | }
8021 | }
8022 | }
8023 | } catch (trackingError) {
8024 | // Don't let tracking errors break tool execution
8025 | console.error('[WARN] Knowledge graph tracking failed:', trackingError);
8026 | }
8027 | }
8028 |
8029 | private async applyOutputMasking(response: any): Promise<any> {
8030 | try {
8031 | return await maskMcpResponse(response, this.maskingConfig);
8032 | } catch (error) {
8033 | // If masking fails, log warning and return original response
8034 | // Log to stderr to avoid corrupting MCP protocol
8035 | console.error('[WARN] Output masking failed:', error);
8036 | return response;
8037 | }
8038 | }
8039 |
8040 | /**
8041 | * Enrich response with state reinforcement and apply masking
8042 | *
8043 | * Implements Phase 2 of context decay mitigation by injecting
8044 | * context reminders every N turns or when response exceeds token threshold.
8045 | *
8046 | * Phase 3 extension: Records conversation turns to structured external memory.
8047 | */
8048 | private async enrichResponseWithStateReinforcement(
8049 | response: CallToolResult,
8050 | toolName?: string,
8051 | toolArgs?: any
8052 | ): Promise<CallToolResult> {
8053 | const startTime = Date.now();
8054 | try {
8055 | // Extract text content from response
8056 | const textContent = response.content
8057 | .filter((item): item is { type: 'text'; text: string } => item.type === 'text')
8058 | .map(item => item.text)
8059 | .join('\n\n');
8060 |
8061 | if (!textContent) {
8062 | // No text content to enrich, just apply masking
8063 | return await this.applyOutputMasking(response);
8064 | }
8065 |
8066 | // Enrich with state reinforcement (Phase 2)
8067 | const enriched = await this.stateReinforcementManager.enrichResponseWithContext(textContent);
8068 |
8069 | // Prepare final response
8070 | let finalResponse: CallToolResult;
8071 |
8072 | // Replace text content with enriched version if context was injected
8073 | if (enriched.contextInjected) {
8074 | finalResponse = {
8075 | ...response,
8076 | content: response.content.map(item => {
8077 | if (item.type === 'text') {
8078 | return {
8079 | type: 'text',
8080 | text: enriched.enrichedContent,
8081 | };
8082 | }
8083 | return item;
8084 | }),
8085 | };
8086 | } else {
8087 | finalResponse = response;
8088 | }
8089 |
8090 | // Record conversation turn (Phase 3: Structured External Memory)
8091 | if (toolName) {
8092 | const duration = Date.now() - startTime;
8093 |
8094 | // Check if response has expandableId (from tiered response)
8095 | const expandableIdMatch = textContent.match(/expandableId:\s*(\S+)/);
8096 | const expandableId = expandableIdMatch ? expandableIdMatch[1] : undefined;
8097 |
8098 | await this.conversationMemoryManager.recordTurn(
8099 | {
8100 | type: 'tool_call',
8101 | toolName,
8102 | toolArgs,
8103 | },
8104 | {
8105 | content: enriched.enrichedContent || textContent,
8106 | tokenCount: enriched.tokenCount,
8107 | contextInjected: enriched.contextInjected,
8108 | ...(expandableId ? { expandableId } : {}),
8109 | },
8110 | {
8111 | duration,
8112 | cacheHit: false, // Could be enhanced to track cache hits
8113 | errorOccurred: false,
8114 | }
8115 | );
8116 |
8117 | this.logger.debug(`Conversation turn recorded for ${toolName}`, 'McpAdrAnalysisServer', {
8118 | turnNumber: enriched.turnNumber,
8119 | });
8120 | }
8121 |
8122 | // Apply masking to final response
8123 | return await this.applyOutputMasking(finalResponse);
8124 | } catch (error) {
8125 | this.logger.error(
8126 | 'State reinforcement or conversation recording failed, returning original response',
8127 | 'McpAdrAnalysisServer',
8128 | error instanceof Error ? error : undefined
8129 | );
8130 | // Fallback to just masking if enrichment fails
8131 | return await this.applyOutputMasking(response);
8132 | }
8133 | }
8134 |
8135 | /**
8136 | * Read MCP resource with prompt-driven caching
8137 | */
8138 | private async readResource(uri: string): Promise<any> {
8139 | try {
8140 | // Import resource router and templated resources (ensures routes are registered)
8141 | const { resourceRouter } = await import('./resources/resource-router.js');
8142 |
8143 | // Import templated resources to register routes
8144 | await import('./resources/adr-by-id-resource.js');
8145 | await import('./resources/research-by-topic-resource.js');
8146 | await import('./resources/todo-by-id-resource.js');
8147 | await import('./resources/rule-by-id-resource.js');
8148 | await import('./resources/technology-by-name-resource.js');
8149 | await import('./resources/pattern-by-name-resource.js');
8150 | await import('./resources/validated-pattern-by-platform-resource.js');
8151 | await import('./resources/pattern-sources-by-platform-resource.js');
8152 | await import('./resources/pattern-base-code-by-platform-resource.js');
8153 | // Phase 1 & 2 resources (PR #346)
8154 | await import('./resources/server-context-resource.js');
8155 | await import('./resources/memory-stats-resource.js');
8156 | await import('./resources/conversation-snapshot-resource.js');
8157 | await import('./resources/tool-catalog-resource.js');
8158 | await import('./resources/adrs-discovered-resource.js');
8159 | // Knowledge Graph Resource (ADR-018)
8160 | const { generateKnowledgeGraphResource } =
8161 | await import('./resources/knowledge-graph-resource.js');
8162 |
8163 | // Handle knowledge://graph specially to inject KnowledgeGraphManager
8164 | if (uri === 'knowledge://graph') {
8165 | const url = new globalThis.URL(uri);
8166 | const result = await generateKnowledgeGraphResource({}, url.searchParams, this.kgManager);
8167 |
8168 | return {
8169 | contents: [
8170 | {
8171 | uri,
8172 | mimeType: result.contentType,
8173 | text: JSON.stringify(result.data, null, 2),
8174 | },
8175 | ],
8176 | _meta: {
8177 | lastModified: result.lastModified,
8178 | etag: result.etag,
8179 | cacheKey: result.cacheKey,
8180 | },
8181 | };
8182 | }
8183 |
8184 | // Try routing first (handles templated resources)
8185 | if (resourceRouter.canRoute(uri)) {
8186 | const result = await resourceRouter.route(uri);
8187 |
8188 | return {
8189 | contents: [
8190 | {
8191 | uri,
8192 | mimeType: result.contentType,
8193 | text: JSON.stringify(result.data, null, 2),
8194 | },
8195 | ],
8196 | _meta: {
8197 | lastModified: result.lastModified,
8198 | etag: result.etag,
8199 | cacheKey: result.cacheKey,
8200 | },
8201 | };
8202 | }
8203 |
8204 | // Fall back to static resource handling
8205 | // Parse URI to determine resource type and parameters
8206 | const url = new globalThis.URL(uri);
8207 | const resourceType = url.pathname.replace('/', '');
8208 | const params = Object.fromEntries(url.searchParams.entries());
8209 |
8210 | switch (resourceType) {
8211 | case 'architectural_knowledge_graph': {
8212 | const { generateArchitecturalKnowledgeGraph } = await import('./resources/index.js');
8213 | const projectPath = params['projectPath'] || process.cwd();
8214 |
8215 | // Generate resource directly (caching is now handled through AI delegation)
8216 | const result = await generateArchitecturalKnowledgeGraph(projectPath);
8217 |
8218 | return {
8219 | contents: [
8220 | {
8221 | uri,
8222 | mimeType: result.contentType,
8223 | text: JSON.stringify(result.data, null, 2),
8224 | },
8225 | ],
8226 | };
8227 | }
8228 |
8229 | case 'analysis_report': {
8230 | const { generateAnalysisReport } = await import('./resources/index.js');
8231 | const projectPath = params['projectPath'] || process.cwd();
8232 | const focusAreas = params['focusAreas'] ? params['focusAreas'].split(',') : undefined;
8233 |
8234 | // Generate resource directly (caching is now handled through AI delegation)
8235 | const result = await generateAnalysisReport(projectPath, focusAreas);
8236 |
8237 | return {
8238 | contents: [
8239 | {
8240 | uri,
8241 | mimeType: result.contentType,
8242 | text: JSON.stringify(result.data, null, 2),
8243 | },
8244 | ],
8245 | };
8246 | }
8247 |
8248 | case 'adr_list': {
8249 | const { generateAdrList } = await import('./resources/index.js');
8250 | const { getAdrDirectoryPath } = await import('./utils/config.js');
8251 | const path = await import('path');
8252 |
8253 | // Use absolute ADR path relative to project
8254 | const absoluteAdrPath = params['adrDirectory']
8255 | ? path.resolve(this.config.projectPath, params['adrDirectory'])
8256 | : getAdrDirectoryPath(this.config);
8257 |
8258 | // Generate resource directly (caching is now handled through AI delegation)
8259 | const result = await generateAdrList(absoluteAdrPath, this.config.projectPath);
8260 |
8261 | return {
8262 | contents: [
8263 | {
8264 | uri,
8265 | mimeType: result.contentType,
8266 | text: JSON.stringify(result.data, null, 2),
8267 | },
8268 | ],
8269 | };
8270 | }
8271 |
8272 | case 'todo_list': {
8273 | const { generateTodoListResource } = await import('./resources/todo-list-resource.js');
8274 | const result = await generateTodoListResource();
8275 |
8276 | return {
8277 | contents: [
8278 | {
8279 | uri,
8280 | mimeType: result.contentType,
8281 | text: JSON.stringify(result.data, null, 2),
8282 | },
8283 | ],
8284 | _meta: {
8285 | lastModified: result.lastModified,
8286 | etag: result.etag,
8287 | cacheKey: result.cacheKey,
8288 | },
8289 | };
8290 | }
8291 |
8292 | case 'research_index': {
8293 | const { generateResearchIndexResource } =
8294 | await import('./resources/research-index-resource.js');
8295 | const result = await generateResearchIndexResource();
8296 |
8297 | return {
8298 | contents: [
8299 | {
8300 | uri,
8301 | mimeType: result.contentType,
8302 | text: JSON.stringify(result.data, null, 2),
8303 | },
8304 | ],
8305 | _meta: {
8306 | lastModified: result.lastModified,
8307 | etag: result.etag,
8308 | cacheKey: result.cacheKey,
8309 | },
8310 | };
8311 | }
8312 |
8313 | case 'rule_catalog': {
8314 | const { generateRuleCatalogResource } =
8315 | await import('./resources/rule-catalog-resource.js');
8316 | const result = await generateRuleCatalogResource();
8317 |
8318 | return {
8319 | contents: [
8320 | {
8321 | uri,
8322 | mimeType: result.contentType,
8323 | text: JSON.stringify(result.data, null, 2),
8324 | },
8325 | ],
8326 | _meta: {
8327 | lastModified: result.lastModified,
8328 | etag: result.etag,
8329 | cacheKey: result.cacheKey,
8330 | },
8331 | };
8332 | }
8333 |
8334 | case 'rule_generation': {
8335 | const { generateRuleGenerationResource } =
8336 | await import('./resources/rule-generation-resource.js');
8337 | const result = await generateRuleGenerationResource(undefined, url.searchParams);
8338 |
8339 | return {
8340 | contents: [
8341 | {
8342 | uri,
8343 | mimeType: result.contentType,
8344 | text: JSON.stringify(result.data, null, 2),
8345 | },
8346 | ],
8347 | _meta: {
8348 | lastModified: result.lastModified,
8349 | etag: result.etag,
8350 | cacheKey: result.cacheKey,
8351 | },
8352 | };
8353 | }
8354 |
8355 | case 'project_status': {
8356 | const { generateProjectStatusResource } =
8357 | await import('./resources/project-status-resource.js');
8358 | const result = await generateProjectStatusResource();
8359 |
8360 | return {
8361 | contents: [
8362 | {
8363 | uri,
8364 | mimeType: result.contentType,
8365 | text: JSON.stringify(result.data, null, 2),
8366 | },
8367 | ],
8368 | _meta: {
8369 | lastModified: result.lastModified,
8370 | etag: result.etag,
8371 | cacheKey: result.cacheKey,
8372 | },
8373 | };
8374 | }
8375 |
8376 | case 'deployment_status': {
8377 | const { generateDeploymentStatusResource } =
8378 | await import('./resources/deployment-status-resource.js');
8379 | const result = await generateDeploymentStatusResource(undefined, url.searchParams);
8380 |
8381 | return {
8382 | contents: [
8383 | {
8384 | uri,
8385 | mimeType: result.contentType,
8386 | text: JSON.stringify(result.data, null, 2),
8387 | },
8388 | ],
8389 | _meta: {
8390 | lastModified: result.lastModified,
8391 | etag: result.etag,
8392 | cacheKey: result.cacheKey,
8393 | },
8394 | };
8395 | }
8396 |
8397 | case 'environment_analysis': {
8398 | const { generateEnvironmentAnalysisResource } =
8399 | await import('./resources/environment-analysis-resource.js');
8400 | const result = await generateEnvironmentAnalysisResource(undefined, url.searchParams);
8401 |
8402 | return {
8403 | contents: [
8404 | {
8405 | uri,
8406 | mimeType: result.contentType,
8407 | text: JSON.stringify(result.data, null, 2),
8408 | },
8409 | ],
8410 | _meta: {
8411 | lastModified: result.lastModified,
8412 | etag: result.etag,
8413 | cacheKey: result.cacheKey,
8414 | },
8415 | };
8416 | }
8417 |
8418 | case 'memory_snapshots': {
8419 | const { generateMemorySnapshotsResource } =
8420 | await import('./resources/memory-snapshots-resource.js');
8421 | const result = await generateMemorySnapshotsResource(undefined, url.searchParams);
8422 |
8423 | return {
8424 | contents: [
8425 | {
8426 | uri,
8427 | mimeType: result.contentType,
8428 | text: JSON.stringify(result.data, null, 2),
8429 | },
8430 | ],
8431 | _meta: {
8432 | lastModified: result.lastModified,
8433 | etag: result.etag,
8434 | cacheKey: result.cacheKey,
8435 | },
8436 | };
8437 | }
8438 |
8439 | case 'project_metrics': {
8440 | const { generateProjectMetricsResource } =
8441 | await import('./resources/project-metrics-resource.js');
8442 | const result = await generateProjectMetricsResource();
8443 |
8444 | return {
8445 | contents: [
8446 | {
8447 | uri,
8448 | mimeType: result.contentType,
8449 | text: JSON.stringify(result.data, null, 2),
8450 | },
8451 | ],
8452 | _meta: {
8453 | lastModified: result.lastModified,
8454 | etag: result.etag,
8455 | cacheKey: result.cacheKey,
8456 | },
8457 | };
8458 | }
8459 |
8460 | case 'deployment_history': {
8461 | const { generateDeploymentHistoryResource } =
8462 | await import('./resources/deployment-history-resource.js');
8463 | const result = await generateDeploymentHistoryResource(undefined, url.searchParams);
8464 |
8465 | return {
8466 | contents: [
8467 | {
8468 | uri,
8469 | mimeType: result.contentType,
8470 | text: JSON.stringify(result.data, null, 2),
8471 | },
8472 | ],
8473 | _meta: {
8474 | lastModified: result.lastModified,
8475 | etag: result.etag,
8476 | cacheKey: result.cacheKey,
8477 | },
8478 | };
8479 | }
8480 |
8481 | case 'code_quality': {
8482 | const { generateCodeQualityResource } =
8483 | await import('./resources/code-quality-resource.js');
8484 | const result = await generateCodeQualityResource(undefined, url.searchParams);
8485 |
8486 | return {
8487 | contents: [
8488 | {
8489 | uri,
8490 | mimeType: result.contentType,
8491 | text: JSON.stringify(result.data, null, 2),
8492 | },
8493 | ],
8494 | _meta: {
8495 | lastModified: result.lastModified,
8496 | etag: result.etag,
8497 | cacheKey: result.cacheKey,
8498 | },
8499 | };
8500 | }
8501 |
8502 | case 'validated_patterns': {
8503 | const { generateValidatedPatternsCatalogResource } =
8504 | await import('./resources/validated-patterns-catalog-resource.js');
8505 | const result = await generateValidatedPatternsCatalogResource();
8506 |
8507 | return {
8508 | contents: [
8509 | {
8510 | uri,
8511 | mimeType: result.contentType,
8512 | text: JSON.stringify(result.data, null, 2),
8513 | },
8514 | ],
8515 | _meta: {
8516 | lastModified: result.lastModified,
8517 | etag: result.etag,
8518 | cacheKey: result.cacheKey,
8519 | },
8520 | };
8521 | }
8522 |
8523 | default:
8524 | throw new McpAdrError(`Unknown resource type: ${resourceType}`, 'UNKNOWN_RESOURCE');
8525 | }
8526 | } catch (error) {
8527 | if (error instanceof McpAdrError) {
8528 | throw error;
8529 | }
8530 | throw new McpAdrError(
8531 | `Failed to read resource: ${error instanceof Error ? error.message : String(error)}`,
8532 | 'RESOURCE_ERROR'
8533 | );
8534 | }
8535 | }
8536 |
8537 | /**
8538 | * Start the server
8539 | */
8540 | async start(): Promise<void> {
8541 | // Validate configuration before starting
8542 | await this.validateConfiguration();
8543 |
8544 | // Initialize memory entity manager
8545 | await this.memoryEntityManager.initialize();
8546 | this.logger.info('Memory Entity Manager initialized', 'McpAdrAnalysisServer');
8547 |
8548 | // Initialize conversation memory manager (Phase 3: Structured External Memory)
8549 | await this.conversationMemoryManager.initialize();
8550 | this.logger.info('Phase 3 (Structured External Memory) initialized', 'McpAdrAnalysisServer');
8551 |
8552 | // Generate initial server context file
8553 | try {
8554 | await this.contextGenerator.writeContextFile(
8555 | this.kgManager,
8556 | this.memoryEntityManager,
8557 | this.conversationMemoryManager
8558 | );
8559 | this.logger.info(
8560 | 'Server context file generated at .mcp-server-context.md',
8561 | 'McpAdrAnalysisServer'
8562 | );
8563 | } catch (error) {
8564 | this.logger.warn('Failed to generate initial server context file', 'McpAdrAnalysisServer', {
8565 | error: error instanceof Error ? error.message : String(error),
8566 | });
8567 | }
8568 |
8569 | const transport = new StdioServerTransport();
8570 | await this.server.connect(transport);
8571 |
8572 | // Keep the process alive
8573 | process.on('SIGINT', async () => {
8574 | await this.server.close();
8575 | process.exit(0);
8576 | });
8577 | }
8578 |
8579 | /**
8580 | * File system tool implementations
8581 | */
8582 |
8583 | /**
8584 | * List accessible roots (MCP best practice)
8585 | */
8586 | private async listRoots(): Promise<CallToolResult> {
8587 | const roots = this.rootManager.listRoots();
8588 |
8589 | const rootsList = roots
8590 | .map(r => `### ${r.name}\n\n**Path**: \`${r.path}\`\n\n**Description**: ${r.description}\n`)
8591 | .join('\n');
8592 |
8593 | return {
8594 | content: [
8595 | {
8596 | type: 'text',
8597 | text: `# Available File System Roots\n\nThese are the directories that can be accessed by this MCP server.\n\n${rootsList}\nUse these paths with \`read_directory\` and \`read_file\` tools to explore and access files.`,
8598 | },
8599 | ],
8600 | };
8601 | }
8602 |
8603 | /**
8604 | * Read directory contents (MCP best practice for autonomous file discovery)
8605 | */
8606 | private async readDirectory(args: { path?: string }): Promise<CallToolResult> {
8607 | const targetPath = args.path || this.config.projectPath;
8608 |
8609 | try {
8610 | const path = await import('path');
8611 | const resolvedPath = path.resolve(targetPath);
8612 |
8613 | // Security check: ensure path is within accessible roots
8614 | if (!this.rootManager.isPathAllowed(resolvedPath)) {
8615 | const roots = this.rootManager.listRoots();
8616 | const rootList = roots.map(r => ` - ${r.name}: ${r.path}`).join('\n');
8617 |
8618 | throw new McpAdrError(
8619 | `Access denied: Path '${targetPath}' is outside accessible roots.\n\nAccessible roots:\n${rootList}\n\nUse list_roots tool for more details.`,
8620 | 'ACCESS_DENIED'
8621 | );
8622 | }
8623 |
8624 | const { readdir } = await import('fs/promises');
8625 | const entries = await readdir(resolvedPath, { withFileTypes: true });
8626 |
8627 | const files = entries.filter(e => e.isFile()).map(e => `📄 ${e.name}`);
8628 |
8629 | const dirs = entries.filter(e => e.isDirectory()).map(e => `📁 ${e.name}/`);
8630 |
8631 | const root = this.rootManager.getRootForPath(resolvedPath);
8632 | const relPath = this.rootManager.getRelativePathFromRoot(resolvedPath);
8633 |
8634 | const filesList = files.length > 0 ? files.join('\n') : '(no files)';
8635 | const dirsList = dirs.length > 0 ? dirs.join('\n') : '(no directories)';
8636 |
8637 | return {
8638 | content: [
8639 | {
8640 | type: 'text',
8641 | text: `# Directory: ${targetPath}\n\n**Root**: ${root?.name}\n**Relative Path**: ${relPath || '/'}\n**Full Path**: \`${resolvedPath}\`\n\n## Directories (${dirs.length})\n\n${dirsList}\n\n## Files (${files.length})\n\n${filesList}`,
8642 | },
8643 | ],
8644 | };
8645 | } catch (error) {
8646 | throw new McpAdrError(
8647 | `Failed to read directory: ${error instanceof Error ? error.message : String(error)}`,
8648 | 'DIRECTORY_READ_ERROR'
8649 | );
8650 | }
8651 | }
8652 |
8653 | private async readFile(args: ReadFileArgs): Promise<CallToolResult> {
8654 | const { filePath } = args;
8655 |
8656 | try {
8657 | const fs = await import('fs/promises');
8658 | const path = await import('path');
8659 |
8660 | // Resolve path (handle both relative and absolute paths)
8661 | const safePath = path.resolve(filePath);
8662 |
8663 | // Security check: ensure path is within accessible roots
8664 | if (!this.rootManager.isPathAllowed(safePath)) {
8665 | const roots = this.rootManager.listRoots();
8666 | const rootList = roots.map(r => ` - ${r.name}: ${r.path}`).join('\n');
8667 |
8668 | throw new McpAdrError(
8669 | `Access denied: Path '${filePath}' is outside accessible roots.\n\nAccessible roots:\n${rootList}\n\nUse list_roots tool for more details.`,
8670 | 'ACCESS_DENIED'
8671 | );
8672 | }
8673 |
8674 | const content = await fs.readFile(safePath, 'utf-8');
8675 |
8676 | return {
8677 | content: [
8678 | {
8679 | type: 'text',
8680 | text: content,
8681 | },
8682 | ],
8683 | };
8684 | } catch (error) {
8685 | throw new McpAdrError(
8686 | `Failed to read file: ${error instanceof Error ? error.message : String(error)}`,
8687 | 'FILE_READ_ERROR'
8688 | );
8689 | }
8690 | }
8691 |
8692 | private async writeFile(args: WriteFileArgs): Promise<CallToolResult> {
8693 | const { filePath, content } = args;
8694 |
8695 | try {
8696 | const fs = await import('fs/promises');
8697 | const path = await import('path');
8698 |
8699 | // Resolve path relative to project path for security
8700 | const safePath = path.resolve(this.config.projectPath, filePath);
8701 |
8702 | // Security check: ensure path is within project directory
8703 | if (!safePath.startsWith(this.config.projectPath)) {
8704 | throw new McpAdrError('Access denied: Path is outside project directory', 'ACCESS_DENIED');
8705 | }
8706 |
8707 | // Ensure directory exists
8708 | await fs.mkdir(path.dirname(safePath), { recursive: true });
8709 |
8710 | // Write file
8711 | await fs.writeFile(safePath, content, 'utf-8');
8712 |
8713 | return {
8714 | content: [
8715 | {
8716 | type: 'text',
8717 | text: `Successfully wrote to ${filePath}`,
8718 | },
8719 | ],
8720 | };
8721 | } catch (error) {
8722 | throw new McpAdrError(
8723 | `Failed to write file: ${error instanceof Error ? error.message : String(error)}`,
8724 | 'FILE_WRITE_ERROR'
8725 | );
8726 | }
8727 | }
8728 |
8729 | private async listDirectory(args: Record<string, unknown>): Promise<CallToolResult> {
8730 | const { path: dirPath } = args;
8731 |
8732 | try {
8733 | const fs = await import('fs/promises');
8734 | const path = await import('path');
8735 |
8736 | // Resolve path relative to project path for security
8737 | const safePath = path.resolve(this.config.projectPath, dirPath as string);
8738 |
8739 | // Security check: ensure path is within project directory
8740 | if (!safePath.startsWith(this.config.projectPath)) {
8741 | throw new McpAdrError('Access denied: Path is outside project directory', 'ACCESS_DENIED');
8742 | }
8743 |
8744 | const entries = await fs.readdir(safePath, { withFileTypes: true });
8745 | const fileList = entries.map(entry => ({
8746 | name: entry.name,
8747 | type: entry.isDirectory() ? 'directory' : 'file',
8748 | path: path.join(dirPath as string, entry.name),
8749 | }));
8750 |
8751 | return {
8752 | content: [
8753 | {
8754 | type: 'text',
8755 | text: JSON.stringify(fileList, null, 2),
8756 | },
8757 | ],
8758 | };
8759 | } catch (error) {
8760 | throw new McpAdrError(
8761 | `Failed to list directory: ${error instanceof Error ? error.message : String(error)}`,
8762 | 'DIRECTORY_LIST_ERROR'
8763 | );
8764 | }
8765 | }
8766 |
8767 | private async generateDeploymentGuidance(args: Record<string, unknown>): Promise<CallToolResult> {
8768 | try {
8769 | const { generateDeploymentGuidance } = await import('./tools/deployment-guidance-tool.js');
8770 | return await generateDeploymentGuidance(args);
8771 | } catch (error) {
8772 | throw new McpAdrError(
8773 | `Deployment guidance generation failed: ${error instanceof Error ? error.message : String(error)}`,
8774 | 'DEPLOYMENT_GUIDANCE_ERROR'
8775 | );
8776 | }
8777 | }
8778 |
8779 | private async smartGitPush(args: Record<string, unknown>): Promise<CallToolResult> {
8780 | try {
8781 | const { smartGitPush } = await import('./tools/smart-git-push-tool-v2.js');
8782 | return await smartGitPush(args);
8783 | } catch (error) {
8784 | throw new McpAdrError(
8785 | `Smart git push failed: ${error instanceof Error ? error.message : String(error)}`,
8786 | 'SMART_GIT_PUSH_ERROR'
8787 | );
8788 | }
8789 | }
8790 |
8791 | private async deploymentReadiness(args: Record<string, unknown>): Promise<CallToolResult> {
8792 | try {
8793 | const { deploymentReadiness } = await import('./tools/deployment-readiness-tool.js');
8794 | return await deploymentReadiness(args);
8795 | } catch (error) {
8796 | throw new McpAdrError(
8797 | `Deployment readiness check failed: ${error instanceof Error ? error.message : String(error)}`,
8798 | 'DEPLOYMENT_READINESS_ERROR'
8799 | );
8800 | }
8801 | }
8802 |
8803 | private async troubleshootGuidedWorkflow(args: Record<string, unknown>): Promise<CallToolResult> {
8804 | try {
8805 | const { troubleshootGuidedWorkflow } =
8806 | await import('./tools/troubleshoot-guided-workflow-tool.js');
8807 | return await troubleshootGuidedWorkflow(args as unknown as TodoManagementV2Args);
8808 | } catch (error) {
8809 | throw new McpAdrError(
8810 | `Troubleshoot guided workflow failed: ${error instanceof Error ? error.message : String(error)}`,
8811 | 'TROUBLESHOOT_GUIDED_WORKFLOW_ERROR'
8812 | );
8813 | }
8814 | }
8815 |
8816 | private async smartScore(_args: Record<string, unknown>): Promise<CallToolResult> {
8817 | // Smart score tool was removed - return deprecation message
8818 | return {
8819 | content: [
8820 | {
8821 | type: 'text',
8822 | text: `⚠️ **Smart Score Tool Deprecated**
8823 |
8824 | This tool has been deprecated and replaced with memory-centric health scoring.
8825 |
8826 | **Replacement:** The new MemoryHealthScoring system tracks:
8827 | - Memory quality and relevance
8828 | - Retrieval performance
8829 | - Entity relationship coherence
8830 | - Context utilization
8831 | - Decision alignment
8832 |
8833 | **Migration:** Health scoring is now integrated into the knowledge graph and automatically calculated based on memory usage patterns.`,
8834 | },
8835 | ],
8836 | isError: false,
8837 | };
8838 | }
8839 |
8840 | private async mcpPlanning(args: Record<string, unknown>): Promise<CallToolResult> {
8841 | try {
8842 | const { mcpPlanning } = await import('./tools/mcp-planning-tool.js');
8843 | return await mcpPlanning(args);
8844 | } catch (error) {
8845 | throw new McpAdrError(
8846 | `MCP planning failed: ${error instanceof Error ? error.message : String(error)}`,
8847 | 'MCP_PLANNING_ERROR'
8848 | );
8849 | }
8850 | }
8851 |
8852 | private async memoryLoading(args: Record<string, unknown>): Promise<CallToolResult> {
8853 | try {
8854 | const { MemoryLoadingTool } = await import('./tools/memory-loading-tool.js');
8855 | const memoryTool = new MemoryLoadingTool();
8856 | return await memoryTool.execute(args);
8857 | } catch (error) {
8858 | throw new McpAdrError(
8859 | `Memory loading failed: ${error instanceof Error ? error.message : String(error)}`,
8860 | 'MEMORY_LOADING_ERROR'
8861 | );
8862 | }
8863 | }
8864 |
8865 | private async expandAnalysisSection(args: Record<string, unknown>): Promise<CallToolResult> {
8866 | try {
8867 | const { expandAnalysisSection } = await import('./tools/expand-analysis-tool.js');
8868 | return await expandAnalysisSection(args as any);
8869 | } catch (error) {
8870 | throw new McpAdrError(
8871 | `Failed to expand analysis: ${error instanceof Error ? error.message : String(error)}`,
8872 | 'EXPAND_ANALYSIS_ERROR'
8873 | );
8874 | }
8875 | }
8876 |
8877 | private async interactiveAdrPlanning(args: Record<string, unknown>): Promise<CallToolResult> {
8878 | try {
8879 | const { interactiveAdrPlanning } = await import('./tools/interactive-adr-planning-tool.js');
8880 | return await interactiveAdrPlanning(args);
8881 | } catch (error) {
8882 | throw new McpAdrError(
8883 | `Interactive ADR planning failed: ${error instanceof Error ? error.message : String(error)}`,
8884 | 'INTERACTIVE_ADR_PLANNING_ERROR'
8885 | );
8886 | }
8887 | }
8888 |
8889 | /**
8890 | * Tool chain orchestrator implementation
8891 | */
8892 | private async toolChainOrchestrator(args: ToolChainOrchestratorArgs): Promise<CallToolResult> {
8893 | try {
8894 | const { toolChainOrchestrator } = await import('./tools/tool-chain-orchestrator.js');
8895 | return await toolChainOrchestrator(args as any);
8896 | } catch (error) {
8897 | throw new McpAdrError(
8898 | `Tool chain orchestration failed: ${error instanceof Error ? error.message : String(error)}`,
8899 | 'TOOL_CHAIN_ORCHESTRATOR_ERROR'
8900 | );
8901 | }
8902 | }
8903 |
8904 | /**
8905 | * Phase 3: Expand Memory Tool
8906 | * Retrieves and expands stored content from tiered responses
8907 | */
8908 | private async expandMemory(args: any): Promise<CallToolResult> {
8909 | try {
8910 | const { expandMemory } = await import('./tools/conversation-memory-tool.js');
8911 | return await expandMemory(args, this.conversationMemoryManager);
8912 | } catch (error) {
8913 | throw new McpAdrError(
8914 | `Memory expansion failed: ${error instanceof Error ? error.message : String(error)}`,
8915 | 'MEMORY_EXPANSION_ERROR'
8916 | );
8917 | }
8918 | }
8919 |
8920 | /**
8921 | * Phase 3: Query Conversation History Tool
8922 | * Searches and retrieves conversation sessions
8923 | */
8924 | private async queryConversationHistory(args: any): Promise<CallToolResult> {
8925 | try {
8926 | const { queryConversationHistory } = await import('./tools/conversation-memory-tool.js');
8927 | return await queryConversationHistory(args, this.conversationMemoryManager);
8928 | } catch (error) {
8929 | throw new McpAdrError(
8930 | `Conversation history query failed: ${error instanceof Error ? error.message : String(error)}`,
8931 | 'CONVERSATION_QUERY_ERROR'
8932 | );
8933 | }
8934 | }
8935 |
8936 | /**
8937 | * Phase 3: Get Conversation Snapshot Tool
8938 | * Retrieves current conversation context
8939 | */
8940 | private async getConversationSnapshot(args: any): Promise<CallToolResult> {
8941 | try {
8942 | const { getConversationSnapshot } = await import('./tools/conversation-memory-tool.js');
8943 | return await getConversationSnapshot(args, this.conversationMemoryManager);
8944 | } catch (error) {
8945 | throw new McpAdrError(
8946 | `Conversation snapshot retrieval failed: ${error instanceof Error ? error.message : String(error)}`,
8947 | 'SNAPSHOT_ERROR'
8948 | );
8949 | }
8950 | }
8951 |
8952 | /**
8953 | * Phase 3: Get Memory Statistics Tool
8954 | * Retrieves conversation memory statistics
8955 | */
8956 | private async getMemoryStats(): Promise<CallToolResult> {
8957 | try {
8958 | const { getMemoryStats } = await import('./tools/conversation-memory-tool.js');
8959 | return await getMemoryStats(this.conversationMemoryManager);
8960 | } catch (error) {
8961 | throw new McpAdrError(
8962 | `Memory stats retrieval failed: ${error instanceof Error ? error.message : String(error)}`,
8963 | 'MEMORY_STATS_ERROR'
8964 | );
8965 | }
8966 | }
8967 |
8968 | /**
8969 | * Update Knowledge Tool (ADR-018)
8970 | * Simple CRUD operations for knowledge graph
8971 | */
8972 | private async updateKnowledge(args: any): Promise<CallToolResult> {
8973 | try {
8974 | const { updateKnowledge } = await import('./tools/update-knowledge-tool.js');
8975 | return await updateKnowledge(args, createNoOpContext(), this.kgManager);
8976 | } catch (error) {
8977 | throw new McpAdrError(
8978 | `Knowledge update failed: ${error instanceof Error ? error.message : String(error)}`,
8979 | 'KNOWLEDGE_UPDATE_ERROR'
8980 | );
8981 | }
8982 | }
8983 |
8984 | /**
8985 | * Get Server Context Tool
8986 | * Generates comprehensive server context file for LLM @ referencing
8987 | */
8988 | private async getServerContext(args: any): Promise<CallToolResult> {
8989 | try {
8990 | const { getServerContext } = await import('./tools/get-server-context-tool.js');
8991 | return await getServerContext(
8992 | args,
8993 | this.kgManager,
8994 | this.memoryEntityManager,
8995 | this.conversationMemoryManager
8996 | );
8997 | } catch (error) {
8998 | throw new McpAdrError(
8999 | `Server context generation failed: ${error instanceof Error ? error.message : String(error)}`,
9000 | 'SERVER_CONTEXT_ERROR'
9001 | );
9002 | }
9003 | }
9004 |
9005 | /**
9006 | * Get Current Datetime Tool
9007 | * Returns the current date and time in various formats for ADR generation and timestamping
9008 | */
9009 | private async getCurrentDatetime(args: {
9010 | timezone?: string;
9011 | format?: 'iso' | 'human' | 'adr' | 'all';
9012 | includeTimestamp?: boolean;
9013 | }): Promise<CallToolResult> {
9014 | const { timezone = 'UTC', format = 'all', includeTimestamp = true } = args;
9015 |
9016 | try {
9017 | const now = new Date();
9018 |
9019 | // Format date for different timezones
9020 | const formatOptions: Intl.DateTimeFormatOptions = {
9021 | timeZone: timezone,
9022 | year: 'numeric',
9023 | month: '2-digit',
9024 | day: '2-digit',
9025 | hour: '2-digit',
9026 | minute: '2-digit',
9027 | second: '2-digit',
9028 | hour12: false,
9029 | };
9030 |
9031 | // Get date parts for the specified timezone
9032 | const formatter = new Intl.DateTimeFormat('en-CA', {
9033 | timeZone: timezone,
9034 | year: 'numeric',
9035 | month: '2-digit',
9036 | day: '2-digit',
9037 | });
9038 | const parts = formatter.formatToParts(now);
9039 | const year = parts.find(p => p.type === 'year')?.value || '';
9040 | const month = parts.find(p => p.type === 'month')?.value || '';
9041 | const day = parts.find(p => p.type === 'day')?.value || '';
9042 |
9043 | // ADR date format: YYYY-MM-DD
9044 | const adrDate = `${year}-${month}-${day}`;
9045 |
9046 | // ISO 8601 format
9047 | const isoDate = now.toISOString();
9048 |
9049 | // Human-readable format
9050 | const humanFormatter = new Intl.DateTimeFormat('en-US', {
9051 | ...formatOptions,
9052 | weekday: 'long',
9053 | month: 'long',
9054 | });
9055 | const humanDate = humanFormatter.format(now);
9056 |
9057 | // Build response based on requested format
9058 | let responseData: Record<string, string | number> = {};
9059 |
9060 | switch (format) {
9061 | case 'iso':
9062 | responseData = { iso: isoDate };
9063 | break;
9064 | case 'human':
9065 | responseData = { human: humanDate };
9066 | break;
9067 | case 'adr':
9068 | responseData = { adr: adrDate };
9069 | break;
9070 | case 'all':
9071 | default:
9072 | responseData = {
9073 | iso: isoDate,
9074 | human: humanDate,
9075 | adr: adrDate,
9076 | timezone: timezone,
9077 | };
9078 | }
9079 |
9080 | if (includeTimestamp) {
9081 | responseData['timestamp'] = now.getTime();
9082 | }
9083 |
9084 | const responseText = `# Current Date and Time
9085 |
9086 | ## Formats
9087 | ${format === 'all' || format === 'iso' ? `- **ISO 8601**: ${isoDate}` : ''}
9088 | ${format === 'all' || format === 'human' ? `- **Human Readable**: ${humanDate}` : ''}
9089 | ${format === 'all' || format === 'adr' ? `- **ADR Date (YYYY-MM-DD)**: ${adrDate}` : ''}
9090 | ${format === 'all' ? `- **Timezone**: ${timezone}` : ''}
9091 | ${includeTimestamp ? `- **Unix Timestamp (ms)**: ${now.getTime()}` : ''}
9092 |
9093 | ## Usage for ADR Generation
9094 |
9095 | When generating ADRs, use the ADR date format (\`${adrDate}\`) in the Date field:
9096 |
9097 | \`\`\`markdown
9098 | # ADR-XXXX: [Title]
9099 |
9100 | ## Date
9101 | ${adrDate}
9102 |
9103 | ## Status
9104 | Proposed
9105 | \`\`\`
9106 |
9107 | ## Raw Data
9108 |
9109 | \`\`\`json
9110 | ${JSON.stringify(responseData, null, 2)}
9111 | \`\`\`
9112 | `;
9113 |
9114 | return {
9115 | content: [
9116 | {
9117 | type: 'text',
9118 | text: responseText,
9119 | },
9120 | ],
9121 | };
9122 | } catch (error) {
9123 | throw new McpAdrError(
9124 | `Failed to get current datetime: ${error instanceof Error ? error.message : String(error)}`,
9125 | 'DATETIME_ERROR'
9126 | );
9127 | }
9128 | }
9129 |
9130 | /**
9131 | * Set Project Path Tool - Dynamic Session Configuration
9132 | *
9133 | * @description Dynamically sets the active project path for the current session.
9134 | * This allows switching between projects without restarting the server or modifying
9135 | * environment variables. Updates both the config and the RootManager.
9136 | *
9137 | * @param args - Set project path arguments
9138 | * @param args.path - Absolute path to the project directory
9139 | * @param args.validatePath - Whether to validate the path exists (default: true)
9140 | * @returns Promise<CallToolResult> - Confirmation of the path change
9141 | */
9142 | private async setProjectPath(args: {
9143 | path: string;
9144 | validatePath?: boolean;
9145 | }): Promise<CallToolResult> {
9146 | const { path: newPath, validatePath = true } = args;
9147 | const { resolve } = await import('path');
9148 |
9149 | try {
9150 | // Resolve to absolute path
9151 | const absolutePath = resolve(newPath);
9152 | const previousPath = this.config.projectPath;
9153 |
9154 | // Validate the path if requested
9155 | if (validatePath) {
9156 | await validateProjectPath(absolutePath);
9157 | }
9158 |
9159 | // Update the server configuration
9160 | this.config.projectPath = absolutePath;
9161 |
9162 | // Re-initialize the RootManager with the new path
9163 | this.rootManager = new RootManager(absolutePath, this.config.adrDirectory);
9164 |
9165 | this.logger.info(`Project path changed: ${previousPath} -> ${absolutePath}`);
9166 |
9167 | const responseText = `# Project Path Updated
9168 |
9169 | ## Configuration
9170 | - **Previous Path**: \`${previousPath}\`
9171 | - **New Path**: \`${absolutePath}\`
9172 | - **ADR Directory**: \`${this.config.adrDirectory}\`
9173 | - **Full ADR Path**: \`${resolve(absolutePath, this.config.adrDirectory)}\`
9174 |
9175 | ## Status
9176 | ✅ Project path successfully updated for this session.
9177 |
9178 | ## Note
9179 | All subsequent tool calls will use this path as the default project path.
9180 | You can still override it per-tool by passing \`projectPath\` as an argument.
9181 |
9182 | To make this permanent, set the \`PROJECT_PATH\` environment variable.
9183 | `;
9184 |
9185 | return {
9186 | content: [
9187 | {
9188 | type: 'text',
9189 | text: responseText,
9190 | },
9191 | ],
9192 | };
9193 | } catch (error) {
9194 | throw new McpAdrError(
9195 | `Failed to set project path: ${error instanceof Error ? error.message : String(error)}`,
9196 | 'SET_PROJECT_PATH_ERROR'
9197 | );
9198 | }
9199 | }
9200 |
9201 | /**
9202 | * Load Prompt Tool - CE-MCP Phase 4 Lazy Loading
9203 | *
9204 | * @description Loads prompts on-demand instead of eagerly loading all prompts at startup.
9205 | * This reduces token usage by ~96% (from 28K tokens to ~1K on-demand).
9206 | *
9207 | * @param args - Load prompt arguments
9208 | * @param args.promptName - Name of the prompt to load
9209 | * @param args.section - Optional section within the prompt
9210 | * @param args.estimateOnly - If true, returns only token estimate
9211 | * @returns Promise<CallToolResult> - Loaded prompt content or estimate
9212 | */
9213 | private async loadPrompt(args: {
9214 | promptName: string;
9215 | section?: string;
9216 | estimateOnly?: boolean;
9217 | }): Promise<CallToolResult> {
9218 | const { promptName, section, estimateOnly = false } = args;
9219 |
9220 | // Import the prompt catalog dynamically to enable lazy loading
9221 | const { getPromptLoader, getPromptMetadata, calculateTokenSavings } =
9222 | await import('./prompts/prompt-catalog.js');
9223 |
9224 | const metadata = getPromptMetadata(promptName);
9225 |
9226 | if (!metadata) {
9227 | const availablePrompts = [
9228 | 'adr-suggestion',
9229 | 'deployment-analysis',
9230 | 'environment-analysis',
9231 | 'research-question',
9232 | 'rule-generation',
9233 | 'analysis',
9234 | 'research-integration',
9235 | 'validated-pattern',
9236 | 'security',
9237 | ];
9238 |
9239 | return {
9240 | content: [
9241 | {
9242 | type: 'text',
9243 | text: JSON.stringify(
9244 | {
9245 | success: false,
9246 | error: `Unknown prompt: ${promptName}`,
9247 | availablePrompts,
9248 | hint: 'Use one of the available prompt names listed above',
9249 | },
9250 | null,
9251 | 2
9252 | ),
9253 | },
9254 | ],
9255 | isError: true,
9256 | };
9257 | }
9258 |
9259 | // If estimate only, return token information without loading
9260 | if (estimateOnly) {
9261 | const loader = getPromptLoader();
9262 | const estimatedTokens = loader.getEstimatedTokens(promptName, section);
9263 | const savings = calculateTokenSavings([promptName]);
9264 |
9265 | return {
9266 | content: [
9267 | {
9268 | type: 'text',
9269 | text: JSON.stringify(
9270 | {
9271 | success: true,
9272 | promptName,
9273 | section: section || 'full',
9274 | estimatedTokens,
9275 | metadata: {
9276 | file: metadata.file,
9277 | category: metadata.category,
9278 | totalTokens: metadata.tokens,
9279 | availableSections: metadata.sections,
9280 | loadOnDemand: metadata.loadOnDemand,
9281 | },
9282 | tokenSavings: {
9283 | loaded: savings.loaded,
9284 | total: savings.total,
9285 | saved: savings.saved,
9286 | percentage: `${savings.percentage}%`,
9287 | },
9288 | },
9289 | null,
9290 | 2
9291 | ),
9292 | },
9293 | ],
9294 | };
9295 | }
9296 |
9297 | // Load the prompt content
9298 | try {
9299 | const loader = getPromptLoader();
9300 | const content = await loader.loadPrompt(promptName, section);
9301 |
9302 | return {
9303 | content: [
9304 | {
9305 | type: 'text',
9306 | text: `# Loaded Prompt: ${promptName}${section ? ` (section: ${section})` : ''}
9307 |
9308 | ## Metadata
9309 | - **Category**: ${metadata.category}
9310 | - **Estimated Tokens**: ${metadata.tokens}
9311 | - **Available Sections**: ${metadata.sections.join(', ')}
9312 |
9313 | ## Content
9314 |
9315 | ${content}
9316 |
9317 | ---
9318 |
9319 | *Loaded on-demand via CE-MCP lazy loading system. Token savings: ~96% compared to eager loading all prompts.*
9320 | `,
9321 | },
9322 | ],
9323 | };
9324 | } catch (error) {
9325 | throw new McpAdrError(
9326 | `Failed to load prompt '${promptName}'${section ? ` section '${section}'` : ''}: ${
9327 | error instanceof Error ? error.message : String(error)
9328 | }`,
9329 | 'PROMPT_LOAD_ERROR'
9330 | );
9331 | }
9332 | }
9333 | }
9334 |
9335 | /**
9336 | * Main execution function for the MCP ADR Analysis Server
9337 | *
9338 | * @description Initializes and starts the MCP server with proper configuration,
9339 | * error handling, and graceful shutdown. Handles command line arguments for
9340 | * help, version, and test modes.
9341 | *
9342 | * @returns {Promise<void>} Resolves when server shuts down gracefully
9343 | *
9344 | * @throws {Error} When server initialization fails or configuration is invalid
9345 | *
9346 | * @example
9347 | * ```typescript
9348 | * // Start the server (typically called from CLI)
9349 | * await main();
9350 | * ```
9351 | *
9352 | * @since 1.0.0
9353 | * @category Main
9354 | */
9355 | async function main(): Promise<void> {
9356 | const args = process.argv.slice(2);
9357 |
9358 | // Handle command line arguments
9359 | if (args.includes('--help') || args.includes('-h')) {
9360 | console.log(`
9361 | MCP ADR Analysis Server v${SERVER_INFO.version}
9362 |
9363 | Usage: mcp-adr-analysis-server [options]
9364 |
9365 | Options:
9366 | --help, -h Show this help message
9367 | --version, -v Show version information
9368 | --test Run health check and exit
9369 | --config Show configuration and exit
9370 |
9371 | Environment Variables:
9372 | PROJECT_PATH Path to project directory (default: current directory)
9373 | ADR_DIRECTORY ADR directory relative to project (default: docs/adrs)
9374 | LOG_LEVEL Logging level: DEBUG, INFO, WARN, ERROR (default: INFO)
9375 | CACHE_ENABLED Enable caching: true, false (default: true)
9376 |
9377 | Examples:
9378 | mcp-adr-analysis-server # Start MCP server
9379 | PROJECT_PATH=/path/to/project mcp-adr-analysis-server
9380 | mcp-adr-analysis-server --test # Health check
9381 | `);
9382 | process.exit(0);
9383 | }
9384 |
9385 | if (args.includes('--version') || args.includes('-v')) {
9386 | console.log(`MCP ADR Analysis Server v${SERVER_INFO.version}`);
9387 | process.exit(0);
9388 | }
9389 |
9390 | try {
9391 | const server = new McpAdrAnalysisServer();
9392 |
9393 | if (args.includes('--test')) {
9394 | console.log('🔍 Running health check...');
9395 | await server.healthCheck();
9396 | console.log('✅ Health check passed - server can start successfully');
9397 | process.exit(0);
9398 | }
9399 |
9400 | if (args.includes('--config')) {
9401 | console.log('📋 Server configuration validated');
9402 | process.exit(0);
9403 | }
9404 |
9405 | // Normal server startup
9406 | await server.start();
9407 | } catch (error) {
9408 | console.error('❌ MCP server failed to start');
9409 | console.error('Error:', error instanceof Error ? error.message : String(error));
9410 | process.exit(1);
9411 | }
9412 | }
9413 |
9414 | // Start the server if this file is run directly
9415 | // Jest-compatible check: avoid import.meta.url which Jest cannot handle
9416 | // Handle both direct execution and npm global package symlinks
9417 | if (
9418 | process.argv[1] &&
9419 | (process.argv[1].endsWith('index.js') ||
9420 | process.argv[1].endsWith('index.ts') ||
9421 | process.argv[1].endsWith('mcp-adr-analysis-server'))
9422 | ) {
9423 | main().catch(error => {
9424 | console.error('Unhandled error:', error);
9425 | process.exit(1);
9426 | });
9427 | }
9428 | // Test comment for pre-commit hook
9429 |
```