-
Notifications
You must be signed in to change notification settings - Fork 82
Closed
Description
Description
When attempting to use code-mode with MCP servers built on FastMCP 2.0 (like basic-memory), tool discovery fails due to JSON Schema $defs references not being resolved.
Error
[McpCommunicationProtocol Error] MCP operation on 'basic-memory:stdio' failed: can't resolve reference #/$defs/ContextResult from id #
MissingRefError: can't resolve reference #/$defs/ContextResult from id #
at Object.code (...node_modules/ajv/dist/vocabularies/core/ref.js:21:19)
Environment
- @utcp/code-mode-mcp: latest (1.0.9)
- basic-memory: 0.15.2 (uses FastMCP 2.12.4)
- MCP SDK: 1.17.0
Configuration
{
"manual_call_templates": [
{
"name": "memory",
"call_template_type": "mcp",
"config": {
"mcpServers": {
"basic-memory": {
"transport": "stdio",
"command": "uvx",
"args": ["basic-memory", "mcp", "--project", "memory"]
}
}
}
}
]
}Root Cause
FastMCP 2.0 generates tool schemas that use $defs references (JSON Schema draft-2020-12 feature). The AJV validator in code-mode appears to not have these references pre-registered, causing the MissingRefError.
This is related to the broader MCP ecosystem issue: modelcontextprotocol/typescript-sdk#745
Potential Solutions
- Configure AJV to handle
$defsby pre-loading them before validation - Use a JSON Schema dereferencer to inline
$defsbefore validation - Skip schema validation for MCP tools (trust the MCP server)
Workaround
Currently, there's no workaround - code-mode cannot be used with FastMCP-based MCP servers that use $defs in their schemas.
Metadata
Metadata
Assignees
Labels
No labels