caplets 0.6.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
  ```
@@ -138,8 +159,10 @@ caplets config paths
138
159
  caplets config paths --json
139
160
  ```
140
161
 
141
- Caplets validates this file at startup. Config changes take effect after restarting the
142
- Caplets MCP server.
162
+ Caplets validates this file at startup and hot reloads config changes while `caplets serve`
163
+ is running. Invalid edits are ignored until fixed, so the MCP server keeps serving the last
164
+ known-good config instead of dropping every tool because of a transient JSON or validation
165
+ error.
143
166
 
144
167
  The optional `$schema` field points editors at the generated JSON Schema in
145
168
  [`schemas/caplets-config.schema.json`](schemas/caplets-config.schema.json). CI verifies that
@@ -148,8 +171,8 @@ the committed schema stays in sync with the Zod config validator.
148
171
  ### Caplet Files
149
172
 
150
173
  For richer skill-like cards, add Markdown Caplet files beside `config.json`. Every Caplet
151
- file must include exactly one executable backend: `mcpServer`, `openapiEndpoint`, or
152
- `graphqlEndpoint`;
174
+ file must include exactly one executable backend: `mcpServer`, `openapiEndpoint`,
175
+ `graphqlEndpoint`, or `httpApi`;
153
176
  serverless Caplets are intentionally out of scope.
154
177
 
155
178
  Top-level files derive the Caplet ID from the filename:
@@ -206,6 +229,32 @@ graphqlEndpoint:
206
229
  # Catalog GraphQL
207
230
  ```
208
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
+
209
258
  Top-level files derive their Caplet ID from the filename. Directory-style Caplets use
210
259
  `linear/CAPLET.md`, which is exposed as `linear`; sibling files can be referenced with
211
260
  normal Markdown links from `CAPLET.md`.
@@ -253,8 +302,8 @@ caplets init --force
253
302
 
254
303
  ### Caplet IDs
255
304
 
256
- Each key under `mcpServers` or `openapiEndpoints` is the stable Caplet ID. It becomes the
257
- 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:
258
307
 
259
308
  ```json
260
309
  {
@@ -270,7 +319,7 @@ generated MCP tool name exactly, so keep it short and specific:
270
319
  ```
271
320
 
272
321
  Caplet IDs must match `^[a-zA-Z0-9_-]{1,64}$` and must be unique across `mcpServers`,
273
- `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.
274
323
 
275
324
  ### Stdio Servers
276
325
 
@@ -389,6 +438,57 @@ Every GraphQL endpoint can set:
389
438
  - `selectionDepth`: maximum depth for generated selection sets. Defaults to `2`; maximum `5`.
390
439
  - `disabled`: omit the endpoint from Caplets discovery. Defaults to `false`.
391
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
+
392
492
  ### Authentication
393
493
 
394
494
  Remote servers can use:
@@ -399,7 +499,7 @@ Remote servers can use:
399
499
  - `{"type": "oauth2", ...}`
400
500
  - `{"type": "oidc", ...}`
401
501
 
402
- 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:
403
503
 
404
504
  ```sh
405
505
  caplets auth login <server>
@@ -458,6 +558,12 @@ Configure your MCP client to run Caplets as a stdio server:
458
558
  If your client starts the configured command directly, `caplets` without arguments also
459
559
  starts the MCP server. `serve` is explicit and recommended for clarity.
460
560
 
561
+ `caplets serve` watches the effective user config, project config, user Caplet files, and
562
+ trusted project Caplet files. Adding, editing, disabling, or removing a Caplet updates the
563
+ top-level MCP tool list without restarting Caplets. When an MCP-backed Caplet changes or is
564
+ removed, Caplets closes only that affected downstream connection; unrelated Caplets and
565
+ their downstream connections keep running.
566
+
461
567
  ## How Agents Use It
462
568
 
463
569
  Caplets initially exposes one MCP tool per enabled Caplet. If the config has `filesystem`,
@@ -536,9 +642,10 @@ pnpm schema:check
536
642
  pnpm verify
537
643
  ```
538
644
 
539
- `pnpm dev` rebuilds on source changes and restarts the local stdio MCP server from
645
+ `pnpm dev` rebuilds Caplets source changes and restarts the local stdio MCP server from
540
646
  `dist/index.js`. Use it for local development, not as the command configured in an MCP
541
- client, because build logs are written to stdout.
647
+ client, because build logs are written to stdout. Runtime config hot reload is built into
648
+ normal `caplets serve` and does not require `pnpm dev`.
542
649
 
543
650
  ## Product Notes
544
651