بنقرة واحدة
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
}
}