cc0-library-mcp 0.1.2 → 0.2.1
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 +71 -11
- package/catalog/sources.json +303 -5
- package/dist/http.js +5 -4
- package/dist/providers/blenderkit.js +60 -0
- package/dist/providers/collections.js +107 -0
- package/dist/providers/commons.js +2 -1
- package/dist/providers/gbif.js +67 -0
- package/dist/providers/iconify.js +81 -0
- package/dist/providers/inaturalist.js +69 -0
- package/dist/providers/phylopic.js +88 -0
- package/dist/providers/zenodo.js +62 -0
- package/dist/search.js +45 -2
- package/dist/server.js +13 -8
- package/dist/types.js +8 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,32 +1,51 @@
|
|
|
1
1
|
# cc0-library
|
|
2
2
|
|
|
3
3
|
**CC0 assets only. With receipts.**
|
|
4
|
-
One search across
|
|
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 **105 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
|

|
|
8
8
|

|
|
9
9
|
[](https://www.npmjs.com/package/cc0-library-mcp)
|
|
10
|
+
[](https://glama.ai/mcp/servers/sanghyoLe/cc0-library)
|
|
11
|
+
[](https://mcprush.com/to/cc0-library-mcp?ref=badge)
|
|
10
12
|
|
|
11
13
|
- **Try it in the browser:** https://sanghyole.github.io/cc0-library/
|
|
14
|
+
- **Walk through the CC0 Museum:** https://sanghyole.github.io/cc0-library/museum.html — a 3D gallery generated from CC0 assets for any theme
|
|
12
15
|
- **Use it from Claude, Cursor, or any MCP client:** `claude mcp add cc0-library -- npx -y cc0-library-mcp`
|
|
16
|
+
- **Listed in:** the [official MCP Registry](https://registry.modelcontextprotocol.io/v0.1/servers?search=io.github.sanghyoLe/cc0-library) (`io.github.sanghyoLe/cc0-library`), [Glama](https://glama.ai/mcp/servers/sanghyoLe/cc0-library) and [mcprush](https://mcprush.com/to/cc0-library-mcp?ref=badge)
|
|
13
17
|
|
|
14
18
|
[](https://sanghyole.github.io/cc0-library/?q=cat&strict=1)
|
|
15
19
|
|
|
16
20
|
[한국어 안내는 아래에 있습니다.](#한국어)
|
|
17
21
|
|
|
22
|
+
## CC0 Museum
|
|
23
|
+
|
|
24
|
+
[](https://sanghyole.github.io/cc0-library/museum.html?theme=ocean)
|
|
25
|
+
|
|
26
|
+
Type a theme (cat, ocean, flowers…) and walk through a museum built at runtime from CC0 assets only:
|
|
27
|
+
|
|
28
|
+
- **Paintings and photos** on the walls: Wikimedia Commons files whose own license is CC0, at most two per creator.
|
|
29
|
+
- **Sculptures** on pedestals, the **floor** and the **lighting HDRI**: Poly Haven.
|
|
30
|
+
- **Ambient sound**: an Openverse audio result whose own license is CC0.
|
|
31
|
+
- Click any piece for its license evidence; the **Credits** panel lists every asset in the room.
|
|
32
|
+
|
|
33
|
+
Rendered with **WebGPU** through three.js `WebGPURenderer` ([three.js](https://threejs.org), MIT, 0.170.0 pinned on jsDelivr), which falls back to WebGL2 in browsers without WebGPU; a badge shows which backend is active (`?renderer=webgl` forces the fallback for testing). It runs entirely in the browser. Camera input is eased: drag (or lock the mouse) to look, WASD to walk with gentle acceleration, Shift to hurry, scroll to zoom in on a painting; walls and pedestals are solid; a subtle head bob is turned off for `prefers-reduced-motion`. Phones use an analog joystick (bottom left) to walk and drag anywhere else to look, with inertia; `?joystick=1` shows the joystick on desktop for testing.
|
|
34
|
+
|
|
35
|
+
Loading is progressive: a progress bar tracks four steps (finding works, floor and lighting, paintings, sculptures); empty frames appear first and each painting fades in when its image arrives; every image, model and HDRI has a time limit, so one slow asset leaves only its own slot empty; and switching themes cancels the previous load. You can enter the room as soon as the floor and lighting are ready.
|
|
36
|
+
|
|
18
37
|
## Why
|
|
19
38
|
|
|
20
39
|
"Free" is not "CC0". Unsplash, Pixabay, and Pexels use their own licenses. Openverse, Flickr, Commons, and Sketchfab mix licenses on one site, and the license on an item is whatever the uploader picked. If you ship a game, a product, or AI training data, you need to know which items are really CC0 and why.
|
|
21
40
|
|
|
22
41
|
| | Openverse search alone | cc0-library |
|
|
23
42
|
|---|---|---|
|
|
24
|
-
| Sources | Openverse index (Flickr, Freesound, Commons, museums…) | Openverse **plus** Commons, Internet Archive, WordPress Photo Directory, Poly Haven, ambientCG, Sketchfab, Cleveland, The Met |
|
|
43
|
+
| Sources | Openverse index (Flickr, Freesound, Commons, museums…) | Openverse **plus** 16 more: Commons, Internet Archive, WordPress Photo Directory, iNaturalist, GBIF, PhyloPic, Iconify, Zenodo, Poly Haven, ambientCG, BlenderKit, Sketchfab, Cleveland, The Met, GitHub, Hugging Face |
|
|
25
44
|
| CC0 filter | `license=cc0` query parameter | Query filter **and** a check of each item's own license field |
|
|
26
45
|
| Who declared CC0 | Not shown | `declaredBy`: studio, museum, or uploader |
|
|
27
46
|
| Re-check before download | — | `get_asset` re-checks CC0 at the source |
|
|
28
47
|
| "Looks free but isn't" list | — | Unsplash, Pixabay, Pexels, SMK (Public Domain Mark), NASA |
|
|
29
|
-
| Asset types | Images, audio | Images, audio, video, HDRIs, textures, 3D models, artworks |
|
|
48
|
+
| Asset types | Images, audio | Images, audio, video, HDRIs, textures, 3D models, artworks, whole collections |
|
|
30
49
|
| AI assistant access | REST API | MCP server (`search_assets`, `get_asset`, `list_sources`) |
|
|
31
50
|
|
|
32
51
|
### Who declared CC0?
|
|
@@ -35,12 +54,32 @@ Every result has `licenseEvidence.declaredBy`:
|
|
|
35
54
|
|
|
36
55
|
| Value | Meaning | Providers |
|
|
37
56
|
|---|---|---|
|
|
38
|
-
| `library` | The studio that made the asset publishes
|
|
39
|
-
| `institution` | A museum marks a work in its own collection as CC0. | Cleveland Museum of Art, The Met |
|
|
40
|
-
| `uploader` | A site user set the CC0 label. Nobody reviewed it, and it can be wrong (for example, someone else's work uploaded as CC0). | Openverse, Wikimedia Commons, Internet Archive, Sketchfab, WordPress Photo Directory |
|
|
57
|
+
| `library` | The studio or project that made the asset publishes it as CC0. | Poly Haven, ambientCG, Iconify CC0 icon sets |
|
|
58
|
+
| `institution` | A museum or research institution marks a work in its own collection as CC0. | Cleveland Museum of Art, The Met, GBIF publishers |
|
|
59
|
+
| `uploader` | A site user set the CC0 label. Nobody reviewed it, and it can be wrong (for example, someone else's work uploaded as CC0). | Openverse, Wikimedia Commons, Internet Archive, Sketchfab, WordPress Photo Directory, iNaturalist, PhyloPic, Zenodo, BlenderKit, GitHub, Hugging Face |
|
|
41
60
|
|
|
42
61
|
The web gallery has a "rights holder only" switch that drops `uploader` results. MCP clients can filter on the field.
|
|
43
62
|
|
|
63
|
+
## The catalog
|
|
64
|
+
|
|
65
|
+
[`catalog/sources.json`](catalog/sources.json) lists 105 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 in the [web gallery's Sources tab](https://sanghyole.github.io/cc0-library/) or with the `list_sources` tool.
|
|
66
|
+
|
|
67
|
+
| Asset type | Sources | Examples |
|
|
68
|
+
|---|---|---|
|
|
69
|
+
| Images, photos, illustrations, icons | 61 | PxHere, freestocks.org, Open Peeps, Health Icons, Simple Icons, 3dicons, FreeSVG |
|
|
70
|
+
| 3D models and animation | 21 | Kenney, Quaternius, KayKit, The Base Mesh, Sign Language Mocap Archive, BlenderKit (CC0 filter) |
|
|
71
|
+
| Audio, music, samples | 20 | BigSoundBank, VCSL, AKWF waveforms, Wyzowl SFX kit, Freesound (CC0 filter) |
|
|
72
|
+
| Textures and materials | 15 | ambientCG, cgbookcase, ShareTextures, 3DTextures.me, Godot VFX textures |
|
|
73
|
+
| HDRIs | 5 | Poly Haven, Open HDRI, ambientCG |
|
|
74
|
+
| Video | 6 | ISO Republic, Free Nature Stock, Internet Archive (CC0 items) |
|
|
75
|
+
| Museum artworks | 3 | Cleveland Museum of Art, The Met, Rijksmuseum (CC0 items) |
|
|
76
|
+
| Fonts | 2 | Beedii, C64 keyboard font |
|
|
77
|
+
|
|
78
|
+
The catalog also keeps two honest lists:
|
|
79
|
+
|
|
80
|
+
- **Not CC0 (11):** popular "free" sources with their own licenses or public-domain statements, such as Unsplash, Pixabay, Pexels, Pixnio, SMK (Public Domain Mark), NASA and LibriVox, each with the reason.
|
|
81
|
+
- **Pending (40):** candidates that could not be verified yet, usually because the site blocks automated requests. A person can check them in a browser and open a pull request.
|
|
82
|
+
|
|
44
83
|
## How each provider is checked
|
|
45
84
|
|
|
46
85
|
| Provider | Asset kinds | How CC0 is checked |
|
|
@@ -51,6 +90,14 @@ The web gallery has a "rights holder only" switch that drops `uploader` results.
|
|
|
51
90
|
| [Internet Archive](https://archive.org) | video, audio, image | The query requires a CC0 `licenseurl`. Each item's own `licenseurl` must be the CC0 1.0 deed. User text is stripped of query operators so it cannot bypass this clause. |
|
|
52
91
|
| [WordPress Photo Directory](https://wordpress.org/photos/) | image | Every photo in the directory is CC0 ("All photos are CC0 licensed"). |
|
|
53
92
|
| [Sketchfab](https://sketchfab.com) | model | The query uses `license=cc0`. Each model's own license must be "CC0 Public Domain". Age-restricted models are dropped. |
|
|
93
|
+
| [iNaturalist](https://www.inaturalist.org) | image | The query uses `photo_license=cc0`. Only photos whose own `license_code` is `cc0` are used. |
|
|
94
|
+
| [GBIF](https://www.gbif.org) | image | The query uses `license=CC0_1_0`. The occurrence license must be CC0, and the image's own license must be CC0 or unstated. |
|
|
95
|
+
| [PhyloPic](https://www.phylopic.org) | image | Each silhouette's license link must be the CC0 deed. Search matches taxon names (e.g. `vulpes`). |
|
|
96
|
+
| [Iconify](https://iconify.design) | image | Search covers only icon sets whose license in `/collections` is `CC0-1.0`. |
|
|
97
|
+
| [Zenodo](https://zenodo.org) | image, video | The query requires `metadata.rights.id:cc0-1.0`; each record must report license `cc-zero`. |
|
|
98
|
+
| [BlenderKit](https://www.blenderkit.com) | model, texture, hdri | The query uses `license:cc_zero`; each asset must report `cc_zero` and be public. Downloads need a free BlenderKit account. |
|
|
99
|
+
| [GitHub](https://github.com) | collection | Repositories whose detected license is `CC0-1.0`. Check the README for contents under other licenses. |
|
|
100
|
+
| [Hugging Face](https://huggingface.co/datasets) | collection | Datasets tagged `license:cc0-1.0`. |
|
|
54
101
|
| [ambientCG](https://ambientcg.com) | hdri, texture, model | Every asset in the library is CC0 ([license](https://docs.ambientcg.com/license/)). |
|
|
55
102
|
| [Cleveland Museum of Art](https://www.clevelandart.org/open-access) | artwork | The query uses `cc0=1`. Each item must also have `share_license_status === "CC0"`. |
|
|
56
103
|
| [The Met](https://github.com/metmuseum/openaccess) | artwork | Each object must have `isPublicDomain === true` (Open Access works are CC0) and an image. |
|
|
@@ -95,8 +142,8 @@ claude mcp add cc0-library -- node "$PWD/dist/index.js"
|
|
|
95
142
|
|
|
96
143
|
| Tool | Input | Returns |
|
|
97
144
|
|---|---|---|
|
|
98
|
-
| `search_assets` | `query`, `kind` (`image`·`audio`·`video`·`hdri`·`texture`·`model`·`artwork`·`any`, default `any`), `limit` 1–20, `page` 1–12 | CC0 assets, per-provider totals, per-provider errors |
|
|
99
|
-
| `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>`) | 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) |
|
|
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 | CC0 assets, per-provider totals, per-provider errors |
|
|
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) |
|
|
100
147
|
| `list_sources` | `kind` (optional) | Curated catalog, the non-CC0 list, and the pending-verification list |
|
|
101
148
|
|
|
102
149
|
If one provider fails, `search_assets` still returns results from the other providers and lists the failure in `errors`. Gateway errors (HTTP 502/503/504) are retried once.
|
|
@@ -157,13 +204,21 @@ src/
|
|
|
157
204
|
providers/archive.ts
|
|
158
205
|
providers/sketchfab.ts
|
|
159
206
|
providers/wpphotos.ts
|
|
160
|
-
|
|
207
|
+
providers/inaturalist.ts, gbif.ts, phylopic.ts, iconify.ts, zenodo.ts, blenderkit.ts
|
|
208
|
+
providers/collections.ts GitHub repositories and Hugging Face datasets
|
|
209
|
+
web/ browser gallery and museum.html (3D CC0 Museum, three.js); scripts/build-site.mjs assembles them into _site/
|
|
161
210
|
catalog/sources.json curated CC0 source list (CC0 data)
|
|
162
211
|
test/ node:test unit tests
|
|
163
212
|
scripts/smoke.mjs live end-to-end check
|
|
164
213
|
scripts/discover.mjs weekly catalog re-check and Openverse candidate discovery
|
|
165
214
|
```
|
|
166
215
|
|
|
216
|
+
## Automation
|
|
217
|
+
|
|
218
|
+
- **Weekly source check** ([`discover.yml`](.github/workflows/discover.yml)): every Monday it re-checks every catalog license page and lists new CC0 candidates from Openverse in the [`source-check`](https://github.com/sanghyoLe/cc0-library/issues?q=label%3Asource-check) issue. A person verifies each candidate before it enters the catalog.
|
|
219
|
+
- **Releases** ([`publish-npm.yml`](.github/workflows/publish-npm.yml)): pushing a `v*` tag runs the tests, publishes to npm with [trusted publishing](https://docs.npmjs.com/trusted-publishers/) (signed provenance, no stored token), and publishes `server.json` to the MCP Registry with GitHub OIDC.
|
|
220
|
+
- **Quality gates:** CI on Node 20, 22 and 24, CodeQL code scanning, Dependabot, and a protected `main` branch.
|
|
221
|
+
|
|
167
222
|
## Contributing
|
|
168
223
|
|
|
169
224
|
See [CONTRIBUTING.md](CONTRIBUTING.md). In short:
|
|
@@ -185,11 +240,16 @@ See [CONTRIBUTING.md](CONTRIBUTING.md). In short:
|
|
|
185
240
|
|
|
186
241
|
**cc0-library**는 CC0 1.0 자료만 찾아 주는 오픈소스 MCP 서버이자 CC0 자료원 목록입니다.
|
|
187
242
|
|
|
188
|
-
- `search_assets`는
|
|
243
|
+
- `search_assets`는 17곳에서 찾습니다. 이미지·오디오·영상은 Openverse, 위키미디어 공용, 인터넷 아카이브, WordPress 사진 디렉터리, iNaturalist, GBIF, PhyloPic, Iconify, Zenodo에서 찾습니다. HDRI, 텍스처, 3D 모델은 Poly Haven, ambientCG, Sketchfab, BlenderKit에서 찾습니다. CC0 저장소·데이터셋 묶음(`collection`)은 GitHub와 Hugging Face에서 찾습니다. 미술품(`artwork`)은 Cleveland Museum of Art와 The Met에서 찾습니다.
|
|
189
244
|
- 모든 결과에는 CC0 확인 근거(`licenseEvidence`)가 붙습니다. 근거에는 CC0를 누가 선언했는지(`declaredBy`)도 들어 있습니다. 제작사(`library`), 미술관(`institution`), 업로더(`uploader`) 중 하나입니다. 업로더가 선언한 CC0는 아무도 검토하지 않았으므로 직접 확인해야 합니다.
|
|
190
245
|
- 웹에서 바로 검색할 수 있습니다: https://sanghyole.github.io/cc0-library/
|
|
246
|
+
- **CC0 미술관**: 주제어를 넣으면 CC0 그림·조각·바닥·조명·배경음으로 3D 전시실을 만들어 걸어 다닐 수 있습니다. WebGPU로 그리고, WebGPU가 없는 브라우저에서는 WebGL2로 자동 전환합니다. https://sanghyole.github.io/cc0-library/museum.html
|
|
191
247
|
- `get_asset`은 다운로드 URL을 주기 전에 원본에서 CC0 여부를 다시 확인합니다.
|
|
192
|
-
- `list_sources`는 검증한 CC0 자료원
|
|
248
|
+
- `list_sources`는 검증한 CC0 자료원 105곳의 목록을 줍니다. 종류별로 이미지 64곳, 3D 22곳, 오디오 20곳, 텍스처 16곳, HDRI 5곳, 영상 6곳, 미술품 3곳, 폰트 6곳입니다. CC0가 아닌 무료 사이트(Unsplash, Pixabay, Pexels, Pixnio, SMK, NASA)와 그 이유도 줍니다. 아직 검증하지 못한 후보도 따로 줍니다.
|
|
249
|
+
|
|
250
|
+
- 매주 자동 점검이 목록의 라이선스 페이지를 다시 확인하고 새 후보를 찾습니다.
|
|
251
|
+
- 버전 태그를 올리면 npm과 MCP 공식 레지스트리에 자동으로 배포됩니다.
|
|
252
|
+
- Glama 품질 등급은 A입니다.
|
|
193
253
|
|
|
194
254
|
설치 (Claude Code):
|
|
195
255
|
|
package/catalog/sources.json
CHANGED
|
@@ -132,7 +132,7 @@
|
|
|
132
132
|
"scope": "filter-only",
|
|
133
133
|
"searchable": true,
|
|
134
134
|
"licensePage": "https://github.com/metmuseum/openaccess",
|
|
135
|
-
"notes": "Collection API without a key. Only objects with isPublicDomain=true qualify. The v1 search endpoint was retired on 2026-10-01; this repo uses v1.1.",
|
|
135
|
+
"notes": "Collection API without a key. Only objects with isPublicDomain=true qualify. The v1 search endpoint was retired on 2026-10-01; this repo uses v1.1. Since February 2026 the Met also publishes 100+ 3D models of collection works; most are CC0 under the same Open Access program.",
|
|
136
136
|
"verified": {
|
|
137
137
|
"date": "2026-11-19",
|
|
138
138
|
"evidence": "metmuseum/openaccess README: artworks covered by the Open Access policy are identified with the Creative Commons Zero (CC0) icon; metmuseum.github.io: datasets waived under CC0"
|
|
@@ -446,9 +446,9 @@
|
|
|
446
446
|
"image"
|
|
447
447
|
],
|
|
448
448
|
"scope": "filter-only",
|
|
449
|
-
"searchable":
|
|
449
|
+
"searchable": true,
|
|
450
450
|
"licensePage": "https://www.phylopic.org",
|
|
451
|
-
"notes": "Silhouettes of organisms, searched by scientific name. Licenses vary per image (CC0, CC BY, CC BY-SA...); use only images whose license is CC0.",
|
|
451
|
+
"notes": "Silhouettes of organisms, searched by scientific name. Licenses vary per image (CC0, CC BY, CC BY-SA...); use only images whose license is CC0. Searchable here.",
|
|
452
452
|
"verified": {
|
|
453
453
|
"date": "2026-11-20",
|
|
454
454
|
"evidence": "API image records carry a license link; e.g. 'Felis chaus' and 'Felis nigripes' images link creativecommons.org/publicdomain/zero/1.0/ while another links by-sa/3.0"
|
|
@@ -640,9 +640,9 @@
|
|
|
640
640
|
"hdri"
|
|
641
641
|
],
|
|
642
642
|
"scope": "filter-only",
|
|
643
|
-
"searchable":
|
|
643
|
+
"searchable": true,
|
|
644
644
|
"licensePage": "https://www.blenderkit.com/docs/licenses/",
|
|
645
|
-
"notes": "Blender add-on library of models, materials and HDRIs under two licenses (Royalty Free and CC0). Use only assets marked CC0.",
|
|
645
|
+
"notes": "Blender add-on library of models, materials and HDRIs under two licenses (Royalty Free and CC0). Use only assets marked CC0. Searchable here.",
|
|
646
646
|
"verified": {
|
|
647
647
|
"date": "2026-11-20",
|
|
648
648
|
"evidence": "license page lists 'CC0 - No Rights Reserved' as one of its asset licenses"
|
|
@@ -1454,6 +1454,269 @@
|
|
|
1454
1454
|
"date": "2026-11-20",
|
|
1455
1455
|
"evidence": "GitHub repository hiddevdploeg/SEOshop-Flags declares license CC0-1.0"
|
|
1456
1456
|
}
|
|
1457
|
+
},
|
|
1458
|
+
{
|
|
1459
|
+
"id": "vcsl",
|
|
1460
|
+
"name": "Versilian Community Sample Library (VCSL)",
|
|
1461
|
+
"url": "https://github.com/sgossner/VCSL",
|
|
1462
|
+
"kinds": [
|
|
1463
|
+
"audio"
|
|
1464
|
+
],
|
|
1465
|
+
"scope": "whole-library",
|
|
1466
|
+
"searchable": false,
|
|
1467
|
+
"licensePage": "https://github.com/sgossner/VCSL",
|
|
1468
|
+
"notes": "General-purpose instrument sample library (orchestral, percussion, keys) with SFZ mappings.",
|
|
1469
|
+
"verified": {
|
|
1470
|
+
"date": "2026-11-20",
|
|
1471
|
+
"evidence": "GitHub repository declares CC0-1.0; README: 'This collection is under a Creative Commons 0 license ... no royalties, no credit, no special terms'"
|
|
1472
|
+
}
|
|
1473
|
+
},
|
|
1474
|
+
{
|
|
1475
|
+
"id": "opensource3dassets",
|
|
1476
|
+
"name": "Open Source 3D Assets",
|
|
1477
|
+
"url": "https://www.opensource3dassets.com",
|
|
1478
|
+
"kinds": [
|
|
1479
|
+
"model"
|
|
1480
|
+
],
|
|
1481
|
+
"scope": "whole-library",
|
|
1482
|
+
"searchable": false,
|
|
1483
|
+
"licensePage": "https://github.com/ToxSam/open-source-3D-assets",
|
|
1484
|
+
"notes": "Directory of ~991 GLB models from metaverse projects, with a JSON database linking to the original files.",
|
|
1485
|
+
"verified": {
|
|
1486
|
+
"date": "2026-11-20",
|
|
1487
|
+
"evidence": "data/projects.json in ToxSam/open-source-3D-assets lists license 'CC0' for all 18 projects"
|
|
1488
|
+
}
|
|
1489
|
+
},
|
|
1490
|
+
{
|
|
1491
|
+
"id": "huggingface-cc0",
|
|
1492
|
+
"name": "Hugging Face Datasets (CC0 filter)",
|
|
1493
|
+
"url": "https://huggingface.co/datasets?license=license:cc0-1.0",
|
|
1494
|
+
"kinds": [
|
|
1495
|
+
"image",
|
|
1496
|
+
"audio",
|
|
1497
|
+
"model"
|
|
1498
|
+
],
|
|
1499
|
+
"scope": "filter-only",
|
|
1500
|
+
"searchable": true,
|
|
1501
|
+
"licensePage": "https://huggingface.co/datasets?license=license:cc0-1.0",
|
|
1502
|
+
"notes": "Datasets under mixed licenses; filter by license cc0-1.0 (1,000+ datasets, e.g. speech corpora, pixel-art atlases, GLB sets). The license tag is set by the uploader; check each dataset card. Searchable here.",
|
|
1503
|
+
"verified": {
|
|
1504
|
+
"date": "2026-11-20",
|
|
1505
|
+
"evidence": "Hub API /api/datasets?filter=license:cc0-1.0 returns datasets tagged cc0-1.0 (e.g. facebook/voxpopuli, Angais/pixel-art-atlas-1.4m)"
|
|
1506
|
+
}
|
|
1507
|
+
},
|
|
1508
|
+
{
|
|
1509
|
+
"id": "inaturalist-cc0",
|
|
1510
|
+
"name": "iNaturalist (CC0 photos)",
|
|
1511
|
+
"url": "https://www.inaturalist.org/observations?photo_license=cc0",
|
|
1512
|
+
"kinds": [
|
|
1513
|
+
"image"
|
|
1514
|
+
],
|
|
1515
|
+
"scope": "filter-only",
|
|
1516
|
+
"searchable": true,
|
|
1517
|
+
"licensePage": "https://www.inaturalist.org/pages/terms",
|
|
1518
|
+
"notes": "Nature observation photos; observers choose a license per photo. Searchable here; only photos whose license_code is cc0 are used.",
|
|
1519
|
+
"verified": {
|
|
1520
|
+
"date": "2026-11-20",
|
|
1521
|
+
"evidence": "API photos carry license_code 'cc0' with attribution 'no rights reserved' (photo_license=cc0 filter)"
|
|
1522
|
+
}
|
|
1523
|
+
},
|
|
1524
|
+
{
|
|
1525
|
+
"id": "gbif-cc0",
|
|
1526
|
+
"name": "GBIF (CC0 occurrence images)",
|
|
1527
|
+
"url": "https://www.gbif.org/occurrence/gallery?license=CC0_1_0",
|
|
1528
|
+
"kinds": [
|
|
1529
|
+
"image"
|
|
1530
|
+
],
|
|
1531
|
+
"scope": "filter-only",
|
|
1532
|
+
"searchable": true,
|
|
1533
|
+
"licensePage": "https://www.gbif.org/terms",
|
|
1534
|
+
"notes": "Specimen and field images from museums and herbaria worldwide. Searchable here; record and image licenses must both be CC0.",
|
|
1535
|
+
"verified": {
|
|
1536
|
+
"date": "2026-11-20",
|
|
1537
|
+
"evidence": "API occurrence license http://creativecommons.org/publicdomain/zero/1.0/legalcode and media license .../publicdomain/zero/1.0/"
|
|
1538
|
+
}
|
|
1539
|
+
},
|
|
1540
|
+
{
|
|
1541
|
+
"id": "iconify-cc0",
|
|
1542
|
+
"name": "Iconify (CC0 icon sets)",
|
|
1543
|
+
"url": "https://icon-sets.iconify.design/?license=CC0-1.0",
|
|
1544
|
+
"kinds": [
|
|
1545
|
+
"image"
|
|
1546
|
+
],
|
|
1547
|
+
"scope": "filter-only",
|
|
1548
|
+
"searchable": true,
|
|
1549
|
+
"licensePage": "https://api.iconify.design/collections",
|
|
1550
|
+
"notes": "Searchable here across the icon sets whose license is CC0-1.0 (e.g. Maki, Temaki, Pinhead, Osmic, Simple Icons, CoreUI Brands). Logo sets remain trademarks.",
|
|
1551
|
+
"verified": {
|
|
1552
|
+
"date": "2026-11-20",
|
|
1553
|
+
"evidence": "/collections reports license.spdx 'CC0-1.0' for 10 of 280 icon sets"
|
|
1554
|
+
}
|
|
1555
|
+
},
|
|
1556
|
+
{
|
|
1557
|
+
"id": "zenodo-cc0",
|
|
1558
|
+
"name": "Zenodo (CC0 records)",
|
|
1559
|
+
"url": "https://zenodo.org/search?q=metadata.rights.id%3Acc0-1.0",
|
|
1560
|
+
"kinds": [
|
|
1561
|
+
"image",
|
|
1562
|
+
"video"
|
|
1563
|
+
],
|
|
1564
|
+
"scope": "filter-only",
|
|
1565
|
+
"searchable": true,
|
|
1566
|
+
"licensePage": "https://about.zenodo.org/terms/",
|
|
1567
|
+
"notes": "Research figures, photos and videos. Searchable here; records must report license cc-zero.",
|
|
1568
|
+
"verified": {
|
|
1569
|
+
"date": "2026-11-20",
|
|
1570
|
+
"evidence": "API records matching metadata.rights.id:cc0-1.0 report metadata.license.id 'cc-zero'"
|
|
1571
|
+
}
|
|
1572
|
+
},
|
|
1573
|
+
{
|
|
1574
|
+
"id": "github-cc0",
|
|
1575
|
+
"name": "GitHub (CC0 repositories)",
|
|
1576
|
+
"url": "https://github.com/search?q=license%3Acc0-1.0&type=repositories",
|
|
1577
|
+
"kinds": [
|
|
1578
|
+
"image",
|
|
1579
|
+
"audio",
|
|
1580
|
+
"model",
|
|
1581
|
+
"texture"
|
|
1582
|
+
],
|
|
1583
|
+
"scope": "filter-only",
|
|
1584
|
+
"searchable": true,
|
|
1585
|
+
"licensePage": "https://docs.github.com/en/search-github/searching-on-github/searching-for-repositories#search-by-license",
|
|
1586
|
+
"notes": "Whole asset repositories whose detected license is CC0-1.0. Searchable here with kind=collection. Check each README: contents can carry other licenses.",
|
|
1587
|
+
"verified": {
|
|
1588
|
+
"date": "2026-11-20",
|
|
1589
|
+
"evidence": "search qualifier license:cc0-1.0; repository API reports license.spdx_id 'CC0-1.0'"
|
|
1590
|
+
}
|
|
1591
|
+
},
|
|
1592
|
+
{
|
|
1593
|
+
"id": "dicebear-cc0",
|
|
1594
|
+
"name": "DiceBear avatar styles (CC0 styles)",
|
|
1595
|
+
"url": "https://www.dicebear.com/styles/",
|
|
1596
|
+
"kinds": [
|
|
1597
|
+
"image"
|
|
1598
|
+
],
|
|
1599
|
+
"scope": "filter-only",
|
|
1600
|
+
"searchable": false,
|
|
1601
|
+
"licensePage": "https://www.dicebear.com/licenses/",
|
|
1602
|
+
"notes": "Procedural avatar styles; each style has its own license. Use only the styles listed under CC0 1.0 on the licenses page.",
|
|
1603
|
+
"verified": {
|
|
1604
|
+
"date": "2026-11-23",
|
|
1605
|
+
"evidence": "licenses page: 'CC0 1.0 42 styles These styles use the CC0 1.0 Public Domain Dedication'"
|
|
1606
|
+
}
|
|
1607
|
+
},
|
|
1608
|
+
{
|
|
1609
|
+
"id": "open-source-avatars",
|
|
1610
|
+
"name": "Open Source Avatars (ToxSam)",
|
|
1611
|
+
"url": "https://www.opensourceavatars.com/",
|
|
1612
|
+
"kinds": [
|
|
1613
|
+
"model"
|
|
1614
|
+
],
|
|
1615
|
+
"scope": "whole-library",
|
|
1616
|
+
"searchable": false,
|
|
1617
|
+
"licensePage": "https://www.opensourceavatars.com/",
|
|
1618
|
+
"notes": "300+ VRM avatars for games, VR and VTubing.",
|
|
1619
|
+
"verified": {
|
|
1620
|
+
"date": "2026-11-23",
|
|
1621
|
+
"evidence": "site footer: 'All avatars CC0.'; meta description: 'CC0 licensed open-source avatars for any project. No attribution required.'"
|
|
1622
|
+
}
|
|
1623
|
+
},
|
|
1624
|
+
{
|
|
1625
|
+
"id": "freestocktextures",
|
|
1626
|
+
"name": "Free Stock Textures",
|
|
1627
|
+
"url": "https://freestocktextures.com/",
|
|
1628
|
+
"kinds": [
|
|
1629
|
+
"texture",
|
|
1630
|
+
"image"
|
|
1631
|
+
],
|
|
1632
|
+
"scope": "whole-library",
|
|
1633
|
+
"searchable": false,
|
|
1634
|
+
"licensePage": "https://freestocktextures.com/license/",
|
|
1635
|
+
"notes": "Photographic textures (wood, stone, metal, paper).",
|
|
1636
|
+
"verified": {
|
|
1637
|
+
"date": "2026-11-23",
|
|
1638
|
+
"evidence": "license page: 'All photos published on FreeStockTextures are licensed under Creative Commons Zero'"
|
|
1639
|
+
}
|
|
1640
|
+
},
|
|
1641
|
+
{
|
|
1642
|
+
"id": "pico8-font-palette",
|
|
1643
|
+
"name": "PICO-8 font and palette",
|
|
1644
|
+
"url": "https://www.lexaloffle.com/pico-8.php",
|
|
1645
|
+
"kinds": [
|
|
1646
|
+
"font"
|
|
1647
|
+
],
|
|
1648
|
+
"scope": "filter-only",
|
|
1649
|
+
"searchable": false,
|
|
1650
|
+
"licensePage": "https://www.lexaloffle.com/pico-8.php?page=faq",
|
|
1651
|
+
"notes": "Only the PICO-8 font and 16-colour palette are CC0; the PICO-8 program and its other content are not.",
|
|
1652
|
+
"verified": {
|
|
1653
|
+
"date": "2026-11-23",
|
|
1654
|
+
"evidence": "FAQ: 'The palette and font are both available under a CC-0 license. -- zep'"
|
|
1655
|
+
}
|
|
1656
|
+
},
|
|
1657
|
+
{
|
|
1658
|
+
"id": "public-domain-archive",
|
|
1659
|
+
"name": "Public Domain Archive",
|
|
1660
|
+
"url": "https://publicdomainarchive.com/",
|
|
1661
|
+
"kinds": [
|
|
1662
|
+
"image"
|
|
1663
|
+
],
|
|
1664
|
+
"scope": "whole-library",
|
|
1665
|
+
"searchable": false,
|
|
1666
|
+
"licensePage": "https://publicdomainarchive.com/",
|
|
1667
|
+
"notes": "Vintage and modern stock photos added weekly.",
|
|
1668
|
+
"verified": {
|
|
1669
|
+
"date": "2026-11-23",
|
|
1670
|
+
"evidence": "home page meta description: 'Images released under CC0 1.0 Universal Public Domain Dedication.'"
|
|
1671
|
+
}
|
|
1672
|
+
},
|
|
1673
|
+
{
|
|
1674
|
+
"id": "pixel-operator",
|
|
1675
|
+
"name": "Pixel Operator font (Jayvee Enaguas)",
|
|
1676
|
+
"url": "https://www.dafont.com/pixel-operator.font",
|
|
1677
|
+
"kinds": [
|
|
1678
|
+
"font"
|
|
1679
|
+
],
|
|
1680
|
+
"scope": "whole-library",
|
|
1681
|
+
"searchable": false,
|
|
1682
|
+
"licensePage": "https://www.dafont.com/pixel-operator.font",
|
|
1683
|
+
"notes": "Bitmap-style TTF family (15 files: regular, bold, mono, small caps).",
|
|
1684
|
+
"verified": {
|
|
1685
|
+
"date": "2026-11-23",
|
|
1686
|
+
"evidence": "font notes: 'licensed under a Creative Commons Zero (CC0) 1.0'; changelog 2018.10.04-1: 'Changed licence to Creative Commons Zero (CC0) 1.0'"
|
|
1687
|
+
}
|
|
1688
|
+
},
|
|
1689
|
+
{
|
|
1690
|
+
"id": "m5x7",
|
|
1691
|
+
"name": "m5x7 font (Daniel Linssen)",
|
|
1692
|
+
"url": "https://managore.itch.io/m5x7",
|
|
1693
|
+
"kinds": [
|
|
1694
|
+
"font"
|
|
1695
|
+
],
|
|
1696
|
+
"scope": "whole-library",
|
|
1697
|
+
"searchable": false,
|
|
1698
|
+
"licensePage": "https://managore.itch.io/m5x7",
|
|
1699
|
+
"notes": "5x7 pixel font for games.",
|
|
1700
|
+
"verified": {
|
|
1701
|
+
"date": "2026-11-23",
|
|
1702
|
+
"evidence": "itch.io asset license field: 'Creative Commons Zero v1.0 Universal'"
|
|
1703
|
+
}
|
|
1704
|
+
},
|
|
1705
|
+
{
|
|
1706
|
+
"id": "monogram-font",
|
|
1707
|
+
"name": "Monogram font (datagoblin)",
|
|
1708
|
+
"url": "https://datagoblin.itch.io/monogram",
|
|
1709
|
+
"kinds": [
|
|
1710
|
+
"font"
|
|
1711
|
+
],
|
|
1712
|
+
"scope": "whole-library",
|
|
1713
|
+
"searchable": false,
|
|
1714
|
+
"licensePage": "https://datagoblin.itch.io/monogram",
|
|
1715
|
+
"notes": "Monospace bitmap font with TTF and game-ready versions.",
|
|
1716
|
+
"verified": {
|
|
1717
|
+
"date": "2026-11-23",
|
|
1718
|
+
"evidence": "page: 'Monogram is a monospace bitmap font, free and CC0!'; itch.io asset license field: 'Creative Commons Zero v1.0 Universal'"
|
|
1719
|
+
}
|
|
1457
1720
|
}
|
|
1458
1721
|
],
|
|
1459
1722
|
"excluded": [
|
|
@@ -1506,6 +1769,11 @@
|
|
|
1506
1769
|
"name": "unitedstates/images (Congress photos)",
|
|
1507
1770
|
"url": "https://github.com/unitedstates/images",
|
|
1508
1771
|
"reason": "Repository declares CC0-1.0, but the photos are official US government works described as public domain, which is not a CC0 dedication."
|
|
1772
|
+
},
|
|
1773
|
+
{
|
|
1774
|
+
"name": "LibriVox",
|
|
1775
|
+
"url": "https://librivox.org",
|
|
1776
|
+
"reason": "Free audiobooks declared 'public domain (definitely in the USA, and maybe in your country)' rather than a CC0 dedication; outside the USA the status may differ."
|
|
1509
1777
|
}
|
|
1510
1778
|
],
|
|
1511
1779
|
"pending": [
|
|
@@ -1698,6 +1966,36 @@
|
|
|
1698
1966
|
"name": "Gopherkon",
|
|
1699
1967
|
"url": "https://github.com/quasilyte/gopherkon",
|
|
1700
1968
|
"reason": "Repository declares CC0-1.0, but the Go gopher design it builds on was created by Renee French under CC BY 3.0."
|
|
1969
|
+
},
|
|
1970
|
+
{
|
|
1971
|
+
"name": "pmndrs market",
|
|
1972
|
+
"url": "https://market.pmnd.rs",
|
|
1973
|
+
"reason": "README describes CC0 models, textures and HDRIs, but the site returned HTTP 404 during verification."
|
|
1974
|
+
},
|
|
1975
|
+
{
|
|
1976
|
+
"name": "Mozilla Common Voice",
|
|
1977
|
+
"url": "https://commonvoice.mozilla.org/en/datasets",
|
|
1978
|
+
"reason": "Speech dataset widely described as CC0, but the datasets page renders with JavaScript and no license statement was readable; the cv-dataset repository is MPL-2.0 (code)."
|
|
1979
|
+
},
|
|
1980
|
+
{
|
|
1981
|
+
"name": "Startup Stock Photos",
|
|
1982
|
+
"url": "https://startupstockphotos.com/",
|
|
1983
|
+
"reason": "Only the page metadata says '(CC0)'; no license page or visible CC0 statement was found."
|
|
1984
|
+
},
|
|
1985
|
+
{
|
|
1986
|
+
"name": "Open Goldberg Variations (Kimiko Ishizaka)",
|
|
1987
|
+
"url": "https://www.opengoldbergvariations.org/",
|
|
1988
|
+
"reason": "The site calls the recording and score 'public domain' but shows no CC0 dedication."
|
|
1989
|
+
},
|
|
1990
|
+
{
|
|
1991
|
+
"name": "100Avatars (Polygonal Mind)",
|
|
1992
|
+
"url": "https://github.com/PolygonalMind/100Avatars",
|
|
1993
|
+
"reason": "Repository has no detected license and the README states no CC0; some avatars appear in Open Source Avatars, which is listed."
|
|
1994
|
+
},
|
|
1995
|
+
{
|
|
1996
|
+
"name": "Khronos glTF Sample Assets",
|
|
1997
|
+
"url": "https://github.com/KhronosGroup/glTF-Sample-Assets",
|
|
1998
|
+
"reason": "Each model carries its own license (CC0, CC BY and others); no per-model CC0 filter has been checked."
|
|
1701
1999
|
}
|
|
1702
2000
|
]
|
|
1703
2001
|
}
|
package/dist/http.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
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.1
|
|
5
|
+
export const USER_AGENT = "cc0-library-mcp/0.2.1 (+https://github.com/sanghyoLe/cc0-library)";
|
|
6
6
|
const TIMEOUT_MS = 15_000;
|
|
7
7
|
export class UpstreamError extends Error {
|
|
8
8
|
provider;
|
|
@@ -21,11 +21,12 @@ export const defaultFetch = (url, init) => fetch(url, {
|
|
|
21
21
|
const RETRYABLE = new Set([502, 503, 504]);
|
|
22
22
|
const RETRY_DELAY_MS = 500;
|
|
23
23
|
/** GETs JSON. Retries once on a gateway error; any other non-2xx status throws UpstreamError. */
|
|
24
|
-
export async function getJson(fetchImpl, provider, url) {
|
|
25
|
-
|
|
24
|
+
export async function getJson(fetchImpl, provider, url, headers) {
|
|
25
|
+
const init = headers ? { headers } : undefined;
|
|
26
|
+
let res = await fetchImpl(url, init);
|
|
26
27
|
if (RETRYABLE.has(res.status)) {
|
|
27
28
|
await new Promise((r) => setTimeout(r, RETRY_DELAY_MS));
|
|
28
|
-
res = await fetchImpl(url);
|
|
29
|
+
res = await fetchImpl(url, init);
|
|
29
30
|
}
|
|
30
31
|
if (!res.ok)
|
|
31
32
|
throw new UpstreamError(provider, res.status, url);
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { getJson } from "../http.js";
|
|
2
|
+
import { CC0_LICENSE_URL } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* BlenderKit (https://www.blenderkit.com/api/v1, search needs no key).
|
|
5
|
+
* Assets are under "Royalty Free" or CC0; the query asks for `license:cc_zero`
|
|
6
|
+
* and each result must report license "cc_zero". Downloads go through the
|
|
7
|
+
* BlenderKit add-on or website with a free account, so results link the asset
|
|
8
|
+
* page. The API sends no CORS headers: it works from servers, not browsers.
|
|
9
|
+
*/
|
|
10
|
+
const BASE = "https://www.blenderkit.com/api/v1";
|
|
11
|
+
const SERVED_BY = "Via BlenderKit (https://www.blenderkit.com)";
|
|
12
|
+
/** BlenderKit asset_type per kind. */
|
|
13
|
+
const ASSET_TYPE = { model: "model", texture: "material", hdri: "hdr" };
|
|
14
|
+
const KIND_OF = { model: "model", material: "texture", hdr: "hdri", scene: "model" };
|
|
15
|
+
export const isCc0 = (a) => a.license === "cc_zero" && !a.isPrivate;
|
|
16
|
+
export function toAsset(a) {
|
|
17
|
+
return {
|
|
18
|
+
id: `blenderkit:${a.id}`,
|
|
19
|
+
kind: KIND_OF[a.assetType] ?? "model",
|
|
20
|
+
title: a.displayName || a.name,
|
|
21
|
+
creator: a.author?.fullName ?? null,
|
|
22
|
+
landingUrl: `https://www.blenderkit.com/asset-gallery-detail/${a.id}/`,
|
|
23
|
+
fileUrl: null,
|
|
24
|
+
thumbnailUrl: a.thumbnailMiddleUrl ?? null,
|
|
25
|
+
tags: (a.tags ?? []).slice(0, 20),
|
|
26
|
+
provider: "blenderkit",
|
|
27
|
+
origin: "blenderkit.com",
|
|
28
|
+
licenseEvidence: {
|
|
29
|
+
license: "CC0-1.0",
|
|
30
|
+
licenseUrl: CC0_LICENSE_URL,
|
|
31
|
+
method: "per-item-license-field",
|
|
32
|
+
source: `BlenderKit asset license "cc_zero" (${BASE}/assets/${a.id}/)`,
|
|
33
|
+
declaredBy: "uploader",
|
|
34
|
+
},
|
|
35
|
+
servedBy: SERVED_BY,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
const plainWords = (q) => q.replace(/[^\p{L}\p{N}\s]/gu, " ").replace(/\s+/g, " ").trim();
|
|
39
|
+
export async function searchBlenderkit(fetchImpl, kind, params) {
|
|
40
|
+
const words = plainWords(params.query);
|
|
41
|
+
if (!words)
|
|
42
|
+
return { total: 0, assets: [] };
|
|
43
|
+
const filters = kind === "all" ? "" : ` asset_type:${ASSET_TYPE[kind]}`;
|
|
44
|
+
const qs = new URLSearchParams({ query: `${words} license:cc_zero${filters}`, page_size: String(params.limit), page: String(params.page) });
|
|
45
|
+
const data = await getJson(fetchImpl, "BlenderKit", `${BASE}/search/?${qs}`);
|
|
46
|
+
return { total: data.count, assets: data.results.filter(isCc0).map(toAsset) };
|
|
47
|
+
}
|
|
48
|
+
export async function getBlenderkit(fetchImpl, id) {
|
|
49
|
+
if (!/^[0-9a-f-]{36}$/.test(id))
|
|
50
|
+
return null;
|
|
51
|
+
const a = await getJson(fetchImpl, "BlenderKit", `${BASE}/assets/${id}/`);
|
|
52
|
+
if (a.id !== id || !isCc0(a))
|
|
53
|
+
return null;
|
|
54
|
+
const asset = toAsset(a);
|
|
55
|
+
return {
|
|
56
|
+
...asset,
|
|
57
|
+
description: a.description ?? null,
|
|
58
|
+
files: [{ label: "download with a free BlenderKit account or the Blender add-on", url: asset.landingUrl, sizeBytes: null }],
|
|
59
|
+
};
|
|
60
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { getJson } from "../http.js";
|
|
2
|
+
import { CC0_LICENSE_URL } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Asset collections: whole repositories and datasets released under CC0.
|
|
5
|
+
*
|
|
6
|
+
* - GitHub (https://api.github.com, no key; 10 searches/minute unauthenticated):
|
|
7
|
+
* repositories whose detected license is CC0-1.0. A repository's README can
|
|
8
|
+
* still license some contents differently, so results carry declaredBy
|
|
9
|
+
* "uploader" and the description says to check the README.
|
|
10
|
+
* - Hugging Face datasets (https://huggingface.co/api, no key): datasets tagged
|
|
11
|
+
* license:cc0-1.0 by their uploaders.
|
|
12
|
+
*/
|
|
13
|
+
const GH = "https://api.github.com";
|
|
14
|
+
const HF = "https://huggingface.co/api/datasets";
|
|
15
|
+
/** owner/name; each part starts with a letter or digit, so ".." path segments are rejected. */
|
|
16
|
+
const OWNER_NAME = /^[A-Za-z0-9][A-Za-z0-9_.-]*\/[A-Za-z0-9][A-Za-z0-9_.-]*$/;
|
|
17
|
+
const repoIsCc0 = (r) => r.license?.spdx_id === "CC0-1.0";
|
|
18
|
+
const datasetIsCc0 = (d) => (d.tags ?? []).includes("license:cc0-1.0");
|
|
19
|
+
export function repoToAsset(r) {
|
|
20
|
+
return {
|
|
21
|
+
id: `github:${r.full_name}`,
|
|
22
|
+
kind: "collection",
|
|
23
|
+
title: r.full_name,
|
|
24
|
+
creator: r.owner?.login ?? null,
|
|
25
|
+
landingUrl: r.html_url,
|
|
26
|
+
fileUrl: `${r.html_url}/archive/refs/heads/${r.default_branch ?? "main"}.zip`,
|
|
27
|
+
thumbnailUrl: `https://opengraph.githubassets.com/1/${r.full_name}`,
|
|
28
|
+
tags: (r.topics ?? []).slice(0, 20),
|
|
29
|
+
provider: "github",
|
|
30
|
+
origin: "github.com",
|
|
31
|
+
licenseEvidence: {
|
|
32
|
+
license: "CC0-1.0",
|
|
33
|
+
licenseUrl: CC0_LICENSE_URL,
|
|
34
|
+
method: "per-item-license-field",
|
|
35
|
+
source: `GitHub detected license CC0-1.0 for ${r.full_name} (${GH}/repos/${r.full_name}); check the README for contents under other licenses`,
|
|
36
|
+
declaredBy: "uploader",
|
|
37
|
+
},
|
|
38
|
+
servedBy: "Via GitHub (https://github.com)",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
export function datasetToAsset(d) {
|
|
42
|
+
const modalities = (d.tags ?? []).filter((t) => t.startsWith("modality:")).map((t) => t.slice(9));
|
|
43
|
+
return {
|
|
44
|
+
id: `huggingface:${d.id}`,
|
|
45
|
+
kind: "collection",
|
|
46
|
+
title: d.cardData?.pretty_name ?? d.id,
|
|
47
|
+
creator: d.author ?? d.id.split("/")[0] ?? null,
|
|
48
|
+
landingUrl: `https://huggingface.co/datasets/${d.id}`,
|
|
49
|
+
fileUrl: null,
|
|
50
|
+
thumbnailUrl: null,
|
|
51
|
+
tags: modalities,
|
|
52
|
+
provider: "huggingface",
|
|
53
|
+
origin: "huggingface.co",
|
|
54
|
+
licenseEvidence: {
|
|
55
|
+
license: "CC0-1.0",
|
|
56
|
+
licenseUrl: CC0_LICENSE_URL,
|
|
57
|
+
method: "per-item-license-field",
|
|
58
|
+
source: `Hugging Face dataset tag license:cc0-1.0 (${HF}/${d.id})`,
|
|
59
|
+
declaredBy: "uploader",
|
|
60
|
+
},
|
|
61
|
+
servedBy: "Via Hugging Face (https://huggingface.co)",
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
/** Keeps letters, digits and spaces so user text cannot add GitHub search qualifiers. */
|
|
65
|
+
const plainWords = (q) => q.replace(/[^\p{L}\p{N}\s]/gu, " ").replace(/\s+/g, " ").trim();
|
|
66
|
+
export async function searchGithub(fetchImpl, params) {
|
|
67
|
+
const words = plainWords(params.query);
|
|
68
|
+
if (!words)
|
|
69
|
+
return { total: 0, assets: [] };
|
|
70
|
+
const qs = new URLSearchParams({ q: `${words} license:cc0-1.0`, sort: "stars", per_page: String(params.limit), page: String(params.page) });
|
|
71
|
+
const data = await getJson(fetchImpl, "GitHub", `${GH}/search/repositories?${qs}`, {
|
|
72
|
+
Accept: "application/vnd.github+json",
|
|
73
|
+
});
|
|
74
|
+
return { total: data.total_count, assets: data.items.filter(repoIsCc0).map(repoToAsset) };
|
|
75
|
+
}
|
|
76
|
+
export async function getGithub(fetchImpl, fullName) {
|
|
77
|
+
if (!OWNER_NAME.test(fullName))
|
|
78
|
+
return null;
|
|
79
|
+
const r = await getJson(fetchImpl, "GitHub", `${GH}/repos/${fullName}`, { Accept: "application/vnd.github+json" });
|
|
80
|
+
if (!repoIsCc0(r))
|
|
81
|
+
return null;
|
|
82
|
+
const asset = repoToAsset(r);
|
|
83
|
+
return { ...asset, description: r.description, files: [{ label: "repository ZIP", url: asset.fileUrl, sizeBytes: null }] };
|
|
84
|
+
}
|
|
85
|
+
export async function searchHuggingface(fetchImpl, params) {
|
|
86
|
+
const words = plainWords(params.query);
|
|
87
|
+
if (!words)
|
|
88
|
+
return { total: 0, assets: [] };
|
|
89
|
+
// The Hub API pages with cursors; fetch enough for the requested page and slice.
|
|
90
|
+
const want = params.limit * params.page;
|
|
91
|
+
const qs = new URLSearchParams({ search: words, filter: "license:cc0-1.0", sort: "downloads", limit: String(want), full: "true" });
|
|
92
|
+
const data = await getJson(fetchImpl, "Hugging Face", `${HF}?${qs}`);
|
|
93
|
+
const page = data.filter(datasetIsCc0).slice((params.page - 1) * params.limit, want);
|
|
94
|
+
return { total: data.length, assets: page.map(datasetToAsset) };
|
|
95
|
+
}
|
|
96
|
+
export async function getHuggingface(fetchImpl, id) {
|
|
97
|
+
if (!OWNER_NAME.test(id))
|
|
98
|
+
return null;
|
|
99
|
+
const d = await getJson(fetchImpl, "Hugging Face", `${HF}/${id}`);
|
|
100
|
+
if (!datasetIsCc0(d))
|
|
101
|
+
return null;
|
|
102
|
+
return {
|
|
103
|
+
...datasetToAsset(d),
|
|
104
|
+
description: d.description?.replace(/\s+/g, " ").trim().slice(0, 500) || null,
|
|
105
|
+
files: [{ label: "dataset files on Hugging Face", url: `https://huggingface.co/datasets/${id}/tree/main`, sizeBytes: null }],
|
|
106
|
+
};
|
|
107
|
+
}
|
|
@@ -62,7 +62,8 @@ const IMAGEINFO = {
|
|
|
62
62
|
origin: "*",
|
|
63
63
|
prop: "imageinfo",
|
|
64
64
|
iiprop: "url|mime|size|extmetadata",
|
|
65
|
-
|
|
65
|
+
/** Wikimedia serves thumbnails only at standard widths (e.g. 330, 500, 960, 1280); others return HTTP 400. */
|
|
66
|
+
iiurlwidth: "330",
|
|
66
67
|
iiextmetadatafilter: "License|LicenseShortName|Artist|ImageDescription",
|
|
67
68
|
};
|
|
68
69
|
export async function searchCommons(fetchImpl, kind, params) {
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { getJson } from "../http.js";
|
|
2
|
+
import { CC0_LICENSE_URL } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* GBIF occurrence images (https://api.gbif.org/v1, no key): specimen and
|
|
5
|
+
* field photos published by museums, herbaria and other institutions.
|
|
6
|
+
* The query asks for `license=CC0_1_0` and still images. An image is used only
|
|
7
|
+
* when the record's license is CC0 and the image's own license (if given) is CC0.
|
|
8
|
+
*/
|
|
9
|
+
const BASE = "https://api.gbif.org/v1/occurrence";
|
|
10
|
+
const SERVED_BY = "Via GBIF (https://www.gbif.org)";
|
|
11
|
+
const CC0_RE = /creativecommons\.org\/publicdomain\/zero\/1\.0/;
|
|
12
|
+
const isCc0 = (u) => !!u && CC0_RE.test(u);
|
|
13
|
+
/** Images on a CC0 record whose own license is CC0 or unstated (then the record license applies). */
|
|
14
|
+
export function cc0Images(o) {
|
|
15
|
+
if (!isCc0(o.license))
|
|
16
|
+
return [];
|
|
17
|
+
return (o.media ?? []).filter((m) => m.type === "StillImage" && m.identifier && (m.license ? isCc0(m.license) : true));
|
|
18
|
+
}
|
|
19
|
+
export function toAsset(o) {
|
|
20
|
+
const img = cc0Images(o)[0];
|
|
21
|
+
if (!img)
|
|
22
|
+
return null;
|
|
23
|
+
return {
|
|
24
|
+
id: `gbif:${o.key}`,
|
|
25
|
+
kind: "image",
|
|
26
|
+
title: [o.vernacularName, o.scientificName].filter(Boolean).join(" — ") || `Occurrence ${o.key}`,
|
|
27
|
+
creator: img.rightsHolder ?? o.recordedBy ?? o.institutionCode ?? null,
|
|
28
|
+
landingUrl: `https://www.gbif.org/occurrence/${o.key}`,
|
|
29
|
+
fileUrl: img.identifier,
|
|
30
|
+
thumbnailUrl: img.identifier,
|
|
31
|
+
tags: [o.scientificName, o.datasetName, o.institutionCode].filter((t) => !!t),
|
|
32
|
+
provider: "gbif",
|
|
33
|
+
origin: o.institutionCode ?? "gbif.org",
|
|
34
|
+
licenseEvidence: {
|
|
35
|
+
license: "CC0-1.0",
|
|
36
|
+
licenseUrl: CC0_LICENSE_URL,
|
|
37
|
+
method: "per-item-license-field",
|
|
38
|
+
source: `GBIF occurrence license and media license are CC0 (${BASE}/${o.key})`,
|
|
39
|
+
declaredBy: "institution",
|
|
40
|
+
},
|
|
41
|
+
servedBy: SERVED_BY,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export async function searchGbif(fetchImpl, params) {
|
|
45
|
+
const qs = new URLSearchParams({
|
|
46
|
+
q: params.query,
|
|
47
|
+
mediaType: "StillImage",
|
|
48
|
+
license: "CC0_1_0",
|
|
49
|
+
limit: String(params.limit),
|
|
50
|
+
offset: String((params.page - 1) * params.limit),
|
|
51
|
+
});
|
|
52
|
+
const data = await getJson(fetchImpl, "GBIF", `${BASE}/search?${qs}`);
|
|
53
|
+
return { total: data.count, assets: data.results.map(toAsset).filter((a) => a !== null) };
|
|
54
|
+
}
|
|
55
|
+
export async function getGbif(fetchImpl, key) {
|
|
56
|
+
if (!/^\d+$/.test(key))
|
|
57
|
+
return null;
|
|
58
|
+
const o = await getJson(fetchImpl, "GBIF", `${BASE}/${key}`);
|
|
59
|
+
const asset = toAsset(o);
|
|
60
|
+
if (!asset)
|
|
61
|
+
return null;
|
|
62
|
+
return {
|
|
63
|
+
...asset,
|
|
64
|
+
description: o.datasetName ?? null,
|
|
65
|
+
files: cc0Images(o).map((m, i) => ({ label: m.title || `image ${i + 1}`, url: m.identifier, sizeBytes: null })),
|
|
66
|
+
};
|
|
67
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { getJson } from "../http.js";
|
|
2
|
+
import { CC0_LICENSE_URL } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* Iconify icon sets (https://api.iconify.design, no key). Iconify serves 280+
|
|
5
|
+
* open-source icon sets under many licenses. Search is limited to the sets
|
|
6
|
+
* whose own license (from /collections) is CC0-1.0. Logo sets (Simple Icons,
|
|
7
|
+
* cryptocurrency icons...) are CC0 as files, but the logos stay trademarks.
|
|
8
|
+
*/
|
|
9
|
+
const BASE = "https://api.iconify.design";
|
|
10
|
+
const SERVED_BY = "Via Iconify (https://iconify.design)";
|
|
11
|
+
const SETS_TTL_MS = 60 * 60 * 1000;
|
|
12
|
+
let setsCache = null;
|
|
13
|
+
/** Test hook. */
|
|
14
|
+
export function resetIconifyCache() {
|
|
15
|
+
setsCache = null;
|
|
16
|
+
}
|
|
17
|
+
/** Icon sets whose license is CC0-1.0, keyed by prefix. */
|
|
18
|
+
export async function cc0Sets(fetchImpl) {
|
|
19
|
+
if (setsCache && Date.now() - setsCache.at < SETS_TTL_MS)
|
|
20
|
+
return setsCache.sets;
|
|
21
|
+
const all = await getJson(fetchImpl, "Iconify", `${BASE}/collections`);
|
|
22
|
+
const sets = Object.fromEntries(Object.entries(all).filter(([, s]) => s.license?.spdx === "CC0-1.0"));
|
|
23
|
+
setsCache = { at: Date.now(), sets };
|
|
24
|
+
return sets;
|
|
25
|
+
}
|
|
26
|
+
export function toAsset(prefix, name, set) {
|
|
27
|
+
const svg = `${BASE}/${prefix}/${name}.svg`;
|
|
28
|
+
return {
|
|
29
|
+
id: `iconify:${prefix}:${name}`,
|
|
30
|
+
kind: "image",
|
|
31
|
+
title: `${name.replace(/-/g, " ")} — ${set.name}`,
|
|
32
|
+
creator: set.author?.name ?? null,
|
|
33
|
+
landingUrl: `https://icon-sets.iconify.design/${prefix}/${name}/`,
|
|
34
|
+
fileUrl: svg,
|
|
35
|
+
thumbnailUrl: svg,
|
|
36
|
+
tags: [set.name, set.category, "icon", "svg"].filter((t) => !!t),
|
|
37
|
+
provider: "iconify",
|
|
38
|
+
origin: set.author?.url ?? "iconify.design",
|
|
39
|
+
licenseEvidence: {
|
|
40
|
+
license: "CC0-1.0",
|
|
41
|
+
licenseUrl: set.license?.url ?? CC0_LICENSE_URL,
|
|
42
|
+
method: "whole-library-cc0",
|
|
43
|
+
source: `Iconify /collections lists icon set "${prefix}" with license CC0-1.0`,
|
|
44
|
+
declaredBy: "library",
|
|
45
|
+
},
|
|
46
|
+
servedBy: SERVED_BY,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
export async function searchIconify(fetchImpl, params) {
|
|
50
|
+
const sets = await cc0Sets(fetchImpl);
|
|
51
|
+
const prefixes = Object.keys(sets);
|
|
52
|
+
if (!prefixes.length)
|
|
53
|
+
return { total: 0, assets: [] };
|
|
54
|
+
// The search API has no offset; ask for enough results to cover the requested page.
|
|
55
|
+
const want = params.limit * params.page;
|
|
56
|
+
const qs = new URLSearchParams({ query: params.query, prefixes: prefixes.join(","), limit: String(Math.max(32, want)) });
|
|
57
|
+
const data = await getJson(fetchImpl, "Iconify", `${BASE}/search?${qs}`);
|
|
58
|
+
const page = data.icons.slice((params.page - 1) * params.limit, want);
|
|
59
|
+
const assets = page.flatMap((full) => {
|
|
60
|
+
const [prefix, name] = full.split(":");
|
|
61
|
+
return sets[prefix] && name ? [toAsset(prefix, name, sets[prefix])] : [];
|
|
62
|
+
});
|
|
63
|
+
return { total: data.total, assets };
|
|
64
|
+
}
|
|
65
|
+
export async function getIconify(fetchImpl, prefix, name) {
|
|
66
|
+
if (!/^[a-z0-9-]+$/.test(prefix) || !/^[a-z0-9-]+$/.test(name))
|
|
67
|
+
return null;
|
|
68
|
+
const sets = await cc0Sets(fetchImpl);
|
|
69
|
+
const set = sets[prefix];
|
|
70
|
+
if (!set)
|
|
71
|
+
return null;
|
|
72
|
+
const asset = toAsset(prefix, name, set);
|
|
73
|
+
return {
|
|
74
|
+
...asset,
|
|
75
|
+
description: set.category === "Logos" ? "Logo icon: the SVG file is CC0, but the logo is a trademark of its owner." : null,
|
|
76
|
+
files: [
|
|
77
|
+
{ label: "SVG", url: asset.fileUrl, sizeBytes: null },
|
|
78
|
+
{ label: "SVG 256px (fixed size)", url: `${asset.fileUrl}?height=256`, sizeBytes: null },
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { getJson } from "../http.js";
|
|
2
|
+
import { CC0_LICENSE_URL } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* iNaturalist observations (https://api.inaturalist.org/v1, no key).
|
|
5
|
+
* Observers choose a license per photo. The query asks for `photo_license=cc0`,
|
|
6
|
+
* and only photos whose own `license_code` is "cc0" are used.
|
|
7
|
+
*/
|
|
8
|
+
const BASE = "https://api.inaturalist.org/v1/observations";
|
|
9
|
+
const SERVED_BY = "Via iNaturalist (https://www.inaturalist.org)";
|
|
10
|
+
/** Photo URLs come in sizes (square, small, medium, large, original); swap the size segment. */
|
|
11
|
+
export const sized = (url, size) => url.replace(/\/(square|small|medium|large|original)\./, `/${size}.`);
|
|
12
|
+
const cc0Photos = (o) => (o.photos ?? []).filter((p) => p.license_code === "cc0");
|
|
13
|
+
export function toAsset(o) {
|
|
14
|
+
const photo = cc0Photos(o)[0];
|
|
15
|
+
if (!photo)
|
|
16
|
+
return null;
|
|
17
|
+
const common = o.taxon?.preferred_common_name;
|
|
18
|
+
const name = o.taxon?.name;
|
|
19
|
+
return {
|
|
20
|
+
id: `inaturalist:${o.id}`,
|
|
21
|
+
kind: "image",
|
|
22
|
+
title: [common ?? o.species_guess, name && name !== common ? `(${name})` : null].filter(Boolean).join(" ") || `Observation ${o.id}`,
|
|
23
|
+
creator: o.user?.name || o.user?.login || null,
|
|
24
|
+
landingUrl: o.uri,
|
|
25
|
+
fileUrl: sized(photo.url, "original"),
|
|
26
|
+
thumbnailUrl: sized(photo.url, "medium"),
|
|
27
|
+
tags: [name, common].filter((t) => !!t),
|
|
28
|
+
provider: "inaturalist",
|
|
29
|
+
origin: "inaturalist.org",
|
|
30
|
+
licenseEvidence: {
|
|
31
|
+
license: "CC0-1.0",
|
|
32
|
+
licenseUrl: CC0_LICENSE_URL,
|
|
33
|
+
method: "per-item-license-field",
|
|
34
|
+
source: `iNaturalist photo license_code="cc0" (${BASE}/${o.id})`,
|
|
35
|
+
declaredBy: "uploader",
|
|
36
|
+
},
|
|
37
|
+
servedBy: SERVED_BY,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export async function searchINaturalist(fetchImpl, params) {
|
|
41
|
+
const qs = new URLSearchParams({
|
|
42
|
+
q: params.query,
|
|
43
|
+
photo_license: "cc0",
|
|
44
|
+
photos: "true",
|
|
45
|
+
quality_grade: "research",
|
|
46
|
+
per_page: String(params.limit),
|
|
47
|
+
page: String(params.page),
|
|
48
|
+
});
|
|
49
|
+
const data = await getJson(fetchImpl, "iNaturalist", `${BASE}?${qs}`);
|
|
50
|
+
return { total: data.total_results, assets: data.results.map(toAsset).filter((a) => a !== null) };
|
|
51
|
+
}
|
|
52
|
+
export async function getINaturalist(fetchImpl, id) {
|
|
53
|
+
if (!/^\d+$/.test(id))
|
|
54
|
+
return null;
|
|
55
|
+
const data = await getJson(fetchImpl, "iNaturalist", `${BASE}/${id}`);
|
|
56
|
+
const o = data.results[0];
|
|
57
|
+
const asset = o ? toAsset(o) : null;
|
|
58
|
+
if (!o || !asset)
|
|
59
|
+
return null;
|
|
60
|
+
return {
|
|
61
|
+
...asset,
|
|
62
|
+
description: null,
|
|
63
|
+
files: cc0Photos(o).map((p, i) => ({
|
|
64
|
+
label: `photo ${i + 1}${p.original_dimensions ? ` (${p.original_dimensions.width}×${p.original_dimensions.height})` : ""}`,
|
|
65
|
+
url: sized(p.url, "original"),
|
|
66
|
+
sizeBytes: null,
|
|
67
|
+
})),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import { getJson } from "../http.js";
|
|
2
|
+
import { CC0_LICENSE_URL } from "../types.js";
|
|
3
|
+
/**
|
|
4
|
+
* PhyloPic silhouettes of organisms (https://api.phylopic.org, no key).
|
|
5
|
+
* Contributors choose a license per image; only images whose license link is
|
|
6
|
+
* the CC0 1.0 deed are used. Search matches taxon names (often scientific
|
|
7
|
+
* names, e.g. "vulpes"), not free text.
|
|
8
|
+
*/
|
|
9
|
+
const BASE = "https://api.phylopic.org";
|
|
10
|
+
const SERVED_BY = "Via PhyloPic (https://www.phylopic.org)";
|
|
11
|
+
const ACCEPT = { Accept: "application/vnd.phylopic.v2+json" };
|
|
12
|
+
const CC0_RE = /creativecommons\.org\/publicdomain\/zero\/1\.0/;
|
|
13
|
+
/** The API versions its data by "build"; requests must name the current one. */
|
|
14
|
+
const BUILD_TTL_MS = 60 * 60 * 1000;
|
|
15
|
+
let buildCache = null;
|
|
16
|
+
/** Test hook. */
|
|
17
|
+
export function resetPhylopicCache() {
|
|
18
|
+
buildCache = null;
|
|
19
|
+
}
|
|
20
|
+
async function currentBuild(fetchImpl) {
|
|
21
|
+
if (buildCache && Date.now() - buildCache.at < BUILD_TTL_MS)
|
|
22
|
+
return buildCache.build;
|
|
23
|
+
const root = await getJson(fetchImpl, "PhyloPic", `${BASE}/`, ACCEPT);
|
|
24
|
+
buildCache = { at: Date.now(), build: root.build };
|
|
25
|
+
return root.build;
|
|
26
|
+
}
|
|
27
|
+
export const isCc0 = (img) => CC0_RE.test(img._links.license?.href ?? "");
|
|
28
|
+
/** Largest raster file, then the vector, as the primary file. */
|
|
29
|
+
function bestFile(img) {
|
|
30
|
+
const raster = [...(img._links.rasterFiles ?? [])].sort((a, b) => parseInt(b.sizes ?? "0") - parseInt(a.sizes ?? "0"))[0];
|
|
31
|
+
return raster?.href ?? img._links.vectorFile?.href ?? null;
|
|
32
|
+
}
|
|
33
|
+
export function toAsset(img) {
|
|
34
|
+
const thumb = [...(img._links.thumbnailFiles ?? [])].sort((a, b) => parseInt(b.sizes ?? "0") - parseInt(a.sizes ?? "0"))[0];
|
|
35
|
+
const taxon = img._links.specificNode?.title ?? img._links.self.title ?? "Silhouette";
|
|
36
|
+
return {
|
|
37
|
+
id: `phylopic:${img.uuid}`,
|
|
38
|
+
kind: "image",
|
|
39
|
+
title: `${taxon} (silhouette)`,
|
|
40
|
+
creator: img.attribution ?? img._links.contributor?.title ?? null,
|
|
41
|
+
landingUrl: `https://www.phylopic.org/images/${img.uuid}`,
|
|
42
|
+
fileUrl: bestFile(img),
|
|
43
|
+
thumbnailUrl: thumb?.href ?? null,
|
|
44
|
+
tags: [taxon, "silhouette"],
|
|
45
|
+
provider: "phylopic",
|
|
46
|
+
origin: "phylopic.org",
|
|
47
|
+
licenseEvidence: {
|
|
48
|
+
license: "CC0-1.0",
|
|
49
|
+
licenseUrl: CC0_LICENSE_URL,
|
|
50
|
+
method: "per-item-license-field",
|
|
51
|
+
source: `PhyloPic image license link is the CC0 deed (${BASE}/images/${img.uuid})`,
|
|
52
|
+
declaredBy: "uploader",
|
|
53
|
+
},
|
|
54
|
+
servedBy: SERVED_BY,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
export async function searchPhylopic(fetchImpl, params) {
|
|
58
|
+
const name = params.query.toLowerCase().replace(/[^a-z\s-]/g, " ").replace(/\s+/g, " ").trim();
|
|
59
|
+
if (!name)
|
|
60
|
+
return { total: 0, assets: [] };
|
|
61
|
+
const build = await currentBuild(fetchImpl);
|
|
62
|
+
const qs = new URLSearchParams({
|
|
63
|
+
build: String(build),
|
|
64
|
+
filter_name: name,
|
|
65
|
+
// Exclude licenses that add conditions; CC0 and Public Domain Mark remain, and PDM is filtered out below.
|
|
66
|
+
filter_license_by: "false",
|
|
67
|
+
filter_license_nc: "false",
|
|
68
|
+
filter_license_sa: "false",
|
|
69
|
+
page: String(params.page - 1),
|
|
70
|
+
embed_items: "true",
|
|
71
|
+
});
|
|
72
|
+
const data = await getJson(fetchImpl, "PhyloPic", `${BASE}/images?${qs}`, ACCEPT);
|
|
73
|
+
const items = (data._embedded?.items ?? []).filter(isCc0).slice(0, params.limit);
|
|
74
|
+
return { total: data.totalItems ?? items.length, assets: items.map(toAsset) };
|
|
75
|
+
}
|
|
76
|
+
export async function getPhylopic(fetchImpl, uuid) {
|
|
77
|
+
if (!/^[0-9a-f-]{36}$/.test(uuid))
|
|
78
|
+
return null;
|
|
79
|
+
const build = await currentBuild(fetchImpl);
|
|
80
|
+
const img = await getJson(fetchImpl, "PhyloPic", `${BASE}/images/${uuid}?build=${build}`, ACCEPT);
|
|
81
|
+
if (!isCc0(img))
|
|
82
|
+
return null;
|
|
83
|
+
const files = [
|
|
84
|
+
...(img._links.vectorFile ? [{ label: "vector (SVG)", url: img._links.vectorFile.href, sizeBytes: null }] : []),
|
|
85
|
+
...(img._links.rasterFiles ?? []).map((f) => ({ label: `raster ${f.sizes ?? ""} (PNG)`.trim(), url: f.href, sizeBytes: null })),
|
|
86
|
+
];
|
|
87
|
+
return { ...toAsset(img), description: null, files };
|
|
88
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { getJson } from "../http.js";
|
|
2
|
+
import { sanitizeQuery } from "./archive.js";
|
|
3
|
+
import { CC0_LICENSE_URL } from "../types.js";
|
|
4
|
+
/**
|
|
5
|
+
* Zenodo research records (https://zenodo.org/api, no key): figures, photos
|
|
6
|
+
* and videos deposited by researchers. The query requires
|
|
7
|
+
* `metadata.rights.id:cc0-1.0`, and each record must report license "cc-zero".
|
|
8
|
+
*/
|
|
9
|
+
const BASE = "https://zenodo.org/api/records";
|
|
10
|
+
const SERVED_BY = "Via Zenodo (https://zenodo.org)";
|
|
11
|
+
export const isCc0 = (r) => r.metadata.license?.id === "cc-zero";
|
|
12
|
+
const IMAGE_FILE = /\.(png|jpe?g|gif|webp|tiff?|svg)$/i;
|
|
13
|
+
export function toAsset(r) {
|
|
14
|
+
const kind = r.metadata.resource_type?.type === "video" ? "video" : "image";
|
|
15
|
+
const preview = (r.files ?? []).find((f) => IMAGE_FILE.test(f.key));
|
|
16
|
+
return {
|
|
17
|
+
id: `zenodo:${r.id}`,
|
|
18
|
+
kind,
|
|
19
|
+
title: r.metadata.title,
|
|
20
|
+
creator: (r.metadata.creators ?? []).map((c) => c.name).slice(0, 3).join("; ") || null,
|
|
21
|
+
landingUrl: r.links.self_html ?? `https://zenodo.org/records/${r.id}`,
|
|
22
|
+
fileUrl: (preview ?? r.files?.[0])?.links.self ?? null,
|
|
23
|
+
thumbnailUrl: preview?.links.self ?? null,
|
|
24
|
+
tags: (r.metadata.keywords ?? []).slice(0, 20),
|
|
25
|
+
provider: "zenodo",
|
|
26
|
+
origin: "zenodo.org",
|
|
27
|
+
licenseEvidence: {
|
|
28
|
+
license: "CC0-1.0",
|
|
29
|
+
licenseUrl: CC0_LICENSE_URL,
|
|
30
|
+
method: "per-item-license-field",
|
|
31
|
+
source: `Zenodo record license "cc-zero" (${BASE}/${r.id})`,
|
|
32
|
+
declaredBy: "uploader",
|
|
33
|
+
},
|
|
34
|
+
servedBy: SERVED_BY,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
export async function searchZenodo(fetchImpl, kind, params) {
|
|
38
|
+
const words = sanitizeQuery(params.query);
|
|
39
|
+
if (!words)
|
|
40
|
+
return { total: 0, assets: [] };
|
|
41
|
+
const qs = new URLSearchParams({ q: `(${words}) AND metadata.rights.id:cc0-1.0`, size: String(params.limit), page: String(params.page) });
|
|
42
|
+
if (kind !== "all")
|
|
43
|
+
qs.set("type", kind);
|
|
44
|
+
else {
|
|
45
|
+
qs.append("type", "image");
|
|
46
|
+
qs.append("type", "video");
|
|
47
|
+
}
|
|
48
|
+
const data = await getJson(fetchImpl, "Zenodo", `${BASE}?${qs}`);
|
|
49
|
+
return { total: data.hits.total, assets: data.hits.hits.filter(isCc0).map(toAsset) };
|
|
50
|
+
}
|
|
51
|
+
export async function getZenodo(fetchImpl, id) {
|
|
52
|
+
if (!/^\d+$/.test(id))
|
|
53
|
+
return null;
|
|
54
|
+
const r = await getJson(fetchImpl, "Zenodo", `${BASE}/${id}`);
|
|
55
|
+
if (!isCc0(r))
|
|
56
|
+
return null;
|
|
57
|
+
return {
|
|
58
|
+
...toAsset(r),
|
|
59
|
+
description: r.metadata.description?.replace(/<[^>]*>/g, " ").replace(/\s+/g, " ").trim().slice(0, 500) || null,
|
|
60
|
+
files: (r.files ?? []).map((f) => ({ label: f.key, url: f.links.self, sizeBytes: f.size ?? null })),
|
|
61
|
+
};
|
|
62
|
+
}
|
package/dist/search.js
CHANGED
|
@@ -11,6 +11,13 @@ import { getCommons, searchCommons } from "./providers/commons.js";
|
|
|
11
11
|
import { getArchive, searchArchive } from "./providers/archive.js";
|
|
12
12
|
import { getSketchfab, searchSketchfab } from "./providers/sketchfab.js";
|
|
13
13
|
import { getWpPhoto, searchWpPhotos } from "./providers/wpphotos.js";
|
|
14
|
+
import { getINaturalist, searchINaturalist } from "./providers/inaturalist.js";
|
|
15
|
+
import { getGbif, searchGbif } from "./providers/gbif.js";
|
|
16
|
+
import { getPhylopic, searchPhylopic } from "./providers/phylopic.js";
|
|
17
|
+
import { getIconify, searchIconify } from "./providers/iconify.js";
|
|
18
|
+
import { getZenodo, searchZenodo } from "./providers/zenodo.js";
|
|
19
|
+
import { getGithub, getHuggingface, searchGithub, searchHuggingface } from "./providers/collections.js";
|
|
20
|
+
import { getBlenderkit, searchBlenderkit } from "./providers/blenderkit.js";
|
|
14
21
|
/**
|
|
15
22
|
* Runs one search across the providers that serve `kind`. With kind "any",
|
|
16
23
|
* results from each provider are interleaved so one provider cannot crowd
|
|
@@ -40,8 +47,26 @@ export async function search(fetchImpl, query, kind, limit, page, options = {})
|
|
|
40
47
|
}
|
|
41
48
|
if (kind === "model" || kind === "any")
|
|
42
49
|
all.push({ name: "sketchfab", run: () => searchSketchfab(fetchImpl, params) });
|
|
43
|
-
if (kind === "image" || kind === "any")
|
|
50
|
+
if (kind === "image" || kind === "any") {
|
|
44
51
|
all.push({ name: "wpphotos", run: () => searchWpPhotos(fetchImpl, params) });
|
|
52
|
+
all.push({ name: "inaturalist", run: () => searchINaturalist(fetchImpl, params) });
|
|
53
|
+
all.push({ name: "gbif", run: () => searchGbif(fetchImpl, params) });
|
|
54
|
+
all.push({ name: "phylopic", run: () => searchPhylopic(fetchImpl, params) });
|
|
55
|
+
all.push({ name: "iconify", run: () => searchIconify(fetchImpl, params) });
|
|
56
|
+
}
|
|
57
|
+
if (kind === "image" || kind === "video" || kind === "any") {
|
|
58
|
+
const k = kind === "any" ? "all" : kind;
|
|
59
|
+
all.push({ name: "zenodo", run: () => searchZenodo(fetchImpl, k, params) });
|
|
60
|
+
}
|
|
61
|
+
if (kind === "hdri" || kind === "texture" || kind === "model" || kind === "any") {
|
|
62
|
+
const k = kind === "any" ? "all" : kind;
|
|
63
|
+
all.push({ name: "blenderkit", run: () => searchBlenderkit(fetchImpl, k, params) });
|
|
64
|
+
}
|
|
65
|
+
// Collections only on request: GitHub allows 10 unauthenticated searches a minute.
|
|
66
|
+
if (kind === "collection") {
|
|
67
|
+
all.push({ name: "github", run: () => searchGithub(fetchImpl, params) });
|
|
68
|
+
all.push({ name: "huggingface", run: () => searchHuggingface(fetchImpl, params) });
|
|
69
|
+
}
|
|
45
70
|
const skip = new Set(options.skip ?? []);
|
|
46
71
|
const run = all.filter((j) => !skip.has(j.name.split(":")[0]));
|
|
47
72
|
const settled = await Promise.allSettled(run.map((j) => j.run()));
|
|
@@ -71,13 +96,17 @@ export function interleave(lists) {
|
|
|
71
96
|
/**
|
|
72
97
|
* Resolves ids produced by `search`: `openverse:image:<uuid>`, `openverse:audio:<uuid>`,
|
|
73
98
|
* `polyhaven:<slug>`, `ambientcg:<assetId>`, `cleveland:<number>`, `met:<number>`,
|
|
74
|
-
* `commons:<pageid>`, `archive:<identifier>`, `sketchfab:<uid>`, `wpphotos:<number
|
|
99
|
+
* `commons:<pageid>`, `archive:<identifier>`, `sketchfab:<uid>`, `wpphotos:<number>`,
|
|
100
|
+
* `inaturalist:<number>`, `gbif:<number>`, `phylopic:<uuid>`, `iconify:<set>:<icon>`, `zenodo:<number>`,
|
|
101
|
+
* `github:<owner>/<repo>`, `huggingface:<owner>/<dataset>`, `blenderkit:<uuid>`.
|
|
75
102
|
*/
|
|
76
103
|
export async function getAsset(fetchImpl, id) {
|
|
77
104
|
const parts = id.split(":");
|
|
78
105
|
const [provider, a, b] = parts;
|
|
79
106
|
if (parts.length === 3 && provider === "openverse" && (a === "image" || a === "audio") && b)
|
|
80
107
|
return getOpenverse(fetchImpl, a, b);
|
|
108
|
+
if (parts.length === 3 && provider === "iconify" && a && b)
|
|
109
|
+
return getIconify(fetchImpl, a, b);
|
|
81
110
|
if (parts.length !== 2 || !a)
|
|
82
111
|
return null;
|
|
83
112
|
if (provider === "polyhaven")
|
|
@@ -96,5 +125,19 @@ export async function getAsset(fetchImpl, id) {
|
|
|
96
125
|
return getSketchfab(fetchImpl, a);
|
|
97
126
|
if (provider === "wpphotos")
|
|
98
127
|
return getWpPhoto(fetchImpl, a);
|
|
128
|
+
if (provider === "inaturalist")
|
|
129
|
+
return getINaturalist(fetchImpl, a);
|
|
130
|
+
if (provider === "gbif")
|
|
131
|
+
return getGbif(fetchImpl, a);
|
|
132
|
+
if (provider === "phylopic")
|
|
133
|
+
return getPhylopic(fetchImpl, a);
|
|
134
|
+
if (provider === "zenodo")
|
|
135
|
+
return getZenodo(fetchImpl, a);
|
|
136
|
+
if (provider === "github")
|
|
137
|
+
return getGithub(fetchImpl, a);
|
|
138
|
+
if (provider === "huggingface")
|
|
139
|
+
return getHuggingface(fetchImpl, a);
|
|
140
|
+
if (provider === "blenderkit")
|
|
141
|
+
return getBlenderkit(fetchImpl, a);
|
|
99
142
|
return null;
|
|
100
143
|
}
|
package/dist/server.js
CHANGED
|
@@ -5,10 +5,13 @@ import { getAsset, loadCatalog, search } from "./library.js";
|
|
|
5
5
|
import { ASSET_KINDS, CATALOG_KINDS, PROVIDER_IDS } from "./types.js";
|
|
6
6
|
/** Poly Haven textures can list 100+ map/resolution/format files; keep replies readable. */
|
|
7
7
|
const MAX_FILES_IN_REPLY = 60;
|
|
8
|
-
const KIND_HELP = "Asset type. image
|
|
9
|
-
"
|
|
10
|
-
"
|
|
11
|
-
"
|
|
8
|
+
const KIND_HELP = "Asset type. image: Openverse, Wikimedia Commons, Internet Archive, WordPress Photo Directory, iNaturalist and GBIF " +
|
|
9
|
+
"(nature photos), PhyloPic (organism silhouettes; search by taxon name), Iconify (CC0 icon sets), Zenodo (research figures). " +
|
|
10
|
+
"audio: Openverse, Commons, Internet Archive. video: Commons, Internet Archive, Zenodo. " +
|
|
11
|
+
"hdri, texture: Poly Haven, ambientCG, BlenderKit. model: Poly Haven, ambientCG, Sketchfab, BlenderKit. " +
|
|
12
|
+
"artwork: public-domain works from the Cleveland Museum of Art and The Met. " +
|
|
13
|
+
"collection: whole CC0 GitHub repositories and Hugging Face datasets (only when asked for; not part of 'any'). " +
|
|
14
|
+
"any (default): every kind except collection, interleaved.";
|
|
12
15
|
// ---------- output schemas: every returned field is documented here ----------
|
|
13
16
|
const licenseEvidenceSchema = z
|
|
14
17
|
.object({
|
|
@@ -85,15 +88,15 @@ const result = (value) => ({
|
|
|
85
88
|
});
|
|
86
89
|
const fail = (message) => ({ content: [{ type: "text", text: message }], isError: true });
|
|
87
90
|
export function createServer(fetchImpl = defaultFetch) {
|
|
88
|
-
const server = new McpServer({ name: "cc0-library", version: "0.1
|
|
91
|
+
const server = new McpServer({ name: "cc0-library", version: "0.2.1" });
|
|
89
92
|
server.registerTool("search_assets", {
|
|
90
|
-
title: "Search CC0 assets across
|
|
93
|
+
title: "Search CC0 assets across 17 sources",
|
|
91
94
|
description: "Find CC0 1.0 (public-domain dedication) images, audio, video, HDRIs, textures, 3D models and museum artworks by keyword, " +
|
|
92
95
|
"returning only items whose CC0 status was checked. " +
|
|
93
96
|
"Use it first to discover candidates; then call get_asset for download files and a fresh license re-check. " +
|
|
94
97
|
"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. " +
|
|
95
98
|
"Behavior: read-only, no API key, live HTTPS calls to each source (usually 2-10 s). A failing source is listed in `errors` while the others still return. " +
|
|
96
|
-
"Results from uploader-driven sites (Openverse, Commons, Internet Archive, Sketchfab, WordPress Photo Directory) carry licenseEvidence.declaredBy='uploader': " +
|
|
99
|
+
"Results from uploader-driven sites (Openverse, Commons, Internet Archive, Sketchfab, WordPress Photo Directory, iNaturalist, PhyloPic, Zenodo, BlenderKit, GitHub, Hugging Face) carry licenseEvidence.declaredBy='uploader': " +
|
|
97
100
|
"tell the user to confirm the uploader owns the work. Show each item's servedBy credit with the results.",
|
|
98
101
|
inputSchema: {
|
|
99
102
|
query: z.string().min(1).max(200).describe("Keywords in any language, matched against titles and tags, e.g. 'rainy street' or 'brick wall'"),
|
|
@@ -129,7 +132,9 @@ export function createServer(fetchImpl = defaultFetch) {
|
|
|
129
132
|
.min(1)
|
|
130
133
|
.max(120)
|
|
131
134
|
.describe("Asset id exactly as returned by search_assets: openverse:image:<uuid>, openverse:audio:<uuid>, polyhaven:<slug>, " +
|
|
132
|
-
"ambientcg:<assetId>, cleveland:<number>, met:<number>, commons:<pageid>, archive:<identifier>, sketchfab:<uid
|
|
135
|
+
"ambientcg:<assetId>, cleveland:<number>, met:<number>, commons:<pageid>, archive:<identifier>, sketchfab:<uid>, wpphotos:<number>, " +
|
|
136
|
+
"inaturalist:<number>, gbif:<number>, phylopic:<uuid>, iconify:<set>:<icon>, zenodo:<number>, github:<owner>/<repo>, " +
|
|
137
|
+
"huggingface:<owner>/<dataset> or blenderkit:<uuid>"),
|
|
133
138
|
},
|
|
134
139
|
outputSchema: getOutput,
|
|
135
140
|
annotations: { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: true },
|
package/dist/types.js
CHANGED
|
@@ -5,9 +5,14 @@
|
|
|
5
5
|
* status of that specific item. `licenseEvidence` records how that was
|
|
6
6
|
* confirmed, so a caller can re-check it instead of trusting this library.
|
|
7
7
|
*/
|
|
8
|
-
/**
|
|
9
|
-
|
|
8
|
+
/**
|
|
9
|
+
* `artwork` = photos of public-domain museum works (Cleveland Museum of Art, The Met).
|
|
10
|
+
* `collection` = a pack of many assets in one place (a CC0 GitHub repository or Hugging Face dataset).
|
|
11
|
+
*/
|
|
12
|
+
export const ASSET_KINDS = ["image", "audio", "video", "hdri", "texture", "model", "artwork", "collection"];
|
|
10
13
|
/** Kinds a catalog source may list. `font` is catalog-only: no search provider serves fonts. */
|
|
11
14
|
export const CATALOG_KINDS = [...ASSET_KINDS, "font"];
|
|
12
|
-
export const PROVIDER_IDS = ["openverse", "polyhaven", "ambientcg", "cleveland", "met", "commons", "archive", "sketchfab", "wpphotos"
|
|
15
|
+
export const PROVIDER_IDS = ["openverse", "polyhaven", "ambientcg", "cleveland", "met", "commons", "archive", "sketchfab", "wpphotos",
|
|
16
|
+
"inaturalist", "gbif", "phylopic", "iconify", "zenodo", "huggingface", "github", "blenderkit",
|
|
17
|
+
];
|
|
13
18
|
export const CC0_LICENSE_URL = "https://creativecommons.org/publicdomain/zero/1.0/";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cc0-library-mcp",
|
|
3
|
-
"version": "0.1
|
|
3
|
+
"version": "0.2.1",
|
|
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",
|