@avclabs.ai/media-mcp 0.3.0 → 0.4.0
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.
- package/README.md +15 -14
- package/README_CN.md +13 -12
- package/dist/config.d.ts +36 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +25 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -0
- package/dist/server.d.ts +5 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +32 -104
- package/dist/server.js.map +1 -1
- package/package.json +20 -28
- package/dist/image-enhancement.d.ts +0 -3
- package/dist/image-enhancement.d.ts.map +0 -1
- package/dist/image-enhancement.js +0 -185
- package/dist/image-enhancement.js.map +0 -1
- package/dist/sam3.d.ts +0 -10
- package/dist/sam3.d.ts.map +0 -1
- package/dist/sam3.js +0 -211
- package/dist/sam3.js.map +0 -1
- package/dist/service-config.d.ts +0 -62
- package/dist/service-config.d.ts.map +0 -1
- package/dist/service-config.js +0 -58
- package/dist/service-config.js.map +0 -1
- package/dist/tooling.d.ts +0 -42
- package/dist/tooling.d.ts.map +0 -1
- package/dist/tooling.js +0 -153
- package/dist/tooling.js.map +0 -1
- package/dist/tos.d.ts +0 -35
- package/dist/tos.d.ts.map +0 -1
- package/dist/tos.js +0 -281
- package/dist/tos.js.map +0 -1
- package/dist/upload.d.ts +0 -79
- package/dist/upload.d.ts.map +0 -1
- package/dist/upload.js +0 -190
- package/dist/upload.js.map +0 -1
- package/dist/video-enhancement.d.ts +0 -3
- package/dist/video-enhancement.d.ts.map +0 -1
- package/dist/video-enhancement.js +0 -156
- package/dist/video-enhancement.js.map +0 -1
package/README.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
# media-mcp (Node.js)
|
|
1
|
+
# media-mcp (Node.js, legacy all-in-one)
|
|
2
2
|
|
|
3
|
-
English | [中文](https://github.com/avclabs/media-mcp/blob/main/README_CN.md)
|
|
3
|
+
English | [中文](https://github.com/avclabs/media-mcp/blob/main/packages/media-mcp/README_CN.md)
|
|
4
|
+
|
|
5
|
+
> **Maintenance note:** this package bundles all 9 tools in one server. New integrations should prefer the per-function packages — [@avclabs.ai/video-mcp](../video-mcp), [@avclabs.ai/image-mcp](../image-mcp), and [@avclabs.ai/sam3-mcp](../sam3-mcp) — so each MCP client session only loads the tool definitions it needs. This all-in-one server stays available and configuration-compatible; see the [repo README](https://github.com/avclabs/media-mcp#readme) for the migration matrix.
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@avclabs.ai/media-mcp)
|
|
6
8
|
[](https://nodejs.org/)
|
|
7
9
|
[](https://opensource.org/licenses/MIT)
|
|
8
10
|
|
|
9
|
-
A video enhancement, image enhancement/colorization/denoising, and image segmentation service based on the MCP protocol, acting as an MCP Client-Server to interact with
|
|
11
|
+
A video enhancement, image enhancement/colorization/denoising, and image segmentation service based on the MCP protocol, acting as an MCP Client-Server to interact with the hosted AVCLabs media services.
|
|
10
12
|
|
|
11
|
-
> **Release status:** the published npm package (`latest` = `0.
|
|
13
|
+
> **Release status:** the published npm package (`latest` = `0.3.0`) includes 9 tools — 3 video, 4 image, and 2 SAM3 — all production-ready.
|
|
12
14
|
|
|
13
15
|
## Features
|
|
14
16
|
|
|
@@ -19,7 +21,7 @@ Provides the following MCP Tools:
|
|
|
19
21
|
- `get_task_status` - Query task status
|
|
20
22
|
- `enhance_video_sync` - Synchronously enhance video (blocking wait, truncated at ~45s by default)
|
|
21
23
|
|
|
22
|
-
**Image Enhancement
|
|
24
|
+
**Image Enhancement**
|
|
23
25
|
- `enhance_image_sync` - Enhance image quality and optimize faces (supports URL or local file upload)
|
|
24
26
|
- `colorize_image_sync` - Colorize black-and-white photos (supports URL or local file upload)
|
|
25
27
|
- `denoise_image_sync` - Remove noise from images (supports URL or local file upload)
|
|
@@ -118,23 +120,22 @@ Or edit `~/.cursor/mcp.json`:
|
|
|
118
120
|
After restarting your client, check if the tools are available:
|
|
119
121
|
|
|
120
122
|
1. Or ask: "What tools do you have available?"
|
|
121
|
-
2. With the current npm `latest=0.
|
|
122
|
-
3. Once the image tools ship in an upcoming release, you will additionally see `enhance_image_sync`, `colorize_image_sync`, `denoise_image_sync`, and `get_image_task_status`.
|
|
123
|
+
2. With the current npm `latest=0.3.0`, you should see all 9 tools: `create_task`, `get_task_status`, `enhance_video_sync`, `enhance_image_sync`, `colorize_image_sync`, `denoise_image_sync`, `get_image_task_status`, `sam3_predict`, and `get_sam3_task_status`.
|
|
123
124
|
|
|
124
125
|
## Configuration Options
|
|
125
126
|
|
|
126
127
|
| Variable | Required | Default | Description |
|
|
127
128
|
|---|---|---|---|
|
|
128
129
|
| `API_KEY` | **Yes** | - | API authentication key (shared by video, image, and SAM3 services) |
|
|
129
|
-
| `HTTP_API_BASE_URL` | No | `https://mcp.avc.ai/enhance` | Shared video and image
|
|
130
|
-
| `IMAGE_API_BASE_URL` | No | Same as `HTTP_API_BASE_URL` | Optional image
|
|
131
|
-
| `SAM3_API_BASE_URL` | No | `https://mcp.avc.ai/sam` | SAM3
|
|
130
|
+
| `HTTP_API_BASE_URL` | No | `https://mcp.avc.ai/enhance` | Shared video and image enhancement host address |
|
|
131
|
+
| `IMAGE_API_BASE_URL` | No | Same as `HTTP_API_BASE_URL` | Optional image host override; omit for the shared production host |
|
|
132
|
+
| `SAM3_API_BASE_URL` | No | `https://mcp.avc.ai/sam` | SAM3 host address |
|
|
132
133
|
| `SAM3_POLL_INTERVAL_MS` | No | `2000` | SAM3 polling interval in milliseconds (`SAM3_POLL_INTERVAL` is a deprecated alias) |
|
|
133
134
|
| `SAM3_POLL_MAX_ATTEMPTS` | No | `25` | SAM3 maximum status queries; the time budget is interval × attempts, and whichever limit is hit first truncates the wait |
|
|
134
135
|
|
|
135
|
-
`IMAGE_API_BASE_URL` is an optional override for pointing image calls at a custom image
|
|
136
|
+
`IMAGE_API_BASE_URL` is an optional override for pointing image calls at a custom image host. When omitted, image and video calls share the `HTTP_API_BASE_URL` service — the recommended setup for the production server.
|
|
136
137
|
|
|
137
|
-
### Custom
|
|
138
|
+
### Custom Host
|
|
138
139
|
|
|
139
140
|
```json
|
|
140
141
|
{
|
|
@@ -151,7 +152,7 @@ Or via CLI args:
|
|
|
151
152
|
npx -y @avclabs.ai/media-mcp@latest --base-url https://your-media-endpoint.com --api-key your-api-key --sam3-base-url https://your-sam3-endpoint.com
|
|
152
153
|
```
|
|
153
154
|
|
|
154
|
-
The optional `--image-base-url` flag is available for deployments that intentionally split the public image
|
|
155
|
+
The optional `--image-base-url` flag is available for deployments that intentionally split the public image host; the current npm `latest` release does not use it (image calls share the main host).
|
|
155
156
|
|
|
156
157
|
## Recommended Workflow
|
|
157
158
|
|
|
@@ -626,7 +627,7 @@ npm ci
|
|
|
626
627
|
npm run release:verify
|
|
627
628
|
```
|
|
628
629
|
|
|
629
|
-
Maintainers: see the [release guide](https://github.com/avclabs/media-mcp/blob/main/docs/RELEASE.md) for the current release status, version synchronization, publish order, smoke tests, and the relationship with the portal
|
|
630
|
+
Maintainers: see the [release guide](https://github.com/avclabs/media-mcp/blob/main/docs/RELEASE.md) for the current release status, version synchronization, publish order, smoke tests, and the relationship with the portal and host-service deployment.
|
|
630
631
|
|
|
631
632
|
## License
|
|
632
633
|
|
package/README_CN.md
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
# media-mcp
|
|
1
|
+
# media-mcp(Node.js,旧版全量包)
|
|
2
2
|
|
|
3
|
-
[English](https://github.com/avclabs/media-mcp/blob/main/README.md) | 中文
|
|
3
|
+
[English](https://github.com/avclabs/media-mcp/blob/main/packages/media-mcp/README.md) | 中文
|
|
4
|
+
|
|
5
|
+
> **维护说明**:本包将全部 9 个工具打包在一个 server 中。新的接入建议改用按功能拆分的 [@avclabs.ai/video-mcp](../video-mcp)、[@avclabs.ai/image-mcp](../image-mcp)、[@avclabs.ai/sam3-mcp](../sam3-mcp),让每个 MCP 客户端会话只加载自己需要的工具定义。本全量包继续可用且配置完全兼容;迁移矩阵见[仓库 README](https://github.com/avclabs/media-mcp#readme)。
|
|
4
6
|
|
|
5
7
|
[](https://www.npmjs.com/package/@avclabs.ai/media-mcp)
|
|
6
8
|
[](https://nodejs.org/)
|
|
7
9
|
[](https://opensource.org/licenses/MIT)
|
|
8
10
|
|
|
9
|
-
基于 MCP 协议的视频增强、图片增强/上色/降噪与图像分割服务,作为 MCP Client-Server
|
|
11
|
+
基于 MCP 协议的视频增强、图片增强/上色/降噪与图像分割服务,作为 MCP Client-Server 与 AVCLabs 云端媒体服务交互。
|
|
10
12
|
|
|
11
|
-
> **发布状态**:当前 npm `latest`(`0.
|
|
13
|
+
> **发布状态**:当前 npm `latest`(`0.3.0`)包含 9 个工具——3 个视频、4 个图片、2 个 SAM3——全部正式可用。
|
|
12
14
|
|
|
13
15
|
## 功能
|
|
14
16
|
|
|
@@ -19,7 +21,7 @@
|
|
|
19
21
|
- `get_task_status` - 查询任务状态
|
|
20
22
|
- `enhance_video_sync` - 同步增强视频(阻塞等待,默认45秒截断)
|
|
21
23
|
|
|
22
|
-
|
|
24
|
+
**图片增强**
|
|
23
25
|
- `enhance_image_sync` - 图片画质增强与人脸优化(支持 URL 或本地文件上传)
|
|
24
26
|
- `colorize_image_sync` - 黑白照片上色(支持 URL 或本地文件上传)
|
|
25
27
|
- `denoise_image_sync` - 图片降噪去噪(支持 URL 或本地文件上传)
|
|
@@ -118,21 +120,20 @@ AI 会自动完成:
|
|
|
118
120
|
重启客户端后,确认工具是否加载成功:
|
|
119
121
|
|
|
120
122
|
1. 或直接问 AI:"你有哪些可用的工具?"
|
|
121
|
-
2. 当前 npm `latest=0.
|
|
122
|
-
3. 图片工具随后续版本发布后,还应能看到 `enhance_image_sync`、`colorize_image_sync`、`denoise_image_sync`、`get_image_task_status`。
|
|
123
|
+
2. 当前 npm `latest=0.3.0` 应看到全部 9 个工具:`create_task`、`get_task_status`、`enhance_video_sync`、`enhance_image_sync`、`colorize_image_sync`、`denoise_image_sync`、`get_image_task_status`、`sam3_predict`、`get_sam3_task_status`。
|
|
123
124
|
|
|
124
125
|
## 配置项
|
|
125
126
|
|
|
126
127
|
| 变量名 | 必填 | 默认值 | 说明 |
|
|
127
128
|
|---|---|---|---|
|
|
128
129
|
| `API_KEY` | **是** | - | API 认证密钥(视频、图片和 SAM3 服务共用) |
|
|
129
|
-
| `HTTP_API_BASE_URL` | 否 | `https://mcp.avc.ai/enhance` |
|
|
130
|
-
| `IMAGE_API_BASE_URL` | 否 | 与 `HTTP_API_BASE_URL` 相同 |
|
|
131
|
-
| `SAM3_API_BASE_URL` | 否 | `https://mcp.avc.ai/sam` | SAM3
|
|
130
|
+
| `HTTP_API_BASE_URL` | 否 | `https://mcp.avc.ai/enhance` | 视频与图片共用的增强服务地址 |
|
|
131
|
+
| `IMAGE_API_BASE_URL` | 否 | 与 `HTTP_API_BASE_URL` 相同 | 可选图片服务地址覆盖;共享生产服务无需配置 |
|
|
132
|
+
| `SAM3_API_BASE_URL` | 否 | `https://mcp.avc.ai/sam` | SAM3 服务地址 |
|
|
132
133
|
| `SAM3_POLL_INTERVAL_MS` | 否 | `2000` | SAM3 轮询间隔(毫秒,`SAM3_POLL_INTERVAL` 为已弃用别名) |
|
|
133
134
|
| `SAM3_POLL_MAX_ATTEMPTS` | 否 | `25` | SAM3 最大状态查询次数;时间预算为 间隔 × 次数,任一限制先耗尽即截断等待 |
|
|
134
135
|
|
|
135
|
-
`IMAGE_API_BASE_URL`
|
|
136
|
+
`IMAGE_API_BASE_URL` 是可选的图片服务地址覆盖参数,用于把图片请求指向自定义图片服务。省略时,图片与视频请求共用 `HTTP_API_BASE_URL` 服务——这也是生产服务器的推荐配置。
|
|
136
137
|
|
|
137
138
|
### 自定义服务地址
|
|
138
139
|
|
|
@@ -151,7 +152,7 @@ AI 会自动完成:
|
|
|
151
152
|
npx -y @avclabs.ai/media-mcp@latest --base-url https://your-media-endpoint.com --api-key your-api-key --sam3-base-url https://your-sam3-endpoint.com
|
|
152
153
|
```
|
|
153
154
|
|
|
154
|
-
可选的 `--image-base-url`
|
|
155
|
+
可选的 `--image-base-url` 参数仅用于主动拆分公网图片服务地址的部署;当前 npm `latest` 版本不使用它(图片请求共用主服务地址)。
|
|
155
156
|
|
|
156
157
|
## 推荐的工作流程
|
|
157
158
|
|
package/dist/config.d.ts
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { ConfigError } from '@avclabs.ai/media-mcp-core';
|
|
2
|
+
export { ConfigError };
|
|
3
|
+
export interface MediaHostCliOverrides {
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
imageBaseUrl?: string;
|
|
6
|
+
sam3BaseUrl?: string;
|
|
7
|
+
apiKey?: string;
|
|
8
|
+
/** Raw argument text; parsed and bounds-checked by the sam3 resolver. */
|
|
9
|
+
sam3PollIntervalMs?: string;
|
|
10
|
+
sam3PollMaxAttempts?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface MediaHostEnv {
|
|
13
|
+
API_KEY?: string;
|
|
14
|
+
HTTP_API_BASE_URL?: string;
|
|
15
|
+
IMAGE_API_BASE_URL?: string;
|
|
16
|
+
SAM3_API_BASE_URL?: string;
|
|
17
|
+
/** Canonical name. */
|
|
18
|
+
SAM3_POLL_INTERVAL_MS?: string;
|
|
19
|
+
/** Deprecated alias of SAM3_POLL_INTERVAL_MS. */
|
|
20
|
+
SAM3_POLL_INTERVAL?: string;
|
|
21
|
+
SAM3_POLL_MAX_ATTEMPTS?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface MediaHostConfig {
|
|
24
|
+
enhancementApiBaseUrl: string;
|
|
25
|
+
imageApiBaseUrl: string;
|
|
26
|
+
sam3ApiBaseUrl: string;
|
|
27
|
+
apiKey: string;
|
|
28
|
+
sam3PollIntervalMs: number;
|
|
29
|
+
sam3PollMaxAttempts: number;
|
|
30
|
+
}
|
|
31
|
+
export declare function resolveMediaHostConfig(options: {
|
|
32
|
+
cli?: MediaHostCliOverrides;
|
|
33
|
+
env?: MediaHostEnv;
|
|
34
|
+
file?: Record<string, unknown>;
|
|
35
|
+
}): MediaHostConfig;
|
|
36
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AAKzD,OAAO,EAAE,WAAW,EAAE,CAAC;AAEvB,MAAM,WAAW,qBAAqB;IACpC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,yEAAyE;IACzE,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,sBAAsB;IACtB,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,iDAAiD;IACjD,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,sBAAsB,CAAC,EAAE,MAAM,CAAC;CACjC;AAED,MAAM,WAAW,eAAe;IAC9B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,eAAe,EAAE,MAAM,CAAC;IACxB,cAAc,EAAE,MAAM,CAAC;IACvB,MAAM,EAAE,MAAM,CAAC;IACf,kBAAkB,EAAE,MAAM,CAAC;IAC3B,mBAAmB,EAAE,MAAM,CAAC;CAC7B;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE;IAC9C,GAAG,CAAC,EAAE,qBAAqB,CAAC;IAC5B,GAAG,CAAC,EAAE,YAAY,CAAC;IACnB,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAChC,GAAG,eAAe,CAYlB"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Legacy all-in-one host configuration. Composes the per-package resolvers so
|
|
2
|
+
// resolveMediaHostConfig keeps its historical semantics exactly: precedence
|
|
3
|
+
// per key is CLI > environment > file config > built-in default, the image
|
|
4
|
+
// base derives from the RESOLVED enhancement base, and validation happens
|
|
5
|
+
// before any tool is created. New integrations should use the per-function
|
|
6
|
+
// packages instead of this one.
|
|
7
|
+
import { ConfigError } from '@avclabs.ai/media-mcp-core';
|
|
8
|
+
import { resolveVideoConfig } from '@avclabs.ai/video-mcp';
|
|
9
|
+
import { resolveImageConfig } from '@avclabs.ai/image-mcp';
|
|
10
|
+
import { resolveSam3Config } from '@avclabs.ai/sam3-mcp';
|
|
11
|
+
export { ConfigError };
|
|
12
|
+
export function resolveMediaHostConfig(options) {
|
|
13
|
+
const video = resolveVideoConfig(options);
|
|
14
|
+
const image = resolveImageConfig(options);
|
|
15
|
+
const sam3 = resolveSam3Config(options);
|
|
16
|
+
return {
|
|
17
|
+
enhancementApiBaseUrl: video.apiBaseUrl,
|
|
18
|
+
imageApiBaseUrl: image.imageApiBaseUrl,
|
|
19
|
+
sam3ApiBaseUrl: sam3.apiBaseUrl,
|
|
20
|
+
apiKey: video.apiKey,
|
|
21
|
+
sam3PollIntervalMs: sam3.pollIntervalMs,
|
|
22
|
+
sam3PollMaxAttempts: sam3.pollMaxAttempts,
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,4EAA4E;AAC5E,2EAA2E;AAC3E,0EAA0E;AAC1E,2EAA2E;AAC3E,gCAAgC;AAEhC,OAAO,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACzD,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAC;AAC3D,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAEzD,OAAO,EAAE,WAAW,EAAE,CAAC;AAiCvB,MAAM,UAAU,sBAAsB,CAAC,OAItC;IACC,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,KAAK,GAAG,kBAAkB,CAAC,OAAO,CAAC,CAAC;IAC1C,MAAM,IAAI,GAAG,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACxC,OAAO;QACL,qBAAqB,EAAE,KAAK,CAAC,UAAU;QACvC,eAAe,EAAE,KAAK,CAAC,eAAe;QACtC,cAAc,EAAE,IAAI,CAAC,UAAU;QAC/B,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,kBAAkB,EAAE,IAAI,CAAC,cAAc;QACvC,mBAAmB,EAAE,IAAI,CAAC,eAAe;KAC1C,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,WAAW,EACX,qBAAqB,EACrB,eAAe,EACf,YAAY,EACZ,sBAAsB,GACvB,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,mEAAmE;AACnE,yEAAyE;AACzE,gBAAgB;AAChB,OAAO,EACL,WAAW,EAIX,sBAAsB,GACvB,MAAM,aAAa,CAAC"}
|
package/dist/server.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* media-mcp — legacy all-in-one MCP server: video enhancement, image
|
|
4
|
+
* enhancement/colorization/denoising, and SAM3 image segmentation (9 tools).
|
|
5
|
+
* Prefer the per-function packages @avclabs.ai/video-mcp, @avclabs.ai/image-mcp,
|
|
6
|
+
* and @avclabs.ai/sam3-mcp; this entry keeps existing client configurations
|
|
7
|
+
* working unchanged.
|
|
4
8
|
*/
|
|
5
9
|
export {};
|
|
6
10
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;GAMG"}
|
package/dist/server.js
CHANGED
|
@@ -1,113 +1,41 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* media-mcp — legacy all-in-one MCP server: video enhancement, image
|
|
4
|
+
* enhancement/colorization/denoising, and SAM3 image segmentation (9 tools).
|
|
5
|
+
* Prefer the per-function packages @avclabs.ai/video-mcp, @avclabs.ai/image-mcp,
|
|
6
|
+
* and @avclabs.ai/sam3-mcp; this entry keeps existing client configurations
|
|
7
|
+
* working unchanged.
|
|
4
8
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
import { setupSam3Tools } from './sam3.js';
|
|
13
|
-
import { resolveMediaHostConfig } from './service-config.js';
|
|
14
|
-
const __filename = fileURLToPath(import.meta.url);
|
|
15
|
-
const __dirname = path.dirname(__filename);
|
|
16
|
-
function parseConfigFile(configPath) {
|
|
17
|
-
let raw;
|
|
18
|
-
try {
|
|
19
|
-
raw = fs.readFileSync(configPath, 'utf-8');
|
|
20
|
-
}
|
|
21
|
-
catch (error) {
|
|
22
|
-
console.error(`Error: cannot read config file ${configPath}: ${error instanceof Error ? error.message : String(error)}`);
|
|
23
|
-
process.exit(1);
|
|
24
|
-
}
|
|
25
|
-
let config;
|
|
26
|
-
try {
|
|
27
|
-
config = JSON.parse(raw);
|
|
28
|
-
}
|
|
29
|
-
catch (error) {
|
|
30
|
-
console.error(`Error: config file ${configPath} is not valid JSON: ${error instanceof Error ? error.message : String(error)}`);
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}
|
|
33
|
-
// Absent keys stay undefined; defaults are applied by resolveMediaHostConfig.
|
|
34
|
-
return {
|
|
35
|
-
baseUrl: typeof config.baseUrl === 'string' ? config.baseUrl : undefined,
|
|
36
|
-
imageBaseUrl: typeof config.imageBaseUrl === 'string' ? config.imageBaseUrl : undefined,
|
|
37
|
-
sam3BaseUrl: typeof config.sam3BaseUrl === 'string' ? config.sam3BaseUrl : undefined,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
function loadConfig(explicitConfigPath) {
|
|
41
|
-
if (explicitConfigPath) {
|
|
42
|
-
const resolved = path.resolve(explicitConfigPath);
|
|
43
|
-
console.error(`Using config file: ${resolved}`);
|
|
44
|
-
return parseConfigFile(resolved);
|
|
45
|
-
}
|
|
46
|
-
// Only the config bundled with the package is considered; a config.json in
|
|
47
|
-
// the caller's working directory must never silently redirect API traffic.
|
|
48
|
-
const bundledPath = path.resolve(__dirname, '..', 'config.json');
|
|
49
|
-
if (fs.existsSync(bundledPath)) {
|
|
50
|
-
return parseConfigFile(bundledPath);
|
|
51
|
-
}
|
|
52
|
-
return {};
|
|
53
|
-
}
|
|
54
|
-
// Collect CLI values without consulting the environment; precedence between
|
|
55
|
-
// layers is resolved by resolveMediaHostConfig.
|
|
56
|
-
function parseCliOverrides(args) {
|
|
57
|
-
const overrides = {};
|
|
58
|
-
for (let i = 0; i < args.length; i++) {
|
|
59
|
-
const takeValue = (key) => {
|
|
60
|
-
overrides[key] = args[i + 1];
|
|
61
|
-
i++;
|
|
62
|
-
};
|
|
63
|
-
if (args[i] === '--base-url' && i + 1 < args.length)
|
|
64
|
-
takeValue('baseUrl');
|
|
65
|
-
else if (args[i] === '--image-base-url' && i + 1 < args.length)
|
|
66
|
-
takeValue('imageBaseUrl');
|
|
67
|
-
else if (args[i] === '--api-key' && i + 1 < args.length)
|
|
68
|
-
takeValue('apiKey');
|
|
69
|
-
else if (args[i] === '--sam3-base-url' && i + 1 < args.length)
|
|
70
|
-
takeValue('sam3BaseUrl');
|
|
71
|
-
else if (args[i] === '--sam3-poll-interval' && i + 1 < args.length)
|
|
72
|
-
takeValue('sam3PollIntervalMs');
|
|
73
|
-
else if (args[i] === '--sam3-poll-max-attempts' && i + 1 < args.length)
|
|
74
|
-
takeValue('sam3PollMaxAttempts');
|
|
75
|
-
}
|
|
76
|
-
return overrides;
|
|
77
|
-
}
|
|
78
|
-
// Main entry
|
|
9
|
+
import { extractConfigPath, loadBundledConfig, parseFlagValues, runStdioServer } from '@avclabs.ai/media-mcp-core';
|
|
10
|
+
import { setupVideoEnhancementTools } from '@avclabs.ai/video-mcp';
|
|
11
|
+
import { setupImageEnhancementTools } from '@avclabs.ai/image-mcp';
|
|
12
|
+
import { setupSam3Tools } from '@avclabs.ai/sam3-mcp';
|
|
13
|
+
import { resolveMediaHostConfig } from './config.js';
|
|
14
|
+
// Kept in sync with package.json; scripts/check-release.mjs fails the build on drift.
|
|
15
|
+
const SERVER_VERSION = '0.4.0';
|
|
79
16
|
async function main() {
|
|
80
17
|
const args = process.argv.slice(2);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
18
|
+
const fileConfig = loadBundledConfig(extractConfigPath(args), import.meta.url);
|
|
19
|
+
const hostConfig = resolveMediaHostConfig({
|
|
20
|
+
cli: parseFlagValues(args, {
|
|
21
|
+
'--base-url': 'baseUrl',
|
|
22
|
+
'--image-base-url': 'imageBaseUrl',
|
|
23
|
+
'--api-key': 'apiKey',
|
|
24
|
+
'--sam3-base-url': 'sam3BaseUrl',
|
|
25
|
+
'--sam3-poll-interval': 'sam3PollIntervalMs',
|
|
26
|
+
'--sam3-poll-max-attempts': 'sam3PollMaxAttempts',
|
|
27
|
+
}),
|
|
28
|
+
env: process.env,
|
|
29
|
+
file: fileConfig,
|
|
30
|
+
});
|
|
31
|
+
await runStdioServer({ name: 'media-mcp', version: SERVER_VERSION }, (server) => {
|
|
32
|
+
// Register video enhancement tools
|
|
33
|
+
setupVideoEnhancementTools(server, hostConfig.enhancementApiBaseUrl, hostConfig.apiKey);
|
|
34
|
+
// Register image enhancement tools
|
|
35
|
+
setupImageEnhancementTools(server, hostConfig.imageApiBaseUrl, hostConfig.apiKey);
|
|
36
|
+
// Register SAM3 tools
|
|
37
|
+
setupSam3Tools(server, hostConfig.sam3ApiBaseUrl, hostConfig.apiKey, hostConfig.sam3PollIntervalMs, hostConfig.sam3PollMaxAttempts);
|
|
101
38
|
});
|
|
102
|
-
// Register video enhancement tools
|
|
103
|
-
setupVideoEnhancementTools(server, hostConfig.enhancementApiBaseUrl, hostConfig.apiKey);
|
|
104
|
-
// Register image enhancement tools
|
|
105
|
-
setupImageEnhancementTools(server, hostConfig.imageApiBaseUrl, hostConfig.apiKey);
|
|
106
|
-
// Register SAM3 tools
|
|
107
|
-
setupSam3Tools(server, hostConfig.sam3ApiBaseUrl, hostConfig.apiKey, hostConfig.sam3PollIntervalMs, hostConfig.sam3PollMaxAttempts);
|
|
108
|
-
const transport = new StdioServerTransport();
|
|
109
|
-
await server.connect(transport);
|
|
110
|
-
console.error('MCP Server running on stdio');
|
|
111
39
|
}
|
|
112
40
|
main().catch((error) => {
|
|
113
41
|
console.error('Server error:', error);
|
package/dist/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA
|
|
1
|
+
{"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":";AACA;;;;;;GAMG;AAEH,OAAO,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AACnH,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,uBAAuB,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,sBAAsB,EAAE,MAAM,aAAa,CAAC;AAErD,sFAAsF;AACtF,MAAM,cAAc,GAAG,OAAO,CAAC;AAE/B,KAAK,UAAU,IAAI;IACjB,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IACnC,MAAM,UAAU,GAAG,iBAAiB,CAAC,iBAAiB,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAE/E,MAAM,UAAU,GAAG,sBAAsB,CAAC;QACxC,GAAG,EAAE,eAAe,CAAC,IAAI,EAAE;YACzB,YAAY,EAAE,SAAS;YACvB,kBAAkB,EAAE,cAAc;YAClC,WAAW,EAAE,QAAQ;YACrB,iBAAiB,EAAE,aAAa;YAChC,sBAAsB,EAAE,oBAAoB;YAC5C,0BAA0B,EAAE,qBAAqB;SAClD,CAAC;QACF,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,IAAI,EAAE,UAAU;KACjB,CAAC,CAAC;IAEH,MAAM,cAAc,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,cAAc,EAAE,EAAE,CAAC,MAAM,EAAE,EAAE;QAC9E,mCAAmC;QACnC,0BAA0B,CAAC,MAAM,EAAE,UAAU,CAAC,qBAAqB,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAExF,mCAAmC;QACnC,0BAA0B,CAAC,MAAM,EAAE,UAAU,CAAC,eAAe,EAAE,UAAU,CAAC,MAAM,CAAC,CAAC;QAElF,sBAAsB;QACtB,cAAc,CACZ,MAAM,EACN,UAAU,CAAC,cAAc,EACzB,UAAU,CAAC,MAAM,EACjB,UAAU,CAAC,kBAAkB,EAC7B,UAAU,CAAC,mBAAmB,CAC/B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"name": "@avclabs.ai/media-mcp",
|
|
4
|
-
"version": "0.
|
|
5
|
-
"description": "MCP Server for video enhancement, image enhancement/colorization/denoising, and image segmentation (SAM3)",
|
|
4
|
+
"version": "0.4.0",
|
|
5
|
+
"description": "Legacy all-in-one MCP Server for video enhancement, image enhancement/colorization/denoising, and image segmentation (SAM3). Prefer the per-function packages @avclabs.ai/video-mcp, @avclabs.ai/image-mcp, and @avclabs.ai/sam3-mcp.",
|
|
6
6
|
"mcpName": "io.github.avclabs/media-mcp",
|
|
7
|
-
"main": "dist/
|
|
8
|
-
"types": "dist/
|
|
7
|
+
"main": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"default": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
9
16
|
"bin": {
|
|
10
17
|
"media-mcp": "dist/server.js"
|
|
11
18
|
},
|
|
@@ -18,12 +25,8 @@
|
|
|
18
25
|
],
|
|
19
26
|
"scripts": {
|
|
20
27
|
"build": "tsc",
|
|
21
|
-
"check:release": "node scripts/check-release.mjs",
|
|
22
28
|
"dev": "tsc --watch",
|
|
23
|
-
"
|
|
24
|
-
"prepublishOnly": "npm run build",
|
|
25
|
-
"test": "npm run build && node --test tests/*.test.mjs",
|
|
26
|
-
"release:verify": "npm run check:release && npm audit --omit=dev --audit-level=high && npm test && npm pack --dry-run"
|
|
29
|
+
"prepublishOnly": "npm run build"
|
|
27
30
|
},
|
|
28
31
|
"keywords": [
|
|
29
32
|
"mcp",
|
|
@@ -33,30 +36,19 @@
|
|
|
33
36
|
"enhancement",
|
|
34
37
|
"colorization",
|
|
35
38
|
"denoising",
|
|
36
|
-
"
|
|
37
|
-
"client",
|
|
38
|
-
"server",
|
|
39
|
-
"claude",
|
|
40
|
-
"anthropic"
|
|
39
|
+
"server"
|
|
41
40
|
],
|
|
42
41
|
"license": "MIT",
|
|
43
42
|
"repository": {
|
|
44
43
|
"type": "git",
|
|
45
|
-
"url": "git+https://github.com/avclabs/media-mcp.git"
|
|
44
|
+
"url": "git+https://github.com/avclabs/media-mcp.git",
|
|
45
|
+
"directory": "packages/media-mcp"
|
|
46
46
|
},
|
|
47
|
-
"bugs": {
|
|
48
|
-
"url": "https://github.com/avclabs/media-mcp/issues"
|
|
49
|
-
},
|
|
50
|
-
"homepage": "https://github.com/avclabs/media-mcp#readme",
|
|
51
47
|
"dependencies": {
|
|
52
|
-
"@
|
|
53
|
-
"
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@types/node": "^20.0.0",
|
|
59
|
-
"typescript": "^5.4.0"
|
|
48
|
+
"@avclabs.ai/media-mcp-core": "^0.1.0",
|
|
49
|
+
"@avclabs.ai/video-mcp": "^0.1.0",
|
|
50
|
+
"@avclabs.ai/image-mcp": "^0.1.0",
|
|
51
|
+
"@avclabs.ai/sam3-mcp": "^0.1.0"
|
|
60
52
|
},
|
|
61
53
|
"mcpServer": {
|
|
62
54
|
"command": "npx",
|
|
@@ -69,7 +61,7 @@
|
|
|
69
61
|
"HTTP_API_BASE_URL": "https://mcp.avc.ai/enhance",
|
|
70
62
|
"SAM3_API_BASE_URL": "https://mcp.avc.ai/sam"
|
|
71
63
|
},
|
|
72
|
-
"description": "视频增强 + 图片增强/上色/降噪 + SAM3 图像分割 MCP
|
|
64
|
+
"description": "视频增强 + 图片增强/上色/降噪 + SAM3 图像分割 MCP 服务(全量 9 工具;推荐改用按功能拆分的 video-mcp / image-mcp / sam3-mcp)",
|
|
73
65
|
"setup": "需要替换 env.API_KEY 为你的 API Key"
|
|
74
66
|
},
|
|
75
67
|
"engines": {
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"image-enhancement.d.ts","sourceRoot":"","sources":["../src/image-enhancement.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AA8CpE,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAwEnG"}
|