@mcpdesc/validator 0.7.1 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -8,6 +8,21 @@ Dates for published releases are the UTC publication dates recorded by npm.
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [0.8.0] - 2026-09-03
12
+
13
+ ### Added
14
+
15
+ - Added RC.1-only `resolveMcpDescriptionComponentReferences` to the default,
16
+ browser, and standalone entries, returning the existing resolved clone,
17
+ diagnostics, and substitution count plus deterministic terminal-target
18
+ provenance.
19
+
20
+ ### Changed
21
+
22
+ - Recorded the maintainer-approved additive provenance correction to the RC.1
23
+ snapshot implementation. Its schema, conformance results, diagnostics, and
24
+ frozen fixtures remain unchanged.
25
+
11
26
  ## [0.7.1] - 2026-09-02
12
27
 
13
28
  ### Changed
@@ -79,7 +94,8 @@ Dates for published releases are the UTC publication dates recorded by npm.
79
94
  - Added synchronous structural and semantic validation for parsed JavaScript values with deterministic diagnostics and exact selector dispatch.
80
95
  - Added ESM browser support, TypeScript declarations, embedded schema provenance, frozen fixtures, and package-content checks.
81
96
 
82
- [Unreleased]: https://github.com/mcpdesc/core/compare/validator-v0.7.1...HEAD
97
+ [Unreleased]: https://github.com/mcpdesc/core/compare/validator-v0.8.0...HEAD
98
+ [0.8.0]: https://github.com/mcpdesc/core/compare/validator-v0.7.1...validator-v0.8.0
83
99
  [0.7.1]: https://github.com/mcpdesc/core/compare/validator-v0.7.0...validator-v0.7.1
84
100
  [0.7.0]: https://github.com/mcpdesc/core/releases/tag/validator-v0.7.0
85
101
  [0.6.0]: https://github.com/mcpdesc/mcpdesc-specification/compare/validator-v0.5.0...validator-v0.6.0
package/README.md CHANGED
@@ -44,7 +44,7 @@ a later draft is published.
44
44
 
45
45
  ## Supported snapshots
46
46
 
47
- Version `0.7.1` supports these immutable snapshots, newest first:
47
+ Version `0.8.0` supports these immutable snapshots, newest first:
48
48
 
49
49
  | Selector | Tag | Embedded schema SHA-256 |
50
50
  |---|---|---|
@@ -135,6 +135,11 @@ The package exports frozen `supportedSpecifications`, `supportedProtocolVersions
135
135
 
136
136
  npm package SemVer tracks implementation releases independently from specification snapshot identity. Adding a later snapshot is additive: it must use a sibling implementation and selector rather than changing an existing snapshot's schema, semantics, metadata, fixtures, or results.
137
137
 
138
+ The RC.1 component resolver has one maintainer-approved additive tooling
139
+ correction: successful substitutions also report authored and terminal target
140
+ paths. The correction does not change the RC.1 schema, validation results,
141
+ diagnostics, or fixtures and is recorded in the integrity manifest.
142
+
138
143
  The runtime bundles its schema, performs no network fetches for external schema references, and imports no Node.js built-ins. Unresolved external Tool-schema references produce incomplete-validation warnings and are preserved. All three ESM entry points support Node.js 20 or later and browser bundlers.
139
144
 
140
145
  ## Snapshot lifecycle
package/index.d.ts CHANGED
@@ -25,6 +25,22 @@ export interface ValidateMcpDescriptionOptions {
25
25
  specification: McpDescriptionSpecification;
26
26
  }
27
27
 
28
+ export interface McpDescriptionComponentReferenceProvenance {
29
+ readonly referencePath: Array<string | number>;
30
+ readonly targetPath: Array<string | number>;
31
+ }
32
+
33
+ export interface McpDescriptionComponentResolutionResult {
34
+ readonly document: unknown;
35
+ readonly diagnostics: McpDescriptionDiagnostic[];
36
+ readonly substitutions: number;
37
+ readonly provenance: McpDescriptionComponentReferenceProvenance[];
38
+ }
39
+
40
+ export interface ResolveMcpDescriptionComponentReferencesOptions {
41
+ readonly specification: '0.8.0-rc.1';
42
+ }
43
+
28
44
  export interface SpecificationProvenance {
29
45
  readonly '0.8.0-draft.1': {
30
46
  readonly snapshotTag: 'v0.8.0-draft.1';
@@ -94,4 +110,9 @@ export declare function resolveMcpDescriptionSpecification(
94
110
  export declare function validateMcpDescription(
95
111
  document: unknown,
96
112
  options: ValidateMcpDescriptionOptions
97
- ): McpDescriptionValidationResult;
113
+ ): McpDescriptionValidationResult;
114
+
115
+ export declare function resolveMcpDescriptionComponentReferences(
116
+ document: unknown,
117
+ options: ResolveMcpDescriptionComponentReferencesOptions
118
+ ): McpDescriptionComponentResolutionResult;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mcpdesc/validator",
3
- "version": "0.7.1",
3
+ "version": "0.8.0",
4
4
  "description": "Structural and semantic validation for MCP Description snapshots",
5
5
  "type": "module",
6
6
  "types": "./index.d.ts",
package/src/index.js CHANGED
@@ -3,6 +3,7 @@ import * as draft2 from './snapshots/0.8.0-draft.2/index.js';
3
3
  import * as draft3 from './snapshots/0.8.0-draft.3/index.js';
4
4
  import * as draft4 from './snapshots/0.8.0-draft.4/index.js';
5
5
  import * as rc1 from './snapshots/0.8.0-rc.1/index.js';
6
+ import { resolveComponentReferences as resolveRc1ComponentReferences } from './snapshots/0.8.0-rc.1/semantic.js';
6
7
 
7
8
  const snapshots = Object.freeze({
8
9
  [draft1.specification]: draft1,
@@ -142,4 +143,15 @@ export function validateMcpDescription(document, options) {
142
143
  }
143
144
 
144
145
  return snapshots[options.specification].validate(document);
146
+ }
147
+
148
+ export function resolveMcpDescriptionComponentReferences(document, options) {
149
+ if (!options || typeof options !== 'object' || Array.isArray(options) || !Object.hasOwn(options, 'specification')) {
150
+ throw new TypeError('options.specification is required');
151
+ }
152
+ if (options.specification !== '0.8.0-rc.1') {
153
+ throw new RangeError(`Component reference resolution does not support specification: ${String(options.specification)}`);
154
+ }
155
+
156
+ return resolveRc1ComponentReferences(document);
145
157
  }
@@ -61,11 +61,12 @@ function componentDiagnostic(code, rel, message, path) {
61
61
  export function resolveComponentReferences(document, rel = 'document') {
62
62
  const resolved = structuredClone(document);
63
63
  const diagnostics = [];
64
+ const provenance = [];
64
65
  let substitutions = 0;
65
66
 
66
67
  function resolve(reference, expectedNamespace, path, stack = []) {
67
68
  const match = /^#\/components\/([^/]+)\/([^/]+)$/.exec(reference?.$componentRef ?? '');
68
- if (!match) return reference;
69
+ if (!match) return { value: reference };
69
70
  const [, namespace, name] = match;
70
71
  if (namespace !== expectedNamespace) {
71
72
  diagnostics.push(componentDiagnostic(
@@ -74,7 +75,7 @@ export function resolveComponentReferences(document, rel = 'document') {
74
75
  `must target #/components/${expectedNamespace}, not #/components/${namespace}`,
75
76
  path
76
77
  ));
77
- return reference;
78
+ return { value: reference };
78
79
  }
79
80
 
80
81
  const key = `${namespace}/${name}`;
@@ -85,7 +86,7 @@ export function resolveComponentReferences(document, rel = 'document') {
85
86
  `forms a cycle through ${[...stack, key].join(' -> ')}`,
86
87
  path
87
88
  ));
88
- return reference;
89
+ return { value: reference };
89
90
  }
90
91
 
91
92
  const target = document?.components?.[namespace]?.[name];
@@ -96,18 +97,29 @@ export function resolveComponentReferences(document, rel = 'document') {
96
97
  `targets missing component ${JSON.stringify(reference.$componentRef)}`,
97
98
  path
98
99
  ));
99
- return reference;
100
+ return { value: reference };
100
101
  }
101
102
  substitutions += 1;
102
103
  return isReferenceObject(target)
103
104
  ? resolve(target, expectedNamespace, path, [...stack, key])
104
- : structuredClone(target);
105
+ : {
106
+ value: structuredClone(target),
107
+ targetPath: ['components', namespace, name]
108
+ };
109
+ }
110
+
111
+ function substitute(reference, expectedNamespace, path, stack = []) {
112
+ const result = resolve(reference, expectedNamespace, path, stack);
113
+ if (result.targetPath) {
114
+ provenance.push({ referencePath: path, targetPath: result.targetPath });
115
+ }
116
+ return result.value;
105
117
  }
106
118
 
107
119
  for (const namespace of componentNamespaces) {
108
120
  for (const [name, value] of Object.entries(document?.components?.[namespace] ?? {})) {
109
121
  if (isReferenceObject(value)) {
110
- resolved.components[namespace][name] = resolve(value, namespace, ['components', namespace, name], [`${namespace}/${name}`]);
122
+ resolved.components[namespace][name] = substitute(value, namespace, ['components', namespace, name], [`${namespace}/${name}`]);
111
123
  }
112
124
  }
113
125
  }
@@ -123,7 +135,7 @@ export function resolveComponentReferences(document, rel = 'document') {
123
135
  if (collection === 'tools') {
124
136
  for (const field of ['inputSchema', 'outputSchema']) {
125
137
  if (isReferenceObject(declaration[field])) {
126
- resolvedDeclaration[field] = resolve(declaration[field], 'schemas', [collection, declarationIndex, field]);
138
+ resolvedDeclaration[field] = substitute(declaration[field], 'schemas', [collection, declarationIndex, field]);
127
139
  }
128
140
  }
129
141
  }
@@ -137,7 +149,7 @@ export function resolveComponentReferences(document, rel = 'document') {
137
149
  : 'promptExamples';
138
150
  for (const [name, example] of Object.entries(declaration.examples ?? {})) {
139
151
  if (isReferenceObject(example)) {
140
- resolvedDeclaration.examples[name] = resolve(
152
+ resolvedDeclaration.examples[name] = substitute(
141
153
  example,
142
154
  exampleNamespace,
143
155
  [collection, declarationIndex, 'examples', name]
@@ -151,7 +163,7 @@ export function resolveComponentReferences(document, rel = 'document') {
151
163
  for (const [declarationIndex, declaration] of (document?.[collection] ?? []).entries()) {
152
164
  for (const [elicitationIndex, elicitation] of (declaration.elicitations ?? []).entries()) {
153
165
  if (isReferenceObject(elicitation.requestedSchema)) {
154
- resolved[collection][declarationIndex].elicitations[elicitationIndex].requestedSchema = resolve(
166
+ resolved[collection][declarationIndex].elicitations[elicitationIndex].requestedSchema = substitute(
155
167
  elicitation.requestedSchema,
156
168
  'schemas',
157
169
  [collection, declarationIndex, 'elicitations', elicitationIndex, 'requestedSchema']
@@ -161,7 +173,7 @@ export function resolveComponentReferences(document, rel = 'document') {
161
173
  }
162
174
  }
163
175
 
164
- return { document: resolved, diagnostics, substitutions };
176
+ return { document: resolved, diagnostics, substitutions, provenance };
165
177
  }
166
178
 
167
179
  function structuralPath(document, error) {