caplets 0.17.8 → 0.18.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 +175 -65
  2. package/dist/index.js +15014 -5184
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -1,18 +1,22 @@
1
1
  <div align="center">
2
- <img src="plugins/caplets/assets/icon.png" alt="Caplets logo" width="140" height="140" />
2
+ <img src="docs/assets/caplets-icon.png" alt="Caplets logo" width="140" height="140" />
3
3
 
4
4
  <h1>Caplets</h1>
5
5
 
6
6
  <p>
7
- <strong>Capability cards for coding agents.</strong><br />
8
- Wrap sprawling tool stacks behind focused, progressive-disclosure interfaces.
7
+ <strong>Give your agent capabilities, not tools.</strong><br />
8
+ Turn MCP servers, APIs, and commands into focused agent capabilities.
9
9
  </p>
10
10
 
11
11
  <p>
12
12
  <a href="https://www.npmjs.com/package/caplets"><img alt="npm" src="https://img.shields.io/npm/v/caplets?style=flat-square&color=E0582F" /></a>
13
13
  <a href="https://github.com/spiritledsoftware/caplets/actions/workflows/ci.yml"><img alt="CI" src="https://img.shields.io/github/actions/workflow/status/spiritledsoftware/caplets/ci.yml?branch=main&style=flat-square&label=ci&color=E0582F" /></a>
14
14
  <a href="LICENSE"><img alt="MIT License" src="https://img.shields.io/badge/license-MIT-F6E8C8?style=flat-square&labelColor=1F2018" /></a>
15
- <img alt="Node 22+" src="https://img.shields.io/badge/node-%3E%3D22-F6E8C8?style=flat-square&labelColor=1F2018" />
15
+ <img alt="Node 24+" src="https://img.shields.io/badge/node-%3E%3D24-F6E8C8?style=flat-square&labelColor=1F2018" />
16
+ </p>
17
+
18
+ <p>
19
+ <a href="https://caplets.dev"><strong>caplets.dev</strong></a>
16
20
  </p>
17
21
 
18
22
  <p>
@@ -22,38 +26,33 @@
22
26
 
23
27
  ---
24
28
 
25
- Caplets turns sprawling tool setups into focused capability cards for coding agents.
26
- Connect MCP servers, OpenAPI specs, GraphQL endpoints, HTTP actions, and curated CLI
27
- commands without flooding the model with every downstream operation up front.
29
+ Caplets turns MCP servers, APIs, and commands into focused agent capabilities: one card first, searchable tools next, inspectable schemas before calls, and preserved results after.
28
30
 
29
- Instead of exposing a flat wall of tools, Caplets shows one top-level tool per capability.
30
- The agent chooses a domain first, then uses scoped operations like `search_tools`,
31
- `get_tool`, and `call_tool` only when it needs more detail.
31
+ Stop dumping every operation into context up front. Caplets wraps each tool source as a capability an agent can discover, inspect, call, and recover from one step at a time. Instead of exposing a giant flat wall of operations, Caplets shows a compact capability card with source, status, and next actions. The agent chooses a domain first, then uses scoped operations like `search_tools`, `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.
33
+ For MCP-backed Caplets, the scoped operation set also includes resource discovery and reading, prompt listing and rendering, resource-template discovery, and completion for prompt or template arguments. Non-MCP backends expose focused tool and action operations.
36
34
 
37
- ## Quick Start
35
+ ## Try the aha moment
38
36
 
39
- Caplets requires Node.js 22 or newer.
37
+ Install Caplets, add Context7, and watch your agent see one capability before it searches downstream tools.
40
38
 
41
39
  ```sh
42
- pnpm add -g caplets
40
+ npm install -g caplets
43
41
  caplets init
42
+ caplets add mcp context7 --command npx --arg -y --arg @upstash/context7-mcp
43
+ caplets serve
44
44
  ```
45
45
 
46
- Add a capability from an existing system:
46
+ In the deterministic benchmark, 106 flat tools became 3 top-level capabilities with an 87.9% smaller initial payload. Your agent starts with `context7`, then drills in through `inspect`, `search_tools`, `get_tool`, and `call_tool` only when needed.
47
47
 
48
- ```sh
49
- # Wrap an MCP server
50
- caplets add mcp docs --command npx --arg -y --arg @upstash/context7-mcp
48
+ ## Quick Start
51
49
 
52
- # Convert useful repository commands into curated tools
53
- caplets add cli repo-tools --repo . --include git,gh,package
50
+ Caplets requires Node.js 24 or newer.
54
51
 
55
- # Install ready-made Caplets from a repository
56
- caplets install spiritledsoftware/caplets github linear context7
52
+ ```sh
53
+ npm install -g caplets
54
+ caplets init
55
+ caplets serve
57
56
  ```
58
57
 
59
58
  Connect Caplets to any MCP client:
@@ -69,13 +68,25 @@ Connect Caplets to any MCP client:
69
68
  }
70
69
  ```
71
70
 
72
- Ask your agent to use Caplets. It will see a compact capability list first, then inspect
73
- only the backend it needs.
71
+ Ask your agent to use Caplets. It will see a compact capability list first, then inspect only the backend it needs.
74
72
 
75
- You can also invoke configured Caplets directly from the CLI for agent-friendly scripts and smoke tests:
73
+ Add capabilities from existing systems when you are ready to give agents a focused tool surface:
76
74
 
77
75
  ```sh
78
- caplets get-caplet context7
76
+ # Wrap an MCP server
77
+ caplets add mcp docs --command npx --arg -y --arg @upstash/context7-mcp
78
+
79
+ # Convert useful repository commands into curated tools
80
+ caplets add cli repo-tools --repo . --include git,gh,package
81
+
82
+ # Install ready-made Caplets from a repository
83
+ caplets install spiritledsoftware/caplets github linear context7
84
+ ```
85
+
86
+ Configured Caplets can be invoked directly from the CLI for agent-friendly scripts and smoke tests:
87
+
88
+ ```sh
89
+ caplets inspect context7
79
90
  caplets list-tools context7
80
91
  caplets get-tool context7 resolve-library-id
81
92
  caplets call-tool context7 resolve-library-id --args '{"libraryName":"react"}'
@@ -123,33 +134,85 @@ Completions include command names, options, common enum values, configured Caple
123
134
 
124
135
  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.
125
136
 
126
- ## Agent Plugins
137
+ ## Agent Integrations
127
138
 
128
139
  Use Caplets as a normal MCP server everywhere, or install a native agent integration when
129
140
  your coding agent supports one.
130
141
 
131
- | Agent | Install | What It Provides |
132
- | -------------- | --------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------ |
133
- | Any MCP client | Add `caplets serve` as a stdio MCP server | Universal progressive-disclosure gateway |
134
- | Claude Code | `claude plugin marketplace add spiritledsoftware/caplets && claude plugin install caplets@caplets` | Claude Code plugin metadata, MCP config, and shared skill guidance |
135
- | Codex | `codex plugin marketplace add spiritledsoftware/caplets`, then install `caplets` from Codex plugins | Codex plugin metadata, MCP config, and shared skill guidance |
136
- | OpenCode | Install [`@caplets/opencode`](packages/opencode/README.md) | Native `caplets_<id>` tools and prompt guidance hooks |
137
- | Pi | Install [`@caplets/pi`](packages/pi/README.md) | Native `caplets_<id>` tools with Pi prompt snippets/guidelines |
142
+ | Agent | Install | What It Provides |
143
+ | -------------- | -------------------------------------------------------------- | -------------------------------------------------------------- |
144
+ | Any MCP client | Add `caplets serve` or `caplets attach` manually in MCP config | Universal progressive-disclosure gateway |
145
+ | Claude Code | Add `caplets serve` or `caplets attach` manually in MCP config | Local or remote/Cloud progressive-disclosure gateway |
146
+ | Codex | Add `caplets serve` or `caplets attach` manually in MCP config | Local or remote/Cloud progressive-disclosure gateway |
147
+ | OpenCode | Install [`@caplets/opencode`](packages/opencode/README.md) | Native `caplets_<id>` tools and prompt guidance hooks |
148
+ | Pi | Install [`@caplets/pi`](packages/pi/README.md) | Native `caplets_<id>` tools with Pi prompt snippets/guidelines |
138
149
 
139
- Codex and Claude Code plugins are plugin-native but MCP-backed. The installable plugin
140
- lives under `plugins/caplets/`, with agent-specific manifests in `.codex-plugin/` and
141
- `.claude-plugin/`, a shared `skills/` directory, and shared `mcp.json` config. The
142
- repo-level `.agents/plugins/marketplace.json` and `.claude-plugin/marketplace.json`
143
- files only advertise that installable plugin root.
150
+ Manual local MCP config:
144
151
 
145
- The Claude Code and Codex commands install from this GitHub repository through each agent's
146
- plugin marketplace flow; users do not need to clone the repository manually. Plugin MCP
147
- configs run `caplets serve` directly, so install the Caplets CLI globally first.
152
+ ```json
153
+ {
154
+ "mcpServers": {
155
+ "caplets": {
156
+ "command": "caplets",
157
+ "args": ["serve"]
158
+ }
159
+ }
160
+ }
161
+ ```
162
+
163
+ Manual remote or Cloud MCP config:
164
+
165
+ ```json
166
+ {
167
+ "mcpServers": {
168
+ "caplets": {
169
+ "command": "caplets",
170
+ "args": ["attach"]
171
+ }
172
+ }
173
+ }
174
+ ```
175
+
176
+ For Caplets Cloud, authenticate once and set the remote selection environment for the agent:
177
+
178
+ ```sh
179
+ caplets cloud auth login
180
+ export CAPLETS_MODE=cloud
181
+ export CAPLETS_REMOTE_URL=https://cloud.caplets.dev
182
+ ```
183
+
184
+ For a self-hosted remote:
185
+
186
+ ```sh
187
+ export CAPLETS_MODE=remote
188
+ export CAPLETS_REMOTE_URL=https://caplets.example.com/caplets
189
+ export CAPLETS_REMOTE_TOKEN=...
190
+ ```
191
+
192
+ ## Core Alchemy
193
+
194
+ Core Alchemy deploys the public landing page from `apps/landing`. It does not deploy the private Cloud Worker or Cloud dashboard; those belong to the nested Cloud repository.
148
195
 
149
196
  ### Remote Caplets service
150
197
 
151
198
  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.
152
199
 
200
+ Hosted Caplets Cloud uses browser-mediated Cloud Auth:
201
+
202
+ ```sh
203
+ caplets cloud auth login --workspace personal
204
+ caplets cloud auth status
205
+ caplets cloud auth workspaces
206
+ caplets cloud auth switch team
207
+ caplets cloud auth logout
208
+ ```
209
+
210
+ Cloud Auth stores one Selected Workspace locally. `caplets attach --workspace <workspace>` must match that saved workspace; switch explicitly before attaching another hosted workspace. Self-hosted remotes continue to use `CAPLETS_REMOTE_URL`, `CAPLETS_REMOTE_TOKEN`, or Basic Auth credentials.
211
+
212
+ Access tokens are short-lived. The CLI refreshes expired hosted credentials before attach, persists the rotated refresh token returned by Cloud, and treats revoked refresh credentials as a fresh-login requirement. `caplets cloud auth logout` clears local credentials; Cloud logout revokes the refresh credential family so rotated refresh tokens stop working together.
213
+
214
+ Use `caplets attach --once` for a finite Project Binding smoke test, or `caplets attach` to run a remote-backed MCP server over stdio or HTTP with Project Binding and local overlay.
215
+
153
216
  Start a local HTTP service. `--path` is the service base path; Caplets mounts MCP,
154
217
  control, and health endpoints underneath it:
155
218
 
@@ -244,12 +307,16 @@ version, and customize them with the project.
244
307
 
245
308
  ## Why It Matters
246
309
 
247
- Large MCP setups can make agents harder to steer. If every downstream server exposes
248
- every tool up front, the model starts with a noisy flat list, duplicate tool names, and
249
- a larger context surface before it knows which capability matters.
310
+ Flat tool lists make agents guess before they understand. If every downstream server exposes every operation up front, the model starts with a noisy list, duplicate tool names, and a larger context surface before it knows which capability matters.
250
311
 
251
- Caplets turns that flat tool wall into progressive disclosure: one capability card first,
252
- then scoped discovery only after the agent chooses the relevant domain.
312
+ Caplets turns that flat wall into a staged path:
313
+
314
+ 1. **Choose** a capability, such as `GitHub`.
315
+ 2. **Inspect** matching operations with `search_tools` or `list_tools`.
316
+ 3. **Resolve** the exact schema with `get_tool`.
317
+ 4. **Invoke** with `call_tool` while preserving downstream content, structured data, and error state.
318
+
319
+ A backend enters agent context as a focused card with source, status, and next actions, not a wall of operations.
253
320
 
254
321
  ## Benchmark
255
322
 
@@ -290,18 +357,30 @@ CAPLETS_BENCH_LIVE=1 pnpm benchmark:live:opencode -- --model openai/gpt-5.5-fast
290
357
 
291
358
  ## Design Model
292
359
 
293
- Caplets combines two ideas that work well separately but leave a gap together: agent
294
- skills and MCP servers.
360
+ Caplets combines two ideas that work well separately but leave a gap together: agent skills and MCP servers.
361
+
362
+ Agent skills are great at progressive disclosure. They show an agent a compact capability card first, then let it read deeper instructions only when that skill is relevant. MCP servers are great at live tool execution, but most clients expose their tools as one flat list up front. That means a powerful MCP setup can flood the agent with every tool from every server before it knows which capability area matters.
363
+
364
+ Caplets borrows the skill-shaped discovery model and applies it to MCP, OpenAPI, GraphQL, HTTP, and CLI backends. Each backend becomes a skill-like capability card first; its actual operations stay hidden until the agent chooses that capability and asks to search, list, inspect, or call them.
365
+
366
+ A capability is safe for agents when it reveals itself in stages:
367
+
368
+ - **Discoverable as one capability:** source, status, auth posture, and next actions are visible before any downstream tool list enters context.
369
+ - **Inspectable before invocation:** agents search inside the selected capability, then inspect exact tool schemas before any call is made.
370
+ - **Lossless after the call:** Caplets preserves structured content, resource links, images, and downstream error state instead of flattening results away.
295
371
 
296
- Agent skills are great at progressive disclosure. They show an agent a compact capability
297
- card first, then let it read deeper instructions only when that skill is relevant. MCP
298
- servers are great at live tool execution, but most clients expose their tools as one flat
299
- list up front. That means a powerful MCP setup can flood the agent with every tool from
300
- every server before it knows which capability area matters.
372
+ ## Trust Before Invocation
301
373
 
302
- Caplets borrows the skill-shaped discovery model and applies it to MCP. Each downstream
303
- server becomes a skill-like capability card first; its actual MCP tools stay hidden until
304
- the agent chooses that server and asks to search, list, inspect, or call them.
374
+ Caplets keeps trust mechanics visible before an agent calls a backend.
375
+
376
+ | Mechanic | Example | Why it matters |
377
+ | -------- | ---------------------------------- | ------------------------------------------------------------------------------- |
378
+ | Source | `.caplets/config.json` | Users can see where the capability came from before trusting it. |
379
+ | Auth | `GITHUB_TOKEN: redacted` | Secrets stay hidden while auth state remains inspectable. |
380
+ | Timeout | `30s boundary` | Slow or stuck backends fail visibly instead of disappearing into agent context. |
381
+ | Error | `safe message + raw detail scoped` | Recovery information stays useful without leaking sensitive configuration. |
382
+
383
+ If a backend fails, Caplets keeps the error scoped to the capability, preserves useful recovery detail, and redacts sensitive configuration before it reaches the agent.
305
384
 
306
385
  ## Capabilities
307
386
 
@@ -464,8 +543,11 @@ tags:
464
543
  - code
465
544
  - review
466
545
  mcpServer:
467
- command: npx
468
- args: ["-y", "github-mcp-server"]
546
+ transport: http
547
+ url: https://api.githubcopilot.com/mcp
548
+ auth:
549
+ type: bearer
550
+ token: $env:GH_TOKEN
469
551
  ---
470
552
 
471
553
  # GitHub
@@ -559,7 +641,7 @@ normal Markdown links from `CAPLET.md`.
559
641
 
560
642
  This repository includes polished working examples under [`caplets/`](caplets/):
561
643
 
562
- - `github`: GitHub's official MCP server container, using `GITHUB_PERSONAL_ACCESS_TOKEN`.
644
+ - `github`: GitHub's hosted MCP endpoint, using `GH_TOKEN`.
563
645
  - `linear`: Linear's hosted OAuth MCP endpoint.
564
646
  - `context7`: Context7 documentation lookup through `@upstash/context7-mcp`.
565
647
  - `repo-cli`: Read-oriented repository CLI workflows through `git` and package scripts.
@@ -857,7 +939,7 @@ an existing destination file.
857
939
  ### Caplet Sets
858
940
 
859
941
  Use `capletSets` to expose another Caplets collection as nested Caplets. Each child Caplet appears
860
- as one downstream tool and supports the full Caplets operation set: `get_caplet`, `check_backend`,
942
+ as one downstream tool and supports the full Caplets operation set: `inspect`, `check_backend`,
861
943
  `list_tools`, `search_tools`, `get_tool`, and `call_tool`.
862
944
 
863
945
  ```json
@@ -997,6 +1079,34 @@ top-level MCP tool list without restarting Caplets. When an MCP-backed Caplet ch
997
1079
  removed, Caplets closes only that affected downstream connection; unrelated Caplets and
998
1080
  their downstream connections keep running.
999
1081
 
1082
+ ## Quick Integration Setup
1083
+
1084
+ Use `caplets setup` to install or configure an agent integration:
1085
+
1086
+ ```bash
1087
+ caplets setup codex
1088
+ caplets setup claude-code
1089
+ caplets setup opencode
1090
+ caplets setup pi
1091
+ caplets setup mcp-client --output ./caplets.mcp.json
1092
+ ```
1093
+
1094
+ Preview the actions before changing anything:
1095
+
1096
+ ```bash
1097
+ caplets setup codex --dry-run
1098
+ ```
1099
+
1100
+ For native integrations that should connect to a remote Caplets HTTP service:
1101
+
1102
+ ```bash
1103
+ caplets setup opencode --remote --server-url https://caplets.example.com/caplets
1104
+ ```
1105
+
1106
+ `caplets setup` runs the supported agent installer commands or writes the explicit config
1107
+ path you pass with `--output`. It does not store secrets, edit unknown MCP client config
1108
+ locations, or start `caplets serve`.
1109
+
1000
1110
  ## Additional Native Integrations
1001
1111
 
1002
1112
  OpenCode and Pi support true native tool registration. Those integrations expose one
@@ -1062,7 +1172,7 @@ Call one exact downstream tool:
1062
1172
 
1063
1173
  Available operations:
1064
1174
 
1065
- - `get_caplet`: return the configured capability card without starting the downstream server.
1175
+ - `inspect`: return the configured capability card without starting the downstream server.
1066
1176
  - `check_backend`: verify the selected backend, whether MCP, OpenAPI, GraphQL, HTTP, CLI, or nested Caplets.
1067
1177
  - `list_tools`: return compact downstream tool metadata.
1068
1178
  - `search_tools`: search downstream tool names and descriptions within this Caplet.
@@ -1072,7 +1182,7 @@ Available operations:
1072
1182
  Requests are strict: operation-specific extra fields are rejected, and `call_tool` requires
1073
1183
  `arguments` to be a JSON object.
1074
1184
 
1075
- Discovery operations (`get_caplet`, `check_backend`, `list_tools`, `search_tools`, and
1185
+ Discovery operations (`inspect`, `check_backend`, `list_tools`, `search_tools`, and
1076
1186
  `get_tool`) return wrapper-generated results whose `structuredContent.caplets` field
1077
1187
  identifies the Caplet with `id`, plus backend, operation, status, and elapsed time when
1078
1188
  available. Discovery result objects and compact tool entries also use `id` for the