使用说明
Andrea Novel Helper MCP Server
一个为 Andrea Novel Helper (ANH) 项目提供 MCP (Model Context Protocol) 工具的服务器。
功能特性
核心工具
- get_file_outline: 获取指定文件的大纲内容
- get_directory_outline: 获取指定目录的大纲内容
- get_file_comments: 获取指定文件的批注内容
- get_character_gallery: 获取角色设定集内容
- get_project_config: 获取项目配置信息
- list_outlines: 列出所有大纲文件
- scan_project_structure: 扫描项目结构
ANH 项目结构支持
本 MCP 服务器专为 ANH 项目结构设计,支持以下文件组织方式:
project_root/
├── anhproject.md # 项目配置文件
├── novel-helper/ # ANH 辅助文件目录
│ ├── outline/ # 大纲文件目录
│ │ ├── doc/ # 对应 doc/ 目录的大纲
│ │ │ ├── file_outline.md
│ │ │ └── doc_dir_outline.md
│ │ └── root_dir_outline.md
│ ├── comments/ # 批注文件目录
│ │ └── doc/
│ │ └── file_comments.md
│ ├── character-gallery.md # 角色设定集 (Markdown)
│ └── character-gallery.json5 # 角色设定集 (JSON5)
├── doc/ # 正文文件目录
│ └── file.md
└── 其他章节目录/
安装和使用
安装
# 克隆项目
git clone <repository-url>
cd anh-mcp
# 使用 uv 安装
uv sync
# 或者使用 pip 安装
pip install -e .
作为 MCP 服务器运行
# 直接运行
anh-mcp
# 或者使用 Python 模块方式
python -m anh_mcp
在 MCP 客户端中配置
在你的 MCP 客户端配置文件中添加:
{
"mcpServers": {
"anh-mcp": {
"command": "anh-mcp",
"args": []
}
}
}
工具使用示例
获取文件大纲
{
"tool": "get_file_outline",
"arguments": {
"file_path": "doc/chapter1.md"
}
}
获取目录大纲
{
"tool": "get_directory_outline",
"arguments": {
"dir_path": "doc"
}
}
获取角色设定集
{
"tool": "get_character_gallery",
"arguments": {
"format": "markdown",
"file_name": "character-gallery"
}
}
扫描项目结构
{
"tool": "scan_project_structure",
"arguments": {
"include_outlines": true
}
}
开发
开发环境设置
# 安装开发依赖
uv sync --extra dev
# 代码格式化
black src/
isort src/
# 类型检查
mypy src/
# 运行测试
pytest
项目结构
anh-mcp/
├── src/
│ └── anh_mcp/
│ ├── __init__.py # 包初始化
│ └── server.py # MCP 服务器实现
├── tests/ # 测试文件
├── pyproject.toml # 项目配置
├── README.md # 项目说明
└── anh-analysis.md # ANH 项目分析文档
许可证
MIT License
贡献
欢迎提交 Issue 和 Pull Request!
相关项目
- Andrea Novel Helper - 原始 ANH 项目
- Model Context Protocol - MCP Python SDK
