Skip to main content

Add your description here

Project description

jhch-poster

一个基于 MCP (Model Context Protocol) 的海报生成服务器,提供模板管理和样式选择功能。

功能特性

  • 模板管理: 提供 5 种精美海报模板
  • 样式选择: 支持多种风格 (modern, minimal, bold, elegant, playful)
  • MCP 协议: 基于 Model Context Protocol 标准构建
  • HTTP 传输: 使用 streamable-http 传输方式

安装

环境要求

  • Python >= 3.11
  • uv (推荐)

使用 uv 安装 (推荐)

# 克隆项目
git clone <repository-url>
cd poster

# 创建虚拟环境并安装依赖
uv venv
uv pip install -e .

# 或使用 uv run 直接运行 (无需手动激活环境)
uv run jhch-poster

使用 pip 安装

# 克隆项目
git clone <repository-url>
cd poster

# 安装依赖
pip install -e .

使用方法

启动服务器

# 使用命令行入口点
jhch-poster

# 或直接运行 Python 模块
python -m jhch_poster.server

服务器默认在端口 8999 启动,使用 HTTP 传输方式。

MCP 工具

服务器提供以下 MCP 工具:

list_styles()

列出所有可用的海报样式。

返回: 样式名称列表

["modern", "minimal", "bold", "elegant", "playful"]

get_style_id(style: str)

根据样式名称获取对应的模板 ID。

参数:

  • style: 样式名称

返回: 模板 ID

get_template(id: str = "")

获取指定 ID 的模板内容,如果未找到则随机返回一个模板。

参数:

  • id: 模板 ID (可选),如 "1", "2"

返回: HTML 模板内容字符串

MCP 资源

poster://templates

获取所有可用模板的元数据信息。

返回: JSON 格式的模板列表,包含 id、name、style 和 file 信息。

项目结构

poster/
├── jhch_poster/
│   ├── __init__.py
│   ├── server.py          # MCP 服务器主文件
│   └── template/
│       ├── 1.html         # 模板 1
│       ├── 2.html         # 模板 2
│       ├── 3.html         # 模板 3
│       ├── 4.html         # 模板 4
│       ├── 5.html         # 模板 5
│       └── templates.json   # 模板元数据
├── main.py
├── pyproject.toml
└── README.md

配置

服务器配置位于 pyproject.toml

  • 端口: 8999
  • 传输方式: streamable-http

依赖管理 (uv)

本项目推荐使用 uv 进行依赖管理。

常用 uv 命令

# 添加依赖
uv pip install <package>

# 添加开发依赖
uv pip install --dev <package>

# 同步依赖 (根据 pyproject.toml)
uv pip sync

# 更新依赖
uv pip install -U <package>

# 生成 lock 文件
uv pip compile pyproject.toml -o requirements.lock

发布到 PyPI

使用 uv 发布 (推荐)

# 1. 构建分发包
uv build

# 2. 检查构建结果
uv publish --check

# 3. 上传到 PyPI 测试环境
uv publish --index testpypi

# 4. 上传到正式 PyPI
uv publish

使用 hatch 发布

# 1. 安装 hatch
uv pip install hatch

# 2. 构建并发布
hatch build
hatch publish

版本管理

在发布前更新版本号 (pyproject.toml):

[project]
version = "0.1.7"  # 更新此处

遵循 语义化版本 规范:

  • MAJOR.MINOR.PATCH
  • 如: 0.1.60.1.7 (修复 bug)
  • 如: 0.1.60.2.0 (新增功能)
  • 如: 0.1.61.0.0 (破坏性变更)

许可证

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jhch_poster-0.1.7.tar.gz (9.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jhch_poster-0.1.7-py3-none-any.whl (11.6 kB view details)

Uploaded Python 3

File details

Details for the file jhch_poster-0.1.7.tar.gz.

File metadata

  • Download URL: jhch_poster-0.1.7.tar.gz
  • Upload date:
  • Size: 9.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.7.6

File hashes

Hashes for jhch_poster-0.1.7.tar.gz
Algorithm Hash digest
SHA256 5832b69a3f8e196c3d158bb3220c78e80116f1159ced0daea20678929f24a8d3
MD5 ef939a9bc8ae1bf0a27cf5c2704ad414
BLAKE2b-256 75dfeba76e8afc80efe2e41801863642ef9916a4029284b679c02e802abe57fd

See more details on using hashes here.

File details

Details for the file jhch_poster-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for jhch_poster-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 4729449ada6ad51d93396314f0ee3a04a9bae98c59765ddd78c2c172df68611c
MD5 9b9f02e5816d39644db7b38680d51e99
BLAKE2b-256 3f813b0fc6e70e415b6b4b64b5b0355555ecd4e2e25f91118f7b97943e90c1d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page