UI5 / UI5/mcp-server

run_manifest_validation always fails: schema with key or id "http://json-schema.org/draft-06/schema" already exists

Open Beginner friendly
#447 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
100
Forks
21
Avg merge
1d 3h
Merged PRs (30d)
20

Description

Summary

run_manifest_validation fails for every manifest on @ui5/mcp-server@0.2.20, including a 10-line minimal one. It never reaches actual validation — it throws while building the Ajv validate function. Both code paths in createValidationFunction.ts are affected (Draft-07 and 2020-12), so it reproduces regardless of the manifest's _version.

Steps to reproduce
  1. Create a minimal manifest:
{
  "_version": "1.60.0",
  "sap.app": {
    "id": "x.y",
    "type": "application",
    "applicationVersion": { "version": "1.0.0" }
  },
  "sap.ui5": {
    "dependencies": { "minUI5Version": "1.120.0", "libs": { "sap.m": {} } }
  }
}
  1. Call the tool:
{"jsonrpc":"2.0","id":1,"method":"tools/call","params":{
  "name":"run_manifest_validation",
  "arguments":{"manifestPath":"<abs-path>/webapp/manifest.json"}}}

Expected: a validation result.
Actual: isError: true.

Server log leading up to it:

[info] tools:run_manifest_validation:runValidation: Using manifest version: 1.60.0
[info] utils:ui5Manifest: Fetched UI5 manifest schema from https://raw.githubusercontent.com/UI5/manifest/v1.60.0/schema.json
[info] ...createValidationFunction: Using Draft-07 validation (detected from $schema: http://json-schema.org/draft-07/schema#)
[info] ...createValidationFunction: Loading external schema: https://adaptivecards.io/schemas/adaptive-card.json
[info] ...createValidationFunction: Loading external schema: https://json-schema.org/draft-06/schema
[error] utils: An internal server error occurred:
[error] utils: Failed to create UI5 manifest validate function: schema with key or id "http://json-schema.org/draft-06/schema" already exists

Full MCP response:

{"result":{"content":[{"type":"text","text":"Failed to create UI5 manifest validate function: schema with key or id \"http://json-schema.org/draft-06/schema\" already exists"}],"isError":true}}
Root cause

Thrown by Ajv#_checkUnique (ajv/dist/core.js:466). Ajv keeps a schema
registry indexed by $id; _checkUnique refuses to register a second
document under an $id that is already present in this.schemas /
this.refs. The draft-06 schema document fetched from the network
identifies itself with the same $id the server has already registered
manually — hence the collision on every run, not just some.

What triggers that network fetch is an http:// vs https:// mismatch.
In src/tools/run_manifest_validation/createValidationFunction.ts the
meta-schema is registered under the http:// URI only:

// createUI5ManifestValidateFunctionDraft07 — createValidationFunction.ts:173 (main)
ajv.addMetaSchema(draft06MetaSchema, "http://json-schema.org/draft-06/schema#");

But the Adaptive Card schema — pulled in from the UI5 manifest schema and
already special-cased in loadSchema — declares:

$schema: "https://json-schema.org/draft-06/schema#"     // note: https

Ajv finds no meta-schema registered under the https:// key, falls back to
loadSchema("https://json-schema.org/draft-06/schema"), and fetches it. The
fetched document self-identifies as $id: "http://json-schema.org/draft-06/schema#"
— colliding with the one registered on line 173.

The same applies to createUI5ManifestValidateFunction2020 (lines 78-79),
which registers both draft-06 and draft-07 under http:// keys only. All
three addMetaSchema calls are still http://-only on main, so this is
not fixed in an unreleased commit either.

Suggested fix

Register the https:// aliases alongside the existing http:// ones:

ajv.addMetaSchema(draft06MetaSchema, "http://json-schema.org/draft-06/schema#");
ajv.addMetaSchema(draft06MetaSchema, "https://json-schema.org/draft-06/schema#");

and the same for draft-07 in the 2020-12 path.

Schema versions tested

Reproduced standalone against the real UI5 manifest schemas, with the same
Ajv version and the same options the server uses (strict: false,
unicodeRegExp: false, identical loadSchema):

Schema As of 0.2.20 With https alias
Draft-07 (v1.60.0 tag) FAILS — already exists compiles
2020-12 (main schema) FAILS — already exists compiles
Workaround

Validate against the official schema directly with Ajv, skipping the
server. One caveat worth documenting separately: each tag in UI5/manifest
ships the _version enum of the previous version (tag v1.60.0 only
accepts up to 1.59.0), so validating a 1.60.0 manifest against its own
tag yields a false positive on _version. Validating against main does
not have this issue.

Environment
@ui5/mcp-server 0.2.20 (latest published)
ajv ^8.20.0 (as declared by the package)
Node.js v24.21.0
npm 11.19.0
OS Windows 11
Launched via npx -y @ui5/mcp-server (stdio)

Other tools in the same server process work fine — run_ui5_linter,
get_api_reference, get_project_info and get_version_info all returned
normally against the same project.

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.

Research direction

Start in src/tools/run_manifest_validation/createValidationFunction.ts, especially the Draft-07 and 2020-12 validation functions and their addMetaSchema calls. Reproduce with the minimal manifest and run_manifest_validation, then verify both schema paths compile and return a validation result without the duplicate draft-06 schema error.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
backend, tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
84/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.