@bryan-thompson/inspector-assessment-client 1.22.13 → 1.22.16

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.
Files changed (43) hide show
  1. package/dist/assets/{OAuthCallback-CZrJlcLn.js → OAuthCallback-DNYBkA2C.js} +1 -1
  2. package/dist/assets/{OAuthDebugCallback-DjI-YxME.js → OAuthDebugCallback-EhdSHXee.js} +1 -1
  3. package/dist/assets/{index-_w0OL9Gt.js → index-BRiFDs-g.js} +21 -14
  4. package/dist/index.html +1 -1
  5. package/lib/lib/assessment/configTypes.d.ts +70 -0
  6. package/lib/lib/assessment/configTypes.d.ts.map +1 -0
  7. package/lib/lib/assessment/configTypes.js +194 -0
  8. package/lib/lib/assessment/constants.d.ts +10 -0
  9. package/lib/lib/assessment/constants.d.ts.map +1 -0
  10. package/lib/lib/assessment/constants.js +61 -0
  11. package/lib/lib/assessment/coreTypes.d.ts +159 -0
  12. package/lib/lib/assessment/coreTypes.d.ts.map +1 -0
  13. package/lib/lib/assessment/coreTypes.js +101 -0
  14. package/lib/lib/assessment/extendedTypes.d.ts +415 -0
  15. package/lib/lib/assessment/extendedTypes.d.ts.map +1 -0
  16. package/lib/lib/assessment/extendedTypes.js +9 -0
  17. package/lib/lib/assessment/index.d.ts +23 -0
  18. package/lib/lib/assessment/index.d.ts.map +1 -0
  19. package/lib/lib/assessment/index.js +48 -0
  20. package/lib/lib/assessment/progressTypes.d.ts +160 -0
  21. package/lib/lib/assessment/progressTypes.d.ts.map +1 -0
  22. package/lib/lib/assessment/progressTypes.js +9 -0
  23. package/lib/lib/assessment/resultTypes.d.ts +568 -0
  24. package/lib/lib/assessment/resultTypes.d.ts.map +1 -0
  25. package/lib/lib/assessment/resultTypes.js +9 -0
  26. package/lib/lib/assessmentTypes.d.ts +20 -1248
  27. package/lib/lib/assessmentTypes.d.ts.map +1 -1
  28. package/lib/lib/assessmentTypes.js +21 -287
  29. package/lib/services/assessment/AssessmentOrchestrator.d.ts +5 -0
  30. package/lib/services/assessment/AssessmentOrchestrator.d.ts.map +1 -1
  31. package/lib/services/assessment/AssessmentOrchestrator.js +24 -6
  32. package/lib/services/assessment/lib/concurrencyLimit.d.ts +12 -0
  33. package/lib/services/assessment/lib/concurrencyLimit.d.ts.map +1 -1
  34. package/lib/services/assessment/lib/concurrencyLimit.js +22 -0
  35. package/lib/services/assessment/lib/logger.d.ts +98 -0
  36. package/lib/services/assessment/lib/logger.d.ts.map +1 -0
  37. package/lib/services/assessment/lib/logger.js +153 -0
  38. package/lib/services/assessment/modules/BaseAssessor.d.ts +2 -2
  39. package/lib/services/assessment/modules/BaseAssessor.d.ts.map +1 -1
  40. package/lib/services/assessment/modules/SecurityAssessor.d.ts.map +1 -1
  41. package/lib/services/assessment/modules/SecurityAssessor.js +10 -5
  42. package/lib/services/assessment/modules/ToolAnnotationAssessor.js +1 -1
  43. package/package.json +1 -1
@@ -1,1253 +1,25 @@
1
1
  /**
2
2
  * MCP Directory Review Assessment Types
3
- * Based on Anthropic's 5 core requirements for MCP directory submission
4
- */
5
- export type AssessmentStatus = "PASS" | "FAIL" | "NEED_MORE_INFO";
6
- export type SecurityRiskLevel = "LOW" | "MEDIUM" | "HIGH";
7
- /**
8
- * Alignment status for tool annotations.
9
- * Extends beyond PASS/FAIL to handle ambiguous cases.
10
- */
11
- export type AlignmentStatus = "ALIGNED" | "MISALIGNED" | "REVIEW_RECOMMENDED" | "UNKNOWN";
12
- /**
13
- * Confidence level for behavior inference
14
- */
15
- export type InferenceConfidence = "high" | "medium" | "low";
16
- /**
17
- * Assessment category tier for distinguishing core vs optional assessments.
18
- * - "core": Always applicable to any MCP server audit
19
- * - "optional": Contextual assessments (e.g., MCPB bundle-specific)
20
- */
21
- export type AssessmentCategoryTier = "core" | "optional";
22
- /**
23
- * Metadata for assessment categories including tier and applicability info.
24
- */
25
- export interface AssessmentCategoryMetadata {
26
- tier: AssessmentCategoryTier;
27
- description: string;
28
- applicableTo?: string;
29
- }
30
- /**
31
- * Category metadata mapping for all assessment modules.
32
- * Used for CLI output and downstream consumers to understand category context.
33
- */
34
- export declare const ASSESSMENT_CATEGORY_METADATA: Record<string, AssessmentCategoryMetadata>;
35
- /**
36
- * Persistence model for MCP servers (Three-Tier Classification).
37
- * Re-exported from annotationPatterns for backward compatibility.
38
3
  *
39
- * - "immediate": Write operations persist directly to storage (database, file, API)
40
- * - "deferred": Write operations are in-memory until explicit save operation
41
- * - "unknown": Cannot determine persistence model
42
- */
43
- export type { PersistenceModel, ServerPersistenceContext, } from "../services/assessment/config/annotationPatterns.js";
44
- export interface TestInputMetadata {
45
- toolCategory: string;
46
- generationStrategy: string;
47
- fieldSources: Record<string, {
48
- field: string;
49
- value: unknown;
50
- source: "category" | "field-name" | "schema-default" | "enum" | "format" | "default";
51
- reason: string;
52
- }>;
53
- }
54
- /**
55
- * Metadata about the response content types and structure.
56
- * Tracks what type of content the tool returns for better categorization.
57
- */
58
- export interface ResponseMetadata {
59
- /** Content types present in the response */
60
- contentTypes: Array<"text" | "image" | "resource" | "resource_link" | "audio">;
61
- /** True if response includes structuredContent property */
62
- hasStructuredContent: boolean;
63
- /** True if response includes _meta property */
64
- hasMeta: boolean;
65
- /** Number of text content blocks */
66
- textBlockCount: number;
67
- /** Number of image content blocks */
68
- imageCount: number;
69
- /** Number of resource/resource_link content blocks */
70
- resourceCount: number;
71
- /** Output schema validation result (if tool has outputSchema) */
72
- outputSchemaValidation?: {
73
- hasOutputSchema: boolean;
74
- isValid: boolean;
75
- error?: string;
76
- };
77
- }
78
- export interface ToolTestResult {
79
- toolName: string;
80
- tested: boolean;
81
- status: "working" | "broken" | "untested";
82
- error?: string;
83
- executionTime?: number;
84
- testParameters?: Record<string, unknown>;
85
- response?: unknown;
86
- testInputMetadata?: TestInputMetadata;
87
- /** Metadata about response content types and structure (optional, backward compatible) */
88
- responseMetadata?: ResponseMetadata;
89
- }
90
- export interface EnhancedToolTestResult {
91
- toolName: string;
92
- tested: boolean;
93
- status: "fully_working" | "partially_working" | "connectivity_only" | "broken" | "untested";
94
- confidence: number;
95
- scenariosExecuted: number;
96
- scenariosPassed: number;
97
- scenariosFailed: number;
98
- executionTime: number;
99
- validationSummary: {
100
- happyPathSuccess: boolean;
101
- edgeCasesHandled: number;
102
- edgeCasesTotal: number;
103
- boundariesRespected: number;
104
- boundariesTotal: number;
105
- errorHandlingWorks: boolean;
106
- };
107
- recommendations: string[];
108
- detailedResults?: Array<{
109
- scenarioName: string;
110
- category: "happy_path" | "edge_case" | "boundary" | "error_case";
111
- passed: boolean;
112
- confidence: number;
113
- issues: string[];
114
- evidence: string[];
115
- }>;
116
- }
117
- export interface SecurityTestResult {
118
- testName: string;
119
- description: string;
120
- payload: string;
121
- vulnerable: boolean;
122
- evidence?: string;
123
- riskLevel: SecurityRiskLevel;
124
- toolName?: string;
125
- response?: string;
126
- confidence?: "high" | "medium" | "low";
127
- requiresManualReview?: boolean;
128
- manualReviewReason?: string;
129
- reviewGuidance?: string;
130
- connectionError?: boolean;
131
- errorType?: "connection" | "server" | "protocol";
132
- testReliability?: "completed" | "failed" | "retried";
133
- }
134
- export interface CodeExample {
135
- code: string;
136
- language?: string;
137
- description?: string;
138
- lineNumber?: number;
139
- lineCount?: number;
140
- exampleType?: "functional" | "install" | "config" | "implementation";
141
- }
142
- /**
143
- * Represents a tool with missing or inadequate documentation.
144
- * Used to identify documentation gaps for tool descriptions.
145
- */
146
- export interface ToolDocGap {
147
- toolName: string;
148
- issue: "missing" | "too_short";
149
- descriptionLength: number;
150
- documentedInReadme: boolean;
151
- }
152
- export interface DocumentationMetrics {
153
- hasReadme: boolean;
154
- exampleCount: number;
155
- requiredExamples: number;
156
- missingExamples: string[];
157
- hasInstallInstructions: boolean;
158
- hasUsageGuide: boolean;
159
- hasAPIReference: boolean;
160
- extractedExamples?: CodeExample[];
161
- installInstructions?: string;
162
- usageInstructions?: string;
163
- readmeLength?: number;
164
- readmeWordCount?: number;
165
- sectionHeadings?: string[];
166
- toolDocumentation?: Array<{
167
- name: string;
168
- hasDescription: boolean;
169
- descriptionLength: number;
170
- documentedInReadme: boolean;
171
- /** Actual description text (truncated to 200 chars) for Claude analysis */
172
- description?: string;
173
- }>;
174
- readmeContent?: string;
175
- /** Count of tools with descriptions >= 50 characters */
176
- toolsWithDescriptions: number;
177
- /** Total number of tools analyzed */
178
- toolsTotal: number;
179
- /** Tools with missing or inadequate (<50 chars) descriptions */
180
- toolDocGaps: ToolDocGap[];
181
- }
182
- export interface ErrorTestDetail {
183
- toolName: string;
184
- testType: string;
185
- testInput: Record<string, unknown>;
186
- testDescription?: string;
187
- expectedError: string;
188
- actualResponse: {
189
- isError: boolean;
190
- errorCode?: string | number;
191
- errorMessage?: string;
192
- rawResponse: unknown;
193
- };
194
- passed: boolean;
195
- reason?: string;
196
- }
197
- export interface ErrorHandlingMetrics {
198
- mcpComplianceScore: number;
199
- errorResponseQuality: "excellent" | "good" | "fair" | "poor";
200
- hasProperErrorCodes: boolean;
201
- hasDescriptiveMessages: boolean;
202
- validatesInputs: boolean;
203
- validationCoverage?: {
204
- wrongType: number;
205
- wrongTypeCount?: {
206
- passed: number;
207
- total: number;
208
- };
209
- extraParams: number;
210
- extraParamsCount?: {
211
- passed: number;
212
- total: number;
213
- };
214
- missingRequired: number;
215
- missingRequiredCount?: {
216
- passed: number;
217
- total: number;
218
- };
219
- nullValues: number;
220
- nullValuesCount?: {
221
- passed: number;
222
- total: number;
223
- };
224
- totalTests: number;
225
- overallPassRate?: number;
226
- };
227
- testDetails?: ErrorTestDetail[];
228
- }
229
- export interface UsabilityMetrics {
230
- toolNamingConvention: "consistent" | "inconsistent";
231
- parameterClarity: "clear" | "unclear" | "mixed";
232
- hasHelpfulDescriptions: boolean;
233
- followsBestPractices: boolean;
234
- detailedAnalysis?: {
235
- tools: Array<{
236
- toolName: string;
237
- namingPattern: string;
238
- description?: string;
239
- descriptionLength: number;
240
- hasDescription: boolean;
241
- parameterCount: number;
242
- hasRequiredParams: boolean;
243
- hasSchema: boolean;
244
- schemaQuality: string;
245
- parameters?: Array<{
246
- name: string;
247
- type?: string;
248
- required: boolean;
249
- description?: string;
250
- hasDescription: boolean;
251
- }>;
252
- }>;
253
- naming: {
254
- patterns: string[];
255
- breakdown: Record<string, number>;
256
- dominant: string;
257
- };
258
- descriptions: {
259
- withDescriptions: number;
260
- withoutDescriptions: number;
261
- averageLength: number;
262
- tooShort: Array<{
263
- toolName: string;
264
- namingPattern: string;
265
- description?: string;
266
- descriptionLength: number;
267
- hasDescription: boolean;
268
- parameterCount: number;
269
- hasRequiredParams: boolean;
270
- hasSchema: boolean;
271
- schemaQuality: string;
272
- parameters?: Array<{
273
- name: string;
274
- type?: string;
275
- required: boolean;
276
- description?: string;
277
- hasDescription: boolean;
278
- }>;
279
- }>;
280
- adequate: Array<{
281
- toolName: string;
282
- namingPattern: string;
283
- description?: string;
284
- descriptionLength: number;
285
- hasDescription: boolean;
286
- parameterCount: number;
287
- hasRequiredParams: boolean;
288
- hasSchema: boolean;
289
- schemaQuality: string;
290
- parameters?: Array<{
291
- name: string;
292
- type?: string;
293
- required: boolean;
294
- description?: string;
295
- hasDescription: boolean;
296
- }>;
297
- }>;
298
- detailed: Array<{
299
- toolName: string;
300
- namingPattern: string;
301
- description?: string;
302
- descriptionLength: number;
303
- hasDescription: boolean;
304
- parameterCount: number;
305
- hasRequiredParams: boolean;
306
- hasSchema: boolean;
307
- schemaQuality: string;
308
- parameters?: Array<{
309
- name: string;
310
- type?: string;
311
- required: boolean;
312
- description?: string;
313
- hasDescription: boolean;
314
- }>;
315
- }>;
316
- };
317
- parameterIssues: string[];
318
- bestPracticeScore: {
319
- naming: number;
320
- descriptions: number;
321
- schemas: number;
322
- clarity: number;
323
- total: number;
324
- };
325
- overallScore: number;
326
- };
327
- }
328
- /** Tool definition with schema from MCP tools/list response */
329
- export interface DiscoveredTool {
330
- name: string;
331
- description?: string;
332
- inputSchema?: {
333
- type: string;
334
- properties?: Record<string, unknown>;
335
- required?: string[];
336
- };
337
- }
338
- export interface FunctionalityAssessment {
339
- totalTools: number;
340
- testedTools: number;
341
- workingTools: number;
342
- brokenTools: string[];
343
- coveragePercentage: number;
344
- status: AssessmentStatus;
345
- explanation: string;
346
- toolResults: ToolTestResult[];
347
- /** Raw tool definitions with inputSchema from MCP server */
348
- tools?: DiscoveredTool[];
349
- }
350
- export interface SecurityAssessment {
351
- promptInjectionTests: SecurityTestResult[];
352
- vulnerabilities: string[];
353
- overallRiskLevel: SecurityRiskLevel;
354
- status: AssessmentStatus;
355
- explanation: string;
356
- }
357
- export interface DocumentationAssessment {
358
- metrics: DocumentationMetrics;
359
- status: AssessmentStatus;
360
- explanation: string;
361
- recommendations: string[];
362
- }
363
- export interface ErrorHandlingAssessment {
364
- metrics: ErrorHandlingMetrics;
365
- /** Raw error handling test results for downstream analysis */
366
- errorTests?: ErrorTestDetail[];
367
- status: AssessmentStatus;
368
- explanation: string;
369
- recommendations: string[];
370
- }
371
- export interface UsabilityAssessment {
372
- metrics: UsabilityMetrics;
373
- status: AssessmentStatus;
374
- explanation: string;
375
- recommendations: string[];
376
- }
377
- export interface StructuredRecommendation {
378
- id: string;
379
- title: string;
380
- severity: "critical" | "warning" | "enhancement";
381
- confidence: "high" | "medium" | "low";
382
- detectionMethod: "automated" | "manual-required";
383
- category: string;
384
- description: string;
385
- requiresManualVerification: boolean;
386
- manualVerificationSteps?: string[];
387
- contextNote?: string;
388
- actionItems: string[];
389
- }
390
- /**
391
- * Individual protocol check result with evidence
392
- */
393
- export interface ProtocolCheckResult {
394
- passed: boolean;
395
- confidence: "high" | "medium" | "low";
396
- evidence?: string;
397
- warnings?: string[];
398
- rawResponse?: unknown;
399
- }
400
- /**
401
- * Protocol checks that are actually tested via MCP calls
402
- * HIGH CONFIDENCE - these are verified through actual protocol interaction
403
- */
404
- export interface ProtocolChecks {
405
- jsonRpcCompliance: ProtocolCheckResult;
406
- serverInfoValidity: ProtocolCheckResult;
407
- schemaCompliance: ProtocolCheckResult;
408
- errorResponseCompliance: ProtocolCheckResult;
409
- structuredOutputSupport: ProtocolCheckResult;
410
- capabilitiesCompliance?: ProtocolCheckResult;
411
- }
412
- /**
413
- * Metadata-based hints parsed from serverInfo
414
- * LOW CONFIDENCE - these are NOT tested, just parsed from metadata
415
- */
416
- export interface MetadataHints {
417
- confidence: "low";
418
- requiresManualVerification: true;
419
- transportHints?: {
420
- detectedTransport?: string;
421
- supportsStdio: boolean;
422
- supportsHTTP: boolean;
423
- supportsSSE: boolean;
424
- detectionMethod: "metadata" | "assumed";
425
- };
426
- oauthHints?: {
427
- hasOAuthConfig: boolean;
428
- supportsOAuth: boolean;
429
- supportsPKCE: boolean;
430
- resourceIndicators?: string[];
431
- };
432
- annotationHints?: {
433
- supportsReadOnlyHint: boolean;
434
- supportsDestructiveHint: boolean;
435
- supportsTitleAnnotation: boolean;
436
- customAnnotations?: string[];
437
- };
438
- streamingHints?: {
439
- supportsStreaming: boolean;
440
- streamingProtocol?: "http-streaming" | "sse" | "websocket";
441
- };
442
- manualVerificationSteps: string[];
443
- }
444
- /**
445
- * MCP Spec Compliance Assessment - Hybrid Structure
446
- * Clearly separates verified protocol checks from unverified metadata hints
447
- */
448
- export interface MCPSpecComplianceAssessment {
449
- protocolVersion: string;
450
- protocolChecks: ProtocolChecks;
451
- metadataHints?: MetadataHints;
452
- status: AssessmentStatus;
453
- complianceScore: number;
454
- explanation: string;
455
- recommendations: string[];
456
- /** @deprecated Use protocolChecks and metadataHints instead */
457
- transportCompliance?: TransportComplianceMetrics;
458
- /** @deprecated Use metadataHints.oauthHints instead */
459
- oauthImplementation?: OAuthComplianceMetrics;
460
- /** @deprecated Use metadataHints.annotationHints instead */
461
- annotationSupport?: AnnotationSupportMetrics;
462
- /** @deprecated Use metadataHints.streamingHints instead */
463
- streamingSupport?: StreamingSupportMetrics;
464
- }
465
- export interface TransportComplianceMetrics {
466
- supportsStreamableHTTP: boolean;
467
- deprecatedSSE: boolean;
468
- transportValidation: "passed" | "failed" | "partial";
469
- errors?: string[];
470
- supportsStdio?: boolean;
471
- supportsSSE?: boolean;
472
- confidence?: "high" | "medium" | "low";
473
- detectionMethod?: "automated" | "manual-required";
474
- requiresManualCheck?: boolean;
475
- manualVerificationSteps?: string[];
476
- }
477
- export interface OAuthComplianceMetrics {
478
- implementsResourceServer: boolean;
479
- supportsRFC8707: boolean;
480
- resourceIndicators: string[];
481
- tokenValidation: boolean;
482
- scopeEnforcement: boolean;
483
- errors?: string[];
484
- supportsOAuth?: boolean;
485
- supportsPKCE?: boolean;
486
- }
487
- export interface AnnotationSupportMetrics {
488
- supportsReadOnlyHint: boolean;
489
- supportsDestructiveHint: boolean;
490
- supportsTitleAnnotation: boolean;
491
- customAnnotations?: string[];
492
- }
493
- export interface StreamingSupportMetrics {
494
- supportsStreaming: boolean;
495
- streamingProtocol?: "http-streaming" | "sse" | "websocket";
496
- performanceMetrics?: {
497
- latency: number;
498
- throughput: number;
499
- };
500
- }
501
- export interface DependencyAnalysis {
502
- totalDependencies: number;
503
- directDependencies: number;
504
- transitiveDependencies: number;
505
- outdatedPackages: number;
506
- abandonedPackages: number;
507
- riskyLicenses: string[];
508
- licenseCompliance?: boolean;
509
- }
510
- export interface VulnerabilityReport {
511
- packageName: string;
512
- version: string;
513
- vulnerability: string;
514
- severity: "CRITICAL" | "HIGH" | "MEDIUM" | "LOW";
515
- cve?: string;
516
- fixAvailable: boolean;
517
- fixVersion?: string;
518
- package?: string;
519
- }
520
- export interface SoftwareBillOfMaterials {
521
- format: "SPDX" | "CycloneDX";
522
- components: number;
523
- licenses: string[];
524
- attestations?: string[];
525
- }
526
- export interface PackageIntegrityMetrics {
527
- signedPackages: number;
528
- verifiedPublishers: number;
529
- integrityChecksPassed: boolean;
530
- integrityScore: number;
531
- squattingRisk: "HIGH" | "MEDIUM" | "LOW";
532
- }
533
- export interface RuntimeTestResult {
534
- testName: string;
535
- category: "memory" | "filesystem" | "network" | "process";
536
- passed: boolean;
537
- findings?: string[];
538
- severity?: SecurityRiskLevel;
539
- }
540
- export interface FuzzingReport {
541
- totalInputsTested: number;
542
- crashesFound: number;
543
- hangsDetected: number;
544
- memoryLeaks: number;
545
- unexpectedBehaviors: string[];
546
- coveragePercentage: number;
547
- passed: number;
548
- failed: number;
549
- }
550
- export interface SandboxTestResult {
551
- escapeTechnique: string;
552
- successful: boolean;
553
- containmentLevel: "full" | "partial" | "none";
554
- details?: string;
555
- }
556
- export interface BehaviorAnalysisReport {
557
- suspiciousBehaviors: string[];
558
- networkConnections: string[];
559
- fileSystemAccess: string[];
560
- processSpawning: boolean;
561
- anomalyScore: number;
562
- }
563
- export interface MCPDirectoryAssessment {
564
- serverName: string;
565
- assessmentDate: string;
566
- assessorVersion: string;
567
- functionality: FunctionalityAssessment;
568
- security: SecurityAssessment;
569
- documentation: DocumentationAssessment;
570
- errorHandling: ErrorHandlingAssessment;
571
- usability: UsabilityAssessment;
572
- mcpSpecCompliance?: MCPSpecComplianceAssessment;
573
- aupCompliance?: AUPComplianceAssessment;
574
- toolAnnotations?: ToolAnnotationAssessment;
575
- prohibitedLibraries?: ProhibitedLibrariesAssessment;
576
- manifestValidation?: ManifestValidationAssessment;
577
- portability?: PortabilityAssessment;
578
- externalAPIScanner?: ExternalAPIScannerAssessment;
579
- authentication?: AuthenticationAssessment;
580
- temporal?: TemporalAssessment;
581
- /** MCP Resources capability assessment results */
582
- resources?: ResourceAssessment;
583
- /** MCP Prompts capability assessment results */
584
- prompts?: PromptAssessment;
585
- /** Cross-capability security assessment (resources x prompts x tools interactions) */
586
- crossCapability?: CrossCapabilitySecurityAssessment;
587
- overallStatus: AssessmentStatus;
588
- summary: string;
589
- recommendations: string[];
590
- executionTime: number;
591
- totalTestsRun: number;
592
- evidenceFiles?: string[];
593
- mcpProtocolVersion?: string;
594
- assessmentMetadata?: {
595
- /** Whether source code was available during assessment */
596
- sourceCodeAvailable: boolean;
597
- /** Transport type used for the assessment */
598
- transportType?: "stdio" | "sse" | "streamable-http";
599
- };
600
- }
601
- /**
602
- * AUP (Acceptable Use Policy) Compliance Types
603
- * Based on Anthropic's 14 AUP categories (A-N)
604
- */
605
- export type AUPCategory = "A" | "B" | "C" | "D" | "E" | "F" | "G" | "H" | "I" | "J" | "K" | "L" | "M" | "N";
606
- export type AUPSeverity = "CRITICAL" | "HIGH" | "MEDIUM" | "FLAG";
607
- export interface AUPViolation {
608
- category: AUPCategory;
609
- categoryName: string;
610
- severity: AUPSeverity;
611
- pattern: string;
612
- matchedText: string;
613
- location: "tool_name" | "tool_description" | "readme" | "source_code";
614
- filePath?: string;
615
- lineNumber?: number;
616
- confidence: "high" | "medium" | "low";
617
- requiresHumanReview: boolean;
618
- reviewGuidance?: string;
619
- }
620
- export interface AUPComplianceAssessment {
621
- violations: AUPViolation[];
622
- highRiskDomains: string[];
623
- scannedLocations: {
624
- toolNames: boolean;
625
- toolDescriptions: boolean;
626
- readme: boolean;
627
- sourceCode: boolean;
628
- };
629
- status: AssessmentStatus;
630
- explanation: string;
631
- recommendations: string[];
632
- }
633
- /**
634
- * Tool Annotation Types (Policy #17)
635
- * Verifies readOnlyHint, destructiveHint presence
636
- */
637
- /**
638
- * Source of tool annotations
639
- */
640
- export type AnnotationSource = "mcp" | "source-code" | "inferred" | "none";
641
- export interface ToolAnnotationResult {
642
- toolName: string;
643
- hasAnnotations: boolean;
644
- annotations?: {
645
- readOnlyHint?: boolean;
646
- destructiveHint?: boolean;
647
- title?: string;
648
- description?: string;
649
- idempotentHint?: boolean;
650
- openWorldHint?: boolean;
651
- };
652
- /** Where the annotations were extracted from */
653
- annotationSource?: AnnotationSource;
654
- inferredBehavior?: {
655
- expectedReadOnly: boolean;
656
- expectedDestructive: boolean;
657
- reason: string;
658
- /** Confidence level of the inference */
659
- confidence: InferenceConfidence;
660
- /** True if the tool name matches an ambiguous pattern */
661
- isAmbiguous: boolean;
662
- };
663
- /** Alignment status between annotations and inferred behavior */
664
- alignmentStatus?: AlignmentStatus;
665
- issues: string[];
666
- recommendations: string[];
667
- /** Description poisoning detection (Issue #8) */
668
- descriptionPoisoning?: {
669
- detected: boolean;
670
- patterns: Array<{
671
- name: string;
672
- pattern: string;
673
- severity: "LOW" | "MEDIUM" | "HIGH";
674
- category: string;
675
- evidence: string;
676
- }>;
677
- riskLevel: "NONE" | "LOW" | "MEDIUM" | "HIGH";
678
- };
679
- }
680
- export interface ToolAnnotationAssessment {
681
- toolResults: ToolAnnotationResult[];
682
- annotatedCount: number;
683
- missingAnnotationsCount: number;
684
- /** Count of high-confidence misalignments only (excludes REVIEW_RECOMMENDED) */
685
- misalignedAnnotationsCount: number;
686
- status: AssessmentStatus;
687
- explanation: string;
688
- recommendations: string[];
689
- /** Detailed metrics for annotation quality */
690
- metrics?: {
691
- /** Percentage of tools with any annotations (0-100) */
692
- coverage: number;
693
- /** Percentage of tools without contradictions (0-100) */
694
- consistency: number;
695
- /** Percentage of high-confidence alignments (0-100) */
696
- correctness: number;
697
- /** Count of tools needing manual review */
698
- reviewRequired: number;
699
- };
700
- /** Breakdown of tools by alignment status */
701
- alignmentBreakdown?: {
702
- aligned: number;
703
- misaligned: number;
704
- reviewRecommended: number;
705
- unknown: number;
706
- };
707
- /** Summary of where annotations were extracted from */
708
- annotationSources?: {
709
- /** Count from MCP protocol (tools/list response) */
710
- mcp: number;
711
- /** Count from source code analysis */
712
- sourceCode: number;
713
- /** Count where behavior was inferred from patterns */
714
- inferred: number;
715
- /** Count with no annotations found */
716
- none: number;
717
- };
718
- /** Count of tools with poisoned descriptions detected (Issue #8) */
719
- poisonedDescriptionsDetected?: number;
720
- }
721
- /**
722
- * Prohibited Libraries Types (Policy #28-30)
723
- * Detects financial and media processing libraries
724
- */
725
- export type ProhibitedLibraryCategory = "financial" | "media" | "payments" | "banking";
726
- export interface ProhibitedLibraryMatch {
727
- name: string;
728
- category: ProhibitedLibraryCategory;
729
- location: "package.json" | "source_import" | "requirements.txt" | "cargo.toml";
730
- filePath?: string;
731
- lineNumber?: number;
732
- severity: "BLOCKING" | "HIGH" | "MEDIUM";
733
- reason: string;
734
- policyReference: string;
735
- }
736
- export interface ProhibitedLibrariesAssessment {
737
- matches: ProhibitedLibraryMatch[];
738
- scannedFiles: string[];
739
- hasFinancialLibraries: boolean;
740
- hasMediaLibraries: boolean;
741
- status: AssessmentStatus;
742
- explanation: string;
743
- recommendations: string[];
744
- }
745
- /**
746
- * MCPB Manifest Validation Types
747
- * Based on manifest_version 0.3 spec
748
- */
749
- export interface ManifestJsonSchema {
750
- manifest_version: string;
751
- name: string;
752
- version: string;
753
- description?: string;
754
- author?: string;
755
- repository?: string;
756
- license?: string;
757
- mcp_config: {
758
- command: string;
759
- args?: string[];
760
- env?: Record<string, string>;
761
- };
762
- icon?: string;
763
- homepage?: string;
764
- keywords?: string[];
765
- privacy_policies?: string[];
766
- }
767
- /**
768
- * Privacy Policy URL Validation Result
769
- * Validates that privacy_policies URLs are accessible
770
- */
771
- export interface PrivacyPolicyValidation {
772
- url: string;
773
- accessible: boolean;
774
- statusCode?: number;
775
- contentType?: string;
776
- error?: string;
777
- }
778
- export interface ManifestValidationResult {
779
- field: string;
780
- valid: boolean;
781
- value?: unknown;
782
- expectedType?: string;
783
- issue?: string;
784
- severity: "ERROR" | "WARNING" | "INFO";
785
- }
786
- export interface ManifestValidationAssessment {
787
- hasManifest: boolean;
788
- manifestVersion?: string;
789
- validationResults: ManifestValidationResult[];
790
- hasIcon: boolean;
791
- hasRequiredFields: boolean;
792
- missingFields: string[];
793
- /** Privacy policy URL validation results */
794
- privacyPolicies?: {
795
- declared: string[];
796
- validationResults: PrivacyPolicyValidation[];
797
- allAccessible: boolean;
798
- };
799
- status: AssessmentStatus;
800
- explanation: string;
801
- recommendations: string[];
802
- }
803
- /**
804
- * Portability Assessment Types
805
- * Detects hardcoded paths, platform-specific code
806
- */
807
- export interface PortabilityIssue {
808
- type: "hardcoded_path" | "platform_specific" | "bundle_root_antipattern" | "absolute_path" | "user_home_path";
809
- filePath: string;
810
- lineNumber?: number;
811
- matchedText: string;
812
- severity: "HIGH" | "MEDIUM" | "LOW";
813
- recommendation: string;
814
- }
815
- export interface PortabilityAssessment {
816
- issues: PortabilityIssue[];
817
- scannedFiles: number;
818
- platformSpecificCount: number;
819
- hardcodedPathCount: number;
820
- usesDirname: boolean;
821
- usesBundleRoot: boolean;
822
- status: AssessmentStatus;
823
- explanation: string;
824
- recommendations: string[];
825
- /** Shell command portability analysis */
826
- shellCommands?: Array<{
827
- command: string;
828
- isPortable: boolean;
829
- alternativeCommand?: string;
830
- }>;
831
- /** Platform coverage summary */
832
- platformCoverage?: {
833
- supported: "all" | "windows" | "macos" | "linux";
834
- missing: string[];
835
- };
836
- }
837
- export interface DetectedAPI {
838
- url: string;
839
- service: string;
840
- filePath: string;
841
- }
842
- export interface ExternalAPIScannerAssessment {
843
- detectedAPIs: DetectedAPI[];
844
- uniqueServices: string[];
845
- affiliationWarning?: string;
846
- scannedFiles: number;
847
- status: AssessmentStatus;
848
- explanation: string;
849
- recommendations: string[];
850
- }
851
- export type AuthMethod = "oauth" | "api_key" | "none" | "unknown";
852
- export interface AuthAppropriateness {
853
- isAppropriate: boolean;
854
- concerns: string[];
855
- explanation: string;
856
- }
857
- export interface TransportSecurityAnalysis {
858
- usesTLS: boolean;
859
- tlsEnforced: boolean;
860
- hasInsecurePatterns: boolean;
861
- insecurePatterns: string[];
862
- hasSecurePatterns: boolean;
863
- securePatterns: string[];
864
- corsConfigured: boolean;
865
- corsPermissive: boolean;
866
- sessionSecure: boolean;
867
- recommendations: string[];
868
- }
869
- export interface AuthenticationAssessment {
870
- authMethod: AuthMethod;
871
- hasLocalDependencies: boolean;
872
- transportType: string;
873
- appropriateness: AuthAppropriateness;
874
- recommendation: string;
875
- detectedPatterns: {
876
- oauthIndicators: string[];
877
- localResourceIndicators: string[];
878
- apiKeyIndicators: string[];
879
- };
880
- transportSecurity?: TransportSecurityAnalysis;
881
- status: AssessmentStatus;
882
- explanation: string;
883
- recommendations: string[];
884
- }
885
- /**
886
- * Temporal/Rug Pull Assessment Types
887
- * Detects tools that change behavior after N invocations
888
- */
889
- export interface TemporalToolResult {
890
- tool: string;
891
- vulnerable: boolean;
892
- totalInvocations: number;
893
- firstDeviationAt: number | null;
894
- deviationCount: number;
895
- errorCount: number;
896
- pattern: "RUG_PULL_TEMPORAL" | "RUG_PULL_DEFINITION" | null;
897
- severity: "HIGH" | "MEDIUM" | "NONE";
898
- reducedInvocations?: boolean;
899
- note?: string;
900
- evidence?: {
901
- safeResponseExample: unknown;
902
- maliciousResponseExample: unknown;
903
- };
904
- definitionMutated?: boolean;
905
- definitionMutationAt?: number | null;
906
- definitionEvidence?: {
907
- baselineDescription?: string;
908
- mutatedDescription?: string;
909
- baselineSchema?: unknown;
910
- mutatedSchema?: unknown;
911
- };
912
- }
913
- export interface TemporalAssessment {
914
- toolsTested: number;
915
- invocationsPerTool: number;
916
- rugPullsDetected: number;
917
- definitionMutationsDetected: number;
918
- details: TemporalToolResult[];
919
- status: AssessmentStatus;
920
- explanation: string;
921
- recommendations: string[];
922
- }
923
- /**
924
- * Resource Assessment Types
925
- * Evaluates MCP server resources for security and compliance
926
- */
927
- export interface ResourceTestResult {
928
- resourceUri: string;
929
- resourceName?: string;
930
- mimeType?: string;
931
- tested: boolean;
932
- accessible: boolean;
933
- securityIssues: string[];
934
- pathTraversalVulnerable: boolean;
935
- sensitiveDataExposed: boolean;
936
- promptInjectionDetected: boolean;
937
- promptInjectionPatterns: string[];
938
- validUri: boolean;
939
- readTime?: number;
940
- contentSizeBytes?: number;
941
- error?: string;
942
- /** Sensitive data patterns detected in resource content */
943
- sensitivePatterns?: Array<{
944
- pattern: string;
945
- severity: "critical" | "high" | "medium";
946
- detected: boolean;
947
- }>;
948
- /** Access control information */
949
- accessControls?: {
950
- requiresAuth: boolean;
951
- authType?: string;
952
- };
953
- /** Data classification based on content analysis */
954
- dataClassification?: "public" | "internal" | "confidential" | "restricted";
955
- }
956
- export interface ResourceAssessment {
957
- resourcesTested: number;
958
- resourceTemplatesTested: number;
959
- accessibleResources: number;
960
- securityIssuesFound: number;
961
- pathTraversalVulnerabilities: number;
962
- sensitiveDataExposures: number;
963
- promptInjectionVulnerabilities: number;
964
- results: ResourceTestResult[];
965
- status: AssessmentStatus;
966
- explanation: string;
967
- recommendations: string[];
968
- }
969
- /**
970
- * Prompt Assessment Types
971
- * Evaluates MCP server prompts for security and AUP compliance
972
- */
973
- export interface PromptTestResult {
974
- promptName: string;
975
- description?: string;
976
- tested: boolean;
977
- hasRequiredArguments: boolean;
978
- argumentsValidated: boolean;
979
- aupCompliant: boolean;
980
- injectionVulnerable: boolean;
981
- safetyIssues: string[];
982
- argumentCount: number;
983
- executionTime?: number;
984
- error?: string;
985
- /** Template analysis for prompt structure */
986
- promptTemplate?: {
987
- templateType: string;
988
- variables: string[];
989
- validated: boolean;
990
- };
991
- /** Dynamic content analysis */
992
- dynamicContent?: {
993
- hasInterpolation: boolean;
994
- injectionSafe: boolean;
995
- escapingApplied: string[];
996
- };
997
- }
998
- export interface PromptAssessment {
999
- promptsTested: number;
1000
- aupViolations: number;
1001
- injectionVulnerabilities: number;
1002
- argumentValidationIssues: number;
1003
- results: PromptTestResult[];
1004
- status: AssessmentStatus;
1005
- explanation: string;
1006
- recommendations: string[];
1007
- }
1008
- /**
1009
- * Cross-Capability Security Assessment Types
1010
- * Tests interactions between tools, resources, and prompts
1011
- */
1012
- export interface CrossCapabilityTestResult {
1013
- testType: "tool_to_resource" | "prompt_to_tool" | "resource_to_tool" | "privilege_escalation";
1014
- sourceCapability: string;
1015
- targetCapability: string;
1016
- vulnerable: boolean;
1017
- evidence?: string;
1018
- riskLevel: SecurityRiskLevel;
1019
- description: string;
1020
- /** Specific privilege escalation vector if detected */
1021
- privilegeEscalationVector?: string;
1022
- /** Data exfiltration risk details */
1023
- dataExfiltrationRisk?: {
1024
- sensitiveFields: string[];
1025
- exfiltrationMethod: string;
1026
- };
1027
- /** Chain of capabilities that could be exploited together */
1028
- attackChain?: string[];
1029
- /** Confidence level in the detection */
1030
- confidence?: "high" | "medium" | "low";
1031
- }
1032
- export interface CrossCapabilitySecurityAssessment {
1033
- testsRun: number;
1034
- vulnerabilitiesFound: number;
1035
- privilegeEscalationRisks: number;
1036
- dataFlowViolations: number;
1037
- results: CrossCapabilityTestResult[];
1038
- status: AssessmentStatus;
1039
- explanation: string;
1040
- recommendations: string[];
1041
- }
1042
- export declare const PROMPT_INJECTION_TESTS: Omit<SecurityTestResult, "vulnerable" | "evidence">[];
1043
- /**
1044
- * Claude Code Bridge Configuration
1045
- * Enables integration with Claude Code CLI for intelligent analysis
1046
- */
1047
- export interface ClaudeCodeConfig {
1048
- enabled: boolean;
1049
- features: {
1050
- intelligentTestGeneration: boolean;
1051
- aupSemanticAnalysis: boolean;
1052
- annotationInference: boolean;
1053
- documentationQuality: boolean;
1054
- };
1055
- timeout: number;
1056
- workingDir?: string;
1057
- maxRetries?: number;
1058
- }
1059
- export interface AssessmentConfiguration {
1060
- testTimeout: number;
1061
- delayBetweenTests?: number;
1062
- skipBrokenTools: boolean;
1063
- reviewerMode?: boolean;
1064
- enableExtendedAssessment?: boolean;
1065
- documentationVerbosity?: "minimal" | "standard" | "verbose";
1066
- parallelTesting?: boolean;
1067
- maxParallelTests?: number;
1068
- scenariosPerTool?: number;
1069
- maxToolsToTestForErrors?: number;
1070
- selectedToolsForTesting?: string[];
1071
- securityPatternsToTest?: number;
1072
- enableDomainTesting?: boolean;
1073
- mcpProtocolVersion?: string;
1074
- enableSourceCodeAnalysis?: boolean;
1075
- patternConfigPath?: string;
1076
- claudeCode?: ClaudeCodeConfig;
1077
- temporalInvocations?: number;
1078
- assessmentCategories?: {
1079
- functionality: boolean;
1080
- security: boolean;
1081
- documentation: boolean;
1082
- errorHandling: boolean;
1083
- usability: boolean;
1084
- mcpSpecCompliance?: boolean;
1085
- aupCompliance?: boolean;
1086
- toolAnnotations?: boolean;
1087
- prohibitedLibraries?: boolean;
1088
- manifestValidation?: boolean;
1089
- portability?: boolean;
1090
- externalAPIScanner?: boolean;
1091
- authentication?: boolean;
1092
- temporal?: boolean;
1093
- resources?: boolean;
1094
- prompts?: boolean;
1095
- crossCapability?: boolean;
1096
- };
1097
- }
1098
- /**
1099
- * Progress callback for assessment modules to report test execution progress.
1100
- * Used by CLI to emit batched JSONL events.
1101
- */
1102
- export interface ProgressCallback {
1103
- (event: ProgressEvent): void;
1104
- }
1105
- /**
1106
- * Union type for all progress events emitted during assessment.
1107
- */
1108
- export type ProgressEvent = ModuleStartedProgress | TestBatchProgress | ModuleCompleteProgress | VulnerabilityFoundProgress | AnnotationMissingProgress | AnnotationMisalignedProgress | AnnotationReviewRecommendedProgress | AnnotationPoisonedProgress | AnnotationAlignedProgress;
1109
- /**
1110
- * Emitted when an assessment module begins execution.
1111
- */
1112
- export interface ModuleStartedProgress {
1113
- type: "module_started";
1114
- module: string;
1115
- estimatedTests: number;
1116
- toolCount: number;
1117
- }
1118
- /**
1119
- * Emitted periodically during module execution with batched test results.
1120
- * Batching reduces event volume for large assessments.
1121
- */
1122
- export interface TestBatchProgress {
1123
- type: "test_batch";
1124
- module: string;
1125
- completed: number;
1126
- total: number;
1127
- batchSize: number;
1128
- elapsed: number;
1129
- }
1130
- /**
1131
- * Emitted when an assessment module completes with final stats.
1132
- */
1133
- export interface ModuleCompleteProgress {
1134
- type: "module_complete";
1135
- module: string;
1136
- status: AssessmentStatus;
1137
- score: number;
1138
- testsRun: number;
1139
- duration: number;
1140
- }
1141
- /**
1142
- * Emitted when a security vulnerability is detected during assessment.
1143
- * Provides real-time alerts for security findings.
1144
- */
1145
- export interface VulnerabilityFoundProgress {
1146
- type: "vulnerability_found";
1147
- tool: string;
1148
- pattern: string;
1149
- confidence: "high" | "medium" | "low";
1150
- evidence: string;
1151
- riskLevel: "HIGH" | "MEDIUM" | "LOW";
1152
- requiresReview: boolean;
1153
- payload?: string;
1154
- }
1155
- /**
1156
- * Tool parameter metadata for annotation events.
1157
- * Reusable type matching jsonl-events.ts ToolParam.
1158
- */
1159
- export interface ToolParamProgress {
1160
- name: string;
1161
- type: string;
1162
- required: boolean;
1163
- description?: string;
1164
- }
1165
- /**
1166
- * Emitted when a tool is missing required annotations.
1167
- * Provides real-time alerts during annotation assessment.
1168
- */
1169
- export interface AnnotationMissingProgress {
1170
- type: "annotation_missing";
1171
- tool: string;
1172
- title?: string;
1173
- description?: string;
1174
- parameters: ToolParamProgress[];
1175
- inferredBehavior: {
1176
- expectedReadOnly: boolean;
1177
- expectedDestructive: boolean;
1178
- reason: string;
1179
- };
1180
- }
1181
- /**
1182
- * Emitted when tool annotations don't match inferred behavior.
1183
- * Provides real-time alerts during annotation assessment.
1184
- */
1185
- export interface AnnotationMisalignedProgress {
1186
- type: "annotation_misaligned";
1187
- tool: string;
1188
- title?: string;
1189
- description?: string;
1190
- parameters: ToolParamProgress[];
1191
- field: "readOnlyHint" | "destructiveHint";
1192
- actual: boolean | undefined;
1193
- expected: boolean;
1194
- confidence: number;
1195
- reason: string;
1196
- }
1197
- /**
1198
- * Emitted when annotation alignment cannot be confidently determined.
1199
- * Used for ambiguous patterns like store_*, queue_*, cache_* where behavior
1200
- * varies by implementation context. Does not indicate a failure - just flags
1201
- * for human review.
1202
- */
1203
- export interface AnnotationReviewRecommendedProgress {
1204
- type: "annotation_review_recommended";
1205
- tool: string;
1206
- title?: string;
1207
- description?: string;
1208
- parameters: ToolParamProgress[];
1209
- field: "readOnlyHint" | "destructiveHint";
1210
- actual: boolean | undefined;
1211
- inferred: boolean;
1212
- confidence: InferenceConfidence;
1213
- isAmbiguous: boolean;
1214
- reason: string;
1215
- }
1216
- /**
1217
- * Emitted when tool description contains poisoning patterns (Issue #8).
1218
- * Indicates potential prompt injection or malicious instructions in tool metadata.
1219
- */
1220
- export interface AnnotationPoisonedProgress {
1221
- type: "annotation_poisoned";
1222
- tool: string;
1223
- description?: string;
1224
- patterns: Array<{
1225
- name: string;
1226
- pattern: string;
1227
- severity: "LOW" | "MEDIUM" | "HIGH";
1228
- category: string;
1229
- evidence: string;
1230
- }>;
1231
- riskLevel: "NONE" | "LOW" | "MEDIUM" | "HIGH";
1232
- }
1233
- /**
1234
- * Emitted when tool annotations correctly match inferred behavior.
1235
- * Provides real-time confirmation during annotation assessment.
4
+ * @deprecated This file has been split into focused modules for better maintainability.
5
+ * All exports are re-exported from the new `assessment/` directory for backward compatibility.
6
+ *
7
+ * For new code, prefer importing from specific modules:
8
+ * - `@/lib/assessment/coreTypes` - AssessmentStatus, SecurityRiskLevel, AlignmentStatus
9
+ * - `@/lib/assessment/configTypes` - AssessmentConfiguration, config presets
10
+ * - `@/lib/assessment/resultTypes` - MCPDirectoryAssessment, assessment result types
11
+ * - `@/lib/assessment/extendedTypes` - AUP, Annotation, Temporal assessment types
12
+ * - `@/lib/assessment/progressTypes` - Progress event types for JSONL streaming
13
+ * - `@/lib/assessment/constants` - PROMPT_INJECTION_TESTS constant
14
+ *
15
+ * Or import everything from `@/lib/assessment`:
16
+ * ```typescript
17
+ * import { MCPDirectoryAssessment, AssessmentConfiguration } from "../lib/assessment/index.js";
18
+ * ```
19
+ *
20
+ * See GitHub Issue #21 for details on this refactoring.
21
+ *
22
+ * @module assessmentTypes
1236
23
  */
1237
- export interface AnnotationAlignedProgress {
1238
- type: "annotation_aligned";
1239
- tool: string;
1240
- confidence: "high" | "medium" | "low";
1241
- annotations: {
1242
- readOnlyHint?: boolean;
1243
- destructiveHint?: boolean;
1244
- openWorldHint?: boolean;
1245
- idempotentHint?: boolean;
1246
- };
1247
- }
1248
- export declare const DEFAULT_ASSESSMENT_CONFIG: AssessmentConfiguration;
1249
- export declare const REVIEWER_MODE_CONFIG: AssessmentConfiguration;
1250
- export declare const DEVELOPER_MODE_CONFIG: AssessmentConfiguration;
1251
- export declare const AUDIT_MODE_CONFIG: AssessmentConfiguration;
1252
- export declare const CLAUDE_ENHANCED_AUDIT_CONFIG: AssessmentConfiguration;
24
+ export * from "./assessment/index.js";
1253
25
  //# sourceMappingURL=assessmentTypes.d.ts.map