Skip to content

Commit a4af55f

Browse files
authored
Merge pull request #13 from universal-tool-calling-protocol/dev
MCP resolve defs refs
2 parents 40456d5 + 539efc4 commit a4af55f

File tree

5 files changed

+161
-38
lines changed

5 files changed

+161
-38
lines changed

bun.lock

Lines changed: 23 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -29,20 +29,20 @@
2929
},
3030
"packages/code-mode": {
3131
"name": "@utcp/code-mode",
32-
"version": "1.0.0",
32+
"version": "1.0.5",
3333
"dependencies": {
34-
"@utcp/sdk": "^1.0.15",
35-
"vm2": "^3.9.19",
34+
"@utcp/sdk": "^1.0.17",
3635
},
3736
"devDependencies": {
3837
"@types/node": "^20.0.0",
38+
"@utcp/direct-call": "^1.0.12",
3939
"bun-types": "latest",
4040
"typescript": "^5.0.0",
4141
},
4242
},
4343
"packages/core": {
4444
"name": "@utcp/sdk",
45-
"version": "1.0.16",
45+
"version": "1.0.17",
4646
"dependencies": {
4747
"dotenv": "^17.2.1",
4848
"zod": "^3.23.8",
@@ -56,7 +56,7 @@
5656
"name": "@utcp/direct-call",
5757
"version": "1.0.12",
5858
"dependencies": {
59-
"@utcp/sdk": "^1.0.4",
59+
"@utcp/sdk": "^1.0.15",
6060
},
6161
"devDependencies": {
6262
"@types/bun": "latest",
@@ -109,14 +109,16 @@
109109
},
110110
"packages/mcp": {
111111
"name": "@utcp/mcp",
112-
"version": "1.0.12",
112+
"version": "1.0.17",
113113
"dependencies": {
114+
"@apidevtools/json-schema-ref-parser": "^15.1.2",
114115
"@modelcontextprotocol/sdk": "^1.17.4",
115-
"@utcp/sdk": "^1.0.4",
116+
"@utcp/sdk": "^1.0.15",
116117
"axios": "^1.11.0",
117118
},
118119
"devDependencies": {
119120
"@types/bun": "latest",
121+
"@types/json-schema": "^7.0.15",
120122
"bun-types": "latest",
121123
"typescript": "^5.9.2",
122124
"zod-to-json-schema": "^3.24.6",
@@ -140,6 +142,8 @@
140142
"zod": "^3.23.8",
141143
},
142144
"packages": {
145+
"@apidevtools/json-schema-ref-parser": ["@apidevtools/json-schema-ref-parser@15.1.2", "", { "dependencies": { "js-yaml": "^4.1.1" }, "peerDependencies": { "@types/json-schema": "^7.0.15" } }, "sha512-54vnqDyGsDAVM0LOIdGMnfVyCN1NlqoGnHEGpMfaDBLMvClfT4j2XbJgvfuF0Ca0kxT6Gb7xUgS5W1I14QqjiQ=="],
146+
143147
"@esbuild/aix-ppc64": ["@esbuild/aix-ppc64@0.25.11", "", { "os": "aix", "cpu": "ppc64" }, "sha512-Xt1dOL13m8u0WE8iplx9Ibbm+hFAO0GsU2P34UNoDGvZYkY8ifSiy6Zuc1lYxfG7svWE2fzqCUmFp5HCn51gJg=="],
144148

145149
"@esbuild/android-arm": ["@esbuild/android-arm@0.25.11", "", { "os": "android", "cpu": "arm" }, "sha512-uoa7dU+Dt3HYsethkJ1k6Z9YdcHjTrSb5NUy66ZfZaSV8hEYGD5ZHbEMXnqLFlbBflLsl89Zke7CAdDJ4JI+Gg=="],
@@ -264,6 +268,8 @@
264268

265269
"@types/js-yaml": ["@types/js-yaml@4.0.9", "", {}, "sha512-k4MGaQl5TGo/iipqb2UDG2UwjXziSWkh0uysQelTlJpX1qGlpUZYm8PnO4DxG1qBomtJUdYJ6qR6xdIah10JLg=="],
266270

271+
"@types/json-schema": ["@types/json-schema@7.0.15", "", {}, "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA=="],
272+
267273
"@types/node": ["@types/node@20.19.24", "", { "dependencies": { "undici-types": "~6.21.0" } }, "sha512-FE5u0ezmi6y9OZEzlJfg37mqqf6ZDSF2V/NLjUyGrR9uTZ7Sb9F7bLNZ03S4XVUNRWGA7Ck4c1kK+YnuWjl+DA=="],
268274

269275
"@types/react": ["@types/react@19.1.12", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-cMoR+FoAf/Jyq6+Df2/Z41jISvGZZ2eTlnsaJRptmZ76Caldwy1odD4xTr/gNV9VLj0AWgg/nmkevIyUfIIq5w=="],
@@ -290,8 +296,6 @@
290296

291297
"acorn": ["acorn@8.15.0", "", { "bin": { "acorn": "bin/acorn" } }, "sha512-NZyJarBfL7nWwIq+FDL6Zp/yHEhePMNnnJ0y3qfieCrmNvYct8uvtiV41UvlSe6apAfk0fY1FbWx+NwfmpvtTg=="],
292298

293-
"acorn-walk": ["acorn-walk@8.3.4", "", { "dependencies": { "acorn": "^8.11.0" } }, "sha512-ueEepnujpqee2o5aIYnvHU6C0A42MNdsIDeqy5BydrkuC5R1ZuUFnm27EeFJGoEHJQgn3uleRvmTXaJgfXbt4g=="],
294-
295299
"ajv": ["ajv@6.12.6", "", { "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", "json-schema-traverse": "^0.4.1", "uri-js": "^4.2.2" } }, "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g=="],
296300

297301
"ansi-regex": ["ansi-regex@6.2.2", "", {}, "sha512-Bq3SmSpyFHaWjPk8If9yc6svM8c56dB5BAtW4Qbw5jHTwwXXcTLoRMkpDJp6VL0XzlWaCHTXrkFURMYmD0sLqg=="],
@@ -620,8 +624,6 @@
620624

621625
"vary": ["vary@1.1.2", "", {}, "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg=="],
622626

623-
"vm2": ["vm2@3.10.0", "", { "dependencies": { "acorn": "^8.14.1", "acorn-walk": "^8.3.4" }, "bin": { "vm2": "bin/vm2" } }, "sha512-3ggF4Bs0cw4M7Rxn19/Cv3nJi04xrgHwt4uLto+zkcZocaKwP/nKP9wPx6ggN2X0DSXxOOIc63BV1jvES19wXQ=="],
624-
625627
"webidl-conversions": ["webidl-conversions@4.0.2", "", {}, "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg=="],
626628

627629
"whatwg-url": ["whatwg-url@7.1.0", "", { "dependencies": { "lodash.sortby": "^4.7.0", "tr46": "^1.0.1", "webidl-conversions": "^4.0.2" } }, "sha512-WUu7Rg1DroM7oQvGWfOiAK21n74Gg+T4elXEQYkOhtyLeWiJFoOGLXPKI/9gzIie9CtwVLm8wtw6YJdKyxSjeg=="],
@@ -638,23 +640,29 @@
638640

639641
"zod-to-json-schema": ["zod-to-json-schema@3.24.6", "", { "peerDependencies": { "zod": "^3.24.1" } }, "sha512-h/z3PKvcTcTetyjl1fkj79MHNEjm+HpD6NXheWjzOekY7kV+lwDYnHw+ivHkijnCSMz1yJaWBD9vu/Fcmk+vEg=="],
640642

643+
"@apidevtools/json-schema-ref-parser/js-yaml": ["js-yaml@4.1.1", "", { "dependencies": { "argparse": "^2.0.1" }, "bin": { "js-yaml": "bin/js-yaml.js" } }, "sha512-qQKT4zQxXl8lLwBtHMWwaTcGfFOZviOJet3Oy/xmGk2gZH677CJM9EvtfdSkgWcATZhj/55JZ0rmy3myCT5lsA=="],
644+
641645
"@types/bun/bun-types": ["bun-types@1.3.0", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ=="],
642646

643647
"@utcp/cli/bun-types": ["bun-types@1.3.0", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ=="],
644648

645-
"@utcp/code-mode/bun-types": ["bun-types@1.3.1", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
649+
"@utcp/code-mode/bun-types": ["bun-types@1.3.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-z3Xwlg7j2l9JY27x5Qn3Wlyos8YAp0kKRlrePAOjgjMGS5IG6E7Jnlx736vH9UVI4wUICwwhC9anYL++XeOgTQ=="],
650+
651+
"@utcp/direct-call/@types/bun": ["@types/bun@1.3.3", "", { "dependencies": { "bun-types": "1.3.3" } }, "sha512-ogrKbJ2X5N0kWLLFKeytG0eHDleBYtngtlbu9cyBKFtNL3cnpDZkNdQj8flVf6WTZUX5ulI9AY1oa7ljhSrp+g=="],
646652

647-
"@utcp/direct-call/bun-types": ["bun-types@1.3.0", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ=="],
653+
"@utcp/direct-call/bun-types": ["bun-types@1.3.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-z3Xwlg7j2l9JY27x5Qn3Wlyos8YAp0kKRlrePAOjgjMGS5IG6E7Jnlx736vH9UVI4wUICwwhC9anYL++XeOgTQ=="],
648654

649655
"@utcp/dotenv-loader/bun-types": ["bun-types@1.3.1", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
650656

651657
"@utcp/file/bun-types": ["bun-types@1.3.1", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
652658

653659
"@utcp/http/bun-types": ["bun-types@1.3.1", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
654660

655-
"@utcp/mcp/bun-types": ["bun-types@1.3.0", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-u8X0thhx+yJ0KmkxuEo9HAtdfgCBaM/aI9K90VQcQioAmkVp3SG3FkwWGibUFz3WdXAdcsqOcbU40lK7tbHdkQ=="],
661+
"@utcp/mcp/@types/bun": ["@types/bun@1.3.3", "", { "dependencies": { "bun-types": "1.3.3" } }, "sha512-ogrKbJ2X5N0kWLLFKeytG0eHDleBYtngtlbu9cyBKFtNL3cnpDZkNdQj8flVf6WTZUX5ulI9AY1oa7ljhSrp+g=="],
662+
663+
"@utcp/mcp/bun-types": ["bun-types@1.3.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-z3Xwlg7j2l9JY27x5Qn3Wlyos8YAp0kKRlrePAOjgjMGS5IG6E7Jnlx736vH9UVI4wUICwwhC9anYL++XeOgTQ=="],
656664

657-
"@utcp/sdk/bun-types": ["bun-types@1.3.1", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
665+
"@utcp/sdk/bun-types": ["bun-types@1.3.3", "", { "dependencies": { "@types/node": "*" } }, "sha512-z3Xwlg7j2l9JY27x5Qn3Wlyos8YAp0kKRlrePAOjgjMGS5IG6E7Jnlx736vH9UVI4wUICwwhC9anYL++XeOgTQ=="],
658666

659667
"@utcp/text/bun-types": ["bun-types@1.3.1", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-NMrcy7smratanWJ2mMXdpatalovtxVggkj11bScuWuiOoXTiKIu2eVS1/7qbyI/4yHedtsn175n4Sm4JcdHLXw=="],
660668

package-lock.json

Lines changed: 74 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/mcp/README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ The `@utcp/mcp` package enables the `UtcpClient` to interact with tools defined
55
## Features
66

77
* **Automatic Plugin Registration**: Registers automatically when imported—no manual setup required.
8+
* **FastMCP 2.0+ Compatibility**: Automatically resolves JSON Schema `$defs` references, ensuring compatibility with modern MCP servers built on FastMCP 2.0+.
89
* **MCP `CallTemplate`**: Defines the configuration for connecting to one or more MCP servers (`McpCallTemplate`), including:
910
* Transport type (`stdio` or `http`)
1011
* Optional OAuth2 authentication for HTTP-based servers
@@ -216,6 +217,25 @@ MCP servers can expose resources (files, data sources, etc.) alongside tools. To
216217
}
217218
```
218219

220+
## FastMCP Compatibility
221+
222+
Starting with version 1.0.17, this plugin automatically handles JSON Schema `$defs` references used by FastMCP 2.0+ servers. This resolves the issue where tool discovery would fail with:
223+
224+
```
225+
MissingRefError: can't resolve reference #/$defs/...
226+
```
227+
228+
**How it works:**
229+
- When tools are discovered from MCP servers, their input and output schemas are automatically dereferenced
230+
- `$defs` references are resolved and inlined into the schema
231+
- This process is transparent and requires no configuration changes
232+
- If dereferencing fails for any reason, the original schema is used as a fallback
233+
234+
This ensures seamless integration with:
235+
- `basic-memory` and other FastMCP-based servers
236+
- Any MCP server using modern JSON Schema draft-2020-12 features
237+
- Legacy MCP servers (which continue to work as before)
238+
219239
## Tool Naming Convention
220240

221241
Tools discovered from MCP servers follow the naming pattern:

packages/mcp/package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@utcp/mcp",
3-
"version": "1.0.16",
3+
"version": "1.0.17",
44
"description": "Model Context Protocol integration for UTCP",
55
"main": "dist/index.cjs",
66
"module": "dist/index.js",
@@ -44,12 +44,14 @@
4444
"build": "tsup"
4545
},
4646
"dependencies": {
47+
"@apidevtools/json-schema-ref-parser": "^15.1.2",
4748
"@modelcontextprotocol/sdk": "^1.17.4",
4849
"@utcp/sdk": "^1.0.15",
4950
"axios": "^1.11.0"
5051
},
5152
"devDependencies": {
5253
"@types/bun": "latest",
54+
"@types/json-schema": "^7.0.15",
5355
"bun-types": "latest",
5456
"typescript": "^5.9.2",
5557
"zod-to-json-schema": "^3.24.6"

0 commit comments

Comments
 (0)