mihoyo-mcp
Provides miHoYo account integration via QR code login, multi-account and game role discovery, and real-time daily note retrieval for Star Rail, Genshin Impact, and Zenless Zone Zero, including stamina/resin/battery, expeditions, and alert checks with deduplication.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mihoyo-mcpCheck my Star Rail daily note and stamina alerts"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mihoyo-mcp
A standalone miHoYo MCP server — targeting both MiYoShe (CN server) and HoYoLAB (global server), built on seriaati/genshin.py (MIT). Any MCP client (nahida-bot, Claude Desktop, Codex...) can use it directly.
Design boundaries
The MCP handles "how to talk to miHoYo"; the client handles "when to ask, and who to tell afterwards".
Scheduling (cron), threshold policies, message push → the client (nahida-bot already has Scheduler / Channel)
Login, credential storage, API calls, alert dedup → this service
Credentials never leave the security boundary: Cookies stay inside the service for the whole time (Fernet encryption), the tool results only contain
account_id, and no token ever appears in the Agent context
┌─────────────────────┐
│ 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
Current capabilities
Capability | Status |
MiYoShe QR code login (non-blocking start/poll) | ✅ Reuses genshin.py's web QR flow |
Multi-account + game character (uid) discovery | ✅ |
Honkai: Star Rail real-time note | ✅ |
Genshin Impact real-time note | ✅ |
Zenless Zone Zero real-time note | ✅ |
Star Rail alert check (dedup across polls) | ✅ |
HoYoLAB login | ⏳ Not integrated (see roadmap) |
Tool overview
Tool | Description |
| Creates a QR login session and returns |
| Polls the QR scan status: |
| Number of logged-in accounts and pending login sessions |
| Lists accounts and their game characters (uid), without any credentials |
| Re-discovers the game characters under an account |
| Trailblaze Power (with surplus), Daily Training, Simulated Universe, assignments |
| Resin, Realm currency, Daily Commissions, expeditions |
| Battery, Activity, and Video Store, etc. |
| Returns only "changes worth telling"; empty result = stay silent |
account_id can be omitted when there is only one account.
About naming: the original design used dot-like names such as
mihoyo.auth.start_qr_login, but the MCP spec (SEP-986) requires tool names to match^[a-zA-Z0-9_-]{1,64}$. Dots make some clients refuse to load, so flat snake_case naming-ish, usingauth_/accounts_/starrail_prefixes as namespaces.
Why check_alerts is part of the MCP
The stamina threshold check (217 >= 200 && recovery <= 1800) does not need to burn LLM tokens, and announcing "the expedition is back" on every poll is unacceptable. The alert dedup state (armed/re-arm) is part of the MiYoShe integration state and naturally belongs to this service. The client's cron only needs:
starrail_check_alerts() → alerts == [] → 静默
→ alerts != [] → 推送消息Quick start
uv sync # 安装依赖
uv run pytest # 运行测试
uv run python scripts/smoke_stdio.py # stdio 握手冒烟测试
uv run mihoyo-mcp # 启动 stdio serverClient configuration example (Claude Desktop / any MCP client that supports stdio):
{
"mcpServers": {
"mihoyo": {
"command": "uv",
"args": ["run", "--directory", "D:/Projects/mihoyo-mcp", "mihoyo-mcp"]
}
}
}Configuration (environment variables)
Variable | Default | Description |
|
| Data directory (accounts / credentials / alert states) |
| Auto-generated | Credential encryption key; in production, prefer putting it into a secret store |
|
| Default stamina threshold for |
|
| Log level (logs go to stderr; stdout is reserved for the MCP protocol) |
Data directory contents:
~/.mihoyo-mcp/
├── accounts.json # 公开账号元数据(无秘密)
├── credentials.enc # Fernet 加密的 Cookie/token 库
├── alert_state.json # 告警去重状态
└── fernet.key # 未设置环境变量时自动生成的 key(带告警日志)Directory structure
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)Login flow (MiYoShe)
auth_start_qr_login("miyoushe")→ send the QR code fromqr_png_base64(orlogin_url) to the userThe user scans with the 米游社 App and confirms on their phone
auth_poll_qr_login(session_id)polls until it returnsconfirmedThe service internally stores the v2 cookies (
account_id_v2/account_mid_v2/ltoken_v2/cookie_token_v2…) and discovers the game characters; after that the Agent only sees anaccount_idlikemiyoushe:123456
Roadmap
Ordered by consumer needs (nahida-bot #52 etc.):
✅ Account / Auth — MiYoShe QR login, multi-account, character
✅ Daily Note + checks — Star Rail / Genshin / ZZZ daily notes,
check_values⏳ HoYoLAB login — email/password (already supported by genshin.py) or OS QR scan (endpoint to be verified/scannable)
Check-in / redemption codes (
check_in/codes.list/codes.redeem)Profile / character showcase (Enka, image panel query)
Game data / Build / progression calculator (hakush.in / Yatta / Ambr)
Gacha import and stats
Renderer (optional image-card generation; the tool returns structured data plus a rendering service)
Referenced projects & license
Project | License | Role in this project |
MIT | Direct dependency: API wrapper, DS, cookie and QR flow | |
GPL-3.0 | Arc, Opt, tokens, does not borrow code | |
MIT | CN-server behavior reference (error handling, daily note field traps) | |
CC BY-NC 4.0 | Protocol dictionary, for verification only, no implementation reuse | |
Unspecified | Modern CN-server QR login reference |
This project is licensed under the 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