caplets 0.7.0 → 0.9.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 +120 -19
- package/dist/index.js +589 -78
- package/package.json +1 -1
- package/schemas/caplet.schema.json +306 -0
- package/schemas/caplets-config.schema.json +334 -0
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Caplets
|
|
2
2
|
|
|
3
3
|
Caplets is a progressive-disclosure gateway for Model Context Protocol (MCP) servers,
|
|
4
|
-
native OpenAPI endpoints,
|
|
4
|
+
native OpenAPI endpoints, native GraphQL endpoints, and explicitly configured HTTP APIs.
|
|
5
5
|
|
|
6
6
|
Instead of connecting an MCP client to many downstream servers or HTTP APIs and exposing
|
|
7
7
|
every operation up front, Caplets exposes one top-level tool per configured capability.
|
|
@@ -28,8 +28,8 @@ the agent chooses that server and asks to search, list, inspect, or call them.
|
|
|
28
28
|
|
|
29
29
|
## What It Does
|
|
30
30
|
|
|
31
|
-
- Reads downstream MCP server definitions, native OpenAPI endpoint definitions,
|
|
32
|
-
- Registers one generated MCP tool for each enabled MCP server, OpenAPI endpoint, or
|
|
31
|
+
- Reads downstream MCP server definitions, native OpenAPI endpoint definitions, native GraphQL endpoint definitions, and explicit HTTP API action definitions from the user config file.
|
|
32
|
+
- Registers one generated MCP tool for each enabled MCP server, OpenAPI endpoint, GraphQL endpoint, or HTTP API.
|
|
33
33
|
- Uses the configured server ID as the generated tool name.
|
|
34
34
|
- Uses the configured `name` and `description` as the capability card shown to agents.
|
|
35
35
|
- Starts downstream MCP servers and loads OpenAPI specs lazily when an operation needs them.
|
|
@@ -37,6 +37,7 @@ the agent chooses that server and asks to search, list, inspect, or call them.
|
|
|
37
37
|
- Lets agents `list_tools`, `search_tools`, `get_tool`, and `call_tool` within one selected Caplet namespace.
|
|
38
38
|
- Converts OpenAPI operations into MCP-style tool metadata and executes HTTP calls directly.
|
|
39
39
|
- Converts configured GraphQL operations into MCP-style tool metadata, and can auto-generate GraphQL tools from schema root query and mutation fields.
|
|
40
|
+
- Converts explicitly configured HTTP actions into MCP-style tool metadata and executes HTTP calls directly.
|
|
40
41
|
- Preserves downstream tool results instead of rewriting them into a custom format.
|
|
41
42
|
- Redacts secrets from structured errors.
|
|
42
43
|
- Supports static remote auth and OAuth token storage for remote servers.
|
|
@@ -58,7 +59,7 @@ pnpm build
|
|
|
58
59
|
|
|
59
60
|
## Configure
|
|
60
61
|
|
|
61
|
-
Create a starter
|
|
62
|
+
Create a starter user config at `${XDG_CONFIG_HOME:-~/.config}/caplets/config.json` on Unix-like platforms or `%APPDATA%\caplets\config.json` on Windows:
|
|
62
63
|
|
|
63
64
|
```sh
|
|
64
65
|
caplets init
|
|
@@ -118,11 +119,31 @@ you want Caplets to expose:
|
|
|
118
119
|
"issuer": "https://login.example.com"
|
|
119
120
|
}
|
|
120
121
|
}
|
|
122
|
+
},
|
|
123
|
+
"httpApis": {
|
|
124
|
+
"status": {
|
|
125
|
+
"name": "Status API",
|
|
126
|
+
"description": "Read deployment status from a simple HTTP API.",
|
|
127
|
+
"baseUrl": "https://api.example.com",
|
|
128
|
+
"auth": { "type": "none" },
|
|
129
|
+
"actions": {
|
|
130
|
+
"get_status": {
|
|
131
|
+
"method": "GET",
|
|
132
|
+
"path": "/status/{service}",
|
|
133
|
+
"description": "Fetch status for one service.",
|
|
134
|
+
"inputSchema": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"properties": { "service": { "type": "string" } },
|
|
137
|
+
"required": ["service"]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
121
142
|
}
|
|
122
143
|
}
|
|
123
144
|
```
|
|
124
145
|
|
|
125
|
-
The default config path can be overridden with `CAPLETS_CONFIG`:
|
|
146
|
+
The default config path is `${XDG_CONFIG_HOME:-~/.config}/caplets/config.json` on Unix-like platforms and `%APPDATA%\caplets\config.json` on Windows. It can be overridden with `CAPLETS_CONFIG`:
|
|
126
147
|
|
|
127
148
|
```sh
|
|
128
149
|
CAPLETS_CONFIG=/path/to/config.json caplets init
|
|
@@ -150,8 +171,8 @@ the committed schema stays in sync with the Zod config validator.
|
|
|
150
171
|
### Caplet Files
|
|
151
172
|
|
|
152
173
|
For richer skill-like cards, add Markdown Caplet files beside `config.json`. Every Caplet
|
|
153
|
-
file must include exactly one executable backend: `mcpServer`, `openapiEndpoint`,
|
|
154
|
-
`graphqlEndpoint`;
|
|
174
|
+
file must include exactly one executable backend: `mcpServer`, `openapiEndpoint`,
|
|
175
|
+
`graphqlEndpoint`, or `httpApi`;
|
|
155
176
|
serverless Caplets are intentionally out of scope.
|
|
156
177
|
|
|
157
178
|
Top-level files derive the Caplet ID from the filename:
|
|
@@ -208,6 +229,32 @@ graphqlEndpoint:
|
|
|
208
229
|
# Catalog GraphQL
|
|
209
230
|
```
|
|
210
231
|
|
|
232
|
+
HTTP action Caplet files use `httpApi`:
|
|
233
|
+
|
|
234
|
+
```md
|
|
235
|
+
---
|
|
236
|
+
name: Status API
|
|
237
|
+
description: Read deployment status from a simple HTTP API.
|
|
238
|
+
httpApi:
|
|
239
|
+
baseUrl: https://api.example.com
|
|
240
|
+
auth:
|
|
241
|
+
type: none
|
|
242
|
+
actions:
|
|
243
|
+
get_status:
|
|
244
|
+
method: GET
|
|
245
|
+
path: /status/{service}
|
|
246
|
+
description: Fetch status for one service.
|
|
247
|
+
inputSchema:
|
|
248
|
+
type: object
|
|
249
|
+
properties:
|
|
250
|
+
service:
|
|
251
|
+
type: string
|
|
252
|
+
required: [service]
|
|
253
|
+
---
|
|
254
|
+
|
|
255
|
+
# Status API
|
|
256
|
+
```
|
|
257
|
+
|
|
211
258
|
Top-level files derive their Caplet ID from the filename. Directory-style Caplets use
|
|
212
259
|
`linear/CAPLET.md`, which is exposed as `linear`; sibling files can be referenced with
|
|
213
260
|
normal Markdown links from `CAPLET.md`.
|
|
@@ -232,11 +279,13 @@ caplets install spiritledsoftware/caplets github linear
|
|
|
232
279
|
```
|
|
233
280
|
|
|
234
281
|
`caplets install` accepts a GitHub `owner/repo` shorthand, a Git URL, or a local repository path.
|
|
235
|
-
It installs into your user Caplets root, which is
|
|
236
|
-
of `CAPLETS_CONFIG` when that environment variable is set.
|
|
237
|
-
unless `--force` is passed.
|
|
282
|
+
It installs into your user Caplets root, which is `${XDG_CONFIG_HOME:-~/.config}/caplets` on Unix-like platforms,
|
|
283
|
+
`%APPDATA%\caplets` on Windows, or the parent directory of `CAPLETS_CONFIG` when that environment variable is set.
|
|
284
|
+
Existing Caplets are not overwritten unless `--force` is passed.
|
|
285
|
+
|
|
286
|
+
On Unix-like platforms, relative `XDG_CONFIG_HOME` and `XDG_STATE_HOME` values are ignored.
|
|
238
287
|
|
|
239
|
-
Caplets always loads user Caplet files from
|
|
288
|
+
Caplets always loads user Caplet files from the user Caplets root. Project `./.caplets/config.json`
|
|
240
289
|
is still loaded as project config, but project Markdown Caplet files are executable
|
|
241
290
|
configuration and are ignored unless explicitly trusted:
|
|
242
291
|
|
|
@@ -255,8 +304,8 @@ caplets init --force
|
|
|
255
304
|
|
|
256
305
|
### Caplet IDs
|
|
257
306
|
|
|
258
|
-
Each key under `mcpServers` or `
|
|
259
|
-
generated MCP tool name exactly, so keep it short and specific:
|
|
307
|
+
Each key under `mcpServers`, `openapiEndpoints`, `graphqlEndpoints`, or `httpApis` is the
|
|
308
|
+
stable Caplet ID. It becomes the generated MCP tool name exactly, so keep it short and specific:
|
|
260
309
|
|
|
261
310
|
```json
|
|
262
311
|
{
|
|
@@ -272,7 +321,7 @@ generated MCP tool name exactly, so keep it short and specific:
|
|
|
272
321
|
```
|
|
273
322
|
|
|
274
323
|
Caplet IDs must match `^[a-zA-Z0-9_-]{1,64}$` and must be unique across `mcpServers`,
|
|
275
|
-
`openapiEndpoints`, and `
|
|
324
|
+
`openapiEndpoints`, `graphqlEndpoints`, and `httpApis`. Spaces, dots, slashes, colons, and Unicode IDs are rejected.
|
|
276
325
|
|
|
277
326
|
### Stdio Servers
|
|
278
327
|
|
|
@@ -391,6 +440,57 @@ Every GraphQL endpoint can set:
|
|
|
391
440
|
- `selectionDepth`: maximum depth for generated selection sets. Defaults to `2`; maximum `5`.
|
|
392
441
|
- `disabled`: omit the endpoint from Caplets discovery. Defaults to `false`.
|
|
393
442
|
|
|
443
|
+
### HTTP APIs
|
|
444
|
+
|
|
445
|
+
Use `httpApis` for simple HTTP APIs that do not have an OpenAPI spec. Each action is an
|
|
446
|
+
explicitly configured tool; Caplets does not discover routes, import curl commands, or execute
|
|
447
|
+
shell snippets.
|
|
448
|
+
|
|
449
|
+
```json
|
|
450
|
+
{
|
|
451
|
+
"name": "Status API",
|
|
452
|
+
"description": "Read and update deployment status through HTTP actions.",
|
|
453
|
+
"baseUrl": "https://api.example.com",
|
|
454
|
+
"auth": { "type": "bearer", "token": "$env:STATUS_API_TOKEN" },
|
|
455
|
+
"maxResponseBytes": 1000000,
|
|
456
|
+
"actions": {
|
|
457
|
+
"get_status": {
|
|
458
|
+
"method": "GET",
|
|
459
|
+
"path": "/status/{service}",
|
|
460
|
+
"description": "Fetch status for one service.",
|
|
461
|
+
"inputSchema": {
|
|
462
|
+
"type": "object",
|
|
463
|
+
"properties": { "service": { "type": "string" }, "verbose": { "type": "boolean" } },
|
|
464
|
+
"required": ["service"]
|
|
465
|
+
},
|
|
466
|
+
"query": { "verbose": "$input.verbose" }
|
|
467
|
+
},
|
|
468
|
+
"set_status": {
|
|
469
|
+
"method": "POST",
|
|
470
|
+
"path": "/status/{service}",
|
|
471
|
+
"jsonBody": { "state": "$input.state", "note": "$input.note" }
|
|
472
|
+
}
|
|
473
|
+
}
|
|
474
|
+
}
|
|
475
|
+
```
|
|
476
|
+
|
|
477
|
+
HTTP API actions support `GET`, `POST`, `PUT`, `PATCH`, and `DELETE`. `baseUrl` must be HTTPS
|
|
478
|
+
except loopback URLs, must not include credentials, query, or fragment, and action `path` values
|
|
479
|
+
must start with `/` and be URL paths that cannot change origin or escape the base URL path.
|
|
480
|
+
|
|
481
|
+
Action mappings can set `query`, `headers`, and `jsonBody`. `query` and `headers` must resolve
|
|
482
|
+
to object maps whose values are strings, numbers, or booleans. `jsonBody` may use literals,
|
|
483
|
+
nested arrays/objects, `$input.field` references, or `$input` for the whole argument object.
|
|
484
|
+
Path placeholders such as `{service}` are read directly from `call_tool.arguments` and URL-encoded.
|
|
485
|
+
Configured action headers cannot set managed headers such as `authorization`, `host`,
|
|
486
|
+
`content-length`, `connection`, or `content-type`; JSON bodies set `content-type` automatically.
|
|
487
|
+
|
|
488
|
+
HTTP API auth supports `none`, `bearer`, `headers`, `oauth2`, and `oidc`, matching OpenAPI and
|
|
489
|
+
GraphQL. Responses are returned as structured content with `status`, `statusText`, safe headers,
|
|
490
|
+
parsed `body` when present, and `elapsedMs`; non-2xx responses set `isError`, redirects are rejected,
|
|
491
|
+
timeouts are enforced, response bodies are capped by `maxResponseBytes` (default `1000000`), and
|
|
492
|
+
errors redact secrets.
|
|
493
|
+
|
|
394
494
|
### Authentication
|
|
395
495
|
|
|
396
496
|
Remote servers can use:
|
|
@@ -401,7 +501,7 @@ Remote servers can use:
|
|
|
401
501
|
- `{"type": "oauth2", ...}`
|
|
402
502
|
- `{"type": "oidc", ...}`
|
|
403
503
|
|
|
404
|
-
For OAuth/OIDC-backed MCP, OpenAPI, and
|
|
504
|
+
For OAuth/OIDC-backed MCP, OpenAPI, GraphQL, and HTTP API Caplets, authenticate once with:
|
|
405
505
|
|
|
406
506
|
```sh
|
|
407
507
|
caplets auth login <server>
|
|
@@ -413,10 +513,11 @@ For headless terminals:
|
|
|
413
513
|
caplets auth login <server> --no-open
|
|
414
514
|
```
|
|
415
515
|
|
|
416
|
-
OAuth/OIDC tokens are stored under
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
516
|
+
OAuth/OIDC tokens are stored under `${XDG_STATE_HOME:-~/.local/state}/caplets/auth/<server>.json`
|
|
517
|
+
on Unix-like platforms and `%LOCALAPPDATA%\caplets\auth\<server>.json` on Windows.
|
|
518
|
+
Token files use owner-only file permissions where the platform supports them. Caplets supports
|
|
519
|
+
well-known OAuth/OIDC discovery and dynamic client registration when advertised. When a token expires,
|
|
520
|
+
run `caplets auth login <server>` again.
|
|
420
521
|
|
|
421
522
|
To inspect or remove stored OAuth credentials:
|
|
422
523
|
|