orly-mcp 是一个 MCP(模型上下文协议)服务器,用于生成 O'RLY?(对 O'Reilly 的模仿)风格的书籍封面,这些封面可直接在 Claude Desktop 应用程序中显示。
只需将以下内容添加到您的 MCP 配置中:
// ... 其他 MCP 服务器 ...
"mcp-orly": {
"command": "uvx",
"args": [
"orly-mcp@latest"
]
}
// ... 其他 MCP 服务器 ...
# 克隆仓库
git clone [your-repo-url]
cd orly-mcp
# 创建虚拟环境并安装依赖
uv venv .venv
uv pip install -r requirements.txt
# 测试示例图像生成
uv run python test_mcp.py
# 运行综合测试
uv run python test_comprehensive.py
# 启动 MCP 开发服务器
python start_server.py
将此 MCP 服务器添加到您的 Claude Desktop 配置文件(claude_desktop_config.json
)中:
{
"mcpServers": {
"orly-local": {
"command": "uv",
"args": [
"run",
"--with", "fastmcp",
"--with", "pillow",
"--with", "fonttools",
"--with", "requests",
"python",
"/path/to/your/orly-mcp/orly_mcp/server.py"
],
"cwd": "/path/to/your/orly-mcp"
}
}
}
重要提示:请将 /path/to/your/orly-mcp
替换为您实际的项目路径。
# 以可编辑模式安装
uv pip install -e .
# Claude Desktop 配置
{
"mcpServers": {
"orly-local": {
"command": "uvx",
"args": ["--from", "/your/path/to/orly-mcp", "orly-mcp"]
}
}
}
如果您看到此错误,说明 MCP 依赖项不可用:
cd /path/to/your/orly-mcp
uv pip install -r requirements.txt
请确保您的 Claude Desktop 配置通过 --with
标志包含所有必需的依赖项。
确保所有依赖项都在您的 Claude Desktop 配置中指定:
"args": [
"run",
"--with", "fastmcp",
"--with", "pillow",
"--with", "fonttools",
"--with", "requests",
"python",
"/your/path/to/orly_mcp/server.py"
]
运行综合测试以验证一切是否正常:
uv run python test_comprehensive.py
配置完成后,您可以要求 Claude 生成 O'RLY 书籍封面,例如:
✨ 生成的书籍封面图像将直接显示在聊天中!
该工具支持以下参数:
本项目采用 MIT 许可证 - 详情请参阅 LICENSE.txt 文件。
orly_generator/
目录中的原始 O'RLY 书籍封面生成代码基于 Charles Berlin(2016 年)的工作,同样采用 MIT 许可证 - 详情请参阅 orly_generator/LICENSE.txt 文件。
本项目基于 Charles Berlin 的优秀工作构建。orly_generator/
目录中的核心图像生成代码改编自他的原始 O-RLY-Book-Generator 仓库,并进行了更新以支持 Python 3,同时集成到 MCP 工具中,以便与 Claude Desktop 等 MCP 客户端一起使用。
(主要针对作者 Chris,因为他不常用 Python 可能会忘记这些步骤)
您可以使用 twine 快速发布新版本:
uv run twine upload dist/*
系统会提示您输入 PyPI API 令牌。
您也可以按照以下步骤操作:
# 安装开发依赖(包括 build 和 twine)
uv sync --group dev
# 构建包
uv run python -m build
# 检查构建的包
uv run twine check dist/*
# 先发布到 TestPyPI 进行测试(可选)
uv run twine upload --repository testpypi dist/*
# 发布到 PyPI
uv run twine upload dist/*
请确保:
pyproject.toml
中的版本号uv run python test_comprehensive.py
在本地测试包进行身份验证时,您需要在 ~/.pypirc
文件中配置 PyPI API 令牌或将其设置为环境变量。