mihoyo-mcp
mihoyo-mcp
독립적인 米哈游 MCP Server —— 동시에 **米游社(중국 서버)**와 **HoYoLAB(국제 서버)**를 대상으로 하며, 내부적으로는 seriaati/genshin.py(MIT)에 의존합니다. 어떤 MCP 클라이언트 (nahida-bot、Claude Desktop、Codex……)에서든 그대로 사용할 수 있습니다.
설계 범위
MCP는 “米哈游와 어떻게 대화할지”를 담당하고, 클라이언트는 “언제 물어볼지, 물어본 뒤 누구에게 알릴지”를 담당합니다.
스케줄링(cron)、임계값 정책、메시지 푸시 → 클라이언트(nahida-bot에 Scheduler / Channel이 이미 있음)
로그인、자격 증명 저장、API 호출、알림 중복 제거 → 이 서비스
자격 증명은 절대 보안 경계를 벗어나지 않습니다:Cookie는 항상 서비스 내부에만 존재하며(Fernet 암호화), 도구 결과에는
account_id만 들어 있고, Agent context에는 어떤 token도 나타나지 않습니다
┌─────────────────────┐
│ nahida-bot │
│ Cron / Scheduler │
│ │ │
│ ▼ │
│ MCP Client ───────────────┐
│ ▼ │ │ MCP (stdio)
│ QQ Channel │ ▼
└─────────────────────┘ ┌──────────────────┐
│ mihoyo-mcp │
│ QR login │
│ credential vault │
│ daily notes │
│ alert dedup state │
└────────┬──────────┘
│
genshin.py
│
米游社 / HoYoLAB APIRelated MCP server: Xiaohongshu MCP Server
현재 기능
기능 | 상태 |
米游社 QR 로그인(비차단 start/poll) | ✅ genshin.py의 웹 QR 연동을 재사용 |
다중 계정 + 게임 캐릭터(uid)발견 | ✅ |
星穹铁道 실시간 메모 | ✅ |
原神 실시간 메모 | ✅ |
绝区零 실시간 메모 | ✅ |
星铁 알림 검사(라운드 간 중복 제거) | ✅ |
HoYoLAB 로그인 | ⏳ 미연동(로드맵 참고) |
도구 목록
도구 | 설명 |
| QR 로그인을 생성하고, |
| QR 스캔 상태를 폴링: |
| 로그인된 계정 수, 완료를 기다리는 로그인 세션 |
| 계정과 그 게임 캐릭터(uid)목록을 반환, 자격 증명은 포함하지 않음 |
| 계정 아래의 게임 캐릭터를 다시 발견 |
| 개척력(비축분 포함), 일일 훈련, 시뮬레이션 유니버스, 파견 |
| 레진, 동천 보전, 일일 임무, 파견 |
| 배터리, 활동도, 비디오샵 등 |
| 알림을 보낼 만한 변경만 반환. 빈 목록 = 조용히 있음 |
account_id는 계정이 하나뿐일 때 생략할 수 있습니다.
명명 관련 설명:초기 설계에서는
mihoyo.auth.start_qr_login처럼 점으로 구분된 명명을 사용했지만, MCP 상태 (SEP-986)는 도구명이^[a-zA-Z0-9_-]{1,64}$를 충족해야 합니다. 점(.)이 있으면 일부 클라이언트가 로드를 거부할 수 있습니다. 그래서 플랫한 snake_case 명명을 채택하고,auth_/accounts_/starrail_같은 접두사를 네임스페이스로 사용했습니다.
왜 check_alerts가 MCP에 있는가
스테미나 임계값 판단(217 >= 200 && recovery <= 1800)은 LLM token을 태울 필요가 없습니다. 그리고 “파견이 돌아왔습니다”를
폴링할 때마다 전부 알리는 것은 받아들일 수 없습니다. 알림 중복 제거 상태(armed/re-arm)는 米游社 연동 상태에 속하므로,
자연스럽게 이 서비스가 보유하는 것이 맞습니다. 클라이언트의 cron은 다음만 하면 됩니다.
starrail_check_alerts() → alerts == [] → 静默
→ alerts != [] → 推送消息빠른 시작
uv sync # 安装依赖
uv run pytest # 运行测试
uv run python scripts/smoke_stdio.py # stdio 握手冒烟测试
uv run mihoyo-mcp # 启动 stdio server클라이언트 설정 예시(Claude Desktop / stdio MCP를 지원하는 모든 클라이언트):
{
"mcpServers": {
"mihoyo": {
"command": "uv",
"args": ["run", "--directory", "D:/Projects/mihoyo-mcp", "mihoyo-mcp"]
}
}
}환경 변수 설정
변수 | 기본값 | 설명 |
|
| 데이터 파일 경로(계정 / 자격 증명 / 알림 상태) |
| 자동 생성 | 자격 증명 암호화 key. 운영 환경에서는 secret store에 보관할 것을 권장 |
|
|
|
|
| 로그 레벨(로그는 stderr로 출력되고, stdout은 MCP 프로토콜 전용으로 유지됨) |
데이터 디렉터리 내용:
~/.mihoyo-mcp/
├── accounts.json # 公开账号元数据(无秘密)
├── credentials.enc # Fernet 加密的 Cookie/token 库
├── alert_state.json # 告警去重状态
└── fernet.key # 未设置环境变量时自动生成的 key(带告警日志)디렉터리 구조
src/mihoyo_mcp/
├── server.py # MCPServer 装配 + stdio 入口
├── config.py # 环境变量配置
├── context.py # AppContext 单例装配
├── errors.py # 领域错误(映射为 MCP tool error)
├── accounts/ # 账号模型 / 注册表 / 加密凭据库
├── auth/ # 扫码登录(start/poll 会话)
├── games/ # genshin.py 客户端工厂 + 便笺获取/归一化
├── alerts/ # 告警去重状态机(纯逻辑,可测)
└── tools/ # MCP 工具注册(auth / accounts / notes)로그인 흐름(米游社)
auth_start_qr_login("miyoushe")→qr_png_base64(또는login_url)에서 생성된 QR 코드를 사용자에게 보냅니다사용자가 米游社 App으로 QR을 스캔하고 휴대폰에서 확인합니다
auth_poll_qr_login(session_id)를confirmed가 될 때까지 폴링합니다서비스 내부에서 v2 쿠키(
account_id_v2/account_mid_v2/ltoken_v2/cookie_token_v2…)와 자동으로 저장하고, 게임 캐릭터를 자동 발견합니다. 이후 Agent는miyoushe:123456형태의account_id만 보게 됩니다.
로드맵
소비 측(nahida-bot #52 등)의 우선순위에 따라 정렬:
✅ Account / Auth —— 米游社 QR 로그인, 다중 계정, 캐릭터 발견
✅ Daily Note + 알림 —— 星铁/原神/绝区零 실시간 메모,
check_alerts⏳ HoYoLAB 로그인 —— 이메일/비밀번호(genshin.py는 이미 지원)또는 해외 서버(redirecta) QR 스캔(endpoint 검증 필요)
참가 출석 / 교환 코드(
check_in/codes.list/codes.redeem)Profile / 캐릭터 전시(Enka, 패널 조회)
게임 정보 / Build / 육성 계산(hakush.in / Yatta / Ambr)
가챔 가져오기와 통계
Renderer(선택적 이미지 카드 생성, 도구는 구조화된 데이터를 반환 + 독립 렌더링 도구)
참고 프로젝트 및 라이선스
프로젝트 | 라이선스 | 이 프로젝트에서의 역할 |
MIT | 직접 의존성:API 캡슐화, DS, 쿠키, QR 로그인 쿨 | |
GPL-3.0 | 아키텍처 참고(계정/자격 증명/알림),코드 래칭 | |
MIT | 중국국가 동작 참고(오류 처리, 메모 필드의 함정) | |
[UIGF-org/mihoyo-api-collect](https://github.com/UIGF-org/ 미나토-api-collect) | CC BY-NC 4.0 | 프로토콜 사전, 조회 확인용, 구현을 배아오거나 이식하지 않음 |
미표기 | 최신 중국국가 QR 로그인 참고 |
이 프로젝트는 MIT License를 사용합니다.
Maintenance
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
- AlicenseNot gradedqualityDmaintenanceEnables interaction with Discord using personal user tokens instead of bot applications, allowing for seamless message management and server exploration. It provides tools for reading history, sending messages, and searching across channels and DMs directly through MCP-compatible clients.6MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that enables AI assistants to interact with Xiaohongshu to publish image notes, search content, and manage account details. It uses Playwright to securely handle session authentication and API signatures through the platform's internal network context.2MIT
- FlicenseNot gradedqualityCmaintenanceAn MCP server enabling LLMs to interact with the NodeSeek forum, supporting account status retrieval, daily check-in, post browsing, reading, replying, and posting.4
- AlicenseNot gradedqualityCmaintenanceA MCP server that exposes QQ bot capabilities over Streamable HTTP, enabling clients to query bot status, read group and friend info, fetch chat history, and send group/private text messages.2MIT
Related MCP Connectors
MCP-native open-source Notion alternative: read & write pages, databases and kanban boards.
MCP server for GLM chat completions using Zhipu AI models via AceDataCloud
MCP server for AI dialogue using various LLM models via AceDataCloud
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
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/AI1379/mihoyo-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server