mcp-server-diff 2.1.0
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.
- package/.github/dependabot.yml +21 -0
- package/.github/workflows/ci.yml +51 -0
- package/.github/workflows/publish.yml +36 -0
- package/.github/workflows/release.yml +51 -0
- package/.prettierignore +3 -0
- package/.prettierrc +8 -0
- package/CONTRIBUTING.md +81 -0
- package/LICENSE +21 -0
- package/README.md +526 -0
- package/action.yml +250 -0
- package/dist/__tests__/fixtures/http-server.d.ts +7 -0
- package/dist/__tests__/fixtures/stdio-server.d.ts +7 -0
- package/dist/cli/__tests__/fixtures/http-server.d.ts +7 -0
- package/dist/cli/__tests__/fixtures/stdio-server.d.ts +7 -0
- package/dist/cli/cli.d.ts +7 -0
- package/dist/cli/diff.d.ts +44 -0
- package/dist/cli/git.d.ts +37 -0
- package/dist/cli/index.d.ts +7 -0
- package/dist/cli/index.js +57182 -0
- package/dist/cli/licenses.txt +466 -0
- package/dist/cli/logger.d.ts +46 -0
- package/dist/cli/package.json +3 -0
- package/dist/cli/probe.d.ts +35 -0
- package/dist/cli/reporter.d.ts +20 -0
- package/dist/cli/runner.d.ts +30 -0
- package/dist/cli/types.d.ts +134 -0
- package/dist/cli.d.ts +7 -0
- package/dist/diff.d.ts +44 -0
- package/dist/git.d.ts +37 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +58032 -0
- package/dist/licenses.txt +466 -0
- package/dist/logger.d.ts +46 -0
- package/dist/package.json +3 -0
- package/dist/probe.d.ts +35 -0
- package/dist/reporter.d.ts +20 -0
- package/dist/runner.d.ts +30 -0
- package/dist/types.d.ts +134 -0
- package/eslint.config.mjs +47 -0
- package/jest.config.mjs +26 -0
- package/package.json +64 -0
- package/src/__tests__/fixtures/http-server.ts +103 -0
- package/src/__tests__/fixtures/stdio-server.ts +158 -0
- package/src/__tests__/integration.test.ts +306 -0
- package/src/__tests__/runner.test.ts +430 -0
- package/src/cli.ts +421 -0
- package/src/diff.ts +252 -0
- package/src/git.ts +262 -0
- package/src/index.ts +284 -0
- package/src/logger.ts +93 -0
- package/src/probe.ts +327 -0
- package/src/reporter.ts +214 -0
- package/src/runner.ts +902 -0
- package/src/types.ts +155 -0
- package/tsconfig.json +30 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for MCP Conformance Action
|
|
3
|
+
*/
|
|
4
|
+
export interface TestConfiguration {
|
|
5
|
+
name: string;
|
|
6
|
+
transport: "stdio" | "streamable-http";
|
|
7
|
+
start_command?: string;
|
|
8
|
+
args?: string;
|
|
9
|
+
server_url?: string;
|
|
10
|
+
headers?: Record<string, string>;
|
|
11
|
+
env_vars?: string;
|
|
12
|
+
custom_messages?: CustomMessage[];
|
|
13
|
+
/** Command to run before starting the MCP server for this config */
|
|
14
|
+
pre_test_command?: string;
|
|
15
|
+
/** Milliseconds to wait after pre_test_command before starting the server */
|
|
16
|
+
pre_test_wait_ms?: number;
|
|
17
|
+
/** Milliseconds to wait for HTTP server to start (when using start_command with HTTP transport) */
|
|
18
|
+
startup_wait_ms?: number;
|
|
19
|
+
/** Command to run after stopping the MCP server for this config (cleanup) */
|
|
20
|
+
post_test_command?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface CustomMessage {
|
|
23
|
+
id: number;
|
|
24
|
+
name: string;
|
|
25
|
+
message: Record<string, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export interface ActionInputs {
|
|
28
|
+
setupNode: boolean;
|
|
29
|
+
nodeVersion: string;
|
|
30
|
+
setupPython: boolean;
|
|
31
|
+
pythonVersion: string;
|
|
32
|
+
setupGo: boolean;
|
|
33
|
+
goVersion: string;
|
|
34
|
+
setupRust: boolean;
|
|
35
|
+
rustToolchain: string;
|
|
36
|
+
setupDotnet: boolean;
|
|
37
|
+
dotnetVersion: string;
|
|
38
|
+
installCommand: string;
|
|
39
|
+
buildCommand: string;
|
|
40
|
+
startCommand: string;
|
|
41
|
+
transport: "stdio" | "streamable-http";
|
|
42
|
+
serverUrl: string;
|
|
43
|
+
headers: Record<string, string>;
|
|
44
|
+
configurations: TestConfiguration[];
|
|
45
|
+
customMessages: CustomMessage[];
|
|
46
|
+
compareRef: string;
|
|
47
|
+
failOnError: boolean;
|
|
48
|
+
failOnDiff: boolean;
|
|
49
|
+
envVars: string;
|
|
50
|
+
serverTimeout: number;
|
|
51
|
+
httpStartCommand: string;
|
|
52
|
+
httpStartupWaitMs: number;
|
|
53
|
+
}
|
|
54
|
+
export interface ProbeResult {
|
|
55
|
+
initialize: InitializeInfo | null;
|
|
56
|
+
tools: ToolsResult | null;
|
|
57
|
+
prompts: PromptsResult | null;
|
|
58
|
+
resources: ResourcesResult | null;
|
|
59
|
+
resourceTemplates: ResourceTemplatesResult | null;
|
|
60
|
+
customResponses: Map<string, unknown>;
|
|
61
|
+
error?: string;
|
|
62
|
+
}
|
|
63
|
+
export interface InitializeInfo {
|
|
64
|
+
serverInfo?: {
|
|
65
|
+
name: string;
|
|
66
|
+
version: string;
|
|
67
|
+
};
|
|
68
|
+
capabilities?: Record<string, unknown>;
|
|
69
|
+
}
|
|
70
|
+
export interface ToolsResult {
|
|
71
|
+
tools: Array<{
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
inputSchema?: Record<string, unknown>;
|
|
75
|
+
}>;
|
|
76
|
+
}
|
|
77
|
+
export interface PromptsResult {
|
|
78
|
+
prompts: Array<{
|
|
79
|
+
name: string;
|
|
80
|
+
description?: string;
|
|
81
|
+
arguments?: Array<{
|
|
82
|
+
name: string;
|
|
83
|
+
description?: string;
|
|
84
|
+
required?: boolean;
|
|
85
|
+
}>;
|
|
86
|
+
}>;
|
|
87
|
+
}
|
|
88
|
+
export interface ResourcesResult {
|
|
89
|
+
resources: Array<{
|
|
90
|
+
uri: string;
|
|
91
|
+
name: string;
|
|
92
|
+
description?: string;
|
|
93
|
+
mimeType?: string;
|
|
94
|
+
}>;
|
|
95
|
+
}
|
|
96
|
+
export interface ResourceTemplatesResult {
|
|
97
|
+
resourceTemplates: Array<{
|
|
98
|
+
uriTemplate: string;
|
|
99
|
+
name: string;
|
|
100
|
+
description?: string;
|
|
101
|
+
mimeType?: string;
|
|
102
|
+
}>;
|
|
103
|
+
}
|
|
104
|
+
/** Counts of MCP primitives discovered */
|
|
105
|
+
export interface PrimitiveCounts {
|
|
106
|
+
tools: number;
|
|
107
|
+
prompts: number;
|
|
108
|
+
resources: number;
|
|
109
|
+
resourceTemplates: number;
|
|
110
|
+
}
|
|
111
|
+
export interface TestResult {
|
|
112
|
+
configName: string;
|
|
113
|
+
transport: string;
|
|
114
|
+
branchTime: number;
|
|
115
|
+
baseTime: number;
|
|
116
|
+
hasDifferences: boolean;
|
|
117
|
+
diffs: Map<string, string>;
|
|
118
|
+
/** Primitive counts from current branch */
|
|
119
|
+
branchCounts?: PrimitiveCounts;
|
|
120
|
+
/** Primitive counts from base ref */
|
|
121
|
+
baseCounts?: PrimitiveCounts;
|
|
122
|
+
/** Error message if probing failed */
|
|
123
|
+
error?: string;
|
|
124
|
+
}
|
|
125
|
+
export interface ConformanceReport {
|
|
126
|
+
generatedAt: string;
|
|
127
|
+
currentBranch: string;
|
|
128
|
+
compareRef: string;
|
|
129
|
+
results: TestResult[];
|
|
130
|
+
totalBranchTime: number;
|
|
131
|
+
totalBaseTime: number;
|
|
132
|
+
passedCount: number;
|
|
133
|
+
diffCount: number;
|
|
134
|
+
}
|
package/dist/cli.d.ts
ADDED
package/dist/diff.d.ts
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core diffing logic for MCP servers
|
|
3
|
+
*
|
|
4
|
+
* Pure functions for comparing probe results - no I/O side effects.
|
|
5
|
+
*/
|
|
6
|
+
import type { ProbeResult, PrimitiveCounts } from "./types.js";
|
|
7
|
+
export interface DiffResult {
|
|
8
|
+
endpoint: string;
|
|
9
|
+
diff: string;
|
|
10
|
+
}
|
|
11
|
+
export interface ComparisonResult {
|
|
12
|
+
baseName: string;
|
|
13
|
+
targetName: string;
|
|
14
|
+
hasDifferences: boolean;
|
|
15
|
+
diffs: DiffResult[];
|
|
16
|
+
baseCounts: PrimitiveCounts;
|
|
17
|
+
targetCounts: PrimitiveCounts;
|
|
18
|
+
baseError?: string;
|
|
19
|
+
targetError?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Extract primitive counts from a probe result
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractCounts(result: ProbeResult): PrimitiveCounts;
|
|
25
|
+
/**
|
|
26
|
+
* Compare two probe results and return structured diff results
|
|
27
|
+
*/
|
|
28
|
+
export declare function compareProbeResults(baseResult: ProbeResult, targetResult: ProbeResult): DiffResult[];
|
|
29
|
+
/**
|
|
30
|
+
* Generate semantic JSON diff
|
|
31
|
+
*/
|
|
32
|
+
export declare function generateJsonDiff(name: string, base: string, target: string): string | null;
|
|
33
|
+
/**
|
|
34
|
+
* Recursively find differences between two JSON objects
|
|
35
|
+
*/
|
|
36
|
+
export declare function findJsonDifferences(base: unknown, target: unknown, path: string): string[];
|
|
37
|
+
/**
|
|
38
|
+
* Format a value for display in diff output
|
|
39
|
+
*/
|
|
40
|
+
export declare function formatValue(value: unknown): string;
|
|
41
|
+
/**
|
|
42
|
+
* Convert DiffResult array to Map for backward compatibility
|
|
43
|
+
*/
|
|
44
|
+
export declare function diffsToMap(diffs: DiffResult[]): Map<string, string>;
|
package/dist/git.d.ts
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git utilities for MCP server diff
|
|
3
|
+
*/
|
|
4
|
+
export interface GitInfo {
|
|
5
|
+
currentBranch: string;
|
|
6
|
+
compareRef: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Get current branch name
|
|
10
|
+
*/
|
|
11
|
+
export declare function getCurrentBranch(): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Determine what ref to compare against
|
|
14
|
+
* Priority: 1) Explicit compare_ref, 2) Auto-detect previous tag, 3) Merge-base with main
|
|
15
|
+
*/
|
|
16
|
+
export declare function determineCompareRef(explicitRef?: string, githubRef?: string): Promise<string>;
|
|
17
|
+
/**
|
|
18
|
+
* Create a worktree for the compare ref
|
|
19
|
+
*/
|
|
20
|
+
export declare function createWorktree(ref: string, path: string): Promise<boolean>;
|
|
21
|
+
/**
|
|
22
|
+
* Remove a worktree
|
|
23
|
+
*/
|
|
24
|
+
export declare function removeWorktree(path: string): Promise<void>;
|
|
25
|
+
/**
|
|
26
|
+
* Checkout a ref (fallback if worktree fails)
|
|
27
|
+
*/
|
|
28
|
+
export declare function checkout(ref: string): Promise<void>;
|
|
29
|
+
/**
|
|
30
|
+
* Checkout previous branch/ref
|
|
31
|
+
*/
|
|
32
|
+
export declare function checkoutPrevious(): Promise<void>;
|
|
33
|
+
/**
|
|
34
|
+
* Get a display-friendly name for a ref.
|
|
35
|
+
* Returns branch/tag name if available, otherwise the short SHA.
|
|
36
|
+
*/
|
|
37
|
+
export declare function getRefDisplayName(ref: string): Promise<string>;
|