Implementation:1mcp app Agent matrixRuntime
| Knowledge Sources | |
|---|---|
| Domains | Testing, MCP_Protocol |
| Last Updated | 2026-10-29 00:00 GMT |
Overview
Concrete matrix execution engine that validates MCP protocol conformance across all combinations of SDK era, transport type, and client/server roles with sanitized wire evidence capture.
Description
The matrixRuntime module provides the core engine for protocol conformance testing. It validates matrix assignments (combinations of inbound era, upstream era, and transport), executes each assignment by spawning a gateway, inbound probe, and upstream peer, captures wire-level evidence, and parses probe output against both legacy and modern JSON-RPC schemas. The module includes `validateMatrixAssignments` for input validation, `executeMatrixAssignment` for running a single cell, and `parseProbeOutput` for interpreting probe results.
Usage
Import this module when you need to:
- Execute the protocol conformance matrix across era combinations
- Validate matrix assignment descriptors before execution
- Parse probe output against legacy and modern JSON-RPC message schemas
- Capture sanitized wire evidence for protocol regression testing
Code Reference
Source Location
- Repository: 1MCP Agent
- File: test/conformance/runtime/matrixRuntime.ts (L357-841)
Signature
export function validateMatrixAssignments(
input: readonly MatrixAssignmentDescriptor[],
): MatrixAssignmentDescriptor[];
export async function executeMatrixAssignment(
input: MatrixExecutionOptions,
): Promise<MatrixExecutionResult>;
export function parseProbeOutput(
value: unknown,
exitCode: number,
): ProbeOutput;
interface MatrixAssignmentDescriptor {
assignmentId: string;
inboundProbe: { command: string; args: string[] };
upstreamPeer: { command: string; args: string[]; readiness: string };
eras: { inbound: string; upstream: string };
upstreamTransport: { type: string };
timeouts: { startupMs: number; probeMs: number; shutdownMs: number };
}
Import
import { validateMatrixAssignments, executeMatrixAssignment, parseProbeOutput } from './matrixRuntime.js';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| assignmentId | string | Yes | Matrix cell ID |
| inboundProbe | { command, args } | Yes | Probe command and arguments |
| upstreamPeer | { command, args, readiness } | Yes | Upstream peer server |
| eras | { inbound, upstream } | Yes | Era selection (v1, v2) |
| timeouts | { startupMs, probeMs, shutdownMs } | Yes | Execution timeouts |
Outputs
| Name | Type | Description |
|---|---|---|
| MatrixExecutionResult | object | Sanitized wire evidence, probe outputs, pass/fail |
Usage Examples
Execute a Matrix Assignment
import { executeMatrixAssignment } from './matrixRuntime.js';
const result = await executeMatrixAssignment({
assignmentId: 'v2-inbound_v1-upstream_stdio',
inboundProbe: { command: 'node', args: ['probe.mjs'] },
upstreamPeer: { command: 'node', args: ['peer.mjs'], readiness: 'http://localhost:3001/ready' },
eras: { inbound: 'v2', upstream: 'v1' },
upstreamTransport: { type: 'stdio' },
timeouts: { startupMs: 10000, probeMs: 30000, shutdownMs: 5000 },
});
console.log(result.passed ? 'PASS' : 'FAIL');