@acid-cat/cli 0.24.0 → 0.25.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 +13 -3
- package/conformance/fixture.acidcat.json +20 -1
- package/conformance/mcp-skills/fixture-guide/SKILL.md +13 -0
- package/conformance/mcp-skills/fixture-guide/assets/sample.bin +0 -0
- package/conformance/mcp-skills/fixture-guide/references/notes.txt +2 -0
- package/conformance/mcp-skills/fixture-other/SKILL.md +8 -0
- package/dist/{conform-LH9KgQ9-.js → conform-CnopVX0Y.js} +358 -112
- package/dist/index.d.ts +14 -1
- package/dist/index.js +2 -2
- package/dist/main.js +2 -2
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -40,7 +40,7 @@ You get the JSON document only when the options are correct. With incorrect opti
|
|
|
40
40
|
- An **error** is a broken rule. Examples: an audience that names an unknown target, an event payload that is not an object, or an id that is both a capability and an event.
|
|
41
41
|
- A **warning** is a broken recommendation. Examples: a file that is not in [canonical form](../../spec/catalog.md#canonical-form), or a member with no `x-` prefix.
|
|
42
42
|
|
|
43
|
-
It also checks each alias in `options.cli` against the [alias rules](../../spec/surfaces/cli.md#aliases), its [positional arguments](../../spec/surfaces/cli.md#positional-arguments) included,
|
|
43
|
+
It also checks each alias in `options.cli` against the [alias rules](../../spec/surfaces/cli.md#aliases), its [positional arguments](../../spec/surfaces/cli.md#positional-arguments) included, each `x-mcp-header` member in an input schema against the [header annotation rules](../../spec/surfaces/mcp.md#header-annotations) of MCP, and `options.mcp` against the [skill rules](../../spec/surfaces/mcp.md#skills-of-a-target): the target has the surface `mcp`, and each skill name is valid and in the list one time. An error about `x-mcp-header` names the capability or the event, and the location of the member as a JSON pointer into the bundled input schema.
|
|
44
44
|
|
|
45
45
|
The exit code is 1 with errors, and 0 otherwise. With `--strict`, warnings also give exit code 1.
|
|
46
46
|
|
|
@@ -120,9 +120,10 @@ Each flag has an equivalent option for `conform()` in code. Give one or more sur
|
|
|
120
120
|
- [Poll delivery](../../spec/surfaces/mcp.md#poll): Through MCP, when `events/list` gives `poll`. Otherwise the check gives a warning and `events/poll` must answer `Unsupported`. `--poll-buffer` adds a cursor older than the buffer. The lease time of `--mcp` and `--mcp-stdio` must be longer than the deadline, because a check uses a lease for its whole time. `--poll-lease-mcp` with `--poll-lease-ms` adds the end of an unused lease. Serve it from a second MCP server with a lease time shorter than the deadline, for example 1000.
|
|
121
121
|
- [Webhook delivery](../../spec/surfaces/mcp.md#webhook): Through MCP over HTTP, with the three `--webhook-*` options. The checks run an HTTPS receiver on `127.0.0.1` with that certificate. Configure the deployment to trust the certificate, allow deliveries to private addresses, and give the principal `<name>` to a request with `Authorization: Bearer <name>`. The deadline must be longer than the deployment's first retry wait, and the maximum lifetime must be longer than the deadline. Give `--webhook-other-principal` with `--webhook-max-subscriptions`: the limit check then fills a principal that no other check uses. Without the webhook options, a server that does not list `webhook` must answer `Unsupported`.
|
|
122
122
|
- [Server Card](../../spec/surfaces/mcp.md#server-card): Through MCP over HTTP, when `<mcp>/server-card` gives 200. The card must pass the JSON Schema of the Server Card extension, have one remote with the URL of `--mcp`, the version of `server/discover` and the revisions that the server serves, the CORS and cache headers, 304 for its `ETag`, 204 for `OPTIONS`, public signing keys only, and egress ranges in CIDR text. With the webhook options and signing keys in the card, each webhook request must have one `v1a,` signature for each key, and each must verify. The JSON Schema is `conformance/server-card.schema.json`, from commit `28db12c` of [ext-server-card](https://github.com/modelcontextprotocol/ext-server-card), under the Apache License 2.0 in `conformance/server-card.LICENSE`.
|
|
123
|
+
- [Skills](../../spec/surfaces/mcp.md#skills): Through MCP with each transport, the `mcp` target of the fixture serves the skill `fixture-guide`. `server/discover` declares `resources` and the skills extension, `skills/list` gives the skill with its frontmatter, the `size` and the `digest` of each file agree with the bytes that `resources/read` gives, `skills/get` gives the same entry, and `resources/list` gives each file. `fixture-other`, the skill of the target `mcp-other`, gets the answer of a skill that does not exist. Through HTTP, `resources/read` with an `Mcp-Name` header that is not `params.uri` gets 400 and `-32020`. Through stdio, and through HTTP with `--mcp-handshake`, `initialize` declares no skills. The files of the skills of the fixture are in `conformance/mcp-skills/<name>/`.
|
|
123
124
|
- [Hints](../../spec/surfaces/mcp.md#tools): Each MCP tool's annotations match its capability's hints.
|
|
124
125
|
- [Heartbeat](../../spec/surfaces/mcp.md#push): Through MCP with each transport, each `notifications/events/active` grants a `heartbeatMs`. A suggestion is clamped between 1000 and 60 000, a heartbeat comes no sooner than the grant after the request and before the deadline ([why](../../spec/conformance.md#the-silence-before-a-heartbeat)), and a suggestion that is not valid gets `-32602`.
|
|
125
|
-
- [Headers](../../spec/surfaces/mcp.md#headers): Through MCP over HTTP, a missing or wrong `Mcp-Method`, `Mcp-Name` or `Mcp-Param-*` header on `tools/call` and `events/stream` gets 400 and `-32020`, and a value in the base64 form is decoded, with a leading U+FEFF kept. Every request of conform mirrors the annotated arguments of the fixture (`fixture.switch.set` and `fixture.ticks`) into their headers.
|
|
126
|
+
- [Headers](../../spec/surfaces/mcp.md#headers): Through MCP over HTTP, a missing or wrong `Mcp-Method`, `Mcp-Name` or `Mcp-Param-*` header on `tools/call` and `events/stream` gets 400 and `-32020`, and a value in the base64 form is decoded, with a leading U+FEFF kept. Every request of conform mirrors the annotated arguments of the fixture (`fixture.switch.set` and `fixture.ticks`) into their headers, and the `params.uri` of `resources/read` into `Mcp-Name`.
|
|
126
127
|
- Properties: With fast-check, through MCP and HTTP: concurrent calls each get their own outcome, and a cancellation changes only its own call. Each run of a property has the deadline.
|
|
127
128
|
|
|
128
129
|
Each poll check uses a new key, so leases from an earlier run do not change the result.
|
|
@@ -139,6 +140,15 @@ A failed check of a SHOULD rule gives a warning, marked `!`, and passes. The exi
|
|
|
139
140
|
|
|
140
141
|
`conform()` and `serve()` come from `@acid-cat/cli`. Give `conform()` the signal of the test as `signal`, so that it stops when the test ends: each check that runs stops and kills the processes that it started, no other check and no other surface starts, and the promise rejects with the reason of the signal. This `serve()` is for tests only: it listens on `127.0.0.1`, on a free port, with plain HTTP. Like the servers of the cores, it closes no idle connection, so that a client of a test never sends a request on a connection while the server closes it. Its `close()` ends each idle connection at once, and ends each other connection when both its request and its response are complete, so it cuts no request that the server accepted. It resolves when every connection has ended, so a response that does not end, such as an open event stream, keeps it waiting. To serve an application, use its core's server: `serve` from `@acid-cat/core-ts/node`, `NodeServer` from `@acid-cat/core-effect`, or `remote::serve` from the crate `acid-cat-core`.
|
|
141
142
|
|
|
143
|
+
`checkMcpSkills(url, catalog, target, { deadline, signal })` runs the skill checks against an MCP server through HTTP, for any catalog and target, and gives the checks. Use it in the tests of an application that serves skills. For a target with no skill, it checks that `server/discover` declares neither `resources` nor the skills extension, and that `skills/list` gets `-32601`.
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
import { checkMcpSkills } from "@acid-cat/cli";
|
|
147
|
+
|
|
148
|
+
const checks = await checkMcpSkills("http://127.0.0.1:3000/mcp", catalog, "mcp");
|
|
149
|
+
assert.deepEqual(checks.filter((check) => !check.passed), []);
|
|
150
|
+
```
|
|
151
|
+
|
|
142
152
|
## Implementation
|
|
143
153
|
|
|
144
154
|
The command line is an [Effect](https://effect.website) program built on `effect/cli`. It validates catalogs with Effect Schema, and imports `schemas/catalog.schema.json` and each schema in the catalog as Effect schemas. The canonical writer comes from [`@acid-cat/catalog`](../catalog/typescript).
|
|
@@ -148,7 +158,7 @@ The command line is an [Effect](https://effect.website) program built on `effect
|
|
|
148
158
|
| `src/catalog.ts` | The catalog rules, the catalog of a target, and bundling |
|
|
149
159
|
| `src/main.ts` | The commands |
|
|
150
160
|
| `src/conform/` | The conformance checks, and `serve`, which serves web handlers on a local port for the tests |
|
|
151
|
-
| `conformance/` | The conformance fixture, in Pkl and in JSON |
|
|
161
|
+
| `conformance/` | The conformance fixture, in Pkl and in JSON, and the files of its skills in `skills/` |
|
|
152
162
|
| `test/` | Tests. Run them with `moon run cli:test` |
|
|
153
163
|
| `test/fixtures/` | The test catalog: a bakery, in canonical form, with capabilities and an event |
|
|
154
164
|
| `test/fixtures/rejected/` | Catalogs that `check` must reject, written by hand |
|
|
@@ -129,7 +129,26 @@
|
|
|
129
129
|
"mcp": {
|
|
130
130
|
"surfaces": [
|
|
131
131
|
"mcp"
|
|
132
|
-
]
|
|
132
|
+
],
|
|
133
|
+
"options": {
|
|
134
|
+
"mcp": {
|
|
135
|
+
"skills": [
|
|
136
|
+
"fixture-guide"
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
},
|
|
141
|
+
"mcp-other": {
|
|
142
|
+
"surfaces": [
|
|
143
|
+
"mcp"
|
|
144
|
+
],
|
|
145
|
+
"options": {
|
|
146
|
+
"mcp": {
|
|
147
|
+
"skills": [
|
|
148
|
+
"fixture-other"
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
133
152
|
}
|
|
134
153
|
},
|
|
135
154
|
"$defs": {
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: fixture-guide
|
|
3
|
+
description: Use the tools of the AcidCat conformance fixture. Use it when a check of acid-cat conform reads a skill.
|
|
4
|
+
license: MIT
|
|
5
|
+
metadata:
|
|
6
|
+
audience: acid-cat conform
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# Fixture guide
|
|
10
|
+
|
|
11
|
+
Call `fixture.echo` to get the text that you give back as it is.
|
|
12
|
+
|
|
13
|
+
See [notes](references/notes.txt) for the other tools.
|
|
Binary file
|