@yawlabs/mcp-compliance 0.4.0 → 0.6.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/README.md +39 -7
- package/dist/{chunk-KNOSZ3TD.js → chunk-QLFYT4I7.js} +1277 -62
- package/dist/index.js +1342 -105
- package/dist/mcp/server.js +8 -5
- package/dist/runner.d.ts +13 -3
- package/dist/runner.js +7 -1
- package/package.json +1 -1
package/dist/mcp/server.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
|
+
SPEC_BASE,
|
|
2
3
|
TEST_DEFINITIONS,
|
|
3
4
|
runComplianceSuite
|
|
4
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-QLFYT4I7.js";
|
|
5
6
|
|
|
6
7
|
// src/mcp/server.ts
|
|
7
8
|
import { createRequire } from "module";
|
|
@@ -13,7 +14,7 @@ import { z } from "zod";
|
|
|
13
14
|
function registerTools(server) {
|
|
14
15
|
server.tool(
|
|
15
16
|
"mcp_compliance_test",
|
|
16
|
-
"Run the full MCP compliance test suite against a server URL. Returns grade (A-F), score, and detailed results for all
|
|
17
|
+
"Run the full MCP compliance test suite against a server URL. Returns grade (A-F), score, and detailed results for all 69 tests covering transport, lifecycle, tools, resources, prompts, errors, schema validation, and security.",
|
|
17
18
|
{
|
|
18
19
|
url: z.string().url().describe("The MCP server URL to test (must be HTTP or HTTPS)"),
|
|
19
20
|
auth: z.string().optional().describe('Authorization header value (e.g., "Bearer tok123")'),
|
|
@@ -69,8 +70,9 @@ ${JSON.stringify(report, null, 2)}` }
|
|
|
69
70
|
]
|
|
70
71
|
};
|
|
71
72
|
} catch (err) {
|
|
73
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
72
74
|
return {
|
|
73
|
-
content: [{ type: "text", text: `Error running compliance test: ${
|
|
75
|
+
content: [{ type: "text", text: `Error running compliance test: ${message}` }],
|
|
74
76
|
isError: true
|
|
75
77
|
};
|
|
76
78
|
}
|
|
@@ -118,8 +120,9 @@ ${JSON.stringify(report, null, 2)}` }
|
|
|
118
120
|
]
|
|
119
121
|
};
|
|
120
122
|
} catch (err) {
|
|
123
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
121
124
|
return {
|
|
122
|
-
content: [{ type: "text", text: `Error: ${
|
|
125
|
+
content: [{ type: "text", text: `Error: ${message}` }],
|
|
123
126
|
isError: true
|
|
124
127
|
};
|
|
125
128
|
}
|
|
@@ -163,7 +166,7 @@ ${TEST_DEFINITIONS.map((t) => t.id).join(", ")}`
|
|
|
163
166
|
`Name: ${def.name}`,
|
|
164
167
|
`Category: ${def.category}`,
|
|
165
168
|
`Required: ${def.required ? "Yes" : "No"}`,
|
|
166
|
-
`Spec reference:
|
|
169
|
+
`Spec reference: ${SPEC_BASE}/${def.specRef}`,
|
|
167
170
|
"",
|
|
168
171
|
def.description,
|
|
169
172
|
"",
|
package/dist/runner.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
type TestCategory = "transport" | "lifecycle" | "tools" | "resources" | "prompts" | "errors" | "schema";
|
|
1
|
+
type TestCategory = "transport" | "lifecycle" | "tools" | "resources" | "prompts" | "errors" | "schema" | "security";
|
|
2
2
|
interface TestResult {
|
|
3
3
|
id: string;
|
|
4
4
|
name: string;
|
|
@@ -60,7 +60,7 @@ interface TestDefinition {
|
|
|
60
60
|
description: string;
|
|
61
61
|
recommendation: string;
|
|
62
62
|
}
|
|
63
|
-
/** All
|
|
63
|
+
/** All 69 test IDs with descriptions for the explain command */
|
|
64
64
|
declare const TEST_DEFINITIONS: TestDefinition[];
|
|
65
65
|
|
|
66
66
|
declare function computeGrade(score: number): Grade;
|
|
@@ -92,6 +92,16 @@ declare function generateBadge(url: string): {
|
|
|
92
92
|
html: string;
|
|
93
93
|
};
|
|
94
94
|
|
|
95
|
+
declare const SPEC_VERSION = "2025-11-25";
|
|
96
|
+
declare const SPEC_BASE = "https://modelcontextprotocol.io/specification/2025-11-25";
|
|
97
|
+
/**
|
|
98
|
+
* Parse SSE (text/event-stream) response body.
|
|
99
|
+
* Handles multi-line data fields per the SSE specification:
|
|
100
|
+
* consecutive "data:" lines are concatenated with "\n".
|
|
101
|
+
* An empty line marks the end of an event.
|
|
102
|
+
* @internal Exported for testing.
|
|
103
|
+
*/
|
|
104
|
+
declare function parseSSEResponse(text: string): any;
|
|
95
105
|
interface RunOptions {
|
|
96
106
|
/** Optional callback for progress updates */
|
|
97
107
|
onProgress?: (testId: string, passed: boolean, details: string) => void;
|
|
@@ -111,4 +121,4 @@ interface RunOptions {
|
|
|
111
121
|
*/
|
|
112
122
|
declare function runComplianceSuite(url: string, options?: RunOptions): Promise<ComplianceReport>;
|
|
113
123
|
|
|
114
|
-
export { type ComplianceReport, type RunOptions, TEST_DEFINITIONS, type TestResult, computeGrade, computeScore, generateBadge, runComplianceSuite };
|
|
124
|
+
export { type ComplianceReport, type RunOptions, SPEC_BASE, SPEC_VERSION, TEST_DEFINITIONS, type TestResult, computeGrade, computeScore, generateBadge, parseSSEResponse, runComplianceSuite };
|
package/dist/runner.js
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
import {
|
|
2
|
+
SPEC_BASE,
|
|
3
|
+
SPEC_VERSION,
|
|
2
4
|
TEST_DEFINITIONS,
|
|
3
5
|
computeGrade,
|
|
4
6
|
computeScore,
|
|
5
7
|
generateBadge,
|
|
8
|
+
parseSSEResponse,
|
|
6
9
|
runComplianceSuite
|
|
7
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-QLFYT4I7.js";
|
|
8
11
|
export {
|
|
12
|
+
SPEC_BASE,
|
|
13
|
+
SPEC_VERSION,
|
|
9
14
|
TEST_DEFINITIONS,
|
|
10
15
|
computeGrade,
|
|
11
16
|
computeScore,
|
|
12
17
|
generateBadge,
|
|
18
|
+
parseSSEResponse,
|
|
13
19
|
runComplianceSuite
|
|
14
20
|
};
|
package/package.json
CHANGED