metheus-governance-mcp-cli 0.2.61 → 0.2.63
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +119 -13
- package/cli.mjs +2806 -7874
- package/lib/auth-flow.mjs +966 -0
- package/lib/bot-commands.mjs +1404 -0
- package/lib/client-registration.mjs +311 -0
- package/lib/doctor-checks.mjs +274 -0
- package/lib/doctor-report.mjs +50 -0
- package/lib/gateway-transport.mjs +160 -0
- package/lib/local-ai-adapters.mjs +14 -2
- package/lib/local-project-dispatch.mjs +172 -0
- package/lib/local-tool-shims.mjs +169 -0
- package/lib/project-tools.mjs +735 -0
- package/lib/provider-local-transport.mjs +358 -0
- package/lib/provider-support.mjs +60 -0
- package/lib/proxy-auth.mjs +77 -0
- package/lib/proxy-gateway-request.mjs +102 -0
- package/lib/proxy-response-pipeline.mjs +94 -0
- package/lib/proxy-stdio.mjs +175 -0
- package/lib/proxy-tool-helpers.mjs +597 -0
- package/lib/runner-data.mjs +297 -0
- package/lib/runner-delivery.mjs +272 -0
- package/lib/runner-execution.mjs +391 -0
- package/lib/runner-helpers.mjs +181 -0
- package/lib/runner-orchestration.mjs +233 -0
- package/lib/runner-runtime.mjs +275 -0
- package/lib/runner-trigger.mjs +174 -0
- package/lib/selftest-bot-commands.mjs +358 -0
- package/lib/selftest-runner-scenarios.mjs +668 -0
- package/lib/selftest-support.mjs +113 -0
- package/lib/selftest-telegram-e2e.mjs +424 -0
- package/lib/setup-context.mjs +60 -0
- package/lib/setup-registration.mjs +145 -0
- package/lib/workspace-context.mjs +379 -0
- package/package.json +2 -2
- package/postinstall.mjs +70 -5
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Compatibility note: legacy command alias `metheus-governance-mcp` is still suppo
|
|
|
10
10
|
- checks Codex/Claude/Gemini/Antigravity/Cursor MCP registration
|
|
11
11
|
- registers only missing clients
|
|
12
12
|
- `setup`: register `metheus-governance-mcp` into Codex/Claude/Gemini/Antigravity/Cursor (if installed)
|
|
13
|
+
- `bot`: local chat bot env setup/list/show/add/edit/remove/global/verify
|
|
13
14
|
- `doctor`: run end-to-end health checks (auth/registration/gateway/project/ctxpack/tools)
|
|
14
15
|
- `proxy`: stdio MCP bridge to Metheus HTTPS gateway
|
|
15
16
|
- `auth`: save/check/clear local Metheus token used by proxy
|
|
@@ -27,10 +28,10 @@ Install creates local provider settings templates here:
|
|
|
27
28
|
- `~/.metheus/kakaotalk.env`
|
|
28
29
|
- `~/.metheus/bot-runner.json`
|
|
29
30
|
|
|
30
|
-
These files are for local provider bot secrets
|
|
31
|
+
These files are for local provider bot secrets, local transport options, and optional per-bot local AI binding.
|
|
31
32
|
|
|
32
33
|
- Store locally:
|
|
33
|
-
- `TELEGRAM_BOT_TOKEN`
|
|
34
|
+
- `TELEGRAM_BOT_TOKEN` or named Telegram bot mappings such as `TELEGRAM_BOT_MAIN_TOKEN`
|
|
34
35
|
- `SLACK_BOT_TOKEN`
|
|
35
36
|
- `KAKAOTALK_BOT_TOKEN`
|
|
36
37
|
- Server-side Metheus stores project chat destination metadata separately:
|
|
@@ -38,13 +39,30 @@ These files are for local provider bot secrets only.
|
|
|
38
39
|
- `chat_id` / channel / room identifier
|
|
39
40
|
- label / active state
|
|
40
41
|
- Do not put project chat destination identifiers in local env files.
|
|
42
|
+
- Telegram env can also carry per-bot local AI binding fields.
|
|
41
43
|
|
|
42
44
|
Example templates:
|
|
43
45
|
|
|
44
46
|
```env
|
|
45
47
|
# ~/.metheus/telegram.env
|
|
48
|
+
TELEGRAM_API_BASE_URL=
|
|
49
|
+
TELEGRAM_AUTO_CLEAR_WEBHOOK=true
|
|
50
|
+
TELEGRAM_ALLOWED_UPDATES=message,edited_message
|
|
51
|
+
TELEGRAM_DEFAULT_BOT_KEY=main
|
|
52
|
+
|
|
53
|
+
# Legacy fallback
|
|
46
54
|
TELEGRAM_BOT_TOKEN=
|
|
47
55
|
|
|
56
|
+
# Preferred named bot mapping
|
|
57
|
+
TELEGRAM_BOT_MAIN_SERVER_BOT_ID=
|
|
58
|
+
TELEGRAM_BOT_MAIN_USERNAME=<bot_username>
|
|
59
|
+
TELEGRAM_BOT_MAIN_TOKEN=
|
|
60
|
+
TELEGRAM_BOT_MAIN_ROLE_PROFILE=monitor
|
|
61
|
+
TELEGRAM_BOT_MAIN_AI_CLIENT=codex
|
|
62
|
+
TELEGRAM_BOT_MAIN_AI_MODEL=
|
|
63
|
+
TELEGRAM_BOT_MAIN_AI_PERMISSION_MODE=read_only
|
|
64
|
+
TELEGRAM_BOT_MAIN_AI_REASONING_EFFORT=low
|
|
65
|
+
|
|
48
66
|
# ~/.metheus/slack.env
|
|
49
67
|
SLACK_BOT_TOKEN=
|
|
50
68
|
|
|
@@ -72,6 +90,17 @@ Runner template:
|
|
|
72
90
|
"reasoning_effort": "low"
|
|
73
91
|
}
|
|
74
92
|
},
|
|
93
|
+
"bot_bindings": {
|
|
94
|
+
"primary_monitor_bot": {
|
|
95
|
+
"bot_id": "<server_bot_uuid>",
|
|
96
|
+
"bot_name": "<bot_name>",
|
|
97
|
+
"role_profile": "monitor",
|
|
98
|
+
"client": "codex",
|
|
99
|
+
"model": "",
|
|
100
|
+
"permission_mode": "read_only",
|
|
101
|
+
"reasoning_effort": "low"
|
|
102
|
+
}
|
|
103
|
+
},
|
|
75
104
|
"routes": [
|
|
76
105
|
{
|
|
77
106
|
"name": "telegram-monitor",
|
|
@@ -79,12 +108,12 @@ Runner template:
|
|
|
79
108
|
"project_id": "<project_uuid>",
|
|
80
109
|
"provider": "telegram",
|
|
81
110
|
"role": "monitor",
|
|
82
|
-
"
|
|
111
|
+
"bot_id": "<server_bot_uuid>",
|
|
83
112
|
"trigger_policy": {
|
|
84
113
|
"mentions_only": true,
|
|
85
114
|
"direct_messages": true,
|
|
86
115
|
"reply_to_bot_messages": true,
|
|
87
|
-
"ignore_edited_messages":
|
|
116
|
+
"ignore_edited_messages": true
|
|
88
117
|
},
|
|
89
118
|
"archive_policy": {
|
|
90
119
|
"mirror_replies": true,
|
|
@@ -134,13 +163,14 @@ metheus-governance-mcp-cli setup --project-id <project_uuid> --ctxpack-key "<ctx
|
|
|
134
163
|
- `~/.metheus/kakaotalk.env`
|
|
135
164
|
- `~/.metheus/bot-runner.json`
|
|
136
165
|
|
|
137
|
-
Fill
|
|
166
|
+
Fill provider bot secrets and provider-local transport options locally. Project chat destination identifiers should be managed on the Metheus server as project chat destinations, not as local env values and not inside legacy Chat Hooks/webhooks.
|
|
138
167
|
|
|
139
168
|
`~/.metheus/bot-runner.json` is the local automation profile for:
|
|
140
169
|
- which project to watch
|
|
141
170
|
- which provider/role bot profile to use
|
|
142
171
|
- which `project_id -> workspace_dir` mapping to apply locally
|
|
143
172
|
- which role profile maps to which local CLI/model/permission/reasoning policy
|
|
173
|
+
- which server bot maps to which local LLM execution profile via `telegram.env` or fallback `bot_bindings`
|
|
144
174
|
|
|
145
175
|
Built-in helper command for legacy fallback/testing:
|
|
146
176
|
|
|
@@ -169,6 +199,59 @@ Guardrail note:
|
|
|
169
199
|
- By default, CLI blocks reading/writing ctxpack sync metadata when workspace root resolves to the home directory.
|
|
170
200
|
- Override only when intentional: `METHEUS_ALLOW_HOME_WORKSPACE=1`.
|
|
171
201
|
|
|
202
|
+
## Bot
|
|
203
|
+
|
|
204
|
+
Interactive entry:
|
|
205
|
+
|
|
206
|
+
```bash
|
|
207
|
+
metheus-governance-mcp-cli bot setup
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
Direct commands:
|
|
211
|
+
|
|
212
|
+
```bash
|
|
213
|
+
metheus-governance-mcp-cli bot list
|
|
214
|
+
metheus-governance-mcp-cli bot show --provider telegram --bot-key main
|
|
215
|
+
metheus-governance-mcp-cli bot add --provider telegram
|
|
216
|
+
metheus-governance-mcp-cli bot edit --provider telegram
|
|
217
|
+
metheus-governance-mcp-cli bot remove --provider telegram
|
|
218
|
+
metheus-governance-mcp-cli bot global --provider telegram
|
|
219
|
+
metheus-governance-mcp-cli bot verify --provider telegram --bot-key main
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Behavior:
|
|
223
|
+
|
|
224
|
+
- `bot setup` asks for `Telegram / Slack / KakaoTalk` first, then prompts with numbered actions.
|
|
225
|
+
- Telegram supports named local bot entries with:
|
|
226
|
+
- `SERVER_BOT_ID`
|
|
227
|
+
- `USERNAME`
|
|
228
|
+
- `TOKEN`
|
|
229
|
+
- `ROLE_PROFILE`
|
|
230
|
+
- `AI_CLIENT`
|
|
231
|
+
- `AI_MODEL`
|
|
232
|
+
- `AI_PERMISSION_MODE`
|
|
233
|
+
- `AI_REASONING_EFFORT`
|
|
234
|
+
- Slack and KakaoTalk currently use a single local token entry per provider in this command flow.
|
|
235
|
+
- `bot verify` checks the configured local token and prints the current AI binding summary.
|
|
236
|
+
- `bot show` prints one local bot entry in detail.
|
|
237
|
+
- `bot global` edits Telegram-wide local settings such as API base URL, allowed updates, and default bot key.
|
|
238
|
+
|
|
239
|
+
Non-interactive examples:
|
|
240
|
+
|
|
241
|
+
```bash
|
|
242
|
+
metheus-governance-mcp-cli bot global --provider telegram --non-interactive true --api-base-url http://127.0.0.1:8999/telegram --auto-clear-webhook false --allowed-updates message,edited_message,channel_post
|
|
243
|
+
metheus-governance-mcp-cli bot add --provider telegram --non-interactive true --bot-key main --bot-id <server_bot_uuid> --token <telegram_bot_token> --role-profile monitor --client codex --permission-mode read_only --reasoning-effort low --default true
|
|
244
|
+
metheus-governance-mcp-cli bot edit --provider telegram --bot-key main --non-interactive true --client claude --model claude-3.7-sonnet --permission-mode workspace_write --reasoning-effort medium
|
|
245
|
+
metheus-governance-mcp-cli bot remove --provider telegram --bot-key main --non-interactive true
|
|
246
|
+
metheus-governance-mcp-cli bot verify --provider telegram --bot-key main --json true
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
Current support status:
|
|
250
|
+
|
|
251
|
+
- Telegram: full local bot entry management, token verification, bot-to-AI binding, inbound runner support
|
|
252
|
+
- Slack: single local token entry, verification supported, inbound runner not supported
|
|
253
|
+
- KakaoTalk: single local token entry, local config only, remote verification not implemented
|
|
254
|
+
|
|
172
255
|
## Project ID behavior (verified)
|
|
173
256
|
|
|
174
257
|
- `setup --project-id <A>` sets default proxy scope to project `A`.
|
|
@@ -182,6 +265,7 @@ Guardrail note:
|
|
|
182
265
|
|
|
183
266
|
```bash
|
|
184
267
|
metheus-governance-mcp-cli doctor --project-id <project_uuid> --base-url https://metheus.gesiaplatform.com
|
|
268
|
+
metheus-governance-mcp-cli doctor --project-id <project_uuid> --base-url https://metheus.gesiaplatform.com --strict true
|
|
185
269
|
```
|
|
186
270
|
|
|
187
271
|
Checks:
|
|
@@ -198,6 +282,9 @@ Checks:
|
|
|
198
282
|
- ctxpack auto sync status
|
|
199
283
|
- smoke calls: `workitem.list`, `evidence.list`, `decision.list`
|
|
200
284
|
|
|
285
|
+
`--strict true` upgrades local runner route safety warnings into failures.
|
|
286
|
+
Use it for production validation before enabling long-running bot routes.
|
|
287
|
+
|
|
201
288
|
Direct bot posting:
|
|
202
289
|
- `me.send-bot-message` uses local provider tokens from `~/.metheus/<provider>.env`
|
|
203
290
|
- it does not use a server-stored bot token
|
|
@@ -209,6 +296,11 @@ Direct bot posting:
|
|
|
209
296
|
- Slack
|
|
210
297
|
- KakaoTalk profiles and destinations can be stored now, but direct local delivery is not implemented yet
|
|
211
298
|
|
|
299
|
+
Provider support matrix in this CLI:
|
|
300
|
+
- `telegram`: local token verification, direct local delivery, typing, reply-to-message, and automatic inbound runner are implemented
|
|
301
|
+
- `slack`: local token verification and direct local delivery are implemented, but automatic inbound runner is not
|
|
302
|
+
- `kakaotalk`: local config can be stored, but token verification, direct local delivery, and automatic inbound runner are not implemented
|
|
303
|
+
|
|
212
304
|
## Local bot runner
|
|
213
305
|
|
|
214
306
|
The local runner closes the loop:
|
|
@@ -226,24 +318,28 @@ Execution model:
|
|
|
226
318
|
- runner resolves `project_id -> workspace_dir`
|
|
227
319
|
- runner resolves server bot role to a local `role_profile`
|
|
228
320
|
- runner executes the mapped client adapter (`codex` / `claude` / `gemini`)
|
|
229
|
-
- legacy `command` remains
|
|
321
|
+
- legacy `command` remains readable for migration, but execution is disabled by default unless `METHEUS_ALLOW_LEGACY_RUNNER_COMMAND=1`
|
|
230
322
|
|
|
231
323
|
Commands:
|
|
232
324
|
|
|
233
325
|
```bash
|
|
234
|
-
metheus-governance-mcp-cli runner once
|
|
235
|
-
metheus-governance-mcp-cli runner start
|
|
326
|
+
metheus-governance-mcp-cli runner once --route-name telegram-monitor
|
|
327
|
+
metheus-governance-mcp-cli runner start --route-name telegram-monitor
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Recommended operational path:
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
metheus-governance-mcp-cli runner once --route-name telegram-monitor --dry-run-delivery true
|
|
334
|
+
metheus-governance-mcp-cli runner start --route-name telegram-monitor
|
|
236
335
|
```
|
|
237
336
|
|
|
238
|
-
|
|
337
|
+
Debug/selection overrides:
|
|
239
338
|
|
|
240
339
|
```bash
|
|
241
340
|
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor
|
|
242
341
|
metheus-governance-mcp-cli runner start --project-id <project_uuid> --provider telegram --role monitor --poll-interval-ms 5000
|
|
243
|
-
metheus-governance-mcp-cli runner start --project-id <project_uuid> --provider telegram --role monitor --mentions-only true
|
|
244
|
-
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor --dry-run-delivery true
|
|
245
342
|
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor --role-profile review
|
|
246
|
-
metheus-governance-mcp-cli runner once --project-id <project_uuid> --provider telegram --role monitor --command "python C:\\path\\to\\reply.py"
|
|
247
343
|
```
|
|
248
344
|
|
|
249
345
|
Recommended production path:
|
|
@@ -253,6 +349,9 @@ Recommended production path:
|
|
|
253
349
|
- keep `project_mappings.<project_id>.workspace_dir` aligned to that teammate's actual local project folder
|
|
254
350
|
- let `ctxpack pull` or project connection refresh the mapping automatically
|
|
255
351
|
- keep per-role execution policy under `role_profiles`
|
|
352
|
+
- keep per-bot LLM binding primarily in `~/.metheus/telegram.env`
|
|
353
|
+
- use `bot_bindings` in `bot-runner.json` only as local fallback/override
|
|
354
|
+
- runner resolution order is: explicit `route.role_profile` -> provider env bot binding -> `bot_bindings` -> server bot role -> `route.role`
|
|
256
355
|
|
|
257
356
|
Why `workspace_dir` matters:
|
|
258
357
|
- the server cannot know each project member's local folder path
|
|
@@ -265,6 +364,11 @@ Role profile fields:
|
|
|
265
364
|
- `permission_mode`: `read_only`, `workspace_write`, `danger_full_access`
|
|
266
365
|
- `reasoning_effort`: `low`, `medium`, `high`
|
|
267
366
|
|
|
367
|
+
Role profile note:
|
|
368
|
+
- Claude maps `reasoning_effort` to `--effort`.
|
|
369
|
+
- Codex maps `reasoning_effort` to `-c model_reasoning_effort="..."`.
|
|
370
|
+
- Gemini CLI still has no dedicated effort flag, so the runner keeps the value in env/prompt context for policy parity.
|
|
371
|
+
|
|
268
372
|
Trigger policy fields:
|
|
269
373
|
- `mentions_only`: in groups, react only when the bot is mentioned or when a message replies to the bot
|
|
270
374
|
- `direct_messages`: allow or block private chat messages
|
|
@@ -309,10 +413,12 @@ Notes:
|
|
|
309
413
|
- mirrored bot replies are deduped by `chat_id + message_id`
|
|
310
414
|
- provider bot messages are ignored during inbound import by default
|
|
311
415
|
- `local-bot-bridge` reads stdin JSON from the runner and can call Codex/Claude/Gemini for you
|
|
416
|
+
- `route.command` fallback is disabled by default; enable it only temporarily with `METHEUS_ALLOW_LEGACY_RUNNER_COMMAND=1`
|
|
312
417
|
- today this automation path is implemented for Telegram end-to-end
|
|
313
|
-
-
|
|
418
|
+
- prefer `TELEGRAM_API_BASE_URL=` inside `~/.metheus/telegram.env` for per-bot local Telegram API overrides; `METHEUS_TELEGRAM_API_BASE_URL` remains a process-level fallback mainly for mock/regression testing
|
|
314
419
|
- Slack can use direct local send, but automatic inbound runner flow is not completed yet
|
|
315
420
|
- KakaoTalk config can be stored now, but direct send/runner flow is not implemented yet
|
|
421
|
+
- `doctor` now reports provider support for both enabled runner routes and active project chat destinations
|
|
316
422
|
|
|
317
423
|
## Use in MCP
|
|
318
424
|
|