caplets 0.4.0 → 0.5.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
- Caplets is a progressive-disclosure gateway for Model Context Protocol (MCP) servers and
4
- native OpenAPI endpoints.
3
+ Caplets is a progressive-disclosure gateway for Model Context Protocol (MCP) servers,
4
+ native OpenAPI endpoints, and native GraphQL endpoints.
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,14 +28,15 @@ 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 and native OpenAPI endpoint definitions from `~/.caplets/config.json`.
32
- - Registers one generated MCP tool for each enabled MCP server or OpenAPI endpoint.
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.
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.
36
36
  - Supports stdio, Streamable HTTP, and legacy HTTP+SSE downstream servers.
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
+ - Converts configured GraphQL operations into MCP-style tool metadata, and can auto-generate GraphQL tools from schema root query and mutation fields.
39
40
  - Preserves downstream tool results instead of rewriting them into a custom format.
40
41
  - Redacts secrets from structured errors.
41
42
  - Supports static remote auth and OAuth token storage for remote servers.
@@ -105,6 +106,18 @@ you want Caplets to expose:
105
106
  "token": "$env:USERS_API_TOKEN"
106
107
  }
107
108
  }
109
+ },
110
+ "graphqlEndpoints": {
111
+ "catalog": {
112
+ "name": "Catalog GraphQL",
113
+ "description": "Query and update catalog records through GraphQL.",
114
+ "endpointUrl": "https://api.example.com/graphql",
115
+ "introspection": true,
116
+ "auth": {
117
+ "type": "oidc",
118
+ "issuer": "https://login.example.com"
119
+ }
120
+ }
108
121
  }
109
122
  }
110
123
  ```
@@ -126,7 +139,8 @@ the committed schema stays in sync with the Zod config validator.
126
139
  ### Caplet Files
127
140
 
128
141
  For richer skill-like cards, add Markdown Caplet files beside `config.json`. Every Caplet
129
- file must include exactly one executable backend: `mcpServer` or `openapiEndpoint`;
142
+ file must include exactly one executable backend: `mcpServer`, `openapiEndpoint`, or
143
+ `graphqlEndpoint`;
130
144
  serverless Caplets are intentionally out of scope.
131
145
 
132
146
  Top-level files derive the Caplet ID from the filename:
@@ -166,7 +180,24 @@ openapiEndpoint:
166
180
  # Users API
167
181
  ```
168
182
 
169
- That file is exposed as the `github` Caplet. Directory-style Caplets use
183
+ GraphQL-backed Caplet files use `graphqlEndpoint`:
184
+
185
+ ```md
186
+ ---
187
+ name: Catalog GraphQL
188
+ description: Query and update catalog records through GraphQL.
189
+ graphqlEndpoint:
190
+ endpointUrl: https://api.example.com/graphql
191
+ schemaPath: ./schema.graphql
192
+ auth:
193
+ type: oidc
194
+ issuer: https://login.example.com
195
+ ---
196
+
197
+ # Catalog GraphQL
198
+ ```
199
+
200
+ Top-level files derive their Caplet ID from the filename. Directory-style Caplets use
170
201
  `linear/CAPLET.md`, which is exposed as `linear`; sibling files can be referenced with
171
202
  normal Markdown links from `CAPLET.md`.
172
203
 
@@ -205,8 +236,8 @@ generated MCP tool name exactly, so keep it short and specific:
205
236
  }
206
237
  ```
207
238
 
208
- Caplet IDs must match `^[a-zA-Z0-9_-]{1,64}$` and must be unique across `mcpServers` and
209
- `openapiEndpoints`. Spaces, dots, slashes, colons, and Unicode IDs are rejected.
239
+ Caplet IDs must match `^[a-zA-Z0-9_-]{1,64}$` and must be unique across `mcpServers`,
240
+ `openapiEndpoints`, and `graphqlEndpoints`. Spaces, dots, slashes, colons, and Unicode IDs are rejected.
210
241
 
211
242
  ### Stdio Servers
212
243
 
@@ -268,9 +299,8 @@ OpenAPI auth is explicit and supports:
268
299
  - `{"type": "none"}`
269
300
  - `{"type": "bearer", "token": "$env:TOKEN"}`
270
301
  - `{"type": "headers", "headers": {"x-api-key": "$env:API_KEY"}}`
271
-
272
- OpenAPI OAuth is not part of the first native OpenAPI backend. OAuth remains available
273
- for remote MCP servers through `caplets auth`.
302
+ - `{"type": "oauth2", ...}`
303
+ - `{"type": "oidc", ...}`
274
304
 
275
305
  OpenAPI `call_tool.arguments` uses grouped HTTP inputs:
276
306
 
@@ -292,6 +322,40 @@ Every OpenAPI endpoint can set:
292
322
  - `operationCacheTtlMs`: how long OpenAPI operation metadata stays fresh. Defaults to `30000`; `0` refreshes every time.
293
323
  - `disabled`: omit the endpoint from Caplets discovery. Defaults to `false`.
294
324
 
325
+ ### GraphQL Endpoints
326
+
327
+ Use `graphqlEndpoints` for native GraphQL APIs. Each entry points at a GraphQL HTTP
328
+ endpoint and exactly one schema source: `schemaPath`, `schemaUrl`, or `introspection: true`.
329
+
330
+ ```json
331
+ {
332
+ "name": "Catalog GraphQL",
333
+ "description": "Query and update catalog records through GraphQL.",
334
+ "endpointUrl": "https://api.example.com/graphql",
335
+ "schemaPath": "./schema.graphql",
336
+ "auth": { "type": "oidc", "issuer": "https://login.example.com" },
337
+ "operations": {
338
+ "product": {
339
+ "document": "query Product($id: ID!) { product(id: $id) { id name } }",
340
+ "operationName": "Product",
341
+ "description": "Fetch a product by ID."
342
+ }
343
+ }
344
+ }
345
+ ```
346
+
347
+ When `operations` is omitted or empty, Caplets auto-generates tools from schema root
348
+ fields: `query_<field>` and `mutation_<field>`. Generated tools use bounded scalar
349
+ selection sets and pass `call_tool.arguments` directly as GraphQL variables/root-field
350
+ arguments.
351
+
352
+ Every GraphQL endpoint can set:
353
+
354
+ - `requestTimeoutMs`: timeout for HTTP calls. Defaults to `60000`.
355
+ - `operationCacheTtlMs`: how long GraphQL operation metadata stays fresh. Defaults to `30000`; `0` refreshes every time.
356
+ - `selectionDepth`: maximum depth for generated selection sets. Defaults to `2`; maximum `5`.
357
+ - `disabled`: omit the endpoint from Caplets discovery. Defaults to `false`.
358
+
295
359
  ### Authentication
296
360
 
297
361
  Remote servers can use:
@@ -300,8 +364,9 @@ Remote servers can use:
300
364
  - `{"type": "bearer", "token": "$env:TOKEN"}`
301
365
  - `{"type": "headers", "headers": {"x-api-key": "$env:API_KEY"}}`
302
366
  - `{"type": "oauth2", ...}`
367
+ - `{"type": "oidc", ...}`
303
368
 
304
- For OAuth-backed remote servers, authenticate once with:
369
+ For OAuth/OIDC-backed MCP, OpenAPI, and GraphQL Caplets, authenticate once with:
305
370
 
306
371
  ```sh
307
372
  caplets auth login <server>
@@ -313,8 +378,9 @@ For headless terminals:
313
378
  caplets auth login <server> --no-open
314
379
  ```
315
380
 
316
- OAuth tokens are stored under `~/.caplets/auth/<server>.json` with owner-only file
317
- permissions where the platform supports them. When an OAuth token expires, run
381
+ OAuth/OIDC tokens are stored under `~/.caplets/auth/<server>.json` with owner-only file
382
+ permissions where the platform supports them. Caplets supports well-known OAuth/OIDC
383
+ discovery and dynamic client registration when advertised. When a token expires, run
318
384
  `caplets auth login <server>` again.
319
385
 
320
386
  To inspect or remove stored OAuth credentials:
@@ -399,7 +465,7 @@ Call one exact downstream tool:
399
465
  Available operations:
400
466
 
401
467
  - `get_caplet`: return the configured capability card without starting the downstream server.
402
- - `check_backend`: verify the selected backend, whether MCP or OpenAPI.
468
+ - `check_backend`: verify the selected backend, whether MCP, OpenAPI, or GraphQL.
403
469
  - `check_mcp_server`: start or connect to an MCP server and verify its tool list.
404
470
  - `list_tools`: return compact downstream tool metadata.
405
471
  - `search_tools`: search downstream tool names and descriptions within this Caplet.