fetchtranscript-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.
- fetchtranscript_mcp-0.1.0/.gitignore +172 -0
- fetchtranscript_mcp-0.1.0/PKG-INFO +145 -0
- fetchtranscript_mcp-0.1.0/README.md +123 -0
- fetchtranscript_mcp-0.1.0/dev_server.py +3 -0
- fetchtranscript_mcp-0.1.0/npm/bin/cli.js +33 -0
- fetchtranscript_mcp-0.1.0/npm/package.json +14 -0
- fetchtranscript_mcp-0.1.0/pyproject.toml +35 -0
- fetchtranscript_mcp-0.1.0/src/fetchtranscript_mcp/__init__.py +3 -0
- fetchtranscript_mcp-0.1.0/src/fetchtranscript_mcp/client.py +95 -0
- fetchtranscript_mcp-0.1.0/src/fetchtranscript_mcp/errors.py +87 -0
- fetchtranscript_mcp-0.1.0/src/fetchtranscript_mcp/prompts.py +72 -0
- fetchtranscript_mcp-0.1.0/src/fetchtranscript_mcp/resources.py +301 -0
- fetchtranscript_mcp-0.1.0/src/fetchtranscript_mcp/server.py +56 -0
- fetchtranscript_mcp-0.1.0/src/fetchtranscript_mcp/tools.py +227 -0
- fetchtranscript_mcp-0.1.0/tests/__init__.py +0 -0
- fetchtranscript_mcp-0.1.0/tests/conftest.py +23 -0
- fetchtranscript_mcp-0.1.0/tests/test_client.py +139 -0
- fetchtranscript_mcp-0.1.0/tests/test_server.py +55 -0
- fetchtranscript_mcp-0.1.0/tests/test_tools.py +108 -0
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
# ===================
|
|
2
|
+
# Monorepo .gitignore
|
|
3
|
+
# ===================
|
|
4
|
+
|
|
5
|
+
# OS
|
|
6
|
+
.DS_Store
|
|
7
|
+
Thumbs.db
|
|
8
|
+
|
|
9
|
+
# IDE
|
|
10
|
+
.idea/
|
|
11
|
+
*.swp
|
|
12
|
+
*.swo
|
|
13
|
+
*~
|
|
14
|
+
|
|
15
|
+
# Environment files
|
|
16
|
+
.env
|
|
17
|
+
.env.local
|
|
18
|
+
.env.*.local
|
|
19
|
+
|
|
20
|
+
# Logs
|
|
21
|
+
*.log
|
|
22
|
+
logs/
|
|
23
|
+
|
|
24
|
+
# ===================
|
|
25
|
+
# Frontend (Node.js / Next.js)
|
|
26
|
+
# ===================
|
|
27
|
+
|
|
28
|
+
# Dependencies
|
|
29
|
+
frontend/node_modules/
|
|
30
|
+
frontend/.pnp
|
|
31
|
+
frontend/.pnp.*
|
|
32
|
+
frontend/.yarn/*
|
|
33
|
+
!frontend/.yarn/patches
|
|
34
|
+
!frontend/.yarn/plugins
|
|
35
|
+
!frontend/.yarn/releases
|
|
36
|
+
!frontend/.yarn/versions
|
|
37
|
+
|
|
38
|
+
# Next.js
|
|
39
|
+
frontend/.next/
|
|
40
|
+
frontend/out/
|
|
41
|
+
|
|
42
|
+
# Build
|
|
43
|
+
frontend/build/
|
|
44
|
+
|
|
45
|
+
# Testing
|
|
46
|
+
frontend/coverage/
|
|
47
|
+
frontend/playwright-report/
|
|
48
|
+
frontend/test-results/
|
|
49
|
+
|
|
50
|
+
# TypeScript
|
|
51
|
+
frontend/*.tsbuildinfo
|
|
52
|
+
|
|
53
|
+
# Prisma
|
|
54
|
+
frontend/src/generated/prisma/
|
|
55
|
+
frontend/prisma/dev.db
|
|
56
|
+
frontend/prisma/dev.db-journal
|
|
57
|
+
|
|
58
|
+
# Vercel
|
|
59
|
+
frontend/.vercel/
|
|
60
|
+
|
|
61
|
+
# Debug logs
|
|
62
|
+
frontend/npm-debug.log*
|
|
63
|
+
frontend/yarn-debug.log*
|
|
64
|
+
frontend/yarn-error.log*
|
|
65
|
+
frontend/.pnpm-debug.log*
|
|
66
|
+
|
|
67
|
+
# ===================
|
|
68
|
+
# Backend (Python)
|
|
69
|
+
# ===================
|
|
70
|
+
|
|
71
|
+
# Python bytecode
|
|
72
|
+
backend/__pycache__/
|
|
73
|
+
backend/**/__pycache__/
|
|
74
|
+
backend/*.py[cod]
|
|
75
|
+
backend/**/*.py[cod]
|
|
76
|
+
backend/*$py.class
|
|
77
|
+
|
|
78
|
+
# Virtual environments
|
|
79
|
+
backend/.venv/
|
|
80
|
+
backend/venv/
|
|
81
|
+
backend/ENV/
|
|
82
|
+
|
|
83
|
+
# Build/dist
|
|
84
|
+
backend/build/
|
|
85
|
+
backend/dist/
|
|
86
|
+
backend/*.egg-info/
|
|
87
|
+
backend/.eggs/
|
|
88
|
+
|
|
89
|
+
# Testing
|
|
90
|
+
backend/.pytest_cache/
|
|
91
|
+
backend/.coverage
|
|
92
|
+
backend/htmlcov/
|
|
93
|
+
backend/.tox/
|
|
94
|
+
backend/.nox/
|
|
95
|
+
|
|
96
|
+
# Type checking / Linting
|
|
97
|
+
backend/.mypy_cache/
|
|
98
|
+
backend/.ruff_cache/
|
|
99
|
+
|
|
100
|
+
# Database
|
|
101
|
+
backend/*.db
|
|
102
|
+
backend/*.sqlite3
|
|
103
|
+
|
|
104
|
+
# Proxy credentials
|
|
105
|
+
backend/src/proxy/*.txt
|
|
106
|
+
|
|
107
|
+
# ===================
|
|
108
|
+
# Docker
|
|
109
|
+
# ===================
|
|
110
|
+
.docker/
|
|
111
|
+
|
|
112
|
+
# ===================
|
|
113
|
+
# K6 Load Testing
|
|
114
|
+
# ===================
|
|
115
|
+
k6/.env.k6
|
|
116
|
+
k6/.venv/
|
|
117
|
+
|
|
118
|
+
# ===================
|
|
119
|
+
# SDKs
|
|
120
|
+
# ===================
|
|
121
|
+
|
|
122
|
+
# Python SDK
|
|
123
|
+
sdks/python/.venv/
|
|
124
|
+
sdks/python/venv/
|
|
125
|
+
sdks/python/__pycache__/
|
|
126
|
+
sdks/python/**/__pycache__/
|
|
127
|
+
sdks/python/*.py[cod]
|
|
128
|
+
sdks/python/**/*.py[cod]
|
|
129
|
+
sdks/python/*.egg-info/
|
|
130
|
+
sdks/python/src/*.egg-info/
|
|
131
|
+
sdks/python/build/
|
|
132
|
+
sdks/python/dist/
|
|
133
|
+
sdks/python/.pytest_cache/
|
|
134
|
+
sdks/python/.coverage
|
|
135
|
+
sdks/python/htmlcov/
|
|
136
|
+
sdks/python/output/
|
|
137
|
+
|
|
138
|
+
# TypeScript SDK
|
|
139
|
+
sdks/typescript/node_modules/
|
|
140
|
+
sdks/typescript/dist/
|
|
141
|
+
sdks/typescript/*.tsbuildinfo
|
|
142
|
+
sdks/typescript/coverage/
|
|
143
|
+
|
|
144
|
+
# MCP Server
|
|
145
|
+
sdks/mcp/.venv/
|
|
146
|
+
sdks/mcp/venv/
|
|
147
|
+
sdks/mcp/__pycache__/
|
|
148
|
+
sdks/mcp/**/__pycache__/
|
|
149
|
+
sdks/mcp/*.py[cod]
|
|
150
|
+
sdks/mcp/**/*.py[cod]
|
|
151
|
+
sdks/mcp/*.egg-info/
|
|
152
|
+
sdks/mcp/src/*.egg-info/
|
|
153
|
+
sdks/mcp/build/
|
|
154
|
+
sdks/mcp/dist/
|
|
155
|
+
sdks/mcp/.pytest_cache/
|
|
156
|
+
sdks/mcp/.coverage
|
|
157
|
+
sdks/mcp/htmlcov/
|
|
158
|
+
sdks/mcp/.mypy_cache/
|
|
159
|
+
sdks/mcp/.ruff_cache/
|
|
160
|
+
sdks/mcp/npm/node_modules/
|
|
161
|
+
|
|
162
|
+
# ===================
|
|
163
|
+
# Misc
|
|
164
|
+
# ===================
|
|
165
|
+
*.pem
|
|
166
|
+
workspace/TEMP_*.md
|
|
167
|
+
|
|
168
|
+
# K6 test results
|
|
169
|
+
k6/results/
|
|
170
|
+
|
|
171
|
+
# Database backups
|
|
172
|
+
backups/
|
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: fetchtranscript-mcp
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: MCP server for FetchTranscript YouTube API
|
|
5
|
+
Author: FetchTranscript
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Keywords: ai,mcp,transcript,youtube
|
|
8
|
+
Classifier: Development Status :: 4 - Beta
|
|
9
|
+
Classifier: Intended Audience :: Developers
|
|
10
|
+
Classifier: Programming Language :: Python :: 3
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
14
|
+
Requires-Python: >=3.10
|
|
15
|
+
Requires-Dist: httpx>=0.27.0
|
|
16
|
+
Requires-Dist: mcp[cli]>=1.0.0
|
|
17
|
+
Provides-Extra: dev
|
|
18
|
+
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
|
|
19
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
20
|
+
Requires-Dist: respx>=0.22; extra == 'dev'
|
|
21
|
+
Description-Content-Type: text/markdown
|
|
22
|
+
|
|
23
|
+
# FetchTranscript MCP Server
|
|
24
|
+
|
|
25
|
+
An [MCP](https://modelcontextprotocol.io) server that gives AI assistants (Claude Desktop, Cursor, etc.) access to YouTube transcripts, video metadata, channels, and search via the [FetchTranscript](https://fetchtranscript.com) API.
|
|
26
|
+
|
|
27
|
+
## Features
|
|
28
|
+
|
|
29
|
+
**8 Tools** — get transcripts, list languages, video metadata, chapters, comments, channel info, channel videos, search
|
|
30
|
+
|
|
31
|
+
**4 Documentation Resources** — API reference, quickstart guide, pricing, workflow examples
|
|
32
|
+
|
|
33
|
+
**3 Prompt Templates** — summarize video, compare videos, extract quotes
|
|
34
|
+
|
|
35
|
+
## Quick Start
|
|
36
|
+
|
|
37
|
+
### 1. Get an API Key
|
|
38
|
+
|
|
39
|
+
Sign up at [fetchtranscript.com](https://fetchtranscript.com) and create an API key from the dashboard.
|
|
40
|
+
|
|
41
|
+
### 2. Configure Claude Desktop
|
|
42
|
+
|
|
43
|
+
Add to your `claude_desktop_config.json`:
|
|
44
|
+
|
|
45
|
+
```json
|
|
46
|
+
{
|
|
47
|
+
"mcpServers": {
|
|
48
|
+
"fetchtranscript": {
|
|
49
|
+
"command": "uvx",
|
|
50
|
+
"args": ["fetchtranscript-mcp"],
|
|
51
|
+
"env": {
|
|
52
|
+
"FETCHTRANSCRIPT_API_KEY": "yt_your_key_here"
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### 3. Use it
|
|
60
|
+
|
|
61
|
+
Ask Claude:
|
|
62
|
+
- "Get the transcript of YouTube video dQw4w9WgXcQ"
|
|
63
|
+
- "Summarize this YouTube video: https://youtube.com/watch?v=..."
|
|
64
|
+
- "Search YouTube for 'machine learning explained' and summarize the top result"
|
|
65
|
+
|
|
66
|
+
## Configuration for Other Clients
|
|
67
|
+
|
|
68
|
+
### Cursor
|
|
69
|
+
|
|
70
|
+
Add to `.cursor/mcp.json`:
|
|
71
|
+
|
|
72
|
+
```json
|
|
73
|
+
{
|
|
74
|
+
"mcpServers": {
|
|
75
|
+
"fetchtranscript": {
|
|
76
|
+
"command": "uvx",
|
|
77
|
+
"args": ["fetchtranscript-mcp"],
|
|
78
|
+
"env": {
|
|
79
|
+
"FETCHTRANSCRIPT_API_KEY": "yt_your_key_here"
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
### Claude Code
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
claude mcp add fetchtranscript -- uvx fetchtranscript-mcp
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Set `FETCHTRANSCRIPT_API_KEY` in your environment.
|
|
93
|
+
|
|
94
|
+
## Installation Alternatives
|
|
95
|
+
|
|
96
|
+
### pip
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install fetchtranscript-mcp
|
|
100
|
+
FETCHTRANSCRIPT_API_KEY=yt_xxx fetchtranscript-mcp
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### npx
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
FETCHTRANSCRIPT_API_KEY=yt_xxx npx @fetchtranscript/mcp-server
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
## Tools
|
|
110
|
+
|
|
111
|
+
| Tool | Description | Key defaults |
|
|
112
|
+
|------|-------------|--------------|
|
|
113
|
+
| `get_transcript` | Fetch video transcript | format=text |
|
|
114
|
+
| `list_languages` | Available transcript languages | — |
|
|
115
|
+
| `get_video_metadata` | Video title, views, likes, etc. | — |
|
|
116
|
+
| `get_chapters` | Video chapter list | — |
|
|
117
|
+
| `get_comments` | Top comments | limit=20 |
|
|
118
|
+
| `get_channel_info` | Channel metadata | — |
|
|
119
|
+
| `list_channel_videos` | Videos from a channel | limit=10 |
|
|
120
|
+
| `search_videos` | Search YouTube | limit=5 |
|
|
121
|
+
|
|
122
|
+
## Environment Variables
|
|
123
|
+
|
|
124
|
+
| Variable | Required | Description |
|
|
125
|
+
|----------|----------|-------------|
|
|
126
|
+
| `FETCHTRANSCRIPT_API_KEY` | Yes | Your API key (starts with `yt_`) |
|
|
127
|
+
| `FETCHTRANSCRIPT_BASE_URL` | No | Override API base URL (default: `https://api.fetchtranscript.com`) |
|
|
128
|
+
|
|
129
|
+
## Development
|
|
130
|
+
|
|
131
|
+
```bash
|
|
132
|
+
cd mcp
|
|
133
|
+
pip install -e ".[dev]"
|
|
134
|
+
pytest tests/
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
Test with MCP Inspector:
|
|
138
|
+
|
|
139
|
+
```bash
|
|
140
|
+
FETCHTRANSCRIPT_API_KEY=yt_xxx mcp dev src/fetchtranscript_mcp/server.py
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
## License
|
|
144
|
+
|
|
145
|
+
MIT
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# FetchTranscript MCP Server
|
|
2
|
+
|
|
3
|
+
An [MCP](https://modelcontextprotocol.io) server that gives AI assistants (Claude Desktop, Cursor, etc.) access to YouTube transcripts, video metadata, channels, and search via the [FetchTranscript](https://fetchtranscript.com) API.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
**8 Tools** — get transcripts, list languages, video metadata, chapters, comments, channel info, channel videos, search
|
|
8
|
+
|
|
9
|
+
**4 Documentation Resources** — API reference, quickstart guide, pricing, workflow examples
|
|
10
|
+
|
|
11
|
+
**3 Prompt Templates** — summarize video, compare videos, extract quotes
|
|
12
|
+
|
|
13
|
+
## Quick Start
|
|
14
|
+
|
|
15
|
+
### 1. Get an API Key
|
|
16
|
+
|
|
17
|
+
Sign up at [fetchtranscript.com](https://fetchtranscript.com) and create an API key from the dashboard.
|
|
18
|
+
|
|
19
|
+
### 2. Configure Claude Desktop
|
|
20
|
+
|
|
21
|
+
Add to your `claude_desktop_config.json`:
|
|
22
|
+
|
|
23
|
+
```json
|
|
24
|
+
{
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"fetchtranscript": {
|
|
27
|
+
"command": "uvx",
|
|
28
|
+
"args": ["fetchtranscript-mcp"],
|
|
29
|
+
"env": {
|
|
30
|
+
"FETCHTRANSCRIPT_API_KEY": "yt_your_key_here"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### 3. Use it
|
|
38
|
+
|
|
39
|
+
Ask Claude:
|
|
40
|
+
- "Get the transcript of YouTube video dQw4w9WgXcQ"
|
|
41
|
+
- "Summarize this YouTube video: https://youtube.com/watch?v=..."
|
|
42
|
+
- "Search YouTube for 'machine learning explained' and summarize the top result"
|
|
43
|
+
|
|
44
|
+
## Configuration for Other Clients
|
|
45
|
+
|
|
46
|
+
### Cursor
|
|
47
|
+
|
|
48
|
+
Add to `.cursor/mcp.json`:
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"mcpServers": {
|
|
53
|
+
"fetchtranscript": {
|
|
54
|
+
"command": "uvx",
|
|
55
|
+
"args": ["fetchtranscript-mcp"],
|
|
56
|
+
"env": {
|
|
57
|
+
"FETCHTRANSCRIPT_API_KEY": "yt_your_key_here"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Claude Code
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
claude mcp add fetchtranscript -- uvx fetchtranscript-mcp
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Set `FETCHTRANSCRIPT_API_KEY` in your environment.
|
|
71
|
+
|
|
72
|
+
## Installation Alternatives
|
|
73
|
+
|
|
74
|
+
### pip
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
pip install fetchtranscript-mcp
|
|
78
|
+
FETCHTRANSCRIPT_API_KEY=yt_xxx fetchtranscript-mcp
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### npx
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
FETCHTRANSCRIPT_API_KEY=yt_xxx npx @fetchtranscript/mcp-server
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Tools
|
|
88
|
+
|
|
89
|
+
| Tool | Description | Key defaults |
|
|
90
|
+
|------|-------------|--------------|
|
|
91
|
+
| `get_transcript` | Fetch video transcript | format=text |
|
|
92
|
+
| `list_languages` | Available transcript languages | — |
|
|
93
|
+
| `get_video_metadata` | Video title, views, likes, etc. | — |
|
|
94
|
+
| `get_chapters` | Video chapter list | — |
|
|
95
|
+
| `get_comments` | Top comments | limit=20 |
|
|
96
|
+
| `get_channel_info` | Channel metadata | — |
|
|
97
|
+
| `list_channel_videos` | Videos from a channel | limit=10 |
|
|
98
|
+
| `search_videos` | Search YouTube | limit=5 |
|
|
99
|
+
|
|
100
|
+
## Environment Variables
|
|
101
|
+
|
|
102
|
+
| Variable | Required | Description |
|
|
103
|
+
|----------|----------|-------------|
|
|
104
|
+
| `FETCHTRANSCRIPT_API_KEY` | Yes | Your API key (starts with `yt_`) |
|
|
105
|
+
| `FETCHTRANSCRIPT_BASE_URL` | No | Override API base URL (default: `https://api.fetchtranscript.com`) |
|
|
106
|
+
|
|
107
|
+
## Development
|
|
108
|
+
|
|
109
|
+
```bash
|
|
110
|
+
cd mcp
|
|
111
|
+
pip install -e ".[dev]"
|
|
112
|
+
pytest tests/
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
Test with MCP Inspector:
|
|
116
|
+
|
|
117
|
+
```bash
|
|
118
|
+
FETCHTRANSCRIPT_API_KEY=yt_xxx mcp dev src/fetchtranscript_mcp/server.py
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* npm wrapper for the FetchTranscript MCP server.
|
|
5
|
+
* Spawns the Python package via uvx (preferred) or python3 -m.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const { spawn } = require("child_process");
|
|
9
|
+
|
|
10
|
+
function run(command, args) {
|
|
11
|
+
const child = spawn(command, args, {
|
|
12
|
+
stdio: "inherit",
|
|
13
|
+
env: process.env,
|
|
14
|
+
});
|
|
15
|
+
child.on("error", () => null); // handled by exit code
|
|
16
|
+
child.on("exit", (code) => process.exit(code ?? 1));
|
|
17
|
+
return child;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Try uvx first (fast, no install needed)
|
|
21
|
+
const uvx = spawn("uvx", ["fetchtranscript-mcp"], {
|
|
22
|
+
stdio: "inherit",
|
|
23
|
+
env: process.env,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
uvx.on("error", () => {
|
|
27
|
+
// uvx not available, fall back to python3 -m
|
|
28
|
+
run("python3", ["-m", "fetchtranscript_mcp.server"]);
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
uvx.on("exit", (code) => {
|
|
32
|
+
if (code !== null) process.exit(code);
|
|
33
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@fetchtranscript/mcp-server",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for FetchTranscript YouTube API (npm wrapper)",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"bin": {
|
|
7
|
+
"fetchtranscript-mcp": "./bin/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": ["bin/"],
|
|
10
|
+
"keywords": ["mcp", "youtube", "transcript", "ai"],
|
|
11
|
+
"engines": {
|
|
12
|
+
"node": ">=18"
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["hatchling"]
|
|
3
|
+
build-backend = "hatchling.build"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "fetchtranscript-mcp"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "MCP server for FetchTranscript YouTube API"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = "MIT"
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
authors = [{ name = "FetchTranscript" }]
|
|
13
|
+
keywords = ["mcp", "youtube", "transcript", "ai"]
|
|
14
|
+
classifiers = [
|
|
15
|
+
"Development Status :: 4 - Beta",
|
|
16
|
+
"Intended Audience :: Developers",
|
|
17
|
+
"Programming Language :: Python :: 3",
|
|
18
|
+
"Programming Language :: Python :: 3.10",
|
|
19
|
+
"Programming Language :: Python :: 3.11",
|
|
20
|
+
"Programming Language :: Python :: 3.12",
|
|
21
|
+
]
|
|
22
|
+
dependencies = [
|
|
23
|
+
"mcp[cli]>=1.0.0",
|
|
24
|
+
"httpx>=0.27.0",
|
|
25
|
+
]
|
|
26
|
+
|
|
27
|
+
[project.optional-dependencies]
|
|
28
|
+
dev = [
|
|
29
|
+
"pytest>=8.0",
|
|
30
|
+
"pytest-asyncio>=0.24",
|
|
31
|
+
"respx>=0.22",
|
|
32
|
+
]
|
|
33
|
+
|
|
34
|
+
[project.scripts]
|
|
35
|
+
fetchtranscript-mcp = "fetchtranscript_mcp.server:main"
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"""Async HTTP client for the FetchTranscript REST API."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from typing import Any
|
|
6
|
+
|
|
7
|
+
import httpx
|
|
8
|
+
|
|
9
|
+
from .errors import raise_for_status
|
|
10
|
+
|
|
11
|
+
DEFAULT_BASE_URL = "https://api.fetchtranscript.com"
|
|
12
|
+
DEFAULT_TIMEOUT = 30.0
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
class FetchTranscriptClient:
|
|
16
|
+
"""Async wrapper around the FetchTranscript REST API."""
|
|
17
|
+
|
|
18
|
+
def __init__(self, api_key: str, base_url: str = DEFAULT_BASE_URL):
|
|
19
|
+
self._client = httpx.AsyncClient(
|
|
20
|
+
base_url=base_url.rstrip("/"),
|
|
21
|
+
headers={
|
|
22
|
+
"X-API-Key": api_key,
|
|
23
|
+
"User-Agent": "FetchTranscript-MCP/0.1.0",
|
|
24
|
+
},
|
|
25
|
+
timeout=DEFAULT_TIMEOUT,
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
async def _get(self, path: str, params: dict[str, Any] | None = None) -> dict[str, Any]:
|
|
29
|
+
response = await self._client.get(path, params=params)
|
|
30
|
+
raise_for_status(response)
|
|
31
|
+
return response.json()
|
|
32
|
+
|
|
33
|
+
# -- Transcripts --
|
|
34
|
+
|
|
35
|
+
async def get_transcript(
|
|
36
|
+
self,
|
|
37
|
+
video_id: str,
|
|
38
|
+
lang: str | None = None,
|
|
39
|
+
format: str | None = None,
|
|
40
|
+
) -> dict[str, Any]:
|
|
41
|
+
params: dict[str, Any] = {}
|
|
42
|
+
if lang:
|
|
43
|
+
params["lang"] = lang
|
|
44
|
+
if format:
|
|
45
|
+
params["format"] = format
|
|
46
|
+
return await self._get(f"/v1/transcripts/{video_id}", params or None)
|
|
47
|
+
|
|
48
|
+
async def list_languages(self, video_id: str) -> dict[str, Any]:
|
|
49
|
+
return await self._get(f"/v1/transcripts/{video_id}/languages")
|
|
50
|
+
|
|
51
|
+
# -- Videos --
|
|
52
|
+
|
|
53
|
+
async def get_video_metadata(self, video_id: str) -> dict[str, Any]:
|
|
54
|
+
return await self._get(f"/v1/videos/{video_id}")
|
|
55
|
+
|
|
56
|
+
async def get_chapters(self, video_id: str) -> dict[str, Any]:
|
|
57
|
+
return await self._get(f"/v1/videos/{video_id}/chapters")
|
|
58
|
+
|
|
59
|
+
async def get_comments(self, video_id: str, limit: int | None = None) -> dict[str, Any]:
|
|
60
|
+
params: dict[str, Any] = {}
|
|
61
|
+
if limit is not None:
|
|
62
|
+
params["limit"] = limit
|
|
63
|
+
return await self._get(f"/v1/videos/{video_id}/comments", params or None)
|
|
64
|
+
|
|
65
|
+
# -- Channels --
|
|
66
|
+
|
|
67
|
+
async def get_channel_info(self, channel_id: str) -> dict[str, Any]:
|
|
68
|
+
return await self._get(f"/v1/channels/{channel_id}")
|
|
69
|
+
|
|
70
|
+
async def list_channel_videos(
|
|
71
|
+
self,
|
|
72
|
+
channel_id: str,
|
|
73
|
+
limit: int | None = None,
|
|
74
|
+
offset: int | None = None,
|
|
75
|
+
include_shorts: bool | None = None,
|
|
76
|
+
) -> dict[str, Any]:
|
|
77
|
+
params: dict[str, Any] = {}
|
|
78
|
+
if limit is not None:
|
|
79
|
+
params["limit"] = limit
|
|
80
|
+
if offset is not None:
|
|
81
|
+
params["offset"] = offset
|
|
82
|
+
if include_shorts is not None:
|
|
83
|
+
params["include_shorts"] = include_shorts
|
|
84
|
+
return await self._get(f"/v1/channels/{channel_id}/videos", params or None)
|
|
85
|
+
|
|
86
|
+
# -- Search --
|
|
87
|
+
|
|
88
|
+
async def search_videos(self, query: str, limit: int | None = None) -> dict[str, Any]:
|
|
89
|
+
params: dict[str, Any] = {"q": query}
|
|
90
|
+
if limit is not None:
|
|
91
|
+
params["limit"] = limit
|
|
92
|
+
return await self._get("/v1/search", params)
|
|
93
|
+
|
|
94
|
+
async def close(self) -> None:
|
|
95
|
+
await self._client.aclose()
|