Metadata-Version: 2.4
Name: genshin-bwiki-mcp
Version: 0.1.0
Summary: Read-only MCP server for searching and reading the Genshin Impact Bwiki.
Project-URL: Homepage, https://wiki.biligame.com/ys/首页
Author: Genshin Bwiki MCP contributors
License: MIT
Keywords: bwiki,genshin-impact,mcp,mediawiki
Classifier: Development Status :: 3 - Alpha
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Requires-Python: >=3.10
Requires-Dist: httpx<1,>=0.27
Requires-Dist: mcp<2,>=1.12
Description-Content-Type: text/markdown

# Genshin Bwiki MCP / 原神 Bwiki MCP

A read-only Python MCP server for searching and reading the community-maintained [Genshin Bwiki](https://wiki.biligame.com/ys/首页). It wraps the site's public MediaWiki API and requires no account or API key.

这是一个只读 Python MCP server，用于检索和读取社区维护的[原神 WIKI_BWIKI](https://wiki.biligame.com/ys/首页)。它封装站点公开的 MediaWiki API，不需要账号或 API Key。

> This project is an independent API client, not an official Bilibili or HoYoverse product. Wiki content remains subject to the source site's rules and rights notices.
>
> 本项目是独立 API 客户端，并非哔哩哔哩或米哈游官方产品。Wiki 内容仍受来源站点社区规则及权利声明约束。

## Tools / 工具

| Tool | Description / 功能 |
| --- | --- |
| `search_pages` | Search by keyword and return titles, snippets, IDs, timestamps and source URLs. / 按关键词搜索页面。 |
| `get_page_summary` | Return bounded plain text derived from a rendered page. / 返回从渲染页面提取、长度受限的纯文本。 |
| `get_page` | Read bounded HTML and/or original wikitext by title or page ID. / 按标题或 ID 读取 HTML 和/或 wikitext。 |
| `site_info` | Check site identity, MediaWiki version, language and URLs. / 检查站点身份、版本、语言及 URL。 |

All tool responses are JSON strings with one of these envelopes:

```json
{"ok": true, "data": {}}
```

```json
{"ok": false, "error": "ValueError", "message": "..."}
```

## JSON configuration / JSON 配置

Install [uv](https://docs.astral.sh/uv/), then import [`example.json`](example.json) into an MCP client that accepts the common `mcpServers` format. The included file points at this checkout and uses `uvx --refresh --from` so it can run before a PyPI release.

安装 [uv](https://docs.astral.sh/uv/)，然后把 [`example.json`](example.json) 导入支持通用 `mcpServers` 格式的客户端。示例已经指向当前项目目录，并使用 `uvx --refresh --from`，因此不依赖预先发布到 PyPI。

For another machine, replace the path after `--from` with that machine's absolute project path. After a future PyPI release, the shorter configuration is:

换到其他机器时，请把 `--from` 后的路径改为项目的绝对路径。未来发布到 PyPI 后，可使用更短的配置：

```json
{
  "mcpServers": {
    "genshin_bwiki": {
      "command": "uvx",
      "args": ["--refresh", "genshin-bwiki-mcp"]
    }
  }
}
```

## Local development / 本地开发

```bash
uv sync
uv run pytest -q
uv run genshin-bwiki-mcp
uv build
```

The server uses stdio transport. Do not print debugging output to stdout while it is attached to an MCP client.

服务器使用 stdio 传输；连接 MCP 客户端时，请勿向 stdout 输出调试信息。

## API behavior / API 行为

- Base endpoint / 基础端点：`https://wiki.biligame.com/ys/api.php`
- Requests are anonymous, read-only, time-limited, and carry an identifying user agent. / 请求匿名、只读、带超时和可识别 User-Agent。
- Output size limits reduce accidental context flooding. / 输出长度限制可避免意外占满模型上下文。
- Bwiki does not return content through the usual MediaWiki Extracts response, so `get_page_summary` converts `action=parse` HTML locally. / Bwiki 未通过常见 Extracts 响应返回正文，因此摘要工具会在本地转换 `action=parse` HTML。
