Skip to content

Commit 5b6b593

Browse files
feat(plugin): add /arcane:configure slash command + installer step
Ships commands/configure.md — a plugin slash command that walks the user through preset selection, optional module allowlist, optional per-tool fine-tuning via AskUserQuestion, then merges the resolved `tools` block into ~/.arcane/config.json while preserving existing keys. Registered in .claude-plugin/plugin.json. Adds a "Step 5: Pick a tool-filter preset" section to install_arcane_skill-mcp.md so fresh installs don't see the 180-tool firehose on day one. Surfaces the four new env vars in the Configuration Reference table. Updates CLAUDE.md with a "Tool filtering" section pointing at registry.ts, presets.ts, config-watcher.ts, and the slash command. Updates CHANGELOG with the full feature rollout under [Unreleased]. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 5057ef8 commit 5b6b593

5 files changed

Lines changed: 118 additions & 6 deletions

File tree

.claude-plugin/plugin.json

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,13 @@
66
"license": "MIT",
77
"homepage": "https://github.com/RandomSynergy17/Arcane-MCP-Server",
88
"keywords": ["docker", "containers", "infrastructure", "devops", "compose", "swarm", "portainer"],
9+
"commands": [
10+
{
11+
"name": "arcane:configure",
12+
"path": "commands/configure.md",
13+
"description": "Configure which Arcane MCP tools are exposed to Claude (preset, modules, per-tool overrides)"
14+
}
15+
],
916
"userConfig": {
1017
"arcane_base_url": {
1118
"description": "Your Arcane instance URL (e.g., https://arcane.example.com:3552)",

CHANGELOG.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,22 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
88
## [Unreleased]
99

1010
### Added
11+
- Tool filtering: six presets (`commonly-used`, `read-only`, `minimal`, `deploy`, `full`, `custom`) trim which of the 180 tools are exposed on `tools/list` to reduce context bloat
12+
- `ToolRegistry` (`src/tools/registry.ts`) captures every `RegisteredTool` handle and applies preset/module/per-tool resolution at startup and on live config changes
13+
- Hot reload: `src/utils/config-watcher.ts` debounces `fs.watch` on `~/.arcane/config.json` and calls `registry.diffAndApply()` so clients see `notifications/tools/list_changed` without reconnecting
14+
- `tools` field on `ArcaneConfig` plus env vars `ARCANE_TOOL_PRESET`, `ARCANE_ENABLED_MODULES`, `ARCANE_ENABLED_TOOLS`, `ARCANE_DISABLED_TOOLS`
15+
- MCP prompt `arcane_configure_tools` for clients without slash commands
16+
- Plugin slash command `/arcane:configure` (`commands/configure.md`) walks users through preset/module/per-tool selection
17+
- MCP resource `arcane://tools-config-notice` flags pre-filtering installs and points users at `/arcane:configure`
18+
- Installer gained "Step 5: Pick a tool-filter preset" before verification
19+
- 27 new unit tests: registry diff/apply logic, preset resolution order, upgrade notice / configure prompt (106 tests total, up from 79)
1120
- README pointer to `Portainer-Offload-Arcane` migration wizard for users coming from Portainer
1221
- Internal design doc: `_docs/plans/2026-04-14-tool-filtering-design.md` (tool filtering feature)
1322

23+
### Changed
24+
- All 25 tool modules now accept an optional `ToolRegistry` parameter and register through a `moduleRegistrar` helper so handles flow into the registry
25+
- Backwards-compatible on upgrade: installs without a `tools` key fall back to the `full` preset (no behaviour change)
26+
1427
---
1528

1629
## [2.0.3] - 2026-04-07

CLAUDE.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,19 @@ All tools use `server.registerTool()` with:
4545

4646
### Resources & Prompts
4747

48-
- `src/resources/index.ts`2 resources (`arcane://environments`, `arcane://version`)
49-
- `src/prompts/index.ts`4 prompts (deploy-stack, troubleshoot-container, security-audit, cleanup-environment)
48+
- `src/resources/index.ts`3 resources (`arcane://environments`, `arcane://version`, `arcane://tools-config-notice`)
49+
- `src/prompts/index.ts`5 prompts (deploy-stack, troubleshoot-container, security-audit, cleanup-environment, arcane_configure_tools)
5050
- Prompts reference real tool names — cross-check if adding/renaming tools
5151

52+
### Tool filtering
53+
54+
- `src/tools/registry.ts``ToolRegistry` captures `RegisteredTool` handles from each module; `applyFilter()` disables tools outside the resolved enabled-set, `diffAndApply()` handles hot reload
55+
- `src/tools/presets.ts` — declarative presets (`commonly-used`, `read-only`, `minimal`, `deploy`, `full`, `custom`) + `resolveEnabled(config, registry)` (preset → modules → enabled → disabled)
56+
- `src/utils/config-watcher.ts` — debounced `fs.watch` on `~/.arcane/config.json`; calls `registry.diffAndApply()` on change
57+
- `src/config.ts``ToolsConfig` field plus env vars: `ARCANE_TOOL_PRESET`, `ARCANE_ENABLED_MODULES`, `ARCANE_ENABLED_TOOLS`, `ARCANE_DISABLED_TOOLS`
58+
- `commands/configure.md` — plugin slash command `/arcane:configure` walks users through preset + module + per-tool selection
59+
- Unconfigured installs fall back to `full` (backwards-compatible); `arcane://tools-config-notice` resource flags the setup until a `tools` key is written
60+
5261
## Key Conventions
5362

5463
- Tool names: `arcane_{resource}_{action}` (e.g., `arcane_container_list`)

commands/configure.md

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
---
2+
description: Configure which Arcane MCP tools are exposed to Claude
3+
allowed-tools: [Read, Write, AskUserQuestion, Bash]
4+
---
5+
6+
# /arcane:configure — Tool filter setup
7+
8+
Use this slash command to trim which Arcane MCP tools are exposed to Claude Code. The full server registers 180 tools; surfacing all of them in `tools/list` bloats the context window. This command writes a `tools` block to `~/.arcane/config.json` that selects a preset, module allowlist, and per-tool overrides. The Arcane MCP server picks up changes live when its config watcher is attached.
9+
10+
## Workflow
11+
12+
1. **Ask the user to pick a preset** with `AskUserQuestion`, single-select:
13+
- `commonly-used` — containers, images, stacks, networks, volumes, environment, system, dashboard (~65 tools) *(recommended default)*
14+
- `read-only` — every `*_list` / `*_get` / `*_inspect` / `*_stats` / `*_status` / `*_summary` tool (~60 tools)
15+
- `minimal` — dashboard + container list/logs/stats/get (~5 tools)
16+
- `deploy` — project, gitops, template, registry, environment, build (~40 tools)
17+
- `full` — all 180 tools (current default if the user has never configured this)
18+
- `custom` — fine-tune modules and individual tools
19+
20+
2. **If the user picks `custom`** (or says they want to fine-tune after picking another preset):
21+
- Ask which modules to enable via `AskUserQuestion` multi-select. The 25 module names:
22+
`auth`, `build`, `container`, `dashboard`, `environment`, `event`, `gitops`, `image`, `image-update`, `job`, `network`, `network-topology`, `notification`, `port`, `project`, `registry`, `settings`, `swarm`, `system`, `template`, `updater`, `user`, `volume`, `vulnerability`, `webhook`.
23+
- Optionally ask if they want per-tool adjustments. If yes, iterate module-by-module (never more than ~10 options per `AskUserQuestion` step) showing each module's tools so they can add/remove individual entries.
24+
25+
3. **Build the `tools` block** — only include the fields that are non-empty:
26+
```json
27+
{
28+
"tools": {
29+
"preset": "<chosen>",
30+
"modules": ["<optional allowlist>"],
31+
"enabled": ["<optional additions>"],
32+
"disabled": ["<optional subtractions>"]
33+
}
34+
}
35+
```
36+
37+
4. **Merge into `~/.arcane/config.json`**:
38+
- `Read` the existing file (tolerate missing — start from `{}`).
39+
- Preserve all existing keys (`baseUrl`, `auth`, `http`, `defaultEnvironmentId`, `timeout`, `skipSslVerify`).
40+
- Replace or add the `tools` field with the new block.
41+
- `Write` back with 2-space indent.
42+
43+
5. **Report to the user**:
44+
- If the server logged `Watching …/config.json for tool-filter changes` at startup (`tail ~/.arcane/logs/*.log` or check the server stderr if available), say: **"Config written — tool list will refresh automatically."**
45+
- Otherwise: **"Config written — reconnect the Arcane MCP server in your client (`/mcp` in Claude Code) for the filter to take effect."**
46+
47+
## Notes
48+
49+
- Keep the conversation tight. Do not dump the full 180-tool list — summarise the chosen preset and let the user opt into fine-tuning.
50+
- Never remove other keys from `~/.arcane/config.json`. A malformed file will brick the server.
51+
- For Claude Desktop and other MCP clients without slash commands, the same flow is available via the `arcane_configure_tools` prompt — this slash command is a Claude Code shortcut to the same outcome.

install_arcane_skill-mcp.md

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,30 @@ Verify the skill is in place:
100100
ls -la ~/.claude/skills/arcane-mcp-server/SKILL.md
101101
```
102102

103-
### Step 5: Verify Installation
103+
### Step 5: Pick a tool-filter preset
104+
105+
The MCP server registers 180 tools by default, which can bloat Claude's context window. Use `AskUserQuestion` to let the user trim the active set:
106+
107+
**Question:** "Which tools do you want active by default?"
108+
**Options:**
109+
- **commonly-used (Recommended)** — containers, images, stacks, networks, volumes, environment, system, dashboard (~65 tools)
110+
- **read-only** — status & observability only, every `*_list` / `*_get` / `*_inspect` / `*_stats` tool (~60 tools)
111+
- **minimal** — dashboard + container list/logs/stats/get (~5 tools)
112+
- **deploy** — project, gitops, template, registry, environment, build (~40 tools)
113+
- **full** — all 180 tools enabled
114+
- **Skip** — I'll configure later with `/arcane:configure`
115+
116+
Write the chosen preset to `~/.arcane/config.json`, merging with any existing content:
117+
118+
```bash
119+
mkdir -p ~/.arcane
120+
# If file exists: read it, add the "tools" key, write back.
121+
# If it doesn't: create { "tools": { "preset": "<chosen>" } }
122+
```
123+
124+
The user can change this any time by running `/arcane:configure` in Claude Code or by editing `~/.arcane/config.json` directly — the server watches the file and refreshes live.
125+
126+
### Step 6: Verify Installation
104127

105128
Run a quick test to confirm everything works:
106129

@@ -111,7 +134,7 @@ echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":
111134

112135
If you see a JSON response with `"result"`, the server is working.
113136

114-
### Step 6: Report Results
137+
### Step 7: Report Results
115138

116139
Tell the user what was installed and provide a quick-start example:
117140

@@ -206,6 +229,10 @@ Add to `~/.config/Claude/claude_desktop_config.json`:
206229
| `ARCANE_TIMEOUT_MS` | No | Request timeout (default: 30000) |
207230
| `ARCANE_SKIP_SSL_VERIFY` | No | Skip SSL verification (default: false) |
208231
| `ARCANE_DEFAULT_ENVIRONMENT_ID` | No | Default environment to use |
232+
| `ARCANE_TOOL_PRESET` | No | `commonly-used` / `read-only` / `minimal` / `deploy` / `full` / `custom` |
233+
| `ARCANE_ENABLED_MODULES` | No | Comma-separated module allowlist (overrides preset modules) |
234+
| `ARCANE_ENABLED_TOOLS` | No | Comma-separated tool names to force-enable |
235+
| `ARCANE_DISABLED_TOOLS` | No | Comma-separated tool names to force-disable |
209236
| `LOG_LEVEL` | No | debug, info, warn, error (default: info) |
210237

211238
---
@@ -225,15 +252,20 @@ Add to `~/.config/Claude/claude_desktop_config.json`:
225252
- Registries (Docker Hub, GHCR, ECR, GCR, ACR)
226253
- Users, Settings, Authentication (JWT + API key + OIDC)
227254

228-
### 4 MCP Prompts (workflow templates):
255+
### 5 MCP Prompts (workflow templates):
229256
- `/deploy-stack` — Guided Docker Compose deployment
230257
- `/troubleshoot-container` — Systematic diagnostics
231258
- `/security-audit` — Vulnerability scanning workflow
232259
- `/cleanup-environment` — Safe resource cleanup
260+
- `arcane_configure_tools` — Walk through preset + tool-filter configuration (for clients without slash commands)
261+
262+
### 1 Slash Command (Claude Code):
263+
- `/arcane:configure` — Interactive preset / module / per-tool picker
233264

234-
### 2 MCP Resources (context data):
265+
### 3 MCP Resources (context data):
235266
- `arcane://environments` — Available environments
236267
- `arcane://version` — Server configuration
268+
- `arcane://tools-config-notice` — Flags when tool filtering hasn't been configured yet
237269

238270
### Companion Skill:
239271
- Intent mapping (natural language to tool sequences)

0 commit comments

Comments
 (0)