feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
import type {
SearchResponse ,
SearchResult ,
TorrentInfo ,
PopularResponse ,
PopularItem ,
RecentResponse ,
RecentItem ,
} from "../types.js" ;
function formatSize ( bytes : string | null ) : string {
if ( ! bytes ) return "?" ;
const b = parseInt ( bytes , 10 ) ;
if ( isNaN ( b ) ) return "?" ;
if ( b >= 1 _073_741_824 ) return ` ${ ( b / 1 _073_741_824 ) . toFixed ( 1 ) } GB ` ;
if ( b >= 1 _048_576 ) return ` ${ ( b / 1 _048_576 ) . toFixed ( 0 ) } MB ` ;
return ` ${ ( b / 1024 ) . toFixed ( 0 ) } KB ` ;
}
function formatRating ( imdb : string | null , tmdb : string | null ) : string {
const parts : string [ ] = [ ] ;
if ( imdb ) parts . push ( ` IMDb: ${ imdb } ` ) ;
if ( tmdb ) parts . push ( ` TMDB: ${ tmdb } ` ) ;
return parts . length > 0 ? parts . join ( " | " ) : "No ratings" ;
}
function truncate ( text : string , max : number ) : string {
if ( text . length <= max ) return text ;
return text . slice ( 0 , max - 3 ) + "..." ;
}
2026-02-09 17:57:11 +01:00
function formatTorrent ( t : TorrentInfo , compact? : boolean ) : string {
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
const parts : string [ ] = [ ] ;
if ( t . quality ) parts . push ( t . quality ) ;
if ( t . sourceType ) parts . push ( t . sourceType ) ;
if ( t . codec ) parts . push ( t . codec ) ;
if ( t . hdrType ) parts . push ( t . hdrType ) ;
const label = parts . length > 0 ? parts . join ( " " ) : "Unknown quality" ;
const size = formatSize ( t . sizeBytes ) ;
const seeds = ` ${ t . seeders } seeders ` ;
const score = t . qualityScore !== null ? ` Score: ${ t . qualityScore } ` : null ;
let line = ` - ${ label } ( ${ size } ) | ${ seeds } ` ;
if ( score ) line += ` | ${ score } ` ;
2026-02-12 15:45:08 +01:00
if ( t . season != null ) {
const ep =
t . episode != null ? ` E ${ String ( t . episode ) . padStart ( 2 , "0" ) } ` : "" ;
line += ` | S ${ String ( t . season ) . padStart ( 2 , "0" ) } ${ ep } ` ;
}
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
line += ` \ n Info hash: ${ t . infoHash } ` ;
2026-02-09 17:57:11 +01:00
if ( compact ) {
line += ` \ n Magnet: magnet:?xt=urn:btih: ${ t . infoHash } ` ;
} else if ( t . magnetUrl ) {
line += ` \ n Magnet: ${ t . magnetUrl } ` ;
}
2026-02-12 15:45:08 +01:00
if ( t . torrentUrl ) {
line += ` \ n Torrent: ${ t . torrentUrl } ` ;
}
// Audio/subtitle track summary (from scanned torrents)
if ( t . audioTracks && t . audioTracks . length > 0 ) {
const langs = t . audioTracks
. map ( ( a ) = > a . lang || "?" )
. filter ( ( v , i , arr ) = > arr . indexOf ( v ) === i ) ;
line += ` \ n Audio: ${ langs . join ( ", " ) } ` ;
const codecs = t . audioTracks
. map ( ( a ) = > a . codec )
. filter ( ( v ) : v is string = > v != null )
. filter ( ( v , i , arr ) = > arr . indexOf ( v ) === i ) ;
if ( codecs . length > 0 ) line += ` ( ${ codecs . join ( ", " ) } ) ` ;
}
if ( t . subtitleTracks && t . subtitleTracks . length > 0 ) {
const langs = t . subtitleTracks
. map ( ( s ) = > s . lang || "?" )
. filter ( ( v , i , arr ) = > arr . indexOf ( v ) === i ) ;
line += ` \ n Subtitles: ${ langs . join ( ", " ) } ` ;
}
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
return line ;
}
2026-02-09 17:57:11 +01:00
export interface FormatOptions {
compact? : boolean ;
}
function formatResult (
r : SearchResult ,
index : number ,
opts? : FormatOptions ,
) : string {
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
const lines : string [ ] = [ ] ;
const yearStr = r . year ? ` ( ${ r . year } ) ` : "" ;
lines . push ( ` ${ index } . ${ r . title } ${ yearStr } [ ${ r . contentType } ] ` ) ;
lines . push ( ` ${ formatRating ( r . ratingImdb , r . ratingTmdb ) } ` ) ;
if ( r . genres && r . genres . length > 0 ) {
lines . push ( ` Genres: ${ r . genres . join ( ", " ) } ` ) ;
}
if ( r . overview ) {
lines . push ( ` ${ truncate ( r . overview , 200 ) } ` ) ;
}
if ( r . torrents . length > 0 ) {
const top = r . torrents
. sort ( ( a , b ) = > ( b . qualityScore ? ? 0 ) - ( a . qualityScore ? ? 0 ) )
. slice ( 0 , 5 ) ;
lines . push ( ` Torrents ( ${ r . torrents . length } total, top ${ top . length } ): ` ) ;
for ( const t of top ) {
2026-02-09 17:57:11 +01:00
lines . push ( formatTorrent ( t , opts ? . compact ) ) ;
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
}
} else {
lines . push ( " No torrents available" ) ;
}
if ( r . streaming ) {
const providers : string [ ] = [ ] ;
if ( r . streaming . flatrate . length > 0 )
providers . push (
` Stream: ${ r . streaming . flatrate . map ( ( p ) = > p . name ) . join ( ", " ) } ` ,
) ;
if ( r . streaming . free . length > 0 )
2026-02-12 15:22:11 +01:00
providers . push ( ` Free: ${ r . streaming . free . map ( ( p ) = > p . name ) . join ( ", " ) } ` ) ;
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
if ( providers . length > 0 ) lines . push ( ` ${ providers . join ( " | " ) } ` ) ;
}
lines . push (
` Content ID: ${ r . id } — use with get_watch_providers(content_id= ${ r . id } ) or get_credits(content_id= ${ r . id } ) ` ,
) ;
if ( r . imdbId ) lines . push ( ` IMDb: ${ r . imdbId } ` ) ;
2026-02-12 15:45:08 +01:00
if ( r . contentUrl ) lines . push ( ` URL: ${ r . contentUrl } ` ) ;
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
return lines . join ( "\n" ) ;
}
2026-02-09 17:57:11 +01:00
export function formatSearchResults (
data : SearchResponse ,
opts? : FormatOptions ,
) : string {
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
if ( data . results . length === 0 ) {
return "No results found. Try: (1) a shorter or alternate title, (2) removing filters like quality or year, (3) checking spelling. You can also try get_popular or get_recent to browse available content." ;
}
2026-02-12 15:45:08 +01:00
const headerParts = [
` Found ${ data . total } results (page ${ data . page } , showing ${ data . results . length } ): ` ,
] ;
if ( data . parsedSeason != null ) {
const ep =
data . parsedEpisode != null
? ` E ${ String ( data . parsedEpisode ) . padStart ( 2 , "0" ) } `
: "" ;
headerParts . push (
` Detected season/episode: S ${ String ( data . parsedSeason ) . padStart ( 2 , "0" ) } ${ ep } ` ,
) ;
}
2026-02-09 17:57:11 +01:00
const results = data . results . map ( ( r , i ) = > formatResult ( r , i + 1 , opts ) ) ;
2026-02-12 15:45:08 +01:00
return [ . . . headerParts , "" , . . . results ] . join ( "\n" ) ;
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
}
function formatPopularItem ( item : PopularItem , index : number ) : string {
const yearStr = item . year ? ` ( ${ item . year } ) ` : "" ;
const rating = formatRating ( item . ratingImdb , item . ratingTmdb ) ;
return ` ${ index } . ${ item . title } ${ yearStr } [ ${ item . contentType } ] — ${ rating } — ${ item . clickCount } clicks — ID: ${ item . id } ` ;
}
export function formatPopularResults ( data : PopularResponse ) : string {
if ( data . items . length === 0 ) {
return "No popular content found." ;
}
const header = ` Popular content ( ${ data . total } total, page ${ data . page } ): ` ;
2026-02-12 15:22:11 +01:00
const hint =
"(Use search_content with a title to get torrents and full details)" ;
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
const items = data . items . map ( ( item , i ) = > formatPopularItem ( item , i + 1 ) ) ;
return [ header , hint , "" , . . . items ] . join ( "\n" ) ;
}
function formatRecentItem ( item : RecentItem , index : number ) : string {
const yearStr = item . year ? ` ( ${ item . year } ) ` : "" ;
const rating = formatRating ( item . ratingImdb , item . ratingTmdb ) ;
const date = new Date ( item . createdAt ) . toLocaleDateString ( "en-US" , {
month : "short" ,
day : "numeric" ,
year : "numeric" ,
} ) ;
return ` ${ index } . ${ item . title } ${ yearStr } [ ${ item . contentType } ] — ${ rating } — Added: ${ date } — ID: ${ item . id } ` ;
}
export function formatRecentResults ( data : RecentResponse ) : string {
if ( data . items . length === 0 ) {
return "No recent content found." ;
}
const header = ` Recently added content ( ${ data . total } total, page ${ data . page } ): ` ;
2026-02-12 15:22:11 +01:00
const hint =
"(Use search_content with a title to get torrents and full details)" ;
feat: initial release of torrentclaw-mcp server
MCP (Model Context Protocol) server that wraps the TorrentClaw REST API,
enabling LLMs (Claude Desktop, Claude Code, Cursor, etc.) to search movies
and TV shows with torrent downloads and streaming availability.
## Tools (6)
- search_content: primary search with filters (title, genre, year, rating,
quality, language, sort). Returns content metadata + torrent magnet links.
- get_popular: trending content ranked by clicks
- get_recent: most recently added content
- get_watch_providers: streaming availability by country (Netflix, Disney+, etc.)
- get_credits: director and top 10 cast members
- get_torrent_url: .torrent file download URL from info_hash
## Resources
- torrentclaw://stats: catalog statistics (content/torrent counts, sources)
## Prompts (4)
- search_movie, search_show, whats_new, where_to_watch
## LLM Usability
- Server description with workflow guidance for tool chaining
- Tool descriptions include trigger phrases, cross-tool references, and
explicit parameter examples
- Formatted output includes info_hash for tool chaining and call-syntax
cross-references (e.g. "use with get_watch_providers(content_id=42)")
- Popular/recent output hints to use search_content for torrents
- Error messages include status-specific recovery guidance (400, 404, 429, 5xx)
- Prompts reference tools by name for reliable LLM execution
## Security
- SSRF protection: validates TORRENTCLAW_API_URL against private IPs,
localhost, link-local, and IPv6 loopback addresses
- Protocol whitelist: only http/https allowed
- Error body sanitization: 4xx truncated to 200 chars, 5xx bodies omitted
- Input validation: control char filter on queries, regex on country codes,
genre character whitelist, content_id bounds
## Testing
- 85 tests across 13 test files
- Coverage: 99.5% statements, 95.2% branches, 98.1% functions, 99.5% lines
- Vitest v4 with v8 coverage provider, 80% thresholds enforced
## Stack
- TypeScript ESM, Node.js >= 18 (native fetch)
- @modelcontextprotocol/sdk v1.12, zod v3.24
- STDIO transport, runnable via npx torrentclaw-mcp
2026-02-09 17:26:23 +01:00
const items = data . items . map ( ( item , i ) = > formatRecentItem ( item , i + 1 ) ) ;
return [ header , hint , "" , . . . items ] . join ( "\n" ) ;
}