anomalyco / anomalyco/opencode

[MCP] memory server tools fail to load: outputSchema uses JSON Schema draft-07, validator only supports 2020-12

Open
#39,908 1 comment 0 reactions 1 assignee View on GitHub

@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

  1. Add to opencode.json:
    "memory": {"type": "local", "command": ["npx", "-y", "@modelcontextprotocol/server-memory"], "enabled": true}
    
  2. Start OpenCode.
  3. 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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.