Files
SnowLuma/packages/mcp/README.md
T
DrSmoothl 69c8960ea9 feat(mcp): @snowluma/mcp — read-only MCP server for the OneBot action catalog
A new published package that exposes every OneBot action's docs + a ready-to-use
JSON Schema to LLM clients over stdio. Tools: list_actions / get_action /
search_actions / list_categories, plus the whole catalog as a resource.

The catalog is a build-time snapshot generated from @snowluma/onebot's live
action specs (collectActionDocs()) — so it auto-tracks action add/remove and the
published package carries zero runtime dependency on the private onebot package.

action-kit enrichment (the data source):
- Field.toJsonSchema() per coercer (uint→integer/minimum:1, messageId→integer/
  not-const-0, int→min/max, string→minLength/maxLength, array→items, enum→enum).
- describe() composes a per-action inputSchema; ActionDoc gains inputSchema +
  category. action-docs.ts tags each doc with its domain category.

Wiring: onebot exports ./action-kit + ./action-docs; root build:all includes mcp;
mcp-npm-publish.yml mirrors the sdk/ui publish workflows (triggers on changes
under packages/mcp/** or packages/onebot/**, since the catalog derives from it).

onebot typecheck + 318 tests green; mcp typecheck/build/smoke green; the 142
registered OneBot action names are unchanged.
2026-06-02 22:45:30 +08:00

41 lines
1.5 KiB
Markdown

# @snowluma/mcp
A read-only [MCP](https://modelcontextprotocol.io) server that exposes the
**SnowLuma OneBot action catalog** — every action's docs, parameters, cross-field
constraints, and a ready-to-use **JSON Schema** — to LLM clients.
Point an LLM at it and it can answer "what params does `set_group_ban` take?" or
"which actions send messages?" on demand, without holding the whole catalog in
context.
## Usage
Add to your MCP client (Claude Desktop, Cline, …):
```json
{
"mcpServers": {
"snowluma": { "command": "npx", "args": ["-y", "@snowluma/mcp"] }
}
}
```
## Tools
- `list_actions({ category? })` — lightweight index (name / category / summary / aliases).
- `get_action({ name })` — full doc for one action incl. `inputSchema` (accepts aliases).
- `search_actions({ query })` — fuzzy match over name / summary / aliases.
- `list_categories()` — categories and their action counts.
Also exposes the whole catalog as a resource: `snowluma://onebot/actions`.
## How it stays in sync
The catalog is a **build-time snapshot** generated from `@snowluma/onebot`'s live
action specs (`collectActionDocs()`) on every build — so it auto-tracks action
add/remove and the published package carries **zero runtime dependency** on the
private `@snowluma/onebot`. The snapshot is pinned to the SnowLuma version it was
built from; a new SnowLuma release republishes a fresh catalog.
This package is generated; do not hand-edit `src/generated/catalog.ts`.