anomalyco / anomalyco/opencode
[MCP] memory server tools fail to load: outputSchema uses JSON Schema draft-07, validator only supports 2020-12
@kitlangton is already working on this.
Since Jul 31, 2026.
- Dominant language
- TypeScript
- Stars
- 209k
- Forks
- 27.5k
- PR merge metrics
- PR metrics pending
Description
Description
The MCP memory server (@modelcontextprotocol/server-memory) tools cannot be used. Every memory tool (search_nodes, create_entities, add_observations, etc.) fails with a schema validation error and is not registered.
Error
Tool 'search_nodes' has an invalid outputSchema: JSON Schema declares an unsupported dialect ("$schema": "http://json-schema.org/draft-07/schema#"). The default validator supports JSON Schema 2020-12 only; pass a pre-configured Ajv instance to AjvJs
Root cause
The official @modelcontextprotocol/server-memory generates its tool schemas with zod-to-json-schema, which by default stamps "$schema": "http://json-schema.org/draft-07/schema#". OpenCode's MCP client validates tool schemas with Ajv configured for JSON Schema 2020-12 only, so any server declaring an explicit draft-07 dialect is rejected before the tool is loaded.
The MCP spec (2025-11-25) honors the declared dialect when present (absent means 2020-12), so the validator should dispatch on the declared dialect instead of rejecting pre-wire. There is already a fix in the reference TypeScript SDK (modelcontextprotocol/typescript-sdk test outputSchemaDialect.test.ts) that does exactly this — the draft-07 Filesystem-server shape validates instead of failing pre-wire.
Environment
- OpenCode version: 1.18.8 (reported as latest)
- OS: Linux (Arch/Manjaro, X11)
- MCP server:
@modelcontextprotocol/server-memory(npx latest)
Steps to reproduce
- Add to
opencode.json:"memory": {"type": "local", "command": ["npx", "-y", "@modelcontextprotocol/server-memory"], "enabled": true} - Start OpenCode.
- Try to invoke any memory tool (e.g.
search_nodes) or inspect the tool list.
Expected
Memory server tools load and validate correctly despite the draft-07 dialect declaration, mirroring the reference SDK behavior (dispatch on declared dialect).
Impact
The knowledge-graph memory feature is completely unusable in OpenCode. The graph data is still persisted on disk; only the tool interface fails.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.