Add get_licenses tool with SPDX and copyleft enrichment#12
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds a new
get_licensesMCP tool that looks up the declared license for one or many packages in a single call, enriched with SPDX metadata and copyleft classification from a baked-in dataset.{packages: [{registry, package, version?}]}. Each result carries a status (found/not-declared/registry-unsupported/error), the raw license string verbatim, and aspdx[]array withlicenseId,name,isOsiApproved,isDeprecated,category,isCopyleft, plus a top-levelisCopyleftshortcut. Works across 11 of 13 registries;goanddockershort-circuit asregistry-unsupportedwithout a network call.data/licenses.jsonmerges the SPDX License List (CC0-1.0) with ScanCode LicenseDB categories (CC-BY-4.0). Both sources and their full attribution strings are embedded insources[]and echoed on every response so downstream consumers carry the CC-BY-4.0 attribution. Manual refresh viadeno task update-licenses.LicenseRegistry.parsetolerates free-form strings — splitsOR/AND/,///WITHfor dual-licensed packages, matches case-insensitively by SPDX ID and by full name (so "MIT License" resolves like "MIT"), and deduplicates repeated tokens.<licenses>block (<name>preferred, falls back to<url>, joins multiple with,). JSR fetches the per-version detail endpoint where the declared license lives. Both reuse existing per-package caches.--allow-readpropagated tostart/dev/testtasks, the CI workflow, and the CLAUDE.md pre-push checklist, since the tool reads the baked dataset at runtime.Test plan
deno fmt --check && deno lint && deno check main.ts && deno test --allow-net --allow-read— all four CI gates pass (194 tests).get_licensesfrom an MCP client with a mix of registries (npm, maven, jsr, cargo, pypi, go, docker) and confirmstatusis correct for each.cargo/serde→"MIT OR Apache-2.0") and confirmspdx[]returns both entries withisCopyleft: false.isCopyleft: true.deno task update-licensesand confirm the dataset rewrites cleanly with the newgeneratedAttimestamp.🤖 Generated with Claude Code