caplets 0.7.0 → 0.8.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 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, and native GraphQL 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, and native GraphQL endpoint definitions from `~/.caplets/config.json`.
32
- - Registers one generated MCP tool for each enabled MCP server, OpenAPI endpoint, or GraphQL endpoint.
31
+ - Reads downstream MCP server definitions, native OpenAPI endpoint definitions, native GraphQL endpoint definitions, and explicit HTTP API action definitions from `~/.caplets/config.json`.
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.
@@ -118,6 +119,26 @@ 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
  ```
@@ -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`, or
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`.
@@ -255,8 +302,8 @@ caplets init --force
255
302
 
256
303
  ### Caplet IDs
257
304
 
258
- Each key under `mcpServers` or `openapiEndpoints` is the stable Caplet ID. It becomes the
259
- generated MCP tool name exactly, so keep it short and specific:
305
+ Each key under `mcpServers`, `openapiEndpoints`, `graphqlEndpoints`, or `httpApis` is the
306
+ stable Caplet ID. It becomes the generated MCP tool name exactly, so keep it short and specific:
260
307
 
261
308
  ```json
262
309
  {
@@ -272,7 +319,7 @@ generated MCP tool name exactly, so keep it short and specific:
272
319
  ```
273
320
 
274
321
  Caplet IDs must match `^[a-zA-Z0-9_-]{1,64}$` and must be unique across `mcpServers`,
275
- `openapiEndpoints`, and `graphqlEndpoints`. Spaces, dots, slashes, colons, and Unicode IDs are rejected.
322
+ `openapiEndpoints`, `graphqlEndpoints`, and `httpApis`. Spaces, dots, slashes, colons, and Unicode IDs are rejected.
276
323
 
277
324
  ### Stdio Servers
278
325
 
@@ -391,6 +438,57 @@ Every GraphQL endpoint can set:
391
438
  - `selectionDepth`: maximum depth for generated selection sets. Defaults to `2`; maximum `5`.
392
439
  - `disabled`: omit the endpoint from Caplets discovery. Defaults to `false`.
393
440
 
441
+ ### HTTP APIs
442
+
443
+ Use `httpApis` for simple HTTP APIs that do not have an OpenAPI spec. Each action is an
444
+ explicitly configured tool; Caplets does not discover routes, import curl commands, or execute
445
+ shell snippets.
446
+
447
+ ```json
448
+ {
449
+ "name": "Status API",
450
+ "description": "Read and update deployment status through HTTP actions.",
451
+ "baseUrl": "https://api.example.com",
452
+ "auth": { "type": "bearer", "token": "$env:STATUS_API_TOKEN" },
453
+ "maxResponseBytes": 1000000,
454
+ "actions": {
455
+ "get_status": {
456
+ "method": "GET",
457
+ "path": "/status/{service}",
458
+ "description": "Fetch status for one service.",
459
+ "inputSchema": {
460
+ "type": "object",
461
+ "properties": { "service": { "type": "string" }, "verbose": { "type": "boolean" } },
462
+ "required": ["service"]
463
+ },
464
+ "query": { "verbose": "$input.verbose" }
465
+ },
466
+ "set_status": {
467
+ "method": "POST",
468
+ "path": "/status/{service}",
469
+ "jsonBody": { "state": "$input.state", "note": "$input.note" }
470
+ }
471
+ }
472
+ }
473
+ ```
474
+
475
+ HTTP API actions support `GET`, `POST`, `PUT`, `PATCH`, and `DELETE`. `baseUrl` must be HTTPS
476
+ except loopback URLs, must not include credentials, query, or fragment, and action `path` values
477
+ must start with `/` and be URL paths that cannot change origin or escape the base URL path.
478
+
479
+ Action mappings can set `query`, `headers`, and `jsonBody`. `query` and `headers` must resolve
480
+ to object maps whose values are strings, numbers, or booleans. `jsonBody` may use literals,
481
+ nested arrays/objects, `$input.field` references, or `$input` for the whole argument object.
482
+ Path placeholders such as `{service}` are read directly from `call_tool.arguments` and URL-encoded.
483
+ Configured action headers cannot set managed headers such as `authorization`, `host`,
484
+ `content-length`, `connection`, or `content-type`; JSON bodies set `content-type` automatically.
485
+
486
+ HTTP API auth supports `none`, `bearer`, `headers`, `oauth2`, and `oidc`, matching OpenAPI and
487
+ GraphQL. Responses are returned as structured content with `status`, `statusText`, safe headers,
488
+ parsed `body` when present, and `elapsedMs`; non-2xx responses set `isError`, redirects are rejected,
489
+ timeouts are enforced, response bodies are capped by `maxResponseBytes` (default `1000000`), and
490
+ errors redact secrets.
491
+
394
492
  ### Authentication
395
493
 
396
494
  Remote servers can use:
@@ -401,7 +499,7 @@ Remote servers can use:
401
499
  - `{"type": "oauth2", ...}`
402
500
  - `{"type": "oidc", ...}`
403
501
 
404
- For OAuth/OIDC-backed MCP, OpenAPI, and GraphQL Caplets, authenticate once with:
502
+ For OAuth/OIDC-backed MCP, OpenAPI, GraphQL, and HTTP API Caplets, authenticate once with:
405
503
 
406
504
  ```sh
407
505
  caplets auth login <server>