Skip to main content
Glama

minimax-remaining-mcp

MCP 서버: AI 에이전트가 MiniMax Token Plan 요금제의 남은 할당량을 알 수 있게 하고, 언제 스스로를 일시 중지하여 속도 제한(rate limit)을 피해야 하는지 알려줍니다.

DeepSeek Harness (DSH), Claude Desktop, Cursor 등 MCP 프로토콜을 지원하는 모든 클라이언트와 호환됩니다.

┌──────────────┐    stdio    ┌──────────────────────┐   HTTPS   ┌──────────────┐
│   AI 代理   │ ──────────► │  minimax-remaining-  │ ────────► │  MiniMax     │
│ (DSH 等)    │ ◄────────── │         mcp          │ ◄──────── │   Web API    │
└──────────────┘             └──────────┬───────────┘           └──────────────┘
                                        │
                                        ▼
                                 ┌─────────────┐
                                 │  Camoufox   │  一次性手动登录
                                 │  (Firefox)  │  → 持久化会话 cookie
                                 └─────────────┘

프로젝트 배경

MiniMax 웹 콘솔의 "5h 한도 / 61% 사용됨 / 2h56m 후 초기화" 패널은 실제로 두 개의 HTTP 인터페이스로 구동됩니다:

  1. /v1/api/openplatform/coding_plan/remains?GroupId=… — 5시간 고정 창의 남은 백분율 + 카운트다운

  2. /backend/account/token_plan_credit — 요금제 풀(주 단위)의 누적 할당량

두 인터페이스 모두 웹 UI의 api_key(sk-cp-... 형태)를 Bearer Token으로 허용하지 않습니다 — 사용하면 base_resp = {2062, "no active token plan"}이 반환됩니다. 유일하게 가능한 방법은 웹 세션 쿠키를 사용하는 것입니다(실제 브라우저 로그인 후의 _token). 이 프로젝트는 Camoufox를 사용해 지속적인 Firefox 프로필을 유지하여 MCP 서버 재시작 사이에도 쿠키가 보존되도록 합니다.

Related MCP server: cycles-mcp-server

5시간 고정 창(롤링 창이 아님)

MiniMax 공식 문서에 따르면:

요금제 내 할당량은 5시간 고정 창과 주간 창의 통제를 받으며, 사용하지 않은 요금제 내 할당량은 다음 결제 주기로 이월되지 않습니다.

따라서 창 경계는 고정된 시계 시간대(일반적으로 CST 00:00 10:00 / 15:00 / 20:00 등)이며, 첫 요청 시점부터 롤링되는 것이 아닙니다. 창 전환 몇 초 전에 조회하면 다음 창의 데이터가 반환됩니다. 응답의 interval_start_iso / interval_end_iso 필드가 정확히 어느 구간인지 알려줍니다.

한 줄 설치

# 方式 1:从 PyPI 安装(推荐)
pip install minimax-remaining-mcp
# 或
uv pip install minimax-remaining-mcp
# 或
uvx minimax-remaining-mcp    # 不安装直接运行

# 方式 2:从 GitHub 安装(无需 PyPI 账号)
pip install git+https://github.com/yang-cc/minimax-remaining-mcp.git

# 方式 3:本地开发模式
git clone https://github.com/yang-cc/minimax-remaining-mcp.git
cd minimax-remaining-mcp
uv venv .venv --python 3.12
uv pip install -e .

일회성 로그인

Bearer Token 경로가 없으므로 Camoufox에서 먼저 수동으로 한 번 로그인해야 합니다:

# 1. 启动服务器
python -m minimax_remaining_mcp.server
# 2. 在 MCP 客户端里调用:
minimax_login(timeout_seconds=600)

Camoufox 브라우저가 팝업되어 MiniMax 로그인 페이지가 열립니다. Cloudflare / CAPTCHA 인증과 계정 로그인을 수동으로 완료하고 브라우저가 API Keys 페이지에 도달할 때까지 진행하세요. 서버가 _token 쿠키를 자동으로 감지하여 세션을 data/cookies.json에 영구 저장합니다.

🔌 DeepSeek Harness (DSH) 통합

DSH는 @deepseek-ai/dsh-mcp-client를 통해 MCP 서버를 로드합니다. ~/.dsh/profiles/web/cordis.patch.yml에 다음 내용을 추가하세요(패키지 이름은 minimax-remaining-mcp이지만 Python 모듈 경로는 minimax_remaining_mcp.server입니다):

- insert:
  - id: minimax-remaining-mcp
    name: '@deepseek-ai/dsh-mcp-client'
    config:
      serverName: minimax
      transport: stdio
      command: <repo>/.venv/Scripts/python.exe   # 或 uv 环境的 python
      args: ['-u', '-m', 'minimax_remaining_mcp.server']
      env:
        # 暂停阈值:5h 剩余低于 30% 时触发代理暂停
        MINIMAX_PAUSE_THRESHOLD_REMAINING_PCT: '30'
        # 储存目录(可选,默认 ./data)
        # MINIMAX_DATA_DIR: E:\\codex_dir\\.dsh\\state\\minimax-remaining-mcp
      failOnStartupError: false
      toolCallTimeoutMs: 180000

DSH 통합 핵심 사항

주의 사항

설명

-u 인자

Python stdio를 버퍼링 없이 실행하여 DSH 콘솔에서 MCP 서버 로그를 즉시 확인할 수 있습니다.

Python 인터프리터 경로

설치 방식에 따라 다름:pip install → 시스템 Python 또는 venv의 python 사용uv pip install -e .<repo>/.venv/Scripts/python.exeuv tool installuv tool run minimax-remaining-mcp도 가능하지만 stdio 버퍼링 때문에 -u 필요

최초 시작 시 로그인 필요

DSH가 MCP 서버를 시작할 때 data/cookies.json이 없으면 minimax_login() 호출 시 브라우저 창이 팝업됩니다.

DSH 재시작

cordis.patch.yml 수정 후 DSH를 재시작해야 적용됩니다.

failOnStartupError: false

false로 설정하는 것을 권장합니다. 최초 시작 시 쿠키가 아직 준비되지 않아도 DSH가 즉시 오류를 보고하지 않습니다.

영구 저장 디렉터리 격리

여러 프로젝트가 동일한 DSH를 공유하는 경우 각 프로젝트마다 다른 MINIMAX_DATA_DIR을 사용하여 쿠키가 서로 덮어쓰이지 않도록 하는 것이 좋습니다.

DSH에서의 일반적인 사용법

DSH 시작 후 minimax_status()를 호출하여 남은 할당량을 판단합니다. 에이전트가 MiniMax API 호출 전마다 minimax_status()를 먼저 호출하도록 훈련시킬 수 있으며, should_pause 필드를 관찰합니다:

remaining_percent_5h < 30  → should_pause=true → 代理应停下来或转做其他事
remaining_percent_5h >= 30 → should_pause=false → 可以继续调用

더 철저한 방법은 minimax_wait_for_quota()를 호출하는 것입니다. 이 함수는 할당량이 임계값 이상으로 회복될 때까지 차단(기본값 MINIMAX_PAUSE_THRESHOLD_REMAINING_PCT)되므로 에이전트가 직접 폴링 로직을 작성할 필요가 없습니다.

도구 목록

도구

용도

minimax_status()

웹 패널의 모든 수치: 5h 남은/사용 % , 카운트다운, 요금제 누적. 임계값 미만이면 should_pause=true 설정.

minimax_window()

에이전트 로컬의 5h 관측 창 상태만 반환(MiniMax의 고정 창과는 별개이며 에이전트 자체 속도 제한용).

minimax_consume(delta=N)

로컬 창 소비 카운터를 N만큼 증가. MiniMax API 호출 후마다 한 번 호출.

minimax_wait_for_quota(target_pct=None, poll_seconds=60)

5h 남은 백분율이 ≥ target_pct가 될 때까지 차단. MCP 연결을 닫으면 중단 가능.

minimax_login(timeout_seconds=600)

수동 로그인용 Camoufox 브라우저 창 팝업.

minimax_smoke()

빠른 Camoufox 상태 확인(example.com 열기).

minimax_info()

정적 구성 + 최근 세션 메타데이터.

minimax_clear(confirm=True)

cookies / session / window 상태 삭제.

⚠️ 최초 콜드 스타트(Camoufox)는 느릴 수 있습니다

minimax_smoke()minimax_login()이 Camoufox를 처음 시작할 때 영구 저장된 Firefox 프로필 압축 해제, sqlite 데이터베이스 초기화, 확장 프로그램 로드 등을 수행하므로 일반적으로 30-90초(디스크 속도에 따라 다름)가 소요됩니다. 이는 Camoufox 콜드 스타트의 정상적인 현상이며 버그가 아닙니다 — 이후 시작에서는 data/profile/의 캐시를 재사용하여 몇 초 만에 완료됩니다.

최초 호출이 MCP 클라이언트의 toolCallTimeoutMs(DSH 기본값 180초)를 초과하여 중단된 경우 한 번 더 재시도하면 결과를 볼 수 있습니다. 콜드 스타트가 자주 발생할 것으로 예상된다면(예: CI에서 실행), 해당 MCP 클라이언트의 toolCallTimeoutMs를 300000(5분)으로 조정하세요.

minimax_status() 응답 예시

실제 진단 출력(5h 창이 소진되어 일시 중지가 트리거되어야 할 때):

minimax_status 예시 출력

다음은 정규화된 JSON 구조입니다:

{
  "ok": true,
  "source": "coding_plan",
  "remaining_percent_5h": 76,             // 5h 窗口剩余 %
  "used_percent_5h": 24,                 // 5h 窗口已用 %
  "seconds_until_reset_human": "4h21m35s",
  "interval_end_iso": "2026-08-25T12:00:00+00:00",
  "interval_status_text": "active",      // active | exhausted | inactive
  "remaining_percent_weekly": 100,
  "seconds_until_weekly_reset_human": "5d08h42m",
  "total_credits": 14000,                // 套餐累计(周维度)
  "used_credits": 3188,
  "remaining_credits": 10812,
  "user_name": "...",
  "group_id": "...",
  "should_pause": false,                 // 低于阈值时为 true
  "model_remains": [
    { "model_name": "general",  "interval_remaining_percent": 76, "interval_status": 1 },
    { "model_name": "video",    "interval_remaining_percent": 100, "interval_status": 3 }
  ]
}

일시 중지 임계값 의미

MINIMAX_PAUSE_THRESHOLD_REMAINING_PCT=305h 창의 남은 백분율이 30% 미만일 때 일시 중지(즉, 70% 이상 사용)를 의미합니다. 비교 대상은 remaining_percent_5h이며, 요금제 누적의 remaining_credits아닙니다 — 이 둘은 독립적인 지표입니다.

영구 저장 파일

모든 상태는 data/에 순수 JSON으로 저장됩니다(.gitignore에 포함됨):

data/
├── cookies.json                # Camoufox 会话 cookie
├── session.json                # 最近一次登录元数据
├── window.json                 # 代理本地的 5h 观测窗口
├── last_usage.json             # 最近一次成功的 API 响应(缓存)
└── profile/                    # Camoufox 持久化 Firefox profile(~150 MB)

coding_plan/remains가 401/403을 반환하면 전체 응답 본문이 data/last_coding_plan_failure.json에 기록되어 문제 해결에 도움이 됩니다 — 서비스가 다운된 것인지 의심되기 전에 먼저 이 파일을 확인하세요.

환경 변수

모두 선택 사항이며 기본값은 아래 표를 참조하세요.

변수

기본값

설명

MINIMAX_PAUSE_THRESHOLD_REMAINING_PCT

30

5h 남은 값이 이 값 미만이면 일시 중지.

MINIMAX_WINDOW_SECONDS

18000

에이전트 로컬 창 길이(5h).

MINIMAX_HEADFUL_ON_LOGIN

1

로그인 시 브라우저 창 강제 표시.

MINIMAX_CAMOUFOX_OS

auto

windows / macos / linux.

MINIMAX_CAMOUFOX_LOCALE

zh-CN

브라우저 언어.

MINIMAX_HTTP_TIMEOUT

15

API 요청 시간 초과(초).

MINIMAX_DATA_DIR

./data

cookies / session 저장 디렉터리.

MINIMAX_WEB_URL

https://platform.minimaxi.com

콘솔 기본 URL 재정의.

MINIMAX_USAGE_API_URL

…/backend/account/token_plan_credit

요금제 풀 endpoint.

MINIMAX_REMAINS_API_URL

…/v1/api/openplatform/coding_plan/remains

5h 창 endpoint.

MINIMAX_REMAINS_API_URL_FALLBACK

api.minimaxi.com/...

기본 endpoint 실패 시 사용.

MINIMAX_LOGIN_HINT_URL

…/user-center/basic-information/interface-key

로그인 랜딩 페이지.

로컬 개발 및 디버깅

# 启动 MCP 服务器(stdio 模式)
.venv\Scripts\python.exe -u -m minimax_remaining_mcp.server
# 或(Windows)
run.bat

# 直接探测 coding_plan 接口(无需 MCP / 浏览器)
.venv\Scripts\python.exe probe_coding_plan.py

# 检查持久化状态
cat data/cookies.json | head -c 200
cat data/session.json
cat data/last_coding_plan_failure.json   # 如果存在

PyPI에 패키지 게시(관리자용)

# 安装打包工具
pip install build twine

# 在项目根目录构建 wheel + sdist
python -m build
# → dist/minimax_remaining_mcp-0.1.0-py3-none-any.whl
# → dist/minimax_remaining_mcp-0.1.0.tar.gz

# 检查产物
twine check dist/*

# 上传到 PyPI(需要先 `twine login` 或用 token)
twine upload dist/*
# 或:uv publish dist/*

게시 후 누구나 다음을 수행할 수 있습니다:

pip install minimax-remaining-mcp
uv pip install minimax-remaining-mcp
uvx minimax-remaining-mcp    # 临时运行

제한 사항

  • Bearer-key 경로 없음. MiniMax는 현재 Coding Plan API용 구독 키를 발급하지 않습니다. 웹 콘솔의 api_key를 Bearer로 사용하면 2062 "no active token plan"이 반환됩니다. 유일한 방법은 세션 쿠키입니다.

  • Cloudflare / CAPTCHA는 수동으로 완료해야 함. 최초 로그인은 반드시 실제 사람이 수행해야 합니다. 이 프로젝트는 캡차 해결 서비스를 연동하지 않습니다.

  • 5h 창은 CST 고정 시간대입니다. 창 전환 전에 조회하면 다음 창의 데이터를 받게 됩니다. interval_start_iso / interval_end_iso가 정확히 어느 구간인지 알려줍니다.

  • 요금제 누적(remaining_credits)은 이월되지 않습니다. 주 단위 누적 풀이며 5h 창 초기화와 함께 0으로 리셋되지 않습니다.

라이선스

MIT — 자세한 내용은 LICENSE를 참조하세요.

A
license - permissive license
A
quality
B
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    A
    maintenance
    Runtime budget authority for autonomous agents - a set of tools to check, reserve, spend, and release budget before and after every costly, risky operation. The agent asks "can I afford this?" before acting, and reports what it actually used afterward.
    9
    138
    Apache 2.0
  • A
    license
    A
    quality
    Not graded
    maintenance
    Provides real-time visibility into Claude Pro and Max subscription usage limits directly within Claude Code by utilizing local OAuth tokens. It enables users to monitor session and weekly usage across different models and receive alerts regarding rate-limiting status.
    4

View all related MCP servers

Related MCP Connectors

  • Budget & cost control for AI agents — per-agent spend caps + rate limits before each call.

  • Agent Token Budget MCP — hard per-session token + spend cap with signed budget-exhausted

  • See, price, and control every tool call your AI agents make: policy checks, cost, and audit tools.

View all MCP Connectors

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/yang-cc/minimax-remaining-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server