一键导入
protocol-golden-testing
Pattern for testing MCP protocol compatibility using golden JSON snapshots
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Pattern for testing MCP protocol compatibility using golden JSON snapshots
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
| name | protocol-golden-testing |
| description | Pattern for testing MCP protocol compatibility using golden JSON snapshots |
| domain | testing |
| confidence | high |
| source | manual — designed during protocol compatibility test architecture session |
When building an MCP server that must remain compatible with a reference implementation (VS Code Copilot Chat), protocol drift is the primary risk. The reference implementation updates independently and isn't available in CI. This skill covers how to test protocol compatibility without the reference running.
Store reference JSON responses as snapshot files. Compare using structural superset checks:
This avoids brittle value comparisons while catching structural regressions.
Test the full protocol exchange over real named pipes with mocked backend services:
McpPipeServer with mocked IVsServiceRpcNamedPipeClientStream as Copilot CLI wouldinitialize, tools/list, tool calls)Add an internal constructor to RpcClient accepting a pre-configured IVsServiceRpc. Since the test project already has [InternalsVisibleTo], this enables mocked integration tests without a real VS pipe connection.
Snapshots/ directorySnapshots/VERSION tracks the VS Code extension version they were captured from// Structural superset check (pseudo-code)
void AssertSchemaMatch(JsonElement actual, JsonElement golden)
{
foreach (var prop in golden.EnumerateObject())
{
Assert.True(actual.TryGetProperty(prop.Name, out var actualProp));
Assert.Equal(prop.Value.ValueKind, actualProp.ValueKind);
if (prop.Value.ValueKind == JsonValueKind.Object)
AssertSchemaMatch(actualProp, prop.Value); // recurse
}
}