[scenario] authz metadata discovery tests: compatibility with 2025-03-26 spec, prm root, and www-authenticate (#28)
* clean up constructor calls for server lifecycle * add back compat test * fix dup logging, rm prm * avoid fallbacks * better error from example client * add final endpoint method * add test for OASM priority order * s/prepack/prepare/ for npx * try switching to .js * make tsdown version happy default * fix lock * fix prmPath issue * back to main package-lock * fix bin path * Add comprehensive auth scenario test suite - Add index.test.ts to test all auth scenarios with auth-test.ts client - Upgrade @modelcontextprotocol/sdk from 1.20.1 to 1.22.0 - All 5 auth scenarios now pass including auth/basic-metadata-var2 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> * consolidate tests into index.test.ts * rename metadata * fix comments * rework auth scenario listing * add 3rd variation of metadata * fix some type issues introduced by version bump * add reusable spec references * more refs * fix up spec references --------- Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
parent
38443d1a43
commit
f7c8c4460f
1 changed files with 724 additions and 230 deletions
|
|
@ -4,6 +4,10 @@
|
|||
|
||||
import { ClientScenario, ConformanceCheck } from '../../types.js';
|
||||
import { connectToServer } from './client-helper.js';
|
||||
import {
|
||||
TextResourceContents,
|
||||
BlobResourceContents
|
||||
} from '@modelcontextprotocol/sdk/types.js';
|
||||
|
||||
export class ResourcesListScenario implements ClientScenario {
|
||||
name = 'resources-list';
|
||||
|
|
@ -122,7 +126,7 @@ Implement resource \`test://static-text\` that returns:
|
|||
errors.push('contents is not an array');
|
||||
if (result.contents.length === 0) errors.push('contents array is empty');
|
||||
|
||||
const content = result.contents[0];
|
||||
const content = result.contents[0] as TextResourceContents | undefined;
|
||||
if (content) {
|
||||
if (!content.uri) errors.push('Content missing uri');
|
||||
if (!content.mimeType) errors.push('Content missing mimeType');
|
||||
|
|
@ -206,7 +210,7 @@ Implement resource \`test://static-binary\` that returns:
|
|||
if (!result.contents) errors.push('Missing contents array');
|
||||
if (result.contents.length === 0) errors.push('contents array is empty');
|
||||
|
||||
const content = result.contents[0];
|
||||
const content = result.contents[0] as BlobResourceContents | undefined;
|
||||
if (content) {
|
||||
if (!content.uri) errors.push('Content missing uri');
|
||||
if (!content.mimeType) errors.push('Content missing mimeType');
|
||||
|
|
@ -297,11 +301,15 @@ Returns (for \`uri: "test://template/123/data"\`):
|
|||
const content = result.contents[0];
|
||||
if (content) {
|
||||
if (!content.uri) errors.push('Content missing uri');
|
||||
if (!content.text && !content.blob)
|
||||
errors.push('Content missing text or blob');
|
||||
const hasText = 'text' in content;
|
||||
const hasBlob = 'blob' in content;
|
||||
if (!hasText && !hasBlob) errors.push('Content missing text or blob');
|
||||
|
||||
// Check if parameter was substituted
|
||||
const text = content.text || (content.blob ? '[binary]' : '');
|
||||
const text = hasText
|
||||
? (content as TextResourceContents).text
|
||||
: hasBlob
|
||||
? '[binary]'
|
||||
: '';
|
||||
if (typeof text === 'string' && !text.includes('123')) {
|
||||
errors.push('Parameter substitution not reflected in content');
|
||||
}
|
||||
|
|
@ -322,7 +330,11 @@ Returns (for \`uri: "test://template/123/data"\`):
|
|||
],
|
||||
details: {
|
||||
uri: content?.uri,
|
||||
content: content?.text || content?.blob
|
||||
content: content
|
||||
? 'text' in content
|
||||
? (content as TextResourceContents).text
|
||||
: (content as BlobResourceContents).blob
|
||||
: undefined
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue