free-api-mcp-server 0.2.4 → 0.2.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "free-api-mcp-server",
3
- "version": "0.2.4",
3
+ "version": "0.2.5",
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",
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.4",
5
+ "version": "0.2.5",
6
6
  "packages": [
7
7
  {
8
8
  "registryType": "npm",
9
9
  "identifier": "free-api-mcp-server",
10
- "version": "0.2.4",
10
+ "version": "0.2.5",
11
11
  "transport": {
12
12
  "type": "stdio"
13
13
  }
@@ -53,10 +53,30 @@ export function guestBlockedMessage(toolName) {
53
53
  ].join('\n');
54
54
  }
55
55
 
56
- // 试用/游客额度用尽文案
57
- export function guestExhaustedMessage(used, limit) {
56
+ // 下一北京零点(UTC+8 00:00)——MCP 试用/游客计数(Redis trialStore 与 stdio localCounter)
57
+ // 都按北京日界重置,额度真实恢复时刻即次日北京 0 点。返回带 +08:00 偏移的 ISO 串,
58
+ // 供客户端解析(与上游 02 QUOTA_EXCEEDED 的 resetAt 同格式)。
59
+ // 注意:上游 02 游客池的 resetAt 是北京 08:00(UTC 午夜),那是 UpstreamError 路径,不在此处。
60
+ export function nextBeijingResetAt(now = new Date()) {
61
+ const bj = new Date(now.getTime() + 8 * 3600 * 1000); // bj 的 UTC 字段 = 北京墙钟
62
+ const nextWallMidnightAsUtc = Date.UTC(
63
+ bj.getUTCFullYear(), bj.getUTCMonth(), bj.getUTCDate() + 1, 0, 0, 0,
64
+ ); // 把「次日北京 00:00 墙钟」当作 UTC 构造
65
+ const realUtc = new Date(nextWallMidnightAsUtc - 8 * 3600 * 1000); // 真实 UTC 时刻 = 墙钟 - 8h
66
+ const shown = new Date(realUtc.getTime() + 8 * 3600 * 1000); // 以北京本地呈现
67
+ const p = (n) => String(n).padStart(2, '0');
68
+ return `${shown.getUTCFullYear()}-${p(shown.getUTCMonth() + 1)}-${p(shown.getUTCDate())}T${p(shown.getUTCHours())}:${p(shown.getUTCMinutes())}:${p(shown.getUTCSeconds())}+08:00`;
69
+ }
70
+
71
+ // 试用/游客额度用尽文案:用与上游 02 相同的 QUOTA_EXCEEDED 码(客户端只认一个额度码),并带 resetAt。
72
+ // 本地计数与 Redis 试用计数均按北京日界(UTC+8 00:00)重置,故 resetAt = 次日北京 0 点。
73
+ // 「无令牌未配置」仍走 AUTH_REQUIRED(guestBlockedMessage / server 的 store_unavailable),不在此函数。
74
+ export function guestExhaustedMessage(used, limit, now = new Date()) {
75
+ const resetAt = nextBeijingResetAt(now);
76
+ const bjText = `${resetAt.slice(0, 10)} ${resetAt.slice(11, 16)}`;
58
77
  return [
59
- '[AUTH_REQUIRED] 免费试用次数已用完' + (limit != null ? `(本能力每日上限 ${limit} 次)` : '') + '。',
78
+ '[QUOTA_EXCEEDED] 免费试用次数已用完' + (limit != null ? `(本能力每日上限 ${limit} 次)` : '') + `,额度将于 resetAt(北京时间 ${bjText})恢复。`,
79
+ `resetAt: ${resetAt}`,
60
80
  `注册免费账号即可获得每日额度:${SIGNUP_URL}`,
61
81
  '拿到令牌后,在客户端 MCP 配置的 env 里设置 FREE_API_TOKEN 即可继续使用。',
62
82
  ].join('\n');