caplets 0.17.7 → 0.17.9

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 +105 -47
  2. package/dist/index.js +3379 -3163
  3. package/package.json +4 -4
package/README.md CHANGED
@@ -4,8 +4,8 @@
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>
@@ -15,6 +15,10 @@
15
15
  <img alt="Node 22+" src="https://img.shields.io/badge/node-%3E%3D22-F6E8C8?style=flat-square&labelColor=1F2018" />
16
16
  </p>
17
17
 
18
+ <p>
19
+ <a href="https://caplets.dev"><strong>caplets.dev</strong></a>
20
+ </p>
21
+
18
22
  <p>
19
23
  <code>MCP</code> · <code>OpenAPI</code> · <code>GraphQL</code> · <code>HTTP</code> · <code>CLI</code>
20
24
  </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 22 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"}'
@@ -244,12 +255,16 @@ version, and customize them with the project.
244
255
 
245
256
  ## Why It Matters
246
257
 
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.
258
+ 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
259
 
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.
260
+ Caplets turns that flat wall into a staged path:
261
+
262
+ 1. **Choose** a capability, such as `GitHub`.
263
+ 2. **Inspect** matching operations with `search_tools` or `list_tools`.
264
+ 3. **Resolve** the exact schema with `get_tool`.
265
+ 4. **Invoke** with `call_tool` while preserving downstream content, structured data, and error state.
266
+
267
+ A backend enters agent context as a focused card with source, status, and next actions, not a wall of operations.
253
268
 
254
269
  ## Benchmark
255
270
 
@@ -290,18 +305,30 @@ CAPLETS_BENCH_LIVE=1 pnpm benchmark:live:opencode -- --model openai/gpt-5.5-fast
290
305
 
291
306
  ## Design Model
292
307
 
293
- Caplets combines two ideas that work well separately but leave a gap together: agent
294
- skills and MCP servers.
308
+ Caplets combines two ideas that work well separately but leave a gap together: agent skills and MCP servers.
309
+
310
+ 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.
295
311
 
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.
312
+ 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.
301
313
 
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.
314
+ A capability is safe for agents when it reveals itself in stages:
315
+
316
+ - **Discoverable as one capability:** source, status, auth posture, and next actions are visible before any downstream tool list enters context.
317
+ - **Inspectable before invocation:** agents search inside the selected capability, then inspect exact tool schemas before any call is made.
318
+ - **Lossless after the call:** Caplets preserves structured content, resource links, images, and downstream error state instead of flattening results away.
319
+
320
+ ## Trust Before Invocation
321
+
322
+ Caplets keeps trust mechanics visible before an agent calls a backend.
323
+
324
+ | Mechanic | Example | Why it matters |
325
+ | -------- | ---------------------------------- | ------------------------------------------------------------------------------- |
326
+ | Source | `.caplets/config.json` | Users can see where the capability came from before trusting it. |
327
+ | Auth | `GITHUB_TOKEN: redacted` | Secrets stay hidden while auth state remains inspectable. |
328
+ | Timeout | `30s boundary` | Slow or stuck backends fail visibly instead of disappearing into agent context. |
329
+ | Error | `safe message + raw detail scoped` | Recovery information stays useful without leaking sensitive configuration. |
330
+
331
+ 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
332
 
306
333
  ## Capabilities
307
334
 
@@ -464,8 +491,11 @@ tags:
464
491
  - code
465
492
  - review
466
493
  mcpServer:
467
- command: npx
468
- args: ["-y", "github-mcp-server"]
494
+ transport: http
495
+ url: https://api.githubcopilot.com/mcp
496
+ auth:
497
+ type: bearer
498
+ token: $env:GH_TOKEN
469
499
  ---
470
500
 
471
501
  # GitHub
@@ -559,7 +589,7 @@ normal Markdown links from `CAPLET.md`.
559
589
 
560
590
  This repository includes polished working examples under [`caplets/`](caplets/):
561
591
 
562
- - `github`: GitHub's official MCP server container, using `GITHUB_PERSONAL_ACCESS_TOKEN`.
592
+ - `github`: GitHub's hosted MCP endpoint, using `GH_TOKEN`.
563
593
  - `linear`: Linear's hosted OAuth MCP endpoint.
564
594
  - `context7`: Context7 documentation lookup through `@upstash/context7-mcp`.
565
595
  - `repo-cli`: Read-oriented repository CLI workflows through `git` and package scripts.
@@ -857,7 +887,7 @@ an existing destination file.
857
887
  ### Caplet Sets
858
888
 
859
889
  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`,
890
+ as one downstream tool and supports the full Caplets operation set: `inspect`, `check_backend`,
861
891
  `list_tools`, `search_tools`, `get_tool`, and `call_tool`.
862
892
 
863
893
  ```json
@@ -997,6 +1027,34 @@ top-level MCP tool list without restarting Caplets. When an MCP-backed Caplet ch
997
1027
  removed, Caplets closes only that affected downstream connection; unrelated Caplets and
998
1028
  their downstream connections keep running.
999
1029
 
1030
+ ## Quick Integration Setup
1031
+
1032
+ Use `caplets setup` to install or configure an agent integration:
1033
+
1034
+ ```bash
1035
+ caplets setup codex
1036
+ caplets setup claude-code
1037
+ caplets setup opencode
1038
+ caplets setup pi
1039
+ caplets setup mcp-client --output ./caplets.mcp.json
1040
+ ```
1041
+
1042
+ Preview the actions before changing anything:
1043
+
1044
+ ```bash
1045
+ caplets setup codex --dry-run
1046
+ ```
1047
+
1048
+ For native integrations that should connect to a remote Caplets HTTP service:
1049
+
1050
+ ```bash
1051
+ caplets setup opencode --remote --server-url https://caplets.example.com/caplets
1052
+ ```
1053
+
1054
+ `caplets setup` runs the supported agent installer commands or writes the explicit config
1055
+ path you pass with `--output`. It does not store secrets, edit unknown MCP client config
1056
+ locations, or start `caplets serve`.
1057
+
1000
1058
  ## Additional Native Integrations
1001
1059
 
1002
1060
  OpenCode and Pi support true native tool registration. Those integrations expose one
@@ -1062,7 +1120,7 @@ Call one exact downstream tool:
1062
1120
 
1063
1121
  Available operations:
1064
1122
 
1065
- - `get_caplet`: return the configured capability card without starting the downstream server.
1123
+ - `inspect`: return the configured capability card without starting the downstream server.
1066
1124
  - `check_backend`: verify the selected backend, whether MCP, OpenAPI, GraphQL, HTTP, CLI, or nested Caplets.
1067
1125
  - `list_tools`: return compact downstream tool metadata.
1068
1126
  - `search_tools`: search downstream tool names and descriptions within this Caplet.
@@ -1072,7 +1130,7 @@ Available operations:
1072
1130
  Requests are strict: operation-specific extra fields are rejected, and `call_tool` requires
1073
1131
  `arguments` to be a JSON object.
1074
1132
 
1075
- Discovery operations (`get_caplet`, `check_backend`, `list_tools`, `search_tools`, and
1133
+ Discovery operations (`inspect`, `check_backend`, `list_tools`, `search_tools`, and
1076
1134
  `get_tool`) return wrapper-generated results whose `structuredContent.caplets` field
1077
1135
  identifies the Caplet with `id`, plus backend, operation, status, and elapsed time when
1078
1136
  available. Discovery result objects and compact tool entries also use `id` for the