caplets 0.3.0 → 0.4.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 +98 -20
- package/dist/index.js +10446 -337
- package/package.json +2 -1
- package/schemas/caplet.schema.json +93 -2
- package/schemas/caplets-config.schema.json +120 -0
package/README.md
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
# Caplets
|
|
2
2
|
|
|
3
|
-
Caplets is a progressive-disclosure gateway for Model Context Protocol (MCP) servers
|
|
3
|
+
Caplets is a progressive-disclosure gateway for Model Context Protocol (MCP) servers and
|
|
4
|
+
native OpenAPI endpoints.
|
|
4
5
|
|
|
5
|
-
Instead of connecting an MCP client to many downstream servers
|
|
6
|
-
front, Caplets exposes one top-level tool per configured
|
|
7
|
-
capability domain, then asks Caplets to list, search, inspect,
|
|
8
|
-
underlying tools.
|
|
6
|
+
Instead of connecting an MCP client to many downstream servers or HTTP APIs and exposing
|
|
7
|
+
every operation up front, Caplets exposes one top-level tool per configured capability.
|
|
8
|
+
An agent first chooses a capability domain, then asks Caplets to list, search, inspect,
|
|
9
|
+
or call that backend's underlying tools or operations.
|
|
9
10
|
|
|
10
11
|
This keeps the initial MCP tool list small, makes tool selection easier, and avoids
|
|
11
12
|
flattened tool-name collisions across servers.
|
|
@@ -27,13 +28,14 @@ the agent chooses that server and asks to search, list, inspect, or call them.
|
|
|
27
28
|
|
|
28
29
|
## What It Does
|
|
29
30
|
|
|
30
|
-
- Reads downstream MCP server definitions from `~/.caplets/config.json`.
|
|
31
|
-
- Registers one generated MCP tool for each enabled server.
|
|
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.
|
|
32
33
|
- Uses the configured server ID as the generated tool name.
|
|
33
34
|
- Uses the configured `name` and `description` as the capability card shown to agents.
|
|
34
|
-
- Starts downstream servers lazily when an operation needs them.
|
|
35
|
+
- Starts downstream MCP servers and loads OpenAPI specs lazily when an operation needs them.
|
|
35
36
|
- Supports stdio, Streamable HTTP, and legacy HTTP+SSE downstream servers.
|
|
36
|
-
- Lets agents `list_tools`, `search_tools`, `get_tool`, and `call_tool` within one selected
|
|
37
|
+
- Lets agents `list_tools`, `search_tools`, `get_tool`, and `call_tool` within one selected Caplet namespace.
|
|
38
|
+
- Converts OpenAPI operations into MCP-style tool metadata and executes HTTP calls directly.
|
|
37
39
|
- Preserves downstream tool results instead of rewriting them into a custom format.
|
|
38
40
|
- Redacts secrets from structured errors.
|
|
39
41
|
- Supports static remote auth and OAuth token storage for remote servers.
|
|
@@ -91,6 +93,18 @@ you want Caplets to expose:
|
|
|
91
93
|
"token": "$env:DOCS_MCP_TOKEN"
|
|
92
94
|
}
|
|
93
95
|
}
|
|
96
|
+
},
|
|
97
|
+
"openapiEndpoints": {
|
|
98
|
+
"users": {
|
|
99
|
+
"name": "Users API",
|
|
100
|
+
"description": "Manage users through the internal HTTP API.",
|
|
101
|
+
"specPath": "./openapi.json",
|
|
102
|
+
"baseUrl": "https://api.example.com",
|
|
103
|
+
"auth": {
|
|
104
|
+
"type": "bearer",
|
|
105
|
+
"token": "$env:USERS_API_TOKEN"
|
|
106
|
+
}
|
|
107
|
+
}
|
|
94
108
|
}
|
|
95
109
|
}
|
|
96
110
|
```
|
|
@@ -112,8 +126,8 @@ the committed schema stays in sync with the Zod config validator.
|
|
|
112
126
|
### Caplet Files
|
|
113
127
|
|
|
114
128
|
For richer skill-like cards, add Markdown Caplet files beside `config.json`. Every Caplet
|
|
115
|
-
file must include
|
|
116
|
-
scope.
|
|
129
|
+
file must include exactly one executable backend: `mcpServer` or `openapiEndpoint`;
|
|
130
|
+
serverless Caplets are intentionally out of scope.
|
|
117
131
|
|
|
118
132
|
Top-level files derive the Caplet ID from the filename:
|
|
119
133
|
|
|
@@ -135,6 +149,23 @@ mcpServer:
|
|
|
135
149
|
Use this Caplet for repository, issue, pull request, and code review workflows.
|
|
136
150
|
```
|
|
137
151
|
|
|
152
|
+
OpenAPI-backed Caplet files use `openapiEndpoint`:
|
|
153
|
+
|
|
154
|
+
```md
|
|
155
|
+
---
|
|
156
|
+
name: Users API
|
|
157
|
+
description: Manage users through the internal HTTP API.
|
|
158
|
+
openapiEndpoint:
|
|
159
|
+
specPath: ./openapi.json
|
|
160
|
+
baseUrl: https://api.example.com
|
|
161
|
+
auth:
|
|
162
|
+
type: bearer
|
|
163
|
+
token: $env:USERS_API_TOKEN
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
# Users API
|
|
167
|
+
```
|
|
168
|
+
|
|
138
169
|
That file is exposed as the `github` Caplet. Directory-style Caplets use
|
|
139
170
|
`linear/CAPLET.md`, which is exposed as `linear`; sibling files can be referenced with
|
|
140
171
|
normal Markdown links from `CAPLET.md`.
|
|
@@ -156,10 +187,10 @@ project `config.json`, and, only when trusted, project Caplet files.
|
|
|
156
187
|
caplets init --force
|
|
157
188
|
```
|
|
158
189
|
|
|
159
|
-
###
|
|
190
|
+
### Caplet IDs
|
|
160
191
|
|
|
161
|
-
Each key under `mcpServers` is the stable
|
|
162
|
-
name exactly, so keep it short and specific:
|
|
192
|
+
Each key under `mcpServers` or `openapiEndpoints` is the stable Caplet ID. It becomes the
|
|
193
|
+
generated MCP tool name exactly, so keep it short and specific:
|
|
163
194
|
|
|
164
195
|
```json
|
|
165
196
|
{
|
|
@@ -174,8 +205,8 @@ name exactly, so keep it short and specific:
|
|
|
174
205
|
}
|
|
175
206
|
```
|
|
176
207
|
|
|
177
|
-
|
|
178
|
-
Unicode IDs are rejected.
|
|
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.
|
|
179
210
|
|
|
180
211
|
### Stdio Servers
|
|
181
212
|
|
|
@@ -216,6 +247,51 @@ Use `transport` and `url` for remote MCP servers.
|
|
|
216
247
|
`transport` can be `http` for MCP Streamable HTTP or `sse` for legacy HTTP+SSE. Remote
|
|
217
248
|
URLs must use `https://`, except loopback development URLs such as `http://localhost`.
|
|
218
249
|
|
|
250
|
+
### OpenAPI Endpoints
|
|
251
|
+
|
|
252
|
+
Use `openapiEndpoints` for native HTTP APIs described by OpenAPI 3 specs. Each entry
|
|
253
|
+
points at one spec through either `specPath` or `specUrl`, and may override the request
|
|
254
|
+
base URL with `baseUrl`.
|
|
255
|
+
|
|
256
|
+
```json
|
|
257
|
+
{
|
|
258
|
+
"name": "Users API",
|
|
259
|
+
"description": "Manage users through the internal HTTP API.",
|
|
260
|
+
"specPath": "./openapi.json",
|
|
261
|
+
"baseUrl": "https://api.example.com",
|
|
262
|
+
"auth": { "type": "none" }
|
|
263
|
+
}
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
OpenAPI auth is explicit and supports:
|
|
267
|
+
|
|
268
|
+
- `{"type": "none"}`
|
|
269
|
+
- `{"type": "bearer", "token": "$env:TOKEN"}`
|
|
270
|
+
- `{"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`.
|
|
274
|
+
|
|
275
|
+
OpenAPI `call_tool.arguments` uses grouped HTTP inputs:
|
|
276
|
+
|
|
277
|
+
```json
|
|
278
|
+
{
|
|
279
|
+
"operation": "call_tool",
|
|
280
|
+
"tool": "GET /users/{id}",
|
|
281
|
+
"arguments": {
|
|
282
|
+
"path": { "id": "42" },
|
|
283
|
+
"query": { "active": true },
|
|
284
|
+
"body": { "name": "Ada" }
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
```
|
|
288
|
+
|
|
289
|
+
Every OpenAPI endpoint can set:
|
|
290
|
+
|
|
291
|
+
- `requestTimeoutMs`: timeout for HTTP calls. Defaults to `60000`.
|
|
292
|
+
- `operationCacheTtlMs`: how long OpenAPI operation metadata stays fresh. Defaults to `30000`; `0` refreshes every time.
|
|
293
|
+
- `disabled`: omit the endpoint from Caplets discovery. Defaults to `false`.
|
|
294
|
+
|
|
219
295
|
### Authentication
|
|
220
296
|
|
|
221
297
|
Remote servers can use:
|
|
@@ -277,8 +353,9 @@ starts the MCP server. `serve` is explicit and recommended for clarity.
|
|
|
277
353
|
|
|
278
354
|
## How Agents Use It
|
|
279
355
|
|
|
280
|
-
Caplets initially exposes one MCP tool per enabled Caplet. If the config has `filesystem
|
|
281
|
-
and `
|
|
356
|
+
Caplets initially exposes one MCP tool per enabled Caplet. If the config has `filesystem`,
|
|
357
|
+
`docs`, and `users`, the client sees three top-level tools: `filesystem`, `docs`, and
|
|
358
|
+
`users`.
|
|
282
359
|
|
|
283
360
|
Each generated Caplet tool accepts an `operation`:
|
|
284
361
|
|
|
@@ -322,9 +399,10 @@ Call one exact downstream tool:
|
|
|
322
399
|
Available operations:
|
|
323
400
|
|
|
324
401
|
- `get_caplet`: return the configured capability card without starting the downstream server.
|
|
325
|
-
- `
|
|
402
|
+
- `check_backend`: verify the selected backend, whether MCP or OpenAPI.
|
|
403
|
+
- `check_mcp_server`: start or connect to an MCP server and verify its tool list.
|
|
326
404
|
- `list_tools`: return compact downstream tool metadata.
|
|
327
|
-
- `search_tools`: search downstream tool names and descriptions within this
|
|
405
|
+
- `search_tools`: search downstream tool names and descriptions within this Caplet.
|
|
328
406
|
- `get_tool`: return full metadata for one exact downstream tool.
|
|
329
407
|
- `call_tool`: invoke one exact downstream tool with JSON object arguments.
|
|
330
408
|
|