旧实现走 OIDB 0x89a_0 但 settings 发空字节 → 服务端返 ok 却 no-op;action 也只收
group_id,没有设置搜索方式的参数(报告属实)。
真机 RE 定稿(tempserver,bot 为管理员的实群逐字段扫描 + GET 读回):
- 修改命令 = 0x89a_0(全量抓包确认,与 MuteAll 同命令,靠 body 形状区分)。结构
= {1:groupUin, 2: 只含被改字段的 GroupDetailInfo modify 子消息}。这是与 0x88D_0
群详情 GET **不同的消息域**(mute/shutUpTime 在此=tag17,在 GET 里却是字符串),
所以标签不能照搬 GET。
- 在 modify 子消息里逐 tag 试写、经 0x88D_0 GET 读回效果,定位:
noFingerOpen(关键词/群指纹搜索)=tag 35,noCodeFingerOpen(群号搜索/总开关)=tag 36;
再对照客户端「被搜索方式」三选下拉(私密/群号/群号+关键词)核实语义与 0/1 取值。
- proto-defs:settings 改为 Oidb0x89a_0SearchSettings 子消息,两 flag 用 pb_optional
(显式存在)——否则 proto3 丢 0 值,导致关闭(=0)被静默忽略。undefined 仍省略。
- set-search/bridge/action:透传 no_finger_open / no_code_finger_open;只下发提供的
字段(同 NapCat filter 机制、与 modify-group-ext-info 一致)。catalog regen。
- 编码测试锁定:0 值必发 tag 35/36、未提供则省略、命令为 0x89a_0。
typecheck 12 包干净;protocol 585 / onebot 521 / core 472 全绿。
@snowluma/mcp
An MCP server for the SnowLuma OneBot action catalog. It runs in two modes from one binary:
- docs (default) — read-only: every action's docs, parameters, cross-field
constraints, and a ready-to-use JSON Schema, so an LLM can answer "what
params does
set_group_bantake?" without holding the whole catalog in context. - execution (opt-in) — when pointed at a running OneBot HTTP endpoint, the LLM can also call actions: read-only ones freely, write ones behind a gate.
Docs only (default)
Add to your MCP client (Claude Desktop, Cline, …) — no endpoint, no execution:
{
"mcpServers": {
"snowluma": { "command": "npx", "args": ["-y", "@snowluma/mcp"] }
}
}
Docs tools
list_actions({ category? })— lightweight index (name / category / summary / aliases /readOnly).get_action({ name })— full doc for one action incl.inputSchemaandreadOnly(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.
Execution (opt-in)
Point the server at a running SnowLuma instance's OneBot HTTP endpoint (the
httpServer network adapter) and it gains two execution tools:
query_action({ action, params? })— calls a read-only action (e.g.get_*,can_*) and returns the full OneBot response. AnnotatedreadOnlyHint. Refuses write actions (points you toinvoke_action).invoke_action({ action, params? })— calls any known action, including ones with side effects (send a message, change a group, …). AnnotateddestructiveHintopenWorldHint. Only available in write mode.
Both pass the OneBot envelope through verbatim — a logical failure (retcode≠0)
comes back as data with its wording; only a transport failure is an error.
Configuration (env)
| Variable | Meaning |
|---|---|
SNOWLUMA_MCP_ENDPOINT |
OneBot HTTP endpoint, e.g. http://127.0.0.1:3000/. Absent → docs-only (execution tools hidden). |
SNOWLUMA_MCP_TOKEN |
Access token (sent as Authorization: Bearer …), if the endpoint requires one. |
SNOWLUMA_MCP_TIMEOUT_MS |
Per-request timeout (default 30000). |
SNOWLUMA_MCP_MODE |
docs | read | write. Default: read when an endpoint is set, else docs. |
Read mode — the LLM can query read-only actions, but cannot perform any write:
{
"mcpServers": {
"snowluma": {
"command": "npx",
"args": ["-y", "@snowluma/mcp"],
"env": {
"SNOWLUMA_MCP_ENDPOINT": "http://127.0.0.1:3000/",
"SNOWLUMA_MCP_TOKEN": "your-access-token"
}
}
}
}
Write mode — also enables invoke_action (the bot can send messages, manage
groups, etc.). Enable deliberately:
{
"mcpServers": {
"snowluma": {
"command": "npx",
"args": ["-y", "@snowluma/mcp"],
"env": {
"SNOWLUMA_MCP_ENDPOINT": "http://127.0.0.1:3000/",
"SNOWLUMA_MCP_TOKEN": "your-access-token",
"SNOWLUMA_MCP_MODE": "write"
}
}
}
}
Safety model
- Read/write is classified per action in the source specs (by what the action
actually does, not its name) and baked into the catalog. The default is write:
an action is callable via
query_actiononly if it is explicitly read-only. - The mode gate is enforced on every call, not just by hiding tools — calling
invoke_actionoutside write mode is refused even if a client sends it directly. - Unknown actions are rejected by both tools (only catalog actions are callable), so typos and non-catalog internal actions can't be driven.
- A well-behaved client can auto-approve
query_action(read-only) and prompt forinvoke_action(destructive) using the MCP tool annotations.
How it stays in sync
The catalog — including each action's readOnly flag — 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 read/write reclassification.
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.