free-api-mcp-server 0.2.0 → 0.2.1
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/.env.example +2 -2
- package/README.md +5 -5
- package/package.json +2 -2
- package/server.json +3 -3
- package/src/index.js +1 -1
- package/src/lib/errors.js +4 -4
- package/src/lib/guestGate.js +1 -1
- package/src/server.js +1 -1
package/.env.example
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# 复制为 .env 后按需修改;全部变量也可由进程环境注入(PM2/CLI 均可)
|
|
2
2
|
|
|
3
3
|
# 02 开放层地址(唯一上游)
|
|
4
|
-
FREE_API_BASE_URL=https://www.
|
|
4
|
+
FREE_API_BASE_URL=https://www.free-api.aiconvg.xin
|
|
5
5
|
|
|
6
6
|
# 传输形态:stdio | http
|
|
7
7
|
MCP_TRANSPORT=stdio
|
|
@@ -43,7 +43,7 @@ MCP_HTTP_PORT=3210
|
|
|
43
43
|
# REDIS_URL=redis://127.0.0.1:6379
|
|
44
44
|
# REDIS_DB=1
|
|
45
45
|
# 注册引导链接
|
|
46
|
-
# TRIAL_SIGNUP_URL=https://www.
|
|
46
|
+
# TRIAL_SIGNUP_URL=https://www.free-api.aiconvg.xin
|
|
47
47
|
|
|
48
48
|
# 日志:debug | info | warn | error
|
|
49
49
|
LOG_LEVEL=info
|
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
把免费 / 付费的 **TTS · ASR · OCR · 多角色配音 · 视频转文字** 开放能力,以标准 MCP 工具暴露给任意 MCP 客户端(Trae / Claude / Cursor / 魔搭 Playground 等)。
|
|
4
4
|
|
|
5
|
-
本服务是纯协议适配层:不存数据、不发牌、不做计费;上游为 `https://www.
|
|
5
|
+
本服务是纯协议适配层:不存数据、不发牌、不做计费;上游为 `https://www.free-api.aiconvg.xin`,额度与计费都在上游按你的令牌结算。
|
|
6
6
|
|
|
7
7
|
## 特性
|
|
8
8
|
|
|
@@ -40,7 +40,7 @@
|
|
|
40
40
|
- 真正可靠的全局限额由上游 02 游客专用令牌兜底,客户端计数仅作二级软限。
|
|
41
41
|
|
|
42
42
|
### 正式令牌(更高额度)
|
|
43
|
-
到 **https://www.
|
|
43
|
+
到 **https://www.free-api.aiconvg.xin** 注册获取免费许可证令牌(免费档每日 TTS 100 / ASR 50 / OCR 50 次),填入 `FREE_API_TOKEN`,额度/计费归属各自账户。
|
|
44
44
|
|
|
45
45
|
```json
|
|
46
46
|
{
|
|
@@ -49,7 +49,7 @@
|
|
|
49
49
|
"command": "npx",
|
|
50
50
|
"args": ["-y", "free-api-mcp-server"],
|
|
51
51
|
"env": {
|
|
52
|
-
"FREE_API_BASE_URL": "https://www.
|
|
52
|
+
"FREE_API_BASE_URL": "https://www.free-api.aiconvg.xin",
|
|
53
53
|
"FREE_API_TOKEN": "<你的许可证令牌>"
|
|
54
54
|
}
|
|
55
55
|
}
|
|
@@ -60,14 +60,14 @@
|
|
|
60
60
|
| 环境变量 | 必填 | 说明 |
|
|
61
61
|
|---|---|---|
|
|
62
62
|
| `FREE_API_TOKEN` | ✅ | 你的许可证令牌(用户各自填写) |
|
|
63
|
-
| `FREE_API_BASE_URL` | ✅ | 固定 `https://www.
|
|
63
|
+
| `FREE_API_BASE_URL` | ✅ | 固定 `https://www.free-api.aiconvg.xin` |
|
|
64
64
|
| `MCP_TRANSPORT` | 默认 stdio | 托管场景保持 stdio(平台自动转 SSE) |
|
|
65
65
|
| `LOG_LEVEL` | 可选 | `debug/info/warn/error`,默认 info;日志走 stderr,stdout 只承载协议 |
|
|
66
66
|
|
|
67
67
|
本地直跑:
|
|
68
68
|
|
|
69
69
|
```bash
|
|
70
|
-
FREE_API_TOKEN=<你的令牌> FREE_API_BASE_URL=https://www.
|
|
70
|
+
FREE_API_TOKEN=<你的令牌> FREE_API_BASE_URL=https://www.free-api.aiconvg.xin npx -y free-api-mcp-server
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
## 调用示例
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "free-api-mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.1",
|
|
4
4
|
"mcpName": "io.github.aiconvg/free-api-mcp",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "MCP server exposing the free TTS/ASR/OCR open API (voices, tts, asr, ocr, account, dubbing, video) over stdio and Streamable HTTP",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "aiconvg",
|
|
9
9
|
"keywords": ["mcp", "model-context-protocol", "modelcontextprotocol", "tts", "asr", "ocr", "text-to-speech", "speech-to-text", "dubbing", "video-transcription", "ai"],
|
|
10
|
-
"homepage": "https://www.
|
|
10
|
+
"homepage": "https://www.free-api.aiconvg.xin",
|
|
11
11
|
"repository": { "type": "git", "url": "git+https://github.com/aiconvg/free-api-mcp-server.git" },
|
|
12
12
|
"bugs": { "url": "https://github.com/aiconvg/free-api-mcp-server/issues" },
|
|
13
13
|
"main": "src/index.js",
|
package/server.json
CHANGED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
"$schema": "https://static.modelcontextprotocol.io/schemas/2025-09-29/server.schema.json",
|
|
3
3
|
"name": "io.github.aiconvg/free-api-mcp",
|
|
4
4
|
"description": "Free API MCP server: text-to-speech, speech-to-text, ASR jobs, OCR, multi-voice dubbing and video transcription over the free open API. Per-user Bearer token; standard engine free.",
|
|
5
|
-
"version": "0.2.
|
|
5
|
+
"version": "0.2.1",
|
|
6
6
|
"packages": [
|
|
7
7
|
{
|
|
8
8
|
"registryType": "npm",
|
|
9
9
|
"identifier": "free-api-mcp-server",
|
|
10
|
-
"version": "0.2.
|
|
10
|
+
"version": "0.2.1",
|
|
11
11
|
"transport": {
|
|
12
12
|
"type": "stdio"
|
|
13
13
|
}
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"remotes": [
|
|
17
17
|
{
|
|
18
18
|
"type": "streamable-http",
|
|
19
|
-
"url": "https://www.
|
|
19
|
+
"url": "https://www.free-api.aiconvg.xin/mcp"
|
|
20
20
|
}
|
|
21
21
|
]
|
|
22
22
|
}
|
package/src/index.js
CHANGED
|
@@ -26,7 +26,7 @@ if (transport === 'stdio') {
|
|
|
26
26
|
}
|
|
27
27
|
if (guest) {
|
|
28
28
|
process.stderr.write(
|
|
29
|
-
'[info] 游客模式:限次免费试用(每实例每北京日有上限,全局限额由上游兜底)。注册获取更高每日额度 → https://www.
|
|
29
|
+
'[info] 游客模式:限次免费试用(每实例每北京日有上限,全局限额由上游兜底)。注册获取更高每日额度 → https://www.free-api.aiconvg.xin\n',
|
|
30
30
|
);
|
|
31
31
|
}
|
|
32
32
|
runStdio(token, { guest }).catch((e) => {
|
package/src/lib/errors.js
CHANGED
|
@@ -2,19 +2,19 @@ import { UpstreamError } from './apiClient.js';
|
|
|
2
2
|
|
|
3
3
|
// MCP 的 isError 内容只放文本;把上游错误码翻译成 Agent 可直接执行的下一步动作。
|
|
4
4
|
const HINTS = {
|
|
5
|
-
UNAUTHORIZED: '令牌无效或缺失。请到 https://www.
|
|
5
|
+
UNAUTHORIZED: '令牌无效或缺失。请到 https://www.free-api.aiconvg.xin 注册获取免费许可证,并在客户端配置 Authorization: Bearer <token> 后重试。',
|
|
6
6
|
VOICE_NOT_ALLOWED: '音色不在开放白名单。先调用 list_voices 查看可用音色,再从中选择 voice 参数。',
|
|
7
7
|
INVALID_PARAM: '入参不合法。请检查必填字段与取值范围(TTS 文本 ≤300 字符、speed 0.5–2.0)。不要使用本地文件路径,音频/图片必须是公网可访问 URL。',
|
|
8
8
|
TEXT_TOO_LONG: '文本超过 300 字符上限(付费音色硬限,2026-11-09 由 2000 收敛)。请分段合成后拼接播放。',
|
|
9
9
|
PAYLOAD_TOO_LARGE: '资源超过上限(同步 ASR/OCR ≤8MB;异步 submit_asr_job ≤50MB)。请压缩后重新上传,或改用更短的音频(同步 ASR 还要求 ≤60 秒,长音频改用 submit_asr_job)。',
|
|
10
10
|
RATE_LIMITED: '触发限速。按 retryAfter 秒数等待后重试。',
|
|
11
|
-
QUOTA_EXCEEDED: '当日额度用尽。额度按能力维度(tts/asr/ocr)与日总量分别封顶,以 quota 中被撑爆的维度为准;本会话请停止计费调用,额度将于 resetAt(北京时间 08:00)恢复。补充方案:① POST /v1/quota-pack 购买当日额度包(1,000 积分 = +50 次,tts/asr/ocr 通用,每日最多 2 包,当日有效)——标准引擎立即恢复,无需换引擎;② 付费引擎(premium)按积分计费、不占日额度——登录 https://www.
|
|
11
|
+
QUOTA_EXCEEDED: '当日额度用尽。额度按能力维度(tts/asr/ocr)与日总量分别封顶,以 quota 中被撑爆的维度为准;本会话请停止计费调用,额度将于 resetAt(北京时间 08:00)恢复。补充方案:① POST /v1/quota-pack 购买当日额度包(1,000 积分 = +50 次,tts/asr/ocr 通用,每日最多 2 包,当日有效)——标准引擎立即恢复,无需换引擎;② 付费引擎(premium)按积分计费、不占日额度——登录 https://www.free-api.aiconvg.xin 顶部「充值」购买积分后,请求中传 engine:"premium"(仅付费档可用);③ 等待次日重置后继续使用标准引擎。',
|
|
12
12
|
UPSTREAM_OVERLOAD: '上游过载。可稍后按 retryAfter 重试(不计费工具可重试,计费工具由用户决定)。',
|
|
13
13
|
UPSTREAM_UNAVAILABLE: '上游暂不可用。可稍后重试(不计费工具可重试,计费工具由用户决定)。',
|
|
14
14
|
FEATURE_DISABLED: '该能力需要付费档位。免费/试用额度仅限标准免费引擎,不能调用 premium。',
|
|
15
15
|
NOT_FOUND: '任务或产物不存在(异步任务结果保留 24 小时)。请核对 taskId。',
|
|
16
16
|
APP_DISABLED: '应用已被禁用,请联系平台。',
|
|
17
|
-
INSUFFICIENT_CREDITS: '积分余额不足(付费能力按积分计费:多角色配音按音色单价/字、视频转写每 5 字 1 积分)。请登录 https://www.
|
|
17
|
+
INSUFFICIENT_CREDITS: '积分余额不足(付费能力按积分计费:多角色配音按音色单价/字、视频转写每 5 字 1 积分)。请登录 https://www.free-api.aiconvg.xin 顶部「充值」购买积分(1 元起,10 元赠 5%、50 元赠 10%)后重试;当前余额可用 get_account 查看。提示:先用 list_dubbing_voices 选免费开源音色(0 积分)可零成本完成配音。',
|
|
18
18
|
};
|
|
19
19
|
|
|
20
20
|
export function errorToMcpContent(err) {
|
|
@@ -31,7 +31,7 @@ export function errorToMcpContent(err) {
|
|
|
31
31
|
isError: true,
|
|
32
32
|
content: [{
|
|
33
33
|
type: 'text',
|
|
34
|
-
text: `[AUTH_REQUIRED] ${err.message}\n注册入口:https://www.
|
|
34
|
+
text: `[AUTH_REQUIRED] ${err.message}\n注册入口:https://www.free-api.aiconvg.xin\n配置示例(客户端 MCP 配置):\n"env": { "FREE_API_TOKEN": "<你的令牌>" }`,
|
|
35
35
|
}],
|
|
36
36
|
};
|
|
37
37
|
}
|
package/src/lib/guestGate.js
CHANGED
|
@@ -12,7 +12,7 @@ import { logger } from '../context.js';
|
|
|
12
12
|
// 这些游客一律拒;游客只放:list_voices / get_account(免费只读)+ 3 个可试能力。
|
|
13
13
|
// 真正可靠的全局限额仍压在上游 02 的游客专用令牌(日额度 + 限流)。
|
|
14
14
|
|
|
15
|
-
const SIGNUP_URL = process.env.TRIAL_SIGNUP_URL || 'https://www.
|
|
15
|
+
const SIGNUP_URL = process.env.TRIAL_SIGNUP_URL || 'https://www.free-api.aiconvg.xin';
|
|
16
16
|
|
|
17
17
|
// 北京日(UTC+8,中国无夏令时):返回 YYYYMMDD,作为「每日」额度日界,
|
|
18
18
|
// 与上游 02 的额度日界对齐(此前用 UTC 日,北京时间 08:00 才切日,会错位)。
|
package/src/server.js
CHANGED
|
@@ -125,7 +125,7 @@ export function buildServer() {
|
|
|
125
125
|
if (!trialStoreAvailable()) {
|
|
126
126
|
return {
|
|
127
127
|
isError: true,
|
|
128
|
-
content: [{ type: 'text', text: '[AUTH_REQUIRED] 试用服务暂不可用,请注册后使用:https://www.
|
|
128
|
+
content: [{ type: 'text', text: '[AUTH_REQUIRED] 试用服务暂不可用,请注册后使用:https://www.free-api.aiconvg.xin' }],
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
const limits = trialLimits();
|