@softspark/ai-toolkit 4.2.5 → 4.3.1
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/CHANGELOG.md +56 -0
- package/README.md +8 -8
- package/app/.claude-plugin/plugin.json +1 -1
- package/app/hooks/_hook-io.sh +14 -0
- package/app/hooks/commit-quality.sh +1 -0
- package/app/hooks/governance-capture.sh +1 -0
- package/app/hooks/guard-config.sh +1 -0
- package/app/hooks/guard-destructive.sh +1 -0
- package/app/hooks/revert-guard.sh +1 -0
- package/app/hooks/search-tracker.sh +5 -1
- package/app/hooks/session-start.sh +4 -0
- package/app/hooks/stop-search-check.sh +3 -1
- package/app/hooks/test-cohesion.sh +1 -0
- package/app/hooks/track-usage.sh +1 -0
- package/app/hooks/user-prompt-submit.sh +2 -1
- package/bin/ai-toolkit.js +43 -0
- package/kb/reference/extension-api.md +77 -11
- package/kb/reference/hooks-catalog.md +3 -3
- package/kb/reference/mcp-templates.md +6 -4
- package/llms-full.txt +86 -18
- package/manifest.json +1 -1
- package/package.json +1 -1
- package/scripts/inject_mcp_cli.py +514 -0
- package/scripts/install.py +2 -1
- package/scripts/install_steps/markers.py +40 -0
- package/scripts/mcp_sources.py +162 -0
- package/scripts/paths.py +2 -0
- package/scripts/test_cohesion.py +1 -1
package/llms-full.txt
CHANGED
|
@@ -8186,11 +8186,11 @@ Run `ai-toolkit update --local` to re-resolve and update the lock file.
|
|
|
8186
8186
|
title: "Extension API Reference"
|
|
8187
8187
|
category: reference
|
|
8188
8188
|
service: ai-toolkit
|
|
8189
|
-
tags: [extension-api, inject-rule, inject-hook, mcp-templates, integration, editors]
|
|
8190
|
-
version: "1.
|
|
8189
|
+
tags: [extension-api, inject-rule, inject-hook, inject-mcp, mcp-templates, integration, editors]
|
|
8190
|
+
version: "1.5.0"
|
|
8191
8191
|
created: "2026-04-07"
|
|
8192
|
-
last_updated: "2026-
|
|
8193
|
-
description: "Reference for ai-toolkit's extension API: inject-rule, inject-hook,
|
|
8192
|
+
last_updated: "2026-05-12"
|
|
8193
|
+
description: "Reference for ai-toolkit's extension API: inject-rule, inject-hook, inject-mcp, remove-* variants, and editor-aware MCP template management."
|
|
8194
8194
|
---
|
|
8195
8195
|
|
|
8196
8196
|
# Extension API Reference
|
|
@@ -8209,8 +8209,10 @@ This design is intentional: ai-toolkit is a generic toolkit. Consumers (MCP serv
|
|
|
8209
8209
|
| `remove-rule <name>` | `~/.claude/CLAUDE.md` | Strip markers by block name | Yes |
|
|
8210
8210
|
| `inject-hook <file.json\|url> [name]` | `~/.claude/settings.json` | JSON `_source` tag per entry, URL cached + registered | Yes |
|
|
8211
8211
|
| `remove-hook <name>` | `~/.claude/settings.json` | Strip all entries with matching `_source`, unregister URL source | Yes |
|
|
8212
|
+
| `inject-mcp <file.json\|url> [name] [--force]` | `~/.mcp.json` + every editor with `global_path` | JSON `_source` tag per server, URL cached + registered, full editor propagation | Yes |
|
|
8213
|
+
| `remove-mcp <name>` | `~/.mcp.json` + every editor with `global_path` | Strip all servers with matching `_source`, clean editor configs, unregister URL | Yes |
|
|
8212
8214
|
| `add-rule <file.md\|url>` | `~/.softspark/ai-toolkit/rules/` | File copy + re-inject all rules on next `update` | Yes |
|
|
8213
|
-
| `mcp add <name...>` | `.mcp.json` | Merge `mcpServers` block from template | Yes |
|
|
8215
|
+
| `mcp add <name...>` | `.mcp.json` | Merge `mcpServers` block from built-in template | Yes |
|
|
8214
8216
|
| `mcp install --editor <name...>` | Native editor MCP config | Render canonical template into editor format | Yes |
|
|
8215
8217
|
|
|
8216
8218
|
## inject-rule
|
|
@@ -8299,6 +8301,67 @@ npx @softspark/ai-toolkit remove-hook my-tool-hooks
|
|
|
8299
8301
|
|
|
8300
8302
|
The argument is the source name (file stem used during `inject-hook`). If no entries with that source are present, the command exits 0 silently.
|
|
8301
8303
|
|
|
8304
|
+
## inject-mcp
|
|
8305
|
+
|
|
8306
|
+
Injects an external MCP server template into `~/.mcp.json` (toolkit source-of-truth) and propagates it to every editor that exposes a `global_path` in `EDITOR_SPECS`. Symmetric with `inject-hook` -- accepts both local file paths and HTTPS URLs, with cache + auto-refresh on `ai-toolkit update`.
|
|
8307
|
+
|
|
8308
|
+
```bash
|
|
8309
|
+
# From local file
|
|
8310
|
+
npx @softspark/ai-toolkit inject-mcp ./rag-mcp-template.json
|
|
8311
|
+
|
|
8312
|
+
# From URL (cached locally, auto-refreshed on update)
|
|
8313
|
+
npx @softspark/ai-toolkit inject-mcp https://example.com/rag-mcp-template.json
|
|
8314
|
+
|
|
8315
|
+
# With explicit source name (preferred when filename stem is generic)
|
|
8316
|
+
npx @softspark/ai-toolkit inject-mcp ./mcp/mcp-template.json --name rag-mcp
|
|
8317
|
+
|
|
8318
|
+
# With explicit target dir
|
|
8319
|
+
npx @softspark/ai-toolkit inject-mcp ./template.json /custom/target --name my-rag
|
|
8320
|
+
|
|
8321
|
+
# Force overwrite of servers with a different _source (collision resolution)
|
|
8322
|
+
npx @softspark/ai-toolkit inject-mcp ./conflict.json --force
|
|
8323
|
+
```
|
|
8324
|
+
|
|
8325
|
+
**Flags:** `--name <name>` overrides the auto-derived source name (works for both local files and URLs). `--force` overwrites servers tagged with a different `_source`. Positional `template-name` is supported only for URL sources (legacy positional grammar inherited from `inject-hook`); for local files use `--name`.
|
|
8326
|
+
|
|
8327
|
+
**Implementation:** `scripts/inject_mcp_cli.py`, `scripts/mcp_sources.py`, `scripts/url_fetch.py`.
|
|
8328
|
+
|
|
8329
|
+
**Input format:** Same as built-in templates in `app/mcp-templates/`:
|
|
8330
|
+
```json
|
|
8331
|
+
{
|
|
8332
|
+
"name": "rag-mcp",
|
|
8333
|
+
"description": "Multi-tenant RAG over knowledge bases",
|
|
8334
|
+
"mcpServers": {
|
|
8335
|
+
"rag-mcp": {
|
|
8336
|
+
"type": "http",
|
|
8337
|
+
"url": "http://localhost:8081/mcp/sse?secret_key=${RAG_MCP_SECRET_KEY}"
|
|
8338
|
+
}
|
|
8339
|
+
}
|
|
8340
|
+
}
|
|
8341
|
+
```
|
|
8342
|
+
|
|
8343
|
+
**Source name derivation:** `rag-mcp-template.json` → `"rag-mcp-template"`. For URLs: `https://example.com/rag-mcp-template.json` → `"rag-mcp-template"`. Every server in the `mcpServers` block is tagged with `"_source": "<source-name>"` inside `~/.mcp.json` only; native editor configs receive the same servers **without** the `_source` field (some clients reject unknown keys).
|
|
8344
|
+
|
|
8345
|
+
**URL support:** When an HTTPS URL is provided, the JSON is fetched, validated, cached in `~/.softspark/ai-toolkit/mcp-templates/external/<name>.json`, and registered in `sources.json`. On every `ai-toolkit update`, URL-sourced templates are re-fetched and re-injected automatically. If the fetch fails during update, the cached version is used.
|
|
8346
|
+
|
|
8347
|
+
**Editor propagation:** Every editor with a `global_path` in `EDITOR_SPECS` is updated -- Claude (`~/.claude.json`), Cursor (`~/.cursor/mcp.json`), GitHub Copilot (`~/.copilot/mcp-config.json`), Gemini CLI (`~/.gemini/settings.json`), Windsurf (`~/.codeium/windsurf/mcp_config.json`), Cline (`~/.cline/data/settings/cline_mcp_settings.json`), Augment (`~/.augment/settings.json`), Codex CLI (`~/.codex/config.toml`). Per-editor failures are non-fatal -- the command reports a warning and continues.
|
|
8348
|
+
|
|
8349
|
+
**Idempotency:** Re-running with the same source overwrites entries for that source cleanly -- no duplicates accumulate.
|
|
8350
|
+
|
|
8351
|
+
**Collisions:** If a server name in `~/.mcp.json` already exists under a *different* `_source` tag, the command exits with code 3 unless `--force` is passed. Entries tagged `"_source": "ai-toolkit"` are protected even with `--force` -- the built-in template namespace cannot be hijacked.
|
|
8352
|
+
|
|
8353
|
+
**Safety:** Only HTTPS URLs are accepted. The source name `ai-toolkit` is reserved.
|
|
8354
|
+
|
|
8355
|
+
## remove-mcp
|
|
8356
|
+
|
|
8357
|
+
Strips all server entries from `~/.mcp.json` that carry a given `_source` tag, cleans the same server names from every editor `global_path`, and (if URL-sourced) unregisters from `sources.json` and removes the cached file.
|
|
8358
|
+
|
|
8359
|
+
```bash
|
|
8360
|
+
npx @softspark/ai-toolkit remove-mcp rag-mcp-template
|
|
8361
|
+
```
|
|
8362
|
+
|
|
8363
|
+
The argument is the source name (file stem used during `inject-mcp`). If no entries with that source are present, the command exits 0 silently. `ai-toolkit` source is reserved and cannot be removed via this command.
|
|
8364
|
+
|
|
8302
8365
|
## mcp add / install
|
|
8303
8366
|
|
|
8304
8367
|
Merges one or more MCP server templates from `app/mcp-templates/` into the project's `.mcp.json`.
|
|
@@ -8337,6 +8400,8 @@ When `install` runs with `--scope project`, ai-toolkit also updates `.mcp.json`
|
|
|
8337
8400
|
│ remove-rule <name> → CLAUDE.md │
|
|
8338
8401
|
│ inject-hook <file|url> → settings.json │
|
|
8339
8402
|
│ remove-hook <name> → settings.json │
|
|
8403
|
+
│ inject-mcp <file|url> → .mcp.json + editors │
|
|
8404
|
+
│ remove-mcp <name> → .mcp.json + editors │
|
|
8340
8405
|
│ add-rule <file|url> → rules/ registry │
|
|
8341
8406
|
│ mcp add <template> → .mcp.json │
|
|
8342
8407
|
│ mcp install <template> → editor-native MCP │
|
|
@@ -8352,7 +8417,7 @@ When `install` runs with `--scope project`, ai-toolkit also updates `.mcp.json`
|
|
|
8352
8417
|
(consumer) (consumer) (consumer)
|
|
8353
8418
|
```
|
|
8354
8419
|
|
|
8355
|
-
## Example: Registering Rules and
|
|
8420
|
+
## Example: Registering Rules, Hooks, and MCP Servers from an External Tool
|
|
8356
8421
|
|
|
8357
8422
|
An external tool's install script would call:
|
|
8358
8423
|
|
|
@@ -8360,14 +8425,14 @@ An external tool's install script would call:
|
|
|
8360
8425
|
# Register rules into CLAUDE.md
|
|
8361
8426
|
npx @softspark/ai-toolkit inject-rule ./rules/my-tool-rules.md
|
|
8362
8427
|
|
|
8363
|
-
# Register hooks into settings.json
|
|
8428
|
+
# Register hooks into settings.json (auto-propagates to Codex)
|
|
8364
8429
|
npx @softspark/ai-toolkit inject-hook ./hooks/my-tool-hooks.json
|
|
8365
8430
|
|
|
8366
|
-
#
|
|
8367
|
-
npx @softspark/ai-toolkit mcp
|
|
8431
|
+
# Register MCP server template into .mcp.json + all editor MCP configs
|
|
8432
|
+
npx @softspark/ai-toolkit inject-mcp ./mcp-template.json
|
|
8368
8433
|
|
|
8369
|
-
#
|
|
8370
|
-
npx @softspark/ai-toolkit mcp
|
|
8434
|
+
# Alternative: pull MCP template from a URL (auto-refreshed on update)
|
|
8435
|
+
npx @softspark/ai-toolkit inject-mcp https://example.com/mcp-template.json
|
|
8371
8436
|
```
|
|
8372
8437
|
|
|
8373
8438
|
To uninstall:
|
|
@@ -8375,6 +8440,7 @@ To uninstall:
|
|
|
8375
8440
|
```bash
|
|
8376
8441
|
npx @softspark/ai-toolkit remove-rule my-tool-rules
|
|
8377
8442
|
npx @softspark/ai-toolkit remove-hook my-tool-hooks
|
|
8443
|
+
npx @softspark/ai-toolkit remove-mcp my-tool
|
|
8378
8444
|
```
|
|
8379
8445
|
|
|
8380
8446
|
All operations are idempotent — safe to run on every install or update.
|
|
@@ -9136,7 +9202,7 @@ First-match-wins per file. Built-in runners: `bats`, `pytest`, `vitest`, `jest`.
|
|
|
9136
9202
|
| Script | `~/.softspark/ai-toolkit/hooks/search-tracker.sh` |
|
|
9137
9203
|
| Fires | After any search-style tool call |
|
|
9138
9204
|
|
|
9139
|
-
**Action:** Clears `~/.softspark/ai-toolkit/state/search-required
|
|
9205
|
+
**Action:** Clears `~/.softspark/ai-toolkit/state/search-required-<session_id>.flag` (per-session, keyed by `session_id` from the hook stdin payload, falling back to `transcript_path` basename, then `default`). Pairs with `user-prompt-submit.sh` (sets the flag on long technical prompts only when a search provider is detected or strict mode is enabled) and `stop-search-check.sh` (blocks Stop if the calling session's flag is still set). Together they enforce the global CLAUDE.md GOLDEN RULE without breaking offline/no-RAG installs and without cross-session interference when multiple Claude Code windows run in parallel.
|
|
9140
9206
|
|
|
9141
9207
|
Non-blocking (exit 0). Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
|
|
9142
9208
|
|
|
@@ -9149,7 +9215,7 @@ Non-blocking (exit 0). Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
|
|
|
9149
9215
|
| Script | `~/.softspark/ai-toolkit/hooks/stop-search-check.sh` |
|
|
9150
9216
|
| Fires | When Claude finishes a response |
|
|
9151
9217
|
|
|
9152
|
-
**Action:** If `search-required
|
|
9218
|
+
**Action:** If `search-required-<session_id>.flag` for the calling session is still present (no search tool ran during this turn) and a search provider is still detectable, emits `{"decision":"block","reason":"..."}` to continue the conversation with a search-first reminder. If no RAG/Web provider is detected, it clears the stale flag and exits 0, so offline/no-MCP users are not blocked. Flags are scoped by `session_id` from the hook stdin payload so a Stop in session B never consumes session A's flag (and vice versa). Stale per-session flags older than 60 minutes are GC'd on the next `SessionStart`.
|
|
9153
9219
|
|
|
9154
9220
|
**Overrides:** `CLAUDE_SKIP_SEARCH_FIRST=1`, `AI_TOOLKIT_SEARCH_FIRST=off`, or `AI_TOOLKIT_SEARCH_FIRST=strict` to force enforcement. Skipped when `TOOLKIT_HOOK_PROFILE=minimal`.
|
|
9155
9221
|
|
|
@@ -9211,7 +9277,7 @@ Set in `.claude/settings.local.json`:
|
|
|
9211
9277
|
├── rules/ # Registered rules (add-rule.sh)
|
|
9212
9278
|
├── state/ # Per-session runtime state (NEW)
|
|
9213
9279
|
│ ├── session-edits.json # Append-only edit log per session
|
|
9214
|
-
│ ├── search-required
|
|
9280
|
+
│ ├── search-required-<sid>.flag # Per-session: set by user-prompt-submit, cleared by search-tracker/stop-search-check, GC'd at SessionStart (>60min)
|
|
9215
9281
|
│ ├── loaded-instructions.log # Audit trail of which rules entered context
|
|
9216
9282
|
│ └── test-cohesion-last.log # Last cohesion test command output
|
|
9217
9283
|
└── hooks/ # Hook scripts (copied on install)
|
|
@@ -9911,11 +9977,11 @@ Global-only clients are configured explicitly via `ai-toolkit mcp install --edit
|
|
|
9911
9977
|
title: "MCP Server Templates"
|
|
9912
9978
|
category: reference
|
|
9913
9979
|
service: ai-toolkit
|
|
9914
|
-
tags: [mcp, templates, servers, configuration, editors]
|
|
9915
|
-
version: "1.
|
|
9980
|
+
tags: [mcp, templates, servers, configuration, editors, inject-mcp, external-templates]
|
|
9981
|
+
version: "1.2.0"
|
|
9916
9982
|
created: "2026-04-07"
|
|
9917
|
-
last_updated: "2026-
|
|
9918
|
-
description: "Reference for 26 MCP server templates
|
|
9983
|
+
last_updated: "2026-05-12"
|
|
9984
|
+
description: "Reference for 26 built-in MCP server templates, external template injection via inject-mcp, and native editor MCP installation support."
|
|
9919
9985
|
---
|
|
9920
9986
|
|
|
9921
9987
|
# MCP Server Templates
|
|
@@ -9924,6 +9990,8 @@ description: "Reference for 26 MCP server templates plus native editor MCP insta
|
|
|
9924
9990
|
|
|
9925
9991
|
ai-toolkit ships 26 ready-to-use MCP server configuration templates in `app/mcp-templates/`. Each template is a JSON file that defines the canonical `mcpServers` block for a specific service. Templates can be merged into the project's `.mcp.json` and rendered into editor-native MCP config files via the `ai-toolkit mcp` CLI subcommand.
|
|
9926
9992
|
|
|
9993
|
+
**External templates:** Tools outside the toolkit (MCP servers, plugins, custom integrations) can register their own MCP templates via `ai-toolkit inject-mcp <file|url>` -- the toolkit caches the template, tags every server with a `_source` field, and propagates the config to every editor that exposes a `global_path`. URL-sourced templates are auto-refreshed on every `ai-toolkit update`. See [PATH: kb/reference/extension-api.md] for the inject-mcp / remove-mcp reference.
|
|
9994
|
+
|
|
9927
9995
|
## CLI
|
|
9928
9996
|
|
|
9929
9997
|
```bash
|
package/manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@softspark/ai-toolkit",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.1",
|
|
4
4
|
"description": "AI coding toolkit: 107 skills, 44 agents, 12-editor write-through (Claude, Cursor, Windsurf, Copilot, Gemini, Cline, Roo, Aider, Augment, Antigravity, Codex, opencode), machine-enforced safety constitution, SARIF audit, signed npm provenance.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|