caplets 0.10.0 → 0.12.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.
- package/README.md +115 -22
- package/caplets/github-cli/CAPLET.md +41 -0
- package/caplets/repo-cli/CAPLET.md +37 -0
- package/dist/index.js +6938 -5826
- package/package.json +1 -1
- package/schemas/caplet.schema.json +139 -0
- package/schemas/caplets-config.schema.json +174 -0
package/README.md
CHANGED
|
@@ -28,8 +28,8 @@ exposed two ways: direct flat MCP aggregation versus Caplets progressive disclos
|
|
|
28
28
|
| Initial Agent Surface | Direct Flat MCP | Caplets | Reduction |
|
|
29
29
|
| ------------------------- | ----------------: | -----------: | ------------: |
|
|
30
30
|
| Visible tools | 106 | 3 | 97.2% fewer |
|
|
31
|
-
| Serialized MCP payload | 32,090 bytes | 8,
|
|
32
|
-
| Approx. context surface | 8,023 tokens | 2,
|
|
31
|
+
| Serialized MCP payload | 32,090 bytes | 8,400 bytes | 73.8% smaller |
|
|
32
|
+
| Approx. context surface | 8,023 tokens | 2,100 tokens | 5,923 fewer |
|
|
33
33
|
| Top-level name collisions | 3 duplicate names | 0 | eliminated |
|
|
34
34
|
|
|
35
35
|
The important part: Caplets does not remove access to the downstream tools. It hides
|
|
@@ -74,8 +74,8 @@ the agent chooses that server and asks to search, list, inspect, or call them.
|
|
|
74
74
|
|
|
75
75
|
## What It Does
|
|
76
76
|
|
|
77
|
-
- Reads downstream MCP server definitions, native OpenAPI endpoint definitions, native GraphQL endpoint definitions,
|
|
78
|
-
- Registers one generated MCP tool for each enabled MCP server, OpenAPI endpoint, GraphQL endpoint, or
|
|
77
|
+
- Reads downstream MCP server definitions, native OpenAPI endpoint definitions, native GraphQL endpoint definitions, explicit HTTP API action definitions, and curated CLI tool definitions from the user config file.
|
|
78
|
+
- Registers one generated MCP tool for each enabled MCP server, OpenAPI endpoint, GraphQL endpoint, HTTP API, or CLI tools backend.
|
|
79
79
|
- Uses the configured server ID as the generated tool name.
|
|
80
80
|
- Uses the configured `name` and `description` as the capability card shown to agents.
|
|
81
81
|
- Starts downstream MCP servers and loads OpenAPI specs lazily when an operation needs them.
|
|
@@ -84,6 +84,7 @@ the agent chooses that server and asks to search, list, inspect, or call them.
|
|
|
84
84
|
- Converts OpenAPI operations into MCP-style tool metadata and executes HTTP calls directly.
|
|
85
85
|
- Converts configured GraphQL operations into MCP-style tool metadata, and can auto-generate GraphQL tools from schema root query and mutation fields.
|
|
86
86
|
- Converts explicitly configured HTTP actions into MCP-style tool metadata and executes HTTP calls directly.
|
|
87
|
+
- Converts explicitly configured CLI actions into MCP-style tool metadata and executes commands directly without a shell.
|
|
87
88
|
- Preserves downstream tool results instead of rewriting them into a custom format.
|
|
88
89
|
- Redacts secrets from structured errors.
|
|
89
90
|
- Supports static remote auth and OAuth token storage for remote servers.
|
|
@@ -218,7 +219,7 @@ the committed schema stays in sync with the Zod config validator.
|
|
|
218
219
|
|
|
219
220
|
For richer skill-like cards, add Markdown Caplet files beside `config.json`. Every Caplet
|
|
220
221
|
file must include exactly one executable backend: `mcpServer`, `openapiEndpoint`,
|
|
221
|
-
`graphqlEndpoint`, or `
|
|
222
|
+
`graphqlEndpoint`, `httpApi`, or `cliTools`;
|
|
222
223
|
serverless Caplets are intentionally out of scope.
|
|
223
224
|
|
|
224
225
|
Top-level files derive the Caplet ID from the filename:
|
|
@@ -301,6 +302,26 @@ httpApi:
|
|
|
301
302
|
# Status API
|
|
302
303
|
```
|
|
303
304
|
|
|
305
|
+
CLI-backed Caplet files use `cliTools`:
|
|
306
|
+
|
|
307
|
+
```md
|
|
308
|
+
---
|
|
309
|
+
name: Repository CLI
|
|
310
|
+
description: Run curated repository workflows through local CLI commands.
|
|
311
|
+
cliTools:
|
|
312
|
+
cwd: /home/you/project
|
|
313
|
+
actions:
|
|
314
|
+
git_status:
|
|
315
|
+
description: Show concise Git working tree status.
|
|
316
|
+
command: git
|
|
317
|
+
args: ["status", "--short"]
|
|
318
|
+
annotations:
|
|
319
|
+
readOnlyHint: true
|
|
320
|
+
---
|
|
321
|
+
|
|
322
|
+
# Repository CLI
|
|
323
|
+
```
|
|
324
|
+
|
|
304
325
|
Top-level files derive their Caplet ID from the filename. Directory-style Caplets use
|
|
305
326
|
`linear/CAPLET.md`, which is exposed as `linear`; sibling files can be referenced with
|
|
306
327
|
normal Markdown links from `CAPLET.md`.
|
|
@@ -310,8 +331,11 @@ This repository includes polished working examples under [`caplets/`](caplets/):
|
|
|
310
331
|
- `github`: GitHub's official MCP server container, using `GITHUB_PERSONAL_ACCESS_TOKEN`.
|
|
311
332
|
- `linear`: Linear's hosted OAuth MCP endpoint.
|
|
312
333
|
- `context7`: Context7 documentation lookup through `@upstash/context7-mcp`.
|
|
334
|
+
- `repo-cli`: Read-oriented repository CLI workflows through `git` and package scripts.
|
|
335
|
+
- `github-cli`: Read-oriented GitHub workflows through the `gh` CLI.
|
|
313
336
|
|
|
314
|
-
Install every example from a repo's `caplets/` directory
|
|
337
|
+
Install every example from a repo's `caplets/` directory into the current project's
|
|
338
|
+
`./.caplets` directory:
|
|
315
339
|
|
|
316
340
|
```sh
|
|
317
341
|
caplets install spiritledsoftware/caplets
|
|
@@ -325,22 +349,20 @@ caplets install spiritledsoftware/caplets github linear
|
|
|
325
349
|
```
|
|
326
350
|
|
|
327
351
|
`caplets install` accepts a GitHub `owner/repo` shorthand, a Git URL, or a local repository path.
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
352
|
+
By default it writes to `./.caplets`, creating that directory when needed. Pass `-g` or
|
|
353
|
+
`--global` to write to your user Caplets root instead, which is
|
|
354
|
+
`${XDG_CONFIG_HOME:-~/.config}/caplets` on Unix-like platforms, `%APPDATA%\caplets` on Windows,
|
|
355
|
+
or the parent directory of `CAPLETS_CONFIG` when that environment variable is set. Existing
|
|
356
|
+
Caplets are not overwritten unless `--force` is passed.
|
|
331
357
|
|
|
332
358
|
On Unix-like platforms, relative `XDG_CONFIG_HOME` and `XDG_STATE_HOME` values are ignored.
|
|
333
359
|
|
|
334
|
-
Caplets
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
```
|
|
341
|
-
|
|
342
|
-
Later sources override earlier ones in this order: user `config.json`, user Caplet files,
|
|
343
|
-
project `config.json`, and, only when trusted, project Caplet files.
|
|
360
|
+
Caplets loads user Caplet files from the user Caplets root and project Caplet files from the
|
|
361
|
+
current working directory's `./.caplets` directory. Later sources override earlier ones in this
|
|
362
|
+
order: user `config.json`, user Caplet files, project `config.json`, and project Caplet files.
|
|
363
|
+
That means a project-local Caplet can intentionally replace a user-level Caplet with the same ID.
|
|
364
|
+
Use `caplets list` to see each Caplet's winning source; when a project Caplet shadows a user-level
|
|
365
|
+
Caplet, the list output includes a warning naming the shadowed path.
|
|
344
366
|
|
|
345
367
|
`caplets init` refuses to overwrite an existing config. To intentionally replace the file:
|
|
346
368
|
|
|
@@ -350,7 +372,7 @@ caplets init --force
|
|
|
350
372
|
|
|
351
373
|
### Caplet IDs
|
|
352
374
|
|
|
353
|
-
Each key under `mcpServers`, `openapiEndpoints`, `graphqlEndpoints`, or `
|
|
375
|
+
Each key under `mcpServers`, `openapiEndpoints`, `graphqlEndpoints`, `httpApis`, or `cliTools` is the
|
|
354
376
|
stable Caplet ID. It becomes the generated MCP tool name exactly, so keep it short and specific:
|
|
355
377
|
|
|
356
378
|
```json
|
|
@@ -367,7 +389,7 @@ stable Caplet ID. It becomes the generated MCP tool name exactly, so keep it sho
|
|
|
367
389
|
```
|
|
368
390
|
|
|
369
391
|
Caplet IDs must match `^[a-zA-Z0-9_-]{1,64}$` and must be unique across `mcpServers`,
|
|
370
|
-
`openapiEndpoints`, `graphqlEndpoints`, and `
|
|
392
|
+
`openapiEndpoints`, `graphqlEndpoints`, `httpApis`, and `cliTools`. Spaces, dots, slashes, colons, and Unicode IDs are rejected.
|
|
371
393
|
|
|
372
394
|
### Stdio Servers
|
|
373
395
|
|
|
@@ -537,6 +559,70 @@ parsed `body` when present, and `elapsedMs`; non-2xx responses set `isError`, re
|
|
|
537
559
|
timeouts are enforced, response bodies are capped by `maxResponseBytes` (default `1000000`), and
|
|
538
560
|
errors redact secrets.
|
|
539
561
|
|
|
562
|
+
### CLI Tools
|
|
563
|
+
|
|
564
|
+
Use `cliTools` for curated local command-line workflows. Each action is an explicitly configured
|
|
565
|
+
tool; Caplets does not expose arbitrary shell access and always spawns `command` plus `args`
|
|
566
|
+
without shell interpolation.
|
|
567
|
+
|
|
568
|
+
```json
|
|
569
|
+
{
|
|
570
|
+
"name": "Repository CLI",
|
|
571
|
+
"description": "Run curated repository workflows through local CLI commands.",
|
|
572
|
+
"cwd": "/home/you/project",
|
|
573
|
+
"timeoutMs": 60000,
|
|
574
|
+
"maxOutputBytes": 1000000,
|
|
575
|
+
"actions": {
|
|
576
|
+
"git_status": {
|
|
577
|
+
"description": "Show concise Git working tree status.",
|
|
578
|
+
"command": "git",
|
|
579
|
+
"args": ["status", "--short"],
|
|
580
|
+
"annotations": { "readOnlyHint": true }
|
|
581
|
+
},
|
|
582
|
+
"run_tests": {
|
|
583
|
+
"description": "Run the package test script.",
|
|
584
|
+
"command": "pnpm",
|
|
585
|
+
"args": ["run", "test"],
|
|
586
|
+
"timeoutMs": 120000,
|
|
587
|
+
"annotations": { "readOnlyHint": true }
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
```
|
|
592
|
+
|
|
593
|
+
CLI actions can set `inputSchema`, `outputSchema`, `env`, action-level `cwd`, `timeoutMs`,
|
|
594
|
+
`maxOutputBytes`, `output: {"type":"json"}`, and MCP annotations. `$input.field` references are
|
|
595
|
+
supported inside `args`, `env`, and `cwd` strings. Caplets performs basic required-field and
|
|
596
|
+
primitive-type validation before spawning. Results are returned as structured content with
|
|
597
|
+
`exitCode`, `stdout`, `stderr`, and `elapsedMs`; non-zero exits set `isError`.
|
|
598
|
+
|
|
599
|
+
Generate and add a CLI Caplet manifest from a repository:
|
|
600
|
+
|
|
601
|
+
```sh
|
|
602
|
+
caplets add cli repo-tools --repo . --include git,gh,package
|
|
603
|
+
```
|
|
604
|
+
|
|
605
|
+
`caplets add` writes generated Markdown Caplet files to `./.caplets/<id>.md` by default.
|
|
606
|
+
Pass `-g` or `--global` to write to the user Caplets root, `--print` to review the generated
|
|
607
|
+
manifest without writing, `--output <path>` for an explicit destination, or `--force` to overwrite
|
|
608
|
+
an existing destination file.
|
|
609
|
+
|
|
610
|
+
Add MCP, OpenAPI, GraphQL, and HTTP API Caplets with the same destination options:
|
|
611
|
+
|
|
612
|
+
```sh
|
|
613
|
+
caplets add mcp local-tools --command node --arg ./server.mjs
|
|
614
|
+
caplets add mcp remote-tools --url https://mcp.example.com/mcp --transport http --token-env MCP_TOKEN
|
|
615
|
+
caplets add openapi users --spec ./openapi.json --base-url https://api.example.com --token-env USERS_API_TOKEN
|
|
616
|
+
caplets add graphql catalog --endpoint-url https://api.example.com/graphql --schema ./schema.graphql
|
|
617
|
+
caplets add graphql catalog-live --endpoint-url https://api.example.com/graphql --introspection
|
|
618
|
+
caplets add http status-api --base-url https://api.example.com --action get_status:GET:/status/{service}
|
|
619
|
+
```
|
|
620
|
+
|
|
621
|
+
For `caplets add mcp`, use `--command` with repeated `--arg`, optional `--cwd`, and repeated
|
|
622
|
+
`--env KEY=VALUE` for stdio servers, or `--url` with `--transport http|sse` for remote servers.
|
|
623
|
+
For HTTP authentication, pass `--token-env <ENV>` so generated manifests reference `$env:ENV`
|
|
624
|
+
instead of embedding raw bearer tokens.
|
|
625
|
+
|
|
540
626
|
### Authentication
|
|
541
627
|
|
|
542
628
|
Remote servers can use:
|
|
@@ -580,6 +666,13 @@ caplets list --all
|
|
|
580
666
|
caplets list --json
|
|
581
667
|
```
|
|
582
668
|
|
|
669
|
+
Human output includes a `source` column. JSON output includes each Caplet's `source`, `path`, and
|
|
670
|
+
`shadows` metadata. If a project source overrides a user source, human output prints a warning such
|
|
671
|
+
as `Warning: project Caplet GitHub shadows global Caplet at /path/to/github.md`.
|
|
672
|
+
|
|
673
|
+
For safety, `caplets add` and `caplets install` reject symlinked output paths and symlinked parent
|
|
674
|
+
directories instead of following them.
|
|
675
|
+
|
|
583
676
|
### Optional Server Settings
|
|
584
677
|
|
|
585
678
|
Every server can set:
|
|
@@ -608,7 +701,7 @@ If your client starts the configured command directly, `caplets` without argumen
|
|
|
608
701
|
starts the MCP server. `serve` is explicit and recommended for clarity.
|
|
609
702
|
|
|
610
703
|
`caplets serve` watches the effective user config, project config, user Caplet files, and
|
|
611
|
-
|
|
704
|
+
project Caplet files. Adding, editing, disabling, or removing a Caplet updates the
|
|
612
705
|
top-level MCP tool list without restarting Caplets. When an MCP-backed Caplet changes or is
|
|
613
706
|
removed, Caplets closes only that affected downstream connection; unrelated Caplets and
|
|
614
707
|
their downstream connections keep running.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
$schema: https://raw.githubusercontent.com/spiritledsoftware/caplets/main/schemas/caplet.schema.json
|
|
3
|
+
name: GitHub CLI
|
|
4
|
+
description: Inspect GitHub pull requests and issues through curated gh CLI commands.
|
|
5
|
+
tags:
|
|
6
|
+
- cli
|
|
7
|
+
- github
|
|
8
|
+
- code
|
|
9
|
+
cliTools:
|
|
10
|
+
actions:
|
|
11
|
+
gh_pr_status:
|
|
12
|
+
description: Show pull request status for the current branch as JSON.
|
|
13
|
+
command: gh
|
|
14
|
+
args:
|
|
15
|
+
- pr
|
|
16
|
+
- status
|
|
17
|
+
- --json
|
|
18
|
+
- currentBranch
|
|
19
|
+
output:
|
|
20
|
+
type: json
|
|
21
|
+
annotations:
|
|
22
|
+
readOnlyHint: true
|
|
23
|
+
openWorldHint: true
|
|
24
|
+
gh_issue_list:
|
|
25
|
+
description: List open GitHub issues as JSON.
|
|
26
|
+
command: gh
|
|
27
|
+
args:
|
|
28
|
+
- issue
|
|
29
|
+
- list
|
|
30
|
+
- --json
|
|
31
|
+
- number,title,state,url
|
|
32
|
+
output:
|
|
33
|
+
type: json
|
|
34
|
+
annotations:
|
|
35
|
+
readOnlyHint: true
|
|
36
|
+
openWorldHint: true
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
# GitHub CLI
|
|
40
|
+
|
|
41
|
+
Use this Caplet to expose read-oriented GitHub workflows through `gh` without giving the agent an unrestricted shell.
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
$schema: https://raw.githubusercontent.com/spiritledsoftware/caplets/main/schemas/caplet.schema.json
|
|
3
|
+
name: Repository CLI
|
|
4
|
+
description: Inspect and run common local repository workflows through curated CLI tools.
|
|
5
|
+
tags:
|
|
6
|
+
- cli
|
|
7
|
+
- code
|
|
8
|
+
cliTools:
|
|
9
|
+
actions:
|
|
10
|
+
git_status:
|
|
11
|
+
description: Show concise Git working tree status.
|
|
12
|
+
command: git
|
|
13
|
+
args:
|
|
14
|
+
- status
|
|
15
|
+
- --short
|
|
16
|
+
annotations:
|
|
17
|
+
readOnlyHint: true
|
|
18
|
+
git_current_branch:
|
|
19
|
+
description: Print the current Git branch name.
|
|
20
|
+
command: git
|
|
21
|
+
args:
|
|
22
|
+
- branch
|
|
23
|
+
- --show-current
|
|
24
|
+
annotations:
|
|
25
|
+
readOnlyHint: true
|
|
26
|
+
package_test:
|
|
27
|
+
description: Run the repository test script with pnpm.
|
|
28
|
+
command: pnpm
|
|
29
|
+
args:
|
|
30
|
+
- run
|
|
31
|
+
- test
|
|
32
|
+
timeoutMs: 120000
|
|
33
|
+
---
|
|
34
|
+
|
|
35
|
+
# Repository CLI
|
|
36
|
+
|
|
37
|
+
Use this Caplet to expose a small, typed set of local repository commands without giving an agent arbitrary shell access.
|