Skip to main content
Glama
wzkzd666

wuwa-mcp

by wzkzd666

鸣潮 MCP Server

一个 Model Context Protocol (MCP) 服务器,用于获取《鸣潮》游戏的角色与声骸信息,并以 Markdown 格式返回,便于大型语言模型直接消费。

📄 English Documentation | 🇨🇳 中文文档

本仓库是 jacksmith3888/wuwa-mcp-server 的二次修改版, 上游停留在 v2.0.1(MIT 许可),当前版本 v2.2.0,由 颗粒 维护。 改动要点:适配 mcp 2.x、修复攻略子页抓取失败、输出去重、移除长度截断。 完整清单见文末「版本改动」。

功能特点

  • 角色信息查询:获取角色详情,含技能、养成攻略

  • 声骸信息查询:获取声骸套装的详细信息

  • 角色档案查询:获取角色档案信息

  • LLM 友好输出:结果格式为大型语言模型优化,内容去重且不截断

  • 双传输模式:支持 STDIO 与 Streamable HTTP

Related MCP server: WuWa MCP Server

环境要求

  • Python ≥ 3.12

  • uv(包管理与运行)

安装

从 PyPI 安装(推荐)

# 装进你的项目
uv add wuwa-mcp

# 或者不安装,直接运行
uvx wuwa-mcp

从 GitHub 安装

uv add "git+https://github.com/wzkzd666/wuwa-mcp-server"

# 锁定到某个版本
uv add "git+https://github.com/wzkzd666/wuwa-mcp-server@v2.2.0"

从本地源码安装(开发用)

# 以路径依赖装进你的项目
uv add /path/to/wuwa-mcp-server

# 安装到本仓库自身环境
cd /path/to/wuwa-mcp-server
uv sync

# 或先构建再安装产物
uv build
uv pip install dist/*.whl

⚠️ 不要安装 wuwa-mcp-server —— PyPI 上那个是上游 v2.0.1,不含 mcp 2.x 适配与去重 / 缓存修复,在 mcp 2.x 环境下启动即崩。 本项目发布的包名是 wuwa-mcp,import 名与包名一致为 wuwa_mcp(import wuwa_mcp)。 唯一的控制台命令也是 wuwa-mcp。

命名对照

用途

名称

PyPI 分发包名

wuwa-mcp

import 名

wuwa_mcp

控制台命令

wuwa-mcp(唯一)

MCP 服务器名

wuwa-mcp

使用方法

任何支持 MCP 的客户端(Claude Desktop、Cherry Studio、Cline 等)都可用同一份配置接入。

从 PyPI 安装后,最简配置:

{
  "mcpServers": {
    "wuwa-mcp": {
      "command": "uvx",
      "args": ["wuwa-mcp"]
    }
  }
}

从本地源码或路径运行时:

{
  "mcpServers": {
    "wuwa-mcp": {
      "command": "uv",
      "args": ["--directory", "/path/to/wuwa-mcp-server", "run", "wuwa-mcp"]
    }
  }
}

与 Claude Desktop 一起运行

  1. 下载 Claude Desktop

  2. 创建或编辑配置文件:

    • macOS:~/Library/Application Support/Claude/claude_desktop_config.json

    • Windows:%APPDATA%\Claude\claude_desktop_config.json

  3. 填入上面的 mcpServers 配置,然后重启客户端

与 Cherry Studio 一起运行

  1. 下载 Cherry Studio

  2. 设置 → MCP 服务器 → 添加,填入上面的 mcpServers 配置

可用工具

1. 角色信息工具

async def get_character_info(character_name: str) -> str

在库街区上查询角色详细信息(含技能、养成攻略)并以 Markdown 格式返回。

参数:

  • character_name: 要查询的角色的中文名称

返回: 包含角色信息的 Markdown 字符串(完整原文,仅去重、不截断),或者在找不到角色或获取数据失败时返回错误消息。

2. 声骸信息工具

async def get_artifact_info(artifact_name: str) -> str

在库街区上查询声骸详细信息并以 Markdown 格式返回。

参数:

  • artifact_name: 要查询的声骸套装的中文名称

返回: 包含声骸信息的 Markdown 字符串,或者在找不到声骸或获取数据失败时返回错误消息。

3. 角色档案工具

async def get_character_profile(character_name: str) -> str

在库街区上查询角色档案信息并以 Markdown 格式返回。

参数:

  • character_name: 要查询的角色的中文名称

返回: 包含角色档案信息的 Markdown 字符串,或者在找不到角色或获取数据失败时返回错误消息。

开发和测试

本地运行

# STDIO 模式(默认)
uv run python -m wuwa_mcp.server

# HTTP 模式
TRANSPORT=http uv run python -m wuwa_mcp.server

代码质量

项目使用 ruff 进行代码格式化和静态分析。

# 安装开发依赖
uv sync --extra dev

# 格式化所有 Python 代码
uv run ruff format .

# 检查代码问题
uv run ruff check .

# 自动修复可修复的问题
uv run ruff check --fix .

Ruff 配置:行长度 120 字符,目标 Python 3.12,启用 pycodestyle / pyflakes / isort / 命名约定 / pyupgrade / bugbear / 代码简化等规则,强制单行导入。

Docker 部署

# 构建镜像
docker build -t wuwa-mcp .

# 运行容器(HTTP 模式,监听 8081)
docker run -p 8081:8081 wuwa-mcp

# 运行容器(STDIO 模式)
docker run -e TRANSPORT=stdio wuwa-mcp

详细功能

结果处理

  • 清理并格式化库街区数据

  • 为 LLM 消费优化格式

  • 支持并行处理提高性能

  • 异步操作避免阻塞

传输模式

  • STDIO 传输:适用于本地客户端,如 Claude Desktop

  • Streamable HTTP 传输:适用于云端部署和远程访问

  • 通过环境变量 TRANSPORT 自动切换模式

贡献

本 fork 由 颗粒 维护(原作者 jacksmith3888)。改动以「能跑通 + 数据完整」为目标,未做大规模重构。

欢迎提出问题和拉取请求。一些可改进的方向:

  • 增加对更多《鸣潮》游戏内容的支持

  • 增强内容解析选项

  • 增加对频繁访问内容的缓存层

  • 支持更多语言的本地化

许可证

本项目采用 MIT 许可证,原始版权归 jacksmith3888 所有。

本地修改部分(v2.2.0,维护者:颗粒)同样遵循 MIT 许可证。

版本改动(维护者:颗粒)

v2.2.0

  • 🔤 统一命名:import 包目录 wuwa_mcp_server → wuwa_mcp,与分发包名 wuwa-mcp 完全一致(PEP 503 归一化),不再需要 [tool.uv.build-backend] module-name 特殊声明。控制台命令也只保留 wuwa-mcp 一个,移除 wuwa-mcp-server 别名。这是一处破坏性变更:原 import wuwa_mcp_server 需改为 import wuwa_mcp,原 wuwa-mcp-server 命令需改为 wuwa-mcp

  • 🐛 修复循环导入:core/__init__.py 顶层 from .container import ... 与 services 反向依赖 core 构成环,导致「先 import services.character_service」直接 ImportError(必须先 import core 才能用)。改为 PEP 562 模块级 __getattr__ 惰性导出 DIContainer / get_container / reset_container,对外 API 不变

  • 🧹 删除死代码 542 行:经 AST 可达性分析 + 全项目引用计数双重确认,移除 26 个零引用符号——13 个重复的工厂函数(create_*,container 已直接构造)、3 个 legacy 兼容壳(LegacyMarkdownConverter、ContentParser、CharacterDevelopmentStrategy)、6 个未被引用的 protocol / ABC、2 个未用异常类、2 个未用 value object(含级联孤立的 ModuleData)

  • 🧹 裁剪冗余再导出:builders / domain / infrastructure / infrastructure.api / parsers / services 六个 __init__.py 的急切再导出无人消费,精简为仅保留 docstring,降低耦合与导入开销

  • 🩹 修复版本漂移:__init__.py 的 __version__ 原硬编码 2.0.1(与 pyproject.toml 不符),改为从 importlib.metadata 读取,杜绝再次漂移

  • 🩹 修复潜在 F821:artifact_service / character_service 中 "MarkdownService" 前向引用从未导入,补 TYPE_CHECKING 导入

  • ✅ 质量:全项目 ruff check --select F 通过;34 个模块独立进程导入测试 0 个 ImportError

v2.1.0(本仓库 fork)

相对上游 v2.0.1 的改动:

  • 🔌 适配 mcp 2.x:FastMCP → MCPServer,修复原版在 mcp 2.x 下启动即崩的 ImportError

  • 🩹 修复攻略子页抓取偶发失败:根因是 HTTP client not initialized(原 _fetch_strategy_content 裸用 api_client 未进 async context)

  • ⚡ 新增 API 响应 TTL 缓存(600s),减少库街区实时请求

  • ♻️ 输出去重:修复「整页渲染两遍」,并移除长度截断,改为始终返回完整原文

  • 📊 表格与标题质量修复:行名缺失、首列空白、blob URL 泄漏、重复表 / 残缺表清理、空标题、数字型 tab 补 Lv. 前缀、全角 % 归一

  • 🧹 清理:移除 Smithery 硬依赖,get_character_info 不再有 full 参数

文件

改动

server.py

mcp.server.fastmcp.FastMCP → mcp.server.mcpserver.MCPServer;移除手搓 Starlette/SSE 分支,改用 mcp 2.x 原生 streamable_http_app();移除 @smithery.server() 分支并补 import sys;get_character_info 不再有 full 参数(始终返回完整内容)

character_repository.py

新增托管方法 get_entry_detail(entry_id)(内部 async with self.api_client),供攻略子页复用

character_service.py

_fetch_strategy_content 改调 get_entry_detail()(修复 ConnectionException);末尾固定 postprocess_markdown(..., max_chars=0) —— 只去重、不截断

kuro_api_client.py

新增 _TTLCache(ttl=600s),缓存 list:char / list:artifact / detail:{entry_id}

markdown_service.py

新增模块级 postprocess_markdown():先按空行分块去重相邻重复块(修「整页渲染两遍」),再按需截断(max_chars<=0 表示不截断)

parsers/html_converter.py

表格行名修复、首列空白修复、blob URL 泄漏修复、重复表与残缺表清理

parsers/content_parser.py

空标题清理、数字型 tab 标题补 Lv. 前缀、全角 % 归一为半角 %

pyproject.toml

mcp[cli]>=1.8.0 → mcp>=2.0.0;移除 smithery 依赖与 [tool.smithery] 段;版本升 2.1.0

v2.0.1(上游 jacksmith3888)

  • 🏗️ 架构重构:采用领域驱动设计(DDD)架构,清晰的分层结构

  • 🔧 代码质量:集成 ruff 代码格式化和静态分析工具

  • 📝 现代化语法:使用 Python 3.12+ 现代类型注解(dict/list 替代 Dict/List)

  • 🧹 代码清理:移除旧有代码,统一代码风格和质量标准

  • ✅ 支持 Streamable HTTP 传输

  • 🔄 向后兼容:同时支持传统的 STDIO 和新的 HTTP 传输模式

  • 🌐 云端部署就绪:适配 VPS、Google Cloud Run、AWS Lambda 等云环境

  • 📦 依赖注入:使用依赖注入容器管理服务实例

  • 🐳 Docker 优化:使用 uv 的多阶段构建,提升构建速度并减小镜像体积

Available Tools

3 tools
get_artifact_infoB

获取库街区上的声骸详细信息并以 Markdown 格式返回。

    参数:
        artifact_name: 要查询的声骸套装的中文名称。

    返回:
        包含声骸信息的 Markdown 字符串,
        或者在找不到声骸或获取数据失败时返回错误消息。
    
ParametersJSON Schema
NameRequiredDescriptionDefault
artifact_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.4/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden. It discloses the return format and that a failure/not-found case yields an error message, which is useful, but it says nothing about auth requirements, rate limits, or whether lookups are cached — gaps that annotations would normally cover.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Purpose is front-loaded, then cleanly organized into parameter and return sections. It is appropriately sized with little wasted text, though the return section somewhat duplicates what the output schema already provides.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness4/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

For a single-parameter lookup tool with an existing output schema, the definition covers the purpose, the one parameter's meaning, and failure behavior. It is complete enough to invoke correctly, with only minor missing context about prerequisites.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema description coverage is 0% (schema only says 'Artifact Name'), so the description must compensate. It does by clarifying that artifact_name is the Chinese name of the artifact set, a meaningful constraint beyond the bare schema.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource ('获取...声骸详细信息') and the output format (Markdown). It is clearly distinct from the character-focused siblings by targeting 声骸 (artifacts/echoes), though it never names or contrasts those siblings explicitly.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description only says what the tool does; it gives no guidance on when to prefer it over get_character_info or get_character_profile, and no prerequisites or exclusions are mentioned.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_character_infoA

获取库街区上的角色详细信息包括角色技能,养成攻略等,并以 Markdown 格式返回。

    参数:
        character_name: 要查询的角色的中文名称。

    返回:
        包含角色信息的 Markdown 字符串(完整内容,只做去重、不截断),
        或者在找不到角色或获取数据失败时返回错误消息。
    
ParametersJSON Schema
NameRequiredDescriptionDefault
character_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

A3.5/5.0
Behavior4/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries the full burden and does disclose useful runtime behavior: output is a Markdown string, content is returned in full (deduplicated but never truncated), and an error message is returned when the character is missing or the fetch fails. It omits auth/rate-limit or source-freshness details, but the failure-mode and completeness disclosure is well beyond what the schema provides.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loads the purpose, then cleanly separates 参数 and 返回 sections. There is minor redundancy in restating the Markdown return twice, but overall it is tight and well organized.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Return values are largely covered by the output schema, and error behavior is documented, but the description never addresses sibling selection against get_character_profile, which is the single biggest ambiguity an agent faces with this tool.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate, and it does: it states that character_name is the Chinese name of the character, a non-obvious constraint on the value format that the schema's bare 'string' type does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

Names a specific verb (获取) and resource (角色详细信息), and enumerates the content retrieved (角色技能、养成攻略) plus the output format (Markdown). However, it does nothing to distinguish itself from the very similar sibling get_character_profile, so an agent cannot tell the two apart from the text alone.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

No when-to-use guidance, no prerequisites, and no mention of the closely-named alternative get_character_profile. The agent is left to guess which of the two character tools to call.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

get_character_profileB

获取库街区上的角色档案信息并以 Markdown 格式返回。

    参数:
        character_name: 要查询的角色的中文名称。

    返回:
        包含角色档案信息的 Markdown 字符串,
        或者在找不到角色或获取数据失败时返回错误消息。
    
ParametersJSON Schema
NameRequiredDescriptionDefault
character_nameYes

Output Schema

ParametersJSON Schema
NameRequiredDescription
resultYes

TDQS

B3.3/5.0
Behavior3/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

No annotations are provided, so the description carries the full burden. It does disclose the return format (Markdown) and the failure behavior (returns an error message when the character is not found or fetching fails), which is useful. It does not state whether data is fetched live, whether any authentication or rate limits apply, or the freshness/incompleteness of profiles.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

Front-loaded with the core purpose followed by clearly labelled parameter and return sections. No wasted sentences, though the return-value section partly duplicates what the existing output schema already expresses.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

The output schema already covers return values, so re-explaining them in prose is mild redundancy rather than a gap. The real shortfall is the absence of any routing guidance distinguishing this tool from get_character_info, which is the main thing an agent needs here.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters4/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so the description must compensate, and it does: it identifies the single parameter as the character's Chinese name. The 'Chinese name' constraint is meaningful because it hints that non-Chinese names/aliases will not resolve, something the bare string schema does not convey.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose4/5

Does the description clearly state what the tool does and how it differs from similar tools?

States a specific verb and resource (retrieve character profile from 库街区) plus the output format (Markdown), which is concrete. However it offers no differentiation from the sibling get_character_info, leaving the agent unable to tell which of the two near-identical-sounding tools to pick.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

There is no when-to-use guidance and no mention of alternatives. With siblings named get_character_info and get_artifact_info, the description should have said how get_character_profile differs, but it gives none.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

  1. 3 tool updatesv2.1.0
    • First observedget_artifact_info
    • First observedget_character_info
    • First observedget_character_profile

TDQS

B3.4/5.0

Scored across 3 tools

Disambiguation3/5

get_character_info and get_character_profile both fetch character data by name, and the distinction (skills/guides vs profile/archive) is not immediately obvious from the names. get_artifact_info is clearly distinct, but the two character tools have overlapping boundaries that could cause misselection.

Naming Consistency5/5

All three tools follow the same get_<entity>_<type> snake_case pattern (get_artifact_info, get_character_info, get_character_profile). The convention is predictable and easy to parse.

Tool Count3/5

Three retrieval tools is thin for a game data server that likely has many entity types and would benefit from list/search operations. It covers only the most basic lookups, making the surface feel under-scoped.

Completeness2/5

There is no way to list or search for valid character or artifact names, so agents are stuck unless the user already knows exact Chinese names. Other game data (e.g. weapons) is absent, representing significant gaps for the domain.

Maintenance

ActivityMaintained
ResponsivenessNo issues

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    D
    maintenance
    Enables AI assistants to search and access Arknights game data including operator information, enemy intelligence, skills, talents, and attributes through PRTS.wiki integration. Provides fuzzy search functionality for operators and enemies with clean Markdown output.
    9
    MIT
  • A
    license
    A
    quality
    A
    maintenance
    Arknights PRTS Wiki MCP Server — queries the PRTS Wiki API for full-text search and article extraction, and serves auto-synced operator archives, voice lines, and story/event scripts from game data. Designed for fan-creation AI agents that need accurate lore, character profiles, and in-character dialogue references.
    9
    10
    MIT
  • F
    license
    Not graded
    quality
    A
    maintenance
    Enables querying the Purupuru universe codex programmatically, including characters, locations, Jani variants, and Wuxing elements, with anti-hallucination validation and fuzzy search.
    -