caplets 0.15.0 → 0.17.0

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.
Files changed (3) hide show
  1. package/README.md +110 -14
  2. package/dist/index.js +2890 -775
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -30,6 +30,10 @@ Instead of exposing a flat wall of tools, Caplets shows one top-level tool per c
30
30
  The agent chooses a domain first, then uses scoped operations like `search_tools`,
31
31
  `get_tool`, and `call_tool` only when it needs more detail.
32
32
 
33
+ For MCP-backed Caplets, the scoped operation set also includes resource discovery/reading,
34
+ prompt listing/rendering, resource-template discovery, and completion for prompt or template
35
+ arguments. Non-MCP backends continue to expose only tool/action operations.
36
+
33
37
  ## Quick Start
34
38
 
35
39
  Caplets requires Node.js 22 or newer.
@@ -76,10 +80,47 @@ caplets list-tools context7
76
80
  caplets get-tool context7.resolve-library-id
77
81
  caplets call-tool context7.resolve-library-id --args '{"libraryName":"react"}'
78
82
  caplets call-tool context7.resolve-library-id --args '{"libraryName":"react"}' --field result.id --format json
83
+ caplets list-resources docs
84
+ caplets read-resource docs file:///repo/README.md
85
+ caplets list-prompts linear
86
+ caplets get-prompt linear.review_issue --args '{"issueId":"CAP-123"}'
87
+ caplets complete docs --resource-template 'file:///repo/{path}' --argument path --value src/
79
88
  ```
80
89
 
81
90
  Direct CLI operation commands print Markdown summaries by default. Add `--format plain` for plain text or `--format json` for machine-readable JSON (`md` is accepted as an alias for `markdown`). If a downstream tool returns `isError: true`, Caplets still exits with status code 1.
82
91
 
92
+ ### Shell completions
93
+
94
+ The npm package ships shell completion generators for Bash, Zsh, Fish, PowerShell, and cmd. Installation is explicit: `npm install -g caplets` does not modify shell startup files or system completion directories.
95
+
96
+ ```sh
97
+ # Bash
98
+ mkdir -p ~/.local/share/bash-completion/completions
99
+ caplets completion bash > ~/.local/share/bash-completion/completions/caplets
100
+
101
+ # Zsh
102
+ mkdir -p ~/.zsh/completions
103
+ caplets completion zsh > ~/.zsh/completions/_caplets
104
+ # Ensure ~/.zsh/completions is on fpath before compinit, then reload your shell:
105
+ # echo 'fpath=(~/.zsh/completions $fpath)' >> ~/.zshrc
106
+ # echo 'autoload -Uz compinit && compinit' >> ~/.zshrc
107
+
108
+ # Fish
109
+ mkdir -p ~/.config/fish/completions
110
+ caplets completion fish > ~/.config/fish/completions/caplets.fish
111
+
112
+ # PowerShell
113
+ caplets completion powershell | Out-String | Invoke-Expression
114
+
115
+ # cmd.exe
116
+ caplets completion cmd > %USERPROFILE%\caplets-completion.cmd
117
+ %USERPROFILE%\caplets-completion.cmd
118
+ ```
119
+
120
+ Completions include command names, options, common enum values, configured Caplet IDs, and cache-backed downstream names for qualified targets such as `caplets call-tool repo.<TAB>`. Downstream discovery is bounded by the `completion` config timeouts and a platform-native cache directory. Generated shell scripts suppress completion stderr; run the underlying CLI command directly when debugging completion behavior.
121
+
122
+ Backends that require OAuth or token auth may need `caplets auth login <server>` before live downstream completions can return richer results. Completion never starts interactive login flows.
123
+
83
124
  ## Agent Plugins
84
125
 
85
126
  Use Caplets as a normal MCP server everywhere, or install a native agent integration when
@@ -107,28 +148,74 @@ configs run `caplets serve` directly, so install the Caplets CLI globally first.
107
148
 
108
149
  OpenCode and Pi can use native `caplets_<id>` tools backed by a remote Caplets HTTP service. Codex, Claude Code, and any MCP client can connect to the same remote MCP endpoint directly.
109
150
 
110
- Start a local HTTP service:
151
+ Start a local HTTP service. `--path` is the service base path; Caplets mounts MCP,
152
+ control, and health endpoints underneath it:
153
+
154
+ ```sh
155
+ CAPLETS_SERVER_URL=http://127.0.0.1:5387/caplets \
156
+ CAPLETS_SERVER_PASSWORD=... \
157
+ caplets serve --transport http
158
+ ```
159
+
160
+ With `CAPLETS_SERVER_URL=http://127.0.0.1:5387/caplets`, the derived endpoints are:
161
+
162
+ - MCP: `http://127.0.0.1:5387/caplets/mcp`
163
+ - Control: `http://127.0.0.1:5387/caplets/control`
164
+ - Health: `http://127.0.0.1:5387/caplets/healthz`
165
+
166
+ `caplets serve --transport http` serves plain HTTP. For non-loopback or network access, expose it only through HTTPS/TLS (for example, a reverse proxy or secure tunnel) and enable Basic Auth; Basic Auth over plain HTTP exposes credentials. Keep credentials out of plugin manifests.
167
+
168
+ #### Docker Compose self-hosting
169
+
170
+ This repository includes a source-build Docker image and Compose service for running the HTTP service from the checked-out source tree:
111
171
 
112
172
  ```sh
113
- caplets serve --transport http --host 127.0.0.1 --port 5387 --path /mcp
173
+ CAPLETS_SERVER_PASSWORD=change-me docker compose up --build
174
+ ```
175
+
176
+ By default, Compose publishes the service on loopback only:
177
+
178
+ - Base URL: `http://127.0.0.1:5387`
179
+ - MCP endpoint: `http://127.0.0.1:5387/mcp`
180
+ - Control endpoint: `http://127.0.0.1:5387/control`
181
+ - Health endpoint: `http://127.0.0.1:5387/healthz`
182
+
183
+ The service stores Caplets config and auth state in a Docker named volume mounted at `/data`. To use a host-visible bind mount instead, replace this Compose volume entry:
184
+
185
+ ```yaml
186
+ volumes:
187
+ - caplets-data:/data
114
188
  ```
115
189
 
116
- `caplets serve --transport http` serves plain HTTP. For non-loopback or network access, expose it only through HTTPS/TLS (for example, a reverse proxy or secure tunnel) and enable Basic Auth; Basic Auth over plain HTTP exposes credentials. Keep credentials out of plugin manifests:
190
+ with:
191
+
192
+ ```yaml
193
+ volumes:
194
+ - ./data:/data
195
+ ```
196
+
197
+ To expose the service to a LAN interface or reverse proxy, set an explicit bind address and public base URL:
117
198
 
118
199
  ```sh
119
- CAPLETS_SERVER_PASSWORD=... caplets serve --transport http --host 127.0.0.1 --port 5387 --path /mcp
200
+ CAPLETS_BIND_ADDRESS=0.0.0.0 \
201
+ CAPLETS_SERVER_URL=https://caplets.example.com \
202
+ CAPLETS_SERVER_PASSWORD=change-me \
203
+ docker compose up --build
120
204
  ```
121
205
 
122
- Native integrations read remote client settings from environment variables:
206
+ Only expose Caplets beyond loopback through HTTPS/TLS and Basic Auth. `CAPLETS_SERVER_PASSWORD` protects both the MCP and control endpoints; downstream provider tokens and auth files remain server-owned inside the mounted `/data` location.
207
+
208
+ Native integrations and remote-capable CLI commands read remote client settings from environment variables:
123
209
 
124
210
  ```sh
125
- CAPLETS_REMOTE_URL=https://caplets.example.com/mcp \
126
- CAPLETS_REMOTE_USER=caplets \
127
- CAPLETS_REMOTE_PASSWORD=... \
211
+ CAPLETS_MODE=remote \
212
+ CAPLETS_SERVER_URL=https://caplets.example.com/caplets \
213
+ CAPLETS_SERVER_USER=caplets \
214
+ CAPLETS_SERVER_PASSWORD=... \
128
215
  opencode
129
216
  ```
130
217
 
131
- For MCP-backed Codex or Claude Code configs, point the agent's MCP server entry at the remote URL using that agent's supported HTTP MCP configuration. If Basic Auth is needed, use the agent's secure secret or environment interpolation mechanism rather than hardcoding credentials.
218
+ For MCP-backed Codex or Claude Code configs, point the agent's MCP server entry at the derived `/mcp` URL using that agent's supported HTTP MCP configuration. If Basic Auth is needed, use the agent's secure secret or environment interpolation mechanism rather than hardcoding credentials.
132
219
 
133
220
  ## Convert Existing Tooling
134
221
 
@@ -242,6 +329,12 @@ you want Caplets to expose:
242
329
  "version": 1,
243
330
  "defaultSearchLimit": 20,
244
331
  "maxSearchLimit": 50,
332
+ "completion": {
333
+ "discoveryTimeoutMs": 750,
334
+ "overallTimeoutMs": 1500,
335
+ "cacheTtlMs": 300000,
336
+ "negativeCacheTtlMs": 30000
337
+ },
245
338
  "mcpServers": {
246
339
  "filesystem": {
247
340
  "name": "Project Files",
@@ -805,11 +898,14 @@ For headless terminals:
805
898
  caplets auth login <server> --no-open
806
899
  ```
807
900
 
808
- OAuth/OIDC tokens are stored under `${XDG_STATE_HOME:-~/.local/state}/caplets/auth/<server>.json`
809
- on Unix-like platforms and `%LOCALAPPDATA%\caplets\auth\<server>.json` on Windows.
810
- Token files use owner-only file permissions where the platform supports them. Caplets supports
811
- well-known OAuth/OIDC discovery and dynamic client registration when advertised. When a token expires,
812
- run `caplets auth login <server>` again.
901
+ In local mode, OAuth/OIDC tokens are stored under
902
+ `${XDG_STATE_HOME:-~/.local/state}/caplets/auth/<server>.json` on Unix-like platforms and
903
+ `%LOCALAPPDATA%\caplets\auth\<server>.json` on Windows. Token files use owner-only file
904
+ permissions where the platform supports them. In `CAPLETS_MODE=remote`, `caplets auth list`,
905
+ `caplets auth login <server>`, and `caplets auth logout <server>` operate on the configured Caplets
906
+ server instead. Downstream OAuth/OIDC credentials are stored server-side and are not returned to the
907
+ local client. Caplets supports well-known OAuth/OIDC discovery and dynamic client registration when
908
+ advertised. When a token expires, run `caplets auth login <server>` again.
813
909
 
814
910
  To inspect or remove stored OAuth credentials:
815
911