You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Option to inline JSON Schema $defs for broader MCP client compatibility #444
basic-memory's MCP server uses FastMCP which generates JSON Schemas with $defs references. Some MCP clients (like code-mode/UTCP) cannot resolve these references, causing tool discovery to fail.
Error (from code-mode client)
MissingRefError: can't resolve reference #/$defs/ContextResult from id #
Context
This is part of a broader MCP ecosystem issue where different clients expect different JSON Schema drafts:
Would it be possible to add an option or configuration to inline/dereference $defs in the tool schemas? This would improve compatibility with MCP clients that don't support $defs resolution.
Alternatively, if FastMCP provides a way to configure schema generation, that could be exposed.
Read project documentation and understand FastMCP integration
Examine MCP tool definitions and schema generation
Analyze where the fix should be implemented
Provide technical recommendation
Response
You're absolutely right that this is an upstream issue, not something that should be fixed in basic-memory itself. Here's my analysis:
Where the issue belongs:
FastMCP - This is where schema generation happens. FastMCP uses Pydantic models to automatically generate JSON schemas for MCP tools via the @mcp.tool() decorator. The $defs references are created by Pydantic's JSON schema generation.
MCP SDK/Spec - The broader issue is that the MCP specification doesn't mandate a specific JSON Schema draft version, leading to different clients having different expectations about schema features like $defs.
Why basic-memory shouldn't fix this:
Abstraction layer violation - basic-memory uses FastMCP as a high-level abstraction. All tool definitions use @mcp.tool() decorators and have no direct control over schema generation (see src/basic_memory/mcp/tools/*.py).
No configuration surface - basic-memory's MCP server is intentionally minimal (src/basic_memory/mcp/server.py:7-9):
mcp=FastMCP(name="Basic Memory")
There's no schema configuration being passed to FastMCP.
Ecosystem-wide problem - As the linked issues show, this affects multiple MCP servers and clients. A workaround in basic-memory wouldn't solve the underlying compatibility problem.
Contribute to the MCP spec discussion in the linked issues to help establish clearer schema compatibility requirements
For immediate workaround: Users experiencing this with code-mode/UTCP could potentially use a different MCP client that supports $defs resolution until upstream fixes are available
The good news is that this is a known issue in the MCP ecosystem and is being actively discussed. A fix at the FastMCP or MCP SDK level would benefit all servers and clients, not just basic-memory.
@phernandez Sorry about this, I was investigating integrating "code mode" with basic-memory and Opus 4.5 started creating issues without being prompted too (it's my fault since I was running in yolo mode).
Although the end results of your CI Claude research dismissing my local Claude research does tickle my funny bone.
Activity
phernandez commentedon Nov 25, 2025
@claude this seems like something that would be required in the mcp sdk or fastmcp.
claude commentedon Nov 25, 2025
Claude finished @phernandez's task —— View job
Analysis Complete
Response
You're absolutely right that this is an upstream issue, not something that should be fixed in basic-memory itself. Here's my analysis:
Where the issue belongs:
FastMCP - This is where schema generation happens. FastMCP uses Pydantic models to automatically generate JSON schemas for MCP tools via the
@mcp.tool()decorator. The$defsreferences are created by Pydantic's JSON schema generation.MCP SDK/Spec - The broader issue is that the MCP specification doesn't mandate a specific JSON Schema draft version, leading to different clients having different expectations about schema features like
$defs.Why basic-memory shouldn't fix this:
Abstraction layer violation - basic-memory uses FastMCP as a high-level abstraction. All tool definitions use
@mcp.tool()decorators and have no direct control over schema generation (seesrc/basic_memory/mcp/tools/*.py).No configuration surface - basic-memory's MCP server is intentionally minimal (
src/basic_memory/mcp/server.py:7-9):There's no schema configuration being passed to FastMCP.
Ecosystem-wide problem - As the linked issues show, this affects multiple MCP servers and clients. A workaround in basic-memory wouldn't solve the underlying compatibility problem.
Recommended path forward:
$defsor generating JSON Schema Draft 2019-09 compatible schemas$defsresolution until upstream fixes are availableThe good news is that this is a known issue in the MCP ecosystem and is being actively discussed. A fix at the FastMCP or MCP SDK level would benefit all servers and clients, not just basic-memory.
johnlindquist commentedon Nov 25, 2025
@phernandez Sorry about this, I was investigating integrating "code mode" with basic-memory and Opus 4.5 started creating issues without being prompted too (it's my fault since I was running in yolo mode).
Although the end results of your CI Claude research dismissing my local Claude research does tickle my funny bone.