cc0-library-mcp 0.2.11 → 0.2.13
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 +8 -5
- package/catalog/sources.json +418 -0
- package/dist/download.js +178 -0
- package/dist/http.js +4 -1
- package/dist/providers/met.js +39 -1
- package/dist/providers/openverse.js +22 -7
- package/dist/providers/polyhaven.js +13 -2
- package/dist/risk.js +77 -0
- package/dist/search.js +38 -11
- package/dist/server.js +79 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# cc0-library
|
|
2
2
|
|
|
3
3
|
**CC0 assets only. With receipts.**
|
|
4
|
-
One search across **17 sources** for images, audio, video, HDRIs, textures, 3D models, museum artworks and whole asset collections, plus a hand-verified catalog of **
|
|
4
|
+
One search across **17 sources** for images, audio, video, HDRIs, textures, 3D models, museum artworks and whole asset collections, plus a hand-verified catalog of **681 CC0 sources**. Every result shows *how* its CC0 status was verified and *who* declared it.
|
|
5
5
|
|
|
6
6
|
[](https://github.com/sanghyoLe/cc0-library/actions/workflows/ci.yml)
|
|
7
7
|

|
|
@@ -46,7 +46,7 @@ Loading is progressive: a progress bar tracks four steps (finding works, floor a
|
|
|
46
46
|
| Re-check before download | — | `get_asset` re-checks CC0 at the source |
|
|
47
47
|
| "Looks free but isn't" list | — | Unsplash, Pixabay, Pexels, SMK (Public Domain Mark), NASA |
|
|
48
48
|
| Asset types | Images, audio | Images, audio, video, HDRIs, textures, 3D models, artworks, whole collections |
|
|
49
|
-
| AI assistant access | REST API | MCP server (`search_assets`, `get_asset`, `list_sources`) |
|
|
49
|
+
| AI assistant access | REST API | MCP server (`search_assets`, `get_asset`, `download_asset`, `list_sources`) |
|
|
50
50
|
|
|
51
51
|
### Who declared CC0?
|
|
52
52
|
|
|
@@ -62,7 +62,7 @@ The web gallery has a "rights holder only" switch that drops `uploader` results.
|
|
|
62
62
|
|
|
63
63
|
## The catalog
|
|
64
64
|
|
|
65
|
-
[`catalog/sources.json`](catalog/sources.json) lists
|
|
65
|
+
[`catalog/sources.json`](catalog/sources.json) lists 681 sites and collections that are CC0 (17 of them searchable), each verified on the source's own license page, repository license or README, with the quoted evidence and a date. Browse it on the [web gallery's Browse tab](https://sanghyole.github.io/cc0-library/) (by type, with the evidence for each source) or with the `list_sources` tool.
|
|
66
66
|
|
|
67
67
|
| Asset type | Sources | Examples |
|
|
68
68
|
|---|---|---|
|
|
@@ -142,8 +142,9 @@ claude mcp add cc0-library -- node "$PWD/dist/index.js"
|
|
|
142
142
|
|
|
143
143
|
| Tool | Input | Returns |
|
|
144
144
|
|---|---|---|
|
|
145
|
-
| `search_assets` | `query`, `kind` (`image`·`audio`·`video`·`hdri`·`texture`·`model`·`artwork`·`collection`·`any`, default `any`; `any` excludes `collection`), `limit` 1–20, `page` 1–12, optional `providers` (e.g. `["iconify"]` for icons) | CC0 assets ranked by query words in title and tags, per-provider totals, per-provider errors |
|
|
145
|
+
| `search_assets` | `query`, `kind` (`image`·`audio`·`video`·`hdri`·`texture`·`model`·`artwork`·`collection`·`any`, default `any`; `any` excludes `collection`), `limit` 1–20, `page` 1–12, optional `providers` (e.g. `["iconify"]` for icons) | CC0 assets ranked by query words in title and tags, per-provider totals, per-provider errors, and `pending` sources that missed the 10 s deadline. Uploader-declared items that name a known franchise or brand, or say they are fan-made, carry `riskFlags` |
|
|
146
146
|
| `get_asset` | `id` from `search_assets` (`openverse:image:<uuid>`, `openverse:audio:<uuid>`, `polyhaven:<slug>`, `ambientcg:<assetId>`, `cleveland:<number>`, `met:<number>`, `commons:<pageid>`, `archive:<identifier>`, `sketchfab:<uid>`, `wpphotos:<number>`, `inaturalist:<n>`, `gbif:<n>`, `phylopic:<uuid>`, `iconify:<set>:<icon>`, `zenodo:<n>`, `blenderkit:<uuid>`, `github:<owner>/<repo>`, `huggingface:<owner>/<dataset>`) | Details plus download URLs (Poly Haven: up to 60 map/resolution/format files; Sketchfab: model page only, because downloads need the user's own login) |
|
|
147
|
+
| `download_asset` | `id`, `dir` (folder to save into), `files` (exact labels from `get_asset`; optional when the asset has one file) | Saves the files under `<dir>/<asset id>/` with each model's companion files (glTF `.bin` and textures) at their relative paths, and writes `cc0.json` with the source, creator, license evidence, `riskFlags` and download time. Login-only pages (Sketchfab, BlenderKit, Freesound originals) are reported in `skipped`; zips are saved as-is |
|
|
147
148
|
| `list_sources` | `kind` (optional) | Curated catalog, the non-CC0 list, and the pending-verification list |
|
|
148
149
|
|
|
149
150
|
Results are ranked by how many query words appear in each item's title (weight 2) or tags (weight 1); ties alternate between providers. Loose matches, such as a GBIF record that mentions the word only in its locality, sink below exact ones.
|
|
@@ -247,7 +248,9 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). In short:
|
|
|
247
248
|
- 웹에서 바로 검색할 수 있습니다: https://sanghyole.github.io/cc0-library/
|
|
248
249
|
- **CC0 미술관**: 주제어를 넣으면 CC0 그림·조각·바닥·조명·배경음으로 3D 전시실을 만들어 걸어 다닐 수 있습니다. WebGPU로 그리고, WebGPU가 없는 브라우저에서는 WebGL2로 자동 전환합니다. https://sanghyole.github.io/cc0-library/museum.html
|
|
249
250
|
- `get_asset`은 다운로드 URL을 주기 전에 원본에서 CC0 여부를 다시 확인합니다.
|
|
250
|
-
- `
|
|
251
|
+
- `download_asset`은 고른 파일을 `<dir>/<asset id>/`에 저장합니다. glTF의 `.bin`과 텍스처 같은 부속 파일도 제자리에 함께 받고, 출처·제작자·라이선스 근거·받은 시각을 `cc0.json`에 남깁니다.
|
|
252
|
+
- 업로더가 CC0라고만 선언한 항목 중 제목이나 태그에 유명 게임·영화·브랜드 이름이 있거나 팬아트라고 적힌 항목에는 `riskFlags`가 붙습니다. CC0 표시가 있어도 원작자의 권리는 남아 있다는 경고입니다.
|
|
253
|
+
- `list_sources`는 검증한 CC0 자료원 681곳의 목록을 줍니다. 종류별로 이미지 323곳, 오디오 181곳, 3D 119곳, 데이터 컬렉션 110곳, 텍스처 48곳, 영상 37곳, 폰트 35곳, 미술품 29곳, HDRI 10곳입니다. CC0가 아닌 무료 사이트(Unsplash, Pixabay, Pexels, Pixnio, SMK, NASA, Coverr, Burst, Mixkit, Gratisography, Natural Earth)와 그 이유도 줍니다. 아직 검증하지 못한 후보도 따로 줍니다.
|
|
251
254
|
|
|
252
255
|
- 매주 자동 점검이 목록의 라이선스 페이지를 다시 확인하고 새 후보를 찾습니다.
|
|
253
256
|
- 버전 태그를 올리면 npm과 MCP 공식 레지스트리에 자동으로 배포됩니다.
|
package/catalog/sources.json
CHANGED
|
@@ -10959,6 +10959,154 @@
|
|
|
10959
10959
|
"date": "2026-11-25",
|
|
10960
10960
|
"evidence": "Page: 'The recording is licensed with the Creative Commons Zero - public domain - license.'"
|
|
10961
10961
|
}
|
|
10962
|
+
},
|
|
10963
|
+
{
|
|
10964
|
+
"id": "blender-hdri-archive",
|
|
10965
|
+
"name": "Blender Institute HDRI Archive",
|
|
10966
|
+
"url": "https://download.blender.org/archive/hdri/",
|
|
10967
|
+
"kinds": [
|
|
10968
|
+
"hdri"
|
|
10969
|
+
],
|
|
10970
|
+
"scope": "filter-only",
|
|
10971
|
+
"searchable": false,
|
|
10972
|
+
"licensePage": "https://download.blender.org/archive/hdri/myanmar/bagan-pagodas-and-trees/",
|
|
10973
|
+
"notes": "Archive of the former Blender Cloud HDRI library: 137 equirectangular HDRIs in 7 sets (BlendedSkies, Dutch Landscape Pack, Indoor, Myanmar, Outdoor, SloCro Landscape Pack, Small World), EXR/HDR up to 16K. Each item page states its licence: 135 are marked cc-0, 2 are cc-by (Outdoor 'Forest Hochsal 02', Small World 'Elevator'), so check the label per item. A few Outdoor/Indoor items are credited to Greg Zaal and may also appear on Poly Haven.",
|
|
10974
|
+
"verified": {
|
|
10975
|
+
"date": "2026-11-25",
|
|
10976
|
+
"evidence": "Page: 'Bagan: Pagodas and Trees cc-0 Published by Sybren A. Stüvel'"
|
|
10977
|
+
}
|
|
10978
|
+
},
|
|
10979
|
+
{
|
|
10980
|
+
"id": "hdr-vault-philip-modin",
|
|
10981
|
+
"name": "HDR Vault (Philip Modin)",
|
|
10982
|
+
"url": "https://pvmodin.gumroad.com/l/HDRVault",
|
|
10983
|
+
"kinds": [
|
|
10984
|
+
"hdri"
|
|
10985
|
+
],
|
|
10986
|
+
"scope": "whole-library",
|
|
10987
|
+
"searchable": false,
|
|
10988
|
+
"licensePage": "https://pvmodin.gumroad.com/l/HDRVault",
|
|
10989
|
+
"notes": "Photographer's own library of full-sphere HDR maps (44 images at the 2017 announcement, 5376x2688 32-bit EXR, mostly indoor), released as one Gumroad download with pay-what-you-want pricing from $0. Includes his earlier 12-image Industrial set.",
|
|
10990
|
+
"verified": {
|
|
10991
|
+
"date": "2026-11-25",
|
|
10992
|
+
"evidence": "Page: 'publish a growing catalog of HDRs maps into the public domain (CC0) for personal and commercial use'"
|
|
10993
|
+
}
|
|
10994
|
+
},
|
|
10995
|
+
{
|
|
10996
|
+
"id": "kringla-cc0-media",
|
|
10997
|
+
"name": "Kringla (Swedish museums and heritage search, CC0 media filter)",
|
|
10998
|
+
"url": "https://www.kringla.nu/kringla/sok?text=*&filter=mediaLicense%3Dcc0",
|
|
10999
|
+
"kinds": [
|
|
11000
|
+
"image",
|
|
11001
|
+
"artwork"
|
|
11002
|
+
],
|
|
11003
|
+
"scope": "filter-only",
|
|
11004
|
+
"searchable": false,
|
|
11005
|
+
"licensePage": "https://www.kringla.nu/kringla/sok?text=*&filter=mediaLicense%3Dcc0",
|
|
11006
|
+
"notes": "Search portal of the Swedish National Heritage Board (Riksantikvarieämbetet) over K-samsök. The media-license facet 'cc0' returned 659,843 records on 2026-11-25, mostly Riksantikvarieämbetet heritage photos (~496k), Östasiatiska museet (~42k), Etnografiska museet (~29k), Medelhavsmuseet (~26k), Värmlands museum (~19k), Österlens and Sörmlands museum. Object pages link the media license to creativecommons.org/publicdomain/zero/1.0/. Many records have no image; use the 'Med bilder' filter. Other records in Kringla carry CC BY, CC BY-NC or PDM.",
|
|
11007
|
+
"verified": {
|
|
11008
|
+
"date": "2026-11-25",
|
|
11009
|
+
"evidence": "Object pages under the mediaLicense=cc0 filter: 'Licens: <a href=\"http://creativecommons.org/publicdomain/zero/1.0/\">'"
|
|
11010
|
+
}
|
|
11011
|
+
},
|
|
11012
|
+
{
|
|
11013
|
+
"id": "publicvideos-org-ia",
|
|
11014
|
+
"name": "Publicvideos.org stock clip batches (Internet Archive)",
|
|
11015
|
+
"url": "https://archive.org/search?query=subject%3A%22publicvideos.org%22",
|
|
11016
|
+
"kinds": [
|
|
11017
|
+
"video"
|
|
11018
|
+
],
|
|
11019
|
+
"scope": "whole-library",
|
|
11020
|
+
"searchable": false,
|
|
11021
|
+
"licensePage": "https://archive.org/details/ace_200911_02",
|
|
11022
|
+
"notes": "57 Internet Archive items (about 142 GB) archiving the publicvideos.org CC0 stock footage project, uploaded 2009-2010 by Ace of Spades (Fabricio Zuardi) and Marcio Galli. Each batch item holds hundreds of short camera clips (street, nature, objects, people) in MP4/OGV derivatives of the original MTS files. Internet Archive API: 57 items with subject publicvideos.org, all 57 with licenseurl http://creativecommons.org/publicdomain/zero/1.0/. Clips have hash filenames, so browsing is by batch rather than by subject.",
|
|
11023
|
+
"verified": {
|
|
11024
|
+
"date": "2026-11-25",
|
|
11025
|
+
"evidence": "Page: 'Usage CC0 1.0 Universal Topics publicvideos.org , royalty free , free , cc0 , cczero , stock footage'"
|
|
11026
|
+
}
|
|
11027
|
+
},
|
|
11028
|
+
{
|
|
11029
|
+
"id": "clouds-over-the-tay-timelapse",
|
|
11030
|
+
"name": "Clouds over the Tay timelapses (Adam Sampson, Internet Archive)",
|
|
11031
|
+
"url": "https://archive.org/search?query=title%3A%22Clouds+over+the+Tay%22",
|
|
11032
|
+
"kinds": [
|
|
11033
|
+
"video"
|
|
11034
|
+
],
|
|
11035
|
+
"scope": "whole-library",
|
|
11036
|
+
"searchable": false,
|
|
11037
|
+
"licensePage": "https://archive.org/details/TayClouds201306full",
|
|
11038
|
+
"notes": "26 month-long sky timelapses (about 32 GB, 2013-2016, several in HD) of clouds over the Tay Road Bridge in Dundee, Scotland, shot one frame per minute with a Raspberry Pi camera. Internet Archive API: 26 items titled 'Clouds over the Tay', all 26 with licenseurl http://creativecommons.org/publicdomain/zero/1.0/. Useful as sky/cloud b-roll and timelapse source material.",
|
|
11039
|
+
"verified": {
|
|
11040
|
+
"date": "2026-11-25",
|
|
11041
|
+
"evidence": "Page: 'Usage CC0 1.0 Universal Topics clouds , tay , dundee , scotland , timelapse'"
|
|
11042
|
+
}
|
|
11043
|
+
},
|
|
11044
|
+
{
|
|
11045
|
+
"id": "nina-paley-cc0-films",
|
|
11046
|
+
"name": "Nina Paley CC0 feature films (Sita Sings the Blues, Seder-Masochism)",
|
|
11047
|
+
"url": "https://archive.org/details/Sita_Sings_the_Blues",
|
|
11048
|
+
"kinds": [
|
|
11049
|
+
"video"
|
|
11050
|
+
],
|
|
11051
|
+
"scope": "filter-only",
|
|
11052
|
+
"searchable": false,
|
|
11053
|
+
"licensePage": "https://archive.org/details/sedermasochism",
|
|
11054
|
+
"notes": "Two hand-animated feature films dedicated to CC0 by the animator, with full production masters on the Internet Archive: Sita Sings the Blues (item Sita_Sings_the_Blues, about 234 GB incl. 1080p masters, audio stems and stills) and Seder-Masochism (item sedermasochism, about 259 GB). Only these CC0 items qualify; many other Nina Paley uploads are CC BY-SA or CC BY. Music in both films (e.g. 1920s Annette Hanshaw recordings in Sita) belongs to third parties and is not covered by CC0.",
|
|
11055
|
+
"verified": {
|
|
11056
|
+
"date": "2026-11-25",
|
|
11057
|
+
"evidence": "Page: 'Nina Paley dedicated the film to the public domain under CC0 on January 24, 2019. The music in the film is still under copyright of its original owners and is not covered by the CC0 dedication.'"
|
|
11058
|
+
}
|
|
11059
|
+
},
|
|
11060
|
+
{
|
|
11061
|
+
"id": "ivory-billed-woodpecker-video-dryad",
|
|
11062
|
+
"name": "Video footage of the Ivory-billed Woodpecker (Dryad)",
|
|
11063
|
+
"url": "https://datadryad.org/dataset/doi:10.5061/dryad.8w9ghx3hp",
|
|
11064
|
+
"kinds": [
|
|
11065
|
+
"video",
|
|
11066
|
+
"collection"
|
|
11067
|
+
],
|
|
11068
|
+
"scope": "whole-library",
|
|
11069
|
+
"searchable": false,
|
|
11070
|
+
"licensePage": "https://datadryad.org/dataset/doi:10.5061/dryad.8w9ghx3hp",
|
|
11071
|
+
"notes": "Raw field video (about 9.7 GB, 23 files) of possible Ivory-billed Woodpeckers recorded in Louisiana (2006, 2008) and Florida (2007), as interlaced DV originals and de-interlaced MOV versions plus short event clips. Companion data for Scientific Reports doi:10.1038/s41598-020-71677-5.",
|
|
11072
|
+
"verified": {
|
|
11073
|
+
"date": "2026-11-25",
|
|
11074
|
+
"evidence": "Page: 'Creative Commons Zero v1.0 Universal'"
|
|
11075
|
+
}
|
|
11076
|
+
},
|
|
11077
|
+
{
|
|
11078
|
+
"id": "dronezaic-aerial-video-dryad",
|
|
11079
|
+
"name": "DroneZaic freely flown aerial video dataset (Dryad)",
|
|
11080
|
+
"url": "https://datadryad.org/dataset/doi:10.5061/dryad.r4xgxd2q7",
|
|
11081
|
+
"kinds": [
|
|
11082
|
+
"video",
|
|
11083
|
+
"collection"
|
|
11084
|
+
],
|
|
11085
|
+
"scope": "whole-library",
|
|
11086
|
+
"searchable": false,
|
|
11087
|
+
"licensePage": "https://datadryad.org/dataset/doi:10.5061/dryad.r4xgxd2q7",
|
|
11088
|
+
"notes": "About 70 GB: raw consumer-drone video of agricultural (maize) field trials (1_raw_videos.zip, about 38 GB) plus processed mosaics and models, from a pipeline for mosaicking freely flown UAV video.",
|
|
11089
|
+
"verified": {
|
|
11090
|
+
"date": "2026-11-25",
|
|
11091
|
+
"evidence": "Page: 'Creative Commons Zero v1.0 Universal'"
|
|
11092
|
+
}
|
|
11093
|
+
},
|
|
11094
|
+
{
|
|
11095
|
+
"id": "coronary-dominance-angiography",
|
|
11096
|
+
"name": "CoronaryDominance angiogram video dataset",
|
|
11097
|
+
"url": "https://huggingface.co/datasets/BearSubj13/CoronaryDominance",
|
|
11098
|
+
"kinds": [
|
|
11099
|
+
"video",
|
|
11100
|
+
"collection"
|
|
11101
|
+
],
|
|
11102
|
+
"scope": "whole-library",
|
|
11103
|
+
"searchable": false,
|
|
11104
|
+
"licensePage": "https://huggingface.co/datasets/BearSubj13/CoronaryDominance/raw/main/README.md",
|
|
11105
|
+
"notes": "1,574 invasive coronary angiography studies with multi-view X-ray videos from two angiography systems, tagged for dominance, quality, artifacts and occlusion; prepared by Kruzhilov et al. for Nature Scientific Data. Specialist medical research footage (10B-100B size category).",
|
|
11106
|
+
"verified": {
|
|
11107
|
+
"date": "2026-11-25",
|
|
11108
|
+
"evidence": "README.md: 'license: cc0-1.0'"
|
|
11109
|
+
}
|
|
10962
11110
|
}
|
|
10963
11111
|
],
|
|
10964
11112
|
"excluded": [
|
|
@@ -12176,6 +12324,171 @@
|
|
|
12176
12324
|
"name": "Pocket Battle VFX",
|
|
12177
12325
|
"reason": "All 6 commits carry 'Co-Authored-By: Claude' trailers; the sprite-generating code was AI-assisted.",
|
|
12178
12326
|
"url": "https://github.com/poke5121999-art/pocket-battle-vfx"
|
|
12327
|
+
},
|
|
12328
|
+
{
|
|
12329
|
+
"name": "FieraRyan panorama packs (Sci-Fi Lab, Spaceship Bridge)",
|
|
12330
|
+
"reason": "CC0 on itch.io but AI-generated with Blockade Labs Skybox AI (AI Disclosure: AI Assisted).",
|
|
12331
|
+
"url": "https://fieraryan.itch.io/sci-fi-lab-panorama-pack"
|
|
12332
|
+
},
|
|
12333
|
+
{
|
|
12334
|
+
"name": "Emberpine skyboxes",
|
|
12335
|
+
"reason": "Paid and AI-generated skyboxes per itch.io AI disclosure.",
|
|
12336
|
+
"url": "https://emberpine.itch.io/skyboxes-day-dusk-storm"
|
|
12337
|
+
},
|
|
12338
|
+
{
|
|
12339
|
+
"name": "Wa Skies (komonodo3d)",
|
|
12340
|
+
"reason": "AI-assisted, custom licence forbids redistribution; not CC0.",
|
|
12341
|
+
"url": "https://komonodo3d.itch.io/free-japanese-skies-2k-hdri"
|
|
12342
|
+
},
|
|
12343
|
+
{
|
|
12344
|
+
"name": "4K Sky HDRI Bundle (GerryVerse)",
|
|
12345
|
+
"reason": "Re-upload: page says the HDRIs were not created by the uploader and are sourced from other sites.",
|
|
12346
|
+
"url": "https://gerryverse.itch.io/4k-sky-hdri-bundle"
|
|
12347
|
+
},
|
|
12348
|
+
{
|
|
12349
|
+
"name": "HydeCo Godot Skies packs",
|
|
12350
|
+
"reason": "Paid repackaging of third-party CC0 HDRIs for Godot; no original content.",
|
|
12351
|
+
"url": "https://hydethebooty98.itch.io/godot-skies-bundle"
|
|
12352
|
+
},
|
|
12353
|
+
{
|
|
12354
|
+
"name": "Sky Textures (Bumbadida)",
|
|
12355
|
+
"reason": "Drone-photo skyboxes stated only as 'Public Domain'; CC0 is not named.",
|
|
12356
|
+
"url": "https://bumbadida.itch.io/skybox-textures-sdr"
|
|
12357
|
+
},
|
|
12358
|
+
{
|
|
12359
|
+
"name": "Open HDRI 1K (Hugging Face)",
|
|
12360
|
+
"reason": "Downsampled aggregate of Poly Haven, BlenderKit, ambientCG, CGEES and Open HDRI, all already listed.",
|
|
12361
|
+
"url": "https://huggingface.co/datasets/leodriesch/open-hdri-1k"
|
|
12362
|
+
},
|
|
12363
|
+
{
|
|
12364
|
+
"name": "RENI HDR (Hugging Face)",
|
|
12365
|
+
"reason": "Low-resolution research derivative of CC0 panoramas from other libraries; no original captures.",
|
|
12366
|
+
"url": "https://huggingface.co/datasets/jadgardner/reni-hdr"
|
|
12367
|
+
},
|
|
12368
|
+
{
|
|
12369
|
+
"name": "Krea 2 scene-linear HDR dataset",
|
|
12370
|
+
"reason": "Perspective crops re-projected from Poly Haven HDRIs; derivative of a listed source.",
|
|
12371
|
+
"url": "https://huggingface.co/datasets/LAXMAYDAY/krea2-scene-linear-hdr-dataset"
|
|
12372
|
+
},
|
|
12373
|
+
{
|
|
12374
|
+
"name": "RoboBenchMart PBR textures and HDRIs",
|
|
12375
|
+
"reason": "Convenience re-pack of ambientCG and Poly Haven assets, adds nothing new.",
|
|
12376
|
+
"url": "https://huggingface.co/datasets/emb-ai/RoboBenchMart_pbr_hdri"
|
|
12377
|
+
},
|
|
12378
|
+
{
|
|
12379
|
+
"name": "zuujis-cc0 HDRI mirrors (GitHub)",
|
|
12380
|
+
"reason": "Mirrors of Poly Haven and ambientCG HDRIs, both already listed.",
|
|
12381
|
+
"url": "https://github.com/zuujis-cc0"
|
|
12382
|
+
},
|
|
12383
|
+
{
|
|
12384
|
+
"name": "BevelLab Packs",
|
|
12385
|
+
"reason": "Only 3 HDRIs, all taken from Poly Haven.",
|
|
12386
|
+
"url": "https://github.com/h3x4d3x4/BevelLab-Packs"
|
|
12387
|
+
},
|
|
12388
|
+
{
|
|
12389
|
+
"name": "HDRI-Skies (free section)",
|
|
12390
|
+
"reason": "Free HDRIs under a custom licence forbidding resale and sharing; not CC0.",
|
|
12391
|
+
"url": "https://blenderartists.org/t/free-hdri-skies-a-lot-of/651203"
|
|
12392
|
+
},
|
|
12393
|
+
{
|
|
12394
|
+
"name": "SkyGAN HDR sky dataset",
|
|
12395
|
+
"reason": "Dataset licensed CC BY-NC-SA 4.0, not CC0.",
|
|
12396
|
+
"url": "https://github.com/CGGMFF/SkyGAN"
|
|
12397
|
+
},
|
|
12398
|
+
{
|
|
12399
|
+
"name": "iHDRI.com",
|
|
12400
|
+
"reason": "Domain now serves an unrelated gambling site; the author's HDRIs moved to CGEES, already listed.",
|
|
12401
|
+
"url": "https://www.ihdri.com/"
|
|
12402
|
+
},
|
|
12403
|
+
{
|
|
12404
|
+
"name": "RISD Museum image request / open access",
|
|
12405
|
+
"reason": "Page only says 'free access to digital images of public domain materials'; CC0 is not named",
|
|
12406
|
+
"url": "https://risdmuseum.org/node/13783"
|
|
12407
|
+
},
|
|
12408
|
+
{
|
|
12409
|
+
"name": "Davison Art Collection, Wesleyan University",
|
|
12410
|
+
"reason": "Open Access images are provided as having 'no known copyright restrictions', not CC0",
|
|
12411
|
+
"url": "https://www.wesleyan.edu/dac/open/openaccess.html"
|
|
12412
|
+
},
|
|
12413
|
+
{
|
|
12414
|
+
"name": "KMSKA (Royal Museum of Fine Arts Antwerp)",
|
|
12415
|
+
"reason": "CC0 waiver covers site texts only; artwork photos are described as public domain without CC0",
|
|
12416
|
+
"url": "https://kmska.be/en/disclaimer"
|
|
12417
|
+
},
|
|
12418
|
+
{
|
|
12419
|
+
"name": "Biblioteca Virtual de Defensa (Spain)",
|
|
12420
|
+
"reason": "Record pages now state 'La copia digital se distribuye bajo licencia CC BY 4.0'; not CC0",
|
|
12421
|
+
"url": "https://bibliotecavirtual.defensa.gob.es/BVMDefensa/"
|
|
12422
|
+
},
|
|
12423
|
+
{
|
|
12424
|
+
"name": "Norrbottens museum (Carlotta)",
|
|
12425
|
+
"reason": "Sampled images are CC BY 4.0 or CC BY-NC 4.0, not CC0",
|
|
12426
|
+
"url": "https://samlingar.norrbottensmuseum.se/web"
|
|
12427
|
+
},
|
|
12428
|
+
{
|
|
12429
|
+
"name": "Kulturen i Lund (Carlotta)",
|
|
12430
|
+
"reason": "Own object pages show CC BY-NC-ND 2.5 even where Europeana says CC0",
|
|
12431
|
+
"url": "https://carl.kulturen.com/web/"
|
|
12432
|
+
},
|
|
12433
|
+
{
|
|
12434
|
+
"name": "Sozialarchiv SAH image archive (Stadt Zürich open data)",
|
|
12435
|
+
"reason": "Dataset license is CC BY (Creative Commons Attribution), not CC0",
|
|
12436
|
+
"url": "https://data.stadt-zuerich.ch/dataset/sozialarchiv-sah"
|
|
12437
|
+
},
|
|
12438
|
+
{
|
|
12439
|
+
"name": "Williams College Museum of Art collection data",
|
|
12440
|
+
"reason": "CC0 repository contains metadata only; no CC0 images",
|
|
12441
|
+
"url": "https://github.com/wcmaart/collection"
|
|
12442
|
+
},
|
|
12443
|
+
{
|
|
12444
|
+
"name": "ACMI collection data",
|
|
12445
|
+
"reason": "CC0 covers collection metadata only (deprecated archive); no images",
|
|
12446
|
+
"url": "https://github.com/ACMILabs/collection"
|
|
12447
|
+
},
|
|
12448
|
+
{
|
|
12449
|
+
"name": "Peaceful Peach clips (Internet Archive)",
|
|
12450
|
+
"reason": "Tagged CC0 on upload but the sampled item (Morning Egg) says the clip is from pixabay.com; re-uploads of other people's footage.",
|
|
12451
|
+
"url": "https://archive.org/details/morning-egg"
|
|
12452
|
+
},
|
|
12453
|
+
{
|
|
12454
|
+
"name": "matthornb explosion and blood spray VFX clips",
|
|
12455
|
+
"reason": "Free for commercial use without credit, but the page never names CC0; custom permission only.",
|
|
12456
|
+
"url": "https://matthornb.itch.io/explosion"
|
|
12457
|
+
},
|
|
12458
|
+
{
|
|
12459
|
+
"name": "Everyday Life Stock Footage 18 clips (TS CALM)",
|
|
12460
|
+
"reason": "Clips were made with generative AI image-to-video tools per the page; also not CC0.",
|
|
12461
|
+
"url": "https://tscalmshop.itch.io/everyday-life-stock-footage-18-clips"
|
|
12462
|
+
},
|
|
12463
|
+
{
|
|
12464
|
+
"name": "Sun cycle loop videos (lilambdcrossing)",
|
|
12465
|
+
"reason": "itch.io AI disclosure marks the pack as AI Assisted; skipped under the no-AI rule.",
|
|
12466
|
+
"url": "https://lilambdcrossing.itch.io/sun-cycle-loop-videos"
|
|
12467
|
+
},
|
|
12468
|
+
{
|
|
12469
|
+
"name": "Flowing Light Backgrounds (lampe332)",
|
|
12470
|
+
"reason": "itch.io AI disclosure marks the graphics as AI Assisted; skipped under the no-AI rule.",
|
|
12471
|
+
"url": "https://lampe332.itch.io/flowing-light-backgrounds"
|
|
12472
|
+
},
|
|
12473
|
+
{
|
|
12474
|
+
"name": "w0rldw3aver360-walks (TheMindExpansionNetwork)",
|
|
12475
|
+
"reason": "Synthetic walkthrough clips generated with an image-to-video model; AI-generated footage.",
|
|
12476
|
+
"url": "https://huggingface.co/datasets/TheMindExpansionNetwork/w0rldw3aver360-walks"
|
|
12477
|
+
},
|
|
12478
|
+
{
|
|
12479
|
+
"name": "CLEVRER re-upload (ghomasHudson)",
|
|
12480
|
+
"reason": "Third-party re-upload tagged cc0-1.0, but the original CLEVRER site does not state a license; provenance unclear.",
|
|
12481
|
+
"url": "https://huggingface.co/datasets/ghomasHudson/clevrer"
|
|
12482
|
+
},
|
|
12483
|
+
{
|
|
12484
|
+
"name": "Internet Archive vj_loops collection",
|
|
12485
|
+
"reason": "Only 13 of 592 items carry the CC0 license url, nearly all from one uploader mixed with gameplay and re-uploads; too thin.",
|
|
12486
|
+
"url": "https://archive.org/details/vj_loops"
|
|
12487
|
+
},
|
|
12488
|
+
{
|
|
12489
|
+
"name": "hhoppe/data image and video test data",
|
|
12490
|
+
"reason": "CC0 but only a handful of short test clips (brink, palmtrees, cherries); below the collection quality bar.",
|
|
12491
|
+
"url": "https://github.com/hhoppe/data"
|
|
12179
12492
|
}
|
|
12180
12493
|
],
|
|
12181
12494
|
"pending": [
|
|
@@ -12463,6 +12776,111 @@
|
|
|
12463
12776
|
"name": "Musea Brugge collection",
|
|
12464
12777
|
"url": "https://collectie.museabrugge.be/en",
|
|
12465
12778
|
"reason": "Still HTTP 403 (nginx) on the collection site."
|
|
12779
|
+
},
|
|
12780
|
+
{
|
|
12781
|
+
"name": "CC0 Skybox Pack 2 (IndieDB)",
|
|
12782
|
+
"reason": "IndieDB returned HTTP 403 to curl; licence and provenance could not be checked.",
|
|
12783
|
+
"url": "https://www.indiedb.com/addons/cc0-skybox-pack-2"
|
|
12784
|
+
},
|
|
12785
|
+
{
|
|
12786
|
+
"name": "Eisklotz HDRIs",
|
|
12787
|
+
"reason": "Site is down (hosting placeholder page); no licence text available. Some Eisklotz HDRIs are in the Blender archive, mostly marked cc-0.",
|
|
12788
|
+
"url": "https://www.eisklotz.com/"
|
|
12789
|
+
},
|
|
12790
|
+
{
|
|
12791
|
+
"name": "Saint Louis Art Museum open access",
|
|
12792
|
+
"reason": "Cloudflare challenge (403 'Just a moment...'); CC0 wording could not be checked",
|
|
12793
|
+
"url": "https://www.slam.org/collection/open-access/"
|
|
12794
|
+
},
|
|
12795
|
+
{
|
|
12796
|
+
"name": "Yale University Art Gallery open access",
|
|
12797
|
+
"reason": "Cloudflare challenge (403); a third-party library guide says Yale images are CC0, not verified on the gallery's own page",
|
|
12798
|
+
"url": "https://artgallery.yale.edu/open-access"
|
|
12799
|
+
},
|
|
12800
|
+
{
|
|
12801
|
+
"name": "Clark Art Institute open access",
|
|
12802
|
+
"reason": "Cloudflare challenge (403); license wording not checked",
|
|
12803
|
+
"url": "https://www.clarkart.edu/collections/open-access"
|
|
12804
|
+
},
|
|
12805
|
+
{
|
|
12806
|
+
"name": "Princeton University Art Museum open access",
|
|
12807
|
+
"reason": "Cloudflare challenge (403); license wording not checked",
|
|
12808
|
+
"url": "https://artmuseum.princeton.edu/about/open-access"
|
|
12809
|
+
},
|
|
12810
|
+
{
|
|
12811
|
+
"name": "Badisches Landesmuseum Karlsruhe digital catalogue",
|
|
12812
|
+
"reason": "TLS handshake error from curl; Europeana lists ~21,600 CC0 images from this museum, own page not verified",
|
|
12813
|
+
"url": "https://katalog.landesmuseum.de/"
|
|
12814
|
+
},
|
|
12815
|
+
{
|
|
12816
|
+
"name": "Sörmlands museum collections",
|
|
12817
|
+
"reason": "Connection timed out; Europeana lists ~107,000 CC0 images, own page not verified (partly visible via Kringla)",
|
|
12818
|
+
"url": "https://sokisamlingar.sormlandsmuseum.se/"
|
|
12819
|
+
},
|
|
12820
|
+
{
|
|
12821
|
+
"name": "Blekinge museum image archive",
|
|
12822
|
+
"reason": "Connection timed out; Europeana and Kringla list a few thousand CC0 images",
|
|
12823
|
+
"url": "https://blm.kulturhotell.se/"
|
|
12824
|
+
},
|
|
12825
|
+
{
|
|
12826
|
+
"name": "Netherlands Institute for Military History image bank (NIMH)",
|
|
12827
|
+
"reason": "HTTP 403 on object pages; Europeana lists ~68,600 CC0 images",
|
|
12828
|
+
"url": "https://nimh-beeldbank.defensie.nl/"
|
|
12829
|
+
},
|
|
12830
|
+
{
|
|
12831
|
+
"name": "Regionaal Archief Nijmegen image collection",
|
|
12832
|
+
"reason": "HTTP 403 bot protection; Europeana lists ~11,600 CC0 images",
|
|
12833
|
+
"url": "https://studiezaal.nijmegen.nl/"
|
|
12834
|
+
},
|
|
12835
|
+
{
|
|
12836
|
+
"name": "Salzburg Museum Sammlung Online",
|
|
12837
|
+
"reason": "JS-only object pages; Europeana lists ~6,700 CC0 images, license text not visible without JS",
|
|
12838
|
+
"url": "https://sammlung-online.salzburgmuseum.at/"
|
|
12839
|
+
},
|
|
12840
|
+
{
|
|
12841
|
+
"name": "Göteborgs stadsmuseum collections (Carlotta)",
|
|
12842
|
+
"reason": "JS-only object pages; Europeana lists ~2,200 CC0 images, per-image license not visible in HTML",
|
|
12843
|
+
"url": "https://samlingar.goteborgsstadsmuseum.se/carlotta/web"
|
|
12844
|
+
},
|
|
12845
|
+
{
|
|
12846
|
+
"name": "Städtische Museen Freiburg Online-Sammlung",
|
|
12847
|
+
"reason": "Anubis bot-check page served to curl; reuse terms not readable",
|
|
12848
|
+
"url": "https://onlinesammlung.freiburg.de/en/weiterverwenden"
|
|
12849
|
+
},
|
|
12850
|
+
{
|
|
12851
|
+
"name": "KENOM numismatic portal (incl. Landesmuseum für Vorgeschichte Halle coins)",
|
|
12852
|
+
"reason": "Anubis bot-check page served to curl; Europeana lists ~19,000 CC0 coin images",
|
|
12853
|
+
"url": "https://www.kenom.de/"
|
|
12854
|
+
},
|
|
12855
|
+
{
|
|
12856
|
+
"name": "Amsterdam Museum collection (Adlib portal)",
|
|
12857
|
+
"reason": "Record pages show only a CC0 badge link; unclear if it covers images or just metadata, and the museum site has no current open-data page (404)",
|
|
12858
|
+
"url": "https://am.adlibhosting.com/ais6v2/"
|
|
12859
|
+
},
|
|
12860
|
+
{
|
|
12861
|
+
"name": "NÖ Museen digital catalogue (noemuseen.at)",
|
|
12862
|
+
"reason": "Object pages label 'CC0 1.0 Universell' but the link points to CC BY-NC-SA 4.0; conflicting license needs clarification",
|
|
12863
|
+
"url": "https://www.noemuseen.at/dipkatalognoemuseen/"
|
|
12864
|
+
},
|
|
12865
|
+
{
|
|
12866
|
+
"name": "Athens City Museum (Vouros-Eutaxias) portal",
|
|
12867
|
+
"reason": "JS-only Angular app; Europeana lists ~2,400 CC0 images, own license text not visible",
|
|
12868
|
+
"url": "https://portal.athenscitymuseum.gr/"
|
|
12869
|
+
},
|
|
12870
|
+
{
|
|
12871
|
+
"name": "Manos & Anastasia Faltaits Museum repository",
|
|
12872
|
+
"reason": "HTTP 403 bot protection; Europeana lists ~2,900 CC0 images",
|
|
12873
|
+
"url": "https://faltaits.gr/"
|
|
12874
|
+
},
|
|
12875
|
+
{
|
|
12876
|
+
"name": "Open Beelden (Sound and Vision open media)",
|
|
12877
|
+
"reason": "Media search page did not finish loading (timed out after two minutes); site states CC0 only for metadata, item licenses mostly CC BY-SA, CC0 video items not confirmed.",
|
|
12878
|
+
"url": "https://www.openbeelden.nl/media/"
|
|
12879
|
+
},
|
|
12880
|
+
{
|
|
12881
|
+
"name": "Sita Sings the Blues official site",
|
|
12882
|
+
"reason": "Returned 502 Bad Gateway; license was verified instead on the Internet Archive item pages.",
|
|
12883
|
+
"url": "https://www.sitasingstheblues.com/"
|
|
12466
12884
|
}
|
|
12467
12885
|
]
|
|
12468
12886
|
}
|
package/dist/download.js
ADDED
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
import { createWriteStream } from "node:fs";
|
|
3
|
+
import { mkdir, readFile, rm, writeFile } from "node:fs/promises";
|
|
4
|
+
import path from "node:path";
|
|
5
|
+
import { Readable, Transform } from "node:stream";
|
|
6
|
+
import { pipeline } from "node:stream/promises";
|
|
7
|
+
/** Largest single file saved; Poly Haven 16K HDRIs are about 700 MB. */
|
|
8
|
+
export const MAX_FILE_BYTES = 1024 ** 3;
|
|
9
|
+
/** Most files one call may pick; a glTF's companions do not count. */
|
|
10
|
+
export const MAX_FILES_PER_CALL = 10;
|
|
11
|
+
export const RECEIPT_NAME = "cc0.json";
|
|
12
|
+
/** Thrown when the request cannot be served as asked; the message says what to change. */
|
|
13
|
+
export class DownloadRequestError extends Error {
|
|
14
|
+
}
|
|
15
|
+
/** Folder and file names: keep letters, digits, dot, dash and underscore. */
|
|
16
|
+
export function safeName(s) {
|
|
17
|
+
const name = s.replace(/[^A-Za-z0-9._-]+/g, "_").replace(/^[._]+/, "").slice(0, 120);
|
|
18
|
+
return name || "file";
|
|
19
|
+
}
|
|
20
|
+
/** A companion path from the source (e.g. "textures/door_diff_1k.jpg"), or null if it would leave the folder. */
|
|
21
|
+
export function safeRelativePath(p) {
|
|
22
|
+
if (!p || p.startsWith("/") || p.includes("\\") || /^[A-Za-z]:/.test(p))
|
|
23
|
+
return null;
|
|
24
|
+
const parts = p.split("/");
|
|
25
|
+
if (parts.some((x) => x === "" || x === "." || x === ".."))
|
|
26
|
+
return null;
|
|
27
|
+
return parts.map(safeName).join("/");
|
|
28
|
+
}
|
|
29
|
+
function fileNameFor(file) {
|
|
30
|
+
try {
|
|
31
|
+
const base = decodeURIComponent(new URL(file.url).pathname.split("/").pop() ?? "");
|
|
32
|
+
// ambientCG serves zips from /get?file=<name>.zip
|
|
33
|
+
const fromQuery = new URL(file.url).searchParams.get("file");
|
|
34
|
+
const name = /\.[A-Za-z0-9]{1,6}$/.test(base) ? base : fromQuery ?? "";
|
|
35
|
+
if (name)
|
|
36
|
+
return safeName(name);
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
// fall through to the label
|
|
40
|
+
}
|
|
41
|
+
return safeName(file.label);
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Picks files by exact label. With no labels, an asset with exactly one file
|
|
45
|
+
* gets that file; otherwise the caller must choose, because sources like Poly
|
|
46
|
+
* Haven list dozens of resolutions and formats.
|
|
47
|
+
*/
|
|
48
|
+
export function pickFiles(asset, labels) {
|
|
49
|
+
const list = (asset.files ?? []).map((f) => f.label);
|
|
50
|
+
const show = () => `Available files: ${list.slice(0, 40).map((l) => JSON.stringify(l)).join(", ")}${list.length > 40 ? `, … (${list.length} total)` : ""}`;
|
|
51
|
+
if (!asset.files?.length)
|
|
52
|
+
throw new DownloadRequestError(`${asset.id} lists no downloadable files. Use its landingUrl: ${asset.landingUrl}`);
|
|
53
|
+
if (!labels?.length) {
|
|
54
|
+
if (asset.files.length === 1)
|
|
55
|
+
return asset.files;
|
|
56
|
+
throw new DownloadRequestError(`${asset.id} has ${asset.files.length} files; pass \`files\` with one or more exact labels. ${show()}`);
|
|
57
|
+
}
|
|
58
|
+
if (labels.length > MAX_FILES_PER_CALL)
|
|
59
|
+
throw new DownloadRequestError(`Pick at most ${MAX_FILES_PER_CALL} files per call.`);
|
|
60
|
+
const unknown = labels.filter((l) => !list.includes(l));
|
|
61
|
+
if (unknown.length)
|
|
62
|
+
throw new DownloadRequestError(`Unknown file label(s): ${unknown.map((l) => JSON.stringify(l)).join(", ")}. ${show()}`);
|
|
63
|
+
return asset.files.filter((f) => labels.includes(f.label));
|
|
64
|
+
}
|
|
65
|
+
async function saveOne(download, url, target) {
|
|
66
|
+
let res;
|
|
67
|
+
try {
|
|
68
|
+
res = await download(url);
|
|
69
|
+
}
|
|
70
|
+
catch (e) {
|
|
71
|
+
return `request failed: ${e instanceof Error ? e.message : String(e)}`;
|
|
72
|
+
}
|
|
73
|
+
if (!res.ok)
|
|
74
|
+
return `HTTP ${res.status}`;
|
|
75
|
+
const type = res.headers.get("content-type") ?? "";
|
|
76
|
+
if (/^text\/html/i.test(type)) {
|
|
77
|
+
await res.body?.cancel();
|
|
78
|
+
return "the URL is a web page, not a file (the source needs a login or a browser download); open it from landingUrl";
|
|
79
|
+
}
|
|
80
|
+
const declared = Number(res.headers.get("content-length"));
|
|
81
|
+
if (declared > MAX_FILE_BYTES) {
|
|
82
|
+
await res.body?.cancel();
|
|
83
|
+
return `file is ${declared} bytes, over the ${MAX_FILE_BYTES}-byte limit`;
|
|
84
|
+
}
|
|
85
|
+
if (!res.body)
|
|
86
|
+
return "empty response";
|
|
87
|
+
const hash = createHash("sha256");
|
|
88
|
+
let bytes = 0;
|
|
89
|
+
const meter = new Transform({
|
|
90
|
+
transform(chunk, _enc, cb) {
|
|
91
|
+
bytes += chunk.length;
|
|
92
|
+
if (bytes > MAX_FILE_BYTES)
|
|
93
|
+
return cb(new Error(`over the ${MAX_FILE_BYTES}-byte limit`));
|
|
94
|
+
hash.update(chunk);
|
|
95
|
+
cb(null, chunk);
|
|
96
|
+
},
|
|
97
|
+
});
|
|
98
|
+
await mkdir(path.dirname(target), { recursive: true });
|
|
99
|
+
try {
|
|
100
|
+
await pipeline(Readable.fromWeb(res.body), meter, createWriteStream(target));
|
|
101
|
+
}
|
|
102
|
+
catch (e) {
|
|
103
|
+
await rm(target, { force: true });
|
|
104
|
+
return `download failed: ${e instanceof Error ? e.message : String(e)}`;
|
|
105
|
+
}
|
|
106
|
+
return { bytes, sha256: hash.digest("hex") };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Saves the chosen files of an already CC0-checked asset into `<dir>/<asset id>/`,
|
|
110
|
+
* with each file's companions (`includes`) at their relative paths, and writes a
|
|
111
|
+
* `cc0.json` receipt recording where each file came from and the license evidence
|
|
112
|
+
* at download time. Files that cannot be fetched are listed in `skipped`.
|
|
113
|
+
*/
|
|
114
|
+
export async function downloadAsset(download, asset, dir, labels, now = () => new Date()) {
|
|
115
|
+
const chosen = pickFiles(asset, labels);
|
|
116
|
+
const folder = path.resolve(dir, safeName(asset.id.replace(/:/g, "_")));
|
|
117
|
+
await mkdir(folder, { recursive: true });
|
|
118
|
+
const saved = [];
|
|
119
|
+
const skipped = [];
|
|
120
|
+
const used = new Set();
|
|
121
|
+
const unique = (rel) => {
|
|
122
|
+
let out = rel;
|
|
123
|
+
for (let n = 2; used.has(out); n++)
|
|
124
|
+
out = rel.replace(/(\.[^./]+)?$/, `-${n}$1`);
|
|
125
|
+
used.add(out);
|
|
126
|
+
return out;
|
|
127
|
+
};
|
|
128
|
+
for (const file of chosen) {
|
|
129
|
+
const rel = unique(fileNameFor(file));
|
|
130
|
+
const r = await saveOne(download, file.url, path.join(folder, rel));
|
|
131
|
+
if (typeof r === "string") {
|
|
132
|
+
skipped.push({ label: file.label, url: file.url, reason: r });
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
saved.push({ label: file.label, path: rel, url: file.url, ...r });
|
|
136
|
+
for (const inc of file.includes ?? []) {
|
|
137
|
+
const incRel = safeRelativePath(inc.path);
|
|
138
|
+
const label = `${file.label} + ${inc.path}`;
|
|
139
|
+
if (!incRel) {
|
|
140
|
+
skipped.push({ label, url: inc.url, reason: "companion path would leave the asset folder" });
|
|
141
|
+
continue;
|
|
142
|
+
}
|
|
143
|
+
// Companions are shared between variants of one model (e.g. the .bin); save each path once.
|
|
144
|
+
if (used.has(incRel))
|
|
145
|
+
continue;
|
|
146
|
+
used.add(incRel);
|
|
147
|
+
const ri = await saveOne(download, inc.url, path.join(folder, incRel));
|
|
148
|
+
if (typeof ri === "string")
|
|
149
|
+
skipped.push({ label, url: inc.url, reason: ri });
|
|
150
|
+
else
|
|
151
|
+
saved.push({ label, path: incRel, url: inc.url, ...ri });
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const receipt = path.join(folder, RECEIPT_NAME);
|
|
155
|
+
// A second call for the same asset adds to the receipt instead of replacing it.
|
|
156
|
+
const earlier = await readFile(receipt, "utf8").then((t) => JSON.parse(t), () => null);
|
|
157
|
+
const merged = new Map();
|
|
158
|
+
if (earlier?.id === asset.id)
|
|
159
|
+
for (const f of earlier.files ?? [])
|
|
160
|
+
merged.set(f.path, f);
|
|
161
|
+
for (const f of saved)
|
|
162
|
+
merged.set(f.path, f);
|
|
163
|
+
await writeFile(receipt, JSON.stringify({
|
|
164
|
+
id: asset.id,
|
|
165
|
+
title: asset.title,
|
|
166
|
+
creator: asset.creator,
|
|
167
|
+
landingUrl: asset.landingUrl,
|
|
168
|
+
provider: asset.provider,
|
|
169
|
+
origin: asset.origin,
|
|
170
|
+
license: asset.licenseEvidence,
|
|
171
|
+
...(asset.riskFlags && { riskFlags: asset.riskFlags }),
|
|
172
|
+
servedBy: asset.servedBy,
|
|
173
|
+
checkedAt: now().toISOString(),
|
|
174
|
+
files: [...merged.values()],
|
|
175
|
+
...(skipped.length && { skipped }),
|
|
176
|
+
}, null, 2) + "\n");
|
|
177
|
+
return { folder, saved, skipped, receipt };
|
|
178
|
+
}
|
package/dist/http.js
CHANGED
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
* Poly Haven's API terms require a User-Agent that names the calling app.
|
|
3
3
|
* Openverse also asks clients to identify themselves.
|
|
4
4
|
*/
|
|
5
|
-
export const USER_AGENT = "cc0-library-mcp/0.2.
|
|
5
|
+
export const USER_AGENT = "cc0-library-mcp/0.2.13 (+https://github.com/sanghyoLe/cc0-library)";
|
|
6
6
|
const TIMEOUT_MS = 15_000;
|
|
7
|
+
/** File downloads can be hundreds of MB, so they get far longer than API calls. */
|
|
8
|
+
const DOWNLOAD_TIMEOUT_MS = 10 * 60_000;
|
|
7
9
|
export class UpstreamError extends Error {
|
|
8
10
|
provider;
|
|
9
11
|
status;
|
|
@@ -17,6 +19,7 @@ export const defaultFetch = (url, init) => fetch(url, {
|
|
|
17
19
|
headers: { "User-Agent": USER_AGENT, Accept: "application/json", ...init?.headers },
|
|
18
20
|
signal: AbortSignal.timeout(TIMEOUT_MS),
|
|
19
21
|
});
|
|
22
|
+
export const defaultDownload = (url) => fetch(url, { headers: { "User-Agent": USER_AGENT }, signal: AbortSignal.timeout(DOWNLOAD_TIMEOUT_MS) });
|
|
20
23
|
/** Gateway errors that upstreams (notably Openverse) return transiently under load. */
|
|
21
24
|
const RETRYABLE = new Set([502, 503, 504]);
|
|
22
25
|
const RETRY_DELAY_MS = 500;
|
package/dist/providers/met.js
CHANGED
|
@@ -40,6 +40,44 @@ export function toAsset(o) {
|
|
|
40
40
|
servedBy: SERVED_BY,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
|
+
/**
|
|
44
|
+
* The Met's API sits behind bot protection that stalls or rejects (without CORS
|
|
45
|
+
* headers) a burst of parallel object requests, so they go a few at a time.
|
|
46
|
+
* The detail phase also has a deadline: The Met can take 10-30 s per object,
|
|
47
|
+
* and objects still pending then are left out rather than holding the search open.
|
|
48
|
+
*/
|
|
49
|
+
const MET_CONCURRENCY = 4;
|
|
50
|
+
const MET_DETAIL_DEADLINE_MS = 12_000;
|
|
51
|
+
/**
|
|
52
|
+
* Like Promise.allSettled over items.map(fn), with at most `limit` calls in flight; keeps input order.
|
|
53
|
+
* Items not settled within `deadlineMs` are reported as rejected and no new calls start after it.
|
|
54
|
+
*/
|
|
55
|
+
export async function settleWithLimit(items, limit, fn, deadlineMs = Infinity) {
|
|
56
|
+
const out = new Array(items.length);
|
|
57
|
+
let next = 0;
|
|
58
|
+
let expired = false;
|
|
59
|
+
const worker = async () => {
|
|
60
|
+
while (!expired && next < items.length) {
|
|
61
|
+
const i = next++;
|
|
62
|
+
try {
|
|
63
|
+
out[i] = { status: "fulfilled", value: await fn(items[i]) };
|
|
64
|
+
}
|
|
65
|
+
catch (reason) {
|
|
66
|
+
out[i] = { status: "rejected", reason };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
};
|
|
70
|
+
const all = Promise.all(Array.from({ length: Math.min(limit, items.length) }, worker));
|
|
71
|
+
let timer;
|
|
72
|
+
if (Number.isFinite(deadlineMs)) {
|
|
73
|
+
await Promise.race([all, new Promise((r) => (timer = setTimeout(() => ((expired = true), r()), deadlineMs)))]);
|
|
74
|
+
clearTimeout(timer);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
await all;
|
|
78
|
+
}
|
|
79
|
+
return Array.from(out, (r) => r ?? { status: "rejected", reason: new Error("deadline passed") });
|
|
80
|
+
}
|
|
43
81
|
const fetchObject = (fetchImpl, id) => getJson(fetchImpl, "The Met", `${OBJECT}/${id}`);
|
|
44
82
|
export async function searchMet(fetchImpl, params) {
|
|
45
83
|
const qs = new URLSearchParams({
|
|
@@ -50,7 +88,7 @@ export async function searchMet(fetchImpl, params) {
|
|
|
50
88
|
});
|
|
51
89
|
const search = await getJson(fetchImpl, "The Met", `${SEARCH}?${qs}`);
|
|
52
90
|
const ids = (search.objectIDs ?? []).slice(0, params.limit);
|
|
53
|
-
const objects = await
|
|
91
|
+
const objects = await settleWithLimit(ids, MET_CONCURRENCY, (id) => fetchObject(fetchImpl, id), MET_DETAIL_DEADLINE_MS);
|
|
54
92
|
const assets = objects.flatMap((r) => (r.status === "fulfilled" && isCc0(r.value) ? [toAsset(r.value)] : []));
|
|
55
93
|
return { total: search.total, assets };
|
|
56
94
|
}
|
|
@@ -57,11 +57,26 @@ export async function getOpenverse(fetchImpl, media, id) {
|
|
|
57
57
|
if (!isCc0(item))
|
|
58
58
|
return null;
|
|
59
59
|
const asset = toAsset(media, item);
|
|
60
|
-
return {
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
60
|
+
return { ...asset, description: null, files: openverseFiles(item) };
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* Freesound items in Openverse point `url` at a lossy preview (cdn.freesound.org/previews/...).
|
|
64
|
+
* The uploaded original is only listed in `alt_files`, behind an OAuth API endpoint, so it is
|
|
65
|
+
* offered as the Freesound page, where a logged-in user can download it.
|
|
66
|
+
*/
|
|
67
|
+
function openverseFiles(item) {
|
|
68
|
+
if (!item.url)
|
|
69
|
+
return [];
|
|
70
|
+
const isFreesoundPreview = /^https:\/\/cdn\.freesound\.org\/previews\//.test(item.url);
|
|
71
|
+
if (!isFreesoundPreview) {
|
|
72
|
+
return [{ label: item.filetype ? `original (${item.filetype})` : "original", url: item.url, sizeBytes: item.filesize ?? null }];
|
|
73
|
+
}
|
|
74
|
+
const ext = item.url.split(".").pop();
|
|
75
|
+
const preview = { label: `preview (${ext}, lossy)`, url: item.url, sizeBytes: null };
|
|
76
|
+
const originals = (item.alt_files ?? []).map((f) => ({
|
|
77
|
+
label: `original (${f.filetype ?? "file"}) — download on Freesound (login required)`,
|
|
78
|
+
url: item.foreign_landing_url,
|
|
79
|
+
sizeBytes: f.filesize ?? null,
|
|
80
|
+
}));
|
|
81
|
+
return [preview, ...originals];
|
|
67
82
|
}
|
|
@@ -63,13 +63,24 @@ export async function searchPolyhaven(fetchImpl, kind, params) {
|
|
|
63
63
|
.map((r) => toAsset(r.slug, index[r.slug]));
|
|
64
64
|
return { total: search.total, assets };
|
|
65
65
|
}
|
|
66
|
-
/**
|
|
66
|
+
/**
|
|
67
|
+
* Flattens the nested /files response into one row per downloadable file.
|
|
68
|
+
* A model file's `include` map (the glTF .bin, textures) stays on its row as
|
|
69
|
+
* `includes`: without them the main file does not open, and as separate rows
|
|
70
|
+
* they would push other formats past the reply's file cap.
|
|
71
|
+
*/
|
|
67
72
|
export function flattenFiles(node, path = []) {
|
|
68
73
|
if (!node || typeof node !== "object")
|
|
69
74
|
return [];
|
|
70
75
|
const rec = node;
|
|
71
76
|
if (typeof rec.url === "string") {
|
|
72
|
-
|
|
77
|
+
const row = { label: path.join(" / "), url: rec.url, sizeBytes: typeof rec.size === "number" ? rec.size : null };
|
|
78
|
+
const include = rec.include && typeof rec.include === "object" ? Object.entries(rec.include) : [];
|
|
79
|
+
const includes = include.flatMap(([p, v]) => {
|
|
80
|
+
const f = v;
|
|
81
|
+
return f && typeof f.url === "string" ? [{ path: p, url: f.url, sizeBytes: typeof f.size === "number" ? f.size : null }] : [];
|
|
82
|
+
});
|
|
83
|
+
return [includes.length ? { ...row, includes } : row];
|
|
73
84
|
}
|
|
74
85
|
return Object.entries(rec).flatMap(([k, v]) => (k === "include" ? [] : flattenFiles(v, [...path, k])));
|
|
75
86
|
}
|
package/dist/risk.js
ADDED
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Warnings for items whose CC0 label was set by an uploader. A CC0 tag does not
|
|
3
|
+
* clear third-party rights: an uploader can tag a fan model of a game weapon or a
|
|
4
|
+
* cartoon character as CC0, yet the franchise owner still holds copyright and
|
|
5
|
+
* trademark in the design. These checks look only at the item's own title and
|
|
6
|
+
* tags, so they catch obvious cases and miss the rest; no flag does not mean safe.
|
|
7
|
+
*
|
|
8
|
+
* Studio (`library`) and museum (`institution`) declarations are not checked:
|
|
9
|
+
* the declarer made or holds the work.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Names of well-known commercial franchises, characters and brands, lowercased.
|
|
13
|
+
* Names that are also ordinary words or terms (halo, blizzard, fallout, marvel,
|
|
14
|
+
* joker, tesla, nike, half-life, ironman, minions) are left out: they flag too
|
|
15
|
+
* many unrelated photos.
|
|
16
|
+
* A name matches as whole words (multi-word names as a phrase); a trailing "*"
|
|
17
|
+
* also matches longer words, for names commonly misspelled or inflected
|
|
18
|
+
* ("frostmourn*" catches "Frostmourn" and "Frostmourne"). Multi-word names also
|
|
19
|
+
* match written as one word, as tags often are ("starwars", "darthvader").
|
|
20
|
+
*/
|
|
21
|
+
const FRANCHISE_TERMS = [
|
|
22
|
+
// games and game characters
|
|
23
|
+
"pokemon", "pokémon", "pikachu", "nintendo", "mario", "luigi", "zelda", "hyrule", "kirby", "metroid", "donkey kong",
|
|
24
|
+
"sonic the hedgehog", "sega", "minecraft", "fortnite", "roblox", "among us", "overwatch", "warcraft",
|
|
25
|
+
"world of warcraft", "frostmourn*", "starcraft", "master chief", "call of duty",
|
|
26
|
+
"grand theft auto", "final fantasy", "kingdom hearts", "elden ring", "dark souls", "skyrim", "the witcher",
|
|
27
|
+
"cyberpunk 2077", "assassin's creed", "resident evil", "genshin", "league of legends", "valorant", "dota",
|
|
28
|
+
"counter-strike", "portal gun", "tetris", "pac-man", "street fighter", "mortal kombat",
|
|
29
|
+
"playstation", "xbox", "animal crossing", "splatoon", "undertale",
|
|
30
|
+
// film, TV, comics, toys
|
|
31
|
+
"star wars", "darth vader", "lightsaber", "stormtrooper", "clone trooper", "yoda", "jedi", "sith", "boba fett", "mandalor*",
|
|
32
|
+
"x-wing", "tie fighter", "death star", "millennium falcon", "star trek", "avengers",
|
|
33
|
+
"spider-man", "batman", "superman", "dc comics", "harry potter", "hogwarts",
|
|
34
|
+
"lord of the rings", "gandalf", "hobbit", "game of thrones", "disney", "mickey mouse", "frozen elsa", "pixar",
|
|
35
|
+
"toy story", "shrek", "simpsons", "spongebob", "transformers", "optimus prime", "lego", "barbie",
|
|
36
|
+
"hello kitty", "studio ghibli", "totoro", "naruto", "dragon ball", "goku", "one piece", "sailor moon",
|
|
37
|
+
"evangelion", "gundam", "doctor who", "tardis", "jurassic park", "godzilla", "ghostbusters", "james bond",
|
|
38
|
+
"pirates of the caribbean", "indiana jones", "teenage mutant ninja turtles",
|
|
39
|
+
// brands and logos
|
|
40
|
+
"coca-cola", "pepsi", "mcdonald's", "adidas", "apple logo", "ferrari", "lamborghini",
|
|
41
|
+
"porsche", "bmw", "mercedes-benz", "rolex", "louis vuitton", "gucci", "red bull",
|
|
42
|
+
];
|
|
43
|
+
/** Words in a title or tags that say the item copies someone else's work. */
|
|
44
|
+
const DERIVATIVE_TERMS = ["fan art", "fan made", "ripped", "sprite rip", "replica", "inspired by"];
|
|
45
|
+
/** Lowercase words separated by single spaces; hyphens count as spaces ("fan-art" = "fan art"). */
|
|
46
|
+
function normalize(text) {
|
|
47
|
+
return ` ${text.toLowerCase().replace(/[^\p{L}\p{N}'*]+/gu, " ").trim()} `;
|
|
48
|
+
}
|
|
49
|
+
function matches(haystack, term) {
|
|
50
|
+
if (term.endsWith("*"))
|
|
51
|
+
return new RegExp(`(^|\\s)${escape(term.slice(0, -1))}`, "u").test(haystack);
|
|
52
|
+
const t = normalize(term).trim();
|
|
53
|
+
if (haystack.includes(` ${t} `))
|
|
54
|
+
return true;
|
|
55
|
+
const joined = t.replace(/ /g, "");
|
|
56
|
+
return joined !== t && haystack.includes(` ${joined} `);
|
|
57
|
+
}
|
|
58
|
+
const escape = (s) => s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
59
|
+
/** Flags for one asset; empty when nothing matched or the declarer is not an uploader. */
|
|
60
|
+
export function riskFlags(asset) {
|
|
61
|
+
if (asset.licenseEvidence.declaredBy !== "uploader")
|
|
62
|
+
return [];
|
|
63
|
+
const text = normalize([asset.title, ...asset.tags].join(" "));
|
|
64
|
+
const flags = [];
|
|
65
|
+
const franchise = FRANCHISE_TERMS.filter((t) => matches(text, t));
|
|
66
|
+
if (franchise.length)
|
|
67
|
+
flags.push(`franchise-name: ${franchise.map((t) => t.replace(/\*$/, "")).join(", ")}`);
|
|
68
|
+
const derivative = DERIVATIVE_TERMS.filter((t) => matches(text, t));
|
|
69
|
+
if (derivative.length)
|
|
70
|
+
flags.push(`derivative-wording: ${derivative.join(", ")}`);
|
|
71
|
+
return flags;
|
|
72
|
+
}
|
|
73
|
+
/** Returns the asset with `riskFlags` set when any check matched, otherwise unchanged. */
|
|
74
|
+
export function withRiskFlags(asset) {
|
|
75
|
+
const flags = riskFlags(asset);
|
|
76
|
+
return flags.length ? { ...asset, riskFlags: flags } : asset;
|
|
77
|
+
}
|
package/dist/search.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* Provider fan-out and id routing. Has no Node-only imports, so the same code
|
|
3
3
|
* runs in the MCP server and in the browser gallery (web/).
|
|
4
4
|
*/
|
|
5
|
+
import { withRiskFlags } from "./risk.js";
|
|
5
6
|
import { getOpenverse, searchOpenverse } from "./providers/openverse.js";
|
|
6
7
|
import { getPolyhaven, searchPolyhaven } from "./providers/polyhaven.js";
|
|
7
8
|
import { getAmbientcg, searchAmbientcg } from "./providers/ambientcg.js";
|
|
@@ -76,20 +77,42 @@ export async function search(fetchImpl, query, kind, limit, page, options = {})
|
|
|
76
77
|
const id = j.name.split(":")[0];
|
|
77
78
|
return !skip.has(id) && (!only || only.has(id));
|
|
78
79
|
});
|
|
79
|
-
|
|
80
|
+
// Slots keep provider order, so the interleave is the same however the calls finish.
|
|
80
81
|
const totals = {};
|
|
81
|
-
const
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
82
|
+
const errorSlots = new Array(run.length);
|
|
83
|
+
const listSlots = new Array(run.length);
|
|
84
|
+
const done = new Array(run.length).fill(false);
|
|
85
|
+
const snapshot = () => {
|
|
86
|
+
const lists = listSlots.filter((l) => !!l);
|
|
87
|
+
const errors = errorSlots.filter((e) => !!e);
|
|
88
|
+
const waiting = run.filter((_, i) => !done[i]).map((j) => j.name);
|
|
89
|
+
const assets = rank(query, interleave(lists)).slice(0, limit).map(withRiskFlags);
|
|
90
|
+
return { query, kind, page, assets, totals: { ...totals }, errors, pending: waiting };
|
|
91
|
+
};
|
|
92
|
+
let pending = run.length;
|
|
93
|
+
const settled = Promise.all(run.map(async (j, i) => {
|
|
94
|
+
try {
|
|
95
|
+
const r = await j.run();
|
|
96
|
+
totals[j.name] = r.total;
|
|
97
|
+
listSlots[i] = r.assets;
|
|
87
98
|
}
|
|
88
|
-
|
|
89
|
-
|
|
99
|
+
catch (e) {
|
|
100
|
+
errorSlots[i] = `${j.name}: ${e instanceof Error ? e.message : String(e)}`;
|
|
90
101
|
}
|
|
91
|
-
|
|
92
|
-
|
|
102
|
+
done[i] = true;
|
|
103
|
+
pending--;
|
|
104
|
+
if (pending > 0)
|
|
105
|
+
options.onProgress?.(snapshot(), pending);
|
|
106
|
+
}));
|
|
107
|
+
if (options.deadlineMs === undefined) {
|
|
108
|
+
await settled;
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
let timer;
|
|
112
|
+
await Promise.race([settled, new Promise((r) => (timer = setTimeout(r, options.deadlineMs)))]);
|
|
113
|
+
clearTimeout(timer);
|
|
114
|
+
}
|
|
115
|
+
return snapshot();
|
|
93
116
|
}
|
|
94
117
|
/** Words of two or more letters or digits, lowercased; works for any script. */
|
|
95
118
|
function words(text) {
|
|
@@ -146,6 +169,10 @@ export function interleave(lists) {
|
|
|
146
169
|
* `github:<owner>/<repo>`, `huggingface:<owner>/<dataset>`, `blenderkit:<uuid>`.
|
|
147
170
|
*/
|
|
148
171
|
export async function getAsset(fetchImpl, id) {
|
|
172
|
+
const asset = await getAssetUnflagged(fetchImpl, id);
|
|
173
|
+
return asset && withRiskFlags(asset);
|
|
174
|
+
}
|
|
175
|
+
async function getAssetUnflagged(fetchImpl, id) {
|
|
149
176
|
const parts = id.split(":");
|
|
150
177
|
const [provider, a, b] = parts;
|
|
151
178
|
if (parts.length === 3 && provider === "openverse" && (a === "image" || a === "audio") && b)
|
package/dist/server.js
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import {
|
|
3
|
+
import { DownloadRequestError, MAX_FILES_PER_CALL, RECEIPT_NAME, downloadAsset } from "./download.js";
|
|
4
|
+
import { defaultDownload, defaultFetch } from "./http.js";
|
|
4
5
|
import { getAsset, loadCatalog, search } from "./library.js";
|
|
5
6
|
import { ASSET_KINDS, CATALOG_KINDS, PROVIDER_IDS } from "./types.js";
|
|
7
|
+
/** One slow source (The Met can take 30 s) must not hold every reply; it is reported in `pending`. */
|
|
8
|
+
const SEARCH_DEADLINE_MS = 10_000;
|
|
6
9
|
/** Poly Haven textures can list 100+ map/resolution/format files; keep replies readable. */
|
|
7
10
|
const MAX_FILES_IN_REPLY = 60;
|
|
8
11
|
const KIND_HELP = "Asset type. image: Openverse, Wikimedia Commons, Internet Archive, WordPress Photo Directory, iNaturalist and GBIF " +
|
|
@@ -40,11 +43,21 @@ const assetShape = {
|
|
|
40
43
|
origin: z.string().describe("Site the item originally came from (e.g. flickr, freesound, metmuseum.org)"),
|
|
41
44
|
licenseEvidence: licenseEvidenceSchema,
|
|
42
45
|
servedBy: z.string().describe("Credit line required by the serving API's terms; show it next to results"),
|
|
46
|
+
riskFlags: z
|
|
47
|
+
.array(z.string())
|
|
48
|
+
.optional()
|
|
49
|
+
.describe("Present only on uploader-declared items whose title or tags name a known franchise, character or brand, or say the work is fan-made or copied " +
|
|
50
|
+
"(e.g. 'franchise-name: star wars'). CC0 from an uploader does not clear the franchise owner's rights: tell the user before suggesting it. " +
|
|
51
|
+
"Absence does not mean the item is safe"),
|
|
43
52
|
};
|
|
44
53
|
const fileSchema = z.object({
|
|
45
54
|
label: z.string().describe("Variant, e.g. '2K-JPG (zip)', 'hdri / 4k / exr', 'primary'"),
|
|
46
55
|
url: z.string().describe("Direct download URL (Sketchfab: model page, login required)"),
|
|
47
56
|
sizeBytes: z.number().nullable().describe("File size in bytes when the source reports it"),
|
|
57
|
+
includes: z
|
|
58
|
+
.array(z.object({ path: z.string(), url: z.string(), sizeBytes: z.number().nullable() }))
|
|
59
|
+
.optional()
|
|
60
|
+
.describe("Companion files (a glTF's .bin and textures). Save each at `path` relative to the main file, or the main file will not open"),
|
|
48
61
|
});
|
|
49
62
|
const nameReason = z.object({
|
|
50
63
|
name: z.string(),
|
|
@@ -58,6 +71,9 @@ const searchOutput = {
|
|
|
58
71
|
assets: z.array(z.object(assetShape)).describe("CC0 results, at most `limit`; may be fewer when sources drop non-CC0 items"),
|
|
59
72
|
totals: z.record(z.string(), z.number()).describe("Upstream match count per source job (before CC0 re-checks); useful to decide whether to page"),
|
|
60
73
|
errors: z.array(z.string()).describe("Sources that failed this time, e.g. 'met: The Met returned HTTP 503'; other sources still returned results"),
|
|
74
|
+
pending: z
|
|
75
|
+
.array(z.string())
|
|
76
|
+
.describe(`Sources that had not answered within ${SEARCH_DEADLINE_MS / 1000} s and were left out; search again (or narrow with providers) to include them`),
|
|
61
77
|
};
|
|
62
78
|
const getOutput = {
|
|
63
79
|
...assetShape,
|
|
@@ -87,17 +103,34 @@ const result = (value) => ({
|
|
|
87
103
|
content: [{ type: "text", text: JSON.stringify(value, null, 2) }],
|
|
88
104
|
});
|
|
89
105
|
const fail = (message) => ({ content: [{ type: "text", text: message }], isError: true });
|
|
90
|
-
|
|
91
|
-
|
|
106
|
+
const savedFileSchema = z.object({
|
|
107
|
+
label: z.string().describe("File label from get_asset; companions read '<main label> + <path>'"),
|
|
108
|
+
path: z.string().describe("Path relative to `folder`"),
|
|
109
|
+
url: z.string().describe("Where it was downloaded from"),
|
|
110
|
+
bytes: z.number(),
|
|
111
|
+
sha256: z.string(),
|
|
112
|
+
});
|
|
113
|
+
const downloadOutput = {
|
|
114
|
+
folder: z.string().describe("Absolute path of the folder created for this asset"),
|
|
115
|
+
saved: z.array(savedFileSchema).describe("Files written, including each model's companion files at their relative paths"),
|
|
116
|
+
skipped: z
|
|
117
|
+
.array(z.object({ label: z.string(), url: z.string(), reason: z.string() }))
|
|
118
|
+
.describe("Files not saved and why, e.g. a page that needs the user's login; tell the user and give them landingUrl"),
|
|
119
|
+
receipt: z.string().describe(`Absolute path of ${RECEIPT_NAME}: id, title, creator, source URLs, license evidence, riskFlags and download time`),
|
|
120
|
+
};
|
|
121
|
+
export function createServer(fetchImpl = defaultFetch, downloadImpl = defaultDownload) {
|
|
122
|
+
const server = new McpServer({ name: "cc0-library", version: "0.2.13" });
|
|
92
123
|
server.registerTool("search_assets", {
|
|
93
124
|
title: "Search CC0 assets across 17 sources",
|
|
94
125
|
description: "Find CC0 1.0 (public-domain dedication) images, audio, video, HDRIs, textures, 3D models and museum artworks by keyword, " +
|
|
95
126
|
"returning only items whose CC0 status was checked. " +
|
|
96
127
|
"Use it first to discover candidates; then call get_asset for download files and a fresh license re-check. " +
|
|
97
128
|
"Use list_sources instead to answer which sites are CC0. Do not use it for CC BY, CC BY-SA or other 'free' licenses: they are filtered out. " +
|
|
98
|
-
|
|
129
|
+
`Behavior: read-only, no API key, live HTTPS calls to each source; replies within ${SEARCH_DEADLINE_MS / 1000} s. ` +
|
|
130
|
+
"A failing source is listed in `errors` and a source still running at the deadline in `pending`, while the others still return. " +
|
|
99
131
|
"Results from uploader-driven sites (Openverse, Commons, Internet Archive, Sketchfab, WordPress Photo Directory, iNaturalist, PhyloPic, Zenodo, BlenderKit, GitHub, Hugging Face) carry licenseEvidence.declaredBy='uploader': " +
|
|
100
|
-
"tell the user to confirm the uploader owns the work
|
|
132
|
+
"tell the user to confirm the uploader owns the work; items with riskFlags name a franchise or brand and need that warning most. " +
|
|
133
|
+
"Show each item's servedBy credit with the results.",
|
|
101
134
|
inputSchema: {
|
|
102
135
|
query: z.string().min(1).max(200).describe("Keywords in any language, matched against titles and tags, e.g. 'rainy street' or 'brick wall'"),
|
|
103
136
|
kind: z.enum([...ASSET_KINDS, "any"]).default("any").describe(KIND_HELP),
|
|
@@ -126,7 +159,7 @@ export function createServer(fetchImpl = defaultFetch) {
|
|
|
126
159
|
},
|
|
127
160
|
outputSchema: searchOutput,
|
|
128
161
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
129
|
-
}, async ({ query, kind, limit, page, providers }) => result(await search(fetchImpl, query, kind, limit, page, { providers })));
|
|
162
|
+
}, async ({ query, kind, limit, page, providers }) => result(await search(fetchImpl, query, kind, limit, page, { providers, deadlineMs: SEARCH_DEADLINE_MS })));
|
|
130
163
|
server.registerTool("get_asset", {
|
|
131
164
|
title: "Get one CC0 asset with download files",
|
|
132
165
|
description: "Fetch one asset's details and download files by an id from search_assets, re-checking at the source that it is still CC0. " +
|
|
@@ -157,6 +190,46 @@ export function createServer(fetchImpl = defaultFetch) {
|
|
|
157
190
|
...(truncated && { filesNote: `${asset.files.length - MAX_FILES_IN_REPLY} more files omitted; see landingUrl.` }),
|
|
158
191
|
});
|
|
159
192
|
});
|
|
193
|
+
server.registerTool("download_asset", {
|
|
194
|
+
title: "Download a CC0 asset with a license receipt",
|
|
195
|
+
description: "Save chosen files of one asset to a local folder, re-checking at the source that it is still CC0 first. " +
|
|
196
|
+
"Creates <dir>/<asset id>/, saves each file there with its companions (a glTF's .bin and textures) at the relative paths the main file expects, " +
|
|
197
|
+
`and writes ${RECEIPT_NAME} recording the source, creator, license evidence, riskFlags and download time, so the project keeps proof of where the asset came from. ` +
|
|
198
|
+
"Use it after search_assets (and get_asset when the asset has several files, to read their labels) when the user wants the asset in their project; " +
|
|
199
|
+
"use get_asset instead when they only want links. " +
|
|
200
|
+
"Pages that need the user's login (Sketchfab, BlenderKit, Freesound originals) are not downloaded and come back in `skipped`. " +
|
|
201
|
+
"Zip packs (ambientCG) are saved as-is, not extracted. " +
|
|
202
|
+
"Behavior: writes files under `dir` only, overwriting same-named files from an earlier download of the same asset; live HTTPS downloads, up to 1 GB per file.",
|
|
203
|
+
inputSchema: {
|
|
204
|
+
id: z.string().min(1).max(120).describe("Asset id exactly as returned by search_assets"),
|
|
205
|
+
dir: z
|
|
206
|
+
.string()
|
|
207
|
+
.min(1)
|
|
208
|
+
.max(1024)
|
|
209
|
+
.describe("Folder to save into, normally inside the user's project (e.g. 'assets/cc0'). A subfolder named after the asset id is created. Relative paths resolve against the server's working directory"),
|
|
210
|
+
files: z
|
|
211
|
+
.array(z.string().min(1).max(200))
|
|
212
|
+
.min(1)
|
|
213
|
+
.max(MAX_FILES_PER_CALL)
|
|
214
|
+
.optional()
|
|
215
|
+
.describe("Exact file labels from get_asset, e.g. ['gltf / 1k / gltf'] or ['1K-JPG (zip)']. Leave out only when the asset has a single file; " +
|
|
216
|
+
"otherwise the call fails and lists the labels"),
|
|
217
|
+
},
|
|
218
|
+
outputSchema: downloadOutput,
|
|
219
|
+
annotations: { readOnlyHint: false, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
|
220
|
+
}, async ({ id, dir, files }) => {
|
|
221
|
+
const asset = await getAsset(fetchImpl, id);
|
|
222
|
+
if (!asset)
|
|
223
|
+
return fail(`No CC0 asset found for id "${id}". The id may be malformed, removed upstream, or no longer CC0.`);
|
|
224
|
+
try {
|
|
225
|
+
return result(await downloadAsset(downloadImpl, asset, dir, files));
|
|
226
|
+
}
|
|
227
|
+
catch (e) {
|
|
228
|
+
if (e instanceof DownloadRequestError)
|
|
229
|
+
return fail(e.message);
|
|
230
|
+
throw e;
|
|
231
|
+
}
|
|
232
|
+
});
|
|
160
233
|
server.registerTool("list_sources", {
|
|
161
234
|
title: "List verified CC0 source sites",
|
|
162
235
|
description: "List the curated catalog of CC0 asset sites, each with its license page, scope and dated evidence, " +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc0-library-mcp",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.13",
|
|
4
4
|
"mcpName": "io.github.sanghyoLe/cc0-library",
|
|
5
5
|
"description": "MCP server and web gallery for CC0-only assets (images, audio, video, HDRIs, textures, 3D models, museum art) from 8 sources, with license evidence per result.",
|
|
6
6
|
"license": "MIT",
|