@mastyf_ai/tool-registry 0.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.
@@ -0,0 +1,64 @@
1
+ export interface RegistryEntry {
2
+ id: string;
3
+ name: string;
4
+ packageName: string;
5
+ description: string;
6
+ version: string;
7
+ repository: string;
8
+ publishedAt: string;
9
+ updatedAt: string;
10
+ trustScore: number;
11
+ trustGrade: TrustGrade;
12
+ cveCount: number;
13
+ criticalCveCount: number;
14
+ downloadCount: number;
15
+ categories: string[];
16
+ authSupported: boolean;
17
+ authProviders: string[];
18
+ badges: RegistryBadge[];
19
+ }
20
+ export type TrustGrade = 'A+' | 'A' | 'B' | 'C' | 'D' | 'F';
21
+ export interface RegistryBadge {
22
+ type: string;
23
+ label: string;
24
+ color: string;
25
+ achievedAt: string;
26
+ }
27
+ export interface ScanResult {
28
+ packageName: string;
29
+ trustScore: number;
30
+ trustGrade: TrustGrade;
31
+ cveCount: number;
32
+ criticalCveCount: number;
33
+ typoSquatRisk: number;
34
+ depConfusionRisk: number;
35
+ authScore: number;
36
+ transportScore: number;
37
+ capabilityRisk: number;
38
+ dimensions: {
39
+ cvePosture: number;
40
+ authStrength: number;
41
+ transportSecurity: number;
42
+ abilityRiskSurface: number;
43
+ supplyChainIntegrity: number;
44
+ observedAttackHistory: number;
45
+ responseHygiene: number;
46
+ configurationFreshness: number;
47
+ };
48
+ recommendations: string[];
49
+ scannedAt: string;
50
+ }
51
+ export declare function generateScanResult(params: {
52
+ packageName: string;
53
+ cveCount?: number;
54
+ criticalCveCount?: number;
55
+ authStrength?: 'none' | 'api_key' | 'oauth2' | 'oauth2_mtls';
56
+ transportSecurity?: 'stdio' | 'http' | 'https' | 'mTLS';
57
+ hasTrustedPublisher?: boolean;
58
+ hasTypoSquatRisk?: boolean;
59
+ hasDepConfusionRisk?: boolean;
60
+ knownAttacks?: number;
61
+ hasDlp?: boolean;
62
+ lastUpdatedDays?: number;
63
+ }): ScanResult;
64
+ export declare function generateBadgeSvg(score: number, grade: TrustGrade): string;
package/dist/index.js ADDED
@@ -0,0 +1,83 @@
1
+ function computeGrade(score) {
2
+ if (score >= 90)
3
+ return 'A+';
4
+ if (score >= 80)
5
+ return 'A';
6
+ if (score >= 60)
7
+ return 'B';
8
+ if (score >= 40)
9
+ return 'C';
10
+ if (score >= 20)
11
+ return 'D';
12
+ return 'F';
13
+ }
14
+ export function generateScanResult(params) {
15
+ const authStrength = params.authStrength || 'none';
16
+ const transportSecurity = params.transportSecurity || 'https';
17
+ const lastUpdatedDays = params.lastUpdatedDays || 0;
18
+ const cvePosture = Math.max(0, 100 - ((params.cveCount || 0) * 10) - ((params.criticalCveCount || 0) * 25));
19
+ const mappedAuthScore = { none: 0, api_key: 30, oauth2: 70, oauth2_mtls: 100 }[authStrength];
20
+ const mappedTransportScore = { stdio: 10, http: 30, https: 60, mTLS: 100 }[transportSecurity];
21
+ const supplyChainScore = (params.hasTrustedPublisher ? 70 : 30) - (params.hasTypoSquatRisk ? 30 : 0) - (params.hasDepConfusionRisk ? 20 : 0);
22
+ const capabilityRisk = 60;
23
+ const attackHistoryScore = Math.max(0, 100 - ((params.knownAttacks || 0) * 15));
24
+ const responseHygieneScore = params.hasDlp ? 80 : 40;
25
+ const freshnessScore = Math.max(0, 100 - lastUpdatedDays * 2);
26
+ const dimensions = {
27
+ cvePosture: Math.round(cvePosture),
28
+ authStrength: mappedAuthScore,
29
+ transportSecurity: mappedTransportScore,
30
+ abilityRiskSurface: capabilityRisk,
31
+ supplyChainIntegrity: Math.max(0, supplyChainScore),
32
+ observedAttackHistory: attackHistoryScore,
33
+ responseHygiene: responseHygieneScore,
34
+ configurationFreshness: Math.round(freshnessScore),
35
+ };
36
+ const dimValues = Object.values(dimensions);
37
+ const score = Math.round(dimValues.reduce((a, b) => a + b, 0) / dimValues.length);
38
+ const recommendations = [];
39
+ if (dimensions.authStrength < 50)
40
+ recommendations.push('Add OAuth 2.1 authentication support');
41
+ if (dimensions.transportSecurity < 60)
42
+ recommendations.push('Enable HTTPS transport with mTLS');
43
+ if (params.criticalCveCount && params.criticalCveCount > 0)
44
+ recommendations.push(`Patch ${params.criticalCveCount} critical CVEs`);
45
+ if (params.hasTypoSquatRisk)
46
+ recommendations.push('Register typo-squat variations of the package name');
47
+ if (!params.hasDlp)
48
+ recommendations.push('Enable response DLP scanning');
49
+ if (lastUpdatedDays > 90)
50
+ recommendations.push('Update package to latest version');
51
+ return {
52
+ packageName: params.packageName,
53
+ trustScore: score,
54
+ trustGrade: computeGrade(score),
55
+ cveCount: params.cveCount || 0,
56
+ criticalCveCount: params.criticalCveCount || 0,
57
+ typoSquatRisk: params.hasTypoSquatRisk ? 50 : 0,
58
+ depConfusionRisk: params.hasDepConfusionRisk ? 50 : 0,
59
+ authScore: dimensions.authStrength,
60
+ transportScore: dimensions.transportSecurity,
61
+ capabilityRisk: dimensions.abilityRiskSurface,
62
+ dimensions,
63
+ recommendations,
64
+ scannedAt: new Date().toISOString(),
65
+ };
66
+ }
67
+ export function generateBadgeSvg(score, grade) {
68
+ const colors = {
69
+ 'A+': '#22c55e',
70
+ 'A': '#22c55e',
71
+ 'B': '#3b82f6',
72
+ 'C': '#f59e0b',
73
+ 'D': '#f97316',
74
+ 'F': '#ef4444',
75
+ };
76
+ const color = colors[grade] || '#6b7280';
77
+ return `<svg xmlns="http://www.w3.org/2000/svg" width="140" height="20">
78
+ <rect width="80" height="20" fill="#1f2937" rx="3"/>
79
+ <text x="40" y="14" fill="#f9fafb" font-size="11" font-family="monospace" text-anchor="middle" font-weight="bold">Mastyf ${grade}</text>
80
+ <rect x="80" width="60" height="20" fill="${color}" rx="3"/>
81
+ <text x="110" y="14" fill="#fff" font-size="11" font-family="monospace" text-anchor="middle">${score}/100</text>
82
+ </svg>`;
83
+ }
package/package.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "name": "@mastyf_ai/tool-registry",
3
+ "version": "0.1.0",
4
+ "description": "Mastyf AI MCP Tool Registry — discover, score, and publish MCP servers with trust grades",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "exports": {
8
+ ".": "./dist/index.js",
9
+ "./scanner": "./dist/scanner.js",
10
+ "./api": "./dist/api.js"
11
+ },
12
+ "files": ["dist"],
13
+ "scripts": {
14
+ "build": "tsc",
15
+ "prepublishOnly": "tsc",
16
+ "dev": "tsx src/server.ts",
17
+ "typecheck": "tsc --noEmit"
18
+ },
19
+ "keywords": ["mcp", "registry", "trust-score", "security", "mastyf"],
20
+ "license": "MIT"
21
+ }