mcp_ScancodeMCP_compare_license_compatibility
Compare two software licenses to determine compatibility and understand legal implications for combining code under different licenses.
Instructions
Legal compatibility verdict and explanation for two license types (e.g., MIT vs GPLv3).
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| licenseA | Yes | First license name (e.g., MIT, GPL-3.0) | |
| licenseB | Yes | Second license name (e.g., Apache-2.0, GPL-2.0) |
Implementation Reference
- index.ts:148-151 (handler)The handler function for the tool, which takes licenseA and licenseB, calls licenseCompatibilityVerdict, and returns the result as content.async ({ licenseA, licenseB }) => { // Use a built-in matrix for common licenses, else flag for manual review return { content: [{ type: "text", text: licenseCompatibilityVerdict(licenseA, licenseB) }] }; }
- index.ts:143-146 (schema)Input schema defining parameters licenseA and licenseB using Zod validation.inputSchema: { licenseA: z.string().describe("First license name (e.g., MIT, GPL-3.0)") , licenseB: z.string().describe("Second license name (e.g., Apache-2.0, GPL-2.0)") },
- index.ts:138-152 (registration)Registration of the tool using server.registerTool, including title, description, inputSchema, and handler.server.registerTool( "mcp_ScancodeMCP_compare_license_compatibility", { title: "Compare License Compatibility", description: "Legal compatibility verdict and explanation for two license types (e.g., MIT vs GPLv3).", inputSchema: { licenseA: z.string().describe("First license name (e.g., MIT, GPL-3.0)") , licenseB: z.string().describe("Second license name (e.g., Apache-2.0, GPL-2.0)") }, }, async ({ licenseA, licenseB }) => { // Use a built-in matrix for common licenses, else flag for manual review return { content: [{ type: "text", text: licenseCompatibilityVerdict(licenseA, licenseB) }] }; } );
- index.ts:266-287 (helper)Helper function that implements the core logic for determining license compatibility based on a simple matrix of common licenses.function licenseCompatibilityVerdict(licenseA: string, licenseB: string): string { // Simple matrix for demo; real-world use would be more complex const a = licenseA.toLowerCase(); const b = licenseB.toLowerCase(); if (a === b) return `Both are ${licenseA}. Compatible.`; if ((a.includes("mit") && b.includes("gpl")) || (b.includes("mit") && a.includes("gpl"))) { return "MIT and GPL: MIT code can be included in GPL projects, but the combined work must be GPL. GPL code cannot be relicensed as MIT. Compatible with restrictions."; } if ((a.includes("mit") && b.includes("apache")) || (b.includes("mit") && a.includes("apache"))) { return "MIT and Apache: Compatible. Both are permissive, but Apache has extra patent terms."; } if ((a.includes("gpl") && b.includes("apache")) || (b.includes("gpl") && a.includes("apache"))) { return "GPL and Apache: Apache 2.0 is compatible with GPLv3, but not with GPLv2. Check versions."; } if (a.includes("proprietary") || b.includes("proprietary")) { return "Proprietary and open source: Usually incompatible. Legal review required."; } if (a.includes("unknown") || b.includes("unknown")) { return "Unknown license: Cannot determine compatibility. Legal review required."; } return "Compatibility unknown or complex. Legal review recommended."; }