@acid-cat/cli 0.16.0 → 0.18.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 +23 -20
- package/conformance/fixture.acidcat.json +8 -6
- package/conformance/server-card.LICENSE +201 -0
- package/conformance/server-card.schema.json +295 -0
- package/dist/catalog.d.ts +2 -2
- package/dist/catalog.js +5 -4
- package/dist/conform/check.d.ts +4 -4
- package/dist/conform/check.js +10 -10
- package/dist/conform/cli.js +5 -5
- package/dist/conform/http.js +5 -5
- package/dist/conform/index.d.ts +4 -4
- package/dist/conform/index.js +1 -1
- package/dist/conform/mcp-stdio.js +1 -1
- package/dist/conform/mcp.d.ts +1 -0
- package/dist/conform/mcp.js +196 -16
- package/dist/conform/poll.js +1 -1
- package/dist/conform/properties.d.ts +1 -1
- package/dist/conform/properties.js +2 -2
- package/dist/conform/server-card.d.ts +5 -0
- package/dist/conform/server-card.js +142 -0
- package/dist/conform/webhook.d.ts +2 -1
- package/dist/conform/webhook.js +25 -6
- package/dist/conform/webmcp.js +5 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -2
- package/dist/json/catalog.schema.json.js +5 -5
- package/dist/json/fixture.acidcat.json.js +12 -6
- package/dist/json/package.json.js +1 -1
- package/dist/json/server-card.schema.json.js +281 -0
- package/dist/main.js +10 -10
- package/package.json +7 -5
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$defs": {
|
|
4
|
+
"Icon": {
|
|
5
|
+
"description": "An optionally-sized icon that can be displayed in a user interface.",
|
|
6
|
+
"properties": {
|
|
7
|
+
"mimeType": {
|
|
8
|
+
"description": "Optional MIME type override if the source MIME type is missing or generic.\nFor example: `\"image/png\"`, `\"image/jpeg\"`, or `\"image/svg+xml\"`.",
|
|
9
|
+
"type": "string"
|
|
10
|
+
},
|
|
11
|
+
"sizes": {
|
|
12
|
+
"description": "Optional array of strings that specify sizes at which the icon can be used.\nEach string should be in WxH format (e.g., `\"48x48\"`, `\"96x96\"`) or `\"any\"` for scalable formats like SVG.\n\nIf not provided, the client should assume that the icon can be used at any size.",
|
|
13
|
+
"items": {
|
|
14
|
+
"type": "string"
|
|
15
|
+
},
|
|
16
|
+
"type": "array"
|
|
17
|
+
},
|
|
18
|
+
"src": {
|
|
19
|
+
"description": "A standard URI pointing to an icon resource. May be an HTTP/HTTPS URL or a\n`data:` URI with Base64-encoded image data.\n\nConsumers SHOULD take steps to ensure URLs serving icons are from the\nsame domain as the client/server or a trusted domain.\n\nConsumers SHOULD take appropriate precautions when consuming SVGs as they can contain\nexecutable JavaScript.",
|
|
20
|
+
"format": "uri",
|
|
21
|
+
"type": "string"
|
|
22
|
+
},
|
|
23
|
+
"theme": {
|
|
24
|
+
"description": "Optional specifier for the theme this icon is designed for. `\"light\"` indicates\nthe icon is designed to be used with a light background, and `\"dark\"` indicates\nthe icon is designed to be used with a dark background.\n\nIf not provided, the client should assume the icon can be used with any theme.",
|
|
25
|
+
"enum": ["dark", "light"],
|
|
26
|
+
"type": "string"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"required": ["src"],
|
|
30
|
+
"type": "object"
|
|
31
|
+
},
|
|
32
|
+
"Input": {
|
|
33
|
+
"description": "A user-supplied or pre-set input value, used for {@link Remote} URL\nvariables and header values.",
|
|
34
|
+
"properties": {
|
|
35
|
+
"choices": {
|
|
36
|
+
"description": "Allowed values for the input. If provided, the user must select one.",
|
|
37
|
+
"items": {
|
|
38
|
+
"type": "string"
|
|
39
|
+
},
|
|
40
|
+
"type": "array"
|
|
41
|
+
},
|
|
42
|
+
"default": {
|
|
43
|
+
"description": "Default value for the input. SHOULD be a valid value for the input.",
|
|
44
|
+
"type": "string"
|
|
45
|
+
},
|
|
46
|
+
"description": {
|
|
47
|
+
"description": "Human-readable explanation of the input. Clients can use this to provide\ncontext to the user.",
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
50
|
+
"format": {
|
|
51
|
+
"description": "Specifies the input format. `\"filepath\"` should be interpreted as a file\non the user's filesystem. When the input is converted to a string,\nbooleans should be represented by `\"true\"`/`\"false\"`, and numbers by\ndecimal values.",
|
|
52
|
+
"enum": ["boolean", "filepath", "number", "string"],
|
|
53
|
+
"type": "string"
|
|
54
|
+
},
|
|
55
|
+
"isRequired": {
|
|
56
|
+
"description": "Whether the input must be supplied for the connection to succeed.",
|
|
57
|
+
"type": "boolean"
|
|
58
|
+
},
|
|
59
|
+
"isSecret": {
|
|
60
|
+
"description": "Whether the input is a secret value (e.g., password, token). If true,\nclients should handle the value securely.",
|
|
61
|
+
"type": "boolean"
|
|
62
|
+
},
|
|
63
|
+
"placeholder": {
|
|
64
|
+
"description": "Placeholder displayed during configuration to provide examples or\nguidance about the expected form of the input.",
|
|
65
|
+
"type": "string"
|
|
66
|
+
},
|
|
67
|
+
"value": {
|
|
68
|
+
"description": "Pre-set value for the input. If set, the value should not be configurable\nby end users. Identifiers wrapped in `{curly_braces}` will be replaced\nwith the corresponding entries from the input's `variables` map (if any).",
|
|
69
|
+
"type": "string"
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
"type": "object"
|
|
73
|
+
},
|
|
74
|
+
"JSONArray": {
|
|
75
|
+
"items": {
|
|
76
|
+
"$ref": "#/$defs/JSONValue"
|
|
77
|
+
},
|
|
78
|
+
"type": "array"
|
|
79
|
+
},
|
|
80
|
+
"JSONObject": {
|
|
81
|
+
"additionalProperties": {
|
|
82
|
+
"$ref": "#/$defs/JSONValue"
|
|
83
|
+
},
|
|
84
|
+
"type": "object"
|
|
85
|
+
},
|
|
86
|
+
"JSONValue": {
|
|
87
|
+
"anyOf": [
|
|
88
|
+
{
|
|
89
|
+
"$ref": "#/$defs/JSONObject"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"items": {
|
|
93
|
+
"$ref": "#/$defs/JSONValue"
|
|
94
|
+
},
|
|
95
|
+
"type": "array"
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
"type": ["string", "integer", "boolean"]
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
},
|
|
102
|
+
"KeyValueInput": {
|
|
103
|
+
"description": "A named {@link Input} — used for HTTP headers — whose `value` may reference\nvariables for substitution.",
|
|
104
|
+
"properties": {
|
|
105
|
+
"choices": {
|
|
106
|
+
"description": "Allowed values for the input. If provided, the user must select one.",
|
|
107
|
+
"items": {
|
|
108
|
+
"type": "string"
|
|
109
|
+
},
|
|
110
|
+
"type": "array"
|
|
111
|
+
},
|
|
112
|
+
"default": {
|
|
113
|
+
"description": "Default value for the input. SHOULD be a valid value for the input.",
|
|
114
|
+
"type": "string"
|
|
115
|
+
},
|
|
116
|
+
"description": {
|
|
117
|
+
"description": "Human-readable explanation of the input. Clients can use this to provide\ncontext to the user.",
|
|
118
|
+
"type": "string"
|
|
119
|
+
},
|
|
120
|
+
"format": {
|
|
121
|
+
"description": "Specifies the input format. `\"filepath\"` should be interpreted as a file\non the user's filesystem. When the input is converted to a string,\nbooleans should be represented by `\"true\"`/`\"false\"`, and numbers by\ndecimal values.",
|
|
122
|
+
"enum": ["boolean", "filepath", "number", "string"],
|
|
123
|
+
"type": "string"
|
|
124
|
+
},
|
|
125
|
+
"isRequired": {
|
|
126
|
+
"description": "Whether the input must be supplied for the connection to succeed.",
|
|
127
|
+
"type": "boolean"
|
|
128
|
+
},
|
|
129
|
+
"isSecret": {
|
|
130
|
+
"description": "Whether the input is a secret value (e.g., password, token). If true,\nclients should handle the value securely.",
|
|
131
|
+
"type": "boolean"
|
|
132
|
+
},
|
|
133
|
+
"name": {
|
|
134
|
+
"description": "Name of the header.",
|
|
135
|
+
"type": "string"
|
|
136
|
+
},
|
|
137
|
+
"placeholder": {
|
|
138
|
+
"description": "Placeholder displayed during configuration to provide examples or\nguidance about the expected form of the input.",
|
|
139
|
+
"type": "string"
|
|
140
|
+
},
|
|
141
|
+
"value": {
|
|
142
|
+
"description": "Pre-set value for the input. If set, the value should not be configurable\nby end users. Identifiers wrapped in `{curly_braces}` will be replaced\nwith the corresponding entries from the input's `variables` map (if any).",
|
|
143
|
+
"type": "string"
|
|
144
|
+
},
|
|
145
|
+
"variables": {
|
|
146
|
+
"additionalProperties": {
|
|
147
|
+
"$ref": "#/$defs/Input"
|
|
148
|
+
},
|
|
149
|
+
"description": "Variables referenced by `{curly_braces}` identifiers in `value`. The map\nkey is the variable name; the value defines the variable's properties.",
|
|
150
|
+
"type": "object"
|
|
151
|
+
}
|
|
152
|
+
},
|
|
153
|
+
"required": ["name"],
|
|
154
|
+
"type": "object"
|
|
155
|
+
},
|
|
156
|
+
"MetaObject": {
|
|
157
|
+
"additionalProperties": {},
|
|
158
|
+
"description": "Represents the contents of a `_meta` field, which clients and servers use to attach additional metadata to their interactions.\n\nCertain key names are reserved by MCP for protocol-level metadata; implementations MUST NOT make assumptions about values at these keys. Additionally, specific schema definitions may reserve particular names for purpose-specific metadata, as declared in those definitions.\n\nValid keys have two segments:\n\n**Prefix:**\n- Optional — if specified, MUST be a series of _labels_ separated by dots (`.`), followed by a slash (`/`).\n- Labels MUST start with a letter and end with a letter or digit. Interior characters may be letters, digits, or hyphens (`-`).\n- Any prefix consisting of zero or more labels, followed by `modelcontextprotocol` or `mcp`, followed by any label, is **reserved** for MCP use. For example: `modelcontextprotocol.io/`, `mcp.dev/`, `api.modelcontextprotocol.org/`, and `tools.mcp.com/` are all reserved.\n\n**Name:**\n- Unless empty, MUST start and end with an alphanumeric character (`[a-z0-9A-Z]`).\n- Interior characters may be alphanumeric, hyphens (`-`), underscores (`_`), or dots (`.`).",
|
|
159
|
+
"type": "object"
|
|
160
|
+
},
|
|
161
|
+
"Remote": {
|
|
162
|
+
"description": "Metadata for connecting to a remote (HTTP-based) MCP server endpoint.",
|
|
163
|
+
"properties": {
|
|
164
|
+
"extensionsInfo": {
|
|
165
|
+
"additionalProperties": {
|
|
166
|
+
"$ref": "#/$defs/JSONObject"
|
|
167
|
+
},
|
|
168
|
+
"description": "Optional server-level information about MCP extensions for this remote\nendpoint. Keys are extension identifiers (e.g.,\n`\"io.modelcontextprotocol/events\"`), and values are objects whose contents\nare defined by the respective extension — typically information a client\nneeds before connecting, such as keys for verifying webhook signatures.\n\nThe presence or absence of an entry does not indicate whether the server\nsupports that extension, and an entry need not match the server's\n`capabilities.extensions`. Extension support is negotiated at runtime via\n`server/discover` and may vary per user.\n\nKeys MUST follow the {@link MetaObject`_meta` key naming rules}, with a\nmandatory prefix.",
|
|
169
|
+
"type": "object"
|
|
170
|
+
},
|
|
171
|
+
"headers": {
|
|
172
|
+
"description": "HTTP headers required or accepted when connecting to this remote\nendpoint. Each header is described as a {@link KeyValueInput} so that\nclients can prompt users for required values, mark secrets, surface\ndefaults, and constrain to a list of choices.",
|
|
173
|
+
"items": {
|
|
174
|
+
"$ref": "#/$defs/KeyValueInput"
|
|
175
|
+
},
|
|
176
|
+
"type": "array"
|
|
177
|
+
},
|
|
178
|
+
"supportedProtocolVersions": {
|
|
179
|
+
"description": "MCP protocol versions actively supported by this remote endpoint. Allows\nclients to select a compatible protocol version before connecting.",
|
|
180
|
+
"items": {
|
|
181
|
+
"type": "string"
|
|
182
|
+
},
|
|
183
|
+
"type": "array"
|
|
184
|
+
},
|
|
185
|
+
"type": {
|
|
186
|
+
"description": "The transport type for this remote endpoint.",
|
|
187
|
+
"enum": ["sse", "streamable-http"],
|
|
188
|
+
"type": "string"
|
|
189
|
+
},
|
|
190
|
+
"url": {
|
|
191
|
+
"description": "URL template for the remote endpoint. Must start with `http://`,\n`https://`, or a `{template-variable}`. Variables in `{curly_braces}`\nare substituted from the {@link Remote.variables} map before the\nclient connects.",
|
|
192
|
+
"pattern": "^(https?://[^\\s]+|\\{[a-zA-Z_][a-zA-Z0-9_]*\\}[^\\s]*)$",
|
|
193
|
+
"type": "string"
|
|
194
|
+
},
|
|
195
|
+
"variables": {
|
|
196
|
+
"additionalProperties": {
|
|
197
|
+
"$ref": "#/$defs/Input"
|
|
198
|
+
},
|
|
199
|
+
"description": "Configuration variables that can be referenced as `{curly_braces}`\nplaceholders in `url` (and inside header values via\n{@link KeyValueInput.variables}). The map key is the variable\nname; the value defines the variable's properties (e.g., human-readable\ndescription, default, whether it is required or secret).",
|
|
200
|
+
"type": "object"
|
|
201
|
+
}
|
|
202
|
+
},
|
|
203
|
+
"required": ["type", "url"],
|
|
204
|
+
"type": "object"
|
|
205
|
+
},
|
|
206
|
+
"Repository": {
|
|
207
|
+
"description": "Repository metadata for the MCP server source code. Enables users and\nsecurity experts to inspect the code, improving transparency.",
|
|
208
|
+
"properties": {
|
|
209
|
+
"id": {
|
|
210
|
+
"description": "Repository identifier from the hosting service (e.g., GitHub repo ID).\nOwned and determined by the source forge. Should remain stable across\nrepository renames and may be used to detect repository resurrection\nattacks — if a repository is deleted and recreated, the ID should change.",
|
|
211
|
+
"type": "string"
|
|
212
|
+
},
|
|
213
|
+
"source": {
|
|
214
|
+
"description": "Repository hosting service identifier (e.g., `\"github\"`). Used by registries\nto determine validation and API access methods.",
|
|
215
|
+
"type": "string"
|
|
216
|
+
},
|
|
217
|
+
"subfolder": {
|
|
218
|
+
"description": "Optional relative path from repository root to the server location within a\nmonorepo or nested package structure. Must be a clean relative path.",
|
|
219
|
+
"type": "string"
|
|
220
|
+
},
|
|
221
|
+
"url": {
|
|
222
|
+
"description": "Repository URL for browsing source code. Should support both web browsing\nand `git clone` operations.",
|
|
223
|
+
"format": "uri",
|
|
224
|
+
"type": "string"
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
"required": ["source", "url"],
|
|
228
|
+
"type": "object"
|
|
229
|
+
},
|
|
230
|
+
"ServerCard": {
|
|
231
|
+
"description": "A static metadata document describing a remote MCP server, suitable for\npre-connection discovery. A Server Card may be hosted at any unreserved URI;\nMCP reserves `GET <streamable-http-url>/server-card` as the recommended\nlocation. Clients learn a card's URL from an [AI Catalog](https://github.com/Agent-Card/ai-catalog)\nrather than guessing it.\n\nServer Cards describe only what is needed to discover and connect to a remote server:\nidentity, transport, and protocol versions.\n\nThey do not enumerate primitives (tools, resources, prompts) — those remain\nsubject to runtime listing via the protocol's standard list operations.\n\nThe fields a Server Card does declare (identity, transport, protocol\nversions) are advisory, not authoritative: they should be consistent with\nthe server's `server/discover` response, and clients must not treat them as\nauthoritative for security decisions. See \"Consistency with Runtime\nBehavior\" in docs/discovery.md for the normative requirement.",
|
|
232
|
+
"properties": {
|
|
233
|
+
"$schema": {
|
|
234
|
+
"description": "The Server Card JSON Schema URI that this document conforms to. Required.\n\nMust be the `/v1/` Server Card schema URL under\n`static.modelcontextprotocol.io/schemas/` (i.e.,\n`https://static.modelcontextprotocol.io/schemas/v1/server-card.schema.json`).\nSchema URLs are versioned by the `vN` segment rather than by date; a\nbreaking revision of the Server Card shape publishes a new `vN` family.",
|
|
235
|
+
"format": "uri",
|
|
236
|
+
"pattern": "^https://static\\.modelcontextprotocol\\.io/schemas/v1/server-card\\.schema\\.json$",
|
|
237
|
+
"type": "string"
|
|
238
|
+
},
|
|
239
|
+
"_meta": {
|
|
240
|
+
"$ref": "#/$defs/MetaObject",
|
|
241
|
+
"description": "Extension metadata using reverse-DNS namespacing for vendor-specific data.\n\nFollows the protocol's standard `_meta` definition."
|
|
242
|
+
},
|
|
243
|
+
"description": {
|
|
244
|
+
"description": "Clear human-readable explanation of server functionality. Should focus on\ncapabilities, not implementation details.",
|
|
245
|
+
"maxLength": 100,
|
|
246
|
+
"minLength": 1,
|
|
247
|
+
"type": "string"
|
|
248
|
+
},
|
|
249
|
+
"icons": {
|
|
250
|
+
"description": "Optional set of sized icons that the client can display in a user interface.\n\nClients that support rendering icons MUST support at least the following\nMIME types: `image/png` and `image/jpeg` (safe, universal compatibility).\nClients SHOULD also support: `image/svg+xml` (scalable but requires security\nprecautions) and `image/webp` (modern, efficient format).",
|
|
251
|
+
"items": {
|
|
252
|
+
"$ref": "#/$defs/Icon"
|
|
253
|
+
},
|
|
254
|
+
"type": "array"
|
|
255
|
+
},
|
|
256
|
+
"name": {
|
|
257
|
+
"description": "Server name in reverse-DNS format. Must contain exactly one forward slash\nseparating namespace from server name.",
|
|
258
|
+
"maxLength": 200,
|
|
259
|
+
"minLength": 3,
|
|
260
|
+
"pattern": "^[a-zA-Z0-9.-]+/[a-zA-Z0-9._-]+$",
|
|
261
|
+
"type": "string"
|
|
262
|
+
},
|
|
263
|
+
"remotes": {
|
|
264
|
+
"description": "Metadata helpful for making HTTP-based connections to this MCP server.",
|
|
265
|
+
"items": {
|
|
266
|
+
"$ref": "#/$defs/Remote"
|
|
267
|
+
},
|
|
268
|
+
"type": "array"
|
|
269
|
+
},
|
|
270
|
+
"repository": {
|
|
271
|
+
"$ref": "#/$defs/Repository",
|
|
272
|
+
"description": "Optional repository metadata for the MCP server source code.\nRecommended for transparency and security inspection."
|
|
273
|
+
},
|
|
274
|
+
"title": {
|
|
275
|
+
"description": "Optional human-readable title or display name for the MCP server.\nMCP subregistries or clients MAY choose to use this for display purposes.",
|
|
276
|
+
"maxLength": 100,
|
|
277
|
+
"minLength": 1,
|
|
278
|
+
"type": "string"
|
|
279
|
+
},
|
|
280
|
+
"version": {
|
|
281
|
+
"description": "Version string for this server. SHOULD follow semantic versioning\n(e.g., '1.0.2', '2.1.0-alpha'). Equivalent of `Implementation.version`\nin the MCP specification. Non-semantic versions are allowed but may not\nsort predictably. Version ranges are rejected (e.g., '^1.2.3', '~1.2.3',\n'>=1.2.3', '1.x', '1.*').",
|
|
282
|
+
"maxLength": 255,
|
|
283
|
+
"type": "string"
|
|
284
|
+
},
|
|
285
|
+
"websiteUrl": {
|
|
286
|
+
"description": "Optional URL to the server's homepage, documentation, or project website.\nProvides a central link for users to learn more about the server.\nParticularly useful when the server has custom installation instructions\nor setup requirements.",
|
|
287
|
+
"format": "uri",
|
|
288
|
+
"type": "string"
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
"required": ["$schema", "description", "name", "version"],
|
|
292
|
+
"type": "object"
|
|
293
|
+
}
|
|
294
|
+
}
|
|
295
|
+
}
|
package/dist/catalog.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { bundle,
|
|
1
|
+
import { bundle, targetCatalog } from "@acid-cat/spec-ts";
|
|
2
2
|
import type { CatalogDocument as Catalog } from "@acid-cat/spec-ts";
|
|
3
|
-
export { bundle,
|
|
3
|
+
export { bundle, targetCatalog };
|
|
4
4
|
export type { Catalog };
|
|
5
5
|
/** The result of a check. An error breaks a rule. A warning breaks a recommendation. */
|
|
6
6
|
export interface Report {
|
package/dist/catalog.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import catalog_schema_default from "./json/catalog.schema.json.js";
|
|
2
2
|
import { isObject, isRecordOf, isStringArray } from "./json.js";
|
|
3
3
|
import { canonicalText } from "@acid-cat/catalog";
|
|
4
|
-
import { REFERENCE, bundle, cliAliases, eventSchemasOf, resolveType, schemasOf,
|
|
4
|
+
import { REFERENCE, bundle, cliAliases, eventSchemasOf, mcpHeaderErrors, resolveType, schemasOf, targetCatalog, visitObjects } from "@acid-cat/spec-ts";
|
|
5
5
|
import { Result, Schema, SchemaIssue, SchemaRepresentation } from "effect";
|
|
6
6
|
// src/catalog.ts
|
|
7
7
|
const KNOWN_MEMBERS = {
|
|
@@ -15,7 +15,7 @@ const KNOWN_MEMBERS = {
|
|
|
15
15
|
"events"
|
|
16
16
|
],
|
|
17
17
|
target: [
|
|
18
|
-
"
|
|
18
|
+
"surfaces",
|
|
19
19
|
"description",
|
|
20
20
|
"options"
|
|
21
21
|
],
|
|
@@ -41,7 +41,7 @@ const KNOWN_MEMBERS = {
|
|
|
41
41
|
const optional = (object, key, isMember) => !Object.hasOwn(object, key) || isMember(object[key]);
|
|
42
42
|
const isString = (value) => typeof value === "string";
|
|
43
43
|
const isBoolean = (value) => typeof value === "boolean";
|
|
44
|
-
const isTarget = (value) => isObject(value) && isStringArray(value.
|
|
44
|
+
const isTarget = (value) => isObject(value) && isStringArray(value.surfaces);
|
|
45
45
|
const isCapability = (value) => isObject(value) && typeof value.description === "string" && optional(value, "audience", isStringArray) && optional(value, "input", isObject) && optional(value, "output", isObject) && optional(value, "state", isObject) && optional(value, "failures", (failures) => isRecordOf(failures, isObject)) && optional(value, "readOnly", isBoolean) && optional(value, "destructive", isBoolean) && optional(value, "idempotent", isBoolean);
|
|
46
46
|
const isEvent = (value) => isObject(value) && typeof value.description === "string" && optional(value, "audience", isStringArray) && optional(value, "input", isObject) && optional(value, "payload", isObject);
|
|
47
47
|
const isCatalog = (value) => isObject(value) && typeof value.acidcat === "string" && optional(value, "title", isString) && optional(value, "description", isString) && isRecordOf(value.targets, isTarget) && optional(value, "$defs", (types) => isRecordOf(types, isObject)) && isRecordOf(value.capabilities, isCapability) && optional(value, "events", (events) => isRecordOf(events, isEvent));
|
|
@@ -93,6 +93,7 @@ function ruleErrors(catalog) {
|
|
|
93
93
|
const references = referenceErrors(schema, types);
|
|
94
94
|
errors.push(...references.map((error) => `${id} ${member} ${error}`));
|
|
95
95
|
if ((member === "input" || member === "payload") && references.length === 0 && resolveType(schema, types).type !== "object") errors.push(`${id}: the ${member} is not an object`);
|
|
96
|
+
if (member === "input" && references.length === 0) errors.push(...mcpHeaderErrors(bundle(schema, types)).map((error) => `${id} input: ${error}`));
|
|
96
97
|
}
|
|
97
98
|
}
|
|
98
99
|
for (const target of Object.keys(catalog.targets)) errors.push(...cliAliases(catalog, target).errors);
|
|
@@ -145,4 +146,4 @@ function referenceErrors(schema, types) {
|
|
|
145
146
|
});
|
|
146
147
|
return errors;
|
|
147
148
|
}
|
|
148
|
-
export { bundle, check, isCatalog,
|
|
149
|
+
export { bundle, check, isCatalog, targetCatalog };
|
package/dist/conform/check.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { CatalogDocument, Occurrence, Outcome } from "@acid-cat/spec-ts";
|
|
2
2
|
export interface Check {
|
|
3
|
-
readonly
|
|
3
|
+
readonly surface: string;
|
|
4
4
|
readonly name: string;
|
|
5
|
-
/** The part of the specification that the check tests, for example `spec/
|
|
5
|
+
/** The part of the specification that the check tests, for example `spec/surfaces/mcp.md#tools`. */
|
|
6
6
|
readonly rule: string;
|
|
7
7
|
readonly passed: boolean;
|
|
8
8
|
/** `true` when the check tests a recommendation (SHOULD) that the implementation does not follow. The check still passes. */
|
|
@@ -21,9 +21,9 @@ export type Define = (name: string, rule: string, body: Body) => void;
|
|
|
21
21
|
export declare class Checks {
|
|
22
22
|
#private;
|
|
23
23
|
readonly results: Check[];
|
|
24
|
-
readonly
|
|
24
|
+
readonly surface: string;
|
|
25
25
|
readonly deadline: number;
|
|
26
|
-
constructor(
|
|
26
|
+
constructor(surface: string, deadline: number);
|
|
27
27
|
run(name: string, rule: string, body: Body): Promise<void>;
|
|
28
28
|
concurrently(define: (check: Define) => void): Promise<void>;
|
|
29
29
|
should(name: string, rule: string, body: Body): Promise<void>;
|
package/dist/conform/check.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import fixture_acidcat_default from "../json/fixture.acidcat.json.js";
|
|
2
2
|
import { isObject } from "../json.js";
|
|
3
|
-
import { CALL_FAILURE_KINDS, isOccurrence,
|
|
3
|
+
import { CALL_FAILURE_KINDS, isOccurrence, targetCatalog } from "@acid-cat/spec-ts";
|
|
4
4
|
import { Schema, SchemaRepresentation } from "effect";
|
|
5
5
|
import { availableParallelism } from "node:os";
|
|
6
6
|
import { setTimeout as setTimeout$1 } from "node:timers/promises";
|
|
@@ -13,8 +13,8 @@ const isOutcome = (value) => {
|
|
|
13
13
|
if (value.ok === false) return "error" in value;
|
|
14
14
|
return !("ok" in value) && CALL_FAILURE_KINDS.some((kind) => kind === value.kind) && typeof value.message === "string";
|
|
15
15
|
};
|
|
16
|
-
const idsOf = (target) => Object.keys(
|
|
17
|
-
const eventIdsOf = (target) => Object.keys(
|
|
16
|
+
const idsOf = (target) => Object.keys(targetCatalog(fixture, target).capabilities).sort();
|
|
17
|
+
const eventIdsOf = (target) => Object.keys(targetCatalog(fixture, target).events ?? {}).sort();
|
|
18
18
|
const payloadChecks = /* @__PURE__ */ new Map();
|
|
19
19
|
function agreesWithPayload(id, data) {
|
|
20
20
|
let agrees = payloadChecks.get(id);
|
|
@@ -43,10 +43,10 @@ function expectOccurrence(value, id) {
|
|
|
43
43
|
const DEADLINE = 3e4;
|
|
44
44
|
var Checks = class {
|
|
45
45
|
results = [];
|
|
46
|
-
|
|
46
|
+
surface;
|
|
47
47
|
deadline;
|
|
48
|
-
constructor(
|
|
49
|
-
this.
|
|
48
|
+
constructor(surface, deadline) {
|
|
49
|
+
this.surface = surface;
|
|
50
50
|
this.deadline = deadline;
|
|
51
51
|
}
|
|
52
52
|
async run(name, rule, body) {
|
|
@@ -69,12 +69,12 @@ var Checks = class {
|
|
|
69
69
|
}
|
|
70
70
|
#result(name, rule, failure) {
|
|
71
71
|
return failure === void 0 ? {
|
|
72
|
-
|
|
72
|
+
surface: this.surface,
|
|
73
73
|
name,
|
|
74
74
|
rule,
|
|
75
75
|
passed: true
|
|
76
76
|
} : {
|
|
77
|
-
|
|
77
|
+
surface: this.surface,
|
|
78
78
|
name,
|
|
79
79
|
rule,
|
|
80
80
|
passed: false,
|
|
@@ -84,12 +84,12 @@ var Checks = class {
|
|
|
84
84
|
async should(name, rule, body) {
|
|
85
85
|
const failure = await this.#settle(body);
|
|
86
86
|
this.results.push(failure === void 0 ? {
|
|
87
|
-
|
|
87
|
+
surface: this.surface,
|
|
88
88
|
name,
|
|
89
89
|
rule,
|
|
90
90
|
passed: true
|
|
91
91
|
} : {
|
|
92
|
-
|
|
92
|
+
surface: this.surface,
|
|
93
93
|
name,
|
|
94
94
|
rule,
|
|
95
95
|
passed: true,
|
package/dist/conform/cli.js
CHANGED
|
@@ -7,7 +7,7 @@ import { mkdtemp, rm } from "node:fs/promises";
|
|
|
7
7
|
import { join } from "node:path";
|
|
8
8
|
import { isDeepStrictEqual } from "node:util";
|
|
9
9
|
// src/conform/cli.ts
|
|
10
|
-
const RULE = "spec/
|
|
10
|
+
const RULE = "spec/surfaces/cli.md";
|
|
11
11
|
const USAGES = {
|
|
12
12
|
"fixture.crash": "fixture crash",
|
|
13
13
|
"fixture.echo": "fixture echo --text <string>",
|
|
@@ -148,12 +148,12 @@ async function checkCli(command, options) {
|
|
|
148
148
|
2
|
|
149
149
|
],
|
|
150
150
|
[
|
|
151
|
-
"a capability outside the
|
|
151
|
+
"a capability outside the target has exit code 2",
|
|
152
152
|
["call", "fixture.hidden"],
|
|
153
153
|
2
|
|
154
154
|
],
|
|
155
155
|
[
|
|
156
|
-
"a capability outside the
|
|
156
|
+
"a capability outside the target with input that is not JSON has exit code 2",
|
|
157
157
|
[
|
|
158
158
|
"call",
|
|
159
159
|
"fixture.hidden",
|
|
@@ -317,7 +317,7 @@ async function checkCli(command, options) {
|
|
|
317
317
|
expectEqual(result.code, 0, "exit code");
|
|
318
318
|
expectEqual(parseJson(result.stdout), { text: "hello" }, "standard output");
|
|
319
319
|
});
|
|
320
|
-
check("list gives the
|
|
320
|
+
check("list gives the capabilities of the target, then its events", `${RULE}#commands`, async (signal) => {
|
|
321
321
|
const entries = await listed(signal);
|
|
322
322
|
const ids = (kind) => entries.filter((entry) => entry.kind === kind).map((entry) => entry.id);
|
|
323
323
|
expectEqual(sorted(ids("capability")), idsOf("cli"), "the ids of the items with kind: capability");
|
|
@@ -655,7 +655,7 @@ function checkWatch(check, command) {
|
|
|
655
655
|
3
|
|
656
656
|
],
|
|
657
657
|
[
|
|
658
|
-
"watch of an event outside the
|
|
658
|
+
"watch of an event outside the target has exit code 2",
|
|
659
659
|
["watch", "fixture.secret"],
|
|
660
660
|
2
|
|
661
661
|
],
|
package/dist/conform/http.js
CHANGED
|
@@ -3,7 +3,7 @@ import { Checks, FORBIDDEN_ORIGIN, eventIdsOf, expect, expectEqual, expectOccurr
|
|
|
3
3
|
import { sseReader } from "./sse.js";
|
|
4
4
|
import { randomUUID } from "node:crypto";
|
|
5
5
|
// src/conform/http.ts
|
|
6
|
-
const RULE = "spec/
|
|
6
|
+
const RULE = "spec/surfaces/http.md";
|
|
7
7
|
const isEntry = (value) => isObject(value) && typeof value.id === "string";
|
|
8
8
|
async function entriesOf(response) {
|
|
9
9
|
const list = await readJson(response);
|
|
@@ -22,7 +22,7 @@ async function checkHttp(base, options) {
|
|
|
22
22
|
signal
|
|
23
23
|
});
|
|
24
24
|
const kindOf = async (response) => memberOf(await readJson(response), "kind");
|
|
25
|
-
await checks.run("GET /capabilities lists the
|
|
25
|
+
await checks.run("GET /capabilities lists the capabilities of the target with their availability", `${RULE}#requests`, async (signal) => {
|
|
26
26
|
const list = await entriesOf(await fetch(`${base}/capabilities`, { signal }));
|
|
27
27
|
expectEqual(sorted(list.map((entry) => entry.id)), idsOf("api"), "ids");
|
|
28
28
|
expect(list.every((entry) => typeof entry.available === "boolean"), "each entry must have available");
|
|
@@ -50,7 +50,7 @@ async function checkHttp(base, options) {
|
|
|
50
50
|
"invalid-input"
|
|
51
51
|
],
|
|
52
52
|
[
|
|
53
|
-
"a capability outside the
|
|
53
|
+
"a capability outside the target has the status 404",
|
|
54
54
|
"fixture.hidden",
|
|
55
55
|
{},
|
|
56
56
|
404,
|
|
@@ -171,14 +171,14 @@ async function checkEvents(checks, base) {
|
|
|
171
171
|
expect(typeof delivered === "number", `fixture.signal must give the number of subscriptions, got ${JSON.stringify(delivered)}`);
|
|
172
172
|
return delivered;
|
|
173
173
|
};
|
|
174
|
-
await checks.run("GET /events lists the events of the
|
|
174
|
+
await checks.run("GET /events lists the events of the target", `${RULE}#requests`, async (signal) => {
|
|
175
175
|
const list = await readJson(await fetch(`${base}/events`, { signal }));
|
|
176
176
|
if (!isArrayOf(list, isEntry)) throw new Error(`GET /events must give a list of objects with an id, got ${JSON.stringify(list)}`);
|
|
177
177
|
expectEqual(sorted(list.map((entry) => entry.id)), eventIdsOf("api"), "ids");
|
|
178
178
|
});
|
|
179
179
|
for (const [name, id, input, status, kind] of [
|
|
180
180
|
[
|
|
181
|
-
"a subscription to an event outside the
|
|
181
|
+
"a subscription to an event outside the target has the status 404",
|
|
182
182
|
"fixture.secret",
|
|
183
183
|
{},
|
|
184
184
|
404,
|
package/dist/conform/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface ConformOptions {
|
|
|
15
15
|
readonly mcp?: string | undefined;
|
|
16
16
|
/**
|
|
17
17
|
* Check the `initialize` handshake of revision 2025-11-25 through the MCP server too
|
|
18
|
-
* (spec/
|
|
18
|
+
* (spec/surfaces/mcp.md#earlier-revisions-through-http). The default is `false`.
|
|
19
19
|
*/
|
|
20
20
|
readonly mcpHandshake?: boolean | undefined;
|
|
21
21
|
/**
|
|
@@ -28,7 +28,7 @@ export interface ConformOptions {
|
|
|
28
28
|
/** The command that starts the command line, for example `["node", "fixture-cli.ts"]`. */
|
|
29
29
|
readonly cli?: readonly string[] | undefined;
|
|
30
30
|
/**
|
|
31
|
-
* The WebMCP
|
|
31
|
+
* The WebMCP surface: the URL of a page that serves the `app` target, or a function that installs the implementation
|
|
32
32
|
* on a host in the same process. A page runs in Chromium, through Playwright.
|
|
33
33
|
*/
|
|
34
34
|
readonly webmcp?: string | WebMcpInstall | undefined;
|
|
@@ -51,7 +51,7 @@ export interface ConformOptions {
|
|
|
51
51
|
* header `Authorization: Bearer <principal>`.
|
|
52
52
|
*/
|
|
53
53
|
readonly webhook?: WebhookSettings | undefined;
|
|
54
|
-
/** The body limit of the remote
|
|
54
|
+
/** The body limit of the remote surfaces, in bytes. The default is 1 MiB. */
|
|
55
55
|
readonly maximumBytes?: number | undefined;
|
|
56
56
|
/**
|
|
57
57
|
* The time, in milliseconds, that each check has to settle. A check that does not settle in this time fails. The
|
|
@@ -59,5 +59,5 @@ export interface ConformOptions {
|
|
|
59
59
|
*/
|
|
60
60
|
readonly deadline?: number | undefined;
|
|
61
61
|
}
|
|
62
|
-
/** Run all checks for the
|
|
62
|
+
/** Run all checks for the surfaces that the options give. */
|
|
63
63
|
export declare function conform(options: ConformOptions): Promise<readonly Check[]>;
|
package/dist/conform/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { browserDriver, checkWebMcp, processDriver } from "./webmcp.js";
|
|
|
8
8
|
import { checkPollLease } from "./poll.js";
|
|
9
9
|
import { serve } from "./serve.js";
|
|
10
10
|
// src/conform/index.ts
|
|
11
|
-
/** Run all checks for the
|
|
11
|
+
/** Run all checks for the surfaces that the options give. */
|
|
12
12
|
async function conform(options) {
|
|
13
13
|
const maximumBytes = options.maximumBytes ?? 1048576;
|
|
14
14
|
const deadline = options.deadline ?? 3e4;
|
|
@@ -7,7 +7,7 @@ import { randomUUID } from "node:crypto";
|
|
|
7
7
|
import { Client } from "@modelcontextprotocol/client";
|
|
8
8
|
import { StdioClientTransport } from "@modelcontextprotocol/client/stdio";
|
|
9
9
|
// src/conform/mcp-stdio.ts
|
|
10
|
-
const RULE = "spec/
|
|
10
|
+
const RULE = "spec/surfaces/mcp.md#stdio";
|
|
11
11
|
const ERAS = [{
|
|
12
12
|
revision: "2026-07-28",
|
|
13
13
|
connects: "an MCP client connects with revision 2026-07-28",
|
package/dist/conform/mcp.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface McpCheckOptions {
|
|
|
12
12
|
readonly webhook: WebhookSettings | undefined;
|
|
13
13
|
}
|
|
14
14
|
export declare function checkMcp(url: string, options: McpCheckOptions): Promise<Checks>;
|
|
15
|
+
export declare function mcpRequestHeaders(method: string, params: JsonObject): Record<string, string>;
|
|
15
16
|
export declare function checkTools(checks: Checks, mcp: Client): Promise<void>;
|
|
16
17
|
export declare const EVENTS_REVISION = "2026-07-28";
|
|
17
18
|
export declare const META: {
|