Skip to main content

lumio-admin-mcp

MCP server (stdio) that exposes Lumio 诗文库 / 词库 / 字库 admin APIs to hosts such as Cursor and Grok Bot, authenticated with a long-lived Bot Token.

PyPI: lumio-admin-mcp
源码: mcp/lumio-admin

设计规格:

  • 一期诗文:docs/superpowers/specs/2026-10-22-lumio-classic-bot-mcp-design.md
  • 二期词库/字库:docs/superpowers/specs/2026-10-23-lumio-mcp-words-hanzi.md

Requirements

  • Python 3.11+
  • uv(推荐用 uvx 直接跑)
  • 可达的 Lumio API(LUMIO_API_BASE_URL)
  • Bot Token(scopes:classic / words / hanzi)

1. Create a Bot Token

在 monorepo 的 backend 目录:

cd backend && ../.venv/bin/python -m scripts.create_bot_token --name grok-bot

默认 scopes:classic,words,hanzi。仅诗文时可:

../.venv/bin/python -m scripts.create_bot_token --name classic-only --scopes classic

stdout 仅打印一次:

BOT_TOKEN=lumio_bot_…

2. Cursor / Grok Bot MCP(推荐:PyPI + uvx)

发布到 PyPI 后,无需本地 checkout:

{
  "mcpServers": {
    "lumio-admin": {
      "command": "uvx",
      "args": ["lumio-admin-mcp"],
      "env": {
        "LUMIO_API_BASE_URL": "https://your-lumio-host",
        "LUMIO_BOT_TOKEN": "lumio_bot_…"
      }
    }
  }
}

固定版本示例:"args": ["lumio-admin-mcp==0.1.0"]。

本地开发(未发布 / 改源码时)

{
  "mcpServers": {
    "lumio-admin": {
      "command": "uv",
      "args": [
        "--directory",
        "/ABS/PATH/mcp/lumio-admin",
        "run",
        "lumio-admin-mcp"
      ],
      "env": {
        "LUMIO_API_BASE_URL": "http://127.0.0.1:7061",
        "LUMIO_BOT_TOKEN": "lumio_bot_…"
      }
    }
  }
}

3. Publish to PyPI(维护者)

  1. 在 PyPI 创建账号,Account settings → API tokens → 生成 token(pypi-…)。
  2. 在本目录构建并发布:
cd mcp/lumio-admin
uv build
uv publish

uv publish 会提示输入用户名(可用 __token__)与 password(粘贴 API token)。也可用环境变量:

export UV_PUBLISH_TOKEN=pypi-…
uv publish

发版前请 bump pyproject.toml 的 version,再 uv build && uv publish。

4. Local install / debug

cd mcp/lumio-admin
uv sync
export LUMIO_API_BASE_URL=http://127.0.0.1:7061
export LUMIO_BOT_TOKEN=lumio_bot_…
uv run lumio-admin-mcp

stdio:等待 MCP host;缺环境变量时 stderr 提示并以 code 1 退出。

5. Example prompts

  • 「列出 online 古诗」
  • 「给静夜思加注释 床=井栏边 并上线」
  • 「在采实每日背诵词库新建分组 Unit 3-2,批量写入这些短语」
  • 「列出字库,往某某字库的某分组批量加汉字」

6. Tools

诗文库(classic)

Tool HTTP Notes
list_works GET /api/admin/classic/works kind, q, status, page, page_size
get_work GET .../works/{id}
create_work POST .../works may set status=online;可选 appreciation(文章赏析)
update_work PATCH .../works/{id} 可选 appreciation
delete_work DELETE .../works/{id} single work only
list_glosses GET .../works/{id}/glosses
create_gloss POST .../works/{id}/glosses
update_gloss PATCH .../glosses/{id}
delete_gloss DELETE .../glosses/{id}

词库(words)

Tool HTTP Notes
list_word_libraries GET /api/admin/word-libraries
list_word_groups GET .../{library_id}/groups
create_word_group POST .../{library_id}/groups 不新建词库
batch_add_words POST .../groups/{group_id}/words/batch

字库(hanzi)

Tool HTTP Notes
list_hanzi_libraries GET /api/admin/hanzi-libraries
list_hanzi_groups GET .../{library_id}/groups
create_hanzi_group POST .../{library_id}/groups 不新建字库
batch_add_hanzis POST .../groups/{group_id}/hanzis/batch

7. Security

  • Never commit LUMIO_BOT_TOKEN / PyPI token。
  • Bot Token 按 scopes 限制路径前缀。
  • 吊销:cd backend && ../.venv/bin/python -m scripts.revoke_bot_token --id <id>

Metadata

Release files for lumio-admin-mcp 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for lumio-admin-mcp 0.1.1
File Size Uploaded Provenance
lumio_admin_mcp-0.1.1.tar.gz 58.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for lumio-admin-mcp 0.1.1
File Interpreter ABI Platform
lumio_admin_mcp-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 66.9 kB

Release files / lumio_admin_mcp-0.1.1.tar.gz

Download URL lumio_admin_mcp-0.1.1.tar.gz
Size 58.4 kB
Tags Source
SHA-256 checksum
How to use checksums
61cf619033c82a7ae4d0a460db9095e4481c6179fb183682c55d617f43bd6ddd
BLAKE2b-256 checksum
How to use checksums
b9c06a68cfc6ce4ca3e6ba264e6616c56627f7db63bd215887826ad92bd61488
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Release files / lumio_admin_mcp-0.1.1-py3-none-any.whl

Download URL lumio_admin_mcp-0.1.1-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
2b468c828e4a0e4422e704d306dba339e93aedf519bc19f86a40ad8495d2edc0
BLAKE2b-256 checksum
How to use checksums
db420079af37a2c86d099f754cdee2dde8c56a17bc73295f4f34466dd78299b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.7.8

Security for lumio-admin-mcp 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page