mcp-server-youtube-info 0.1.0__py3-none-any.whl

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.
@@ -0,0 +1,42 @@
1
+ from mcp_server_youtube_info.server import mcp
2
+
3
+ def main():
4
+ """MCP YouTube Info Server - YouTube情報取得サーバー実装"""
5
+ import os
6
+ import argparse
7
+
8
+ # Set up command line arguments
9
+ parser = argparse.ArgumentParser(
10
+ description="Run server with configurable transport and network settings")
11
+ parser.add_argument('--sse', choices=['on', 'off'], default='off',
12
+ help='Enable SSE transport if set to "on"')
13
+ parser.add_argument('--host',
14
+ default="localhost",
15
+ help='Host to bind the server to (default: localhost)')
16
+ parser.add_argument('--port',
17
+ type=int,
18
+ default=8000,
19
+ help='Port to bind the server to (default: 8000)')
20
+ parser.add_argument('--log-level',
21
+ choices=['debug', 'info', 'warning', 'error'],
22
+ default='info',
23
+ help='Set logging level:\n'
24
+ ' debug: Detailed debug information\n'
25
+ ' info: General execution information (default)\n'
26
+ ' warning: Potential issues that don\'t affect execution\n'
27
+ ' error: Errors that occur during execution')
28
+ args = parser.parse_args()
29
+
30
+ # Run server with configured settings
31
+ if args.sse == 'on':
32
+ mcp.run(
33
+ transport="sse",
34
+ host=args.host,
35
+ port=args.port,
36
+ log_level=args.log_level
37
+ )
38
+ else:
39
+ mcp.run()
40
+
41
+ if __name__ == "__main__":
42
+ main()
@@ -0,0 +1,3 @@
1
+ from mcp_server_youtube_info.server import mcp
2
+
3
+ mcp.run()
@@ -0,0 +1,58 @@
1
+ from fastmcp import FastMCP
2
+ import yt_dlp
3
+
4
+ mcp = FastMCP("MCP YouTube Info Server")
5
+
6
+ def extract_info(video_id: str) -> dict:
7
+ """YouTubeの動画情報を取得します。
8
+
9
+ Args:
10
+ video_id (str): YouTube動画ID
11
+
12
+ Returns:
13
+ dict: 動画情報
14
+ """
15
+ ydl_opts = {
16
+ 'quiet': True,
17
+ 'no_warnings': True,
18
+ 'extract_flat': True,
19
+ }
20
+
21
+ with yt_dlp.YoutubeDL(ydl_opts) as ydl:
22
+ try:
23
+ url = f"https://www.youtube.com/watch?v={video_id}"
24
+ info = ydl.extract_info(url, download=False)
25
+ return info
26
+ except Exception as e:
27
+ raise Exception(f"動画情報の取得に失敗しました: {str(e)}")
28
+
29
+ @mcp.tool()
30
+ def thumbnail(video_id: str) -> str:
31
+ """YouTubeのサムネイル画像URLを取得します。
32
+
33
+ Args:
34
+ video_id (str): YouTube動画ID
35
+
36
+ Returns:
37
+ str: サムネイル画像のURL
38
+ """
39
+ try:
40
+ info = extract_info(video_id)
41
+ return info.get('thumbnail')
42
+ except Exception as e:
43
+ raise Exception(f"サムネイルの取得に失敗しました: {str(e)}")
44
+
45
+ @mcp.tool()
46
+ def metainfo(video_id: str) -> dict:
47
+ """YouTube動画のメタ情報を取得します。
48
+
49
+ Args:
50
+ video_id (str): YouTube動画ID
51
+
52
+ Returns:
53
+ dict: yt-dlpから取得した生のメタ情報
54
+ """
55
+ try:
56
+ return extract_info(video_id)
57
+ except Exception as e:
58
+ raise Exception(f"メタ情報の取得に失敗しました: {str(e)}")
@@ -0,0 +1,104 @@
1
+ Metadata-Version: 2.4
2
+ Name: mcp-server-youtube-info
3
+ Version: 0.1.0
4
+ Summary: A YouTube information retrieval server implementation for Model Context Protocol (MCP)
5
+ Project-URL: Homepage, https://github.com/yareyaredesuyo/mcp-servers
6
+ Project-URL: Repository, https://github.com/yareyaredesuyo/mcp-servers.git
7
+ Project-URL: Documentation, https://github.com/yareyaredesuyo/mcp-servers#readme
8
+ Project-URL: Bug Tracker, https://github.com/yareyaredesuyo/mcp-servers/issues
9
+ Author-email: yareyaredesuyo <yareyaredesuyo@gmail.com>
10
+ License-Expression: MIT
11
+ Keywords: automation,llm,mcp,model-context-protocol,youtube
12
+ Classifier: Development Status :: 4 - Beta
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: License :: OSI Approved :: MIT License
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.10
17
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: argparse>=1.4.0
20
+ Requires-Dist: fastmcp>=2.5.2
21
+ Requires-Dist: pytube>=15.0.0
22
+ Requires-Dist: yt-dlp>=2025.5.22
23
+ Description-Content-Type: text/markdown
24
+
25
+ # MCP YouTube Info Server
26
+
27
+ このプロジェクトは、Model Context Protocol (MCP) を使用して YouTube 動画の情報を取得するサーバー実装です。FastMCP フレームワークを使用して、YouTube の動画情報を取得する機能を提供します。
28
+
29
+ ## Available Tools
30
+
31
+ ### thumbnail
32
+
33
+ YouTube 動画のサムネイル画像の URL を取得します。
34
+
35
+ - video_id (string, required): YouTube 動画 ID
36
+ - 戻り値: サムネイル画像の URL
37
+
38
+ ### metainfo
39
+
40
+ YouTube 動画のメタ情報を取得します。
41
+
42
+ - video_id (string, required): YouTube 動画 ID
43
+ - 戻り値: タイトル、説明、視聴回数、投稿日時などのメタ情報を含む JSON
44
+
45
+ ## インストール
46
+
47
+ ### uv の使用(推奨)
48
+
49
+ uv を使用する場合、特別なインストールは必要ありません。`uvx` を使用して直接 `mcp-server-youtube-info` を実行できます。
50
+
51
+ ### PIP の使用
52
+
53
+ または、pip を使用して `mcp-server-youtube-info` をインストールすることもできます:
54
+
55
+ ```
56
+ pip install mcp-server-youtube-info
57
+ ```
58
+
59
+ インストール後、以下のようにスクリプトとして実行できます:
60
+
61
+ ```
62
+ mcp-server-youtube-info
63
+ ```
64
+
65
+ ### コマンドラインオプション
66
+
67
+ サーバーの実行時に以下のオプションを指定できます:
68
+
69
+ - `--sse`: SSE トランスポートの有効化
70
+
71
+ - 選択肢: `on`, `off`
72
+ - デフォルト: `off`
73
+ - 説明: "on"に設定すると SSE トランスポートが有効になります
74
+
75
+ - `--host`: サーバーをバインドするホスト
76
+
77
+ - デフォルト: `localhost`
78
+ - 説明: サーバーをバインドするホストアドレスを指定します
79
+
80
+ - `--port`: サーバーをバインドするポート
81
+
82
+ - タイプ: 整数
83
+ - デフォルト: `8000`
84
+ - 説明: サーバーをバインドするポート番号を指定します
85
+
86
+ - `--log-level`: ログレベルの設定
87
+ - 選択肢: `debug`, `info`, `warning`, `error`
88
+ - デフォルト: `info`
89
+ - 説明:
90
+ - debug: 詳細なデバッグ情報
91
+ - info: 一般的な実行情報(デフォルト)
92
+ - warning: 実行に影響しない潜在的な問題
93
+ - error: 実行中に発生したエラー
94
+
95
+ ## 開発
96
+
97
+ このプロジェクトは、YouTube の動画情報を取得するための MCP サーバーを提供します。新しい機能を追加する場合は、`server.py` に実装を追加してください。
98
+
99
+ 開発時には、以下のコマンドを実行することで、開発中のスクリプトの動作を検証できます。
100
+
101
+ ```
102
+ pip install -e .
103
+ mcp-server-youtube-info
104
+ ```
@@ -0,0 +1,7 @@
1
+ mcp_server_youtube_info/__init__.py,sha256=KD9wJz_1DlOz4LWl_zjMosWuGt_45YImmAEY4rFAHcY,1638
2
+ mcp_server_youtube_info/__main__.py,sha256=uqSLNeSh8GpjfJjyKqL_tvsDIryo3G_SYCmTqtDnPhs,58
3
+ mcp_server_youtube_info/server.py,sha256=gwMJf8AWHttuY6x8f-iwUDGjAOdkBDUFtbpz-RNouEg,1519
4
+ mcp_server_youtube_info-0.1.0.dist-info/METADATA,sha256=uYkGsfmHpJHE58PGm_NBPrxgtmcoBIxjXoTOnixnaQo,3720
5
+ mcp_server_youtube_info-0.1.0.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
6
+ mcp_server_youtube_info-0.1.0.dist-info/entry_points.txt,sha256=CVOJ38APpxqkwNxKV4Bb7kHLC_Zbg8ZjnAevxUONEkk,73
7
+ mcp_server_youtube_info-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.27.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,2 @@
1
+ [console_scripts]
2
+ mcp-server-youtube-info = mcp_server_youtube_info:main