media-agent-mcp 0.3.10__tar.gz → 0.3.11__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.
Files changed (26) hide show
  1. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/PKG-INFO +1 -2
  2. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/pyproject.toml +1 -2
  3. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/async_server.py +30 -20
  4. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp.egg-info/PKG-INFO +1 -2
  5. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp.egg-info/requires.txt +0 -1
  6. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/README.md +0 -0
  7. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/setup.cfg +0 -0
  8. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/__init__.py +0 -0
  9. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/ai_models/__init__.py +0 -0
  10. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/ai_models/seed16.py +0 -0
  11. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/ai_models/seedance.py +0 -0
  12. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/ai_models/seededit.py +0 -0
  13. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/ai_models/seedream.py +0 -0
  14. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/async_wrapper.py +0 -0
  15. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/media_selectors/__init__.py +0 -0
  16. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/media_selectors/image_selector.py +0 -0
  17. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/media_selectors/video_selector.py +0 -0
  18. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/server.py +0 -0
  19. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/storage/__init__.py +0 -0
  20. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/storage/tos_client.py +0 -0
  21. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/video/__init__.py +0 -0
  22. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp/video/processor.py +0 -0
  23. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp.egg-info/SOURCES.txt +0 -0
  24. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp.egg-info/dependency_links.txt +0 -0
  25. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp.egg-info/entry_points.txt +0 -0
  26. {media_agent_mcp-0.3.10 → media_agent_mcp-0.3.11}/src/media_agent_mcp.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: media-agent-mcp
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Summary: A Model Context Protocol server for media processing with AI tools
5
5
  Author-email: Media Agent Team <team@mediaagent.com>
6
6
  Keywords: mcp,ai,media,video,image,processing
@@ -22,7 +22,6 @@ Requires-Dist: numpy>=1.24.0
22
22
  Requires-Dist: python-dotenv>=1.0.0
23
23
  Requires-Dist: volcengine-python-sdk>=1.0.0
24
24
  Requires-Dist: volcengine>=1.0.194
25
- Requires-Dist: tenacity>=8.2.3
26
25
 
27
26
  # Media Agent MCP
28
27
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "media-agent-mcp"
3
- version = "0.3.10"
3
+ version = "0.3.11"
4
4
  description = "A Model Context Protocol server for media processing with AI tools"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -27,7 +27,6 @@ dependencies = [
27
27
  "python-dotenv>=1.0.0",
28
28
  "volcengine-python-sdk>=1.0.0",
29
29
  "volcengine>=1.0.194",
30
- "tenacity>=8.2.3",
31
30
  ]
32
31
 
33
32
  [project.scripts]
@@ -22,17 +22,27 @@ from typing import List, Optional
22
22
  import json
23
23
  from dotenv import load_dotenv
24
24
  import uvicorn
25
- from tenacity import retry, stop_after_attempt, wait_fixed
26
-
27
- def _is_result_error(result):
28
- """Return True if the result is a dictionary with status 'error'."""
29
- if isinstance(result, str):
30
- try:
31
- data = json.loads(result)
32
- return isinstance(data, dict) and data.get('status') == 'error'
33
- except json.JSONDecodeError:
34
- return False
35
- return isinstance(result, dict) and result.get('status') == 'error'
25
+ from functools import wraps
26
+
27
+ def async_retry(max_retries=3, delay=2):
28
+ def decorator(func):
29
+ @wraps(func)
30
+ async def wrapper(*args, **kwargs):
31
+ for attempt in range(max_retries):
32
+ try:
33
+ result = await func(*args, **kwargs)
34
+ if isinstance(result, dict) and result.get('status') == 'error':
35
+ logger.warning(f"Attempt {attempt + 1} of {max_retries} failed for {func.__name__}. Error: {result.get('message')}. Retrying in {delay}s...")
36
+ await asyncio.sleep(delay)
37
+ continue
38
+ return result
39
+ except Exception as e:
40
+ logger.error(f"Attempt {attempt + 1} of {max_retries} failed for {func.__name__} with exception: {e}. Retrying in {delay}s...")
41
+ await asyncio.sleep(delay)
42
+ logger.error(f"Function {func.__name__} failed after {max_retries} retries.")
43
+ return {"status": "error", "data": None, "message": f"Function {func.__name__} failed after {max_retries} retries."}
44
+ return wrapper
45
+ return decorator
36
46
 
37
47
  from mcp.server.fastmcp import FastMCP
38
48
 
@@ -60,7 +70,7 @@ mcp = FastMCP("Media-Agent-MCP-Async")
60
70
 
61
71
 
62
72
  @mcp.tool()
63
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(2), retry_if_result=_is_result_error)
73
+ @async_retry()
64
74
  async def video_concat_tool(video_urls: List[str]) -> dict:
65
75
  """
66
76
  Asynchronously concatenate multiple videos from URLs and upload to TOS.
@@ -75,7 +85,7 @@ async def video_concat_tool(video_urls: List[str]) -> dict:
75
85
 
76
86
 
77
87
  @mcp.tool()
78
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(2), retry_if_result=_is_result_error)
88
+ @async_retry()
79
89
  async def video_last_frame_tool(video_url: str) -> dict:
80
90
  """
81
91
  Asynchronously extract the last frame from a video file and upload to TOS.
@@ -90,7 +100,7 @@ async def video_last_frame_tool(video_url: str) -> dict:
90
100
 
91
101
 
92
102
  @mcp.tool()
93
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(2), retry_if_result=_is_result_error)
103
+ @async_retry()
94
104
  async def seedream_generate_image_tool(prompt: str, size: str = "1024x1024") -> dict:
95
105
  """
96
106
  Asynchronously generate an image using Seedream AI model.
@@ -106,7 +116,7 @@ async def seedream_generate_image_tool(prompt: str, size: str = "1024x1024") ->
106
116
 
107
117
 
108
118
  @mcp.tool()
109
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(2), retry_if_result=_is_result_error)
119
+ @async_retry()
110
120
  async def seedance_generate_video_tool(prompt: str, first_frame_image: str,
111
121
  last_frame_image: str = None, duration: int = 5,
112
122
  resolution: str = "720p") -> dict:
@@ -127,7 +137,7 @@ async def seedance_generate_video_tool(prompt: str, first_frame_image: str,
127
137
 
128
138
 
129
139
  @mcp.tool()
130
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(2), retry_if_result=_is_result_error)
140
+ @async_retry()
131
141
  async def seededit_tool(image_url: str, prompt: str, seed: int = -1,
132
142
  scale: float = 0.5, charactor_keep: bool = False) -> dict:
133
143
  """
@@ -147,7 +157,7 @@ async def seededit_tool(image_url: str, prompt: str, seed: int = -1,
147
157
 
148
158
 
149
159
  @mcp.tool()
150
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(2), retry_if_result=_is_result_error)
160
+ @async_retry()
151
161
  async def vlm_vision_task_tool(messages: List) -> dict:
152
162
  """
153
163
  Asynchronously perform vision-language tasks using VLM model.
@@ -162,7 +172,7 @@ async def vlm_vision_task_tool(messages: List) -> dict:
162
172
 
163
173
 
164
174
  @mcp.tool()
165
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(2), retry_if_result=_is_result_error)
175
+ @async_retry()
166
176
  async def image_selector_tool(image_paths: List[str], prompt: str) -> dict:
167
177
  """
168
178
  Asynchronously select the best image from multiple options using VLM model.
@@ -178,7 +188,7 @@ async def image_selector_tool(image_paths: List[str], prompt: str) -> dict:
178
188
 
179
189
 
180
190
  @mcp.tool()
181
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(2), retry_if_result=_is_result_error)
191
+ @async_retry()
182
192
  async def video_selector_tool(video_paths: List[str], prompt: str) -> dict:
183
193
  """
184
194
  Asynchronously select the best video from multiple options using VLM model.
@@ -194,7 +204,7 @@ async def video_selector_tool(video_paths: List[str], prompt: str) -> dict:
194
204
 
195
205
 
196
206
  @mcp.tool()
197
- @retry(stop=stop_after_attempt(3), wait=wait_fixed(2), retry_if_result=_is_result_error)
207
+ @async_retry()
198
208
  async def tos_save_content_tool(content: str, file_extension: str = "txt",
199
209
  object_key: Optional[str] = None) -> dict:
200
210
  """
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: media-agent-mcp
3
- Version: 0.3.10
3
+ Version: 0.3.11
4
4
  Summary: A Model Context Protocol server for media processing with AI tools
5
5
  Author-email: Media Agent Team <team@mediaagent.com>
6
6
  Keywords: mcp,ai,media,video,image,processing
@@ -22,7 +22,6 @@ Requires-Dist: numpy>=1.24.0
22
22
  Requires-Dist: python-dotenv>=1.0.0
23
23
  Requires-Dist: volcengine-python-sdk>=1.0.0
24
24
  Requires-Dist: volcengine>=1.0.194
25
- Requires-Dist: tenacity>=8.2.3
26
25
 
27
26
  # Media Agent MCP
28
27
 
@@ -9,4 +9,3 @@ numpy>=1.24.0
9
9
  python-dotenv>=1.0.0
10
10
  volcengine-python-sdk>=1.0.0
11
11
  volcengine>=1.0.194
12
- tenacity>=8.2.3