{"_id":"@lushly-dev/afd-server","_rev":"16-d8eb2b8b1a717b95e28638c683860d9f","name":"@lushly-dev/afd-server","dist-tags":{"latest":"2.5.0"},"versions":{"0.1.0":{"name":"@lushly-dev/afd-server","version":"0.1.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"license":"MIT","_id":"@lushly-dev/afd-server@0.1.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"dist":{"shasum":"6a55733df6e1b111b37d6f8f13b468d6f0302f72","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-0.1.0.tgz","fileCount":43,"integrity":"sha512-YccdRaOWLLEMTOSznFB+oUhDomKbmqpE4TR8Hve7lc8fPtaTXHnAvk0Hc8us2uBT3NiacY3F+FYx8TDPBbSHrA==","signatures":[{"sig":"MEQCIBE4F4RB3TTTgNP8WqypICr5HATW8VEnrazpRJofcV7jAiBh4BFcxOnePmlGU2Ttt00CO4lhyCntK6+15jNm6ypzLw==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":160710},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-0.1.0.tgz","types":"./dist/index.d.ts","module":"./dist/index.js","exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"lushly-admin","email":"falkicon@gmail.com"},"_resolved":"C:\\Users\\jasfalk\\AppData\\Local\\Temp\\f74d09f12157141e9f06fa0b7c3a7fb9\\lushly-dev-afd-server-0.1.0.tgz","_integrity":"sha512-YccdRaOWLLEMTOSznFB+oUhDomKbmqpE4TR8Hve7lc8fPtaTXHnAvk0Hc8us2uBT3NiacY3F+FYx8TDPBbSHrA==","_npmVersion":"11.2.0","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"_nodeVersion":"23.3.0","dependencies":{"zod":"^3.23.8","zod-to-json-schema":"^3.23.5","@lushly-dev/afd-core":"0.1.0","@modelcontextprotocol/sdk":"^1.24.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.4.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_0.1.0_1767824768375_0.7385358079380728","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@lushly-dev/afd-server","version":"0.3.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@0.3.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"5ec40d33e277eb043733b302819c874f6eaac8c3","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-0.3.0.tgz","fileCount":47,"integrity":"sha512-tpw2ygh+6p718soWHYsMgZWT+s6/G2Yp2stcB4nH6BiiA5v+zLdNNPnM7E8trMEgAkhZ8KiTw4NHOuIdis/dug==","signatures":[{"sig":"MEUCIQCG4qJB0KnaxoCnAtFztezNBXw8+kiD2c5kNISbFnGw9QIgfbIwV9W0gvXZaZr4OK5nqRmxjou6GuJuT3jpV4S52Hs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@0.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":238629},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-0.3.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"lushly-admin","email":"falkicon@gmail.com"},"_resolved":"/tmp/642840e2936a8589ca0bfedacb411713/lushly-dev-afd-server-0.3.0.tgz","_integrity":"sha512-tpw2ygh+6p718soWHYsMgZWT+s6/G2Yp2stcB4nH6BiiA5v+zLdNNPnM7E8trMEgAkhZ8KiTw4NHOuIdis/dug==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"10.9.4","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.23.8","zod-to-json-schema":"^3.23.5","@lushly-dev/afd-core":"0.3.0","@modelcontextprotocol/sdk":"^1.24.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^1.6.0","typescript":"^5.4.0","@lushly-dev/afd-client":"0.3.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_0.3.0_1772238051190_0.5628902158465363","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@lushly-dev/afd-server","version":"0.3.1","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@0.3.1","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"1c0fb1c944368cc48a72511b3f8ff15adeeb1c7d","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-0.3.1.tgz","fileCount":47,"integrity":"sha512-s6j43wMRfnlMGz+7xkyKE3ObBym/D9dJjDU8PwJq3vZ82yuPX/J5eSgkLgbqfUirAuDE8G+mm44Y+LTG+U2lqg==","signatures":[{"sig":"MEUCIQDya3zWU/JB4/cmuHOhfBzdDdoAC14n1/GTPwBVKT3f8gIgfK6FIh0Xd1oMdiyHbhMF9SsjtpU0zGrfxsijoxtJfuM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@0.3.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":238668},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-0.3.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"lushly-admin","email":"falkicon@gmail.com"},"_resolved":"/tmp/c2562b4edc5185239f7ddec0a133a836/lushly-dev-afd-server-0.3.1.tgz","_integrity":"sha512-s6j43wMRfnlMGz+7xkyKE3ObBym/D9dJjDU8PwJq3vZ82yuPX/J5eSgkLgbqfUirAuDE8G+mm44Y+LTG+U2lqg==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"10.9.4","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.23.8","zod-to-json-schema":"^3.23.5","@lushly-dev/afd-core":"0.3.1","@modelcontextprotocol/sdk":"^1.24.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.18","typescript":"^5.4.0","@vitest/coverage-v8":"^4.0.18","@lushly-dev/afd-client":"0.3.1"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_0.3.1_1772250989785_0.33990921898583104","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@lushly-dev/afd-server","version":"0.3.2","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@0.3.2","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"cba92db54d8eb99160d6aae00c571260fc97b7ff","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-0.3.2.tgz","fileCount":47,"integrity":"sha512-PgYzomka+azD0xTH6PdQSFkrDRXztz/lALvSVwz9d9XU59FRn1ZIcODzMGOuDdhY37tQFlqRMCsYVn1YLdrzuQ==","signatures":[{"sig":"MEUCIE8BNzKVPJsKI2ZgniIPkTPL/ww+MHyqh2BRkd1DIxIbAiEAty+UQGiSd44RFJA2vAivOfa91n8mK4EpRkPQ0SDiyYE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@0.3.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":238668},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-0.3.2.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"lushly-admin","email":"falkicon@gmail.com"},"_resolved":"/tmp/0d0bbd4be4b44208db347914d150a2fb/lushly-dev-afd-server-0.3.2.tgz","_integrity":"sha512-PgYzomka+azD0xTH6PdQSFkrDRXztz/lALvSVwz9d9XU59FRn1ZIcODzMGOuDdhY37tQFlqRMCsYVn1YLdrzuQ==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"10.9.4","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.23.8","zod-to-json-schema":"^3.23.5","@lushly-dev/afd-core":"0.3.2","@modelcontextprotocol/sdk":"^1.24.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.18","typescript":"^5.4.0","@vitest/coverage-v8":"^4.0.18","@lushly-dev/afd-client":"0.3.2"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_0.3.2_1772256956763_0.3608139032363398","host":"s3://npm-registry-packages-npm-production"}},"0.3.4":{"name":"@lushly-dev/afd-server","version":"0.3.4","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@0.3.4","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"cb27772d016c7e3542802e56b0b0506303b0beb6","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-0.3.4.tgz","fileCount":47,"integrity":"sha512-brp1dhsagNWLOiBAkBKKaW4ww6U8zl0Za+UQ8iYY3UAY+9ORZoafJLAYflGiY1fUKHxpy316WcWvKEd/f1lDlw==","signatures":[{"sig":"MEYCIQClApEmd4sWX1jOYTGvj/YqLav3HjFN/Pgl2MYgRku9cQIhAIED19uVy9izvVSCzJno6R5ViAXCdHXYWLvy4+FDg9Jd","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@0.3.4","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":238668},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-0.3.4.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"lushly-admin","email":"falkicon@gmail.com"},"_resolved":"/tmp/602f3ff10dec8c495ffcfbed173f316b/lushly-dev-afd-server-0.3.4.tgz","_integrity":"sha512-brp1dhsagNWLOiBAkBKKaW4ww6U8zl0Za+UQ8iYY3UAY+9ORZoafJLAYflGiY1fUKHxpy316WcWvKEd/f1lDlw==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"10.9.4","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.23.8","zod-to-json-schema":"^3.23.5","@lushly-dev/afd-core":"0.3.4","@modelcontextprotocol/sdk":"^1.24.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.18","typescript":"^5.4.0","@vitest/coverage-v8":"^4.0.18","@lushly-dev/afd-client":"0.3.4"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_0.3.4_1772258405441_0.8530167020441781","host":"s3://npm-registry-packages-npm-production"}},"0.4.0":{"name":"@lushly-dev/afd-server","version":"0.4.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@0.4.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"daf67c0b69fe25cc0fd58d38e09d760fdc456236","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-0.4.0.tgz","fileCount":47,"integrity":"sha512-kTeahz0o1HN1k8I52WiTz/tMEy6PMwmEKvBdpkKccU/azMA/0yiSjyGwdMJ/WOBfFrbYqNFxYzqyQiunBRtZZg==","signatures":[{"sig":"MEUCIQCNf+sT9tt6LvNz89XqJuoibdy5G8Se8W7mn06W70amygIgZjNPxemNpQBHDYgNu9PfzPR9sHSNatB8JnhS+Sr5nIY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@0.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":238668},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-0.4.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"lushly-admin","email":"falkicon@gmail.com"},"_resolved":"/tmp/de96c2944fd8770d489380b5356c0537/lushly-dev-afd-server-0.4.0.tgz","_integrity":"sha512-kTeahz0o1HN1k8I52WiTz/tMEy6PMwmEKvBdpkKccU/azMA/0yiSjyGwdMJ/WOBfFrbYqNFxYzqyQiunBRtZZg==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"10.9.4","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.23.8","zod-to-json-schema":"^3.23.5","@lushly-dev/afd-core":"0.4.0","@modelcontextprotocol/sdk":"^1.24.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.18","typescript":"^5.4.0","@vitest/coverage-v8":"^4.0.18","@lushly-dev/afd-client":"0.4.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_0.4.0_1772310073378_0.47218126742280253","host":"s3://npm-registry-packages-npm-production"}},"0.5.0":{"name":"@lushly-dev/afd-server","version":"0.5.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@0.5.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"fa896afe41d457f6df9c12816996204b880a2c06","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-0.5.0.tgz","fileCount":75,"integrity":"sha512-RZg4D8kTIiUNNvl0crjtjqmz9/iqjmFVRucqbjODh9XEwL2B14GzfBv38r7bZyGPhvkg66KCVQnAXFishFY8Lg==","signatures":[{"sig":"MEUCIB5J9CPQxyeGc22Kze3cxQA5axpqJCorxK5cjnyT4xLIAiEA8WBIkzpnDDTDZNK4ta/GmpGKNUlMJNoAu4n5xtb+wVw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@0.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":310747},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-0.5.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=20.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"lushly-admin","email":"falkicon@gmail.com"},"_resolved":"/tmp/b6174d43c1dcd944a6695027c39568f6/lushly-dev-afd-server-0.5.0.tgz","_integrity":"sha512-RZg4D8kTIiUNNvl0crjtjqmz9/iqjmFVRucqbjODh9XEwL2B14GzfBv38r7bZyGPhvkg66KCVQnAXFishFY8Lg==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"10.9.4","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"22.22.0","dependencies":{"zod":"^3.23.8","zod-to-json-schema":"^3.23.5","@lushly-dev/afd-core":"0.5.0","@modelcontextprotocol/sdk":"^1.24.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.18","typescript":"^5.4.0","@vitest/coverage-v8":"^4.0.18","@lushly-dev/afd-client":"0.5.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_0.5.0_1773188895822_0.9196090777624273","host":"s3://npm-registry-packages-npm-production"}},"0.6.0":{"name":"@lushly-dev/afd-server","version":"0.6.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@0.6.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"e31da02d0d793fb6e8bc1997f347660eaa4428ee","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-0.6.0.tgz","fileCount":75,"integrity":"sha512-SBDfq58+6kjnss+rpiPNg5HGNFk8VAGsPXojDuCv2c1rz9vcekTqeNd8j19ev1UtVviEcAiVNBA1y6omZDplNg==","signatures":[{"sig":"MEQCIEF9PRjsC6u2MABAIrvsHMeqbbDrh16PnGr/8nypllinAiBAvA7cVovu8ahl/1EkQ3VZQakoE2gRGn/Q8g7qf0peHQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@0.6.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":303530},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-0.6.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"lushly-admin","email":"falkicon@gmail.com"},"_resolved":"/tmp/9433dee44161d81eb6eb353e83c722c1/lushly-dev-afd-server-0.6.0.tgz","_integrity":"sha512-SBDfq58+6kjnss+rpiPNg5HGNFk8VAGsPXojDuCv2c1rz9vcekTqeNd8j19ev1UtVviEcAiVNBA1y6omZDplNg==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"11.9.0","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"24.14.0","dependencies":{"zod":"^4.0.0","@lushly-dev/afd-core":"0.6.0","@modelcontextprotocol/sdk":"^1.27.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.0","typescript":"^5.9.3","@vitest/coverage-v8":"^4.1.0","@lushly-dev/afd-client":"0.6.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_0.6.0_1773466659014_0.5413450432349758","host":"s3://npm-registry-packages-npm-production"}},"1.0.0":{"name":"@lushly-dev/afd-server","version":"1.0.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@1.0.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"88f3b0d7a1f08b0c6a974889cd42902c75808c99","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-1.0.0.tgz","fileCount":75,"integrity":"sha512-tbpEocu1SnuRofCaD5Ngtv8NQh7IQfwdAENV6rJnAf6JmMMqek9+TzNU5clqKNDfKCjyo8qBIBXNrWlye494vg==","signatures":[{"sig":"MEUCIQDZD1cDZFjebyp+SAYqBJ1VnQ8COoxzIOcIvltBOLjOnwIgMMkkAq2YZTN5Gp9XxZ9jqjKRzUEh5UxmSONfhXvnvTw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@1.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":306996},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-1.0.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.0.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","test:watch":"vitest"},"_npmUser":{"name":"lushly-admin","email":"falkicon@gmail.com"},"_resolved":"/tmp/7da6115925de7bfdac86515acf779aa4/lushly-dev-afd-server-1.0.0.tgz","_integrity":"sha512-tbpEocu1SnuRofCaD5Ngtv8NQh7IQfwdAENV6rJnAf6JmMMqek9+TzNU5clqKNDfKCjyo8qBIBXNrWlye494vg==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"11.9.0","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"24.14.0","dependencies":{"zod":"^4.0.0","@lushly-dev/afd-core":"1.0.0","@modelcontextprotocol/sdk":"^1.27.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.0","typescript":"^5.9.3","@vitest/coverage-v8":"^4.1.0","@lushly-dev/afd-client":"1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_1.0.0_1773633892531_0.2961473352126478","host":"s3://npm-registry-packages-npm-production"}},"2.0.0":{"name":"@lushly-dev/afd-server","version":"2.0.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@2.0.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"004351332dc8cb55a12a2e6605f914fb4fa187aa","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-2.0.0.tgz","fileCount":123,"integrity":"sha512-VhgJggg8ixeQZAr/V6lcxUAkHDv2oS7c3FrTUcAY6/kD6sWk4iPL6OsG9zzx4uY45Wk/chTsQnDmU5QIIV9tlQ==","signatures":[{"sig":"MEUCIQD2SlCcQ2s5wRUcVrsMLGcwbBO1rdtGqx1xp6aEfZ9VDwIgFM8CiuiLqBLtysrrziWm4sc7bKFpnWC0aSt10IlJHdc=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCIDbI6vvVhsv8XQNOLWE0a1CVrmYnysvc0UuP9f2w0fgCAiAbgRuPoddo+hRJOUo8l+fWBma30OSCqKEdoc0BqMXwJQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@2.0.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":435501},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-2.0.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./define":{"types":"./dist/define.d.ts","import":"./dist/define.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.typecheck.json","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"5af2874d-5cee-4647-b27c-04e44b718d8b"}},"_resolved":"/tmp/52697ac9202b664b12b2dd0b2d8b11ee/lushly-dev-afd-server-2.0.0.tgz","_integrity":"sha512-VhgJggg8ixeQZAr/V6lcxUAkHDv2oS7c3FrTUcAY6/kD6sWk4iPL6OsG9zzx4uY45Wk/chTsQnDmU5QIIV9tlQ==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"11.19.0","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"24.21.0","dependencies":{"zod":"^4.5.4","@lushly-dev/afd-core":"2.0.0","@modelcontextprotocol/sdk":"^1.30.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.11","typescript":"^5.9.3","@vitest/coverage-v8":"^4.1.11","@lushly-dev/afd-client":"2.0.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_2.0.0_1791773916331_0.06429203946361461","host":"s3://npm-registry-packages-npm-production"}},"2.1.0":{"name":"@lushly-dev/afd-server","version":"2.1.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@2.1.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"2a3c71ee9f542013a031f0f706f5677bcabcc633","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-2.1.0.tgz","fileCount":123,"integrity":"sha512-dvrs7UyokDPYOqRvkqLHNUgR1/jtjajMjult488C4PEnAr6vUMak0ZJpRL5JWbk0AoKepVoqguofBGKW4yftmQ==","signatures":[{"sig":"MEUCIQD5pdcGv7nQIF51i0774GJI8t8jKmtnp1qUbwo9uno8dQIgLLnoBIop1ib3V0MVnvSi19OZtN30c1y5gATk75hVpUk=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEUCIQDo/D5IVbEmm5iZbOPHGzz9GCXjRBeTCom3OcA2Z5iBUgIgQGRbI5gK42+upIwal6ese6UM+7sbHZPtnbkQL1kIM1w=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@2.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":435621},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-2.1.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./define":{"types":"./dist/define.d.ts","import":"./dist/define.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.typecheck.json","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"5af2874d-5cee-4647-b27c-04e44b718d8b"}},"_resolved":"/tmp/3af5635720d501e8c0e1423d6a93545c/lushly-dev-afd-server-2.1.0.tgz","_integrity":"sha512-dvrs7UyokDPYOqRvkqLHNUgR1/jtjajMjult488C4PEnAr6vUMak0ZJpRL5JWbk0AoKepVoqguofBGKW4yftmQ==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"11.19.0","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"24.21.0","dependencies":{"zod":"^4.5.4","@lushly-dev/afd-core":"2.1.0","@modelcontextprotocol/sdk":"^1.32.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.11","typescript":"^5.9.3","@vitest/coverage-v8":"^4.1.11","@lushly-dev/afd-client":"2.1.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_2.1.0_1791774494768_0.3286608696252815","host":"s3://npm-registry-packages-npm-production"}},"2.2.0":{"name":"@lushly-dev/afd-server","version":"2.2.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@2.2.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"8fc43ec2f49ed3523e4c21af635c5031e4ddfbe9","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-2.2.0.tgz","fileCount":159,"integrity":"sha512-QUfcAsP8OyCJJw8zI0Y/kD9EseMzPodsT7GTb2ryGx4/CcwvbvIRG694ZclqVIPzr9q5xVdBCb0vHYmLkzsHbg==","signatures":[{"sig":"MEUCIQCvtvBkVttW2sj6HJYiI2vzuXNIrxocqRMTaU1F0jTomgIgTB08vBg5I3xHE537bpWcoohcRKIjag+pyj7AY6O+3cY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQCuEmxIn9bnHoDO4mAZrqoVOBJ+PznjM8FHgvsOw5BVRQIhANfwbFPVfG2gDFSOWOCn+pzZshMp8fYFJgPjArwpSvSi","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@2.2.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":642990},"main":"./dist/index.js","type":"module","_from":"file:lushly-dev-afd-server-2.2.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./define":{"types":"./dist/define.d.ts","import":"./dist/define.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.typecheck.json","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"5af2874d-5cee-4647-b27c-04e44b718d8b"}},"_resolved":"/tmp/ff956dc869702ec1d81ef8ad46104fc3/lushly-dev-afd-server-2.2.0.tgz","_integrity":"sha512-QUfcAsP8OyCJJw8zI0Y/kD9EseMzPodsT7GTb2ryGx4/CcwvbvIRG694ZclqVIPzr9q5xVdBCb0vHYmLkzsHbg==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"11.19.0","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"24.21.0","dependencies":{"zod":"^4.6.6","@lushly-dev/afd-core":"2.2.0","@modelcontextprotocol/node":"^2.1.2","@modelcontextprotocol/server":"^2.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.11","typescript":"^5.9.3","@vitest/coverage-v8":"^4.1.11","@lushly-dev/afd-client":"2.2.0","@modelcontextprotocol/client":"^2.4.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_2.2.0_1793086542971_0.3593599016037541","host":"s3://npm-registry-packages-npm-production"}},"2.2.1":{"name":"@lushly-dev/afd-server","version":"2.2.1","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@2.2.1","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"0984846475d17ee86b63f62ead8abdd078b3e9f4","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-2.2.1.tgz","fileCount":159,"integrity":"sha512-EZIDhKRJhwN4l39S7tu7YcbvZBjNezdHN2ToYg4SG6Om5IGuWI8nOkx7z6kwDU1kwNZUkoV9sLqba/bfVkdKDg==","signatures":[{"sig":"MEQCID4pGECWoPMftuRsOY7MaSz8BxULl3XtvVqq2p2HllUJAiB2qqB3CfVpvpVAgZIrXbyZbZhzFlKbNxsEkHL2XHeOQg==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQC9IKRKMdUfJYmUh2H8JCFtigRZiSMnmcQ6ruO+boNxMAIhAOFoOFZhxQCVSxiJDryqllNiapTvbRkLPtUx1Tv+H9sj","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@2.2.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":645445},"main":"./dist/index.js","type":"module","_from":"file:/home/runner/work/_temp/npm-plan.json.artifacts/6/lushly-dev-afd-server-2.2.1.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./define":{"types":"./dist/define.d.ts","import":"./dist/define.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.typecheck.json","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"5af2874d-5cee-4647-b27c-04e44b718d8b"}},"_resolved":"/home/runner/work/_temp/npm-plan.json.artifacts/6/lushly-dev-afd-server-2.2.1.tgz","_integrity":"sha512-EZIDhKRJhwN4l39S7tu7YcbvZBjNezdHN2ToYg4SG6Om5IGuWI8nOkx7z6kwDU1kwNZUkoV9sLqba/bfVkdKDg==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"11.19.1","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"24.22.1","dependencies":{"zod":"^4.6.6","@lushly-dev/afd-core":"2.2.1","@modelcontextprotocol/node":"^2.1.2","@modelcontextprotocol/server":"^2.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.11","typescript":"^5.9.3","@vitest/coverage-v8":"^4.1.11","@lushly-dev/afd-client":"2.2.1","@modelcontextprotocol/client":"^2.4.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_2.2.1_1793271347283_0.6121026027232644","host":"s3://npm-registry-packages-npm-production"}},"2.3.0":{"name":"@lushly-dev/afd-server","version":"2.3.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@2.3.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"d108737a652f59a9b9e46f10acfd7d89f2e34b88","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-2.3.0.tgz","fileCount":223,"integrity":"sha512-WXsRRohJRQd0BlgCJkILBDbJ55AmgqH6fspcG6yW05HOazmOcJqB50F5XsE2OzcARRwUHs/3QoMI3rOHryZdNw==","signatures":[{"sig":"MEUCIQCaUqRdVUyuPodWH5smFCmxd24OxzhKZhtLpqkma+VU6gIgUxYVDM42EnRUzsJiTkA8g5i0sbmaMUIFn3i9BJTB2GQ=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEYCIQDtfCTs6Jeu5ZHnc1+UMHUUbbnMm5yVucq2a90f/PvjPgIhAIIzYg7d8BApyikwYI4z1sLFgcWQDzbIP2+9WCSdj2aJ","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@2.3.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":919984},"main":"./dist/index.js","type":"module","_from":"file:/home/runner/work/_temp/npm-plan.json.artifacts/6/lushly-dev-afd-server-2.3.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./define":{"types":"./dist/define.d.ts","import":"./dist/define.js"},"./direct":{"types":"./dist/direct.d.ts","import":"./dist/direct.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.typecheck.json","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"5af2874d-5cee-4647-b27c-04e44b718d8b"}},"_resolved":"/home/runner/work/_temp/npm-plan.json.artifacts/6/lushly-dev-afd-server-2.3.0.tgz","_integrity":"sha512-WXsRRohJRQd0BlgCJkILBDbJ55AmgqH6fspcG6yW05HOazmOcJqB50F5XsE2OzcARRwUHs/3QoMI3rOHryZdNw==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"11.20.0","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"26.13.0","dependencies":{"zod":"^4.6.6","yaml":"^2.9.1","@lushly-dev/afd-core":"2.3.0","@modelcontextprotocol/node":"^2.1.2","@modelcontextprotocol/server":"^2.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.1.12","esbuild":"0.28.2","playwright":"1.64.0","typescript":"^7.0.2","@vitest/coverage-v8":"^4.1.12","@lushly-dev/afd-client":"2.3.0","@modelcontextprotocol/client":"^2.4.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_2.3.0_1794114432242_0.3127530178926359","host":"s3://npm-registry-packages-npm-production"}},"2.4.0":{"name":"@lushly-dev/afd-server","version":"2.4.0","keywords":["afd","agent-first","mcp","server","zod","validation"],"author":{"name":"Falkicon"},"license":"MIT","_id":"@lushly-dev/afd-server@2.4.0","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"homepage":"https://github.com/lushly-dev/afd#readme","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"c03e11028da2b8d529002858a43291fa33d27848","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-2.4.0.tgz","fileCount":255,"integrity":"sha512-jUjHz2ahP0OqUDRhM5N5PVwbJaL5yDHFuMiyanWy6NjJw/L2YpiWhTg7QNgww2I7+GUHdHqfBsYZR8ahBv9crA==","signatures":[{"sig":"MEUCIHgrhzxVNaoVLXqIJF1zk+d+FlYd6ERNYwHbjGgcFmnSAiEA1tL1nGQPtuRXspcMLjahZqMmgVM83Zea6C0BofDCBmM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEQCICxW3mCmThwjaRp1uldMK69UuKDmR+Lgau4w7lUSKhqwAiBf/RdW3F9G2vgHqybnqIgqi+kbvCxECJ136rxQ9U2VFQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@2.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1076829},"main":"./dist/index.js","type":"module","_from":"file:/home/runner/work/_temp/npm-plan.json.artifacts/6/lushly-dev-afd-server-2.4.0.tgz","types":"./dist/index.d.ts","engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./define":{"types":"./dist/define.d.ts","import":"./dist/define.js"},"./direct":{"types":"./dist/direct.d.ts","import":"./dist/direct.js"},"./credentials":{"types":"./dist/credentials.d.ts","import":"./dist/credentials.js"}},"scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.typecheck.json","test:watch":"vitest"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"5af2874d-5cee-4647-b27c-04e44b718d8b"}},"_resolved":"/home/runner/work/_temp/npm-plan.json.artifacts/6/lushly-dev-afd-server-2.4.0.tgz","_integrity":"sha512-jUjHz2ahP0OqUDRhM5N5PVwbJaL5yDHFuMiyanWy6NjJw/L2YpiWhTg7QNgww2I7+GUHdHqfBsYZR8ahBv9crA==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"11.20.0","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"sideEffects":false,"_nodeVersion":"26.13.0","dependencies":{"zod":"^4.6.6","jose":"^6.2.14","yaml":"^2.9.1","@lushly-dev/afd-core":"2.4.0","@modelcontextprotocol/node":"^2.1.2","@modelcontextprotocol/server":"^2.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^5.1.0","esbuild":"0.28.2","playwright":"1.64.0","typescript":"^7.0.2","@vitest/coverage-v8":"^5.1.0","@lushly-dev/afd-client":"2.4.0","@modelcontextprotocol/client":"^2.4.0"},"_npmOperationalInternal":{"tmp":"tmp/afd-server_2.4.0_1794308119114_0.8335768843509377","host":"s3://npm-registry-packages-npm-production"}},"2.5.0":{"_id":"@lushly-dev/afd-server@2.5.0","bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"dist":{"shasum":"4eb45f64b5e92ae6cd861ec3c082d460a896aec1","tarball":"https://registry.npmjs.org/@lushly-dev/afd-server/-/afd-server-2.5.0.tgz","fileCount":319,"integrity":"sha512-wQpd4HSpj45oQh2/UOeAlwUOjhWZOZr4kAtIt/O3cvpiNO8l+bwMSwuByZfSbMiV+a5vE9p1YxryKXlS54GKow==","signatures":[{"sig":"MEUCIQDlv2TqqynBl/r5HoAp30ivvzFt9tnNgYvPoiadV9TWwAIgJDKj4jq/rHQ7/m5tVG34mfHpwaiEBHYnBVkcfZ77sbw=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDfg1UsYPIXh26yqg4mDKIDXgePbq9Fw902ZQYAQCjFVwIgDS6aU5hcwBeK7UbJ3A8+PscMyzbtp7yvkyphO22JmlA="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@lushly-dev%2fafd-server@2.5.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":1555461},"main":"./dist/index.js","name":"@lushly-dev/afd-server","type":"module","_from":"file:/home/runner/work/_temp/npm-plan.json.artifacts/6/lushly-dev-afd-server-2.5.0.tgz","types":"./dist/index.d.ts","author":{"name":"Falkicon"},"engines":{"node":">=22.12.0"},"exports":{".":{"types":"./dist/index.d.ts","import":"./dist/index.js"},"./define":{"types":"./dist/define.d.ts","import":"./dist/define.js"},"./direct":{"types":"./dist/direct.d.ts","import":"./dist/direct.js"},"./credentials":{"types":"./dist/credentials.d.ts","import":"./dist/credentials.js"}},"license":"MIT","scripts":{"dev":"tsc --watch","test":"vitest run","build":"tsc","clean":"rm -rf dist","typecheck":"tsc -p tsconfig.typecheck.json","test:watch":"vitest"},"version":"2.5.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"5af2874d-5cee-4647-b27c-04e44b718d8b"}},"homepage":"https://github.com/lushly-dev/afd#readme","keywords":["afd","agent-first","mcp","server","zod","validation"],"_resolved":"/home/runner/work/_temp/npm-plan.json.artifacts/6/lushly-dev-afd-server-2.5.0.tgz","_integrity":"sha512-wQpd4HSpj45oQh2/UOeAlwUOjhWZOZr4kAtIt/O3cvpiNO8l+bwMSwuByZfSbMiV+a5vE9p1YxryKXlS54GKow==","repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"_npmVersion":"11.20.0","description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","directories":{},"maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"sideEffects":false,"_nodeVersion":"26.13.1","dependencies":{"zod":"^4.6.6","jose":"^6.2.14","yaml":"^2.9.1","@lushly-dev/afd-core":"2.5.0","@modelcontextprotocol/node":"^2.1.2","@modelcontextprotocol/server":"^2.4.0"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^5.1.1","esbuild":"0.28.2","playwright":"1.64.1","typescript":"^7.0.2","@vitest/coverage-v8":"^5.1.1","@lushly-dev/afd-client":"2.5.0","@modelcontextprotocol/client":"^2.4.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/afd-server_2.5.0_1795489448737_0.7695052050821749"}}},"time":{"created":"2026-01-07T22:26:08.264Z","modified":"2026-11-24T03:04:09.219Z","0.1.0":"2026-01-07T22:26:08.551Z","0.3.0":"2026-02-28T00:20:51.348Z","0.3.1":"2026-02-28T03:56:29.946Z","0.3.2":"2026-02-28T05:35:56.931Z","0.3.4":"2026-02-28T06:00:05.588Z","0.4.0":"2026-02-28T20:21:13.529Z","0.5.0":"2026-03-11T00:28:15.980Z","0.6.0":"2026-03-14T05:37:39.188Z","1.0.0":"2026-03-16T04:04:52.696Z","2.0.0":"2026-10-12T02:58:36.408Z","2.1.0":"2026-10-12T03:08:14.904Z","2.2.0":"2026-10-27T07:35:43.082Z","2.2.1":"2026-10-29T10:55:47.378Z","2.3.0":"2026-11-08T05:07:12.397Z","2.4.0":"2026-11-10T10:55:19.251Z","2.5.0":"2026-11-24T03:04:08.827Z"},"bugs":{"url":"https://github.com/lushly-dev/afd/issues"},"author":{"name":"Falkicon"},"license":"MIT","homepage":"https://github.com/lushly-dev/afd#readme","keywords":["afd","agent-first","mcp","server","zod","validation"],"repository":{"url":"git+https://github.com/lushly-dev/afd.git","type":"git","directory":"packages/server"},"description":"Server-side utilities for building AFD-compliant MCP servers with Zod validation","maintainers":[{"name":"lushly-admin","email":"falkicon@gmail.com"}],"readme":"# @lushly-dev/afd-server\n\nServer-side utilities for building AFD-compliant MCP servers with Zod validation.\n\n## Installation\n\n```bash\nnpm install @lushly-dev/afd-server\n# or\npnpm add @lushly-dev/afd-server\n```\n\n## Features\n\n- **Zod-based Command Definition** - Define commands with Zod schemas for type-safe validation\n- **Auto JSON Schema Generation** - Automatic conversion to JSON Schema for MCP tool definitions\n- **Multiple Transport Support** - stdio and Streamable HTTP (`/mcp`), each serving MCP 2026-07-28 and 2025 clients\n- **Auto Transport Detection** - Automatically selects the right transport based on environment\n- **Built-in Validation** - Automatic input validation before handler execution\n- **Middleware System** - Logging, tracing, rate limiting, approvals, and custom middleware\n- **Pre-execution Approvals** - Hold commands for human sign-off with signed, short-lived approval tokens\n- **Command Prerequisites** - Declare `requires` dependencies so agents can plan execution order\n- **Agent Discovery** - Grouped, individual or lazy tool strategies, `afd-detail`, and optional `afd-help`/`afd-docs`/`afd-schema` bootstrap tools\n- **Full TypeScript Support** - Complete type inference from Zod schemas\n\n## Quick Start\n\n```typescript\nimport { z } from 'zod';\nimport { defineCommand, createMcpServer, defaultMiddleware, success, failure } from '@lushly-dev/afd-server';\n\n// Define a command with Zod schema\nconst greet = defineCommand({\n  expose: { mcp: true }, // Explicitly allow remote invocation\n  name: 'greet',\n  description: 'Greet a user by name',\n  category: 'demo',\n  input: z.object({\n    name: z.string().min(1, 'Name is required'),\n    formal: z.boolean().default(false),\n  }),\n\n  async handler(input) {\n    const greeting = input.formal\n      ? `Good day, ${input.name}.`\n      : `Hello, ${input.name}!`;\n\n    return success({ greeting }, {\n      reasoning: `Generated ${input.formal ? 'formal' : 'casual'} greeting`,\n      confidence: 1.0,\n    });\n  },\n});\n\n// Create and start the server (auto-detects transport)\nconst server = createMcpServer({\n  name: 'my-server',\n  version: '1.0.0',\n  commands: [greet],\n  middleware: defaultMiddleware(),  // Trace IDs, logging, slow-command warnings\n  port: 3100,\n});\n\nawait server.start();\nconsole.error(`Server running at ${server.getUrl()}`);\n```\n\n## Remote Command Exposure\n\nRemote invocation now enforces the core exposure contract: commands require `expose: { mcp: true }`. Omitting `expose`, omitting `expose.mcp`, or setting it to `false` keeps a command private. This applies to tool listing, discovery, direct MCP calls, `afd-call`, batch, pipelines, `/rpc`, and streaming. Existing applications should explicitly opt in their public commands. The server's in-process `execute()` and `executePipeline()` remain available for private commands.\n\nConfigured `contexts` automatically register `afd-context-list`, `afd-context-enter`, and `afd-context-exit`. Active contexts scope all remote execution paths. Context state belongs to the client, not the server: stdio has one stack, and each HTTP session has its own (see [Context Management](#context-management)).\n\n## Embedding In A Host-Controlled HTTP Server\n\nUse `createMcpHandler()` when your platform owns the HTTP server lifecycle and expects a request handler instead of a self-starting server object:\n\n```typescript\nimport { createServer } from 'node:http';\nimport { createMcpHandler } from '@lushly-dev/afd-server';\n\nconst handler = createMcpHandler({\n  name: 'my-server',\n  version: '1.0.0',\n  commands: [greet],\n  host: '127.0.0.1',\n  port: 3100,\n});\n\ncreateServer((req, res) => {\n  void handler(req, res);\n}).listen(3100, '127.0.0.1');\n```\n\nCall `handler.dispose()` when the embedding host shuts down to close active SSE/stream responses and drop HTTP sessions. The host still owns its listener and other connections.\n\nUse `createMcpServer()` for the batteries-included standalone server. Use `createMcpHandler()` when you need AFD to plug into an existing Node HTTP host.\n\n## Transport Protocols\n\nThe server supports multiple transport protocols for different use cases:\n\n### Auto-Detection (Default)\n\nBy default, the server auto-detects the best transport based on the environment:\n\n```typescript\nconst server = createMcpServer({\n  name: 'my-server',\n  version: '1.0.0',\n  commands: [greet],\n  // transport: 'auto' is the default\n});\n\n// When stdin is piped (IDE/agent context): uses stdio\n// When stdin is a TTY (interactive context): uses HTTP\n```\n\n> **Pitfall:** `auto` picks stdio whenever stdin is not a TTY. Under Docker without `-t`, systemd, pm2 or CI, the server therefore speaks stdio and the HTTP port never opens. Set `transport: 'http'` for any server that must listen on the network. `start()` logs the resolved transport to stderr, for example `[my-server] MCP transport: stdio (auto-detected because stdin is not a TTY; set transport: 'http' to serve HTTP)`.\n\n### stdio Transport (IDE/Agent Integration)\n\nUse stdio for integration with IDE MCP clients like Cursor, Claude Code, or Antigravity:\n\n```typescript\nconst server = createMcpServer({\n  name: 'my-server',\n  version: '1.0.0',\n  commands: [greet],\n  transport: 'stdio',  // Explicit stdio mode\n});\n\nawait server.start();\n// Server reads JSON-RPC from stdin, writes to stdout\n```\n\nstdio serves both MCP protocol eras on one connection: a client that opens with `server/discover` and per-request `_meta` gets MCP 2026-07-28, and a client that opens with `initialize` gets the 2025 protocol for the rest of the connection.\n\nIn your IDE's MCP configuration (adjust the path to match your project):\n```json\n{\n  \"mcpServers\": {\n    \"my-server\": {\n      \"command\": \"node\",\n      \"args\": [\"path/to/your/server.js\"]\n    }\n  }\n}\n```\n\n### HTTP Transport (Browser/Web UI)\n\nUse HTTP for browser-based clients and web UIs:\n\n```typescript\nconst server = createMcpServer({\n  name: 'my-server',\n  version: '1.0.0',\n  commands: [greet],\n  transport: 'http',  // Explicit HTTP mode\n  port: 3100,\n});\n\nawait server.start();\nconsole.error(`Server running at ${server.getUrl()}`);\n// MCP clients connect to http://localhost:3100/mcp\n```\n\nPoint MCP clients at `/mcp`, for example `claude mcp add --transport http my-server http://localhost:3100/mcp`. See [MCP endpoint](#mcp-endpoint-mcp).\n\n## Defining Commands\n\n### Browser-safe entry point: `@lushly-dev/afd-server/define`\n\nThe root entry loads the MCP SDK, `node:http` and `node:tls`, so it cannot be\nbundled for the browser. Code that only defines commands (shared command\nmodules, UI state packages, in-app agents) can import from the `/define`\nsubpath instead. It exports `defineCommand`, `defineCommandWithSchema` (see\n[below](#the-lean-path-definecommandwithschema)), the schema helpers\n(`zodToJsonSchema`, `getRequiredFields`, `isObjectSchema`), the result helpers\n(`success`, `failure`, `error`, `isSuccess`, `isFailure`), `defaultExpose` and\nthe matching types, with no MCP SDK or Node.js builtin in its module graph:\n\n```typescript\nimport { z } from 'zod';\nimport { defineCommand, success } from '@lushly-dev/afd-server/define';\n\nexport const panelOpen = defineCommand({\n  name: 'panel-open',\n  description: 'Open a panel',\n  input: z.object({ id: z.string() }),\n  async handler(input) {\n    return success({ id: input.id, open: true });\n  },\n});\n```\n\nThe same functions are still exported from `@lushly-dev/afd-server`.\n\n### The lean path: `defineCommandWithSchema`\n\n`defineCommand` computes each command's JSON Schema with `toJSONSchema` as it\nloads, and takes classic Zod. A browser bundle pays for both. When you already\nhave the JSON Schema, `defineCommandWithSchema` takes it as written, with a\nclassic or a [Zod Mini](https://zod.dev/packages/mini) schema to validate. A host\nthat defines every command this way and imports only `createDirectRegistry`,\n`createJournalMiddleware` and the middleware bundles `zod/v4/core` and neither\nclassic Zod nor `toJSONSchema`. A test holds that, with esbuild. Import Zod Mini as\n`import * as z from 'zod/mini'`: esbuild cannot tree-shake `import { z }`, and keeps\nall of it, locales and `toJSONSchema` included. Vite 8 handles either form.\n\n```typescript\nimport * as z from 'zod/mini';\nimport { defineCommandWithSchema, success } from '@lushly-dev/afd-server/define';\n\nexport const panelOpen = defineCommandWithSchema({\n  name: 'panel-open',\n  description: 'Open a panel',\n  input: z.object({ id: z.string() }),\n  jsonSchema: {\n    type: 'object',\n    properties: { id: { type: 'string' } },\n    required: ['id'],\n  },\n  async handler(input) {\n    return success({ id: input.id, open: true });\n  },\n});\n```\n\n- **Nothing compares the two.** `input` validates every call and `jsonSchema` is\n  what every surface shows, so hold them equal in a test, against\n  `zodToJsonSchema(schema)`. `advertisedInputSchema` still replaces it.\n- **Output is not converted either.** Pass `outputJsonSchema` beside `output` to\n  advertise it. With `output` alone, no surface shows an output schema.\n- **`createDirectToolSurface` and the MCP servers still load both**, since their\n  own tools are defined on classic Zod.\n- **Messages.** Zod Mini loads no locale, so with no classic schema built on the\n  page an issue says only `Invalid input`. `VALIDATION_ERROR` then builds its text\n  from the issue, as Zod's English does for a wrong type, a value, a size other than a\n  file's, an unknown key, a regex or a discriminator. A format keeps its own name (`Invalid\n  email` for `Invalid email address`), and a rarer code, such as `multipleOf`, says\n  `Invalid input`, with the field's path. With a locale loaded, or a message of the\n  schema's own, nothing is rebuilt.\n\nTypes: `ZodCommandDefinition` with no type argument still reads as classic, so\n`command.inputSchema.safeParse(input)` works as before. A Mini command is cast to\nit for `createDirectRegistry`, as a typed classic command is, with\n`as unknown as ZodCommandDefinition`.\n\n### In-process entry point: `@lushly-dev/afd-server/direct`\n\nA host that runs commands in its own process (a browser app, a web worker, a\nTauri or Electron webview, or a Node.js host that does not want the MCP SDK)\nimports from `/direct`. It exports everything `/define` does, plus:\n\n- `createDirectRegistry`, with validation, middleware, exposure checks and\n  error sanitization, as `createMcpServer` runs them, and AFD contexts scoped\n  per call;\n- `createDirectToolSurface`, the MCP tool surface for that registry (see\n  below);\n- `createApprovalMiddleware`, on WebCrypto (see [Approvals](#approvals));\n- `createJournalMiddleware`, `JOURNAL_RESULT_UNSERIALIZABLE`, `replayJournal` and `MemoryJournalSink`;\n- the middleware with no Node.js builtin in its module graph:\n  `composeMiddleware`, `defaultMiddleware`, `createLoggingMiddleware`,\n  `createTimingMiddleware`, `createRetryMiddleware`, `createTracingMiddleware`,\n  `createAutoTraceIdMiddleware`, `createRateLimitMiddleware`,\n  `createTelemetryMiddleware` and `ConsoleTelemetrySink`.\n\n```typescript\nimport {\n  createDirectRegistry,\n  createJournalMiddleware,\n  MemoryJournalSink,\n} from '@lushly-dev/afd-server/direct';\nimport { panelOpen } from './commands.js';\n\nconst journal = new MemoryJournalSink();\nconst registry = createDirectRegistry([panelOpen], {\n  middleware: [createJournalMiddleware(journal)],\n});\nawait registry.execute('panel-open', { id: 'settings' });\n```\n\nA test bundles `/direct` for the browser, failing on any MCP SDK or Node.js\nbuiltin, and holds AFD's own code (minified, Zod excluded) to 39 KB for a host\nthat imports the registry, the journal and `defineCommand`, 52 KB with the\napproval middleware as well, 74 KB for a host that also imports\n`createDirectToolSurface`, and 113 KB for every export. A host that does\nnot import the tool surface does not bundle the tool router. A Chromium test\nruns a command through the registry with the journal and approval middleware,\napproves it through `DirectClient`, and replays the journal.\n\n#### Contexts and `activeContext`\n\n`createDirectRegistry(commands, { contexts })` takes the same context\ndefinitions as `createMcpServer`. The active context is per-call input, as\n`_meta[\"dev.afd/context\"]` is on MCP 2026-07-28, never registry state: a call\nnames it in the `activeContext` option, passed beside the command context so a\nhandler cannot read or set it.\n\n```typescript\nconst registry = createDirectRegistry(commands, {\n  contexts: [{ name: 'billing' }, { name: 'writing' }],\n});\n\nawait registry.execute('invoice-pay', { id: 'in-1' }, {}, { activeContext: 'billing' });\nawait registry.execute('note-create', { title: 'x' }, {}, { activeContext: 'billing' });\n// → COMMAND_NOT_IN_CONTEXT: note-create declares contexts: ['writing']\nawait registry.execute('note-create', { title: 'x' }, {}, { activeContext: 'nope' });\n// → CONTEXT_NOT_FOUND, before anything runs\n```\n\nWithout `activeContext` every command is available, as on MCP with no context\nselected. The option covers the commands a call runs through `afd-call`,\n`afd-batch` and `afd-pipe` too. Naming a context on a registry that configures\nnone fails with `CONTEXT_NOT_FOUND`. `DirectClient` takes the same option on\n`call()` and `pipe()` (see `@lushly-dev/afd-client`). Contexts scope what an\nagent sees; they are not a security boundary.\n\n#### The tool surface: `createDirectToolSurface`\n\nAn in-page agent that should see what an MCP agent sees gets the MCP tool\nsurface from the code the MCP server runs: its tool list for every strategy, its\ntool router, the meta-tools (`afd-discover`, `afd-detail`, `afd-call`,\n`afd-batch`, `afd-pipe`), the context tools when `contexts` is set, and, with\n`bootstrap: true`, `afd-help`, `afd-docs` and `afd-schema`.\n\n```typescript\nimport { createDirectRegistry, createDirectToolSurface } from '@lushly-dev/afd-server/direct';\n\nconst registry = createDirectRegistry(commands, {\n  contexts,\n  tools: createDirectToolSurface({ strategy: 'lazy' }),\n});\n\nregistry.listTools();                                   // what an MCP server with these commands lists\nregistry.listTools({ strategy: 'grouped', activeContext: 'billing' });\nawait registry.execute('afd-discover', {}, {}, { activeContext: 'billing' });\nawait registry.execute('afd-call', { command: 'invoice-pay', input: { id: 'in-1' } });\n```\n\n| `createDirectToolSurface` option | Default | Description |\n|--------|---------|-------------|\n| `strategy` | `'individual'` | `'individual'`, `'grouped'`, `'lazy'` or `'hybrid'`: the default for `listTools`, and the strategy grouped tool calls route by |\n| `firstClassTools` | — | The hybrid strategy's first-class commands, checked as `createMcpServer` checks them |\n| `bootstrap` | `false` | Register `afd-help`, `afd-docs` and `afd-schema` |\n\n- `registry.listTools({ strategy?, activeContext?, allow? })` returns exactly\n  what an MCP server with the same commands, contexts and strategy lists, by\n  calling the server's own tool list, with the server's defaults for\n  `groupByFn`, `advertiseOutputSchema` and `confirmations` (in-process calls are\n  never confirmation-gated). With `allow`, it leaves out the commands and tool\n  names the predicate rejects (see below). It throws a `TypeError` on a\n  registry built without `tools`, and a `RangeError` for an unknown context.\n- `registry.execute` sends meta-tool names, and grouped tool names under the\n  grouped strategy, through the server's tool router, and returns the JSON an\n  MCP client reads (`afd-batch` a `BatchResult`, `afd-pipe` a\n  `PipelineResult`). Command names, the context tools and the bootstrap tools\n  run as commands. `hasCommand` answers `true` for the routed tool names.\n- `afd-context-enter` and `afd-context-exit` behave as on the stateless MCP\n  2026-07-28 lane: they validate the name, change nothing, and return\n  `persisted: false` with the hint to send the context on each call. A host\n  that wants a context stack keeps it and passes its top as `activeContext`.\n- Exposure: where the MCP server lists and routes its MCP-exposed commands, the\n  surface uses the commands exposed to the registry's `interface` (`'agent'`\n  by default), and exposes its own tools to that interface. A registry built\n  with `interface: 'mcp'` sees exactly the MCP server's commands.\n- With the surface, a command named like a meta-tool always throws, and like a\n  context or bootstrap tool when those are registered, as on `createMcpServer`.\n  Refusals point to `afd-discover` and the context tools only when the surface\n  serves them; without it, `COMMAND_NOT_FOUND` ends \"Check the command name\n  against the available commands.\" and `COMMAND_NOT_IN_CONTEXT` names the\n  command's contexts.\n\n#### The `allow` call option\n\n`allow` is a trusted, in-process predicate over names, passed beside\n`activeContext`. It covers the name a call names and every command that call\nruns: the `afd-call` target, each `afd-batch` item, each `afd-pipe` step, a\ngrouped tool's action, and a command a handler runs by passing its own context\nto `execute`. A name it rejects, or a predicate that throws, fails with\n`COMMAND_NOT_ALLOWED` (the failure `DirectClient` gives) before anything runs.\n`afd-discover`, `afd-detail` and the bootstrap tools leave refused commands\nout, and so does `listTools({ allow })`.\n\n```typescript\nconst allowed = new Set(['afd-call', 'afd-batch', 'note-list']);\nconst allow = (name: string) => allowed.has(name);\n\nawait registry.execute('afd-call', { command: 'note-list', input: {} }, {}, { allow }); // runs\nawait registry.execute('afd-call', { command: 'note-delete', input: { id: 'n1' } }, {}, { allow });\n// → COMMAND_NOT_ALLOWED; so is note-delete as an afd-batch item or an afd-pipe step\nregistry.listTools({ allow }); // afd-batch, afd-call, note-list\n```\n\n`DirectClient` passes its own `allow` this way on every call, `pipe()` step and\napproval retry, so allowing a meta-tool or a grouped tool no longer reaches\ncommands `allow` refuses. The registry binds the predicate to the call's context\nas an opaque token, so handlers cannot read or replace it, and tool arguments\ncannot carry one. Without `allow`, nothing changes. A grouped tool's own name\nis checked too: allow the group (`note`) to call its permitted actions. The\naction resolves among the permitted commands only, so a refused action is\n`COMMAND_NOT_FOUND` and cannot make another ambiguous, and a group with no\npermitted action is `COMMAND_NOT_ALLOWED`.\n\n### Verified credentials: `@lushly-dev/afd-server/credentials`\n\n`isVerifiedCredentials(value)` answers whether `value` is the `credentials`\nobject afd-server put on a call after verifying the call's token. The brand is\na private `WeakMap` holding each object's admitted expiry deadline, so a copy,\nan object built with the same fields, the `credentials` a direct-registry\ncaller passes, and those a host's `createContext` sets are never recognised.\nBranded credentials are frozen, and stop being recognised once their admitted\ndeadline (`expiresAt` plus any admission clock skew, checked against `now` in\n`isVerifiedCredentials(value, now?)`, defaulting to `Date.now()`) has passed or\ntheir request has ended. No entry exports\nthe functions that brand and unbrand: only the [`auth` option](#mcp-authorization)\nbrands, the credentials of a request it verified. A nested call keeps the brand\nonly if it is given the same object.\n\nA host that serves MCP with token authorization through afd-auth's middleware\npasses it there, so a token's call keeps its actor rather than the session's:\n\n```typescript\nimport { createAuthMiddleware } from '@lushly-dev/afd-auth';\nimport { isVerifiedCredentials } from '@lushly-dev/afd-server/credentials';\n\nconst auth = createAuthMiddleware(adapter, { isVerifiedCredentials });\n```\n\nThe entry loads nothing else of the server and is held browser-safe by\n`entry-points.test.ts`. The root entry exports the same function.\n\n### MCP authorization\n\nWith `auth`, `createMcpHandler` (and `createMcpServer` over HTTP) is an OAuth 2.1\nprotected resource, as [`spec/authorization.md`](../../spec/authorization.md) M1\nto M7 specify:\n\n```typescript\nimport { createMcpHandler, JwtVerifier, jwksKeySource } from '@lushly-dev/afd-server';\n\nconst resource = 'https://todo.example.com/mcp';\nconst handler = createMcpHandler({\n  name: 'todo',\n  version: '1.0.0',\n  commands,\n  allowedHosts: ['todo.example.com'],\n  auth: {\n    resource,\n    authorizationServers: ['https://auth.example.com'],\n    scopesSupported: ['todo:read'],\n    verifier: new JwtVerifier({\n      rules: { resource },\n      issuers: [\n        {\n          issuer: 'https://auth.example.com',\n          algorithms: ['RS256', 'ES256', 'EdDSA'],\n          // The host fetches; AFD opens no socket.\n          keys: jwksKeySource(() => fetch('https://auth.example.com/jwks').then((r) => r.json())),\n        },\n      ],\n    }),\n  },\n  // Map the verified credentials to an actor (optional).\n  createContext: (_req, { credentials }) => ({\n    actor: { kind: 'agent', id: credentials?.clientId, onBehalfOf: credentials?.subject },\n  }),\n});\n```\n\n- **Every HTTP route needs exactly one bearer token** in the `Authorization`\n  header (`/mcp`, `/sse`, `/message`, `/rpc`, `/batch`, `/stream`, `/health`\n  and any other path). A missing, malformed or refused one, a token in the query\n  or a form body, or a second header is a 401 with M5's exact\n  `WWW-Authenticate` challenge and JSON body. Only the RFC 9728 metadata,\n  served by `GET` at `/.well-known/oauth-protected-resource<path>` and\n  `/.well-known/oauth-protected-resource`, and CORS preflights are public.\n  `/health` needs a token too, so it fails closed: a host that needs a public\n  health check serves its own route before handing the request to the handler.\n  stdio, `server.execute()` and in-process registries are unaffected.\n- **`JwtVerifier`** applies every M3 rule itself, in order; `jose` checks the\n  signature only, through WebCrypto (RS256 to RS512, PS256 to PS512, ES256,\n  ES384 and EdDSA on Ed25519). The audience check is not optional: `aud` must be\n  the `resource`, alone. `none` and `HS*` are always refused, the clock skew is\n  at most 300 seconds (default 60) and the lifetime at most 3600 seconds by\n  default. An opaque token goes to `createIntrospectionVerifier({ issuer, rules,\n  introspect })`, given as `introspection`, whose `introspect(token)` is the\n  host's RFC 7662 call; its rules must name the same resource and binding\n  requirement. Give each issuer a key source of its own (a `kid` names a key\n  only within one issuer's set): two issuers sharing one are refused, and so is\n  an issuer `authorizationServers` does not name. `jwksKeySource` keeps the last\n  good keys while loads fail, for at most `maxStaleMs` (default one hour), then\n  answers `unavailable`.\n- **Whatever the verifier, the layer checks** `rules.clockSkewS` (when present,\n  a whole number from 0 to 300 seconds, or construction throws), the\n  credentials' shape, their certificate binding against this request's TLS\n  client certificate, the binding requirement, and `expiresAt` (within the\n  verifier's skew), refusing with M5's 401.\n- **HTTP sessions belong to their caller.** With `contexts`, a session that\n  `initialize` creates on `/message` is bound to the credentials' issuer,\n  subject and client; another caller presenting its `Mcp-Session-Id` is\n  answered as for an unknown session, and another caller's `initialize` never\n  evicts it (see [Sessions](#sessions-mcp-session-id)).\n- **Commands see `context.credentials`** (`issuer`, `subject`, `clientId`,\n  `scopes`, `resource`, `expiresAt`, `issuedAt`, and `authTime`, `acr` and `cnf`\n  when present), frozen and recognised by `isVerifiedCredentials` until the\n  request ends or its admitted expiry (`expiresAt` plus admission clock skew)\n  passes. Once that deadline passes, afd-auth's middleware fails closed with\n  `TOKEN_EXPIRED` without reading the session. Never the token: the layer removes the `Authorization` header\n  before `createContext` runs, and the journal never records credentials.\n  Without an `actor` from `createContext`, the actor is\n  `{ kind: 'agent', id: <clientId>, onBehalfOf: <subject> }`.\n- **A refused token's rule code** (`audience`, `expired`, ...) goes to\n  `auth.onRefusal`, by default a `console.warn` line, with the issuer's alias;\n  never the token or a claim. A host verifier may wrap `JwtVerifier` to refuse\n  more with a code of its own, which is answered the same way.\n- **Scopes (M6).** A command declares the scopes a caller's token needs with\n  `defineCommand({ scopes: ['todo:write'] })`, and `auth.requiredScopes` names\n  those every request needs; a call needs both, compared exactly. A missing\n  scope is one 403 before dispatch, with M5's challenge\n  (`Bearer error=\"insufficient_scope\", scope=\"<missing>\", resource_metadata=...`)\n  and body, naming every missing scope of every step once, in step order: for\n  a command's own tool, a grouped action, `afd-call`, each step of `afd-batch`\n  and `afd-pipe`, `/rpc`, `/batch` and `/stream`. A JSON-RPC batch is refused\n  with 400 first. A call decided after routing (`GET /stream`, say) fails with\n  `INSUFFICIENT_SCOPE` (`details.scopes`, not retryable) before any\n  confirmation, a batch or pipeline as a whole.\n- **A resolver** (`auth.resolver`) decides every call instead of the static\n  rule: `resolve(command, input, credentials)` answers `'allowed'`,\n  `{ missing: [...] }` or `'defer'` (the registry answers), first on the\n  arguments as sent, then again at execution on the validated input, so a rule\n  keyed on an argument holds when a default or a pipeline step supplies it.\n  `visible` and, optionally, `known` decide the listings; both must be pure.\n- **Listing** (`auth.filterToolsByScope: true`): `tools/list` (then\n  `cacheScope: \"private\"`), `afd-discover`, `afd-detail`, `afd-help` and\n  grouped actions show only what the caller may use, and no suggestion names\n  another command. With a resolver, a command its `known` rejects does not\n  exist for that caller at all: every route answers it exactly as a name that\n  does not exist, before validation, middleware or a confirmation.\n\n#### A host's own layer\n\nA gateway that authenticates its callers itself, instead of a bearer token,\nvouches for each one with `handler.admit(req, credentials)`. **This is the host\nvouching for a caller:** only a gateway that has itself authenticated the\ncaller may call it, never with anything the caller sent. The credentials are\nchecked as a verifier's are (shape, a numeric `expiresAt` not yet passed, the\ncertificate binding where required), frozen and branded while the handler\nserves `req`; `admit` refuses a request that carries a bearer token, or was\nadmitted before. It exists only on the handler object, which the host holds.\nThe host then runs the bearer layer's own decision before dispatch, and passes\nthe body it read on to the handler:\n\n```typescript\nconst check = handler.preDispatchCheck({\n  challenge: new ScopeChallenge('Gateway', { realm: 'todo' }),\n  scopeSource: 'a new assertion from the gateway',\n});\n\nasync function serve(req, res) {\n  const body = await readBody(req, check.maxBodyBytes + 1);\n  try {\n    handler.admit(req, await gatewayCredentials(req));\n  } catch {\n    // A bearer token beside the gateway's credentials, or credentials that fail the checks.\n    res.writeHead(400, { 'Content-Type': 'text/plain' });\n    res.end('One request has one source of credentials');\n    return;\n  }\n  const decided = check.decide(req, body);\n  if (!decided.proceed) {\n    res.writeHead(decided.status, decided.headers);\n    res.end(decided.body);\n    return;\n  }\n  await handler(req, res, body);\n}\n```\n\n`decide` answers exactly what the bearer layer would after admitting the same\ncredentials (a 403, a 400 for a JSON-RPC batch, a 413 over the cap), but for a\n403's challenge in the host's scheme and its suggestion. A request with\nneither admitted credentials nor a valid bearer token still gets M5's 401.\n\nA server that also runs afd-auth's middleware passes `isVerifiedCredentials` to\n`createAuthMiddleware`, as [above](#verified-credentials-lushly-devafd-servercredentials).\n\n### Basic Command\n\n```typescript\nimport { z } from 'zod';\nimport { defineCommand, success, failure } from '@lushly-dev/afd-server';\n\nconst createUser = defineCommand({\n  name: 'user-create',\n  title: 'Create user', // optional display label: the MCP tool title\n  description: 'Create a new user',\n  category: 'users',\n  mutation: true,\n  \n  input: z.object({\n    email: z.string().email(),\n    name: z.string().min(1).max(100),\n    role: z.enum(['admin', 'user', 'guest']).default('user'),\n  }),\n  \n  async handler(input) {\n    // Your implementation\n    const user = await db.users.create(input);\n    \n    return success(user, {\n      reasoning: `Created user ${user.email} with role ${user.role}`,\n    });\n  },\n});\n```\n\nThe advertised JSON Schema describes what a caller may **send** (Zod input mode): `role` has a default, so it is optional and only `email` and `name` are required. Input schemas may use `.transform()` and `.pipe()`; they are advertised by their input type (a `z.string().transform(Number)` field is a string), and the handler receives the transformed value. `output` schemas are generated in output mode. Integer fields (`z.number().int()`) are advertised as `type: 'integer'`. Examples are typed and validated as raw input, so they may omit defaulted fields.\n\n### Command with Error Handling\n\n```typescript\nconst getUser = defineCommand({\n  name: 'user-get',\n  description: 'Get a user by ID',\n  category: 'users',\n  errors: ['NOT_FOUND'],\n  \n  input: z.object({\n    id: z.string().uuid(),\n  }),\n  \n  async handler(input) {\n    const user = await db.users.find(input.id);\n    \n    if (!user) {\n      return failure({\n        code: 'NOT_FOUND',\n        message: `User with ID \"${input.id}\" not found`,\n        suggestion: 'Check the ID or use user-list to find available users',\n      });\n    }\n    \n    return success(user);\n  },\n});\n```\n\n### Command with Prerequisites\n\n```typescript\nconst secretData = defineCommand({\n  name: 'secret-data',\n  description: 'Return sensitive data for the authenticated user',\n  requires: ['auth-sign-in'],  // Agent sees this before calling\n  input: z.object({}),\n\n  async handler(input, context) {\n    return success({ secret: '...' });\n  },\n});\n```\n\nPrerequisites are metadata — they tell agents what to call first but are not enforced at runtime (middleware handles enforcement). They appear in MCP tool `_meta` (per action in `_meta.actions` for grouped tools), in `afd-detail`, and in `afd-help` output when the server has `bootstrap: true`.\n\n### Command with Output Schema\n\nDeclare what a command returns so agents know the response shape before calling:\n\n```typescript\nconst Todo = z.object({\n  id: z.string(),\n  title: z.string(),\n  done: z.boolean(),\n});\n\nconst listTodos = defineCommand({\n  name: 'todo-list',\n  description: 'List all todo items',\n  input: z.object({ filter: z.enum(['all', 'active', 'done']).optional() }),\n  output: Todo.array(),  // Agents see this in _meta.outputSchema and afd-detail\n  async handler(input) {\n    const todos = await store.list(input.filter);\n    return success(todos, { reasoning: `Found ${todos.length} todos` });\n  },\n});\n```\n\nOutput schemas are optional (backward compatible). They describe the shape of `CommandResult.data`, not the full envelope. No runtime output validation is performed.\n\n### Command with Context Scoping\n\nRestrict commands to specific contexts for large command sets:\n\n```typescript\nconst formatDoc = defineCommand({\n  name: 'doc-format',\n  description: 'Format the current document',\n  contexts: ['editing'],  // Only visible when 'editing' context is active\n  input: z.object({ style: z.string() }),\n  async handler(input) { ... },\n});\n```\n\nCommands without `contexts` are universal (always visible). See \"Context Management\" below for server-level context configuration.\n\n### Command that asks for confirmation\n\nA command with `confirmPrompt` can be gated on the server's MCP and HTTP surfaces with the\n`confirmations` option ([`spec/command-metadata.md`](../../spec/command-metadata.md#confirmations)):\n\n```typescript\nconst clearTodos = defineCommand({\n  name: 'todo-clear',\n  description: 'Delete every todo',\n  mutation: true,\n  destructive: true,\n  confirmPrompt: 'Delete every todo? This cannot be undone.',\n  input: z.object({}),\n  async handler() { ... },\n});\n\ncreateMcpServer({ name: 'todo', version: '1.0.0', commands: [clearTodos], confirmations: 'enforce' });\n```\n\n- **An MCP client that supports elicitation** is asked `confirmPrompt` through an\n  `input_required` result, and the command runs only if the user accepts. A decline gives\n  `CONFIRMATION_DECLINED`.\n- **Any other caller** gets `CONFIRMATION_REQUIRED` until it repeats the call with\n  `confirm: true` (on `afd-batch` and `afd-pipe`, `confirm: ['todo-clear']`; on the HTTP\n  routes, the `Afd-Confirm: todo-clear` header). That acknowledgement comes from the agent, not\n  the user. `confirmations: 'require-human'` refuses it and accepts only an elicitation.\n- **The `requestState` key is per process by default.** Without `confirmationKey` (a string or\n  bytes, 32 bytes or more, checked when the server is created), each process signs the\n  confirmation's `requestState` with its own random key, so the answer must reach the process\n  that asked. Several instances behind one URL need the same `confirmationKey`; see\n  [Several instances](#several-instances).\n\n`server.execute()` and DirectClient calls are never gated.\n\n\n## Server Configuration\n\n```typescript\nconst server = createMcpServer({\n  // Required\n  name: 'my-server',\n  version: '1.0.0',\n  commands: [cmd1, cmd2, cmd3],\n\n  // Optional\n  port: 3100,              // Default: 3100\n  host: 'localhost',       // Default: localhost\n  transport: 'http',       // Default: 'auto' (see the pitfall above)\n  cors: true,              // Send CORS headers for accepted origins (default: false)\n  toolStrategy: 'grouped', // Default: 'grouped' (see \"Tool Strategies\")\n  bootstrap: true,         // Add afd-help, afd-docs, afd-schema (default: false)\n  resources: provider,     // MCP resources (see \"Resources, Skills and Tool _meta\")\n  skills: catalog,         // Agent Skills over MCP (a SkillCatalog)\n\n  // Per-request context for HTTP calls (see \"Request Context\")\n  createContext: (req) => ({ clientIp: req.socket.remoteAddress ?? 'unknown' }),\n\n  // Middleware — zero-config observability\n  middleware: defaultMiddleware(),\n\n  // Several processes behind one URL (see \"Several instances\")\n  instances: 'multiple',\n  confirmationKey: process.env.AFD_CONFIRMATION_KEY!, // shared by every instance\n\n  // Callbacks\n  onCommand(command, input, result) {\n    console.log(`Executed ${command}:`, result.success);\n  },\n  onError(error) {\n    console.error('Server error:', error);\n  },\n});\n```\n\n### Several instances\n\nTwo things are kept per process unless you share them:\n\n| What | Default | Used when | Share it with |\n|------|---------|-----------|---------------|\n| The key that signs elicitation `requestState` | A random key per server or handler, so even two handlers in one process do not share it | `confirmations` is not `'off'`, or an approval middleware has `relay: 'mcp-elicitation'` | `confirmationKey` on every instance (32 bytes or more) |\n| Spent single-use approval tokens | In memory, per `createApprovalMiddleware` | An approval middleware with the default `replay: 'single-use'` | `nonceStore` on every instance's approval middleware |\n\nBehind one process the defaults are enough. Behind several (a load balancer, or several engines answering the same callers), a `requestState` signed by one process is unanswered on another, so the person is asked again, and a single-use token works once on each process. Say which you run with `instances`:\n\n- **`instances: 'multiple'`**: creating the server throws unless each default in use is supplied, naming what is missing.\n- **`instances: 'single'`**: one process serves every request; nothing is required or logged. A supplied `confirmationKey` is still checked (32 bytes or more).\n- **Left out**: as `'single'`, but a server served over HTTP (`start()` on the HTTP transport, or `createMcpHandler`) logs one warning to stderr when it relies on either default, once per process however many servers and handlers it creates. stdio logs nothing.\n\nThe check sees approval middleware passed in `middleware` directly or inside `composeMiddleware`, made by any installed copy of this package from this version on (older copies do not mark theirs), but not one wrapped inside another middleware. A `taskStore` is shared separately.\n\nThe `instances` check is TypeScript only for now. The Python server (`create_server(confirmation_key=...)`, else a random key per server, and the approval middleware's `nonce_store`, else memory) and the Rust server (`McpServer::with_confirmations_key`, else a random key, and `ApprovalMiddlewareOptions::with_nonce_store`, else memory) have the same defaults: share them yourself behind several processes.\n\n## Middleware\n\n### Default Middleware (Recommended)\n\n`defaultMiddleware()` returns a pre-configured stack of three middleware covering common observability needs:\n\n1. **Auto Trace ID** — generates `context.traceId` via `crypto.randomUUID()` when not present\n2. **Structured Logging** — logs command start/completion with trace ID correlation\n3. **Slow-Command Warnings** — warns when commands exceed a configurable threshold (default: 1000ms)\n\n```typescript\nimport { defaultMiddleware } from '@lushly-dev/afd-server';\n\n// Zero-config — all three enabled\nmiddleware: defaultMiddleware()\n\n// Selective disable\nmiddleware: defaultMiddleware({ timing: false })\n\n// Custom options\nmiddleware: defaultMiddleware({\n  logging: { logInput: true },\n  timing: { slowThreshold: 500, onSlow: (name, ms) => logger.warn(`${name}: ${ms}ms`) },\n  traceId: { generate: () => `custom-${Date.now()}` },\n})\n\n// Compose with custom middleware\nmiddleware: [...defaultMiddleware(), myAuthMiddleware, myRateLimiter]\n```\n\n### Logging\n\n```typescript\nimport { createLoggingMiddleware } from '@lushly-dev/afd-server';\n\nconst middleware = createLoggingMiddleware({\n  log: console.log,        // Custom log function\n  logInput: false,         // Don't log input (may contain sensitive data)\n  logResult: false,        // Don't log full results\n});\n```\n\n### Timing\n\n```typescript\nimport { createTimingMiddleware } from '@lushly-dev/afd-server';\n\nconst middleware = createTimingMiddleware({\n  slowThreshold: 1000,     // Warn if command takes > 1s\n  onSlow(command, durationMs) {\n    console.warn(`Slow command: ${command} took ${durationMs}ms`);\n  },\n});\n```\n\n### OpenTelemetry Tracing\n\n```typescript\nimport { trace } from '@opentelemetry/api';\nimport { createTracingMiddleware } from '@lushly-dev/afd-server';\n\nconst tracer = trace.getTracer('my-app');\n\nconst middleware = createTracingMiddleware({\n  tracer,\n  spanPrefix: 'command',   // Span names: command.user-create, etc.\n});\n```\n\n### Rate Limiting\n\nKey the limiter on a value that identifies the caller. Over HTTP, provide it with `createContext`; the default key (`'global'`) shares one budget between all clients, and `traceId` is unique per call, so it never limits anything.\n\n```typescript\nimport { createMcpServer, createRateLimitMiddleware } from '@lushly-dev/afd-server';\n\nconst server = createMcpServer({\n  name: 'my-server',\n  version: '1.0.0',\n  commands,\n  transport: 'http',\n  // Prefer an authenticated user ID; fall back to the socket address. Do not trust\n  // X-Forwarded-For unless your own proxy sets it.\n  createContext: (req) => ({\n    clientId: authenticate(req)?.userId ?? req.socket.remoteAddress ?? 'unknown',\n  }),\n  middleware: [\n    createRateLimitMiddleware({\n      maxRequests: 100,\n      windowMs: 60000,         // 100 requests per minute, per client\n      keyFn: (context) => String(context.clientId ?? 'unknown'),\n    }),\n  ],\n});\n```\n\n### Retries\n\n`createRetryMiddleware` reruns a command whose failure code passes `shouldRetry` (default: `TRANSIENT_ERROR` and `TIMEOUT`), up to `maxRetries` times (default: 3). The backoff is exponential and capped: retry `n` backs off `min(maxDelay, retryDelay * 2 ** (n - 1))`, with `retryDelay` defaulting to 100 ms and `maxDelay` to 5000 ms. With `jitter` (the default) each wait is a random time between half and all of that backoff; `jitter: false` waits exactly the backoff. When `context.signal` aborts, for example because the client disconnected or a batch deadline passed, the wait ends and the last failure is returned without further retries. Retry only commands that are safe to repeat.\n\n```typescript\nimport { createRetryMiddleware } from '@lushly-dev/afd-server';\n\nconst retry = createRetryMiddleware({\n  maxRetries: 4,\n  retryDelay: 200,  // 200, 400, 800, 1600 ms before jitter\n  maxDelay: 1000,   // ...capped at 1000 ms\n  shouldRetry: (code) => code === 'UPSTREAM_UNAVAILABLE',\n});\n```\n\n### Approvals\n\n`destructive` and `confirmPrompt` describe a command; `approval` holds it. A command whose `approval` policy requires it does not run until a human has approved that exact call. `createApprovalMiddleware` returns `APPROVAL_REQUIRED` before the handler runs, with a token the surface passes back once the human said yes:\n\n```typescript\nimport { createApprovalMiddleware, createMcpServer, defineCommand, success } from '@lushly-dev/afd-server';\n\nconst todoDelete = defineCommand({\n  name: 'todo-delete',\n  description: 'Delete a todo permanently',\n  mutation: true,\n  destructive: true,\n  // Or a function: (input, context) => context.actor?.kind === 'human' ? 'not-required' : 'required'\n  approval: 'required',\n  input: z.object({ id: z.string() }),\n  async handler(input) {\n    return success({ deleted: input.id });\n  },\n});\n\nconst server = createMcpServer({\n  name: 'todo',\n  version: '1.0.0',\n  commands: [todoDelete],\n  middleware: [\n    createApprovalMiddleware({\n      secret: process.env.AFD_APPROVAL_SECRET!, // required, at least 32 bytes, no default\n      summarize: (command, input) => `Delete todo ${(input as { id: string }).id} (permanent)`,\n    }),\n  ],\n});\n```\n\nA held call returns:\n\n```json\n{\n  \"success\": false,\n  \"error\": {\n    \"code\": \"APPROVAL_REQUIRED\",\n    \"message\": \"todo-delete needs approval before it runs\",\n    \"suggestion\": \"Ask the user to approve \\\"Delete todo 42 (permanent)\\\"; once they approve, the application retries the same call with the same input and details.approvalToken as its approval evidence (tool arguments cannot carry it). …\",\n    \"retryable\": false,\n    \"details\": { \"approvalToken\": \"afdap1.…\", \"expiresAt\": \"2026-10-26T12:05:00.000Z\", \"summary\": \"Delete todo 42 (permanent)\" }\n  }\n}\n```\n\nTo resume, retry the same command with the same input and `context.approval` set to the token, on the trusted host execution surface (`server.execute`). `createDirectRegistry` strips public `approval` evidence and keeps holds token-free; use a `DirectClient` with `onApprovalNeeded` to approve through its private exchange.\n\n- **The token is the approval.** It is an HMAC-SHA256 over the command name, a keyed digest of the validated input (canonical JSON: sorted keys, so key order and defaults do not matter), a keyed digest of the actor's `kind`, `id` and `onBehalfOf`, an expiry and a random nonce. Tampered, expired, other-command, other-input and other-actor tokens are rejected, using constant-time comparisons; the new result's `details.reason` says why (which also tells a token's holder that its signature is valid).\n- **Only trusted code sets `context.approval`**, after a human approved: a surface such as `createContext(req)` or the application, never tool arguments. Whoever holds a token can use it, and the `APPROVAL_REQUIRED` result goes to the caller. So `includeToken` defaults to `false` when `context.interface` is `'mcp'` (every MCP lane, and the HTTP routes of `createMcpHandler`), whose caller is the agent: deliver the token to the human through `onApprovalRequired`. Elsewhere it defaults to `true`; set it explicitly to override either default. A DirectClient/DirectRegistry or in-process CLI exchange always suppresses the token regardless of this option.\n- **Plain JSON input only.** A validated input holding a `Map`, `Set`, `RegExp`, typed array, class instance, `bigint` or non-finite number cannot be bound without ambiguity, so such a call fails before the handler instead of being held.\n- **Single-use by default.** A token runs the command once (`reason: 'already-used'` after). `replay: 'within-ttl'` lets it run the same call as often as it is presented until it expires, so one approval also covers repeats such as duplicate batch items. Spent tokens are remembered in memory by this middleware instance, so by default a token works once per process: share one `nonceStore` (`consume(nonce, expiresAt)` returning `true` only for an unused nonce, atomically) between every instance that uses the secret, across processes or between a server and a `createDirectRegistry`. A server with `instances: 'multiple'` refuses single-use approval middleware without one ([Several instances](#several-instances)).\n- **Short-lived.** `ttlMs` defaults to 5 minutes, at most 24 hours. Time comes from the `clock` option, else the system clock; never from `context.clock`, which a caller can set.\n- **Key rotation:** pass `secret: [newKey, oldKey]`; the first signs, any verifies.\n- **WebCrypto.** The middleware uses `globalThis.crypto` (Node.js 22 and every current browser on a secure origin), so it also runs in a browser or webview through `@lushly-dev/afd-server/direct`. Tokens are byte for byte the same in TypeScript, Python, Rust and C++ (`spec/vectors/approval-tokens.json`).\n- **In a page, the secret is not a boundary.** A signing secret held in a page is visible to every script on that page. The gate still stops a model from approving its own call through tool input, and DirectClient's private exchange never puts the secret or a token in a result the model reads, but it does not protect against code running in the page. When you need that, keep approvals on a server.\n- **Fails closed.** A policy function that returns anything but `'not-required'` holds the call; one that throws fails it before the handler. Write policies so that a missing actor is held (`kind === 'human' ? 'not-required' : 'required'`).\n- **A declared policy always holds.** The middleware decides from the policy and `confirmPrompt` of the command each call runs, and from the policy its `commands` option lists for that command: a call is held when either holds it. Without an approval middleware, `createMcpServer` and `createDirectRegistry` refuse a command whose policy is not `'not-required'` with `APPROVAL_UNAVAILABLE` before its handler runs (a policy function is not evaluated: declaring one needs the middleware). Each batch item, pipeline step and command run from another command's handler is checked on its own. The `commands` option is optional; outside those two, where no engine names the command, only it decides, and a command missing from it is not held.\n- **One approval runs one handler, on the approved input.** The middleware admits the command and the canonical input it decided on (the input it verified the token against, computed before any await), and the engine takes that admission as it dispatches: a second dispatch on the same context, another command or an input changed after the approval answers `APPROVAL_UNAVAILABLE`. This holds whether the gating policy is the command's own or given only in the `commands` option. A call that needs approval on a validated input with no canonical form (a `bigint`, a `Set`, a class instance from a transform) gets `APPROVAL_UNAVAILABLE` with `details.reason: 'input-not-canonical'` from the middleware, without asking anyone; one its policy lets through runs, compared by identity at dispatch (a change inside the same object is not seen). An input that changes while the middleware decides (in a policy function) is refused the same way, and nobody is asked. Install one approval middleware per engine: a second one that does not gate a command leaves the first one's admission to decide, and a retry between two that both admit a call is refused, since each must admit it again; but two that both gate a command's own policy each ask. So put `createRetryMiddleware` before (outside) the approval middleware, where each attempt is decided again, never after it, where a retry is refused; and never change `input` in middleware after the approval.\n- **Admission is not a boundary against code in the same process or page.** The records live on `globalThis`, shared by installed copies of this package, and any code running beside it could reach them; the gate stops the model, as the secret does in a page.\n- **Actor binding is as strong as the actor.** The MCP default actor is `{ kind: 'agent' }` with no `id`, so tokens are bound to a specific agent or user only when `createContext` or auth middleware sets one. Install the middleware after any middleware that sets or refines `context.actor`.\n- **Batches and pipelines** pass one `context.approval` to every step. Retrying a pipeline reruns its ungated steps, and a gated step whose input comes from an earlier step may never match its token, so approve such steps as separate calls. Over MCP with `relay: 'mcp-elicitation'`, a batch or pipeline is approved up front instead (below).\n- `afd validate` warns (`MISSING_APPROVAL_POLICY`) about `mutation` or `destructive` commands that declare no policy. Declare `approval: 'not-required'` to say a command was considered and needs none.\n\n#### Asking the human over MCP\n\nOver MCP the caller is the agent, so the human has to be reached some other way. With `relay: 'mcp-elicitation'`, the middleware asks the human behind the MCP client, through a form elicitation, instead of returning a token:\n\n```typescript\ncreateApprovalMiddleware({ secret, relay: 'mcp-elicitation' });\n```\n\nA call to one gated command (its own tool, `afd-call` or a grouped tool) from a client that declares form elicitation gets an `input_required` result on `/mcp` (MCP 2026-07-28), or a server-sent `elicitation/create` on a 2025-era stdio connection. The form shows the approval summary, the command name and its validated input, and one required `approve` checkbox. The client asks its user and retries, and the command runs once:\n\n- the `requestState` verifies (HMAC-signed with `confirmationKey`, bound to the method and the OAuth client id when there is one; an answer counts for 10 minutes from when it was asked);\n- it names this command, validated input and actor (a digest keyed with the approval secret), and its nonce and expiry carry a MAC under the approval secret, so `confirmationKey` alone cannot mint an approval;\n- the approval has not expired (`ttlMs`, on the middleware's clock);\n- the answer is `accept` with `approve: true`;\n- its nonce is unspent (single-use by default; `replay: 'within-ttl'` allows reuse).\n\nNo approval token is issued on this path, so the model never sees one. A stale, altered or mismatched state counts as unanswered and the human is asked again. A declined or cancelled form fails the call with `APPROVAL_REQUIRED`, `details.reason: 'declined'` and `retryable: false`. A call that needs both a confirmation and an approval asks for each in turn.\n\nCalls that cannot elicit fail with `APPROVAL_REQUIRED` and no token, as without the relay:\n\n- the client declares no form elicitation;\n- a 2025-era HTTP request, or the legacy `/message` lane, which have no back channel.\n\nAn `afd-batch` or `afd-pipe` from a client that can elicit is approved up front, as a whole, before any step runs (#459): asking mid-run would rerun the earlier steps on the retry. One form lists every gated step's summary, command and validated input (a pipeline's `$input` references resolved), at most 20 of them, and on acceptance each gated step runs once on its own approval, bound to the whole request as sent and to its command, input and actor: an approval covers that exact batch or pipeline, never another call. Every nonce is spent before the first step runs, so a replayed retry runs nothing. A step whose command has an approval policy runs on the input validated up front, and the retry reads each gated step's approved input back from the `requestState`, so a schema whose default is random or reads the clock (`.default(() => randomUUID())`) runs the input the human was shown (#1414). The step is still validated as sent when it runs, so a schema that checks state an earlier step changed fails it with `VALIDATION_ERROR`. The `requestState` is signed, not encrypted: the client can read the kept input, schema defaults and transforms included, so a gated command's schema must not compute a secret. A decline runs nothing (`reason: 'declined'`). A pipeline whose gated step takes its input from an earlier step (`$prev`, `$first`, `$steps`) cannot be shown to the human first, so it runs nothing and fails with `APPROVAL_REQUIRED`, `details.reason: 'input-not-known'` and the step's index and command: split it there and call that command on its own.\n\nOnly the command the tool call routes to can use the relay, once: a command that a handler runs cannot elicit. An accepted approval that has expired or was already used is asked again, and the question says so. `onApprovalRequired` is not called on the relay path, since no token exists.\n\n#### An approver client\n\nA trusted MCP client that shows a person the held action itself, such as an application shell that mounts this server, can carry the person's decision back (`spec/command-metadata.md`, \"Approval evidence from an approver client\"). Name it with `approver`, a predicate over the call's context after `createContext`:\n\n```typescript\ncreateMcpServer({\n\tname: 'mail',\n\tversion: '1.0.0',\n\tcommands,\n\tcreateContext: (_req, { credentials }) => ({ credentials }),\n\tapprover: (context) => context.credentials?.clientId === 'loam-shell',\n\tmiddleware: [createApprovalMiddleware({ secret })],\n});\n```\n\n- **An approver gets the token:** its `APPROVAL_REQUIRED` results carry `details.approvalToken` whatever `includeToken` says, and the relay never answers it with a form.\n- **It retries one command on MCP 2026-07-28** with the token in `_meta[\"dev.afd/approval\"]` (`AFD_APPROVAL_META_KEY`) and the same input. On `afd-batch`, `afd-pipe` or a 2025-era request the key fails the call with `APPROVAL_REQUIRED` before anything runs.\n- **Its tokens bind its principal binding** (the actor and the credentials' issuer, subject and client), so another client, even of the same person, gets `credentials-mismatch`.\n- **Anyone else's key is ignored,** and the key in tool arguments (or the HTTP routes' input) is refused with `VALIDATION_ERROR`, from every caller.\n- **The approver promises** never to give the token to an agent or a model, and to present it only on a retry a person approved after seeing the action, shown by `approvalDisplay` from `@lushly-dev/afd-core`, which refuses input too large, too deep or hiding characters.\n\nThe relay trusts the MCP client application to put the question to a person. The server cannot tell a human's click from client code that accepts on its own, so the relay is off by default. Leave it off where the agent's own code is the MCP client, for example an `McpClient` whose `onElicitation` answers automatically. The relay's `requestState` is signed with the server's `confirmationKey`, a random key per process when it is not set, and its nonces are spent in the middleware's `nonceStore`, in memory per process by default: servers with several instances must share both and set `instances: 'multiple'` ([Several instances](#several-instances)).\n\n`spec/command-metadata.md` (\"Approvals\") is the cross-language contract.\n\n### Declared Context Fields\n\nSome values belong to a request rather than to one command's input: the project a shell is scoped to, the space a query targets, the calling app, a locale. Declare each one on the server or registry with `contextFields`, and a call carries it on its context under the field's name:\n\n```typescript\nconst server = createMcpServer({\n  name: 'shell',\n  version: '1.0.0',\n  commands,\n  contextFields: [\n    { name: 'scope', meta: 'dev.example/scope', schema: z.object({ project: z.string() }), journal: true },\n    { name: 'locale', meta: 'dev.example/locale', schema: z.string().max(35) },\n  ],\n});\nawait server.execute('project-summary', {}, { scope: { project: 'p-1' } });\n// The handler reads context.scope, validated by its schema.\n```\n\n- The value is validated before middleware runs. An invalid value, or a missing `required: true` one, fails the call with `VALIDATION_ERROR`, whose `details` name the `field` and its `meta` key. `null` is no value. AFD's own `afd-*` commands do not enforce `required`, so a client can discover the fields first.\n- Names AFD already uses (`actor`, `approval`, `auth`, `clock`, `credentials`, `interface`, `random`, `session`, `signal`, `source`, `timeout`, `traceId`) are refused, as is a `meta` key without a reverse-DNS prefix or with `dev.afd/` or an MCP-reserved prefix.\n- A field is a claim made by the caller: use it to narrow what a handler does (pick a project), never to grant access. Check the caller's access to the claimed scope.\n- `journal: true` keeps the value in the journal (below). Only declare it for a field that never holds a secret.\n- Over MCP the value comes from `tools/call`'s `params._meta[meta]`, on both eras and over stdio and HTTP; undeclared `_meta` keys are dropped, and a value `createContext` sets for the same name wins. On AFD's HTTP lanes, `/message` reads `params._meta`, `/rpc` reads `params._meta` and `/stream` the `_meta` member of its input (both leave it out of the command input), and `/batch` reads the body's `_meta`.\n- A client that cannot set `_meta` can send the same values in the meta-tools' `meta` argument: `afd-call`, `afd-batch`, `afd-pipe`, `afd-discover` and `afd-detail` take `meta: { \"dev.afd/context\": \"billing\", \"dev.loam/scope\": { ... } }`, applied as if sent in `_meta`. Other keys are dropped, and a key sent both ways must agree, or the call fails with `VALIDATION_ERROR`.\n- `server/discover` lists the fields under `_meta[\"dev.afd/context-fields\"]` and `afd-help` returns them as `contextFields`, each with its JSON Schema. `tools/list` never varies by a field. `spec/context-fields.md` is the cross-language contract.\n\n### Command Journal and Replay\n\n`createJournalMiddleware(sink)` records each accepted call (validation and lookup rejections never reach middleware) as a `JournalEntry`: command, validated input, actor, trace ID, a context digest, the result and the duration. Context values outside the allowlist (actor, interface, trace ID) are never stored, so auth sessions and tokens stay out of the journal. Each entry also holds a tape of the values the handler read from `context.clock` and `context.random`. Failures are recorded only with `recordFailures: true`. When a result cannot be copied as JSON (a throwing getter, circular reference or `bigint`), the error goes to `onError`, the live return value is unchanged, and the entry records a `JOURNAL_RESULT_UNSERIALIZABLE` failure instead of dropping the call. A [declared context field](#declared-context-fields) marked `journal: true` is kept in the entry's `context`, or named in `contextOmitted` when its canonical JSON exceeds 4096 bytes, and replay restores it. Commands named `auth-*` are skipped by default; `filter` and `redact` keep other secret inputs or results out (drop `tape` as well when a secret comes from `context.random`). Put it last in the middleware list.\n\n`replayJournal(registry, entries)` re-runs the entries in order against a fresh server or registry, feeds each call its recorded clock and random values, and reports every entry as `same`, `different` (with a structural diff) or `error`. For an entry recorded with `JOURNAL_RESULT_UNSERIALIZABLE`, replay still runs the command and adds a note that the original result was not captured: an unserializable replayed result reports `error`, a serializable one reports `different`, and a recorded-answer target returning the entry verbatim reports `same` with the note. Replay against a server with the same middleware: the journal middleware in it lines the tape up with the handler and records nothing during replay. It reports divergence; it does not make other nondeterminism go away. A journal entry does not show that a call was approved: with `recordFailures: true` the journal also keeps calls that never ran, such as an `APPROVAL_REQUIRED` hold, and `replayJournal` executes every entry it is given before comparing, failed ones included. So replay gated commands against a target with the approval middleware, which holds them again, or pass only the entries whose recorded result succeeded (`entries.filter((entry) => entry.result.success)`) to a target that serves those commands with `approval: 'not-required'`. A target without either refuses them with `APPROVAL_UNAVAILABLE`. The format is specified in [`spec/journal.md`](../../spec/journal.md).\n\n```typescript\nimport { readFileSync } from 'node:fs';\nimport { parseJournal } from '@lushly-dev/afd-core';\nimport { FileJournalSink } from '@lushly-dev/afd-core/journal-file';\nimport { createJournalMiddleware, createMcpServer, replayJournal } from '@lushly-dev/afd-server';\n\n// Record\nconst server = createMcpServer({\n  name: 'todo',\n  version: '1.0.0',\n  commands,\n  middleware: [createJournalMiddleware(new FileJournalSink('./session.jsonl'))],\n});\n\n// Later: replay against a fresh build\nconst entries = parseJournal(readFileSync('./session.jsonl', 'utf8'));\nconst report = await replayJournal(createMcpServer({ name: 'todo', version: '2.0.0', commands }), entries);\nfor (const entry of report.entries.filter((e) => e.status !== 'same')) {\n  console.log(entry.seq, entry.command, entry.status, entry.differences ?? entry.error);\n}\n```\n\n### Custom Middleware\n\n```typescript\nimport type { CommandMiddleware } from '@lushly-dev/afd-server';\n\nconst myMiddleware: CommandMiddleware = async (commandName, input, context, next) => {\n  console.log(`Before: ${commandName}`);\n  const result = await next();\n  console.log(`After: ${commandName}, success: ${result.success}`);\n  return result;\n};\n```\n\n## In-Process Agents: `createDirectRegistry`\n\nFor an AI agent in the same process, `DirectClient` from `@lushly-dev/afd-client`\nskips the transport. Give it a registry built with `createDirectRegistry`, not\none that calls `command.handler(input)` directly: the registry runs every call\nthrough the same engine as `createMcpServer` (Zod input validation, middleware,\nerror sanitization, `onCommand`/`onError`), and only lists and runs commands\nexposed to the chosen interface.\n\n```typescript\nimport { createDirectClient } from '@lushly-dev/afd-client';\nimport { createDirectRegistry, createLoggingMiddleware } from '@lushly-dev/afd-server';\n\nconst registry = createDirectRegistry(commands, {\n  interface: 'agent',                    // default\n  middleware: [createLoggingMiddleware()],\n});\nconst client = createDirectClient(registry);\n\nawait client.call('todo-create', { title: { nested: true } });\n// → { success: false, error: { code: 'VALIDATION_ERROR', ... } }\n```\n\n| Option | Default | Description |\n|--------|---------|-------------|\n| `interface` | `'agent'` | Interface served: `'agent'`, `'palette'`, `'mcp'` or `'cli'` |\n| `middleware` | `[]` | Middleware, as for `createMcpServer` |\n| `devMode` | `false` | Include exception messages and stacks in failures |\n| `onCommand`, `onError` | — | Hooks, as for `createMcpServer` |\n| `contexts` | — | Contexts, as for `createMcpServer`; a call names its own in the `activeContext` option |\n| `tools` | — | `createDirectToolSurface()`: `listTools`, the meta-tools, the context tools and, optionally, the bootstrap tools |\n\nA command is exposed to the interface when its `expose` flag for it is `true`.\nFlags a command leaves out fall back to `defaultExpose` (`palette` and `agent`\non, `mcp` and `cli` off), so `expose: { mcp: true }` stays available to agents.\nSet `expose: { agent: false }` to keep a command away from in-app agents.\nCommands that are registered but not exposed are left out of\n`listCommands()`/`hasCommand()`, and `execute()` returns `COMMAND_NOT_EXPOSED`\nfor them. Duplicate command names throw.\n\n## Validation Utilities\n\n```typescript\nimport { validateInput, validateOrThrow, isValid, patterns } from '@lushly-dev/afd-server';\n\n// Validate and get result\nconst result = validateInput(schema, data);\nif (!result.success) {\n  console.log(result.errors);\n}\n\n// Validate or throw\ntry {\n  const data = validateOrThrow(schema, input);\n} catch (e) {\n  if (e instanceof ValidationException) {\n    console.log(e.errors);\n  }\n}\n\n// Check validity\nif (isValid(schema, data)) {\n  // data is typed\n}\n\n// Common patterns\nconst schema = z.object({\n  id: patterns.uuid,\n  email: patterns.email,\n  count: patterns.positiveInt,\n  ...patterns.pagination,\n});\n```\n\n## API Reference\n\n### defineCommand(options)\n\nCreate a command definition with Zod schema.\n\n| Option | Type | Required | Description |\n|--------|------|----------|-------------|\n| `name` | string | Yes | Unique command name (e.g., `user-create`) |\n| `description` | string | Yes | Human-readable description |\n| `input` | ZodType | Yes | Zod schema for input validation; advertised in Zod input mode (defaulted fields optional, transforms allowed) |\n| `handler` | function | Yes | Command implementation |\n| `category` |","readmeFilename":"README.md"}