Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions server/mcp_server_mediakit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,23 @@

MediaKit MCP Server is a standard AI capability plugin for Volcano Engine AI MediaKit. It is built on the MCP (Model Context Protocol) protocol and exposes cloud media capabilities such as video editing, audio processing, subtitle processing, and video enhancement as tools that can be called by AI agents. With MediaKit MCP, developers can use natural language to drive intelligent media production workflows.

<<<<<<< HEAD
| Field | Value |
| ----------- | ----------------------------------------------------------------- |
| Version | v1.0.0 |
| Description | MediaKit MCP intelligent media assistant |
| Categories | Media cloud, audio/video editing, video enhancement |
| Tags | MCP, MediaKit, video editing, audio processing, video enhancement |
=======
| Field | Value |
| --- | --- |
| Version | v1.0.0 |
| Description | MediaKit MCP intelligent media assistant |
| Categories | Media cloud, audio/video editing, video enhancement |
| Tags | MCP, MediaKit, video editing, audio processing, video enhancement |

> > > > > > > 62a9e293bc254026e04eaec63ca9d229aaa8e89e

## Tool Overview

MediaKit MCP provides tools that cover the full workflow from asynchronous task query to deep media editing and video enhancement. All tools support dynamic loading by group or by tool name to optimize agent reasoning efficiency.
Expand Down Expand Up @@ -133,11 +143,19 @@ Trae is an AI-native IDE with strong agent collaboration capabilities. By connec

Choose one of the following modes based on your usage scenario:

<<<<<<< HEAD
| Mode | Best for | Access method |
| --------------------------- | ------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------- |
| **Local Mode (JSON Local)** | Personal debugging, quick trials, no self-hosted service required. | Use `uvx` to launch MediaKit MCP directly from the `mcp-server` repository subdirectory. |
| **Cloud Mode (JSON URL)** | Team sharing, long-term usage, centralized operations. | Deploy MediaKit MCP Server yourself, then connect using the deployed Streamable HTTP endpoint. |
=======
| Mode | Best for | Access method |
| --- | --- | --- |
| **Local Mode (JSON Local)** | Personal debugging, quick trials, no self-hosted service required. | Use `uvx` to launch MediaKit MCP directly from the `mcp-server` repository subdirectory. |
| **Cloud Mode (JSON URL)** | Team sharing, long-term usage, centralized operations. | Deploy MediaKit MCP Server yourself, then connect using the deployed Streamable HTTP endpoint. |

> > > > > > > 62a9e293bc254026e04eaec63ca9d229aaa8e89e

### Step 2: Add MCP Configuration

1. Open Trae and click the settings button in the top-right corner.
Expand Down Expand Up @@ -317,12 +335,21 @@ The table below lists the core MediaKit MCP configuration fields for cloud mode

For self-hosted cloud mode, you can also configure the following startup parameters:

<<<<<<< HEAD
| Environment variable | Default value | Description |
| ---------------------- | ------------- | --------------------------- |
| `MCP_SERVER_HOST` | `0.0.0.0` | MCP service bind address. |
| `MCP_SERVER_PORT` | `8000` | MCP service listening port. |
| `STREAMABLE_HTTP_PATH` | `/mcp` | Streamable HTTP path. |
=======
| Environment variable | Default value | Description |
| --- | --- | --- |
| `MCP_SERVER_HOST` | `0.0.0.0` | MCP service bind address. |
| `MCP_SERVER_PORT` | `8000` | MCP service listening port. |
| `STREAMABLE_HTTP_PATH` | `/mcp` | Streamable HTTP path. |

> > > > > > > 62a9e293bc254026e04eaec63ca9d229aaa8e89e

## Tool Details

### query_task
Expand Down Expand Up @@ -384,3 +411,9 @@ Enhance video quality for scenarios such as `common`, `ugc`, `short_series`, `ai
## License

MIT

This software calls MediaKit APIs at runtime. Use of these APIs is subject to the following terms and privacy policies:

- [Video Cloud Service Special Terms](https://www.volcengine.com/docs/6448/79646?lang=zh)
- [Intelligent Processing Service Billing Rules](https://www.volcengine.com/docs/6448/104992?lang=zh)
- [Intelligent Processing Service Level Agreement](https://www.volcengine.com/docs/6448/79648?lang=zh)
34 changes: 33 additions & 1 deletion server/mcp_server_mediakit/README_zh.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,21 @@

MediaKit MCP 是火山引擎 AI MediaKit 面向 AI 时代推出的标准能力插件。它基于 MCP(Model Context Protocol)协议,将云端专业的视频剪辑、音频处理、字幕处理、画质增强等原子能力封装为智能体可直观调用的工具。通过 MediaKit MCP,开发者可直接以自然语言驱动 AI 智能体完成复杂的云端媒体处理任务。

<<<<<<< HEAD
| 字段 | 取值 |
| ---- | ------------------------------------------- |
| 版本 | v1.0.0 |
| 描述 | MediaKit MCP 智能媒体助手 |
| 分类 | 视频云、音视频编辑、画质增强 |
=======
| 字段 | 取值 |
| --- | --- |
| 版本 | v1.0.0 |
| 描述 | MediaKit MCP 智能媒体助手 |
| 分类 | 视频云、音视频编辑、画质增强 |
| 标签 | MCP、MediaKit、视频剪辑、音频处理、画质增强 |

> > > > > > > 62a9e293bc254026e04eaec63ca9d229aaa8e89e
> > > > > > > | 标签 | MCP、MediaKit、视频剪辑、音频处理、画质增强 |

## 工具概览

Expand Down Expand Up @@ -133,11 +142,19 @@ Trae 是一款 AI 原生 IDE,提供了强大的智能体协作能力。通过

根据您的使用场景,选择以下两种接入模式之一:

<<<<<<< HEAD
| 模式 | 适用场景 | 接入方式 |
| -------------------------- | ---------------------------------- | ------------------------------------------------------------------------- |
| **本地模式(JSON Local)** | 个人调试、快速试用、无需自建服务。 | 通过 `uvx` 直接从 `mcp-server` 仓库子目录拉起 MediaKit MCP。 |
| **云端模式(JSON URL)** | 团队共享、长期稳定使用、统一运维。 | 先自行部署 MediaKit MCP Server,再使用部署后的 Streamable HTTP 地址接入。 |
=======
| 模式 | 适用场景 | 接入方式 |
| --- | --- | --- |
| **本地模式(JSON Local)** | 个人调试、快速试用、无需自建服务。 | 通过 `uvx` 直接从 `mcp-server` 仓库子目录拉起 MediaKit MCP。 |
| **云端模式(JSON URL)** | 团队共享、长期稳定使用、统一运维。 | 先自行部署 MediaKit MCP Server,再使用部署后的 Streamable HTTP 地址接入。 |

> > > > > > > 62a9e293bc254026e04eaec63ca9d229aaa8e89e

### 步骤 2:添加 MCP 配置

1. 打开 Trae,单击窗口右上角“设置”按钮。
Expand Down Expand Up @@ -317,12 +334,21 @@ uvx --from "git+https://github.com/volcengine/mcp-server.git#subdirectory=server

云端自部署时,还可按需使用以下服务启动参数:

<<<<<<< HEAD
| 环境变量 | 默认值 | 说明 |
| ---------------------- | --------- | ---------------------- |
| `MCP_SERVER_HOST` | `0.0.0.0` | MCP 服务监听地址。 |
| `MCP_SERVER_PORT` | `8000` | MCP 服务监听端口。 |
| `STREAMABLE_HTTP_PATH` | `/mcp` | Streamable HTTP 路径。 |
=======
| 环境变量 | 默认值 | 说明 |
| --- | --- | --- |
| `MCP_SERVER_HOST` | `0.0.0.0` | MCP 服务监听地址。 |
| `MCP_SERVER_PORT` | `8000` | MCP 服务监听端口。 |
| `STREAMABLE_HTTP_PATH` | `/mcp` | Streamable HTTP 路径。 |

> > > > > > > 62a9e293bc254026e04eaec63ca9d229aaa8e89e

## 工具详情

### query_task
Expand Down Expand Up @@ -384,3 +410,9 @@ uvx --from "git+https://github.com/volcengine/mcp-server.git#subdirectory=server
## License

MIT

该软件运行时会调用 MediaKit 的 API,使用这些 API 需要遵守如下协议和隐私政策:

- [视频云服务专用条款](https://www.volcengine.com/docs/6448/79646?lang=zh)
- [智能处理服务计费结算规则](https://www.volcengine.com/docs/6448/104992?lang=zh)
- [智能处理服务等级协议](https://www.volcengine.com/docs/6448/79648?lang=zh)
25 changes: 25 additions & 0 deletions server/mcp_server_mediakit/src/base/api_info.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,41 @@
api_info = {
"add_image_to_video": {"path": "/api/v1/tools/add-image-to-video", "method": "POST"},
"add_subtitle_to_video": {"path": "/api/v1/tools/add-subtitle-to-video", "method": "POST"},
"adjust_audio_speed": {"path": "/api/v1/tools/adjust-audio-speed", "method": "POST"},
"adjust_video_speed": {"path": "/api/v1/tools/adjust-video-speed", "method": "POST"},
"adjust_video_volume": {"path": "/api/v1/tools/adjust-video-volume", "method": "POST"},
"analyze_video_highlights": {"path": "/api/v1/tools/analyze-video-highlights", "method": "POST"},
"analyze_video_storyline": {"path": "/api/v1/tools/analyze-video-storyline", "method": "POST"},
"apply_video_filter": {"path": "/api/v1/tools/apply-video-filter", "method": "POST"},
"asr_subtitles": {"path": "/api/v1/tools/asr-subtitles", "method": "POST"},
"concat_audio": {"path": "/api/v1/tools/concat-audio", "method": "POST"},
"concat_video": {"path": "/api/v1/tools/concat-video", "method": "POST"},
"enhance_image": {"path": "/api/v1/tools-sync/enhance-image", "method": "POST"},
"enhance_video": {"path": "/api/v1/tools/enhance-video", "method": "POST"},
"enhance_video_generative": {"path": "/api/v1/tools/enhance-video-generative", "method": "POST"},
"erase_image": {"path": "/api/v1/tools-sync/erase-image", "method": "POST"},
"erase_video_subtitle": {"path": "/api/v1/tools/erase-video-subtitle", "method": "POST"},
"erase_video_subtitle_pro": {"path": "/api/v1/tools/erase-video-subtitle-pro", "method": "POST"},
"evaluate_image_quality": {"path": "/api/v1/tools-sync/evaluate-image-quality", "method": "POST"},
"extract_audio": {"path": "/api/v1/tools/extract-audio", "method": "POST"},
"fade_audio": {"path": "/api/v1/tools/fade-audio", "method": "POST"},
"fade_video_audio": {"path": "/api/v1/tools/fade-video-audio", "method": "POST"},
"flip_video": {"path": "/api/v1/tools/flip-video", "method": "POST"},
"generate_highlights_microdrama": {"path": "/api/v1/tools/generate-highlights-microdrama", "method": "POST"},
"generate_highlights_minigame": {"path": "/api/v1/tools/generate-highlights-minigame", "method": "POST"},
"image_ocr": {"path": "/api/v1/tools-sync/image-ocr", "method": "POST"},
"image_to_video": {"path": "/api/v1/tools/image-to-video", "method": "POST"},
"matte_greenscreen_video": {"path": "/api/v1/tools/matte-greenscreen-video", "method": "POST"},
"matte_portrait_video": {"path": "/api/v1/tools/matte-portrait-video", "method": "POST"},
"mix_audio": {"path": "/api/v1/tools/mix-audio", "method": "POST"},
"mux_audio_video": {"path": "/api/v1/tools/mux-audio-video", "method": "POST"},
"probe_audio_metadata": {"path": "/api/v1/tools/probe-audio-metadata", "method": "POST"},
"probe_video_metadata": {"path": "/api/v1/tools/probe-video-metadata", "method": "POST"},
"query_task": {"path": "/api/v1/tasks/{task_id}", "method": "GET"},
"remove_image_background": {"path": "/api/v1/tools-sync/remove-image-background", "method": "POST"},
"segment_scenes": {"path": "/api/v1/tools/segment-scenes", "method": "POST"},
"separate_voice": {"path": "/api/v1/tools/separate-voice", "method": "POST"},
"trim_audio": {"path": "/api/v1/tools/trim-audio", "method": "POST"},
"trim_video": {"path": "/api/v1/tools/trim-video", "method": "POST"},
"video_ocr": {"path": "/api/v1/tools/video-ocr", "method": "POST"},
}
68 changes: 68 additions & 0 deletions server/mcp_server_mediakit/src/mediakit/mcp_tools/audio.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
from __future__ import annotations

from typing import Any, Dict, List, Optional
from typing_extensions import NotRequired, Required, TypedDict

try:
from pydantic import Field
except Exception: # pragma: no cover
def Field(*args, **kwargs):
if args:
return args[0]
return kwargs.get("default", None)

try:
from mcp.server.fastmcp.server import Context
from mcp.server.session import ServerSession
except Exception: # pragma: no cover
class Context: # type: ignore
pass

class ServerSession: # type: ignore
pass

from base.client import MediKitClient
from ..utils.response import async_task_response, error_response

TOOL_NAMES = ['probe_audio_metadata', 'separate_voice']


def register_tools(mcp, client: MediKitClient) -> None:
@mcp.tool(name="separate_voice", description="将音频中的人声与背景音精准分离,输出为两个独立的音轨文件。\n支持格式:主流音视频格式(如mp4、mov、mp3、m4a、wav等)。\n输入:video_url和audio_url二选一。\n输出格式:AAC。 使用 task_id, 调用 query_task 方法获取结果")
async def separate_voice(
video_url: Optional[str] = Field(None, description="输入视频 Url(需公网可访问),与audio_url二选一,都存在时优先取video_url"),
audio_url: Optional[str] = Field(None, description="输入音频 Url(需公网可访问),与video_url二选一,不能都为空"),
callback_args: Optional[str] = Field(None, description="可选,回调参数"),
client_token: Optional[str] = Field(None, description="可选,用于幂等,默认幂等,用户可根据需求进行调整"),
*,
ctx: Context,
) -> dict:
"""将音频中的人声与背景音精准分离,输出为两个独立的音轨文件。
支持格式:主流音视频格式(如mp4、mov、mp3、m4a、wav等)。
输入:video_url和audio_url二选一。
输出格式:AAC。"""
try:
result = client.call(api_name="separate_voice", video_url=video_url, audio_url=audio_url, callback_args=callback_args, client_token=client_token)
return async_task_response(result)
except Exception as exc:
return error_response(str(exc))

@mcp.tool(name="probe_audio_metadata", description="获取指定音频的详细元信息,输出容器层信息(format_meta)与音频流元信息(audio_stream_meta)。\n字段分类参考 ffprobe,并对 VOD 原始返回做精简与统一。\n使用限制:支持公网 HTTP/HTTPS URL。 使用 task_id, 调用 query_task 方法获取结果")
async def probe_audio_metadata(
audio_url: str = Field(..., description="待探测的音频公网 HTTP/HTTPS URL。"),
callback_args: Optional[str] = Field(None, description="可选,回调参数"),
client_token: Optional[str] = Field(None, description="可选,用于幂等,默认幂等,用户可根据需求进行调整"),
*,
ctx: Context,
) -> dict:
"""获取指定音频的详细元信息,输出容器层信息(format_meta)与音频流元信息(audio_stream_meta)。
字段分类参考 ffprobe,并对 VOD 原始返回做精简与统一。
使用限制:支持公网 HTTP/HTTPS URL。"""
try:
result = client.call(api_name="probe_audio_metadata", audio_url=audio_url, callback_args=callback_args, client_token=client_token)
return async_task_response(result)
except Exception as exc:
return error_response(str(exc))

if hasattr(mcp, "register_domain_tools"):
mcp.register_domain_tools("audio", TOOL_NAMES)
Loading
Loading