karanfillabs-mcp 0.1.0__tar.gz
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.
- karanfillabs_mcp-0.1.0/LICENSE +21 -0
- karanfillabs_mcp-0.1.0/PKG-INFO +121 -0
- karanfillabs_mcp-0.1.0/README.md +97 -0
- karanfillabs_mcp-0.1.0/karanfillabs_mcp.egg-info/PKG-INFO +121 -0
- karanfillabs_mcp-0.1.0/karanfillabs_mcp.egg-info/SOURCES.txt +10 -0
- karanfillabs_mcp-0.1.0/karanfillabs_mcp.egg-info/dependency_links.txt +1 -0
- karanfillabs_mcp-0.1.0/karanfillabs_mcp.egg-info/entry_points.txt +2 -0
- karanfillabs_mcp-0.1.0/karanfillabs_mcp.egg-info/requires.txt +2 -0
- karanfillabs_mcp-0.1.0/karanfillabs_mcp.egg-info/top_level.txt +1 -0
- karanfillabs_mcp-0.1.0/karanfillabs_mcp.py +158 -0
- karanfillabs_mcp-0.1.0/pyproject.toml +48 -0
- karanfillabs_mcp-0.1.0/setup.cfg +4 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Karanfil Labs
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: karanfillabs-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official MCP Server for Karanfil Labs Visual DNA API — Identify movies and TV episodes from video frames or English scene descriptions.
|
|
5
|
+
Author-email: Karanfil Labs <info@karanfillabs.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://karanfillabs.com
|
|
8
|
+
Project-URL: Documentation, https://api.karanfillabs.com/docs
|
|
9
|
+
Project-URL: Repository, https://github.com/karanfillabs/karanfillabs-mcp
|
|
10
|
+
Keywords: mcp,model-context-protocol,karanfillabs,movie-recognition,video-search,clip,anti-piracy,visual-search
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: mcp>=1.2.0
|
|
22
|
+
Requires-Dist: httpx>=0.27.0
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Karanfil Labs — Visual DNA MCP Server
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
Official **Model Context Protocol (MCP)** server for the **[Karanfil Labs Visual DNA API](https://karanfillabs.com)** — enabling **Claude Desktop**, **Cursor**, **Windsurf**, and any MCP-compatible AI agent to identify movies & TV episodes from video frames or search across **88M+ 768-d visual fingerprints** using plain-language prompts.
|
|
30
|
+
|
|
31
|
+
[🇬🇧 English Guide](#-english-guide) • [🇹🇷 Türkçe Kılavuz](#-türkçe-kılavuz) • [🌐 Live Demo & API Key](https://karanfillabs.com) • [📖 Swagger Docs](https://api.karanfillabs.com/docs)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🇬🇧 English Guide
|
|
36
|
+
|
|
37
|
+
### Available MCP Tools
|
|
38
|
+
1. **`identify_scene_from_image`** — Identify the movie or TV episode (`SxxExx`), release year, `tmdb_id`, and similarity confidence from any local screenshot file path (`PNG`, `JPG`, `WEBP`) or direct image URL (`POST /v1/identify`). Works even on cropped or subtitled frames.
|
|
39
|
+
2. **`search_scenes_by_text`** — Semantic text-to-scene discovery across millions of cinema and TV frames using natural English descriptions like *"rainy neon street car chase"* (`POST /v1/search`).
|
|
40
|
+
3. **`check_visual_dna_status`** — Keyless health check returning live server status and real-time indexed 768-d vector count (`GET /health`).
|
|
41
|
+
|
|
42
|
+
### Privacy & Catalog Note
|
|
43
|
+
* **Volatile RAM Processing:** Submitted image frames are converted into 768-d mathematical vectors strictly in volatile server RAM and discarded immediately — zero full images or copyrighted videos are hosted or written to disk.
|
|
44
|
+
* **Growing Catalog & Thresholds:** While 88M+ frame vectors are online (heavily covering TV series, anime, and feature films), not every movie ever made is indexed yet. True matches from indexed titles typically score **82% – 95%+**; scores below **80%** indicate closest visual similarity when a title is not yet in the index.
|
|
45
|
+
|
|
46
|
+
### 1. Get Your Free API Key (50 Free Credits)
|
|
47
|
+
Sign up in 15 seconds at **[karanfillabs.com/#portal](https://karanfillabs.com/#portal)** (no credit card required) to receive **50 free API test credits** and your `kl_live_...` key.
|
|
48
|
+
|
|
49
|
+
### 2. Quick Configuration (Claude Desktop / Cursor / Windsurf)
|
|
50
|
+
|
|
51
|
+
Requires [`uv`](https://docs.astral.sh/uv/) (`pip install uv` or `brew install uv`). Add the following block to your `claude_desktop_config.json` or `.cursor/mcp.json`:
|
|
52
|
+
|
|
53
|
+
**Option A — Run directly from GitHub (Works Immediately):**
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"karanfillabs": {
|
|
58
|
+
"command": "uvx",
|
|
59
|
+
"args": [
|
|
60
|
+
"--from",
|
|
61
|
+
"git+[https://github.com/karanfillabs/karanfillabs-mcp](https://github.com/karanfillabs/karanfillabs-mcp)",
|
|
62
|
+
"karanfillabs-mcp"
|
|
63
|
+
],
|
|
64
|
+
"env": {
|
|
65
|
+
"KARANFIL_API_KEY": "kl_live_your_api_key_here"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Option B — Run from PyPI (Once published on PyPI):**
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"karanfillabs": {
|
|
77
|
+
"command": "uvx",
|
|
78
|
+
"args": ["karanfillabs-mcp"],
|
|
79
|
+
"env": {
|
|
80
|
+
"KARANFIL_API_KEY": "kl_live_your_api_key_here"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Example Prompts in Claude or Cursor
|
|
88
|
+
* *"Check Karanfil Labs Visual DNA server status and how many vectors are online."*
|
|
89
|
+
* *"Identify the movie or series episode in `/Users/alex/Desktop/frame.jpg` using Karanfil Labs."*
|
|
90
|
+
* *"Search Karanfil Labs for cinema scenes matching 'spaceship approaching a black hole'."*
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 🇹🇷 Türkçe Kılavuz
|
|
95
|
+
|
|
96
|
+
**[Karanfil Labs Visual DNA API](https://karanfillabs.com)** için resmi **Model Context Protocol (MCP)** köprü paketi. Tek satır kod yazmadan **Claude Desktop**, **Cursor** ve **Windsurf** içerisinden bilgisayarınızdaki bir film/dizi karesini taratabilir veya **88M+ adet 768 boyutlu görsel parmak izi** arasında sahne araması yapabilirsiniz.
|
|
97
|
+
|
|
98
|
+
### Sunulan Araçlar (Tools)
|
|
99
|
+
1. **`identify_scene_from_image`** — Bilgisayarınızdaki bir ekran görüntüsü yolundan (`PNG`, `JPG`, `WEBP`) veya doğrudan görsel bağlantısından hangi film/dizi bölümü (`SxxExx`) olduğunu, yılını, `tmdb_id` bilgisini ve güven skorunu döndürür (`POST /v1/identify`).
|
|
100
|
+
2. **`search_scenes_by_text`** — Doğal dil sahne tarifleriyle milyonlarca sinema/dizi karesi içinde anlamsal sahne araması yapar (`POST /v1/search`). Türkçe yazsanız bile yapay zeka asistanınız tarifi otomatik İngilizceye çevirerek sorgular.
|
|
101
|
+
3. **`check_visual_dna_status`** — Anahtar gerektirmeden sunucu sağlık durumunu ve o an aktif olan canlı vektör sayısını döndürür (`GET /health`).
|
|
102
|
+
|
|
103
|
+
### Gizlilik ve Katalog Notu
|
|
104
|
+
* **Anlık RAM İşleme (KVKK / GDPR Uyumlu):** Gönderilen kareler yalnızca geçici sunucu belleğinde (RAM) 768 boyutlu vektöre çevrilip salisesinde silinir; diske ham görsel yazılmaz ve telifli video barındırılmaz.
|
|
105
|
+
* **Büyüyen Katalog ve Skor Eşiği:** Katalogda 88M+ kare vektörü aktif olsa da henüz tarihteki tüm filmler indekslenmemiştir. İndekste bulunan yapımlar genelde **%82 – %95+** bandında eşleşir; **%80** altındaki skorlar aranan yapımın henüz katalogda olmayabileceğini gösterir.
|
|
106
|
+
|
|
107
|
+
### 1. Ücretsiz API Anahtarı Alın (50 Hediye Kredi)
|
|
108
|
+
**[karanfillabs.com/#portal](https://karanfillabs.com/#portal)** adresinden kredi kartı gerekmeden ücretsiz hesap açarak **50 test kredisi** ve `kl_live_...` anahtarınızı hemen alabilirsiniz.
|
|
109
|
+
|
|
110
|
+
### 2. Kurulum (Claude Desktop / Cursor)
|
|
111
|
+
`claude_desktop_config.json` veya `.cursor/mcp.json` dosyanıza yukarıdaki **Option A** JSON bloğunu ekleyip `KARANFIL_API_KEY` kısmına kendi `kl_live_...` anahtarınızı yazmanız yeterlidir.
|
|
112
|
+
|
|
113
|
+
### 3. Örnek Kullanım Komutları
|
|
114
|
+
* *"Karanfil Labs sunucu durumunu ve aktif vektör sayısını kontrol et."*
|
|
115
|
+
* *"Masaüstümdeki `C:\Users\Kullanici\Desktop\sahne.png` karesinin hangi dizi ve bölüm olduğunu Karanfil Labs ile bul."*
|
|
116
|
+
* *"Yağmurlu bir gecede neon ışıklı sokakta geçen araba kovalamacası sahnelerini Karanfil Labs'te ara."*
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
MIT © [Karanfil Labs Yazılım ve Teknoloji A.Ş.](https://karanfillabs.com)
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
# Karanfil Labs — Visual DNA MCP Server
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
Official **Model Context Protocol (MCP)** server for the **[Karanfil Labs Visual DNA API](https://karanfillabs.com)** — enabling **Claude Desktop**, **Cursor**, **Windsurf**, and any MCP-compatible AI agent to identify movies & TV episodes from video frames or search across **88M+ 768-d visual fingerprints** using plain-language prompts.
|
|
6
|
+
|
|
7
|
+
[🇬🇧 English Guide](#-english-guide) • [🇹🇷 Türkçe Kılavuz](#-türkçe-kılavuz) • [🌐 Live Demo & API Key](https://karanfillabs.com) • [📖 Swagger Docs](https://api.karanfillabs.com/docs)
|
|
8
|
+
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
## 🇬🇧 English Guide
|
|
12
|
+
|
|
13
|
+
### Available MCP Tools
|
|
14
|
+
1. **`identify_scene_from_image`** — Identify the movie or TV episode (`SxxExx`), release year, `tmdb_id`, and similarity confidence from any local screenshot file path (`PNG`, `JPG`, `WEBP`) or direct image URL (`POST /v1/identify`). Works even on cropped or subtitled frames.
|
|
15
|
+
2. **`search_scenes_by_text`** — Semantic text-to-scene discovery across millions of cinema and TV frames using natural English descriptions like *"rainy neon street car chase"* (`POST /v1/search`).
|
|
16
|
+
3. **`check_visual_dna_status`** — Keyless health check returning live server status and real-time indexed 768-d vector count (`GET /health`).
|
|
17
|
+
|
|
18
|
+
### Privacy & Catalog Note
|
|
19
|
+
* **Volatile RAM Processing:** Submitted image frames are converted into 768-d mathematical vectors strictly in volatile server RAM and discarded immediately — zero full images or copyrighted videos are hosted or written to disk.
|
|
20
|
+
* **Growing Catalog & Thresholds:** While 88M+ frame vectors are online (heavily covering TV series, anime, and feature films), not every movie ever made is indexed yet. True matches from indexed titles typically score **82% – 95%+**; scores below **80%** indicate closest visual similarity when a title is not yet in the index.
|
|
21
|
+
|
|
22
|
+
### 1. Get Your Free API Key (50 Free Credits)
|
|
23
|
+
Sign up in 15 seconds at **[karanfillabs.com/#portal](https://karanfillabs.com/#portal)** (no credit card required) to receive **50 free API test credits** and your `kl_live_...` key.
|
|
24
|
+
|
|
25
|
+
### 2. Quick Configuration (Claude Desktop / Cursor / Windsurf)
|
|
26
|
+
|
|
27
|
+
Requires [`uv`](https://docs.astral.sh/uv/) (`pip install uv` or `brew install uv`). Add the following block to your `claude_desktop_config.json` or `.cursor/mcp.json`:
|
|
28
|
+
|
|
29
|
+
**Option A — Run directly from GitHub (Works Immediately):**
|
|
30
|
+
```json
|
|
31
|
+
{
|
|
32
|
+
"mcpServers": {
|
|
33
|
+
"karanfillabs": {
|
|
34
|
+
"command": "uvx",
|
|
35
|
+
"args": [
|
|
36
|
+
"--from",
|
|
37
|
+
"git+[https://github.com/karanfillabs/karanfillabs-mcp](https://github.com/karanfillabs/karanfillabs-mcp)",
|
|
38
|
+
"karanfillabs-mcp"
|
|
39
|
+
],
|
|
40
|
+
"env": {
|
|
41
|
+
"KARANFIL_API_KEY": "kl_live_your_api_key_here"
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
**Option B — Run from PyPI (Once published on PyPI):**
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"karanfillabs": {
|
|
53
|
+
"command": "uvx",
|
|
54
|
+
"args": ["karanfillabs-mcp"],
|
|
55
|
+
"env": {
|
|
56
|
+
"KARANFIL_API_KEY": "kl_live_your_api_key_here"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 3. Example Prompts in Claude or Cursor
|
|
64
|
+
* *"Check Karanfil Labs Visual DNA server status and how many vectors are online."*
|
|
65
|
+
* *"Identify the movie or series episode in `/Users/alex/Desktop/frame.jpg` using Karanfil Labs."*
|
|
66
|
+
* *"Search Karanfil Labs for cinema scenes matching 'spaceship approaching a black hole'."*
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 🇹🇷 Türkçe Kılavuz
|
|
71
|
+
|
|
72
|
+
**[Karanfil Labs Visual DNA API](https://karanfillabs.com)** için resmi **Model Context Protocol (MCP)** köprü paketi. Tek satır kod yazmadan **Claude Desktop**, **Cursor** ve **Windsurf** içerisinden bilgisayarınızdaki bir film/dizi karesini taratabilir veya **88M+ adet 768 boyutlu görsel parmak izi** arasında sahne araması yapabilirsiniz.
|
|
73
|
+
|
|
74
|
+
### Sunulan Araçlar (Tools)
|
|
75
|
+
1. **`identify_scene_from_image`** — Bilgisayarınızdaki bir ekran görüntüsü yolundan (`PNG`, `JPG`, `WEBP`) veya doğrudan görsel bağlantısından hangi film/dizi bölümü (`SxxExx`) olduğunu, yılını, `tmdb_id` bilgisini ve güven skorunu döndürür (`POST /v1/identify`).
|
|
76
|
+
2. **`search_scenes_by_text`** — Doğal dil sahne tarifleriyle milyonlarca sinema/dizi karesi içinde anlamsal sahne araması yapar (`POST /v1/search`). Türkçe yazsanız bile yapay zeka asistanınız tarifi otomatik İngilizceye çevirerek sorgular.
|
|
77
|
+
3. **`check_visual_dna_status`** — Anahtar gerektirmeden sunucu sağlık durumunu ve o an aktif olan canlı vektör sayısını döndürür (`GET /health`).
|
|
78
|
+
|
|
79
|
+
### Gizlilik ve Katalog Notu
|
|
80
|
+
* **Anlık RAM İşleme (KVKK / GDPR Uyumlu):** Gönderilen kareler yalnızca geçici sunucu belleğinde (RAM) 768 boyutlu vektöre çevrilip salisesinde silinir; diske ham görsel yazılmaz ve telifli video barındırılmaz.
|
|
81
|
+
* **Büyüyen Katalog ve Skor Eşiği:** Katalogda 88M+ kare vektörü aktif olsa da henüz tarihteki tüm filmler indekslenmemiştir. İndekste bulunan yapımlar genelde **%82 – %95+** bandında eşleşir; **%80** altındaki skorlar aranan yapımın henüz katalogda olmayabileceğini gösterir.
|
|
82
|
+
|
|
83
|
+
### 1. Ücretsiz API Anahtarı Alın (50 Hediye Kredi)
|
|
84
|
+
**[karanfillabs.com/#portal](https://karanfillabs.com/#portal)** adresinden kredi kartı gerekmeden ücretsiz hesap açarak **50 test kredisi** ve `kl_live_...` anahtarınızı hemen alabilirsiniz.
|
|
85
|
+
|
|
86
|
+
### 2. Kurulum (Claude Desktop / Cursor)
|
|
87
|
+
`claude_desktop_config.json` veya `.cursor/mcp.json` dosyanıza yukarıdaki **Option A** JSON bloğunu ekleyip `KARANFIL_API_KEY` kısmına kendi `kl_live_...` anahtarınızı yazmanız yeterlidir.
|
|
88
|
+
|
|
89
|
+
### 3. Örnek Kullanım Komutları
|
|
90
|
+
* *"Karanfil Labs sunucu durumunu ve aktif vektör sayısını kontrol et."*
|
|
91
|
+
* *"Masaüstümdeki `C:\Users\Kullanici\Desktop\sahne.png` karesinin hangi dizi ve bölüm olduğunu Karanfil Labs ile bul."*
|
|
92
|
+
* *"Yağmurlu bir gecede neon ışıklı sokakta geçen araba kovalamacası sahnelerini Karanfil Labs'te ara."*
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## License
|
|
97
|
+
MIT © [Karanfil Labs Yazılım ve Teknoloji A.Ş.](https://karanfillabs.com)
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: karanfillabs-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Official MCP Server for Karanfil Labs Visual DNA API — Identify movies and TV episodes from video frames or English scene descriptions.
|
|
5
|
+
Author-email: Karanfil Labs <info@karanfillabs.com>
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://karanfillabs.com
|
|
8
|
+
Project-URL: Documentation, https://api.karanfillabs.com/docs
|
|
9
|
+
Project-URL: Repository, https://github.com/karanfillabs/karanfillabs-mcp
|
|
10
|
+
Keywords: mcp,model-context-protocol,karanfillabs,movie-recognition,video-search,clip,anti-piracy,visual-search
|
|
11
|
+
Classifier: Development Status :: 4 - Beta
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Requires-Python: >=3.10
|
|
19
|
+
Description-Content-Type: text/markdown
|
|
20
|
+
License-File: LICENSE
|
|
21
|
+
Requires-Dist: mcp>=1.2.0
|
|
22
|
+
Requires-Dist: httpx>=0.27.0
|
|
23
|
+
Dynamic: license-file
|
|
24
|
+
|
|
25
|
+
# Karanfil Labs — Visual DNA MCP Server
|
|
26
|
+
|
|
27
|
+

|
|
28
|
+
|
|
29
|
+
Official **Model Context Protocol (MCP)** server for the **[Karanfil Labs Visual DNA API](https://karanfillabs.com)** — enabling **Claude Desktop**, **Cursor**, **Windsurf**, and any MCP-compatible AI agent to identify movies & TV episodes from video frames or search across **88M+ 768-d visual fingerprints** using plain-language prompts.
|
|
30
|
+
|
|
31
|
+
[🇬🇧 English Guide](#-english-guide) • [🇹🇷 Türkçe Kılavuz](#-türkçe-kılavuz) • [🌐 Live Demo & API Key](https://karanfillabs.com) • [📖 Swagger Docs](https://api.karanfillabs.com/docs)
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
## 🇬🇧 English Guide
|
|
36
|
+
|
|
37
|
+
### Available MCP Tools
|
|
38
|
+
1. **`identify_scene_from_image`** — Identify the movie or TV episode (`SxxExx`), release year, `tmdb_id`, and similarity confidence from any local screenshot file path (`PNG`, `JPG`, `WEBP`) or direct image URL (`POST /v1/identify`). Works even on cropped or subtitled frames.
|
|
39
|
+
2. **`search_scenes_by_text`** — Semantic text-to-scene discovery across millions of cinema and TV frames using natural English descriptions like *"rainy neon street car chase"* (`POST /v1/search`).
|
|
40
|
+
3. **`check_visual_dna_status`** — Keyless health check returning live server status and real-time indexed 768-d vector count (`GET /health`).
|
|
41
|
+
|
|
42
|
+
### Privacy & Catalog Note
|
|
43
|
+
* **Volatile RAM Processing:** Submitted image frames are converted into 768-d mathematical vectors strictly in volatile server RAM and discarded immediately — zero full images or copyrighted videos are hosted or written to disk.
|
|
44
|
+
* **Growing Catalog & Thresholds:** While 88M+ frame vectors are online (heavily covering TV series, anime, and feature films), not every movie ever made is indexed yet. True matches from indexed titles typically score **82% – 95%+**; scores below **80%** indicate closest visual similarity when a title is not yet in the index.
|
|
45
|
+
|
|
46
|
+
### 1. Get Your Free API Key (50 Free Credits)
|
|
47
|
+
Sign up in 15 seconds at **[karanfillabs.com/#portal](https://karanfillabs.com/#portal)** (no credit card required) to receive **50 free API test credits** and your `kl_live_...` key.
|
|
48
|
+
|
|
49
|
+
### 2. Quick Configuration (Claude Desktop / Cursor / Windsurf)
|
|
50
|
+
|
|
51
|
+
Requires [`uv`](https://docs.astral.sh/uv/) (`pip install uv` or `brew install uv`). Add the following block to your `claude_desktop_config.json` or `.cursor/mcp.json`:
|
|
52
|
+
|
|
53
|
+
**Option A — Run directly from GitHub (Works Immediately):**
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"mcpServers": {
|
|
57
|
+
"karanfillabs": {
|
|
58
|
+
"command": "uvx",
|
|
59
|
+
"args": [
|
|
60
|
+
"--from",
|
|
61
|
+
"git+[https://github.com/karanfillabs/karanfillabs-mcp](https://github.com/karanfillabs/karanfillabs-mcp)",
|
|
62
|
+
"karanfillabs-mcp"
|
|
63
|
+
],
|
|
64
|
+
"env": {
|
|
65
|
+
"KARANFIL_API_KEY": "kl_live_your_api_key_here"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
**Option B — Run from PyPI (Once published on PyPI):**
|
|
73
|
+
```json
|
|
74
|
+
{
|
|
75
|
+
"mcpServers": {
|
|
76
|
+
"karanfillabs": {
|
|
77
|
+
"command": "uvx",
|
|
78
|
+
"args": ["karanfillabs-mcp"],
|
|
79
|
+
"env": {
|
|
80
|
+
"KARANFIL_API_KEY": "kl_live_your_api_key_here"
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### 3. Example Prompts in Claude or Cursor
|
|
88
|
+
* *"Check Karanfil Labs Visual DNA server status and how many vectors are online."*
|
|
89
|
+
* *"Identify the movie or series episode in `/Users/alex/Desktop/frame.jpg` using Karanfil Labs."*
|
|
90
|
+
* *"Search Karanfil Labs for cinema scenes matching 'spaceship approaching a black hole'."*
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## 🇹🇷 Türkçe Kılavuz
|
|
95
|
+
|
|
96
|
+
**[Karanfil Labs Visual DNA API](https://karanfillabs.com)** için resmi **Model Context Protocol (MCP)** köprü paketi. Tek satır kod yazmadan **Claude Desktop**, **Cursor** ve **Windsurf** içerisinden bilgisayarınızdaki bir film/dizi karesini taratabilir veya **88M+ adet 768 boyutlu görsel parmak izi** arasında sahne araması yapabilirsiniz.
|
|
97
|
+
|
|
98
|
+
### Sunulan Araçlar (Tools)
|
|
99
|
+
1. **`identify_scene_from_image`** — Bilgisayarınızdaki bir ekran görüntüsü yolundan (`PNG`, `JPG`, `WEBP`) veya doğrudan görsel bağlantısından hangi film/dizi bölümü (`SxxExx`) olduğunu, yılını, `tmdb_id` bilgisini ve güven skorunu döndürür (`POST /v1/identify`).
|
|
100
|
+
2. **`search_scenes_by_text`** — Doğal dil sahne tarifleriyle milyonlarca sinema/dizi karesi içinde anlamsal sahne araması yapar (`POST /v1/search`). Türkçe yazsanız bile yapay zeka asistanınız tarifi otomatik İngilizceye çevirerek sorgular.
|
|
101
|
+
3. **`check_visual_dna_status`** — Anahtar gerektirmeden sunucu sağlık durumunu ve o an aktif olan canlı vektör sayısını döndürür (`GET /health`).
|
|
102
|
+
|
|
103
|
+
### Gizlilik ve Katalog Notu
|
|
104
|
+
* **Anlık RAM İşleme (KVKK / GDPR Uyumlu):** Gönderilen kareler yalnızca geçici sunucu belleğinde (RAM) 768 boyutlu vektöre çevrilip salisesinde silinir; diske ham görsel yazılmaz ve telifli video barındırılmaz.
|
|
105
|
+
* **Büyüyen Katalog ve Skor Eşiği:** Katalogda 88M+ kare vektörü aktif olsa da henüz tarihteki tüm filmler indekslenmemiştir. İndekste bulunan yapımlar genelde **%82 – %95+** bandında eşleşir; **%80** altındaki skorlar aranan yapımın henüz katalogda olmayabileceğini gösterir.
|
|
106
|
+
|
|
107
|
+
### 1. Ücretsiz API Anahtarı Alın (50 Hediye Kredi)
|
|
108
|
+
**[karanfillabs.com/#portal](https://karanfillabs.com/#portal)** adresinden kredi kartı gerekmeden ücretsiz hesap açarak **50 test kredisi** ve `kl_live_...` anahtarınızı hemen alabilirsiniz.
|
|
109
|
+
|
|
110
|
+
### 2. Kurulum (Claude Desktop / Cursor)
|
|
111
|
+
`claude_desktop_config.json` veya `.cursor/mcp.json` dosyanıza yukarıdaki **Option A** JSON bloğunu ekleyip `KARANFIL_API_KEY` kısmına kendi `kl_live_...` anahtarınızı yazmanız yeterlidir.
|
|
112
|
+
|
|
113
|
+
### 3. Örnek Kullanım Komutları
|
|
114
|
+
* *"Karanfil Labs sunucu durumunu ve aktif vektör sayısını kontrol et."*
|
|
115
|
+
* *"Masaüstümdeki `C:\Users\Kullanici\Desktop\sahne.png` karesinin hangi dizi ve bölüm olduğunu Karanfil Labs ile bul."*
|
|
116
|
+
* *"Yağmurlu bir gecede neon ışıklı sokakta geçen araba kovalamacası sahnelerini Karanfil Labs'te ara."*
|
|
117
|
+
|
|
118
|
+
---
|
|
119
|
+
|
|
120
|
+
## License
|
|
121
|
+
MIT © [Karanfil Labs Yazılım ve Teknoloji A.Ş.](https://karanfillabs.com)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
README.md
|
|
3
|
+
karanfillabs_mcp.py
|
|
4
|
+
pyproject.toml
|
|
5
|
+
karanfillabs_mcp.egg-info/PKG-INFO
|
|
6
|
+
karanfillabs_mcp.egg-info/SOURCES.txt
|
|
7
|
+
karanfillabs_mcp.egg-info/dependency_links.txt
|
|
8
|
+
karanfillabs_mcp.egg-info/entry_points.txt
|
|
9
|
+
karanfillabs_mcp.egg-info/requires.txt
|
|
10
|
+
karanfillabs_mcp.egg-info/top_level.txt
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
karanfillabs_mcp
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Official MCP Server for Karanfil Labs Visual DNA API (https://karanfillabs.com)."""
|
|
3
|
+
|
|
4
|
+
import mimetypes
|
|
5
|
+
import os
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from urllib.parse import urlparse
|
|
8
|
+
|
|
9
|
+
import httpx
|
|
10
|
+
from mcp.server.fastmcp import FastMCP
|
|
11
|
+
|
|
12
|
+
API_BASE = os.environ.get("KARANFIL_API_BASE", "https://api.karanfillabs.com").rstrip("/")
|
|
13
|
+
mcp = FastMCP("Karanfil Labs Visual DNA")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
def _get_api_key() -> str:
|
|
17
|
+
key = os.environ.get("KARANFIL_API_KEY", "").strip()
|
|
18
|
+
if not key:
|
|
19
|
+
raise ValueError(
|
|
20
|
+
"KARANFIL_API_KEY environment variable is not set. "
|
|
21
|
+
"Create a free account at https://karanfillabs.com/#portal to receive 50 free API test credits "
|
|
22
|
+
"and your kl_live_... key."
|
|
23
|
+
)
|
|
24
|
+
return key
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
def _format_matches(data: dict, is_text_search: bool = False) -> str:
|
|
28
|
+
matches = data.get("matches") or []
|
|
29
|
+
latency = data.get("latency_ms", "N/A")
|
|
30
|
+
quota_info = data.get("quota") or {}
|
|
31
|
+
rem = quota_info.get("remaining_quota", "N/A")
|
|
32
|
+
plan = quota_info.get("plan", "unknown")
|
|
33
|
+
|
|
34
|
+
header = f"Engine Latency: {latency} ms | Plan: {plan} | Remaining Quota: {rem}"
|
|
35
|
+
if not matches:
|
|
36
|
+
return f"{header}\nNo matching scene found above the similarity threshold in the current indexed catalog."
|
|
37
|
+
|
|
38
|
+
lines = [header, ""]
|
|
39
|
+
top_conf = float(matches[0].get("confidence") or 0.0)
|
|
40
|
+
if not is_text_search and top_conf < 0.80:
|
|
41
|
+
lines.append(
|
|
42
|
+
"NOTE: Top match confidence is below 80%. "
|
|
43
|
+
"The exact movie or series may not be indexed in the catalog yet (closest visual neighbors shown)."
|
|
44
|
+
)
|
|
45
|
+
lines.append("")
|
|
46
|
+
|
|
47
|
+
for idx, m in enumerate(matches, start=1):
|
|
48
|
+
title = m.get("title", "Unknown")
|
|
49
|
+
year = f" ({m['year']})" if m.get("year") else ""
|
|
50
|
+
mtype = m.get("media_type", "movie")
|
|
51
|
+
ep = f" • {m['episode']}" if m.get("episode") else ""
|
|
52
|
+
tmdb = f" | TMDB #{m['tmdb_id']}" if m.get("tmdb_id") else ""
|
|
53
|
+
conf = float(m.get("confidence") or 0.0) * 100.0
|
|
54
|
+
lines.append(f"{idx}. {title}{year} [{mtype}{ep}] — {conf:.1f}%{tmdb}")
|
|
55
|
+
|
|
56
|
+
return "\n".join(lines)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
@mcp.tool()
|
|
60
|
+
def identify_scene_from_image(
|
|
61
|
+
image_source: str,
|
|
62
|
+
top_k: int = 3,
|
|
63
|
+
min_score: float = 0.70,
|
|
64
|
+
) -> str:
|
|
65
|
+
"""Identify a movie or TV series episode from a local video frame file path or direct image URL.
|
|
66
|
+
|
|
67
|
+
Args:
|
|
68
|
+
image_source: Local image path (PNG, JPG, WEBP) or direct http/https image URL.
|
|
69
|
+
top_k: Number of closest scene candidates to return (1 to 10, default 3).
|
|
70
|
+
min_score: Minimum cosine similarity threshold between 0.0 and 1.0 (default 0.70; 0.82+ recommended for strict matching).
|
|
71
|
+
"""
|
|
72
|
+
api_key = _get_api_key()
|
|
73
|
+
top_k = max(1, min(10, int(top_k)))
|
|
74
|
+
min_score = max(0.0, min(1.0, float(min_score)))
|
|
75
|
+
|
|
76
|
+
src = image_source.strip()
|
|
77
|
+
if src.startswith(("http://", "https://")):
|
|
78
|
+
with httpx.Client(timeout=20.0, follow_redirects=True) as dl:
|
|
79
|
+
img_resp = dl.get(src)
|
|
80
|
+
img_resp.raise_for_status()
|
|
81
|
+
raw_bytes = img_resp.content
|
|
82
|
+
parsed_name = Path(urlparse(src).path).name or "frame.jpg"
|
|
83
|
+
mime = img_resp.headers.get("content-type", "").split(";")[0].strip() or "image/jpeg"
|
|
84
|
+
else:
|
|
85
|
+
file_path = Path(src).expanduser().resolve()
|
|
86
|
+
if not file_path.is_file():
|
|
87
|
+
return f"Error: Image file not found at '{file_path}'."
|
|
88
|
+
raw_bytes = file_path.read_bytes()
|
|
89
|
+
parsed_name = file_path.name
|
|
90
|
+
mime = mimetypes.guess_type(parsed_name)[0] or "image/jpeg"
|
|
91
|
+
|
|
92
|
+
if len(raw_bytes) > 12 * 1024 * 1024:
|
|
93
|
+
return "Error: Image exceeds 12 MB size limit. Please resize or compress the frame."
|
|
94
|
+
|
|
95
|
+
with httpx.Client(timeout=30.0) as client:
|
|
96
|
+
resp = client.post(
|
|
97
|
+
f"{API_BASE}/v1/identify",
|
|
98
|
+
headers={"X-API-Key": api_key},
|
|
99
|
+
params={"top_k": top_k, "min_score": min_score},
|
|
100
|
+
files={"file": (parsed_name, raw_bytes, mime)},
|
|
101
|
+
)
|
|
102
|
+
|
|
103
|
+
if resp.status_code != 200:
|
|
104
|
+
return f"API Error ({resp.status_code}): {resp.text}"
|
|
105
|
+
|
|
106
|
+
return _format_matches(resp.json(), is_text_search=False)
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
@mcp.tool()
|
|
110
|
+
def search_scenes_by_text(
|
|
111
|
+
query: str,
|
|
112
|
+
top_k: int = 5,
|
|
113
|
+
min_score: float = 0.22,
|
|
114
|
+
) -> str:
|
|
115
|
+
"""Search millions of cinema and TV frames using an English natural-language scene description.
|
|
116
|
+
|
|
117
|
+
Args:
|
|
118
|
+
query: English scene description (e.g. 'car chase in rainy neon street'). Translate non-English prompts to English before calling.
|
|
119
|
+
top_k: Number of closest matching scenes to return (1 to 10, default 5).
|
|
120
|
+
min_score: Minimum text-to-image similarity threshold (0.0 to 1.0, default 0.22).
|
|
121
|
+
"""
|
|
122
|
+
api_key = _get_api_key()
|
|
123
|
+
clean_query = query.strip()
|
|
124
|
+
if not clean_query:
|
|
125
|
+
return "Error: Scene query cannot be empty."
|
|
126
|
+
|
|
127
|
+
top_k = max(1, min(10, int(top_k)))
|
|
128
|
+
min_score = max(0.0, min(1.0, float(min_score)))
|
|
129
|
+
|
|
130
|
+
with httpx.Client(timeout=30.0) as client:
|
|
131
|
+
resp = client.post(
|
|
132
|
+
f"{API_BASE}/v1/search",
|
|
133
|
+
headers={"X-API-Key": api_key, "Content-Type": "application/json"},
|
|
134
|
+
json={"query": clean_query, "top_k": top_k, "min_score": min_score},
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
if resp.status_code != 200:
|
|
138
|
+
return f"API Error ({resp.status_code}): {resp.text}"
|
|
139
|
+
|
|
140
|
+
return _format_matches(resp.json(), is_text_search=True)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
@mcp.tool()
|
|
144
|
+
def check_visual_dna_status() -> str:
|
|
145
|
+
"""Check Karanfil Labs Visual DNA API server health and live indexed 768-d frame vector count (no API key required)."""
|
|
146
|
+
with httpx.Client(timeout=15.0) as client:
|
|
147
|
+
resp = client.get(f"{API_BASE}/health")
|
|
148
|
+
if resp.status_code != 200:
|
|
149
|
+
return f"Health check returned HTTP {resp.status_code}: {resp.text}"
|
|
150
|
+
return resp.text
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
def main() -> None:
|
|
154
|
+
mcp.run()
|
|
155
|
+
|
|
156
|
+
|
|
157
|
+
if __name__ == "__main__":
|
|
158
|
+
main()
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "karanfillabs-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Official MCP Server for Karanfil Labs Visual DNA API — Identify movies and TV episodes from video frames or English scene descriptions."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Karanfil Labs", email = "info@karanfillabs.com" }
|
|
14
|
+
]
|
|
15
|
+
keywords = [
|
|
16
|
+
"mcp",
|
|
17
|
+
"model-context-protocol",
|
|
18
|
+
"karanfillabs",
|
|
19
|
+
"movie-recognition",
|
|
20
|
+
"video-search",
|
|
21
|
+
"clip",
|
|
22
|
+
"anti-piracy",
|
|
23
|
+
"visual-search"
|
|
24
|
+
]
|
|
25
|
+
classifiers = [
|
|
26
|
+
"Development Status :: 4 - Beta",
|
|
27
|
+
"Intended Audience :: Developers",
|
|
28
|
+
"License :: OSI Approved :: MIT License",
|
|
29
|
+
"Programming Language :: Python :: 3",
|
|
30
|
+
"Programming Language :: Python :: 3.10",
|
|
31
|
+
"Programming Language :: Python :: 3.11",
|
|
32
|
+
"Programming Language :: Python :: 3.12",
|
|
33
|
+
]
|
|
34
|
+
dependencies = [
|
|
35
|
+
"mcp>=1.2.0",
|
|
36
|
+
"httpx>=0.27.0",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
[project.urls]
|
|
40
|
+
Homepage = "https://karanfillabs.com"
|
|
41
|
+
Documentation = "https://api.karanfillabs.com/docs"
|
|
42
|
+
Repository = "https://github.com/karanfillabs/karanfillabs-mcp"
|
|
43
|
+
|
|
44
|
+
[project.scripts]
|
|
45
|
+
karanfillabs-mcp = "karanfillabs_mcp:main"
|
|
46
|
+
|
|
47
|
+
[tool.setuptools]
|
|
48
|
+
py-modules = ["karanfillabs_mcp"]
|