refactor: range-based spec version tagging (introducedIn/removedIn) (#265)

* refactor: replace specVersions list with introducedIn/removedIn range tagging

Replaces per-scenario `specVersions: SpecVersion[]` arrays with `introducedIn`
and optional `removedIn` range fields on all three scenario interfaces. Extension
scenarios get an orthogonal `extension?: boolean` flag instead of the former
`'extension'` tag in the versions list.

matchesSpecVersion() is rewritten as a range comparison
(introducedIn <= target && (!removedIn || target < removedIn)), with draft
sorting after all dated versions. getScenarioSpecVersions() reconstructs the
effective version list from the range for backward-compat with tier-check.
Closes #256.

* refactor: nest spec-version range under `source: ScenarioSource` union

The flat `introducedIn`/`removedIn`/`extension?` shape forced extension
scenarios to set a placeholder `introducedIn` that was never read. Nesting
the version-range fields inside a `source` property typed as a union lets
the compiler enforce introducedIn XOR extensionId — no runtime invariant
test needed.

  type ScenarioSource =
    | { introducedIn: SpecVersion; removedIn?: SpecVersion }
    | { extensionId: ExtensionId };

A class can't `implements` a union type directly, so the union lives inside
a property and `Scenario` stays a plain interface — `class implements
Scenario` keeps working everywhere. `EXTENSION_IDS` is a const array
mirroring the `DATED_SPEC_VERSIONS` pattern.

Also renames the cross-app-access scenario to enterprise-managed-auth to
match the extension's canonical name: file, class, slug, context schema
literal, and the everything-client runner.

* refactor: use canonical SEP-2133 extension identifiers

EXTENSION_IDS now holds the wire identifiers from the spec's extension docs
(client-matrix.mdx, docs/extensions/auth/*.mdx) so extensionId values can be
cross-referenced against capabilities.extensions keys directly:

  io.modelcontextprotocol/oauth-client-credentials
  io.modelcontextprotocol/enterprise-managed-authorization

The previous commit used a shortened 'enterprise-managed-auth' which doesn't
match the canonical '-authorization'. Re-renames the scenario file/class/slug
and downstream references to align.

---------

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Paul Carleton 2026-05-14 16:12:32 +01:00 • committed by GitHub
commit acc70de0f6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2,12 +2,12 @@
* Utilities test scenarios for MCP servers
*/
import { ClientScenario, ConformanceCheck, SpecVersion } from '../../types';
import { ClientScenario, ConformanceCheck } from '../../types';
import { connectToServer } from './client-helper';
export class LoggingSetLevelScenario implements ClientScenario {
name = 'logging-set-level';
specVersions: SpecVersion[] = ['2025-06-18', '2025-11-25'];
readonly source = { introducedIn: '2025-06-18' } as const;
description = `Test setting logging level.
**Server Implementation Requirements:**
@ -86,7 +86,7 @@ export class LoggingSetLevelScenario implements ClientScenario {
export class PingScenario implements ClientScenario {
name = 'ping';
specVersions: SpecVersion[] = ['2025-06-18', '2025-11-25'];
readonly source = { introducedIn: '2025-06-18' } as const;
description = `Test ping utility for connection health check.
**Server Implementation Requirements:**
@ -176,7 +176,7 @@ export class PingScenario implements ClientScenario {
export class CompletionCompleteScenario implements ClientScenario {
name = 'completion-complete';
specVersions: SpecVersion[] = ['2025-06-18', '2025-11-25'];
readonly source = { introducedIn: '2025-06-18' } as const;
description = `Test completion endpoint.
**Server Implementation Requirements:**