feat: add SchemaAdapter system for typemap integration (Zod/Valibot), fix scanner pathToFileURL

- Add from_typemap.ts with SchemaAdapter interface, defaultAdapter, zodAdapter(), valibotAdapter()
- OperationRegistry now accepts optional { schemaAdapter } config; default is TypeBox passthrough
- Adapters use @alkdev/typemap (optional peer dep) with lazy init; detect schemas via ~standard vendor protocol
- Fix scanner pathToFileURL to encode URI components and normalize Windows backslashes
- Add from-typemap sub-path export in package.json and tsup config
- Add test suite covering defaultAdapter, zodAdapter, valibotAdapter, and registry integration
This commit is contained in:
2026-05-16 09:24:34 +00:00
parent 92936f4232
commit 3e1884cd23
8 changed files with 390 additions and 19 deletions

View File

@@ -26,6 +26,16 @@
"types": "./dist/from-mcp.d.cts",
"default": "./dist/from-mcp.cjs"
}
},
"./from-typemap": {
"import": {
"types": "./dist/from-typemap.d.ts",
"default": "./dist/from-typemap.js"
},
"require": {
"types": "./dist/from-typemap.d.cts",
"default": "./dist/from-typemap.cjs"
}
}
},
"publishConfig": {
@@ -53,27 +63,33 @@
],
"license": "MIT OR Apache-2.0",
"dependencies": {
"@alkdev/typebox": "^0.34.49",
"@alkdev/pubsub": "^0.1.0",
"@alkdev/typebox": "^0.34.49",
"@logtape/logtape": "^2.0.0"
},
"peerDependencies": {
"@alkdev/typemap": "^0.10.0",
"@modelcontextprotocol/sdk": "^1.0.0"
},
"peerDependenciesMeta": {
"@modelcontextprotocol/sdk": {
"optional": true
},
"@alkdev/typemap": {
"optional": true
}
},
"devDependencies": {
"@types/node": "^22.0.0",
"@alkdev/typemap": "^0.10.1",
"@modelcontextprotocol/sdk": "^1.12.1",
"@types/node": "^22.0.0",
"@vitest/coverage-v8": "^3.2.4",
"tsup": "^8.5.1",
"typescript": "^5.7.0",
"valibot": "^1.4.0",
"vitest": "^3.1.0"
},
"engines": {
"node": ">=18.0.0"
}
}
}