@tik-choco/mistlib-mcp 0.0.0-stage → 0.1.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/LICENSE +373 -0
- package/README.md +128 -2
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/mcp/index.d.ts +3 -0
- package/dist/mcp/index.js +1 -0
- package/dist/mcp/schema.d.ts +6 -0
- package/dist/mcp/schema.js +29 -0
- package/dist/mcp/server.d.ts +100 -0
- package/dist/mcp/server.js +303 -0
- package/dist/provider/identity.d.ts +4 -0
- package/dist/provider/identity.js +57 -0
- package/dist/provider/index.d.ts +4 -0
- package/dist/provider/index.js +3 -0
- package/dist/provider/mistseed.d.ts +16 -0
- package/dist/provider/mistseed.js +91 -0
- package/dist/provider/protocol.d.ts +49 -0
- package/dist/provider/protocol.js +139 -0
- package/dist/provider/provider.d.ts +3 -0
- package/dist/provider/provider.js +430 -0
- package/dist/provider/shared-node.d.ts +23 -0
- package/dist/provider/shared-node.js +78 -0
- package/dist/provider/types.d.ts +31 -0
- package/dist/provider/types.js +1 -0
- package/dist/wire/credentials.d.ts +47 -0
- package/dist/wire/credentials.js +79 -0
- package/dist/wire/encoding.d.ts +7 -0
- package/dist/wire/encoding.js +23 -0
- package/dist/wire/errors.d.ts +27 -0
- package/dist/wire/errors.js +19 -0
- package/dist/wire/framing.d.ts +40 -0
- package/dist/wire/framing.js +166 -0
- package/dist/wire/index.d.ts +8 -0
- package/dist/wire/index.js +8 -0
- package/dist/wire/json.d.ts +13 -0
- package/dist/wire/json.js +73 -0
- package/dist/wire/messages.d.ts +68 -0
- package/dist/wire/messages.js +89 -0
- package/dist/wire/names.d.ts +4 -0
- package/dist/wire/names.js +14 -0
- package/dist/wire/noise-session.d.ts +135 -0
- package/dist/wire/noise-session.js +432 -0
- package/noise-wasm/README.md +59 -0
- package/noise-wasm/pkg/noise_wasm.d.ts +101 -0
- package/noise-wasm/pkg/noise_wasm.js +699 -0
- package/noise-wasm/pkg/noise_wasm_bg.wasm +0 -0
- package/noise-wasm/pkg/noise_wasm_bg.wasm.d.ts +30 -0
- package/package.json +70 -4
- package/spec/provider-runtime-v1.md +100 -0
- package/spec/secure-channel-v1.md +213 -0
- package/spec/wire-v1.md +355 -0
- package/vectors/wire-v1.json +117 -0
package/spec/wire-v1.md
ADDED
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
# mistl MCP provider wire protocol, version 1
|
|
2
|
+
|
|
3
|
+
## 1. Scope and roles
|
|
4
|
+
|
|
5
|
+
A gateway is an MCP client; a browser provider is an MCP server. The
|
|
6
|
+
transport delivers reliable, directed raw bytes within a room. Room
|
|
7
|
+
membership and the transport's claimed sender are not authentication.
|
|
8
|
+
Only public hello messages may be broadcast. Tool definitions, RPC
|
|
9
|
+
arguments/results, tickets and grants MUST be sent only over an
|
|
10
|
+
authenticated confidential channel. Do not auto-retry an operation whose
|
|
11
|
+
execution outcome is unknown.
|
|
12
|
+
|
|
13
|
+
The internal application protocol is [MCP 2025-11-25](https://modelcontextprotocol.io/specification/2025-11-25).
|
|
14
|
+
No application-specific RPC envelope or batch is defined.
|
|
15
|
+
|
|
16
|
+
## 2. JSON and primitive encodings
|
|
17
|
+
|
|
18
|
+
Each transport record is exactly one UTF-8 JSON object with no BOM.
|
|
19
|
+
Reject malformed UTF-8, duplicate object member names (including escaped
|
|
20
|
+
equivalents), non-finite numbers, unpaired UTF-16 surrogates and nesting
|
|
21
|
+
deeper than 32 (root at depth zero). Reject unknown envelope versions,
|
|
22
|
+
types, missing required fields and extra envelope fields. Fields are
|
|
23
|
+
case-sensitive.
|
|
24
|
+
|
|
25
|
+
Canonical JSON follows RFC 8785 (JCS) for this restricted JSON domain:
|
|
26
|
+
serialize finite IEEE 754 binary64 numbers using ECMAScript JSON number
|
|
27
|
+
serialization (including zero for negative zero); serialize strings with
|
|
28
|
+
ECMAScript JSON escaping; do not normalize Unicode; preserve array order;
|
|
29
|
+
sort object keys by ascending UTF-16 code units, recursively; emit no
|
|
30
|
+
insignificant whitespace. Canonical bytes are the UTF-8 encoding of this
|
|
31
|
+
string, without BOM or trailing newline. Incoming JSON need not already
|
|
32
|
+
be canonical. Integer fields MUST be nonnegative safe integers (0 through
|
|
33
|
+
2^53−1), unless a smaller range is stated.
|
|
34
|
+
|
|
35
|
+
* 128-bit identifiers: exactly 32 lowercase hexadecimal digits, generated
|
|
36
|
+
from independent cryptographic randomness.
|
|
37
|
+
* Opaque identifiers (DID, instance): nonempty strings of at most 512
|
|
38
|
+
UTF-16 code units, with no whitespace or ASCII control character.
|
|
39
|
+
Authentication MUST match the expected pinned DID and instance, not merely
|
|
40
|
+
parse these strings.
|
|
41
|
+
* Binary values: RFC 4648 URL-safe base64 without padding, with zero unused
|
|
42
|
+
bits; reject noncanonical encodings.
|
|
43
|
+
* SHA-256 digests: exactly 64 lowercase hex digits.
|
|
44
|
+
|
|
45
|
+
## 3. Control envelopes
|
|
46
|
+
|
|
47
|
+
Every envelope has `v:1` and a discriminator `type`. The shapes below
|
|
48
|
+
are exhaustive; illustrative strings are not literal identifiers.
|
|
49
|
+
|
|
50
|
+
```json
|
|
51
|
+
{
|
|
52
|
+
"v": 1, "type": "mcp.hello",
|
|
53
|
+
"gatewayDid": "did:example:gateway", "instance": "stable",
|
|
54
|
+
"bootNonce": "00112233445566778899aabbccddeeff",
|
|
55
|
+
"mcpVersions": ["2025-11-25"],
|
|
56
|
+
"limits": {"chunkSize":12288,"messageSize":524288,"maxChunks":43,"frameSize":18432}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
`bootNonce` is a fresh 128-bit identifier on each gateway boot.
|
|
61
|
+
`mcpVersions` contains 1–8 distinct version strings in YYYY-MM-DD form.
|
|
62
|
+
All limit values are positive integers, no larger than the defaults in
|
|
63
|
+
§5, and messageSize MUST NOT exceed chunkSize × maxChunks. The hello is
|
|
64
|
+
an unauthenticated hint, carries no namespace, and grants no authority.
|
|
65
|
+
Use effective limits agreed by the authenticated endpoints, no larger
|
|
66
|
+
than either party's supported limits.
|
|
67
|
+
|
|
68
|
+
Pairing and authentication messages all have the following outer shape:
|
|
69
|
+
|
|
70
|
+
```json
|
|
71
|
+
{"v":1,"type":"mcp.pair.challenge","sid":"00112233445566778899aabbccddeeff","data":"AA"}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
| Type | Purpose |
|
|
75
|
+
| --- | --- |
|
|
76
|
+
| mcp.pair.challenge | Begin pairing exchange |
|
|
77
|
+
| mcp.pair.proof | Continue pairing exchange |
|
|
78
|
+
| mcp.pair.grant | Complete pairing, with credentials only in protected payload |
|
|
79
|
+
| mcp.auth.challenge | Begin reconnect authentication |
|
|
80
|
+
| mcp.auth.proof | Continue authentication |
|
|
81
|
+
| mcp.auth.grant | Protected credential presentation/issuance |
|
|
82
|
+
| mcp.auth.accept | Complete authentication |
|
|
83
|
+
| mcp.close | Terminate authenticated session, best effort |
|
|
84
|
+
|
|
85
|
+
`sid` is a 128-bit exchange/session identifier. `data` is nonempty
|
|
86
|
+
canonical base64url of opaque channel-protocol bytes. Pairing and
|
|
87
|
+
authentication envelopes MUST be directed. The pairing lifetime is at
|
|
88
|
+
most 120 seconds and single-use; session establishment has a 15-second
|
|
89
|
+
deadline. Channel authentication, sequencing, expiry, freshness and
|
|
90
|
+
credential confidentiality are required before accepting any RPC.
|
|
91
|
+
|
|
92
|
+
`mcp.close` has the same fields as the opaque envelope above; the
|
|
93
|
+
protected payload must authenticate the close type and session. Ignore
|
|
94
|
+
unauthenticated closes; closing is not an acknowledgment of an RPC.
|
|
95
|
+
|
|
96
|
+
## 4. Secure channel
|
|
97
|
+
|
|
98
|
+
### Noise patterns
|
|
99
|
+
|
|
100
|
+
See Secure channel section (TBD)
|
|
101
|
+
|
|
102
|
+
### Prologue
|
|
103
|
+
|
|
104
|
+
See Secure channel section (TBD)
|
|
105
|
+
|
|
106
|
+
### PSK derivation
|
|
107
|
+
|
|
108
|
+
See Secure channel section (TBD)
|
|
109
|
+
|
|
110
|
+
### Channel binding
|
|
111
|
+
|
|
112
|
+
See Secure channel section (TBD)
|
|
113
|
+
|
|
114
|
+
## 5. Application framing
|
|
115
|
+
|
|
116
|
+
```json
|
|
117
|
+
{"v":1,"type":"mcp.frame","sid":"00112233445566778899aabbccddeeff","mid":"ffeeddccbbaa99887766554433221100","seq":0,"count":1,"size":123,"data":"AA"}
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
The sender encodes one JSON-RPC object as UTF-8, chooses a unique random
|
|
121
|
+
128-bit `mid` within the authenticated session `sid`, and splits the
|
|
122
|
+
bytes into chunks of at most chunkSize bytes. A message must not be
|
|
123
|
+
empty. `size` is the full plaintext byte length; `count` is
|
|
124
|
+
ceil(size / chunkSize); `seq` is a zero-based integer less than count.
|
|
125
|
+
All chunks except the final one have exactly chunkSize bytes; the final
|
|
126
|
+
chunk has size − seq × chunkSize bytes. The envelope's count and size
|
|
127
|
+
are identical for all pieces.
|
|
128
|
+
|
|
129
|
+
For each piece, exclude `data` from the envelope and construct:
|
|
130
|
+
|
|
131
|
+
```text
|
|
132
|
+
canonicalBytes(header without data) || 0x0A || chunk
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
Pass these exact bytes to the session's authenticated `seal` operation;
|
|
136
|
+
`data` is base64url of the returned ciphertext. The receiver calls
|
|
137
|
+
`open` and verifies the returned byte prefix byte-for-byte against the
|
|
138
|
+
canonical outer header plus LF before using the chunk. Reject if the
|
|
139
|
+
remaining length is not the expected chunk length. Thus an altered
|
|
140
|
+
outer header cannot silently reassign authenticated contents.
|
|
141
|
+
The header plus LF is at most 143 bytes, so the cipher interface MUST
|
|
142
|
+
accept at least 12,431 bytes of plaintext per frame (12,288 + 143);
|
|
143
|
+
with a 16-byte authentication tag the maximum ciphertext is 12,447 bytes.
|
|
144
|
+
This overhead does not count against the JSON chunk or reconstructed
|
|
145
|
+
message size.
|
|
146
|
+
|
|
147
|
+
Demultiplex only to a previously authenticated (room, from, sid) session;
|
|
148
|
+
within that session, reassembly is keyed by mid. The recipient validates
|
|
149
|
+
the envelope, limits, chunk count and sequence before allocating space,
|
|
150
|
+
then validates the authenticated contents. Hold chunks until all arrive,
|
|
151
|
+
concatenate in seq order, and decode/parse the complete UTF-8 bytes
|
|
152
|
+
exactly once as a JSON-RPC object. Never decode each chunk individually.
|
|
153
|
+
An identical authenticated duplicate is ignored, including a repeated
|
|
154
|
+
identical ciphertext for an already authenticated piece. A conflicting
|
|
155
|
+
duplicate or authentication failure closes the session. Completed and
|
|
156
|
+
expired mids are not reused or delivered again. Retain a bounded replay
|
|
157
|
+
ledger until session close; renew the session rather than evict its
|
|
158
|
+
entries. With an ordered stateful cipher, first deliveries must follow
|
|
159
|
+
cipher order; failure or an expired incomplete message requires session
|
|
160
|
+
renewal if cipher synchronization cannot be guaranteed. A partial send,
|
|
161
|
+
seal/open failure or limit failure after cipher consumption is fatal to
|
|
162
|
+
the session; never resume with an uncertain cipher state.
|
|
163
|
+
|
|
164
|
+
| Limit | Value |
|
|
165
|
+
| --- | ---: |
|
|
166
|
+
| Plain JSON chunk | 12 KiB (12,288 bytes) |
|
|
167
|
+
| Encoded raw frame | 18 KiB |
|
|
168
|
+
| Encoded control record | 8 KiB |
|
|
169
|
+
| Reassembled JSON | 512 KiB |
|
|
170
|
+
| Chunks per message | 43 |
|
|
171
|
+
| JSON depth | 32 |
|
|
172
|
+
| Incomplete messages per peer session | 4 |
|
|
173
|
+
| Aggregate reassembly memory | 16 MiB |
|
|
174
|
+
| Reassembly lifetime from first accepted piece | 10 seconds |
|
|
175
|
+
| Unique message IDs per session | 4,096 |
|
|
176
|
+
|
|
177
|
+
If a lower chunk size is negotiated, the effective message size is at
|
|
178
|
+
most min(512 KiB, chunkSize × maxChunks). Receivers reserve a bounded
|
|
179
|
+
budget for incomplete messages, including retained duplicate detection
|
|
180
|
+
data. Expired records are discarded and memory released; implementations
|
|
181
|
+
must sweep expiration while idle as well as on reception. Session close
|
|
182
|
+
releases all retained state. Serialize transmission and bound the send
|
|
183
|
+
queue; do not infer remote execution success from a transport send.
|
|
184
|
+
|
|
185
|
+
## 6. Provider ticket and namespace approval grant
|
|
186
|
+
|
|
187
|
+
Both objects are signed by the gateway with Ed25519 (RFC 8032).
|
|
188
|
+
The trusted verification key is the pinned 32-byte Ed25519 public key
|
|
189
|
+
corresponding to the expected issuer. `sig` is a 64-byte Ed25519
|
|
190
|
+
signature encoded in unpadded base64url. A provider ticket has exactly:
|
|
191
|
+
|
|
192
|
+
```json
|
|
193
|
+
{
|
|
194
|
+
"id":"00112233445566778899aabbccddeeff",
|
|
195
|
+
"iss":"did:example:gateway","aud":"did:example:leaf",
|
|
196
|
+
"origin":"https://example.org","actions":["register"],
|
|
197
|
+
"instance":"stable","epoch":1,"nbf":1700000000,"exp":1700003600,
|
|
198
|
+
"sig":"<base64url of 64 bytes>"
|
|
199
|
+
}
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
A valid ticket allows registration review, not tool publication or
|
|
203
|
+
execution. `id` is a unique 128-bit identifier; `iss` is the gateway DID;
|
|
204
|
+
`aud` is the dedicated provider leaf DID, not an interchangeable root DID;
|
|
205
|
+
`origin` is the browser's serialized HTTP(S) origin (scheme, host,
|
|
206
|
+
optional nondefault port, no path, credentials, query or fragment).
|
|
207
|
+
Opaque origins are prohibited. `instance` identifies the gateway
|
|
208
|
+
instance; `epoch` is its current credential epoch. `nbf` and `exp` are
|
|
209
|
+
integer Unix seconds with nbf < exp. Require nbf ≤ now < exp without
|
|
210
|
+
implicit clock skew. Require exact issuer, audience, origin, instance and
|
|
211
|
+
epoch equality with the authenticated expected values, valid signature,
|
|
212
|
+
and no revocation. The origin is an authenticated claim, not an
|
|
213
|
+
independent browser-origin attestation. Same-origin scripts share the
|
|
214
|
+
origin trust boundary; namespace separation does not isolate scripts.
|
|
215
|
+
|
|
216
|
+
A namespace grant has the same common fields and replaces actions:
|
|
217
|
+
|
|
218
|
+
```json
|
|
219
|
+
{
|
|
220
|
+
"id":"112233445566778899aabbccddeeff00",
|
|
221
|
+
"iss":"did:example:gateway","aud":"did:example:leaf",
|
|
222
|
+
"origin":"https://example.org","namespace":"notes",
|
|
223
|
+
"ticketId":"00112233445566778899aabbccddeeff",
|
|
224
|
+
"actions":["read","write"],"catalogDigest":"<64 lowercase hex digits>",
|
|
225
|
+
"localAgentAllowed":true,"instance":"stable","epoch":1,
|
|
226
|
+
"nbf":1700000000,"exp":1700003600,"sig":"<base64url of 64 bytes>"
|
|
227
|
+
}
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Actions are a nonempty array of distinct values from read, write,
|
|
231
|
+
destructive. `localAgentAllowed` is a boolean; true is required for a
|
|
232
|
+
local-agent publication. Verify the ticket independently at use time,
|
|
233
|
+
verify the grant with the same expected identity and epoch and with its
|
|
234
|
+
own expiry, revocation and signature; ticketId MUST equal the ID of that
|
|
235
|
+
valid ticket. Require an exact namespace and catalogDigest match. The
|
|
236
|
+
effective permission is the intersection of the grant's actions, the
|
|
237
|
+
gateway's current policy, and the application's authorization. Annotations
|
|
238
|
+
alone never grant permission. Deny wins.
|
|
239
|
+
|
|
240
|
+
The catalog digest is SHA-256 of canonical bytes of the array of complete
|
|
241
|
+
MCP tool definitions, sorted by local name in UTF-16 code-unit order.
|
|
242
|
+
Include name, schema and every advertised metadata field; do not hash
|
|
243
|
+
pagination wrappers. Changing a definition or classification requires
|
|
244
|
+
fresh approval. A grant cannot follow a replacement ticket without
|
|
245
|
+
being reissued and signed with the new ticket ID.
|
|
246
|
+
|
|
247
|
+
### Signature input
|
|
248
|
+
|
|
249
|
+
Remove only the top-level `sig` member. Canonicalize the two-element
|
|
250
|
+
array below as specified in §2, then UTF-8 encode (without newline).
|
|
251
|
+
Sign those bytes directly using Ed25519, not a hex string or a separate
|
|
252
|
+
hash of the bytes.
|
|
253
|
+
|
|
254
|
+
```text
|
|
255
|
+
ticket: ["mist-mcp/provider/v1", ticketWithoutSig]
|
|
256
|
+
grant: ["mist-mcp/namespace-grant/v1", grantWithoutSig]
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
Reject extra/unknown credential fields, malformed actions and
|
|
260
|
+
noncanonical binary/digest/ID fields before verifying.
|
|
261
|
+
|
|
262
|
+
## 7. Names and MCP dispatch
|
|
263
|
+
|
|
264
|
+
The provider's MCP `tools/list` and `tools/call` use local names.
|
|
265
|
+
The gateway publishes the exact name `namespace__localName`, 1–128
|
|
266
|
+
ASCII characters from `[A-Za-z0-9_.-]`. Namespace is 1–48 lowercase
|
|
267
|
+
ASCII letters, digits or hyphens. Local name is 1–45 characters from the
|
|
268
|
+
public name alphabet. Neither component contains `__`. Split on the
|
|
269
|
+
first occurrence of `__`; case-sensitive, no truncation/normalization.
|
|
270
|
+
An already live namespace cannot be overwritten by a second session.
|
|
271
|
+
|
|
272
|
+
After authentication, initialize using MCP 2025-11-25, advertise
|
|
273
|
+
`tools.listChanged:true`, and wait for `notifications/initialized`
|
|
274
|
+
before listing or calling tools. Allow ping. List results use opaque
|
|
275
|
+
cursor strings tied to a catalog revision; stale cursors fail rather
|
|
276
|
+
than mixing revisions. Emit `notifications/tools/list_changed` on
|
|
277
|
+
definition or membership changes. Each tool definition is at most
|
|
278
|
+
16 KiB; maximum 64 per provider, 32 providers/1,024 tools gateway-wide,
|
|
279
|
+
8 MiB total schemas. Validate arguments against object-root JSON Schema
|
|
280
|
+
2020-12 without remote reference resolution.
|
|
281
|
+
|
|
282
|
+
The gateway correlates its own request IDs to client connections; the
|
|
283
|
+
provider ledger is scoped to a single authenticated session/direction.
|
|
284
|
+
IDs are strings or safe integers, not null; notifications have no ID.
|
|
285
|
+
An identical in-progress request does not start another handler.
|
|
286
|
+
An identical completed request gets the cached response. A different
|
|
287
|
+
request with the same ID is rejected. A session holds at most 4,096
|
|
288
|
+
request records and a bounded ledger; renew before eviction.
|
|
289
|
+
|
|
290
|
+
Validate parameters and enforce authorization before any tool invocation.
|
|
291
|
+
A tool not explicitly marked read-only requires application-local
|
|
292
|
+
confirmation before its handler starts. Confirmation is specific to the
|
|
293
|
+
call and arguments; rejection, timeout, cancellation, or a changed
|
|
294
|
+
definition prevents invocation. Domain authorization and state/version
|
|
295
|
+
checks remain the handler's responsibility. Deliver cancellation via
|
|
296
|
+
AbortSignal; cancellation is cooperative and does not prove rollback.
|
|
297
|
+
Return tool failures using MCP `result.isError:true`; invalid RPC,
|
|
298
|
+
parameters, authorization, or transport state use JSON-RPC errors.
|
|
299
|
+
Successful structured results are objects (wrap nonobjects in
|
|
300
|
+
`{"value":...}`) with a text content representation for compatibility.
|
|
301
|
+
|
|
302
|
+
| Deadline / concurrency | Value |
|
|
303
|
+
| --- | ---: |
|
|
304
|
+
| Connect, initialize, list | 15 seconds |
|
|
305
|
+
| Default call | 30 seconds |
|
|
306
|
+
| Absolute call/confirmation ceiling | 120 seconds |
|
|
307
|
+
| Outstanding calls per peer | 4 |
|
|
308
|
+
| Outstanding calls gateway-wide | 32 |
|
|
309
|
+
| Writes per provider at once | 1 |
|
|
310
|
+
| Ping interval / liveness expiry | 10 / 45 seconds |
|
|
311
|
+
|
|
312
|
+
Timeouts are absolute, not extended by progress. Cancel/timeout before
|
|
313
|
+
execution is a known non-execution; after start the result is unknown.
|
|
314
|
+
Ignore a late handler result; do not automatically repeat the call.
|
|
315
|
+
The gateway may ignore responses after cancelling, as required by MCP.
|
|
316
|
+
|
|
317
|
+
## 8. Errors
|
|
318
|
+
|
|
319
|
+
Wire errors are local classifications, not a new RPC protocol. Do not
|
|
320
|
+
send unauthenticated errors in response to arbitrary network input.
|
|
321
|
+
|
|
322
|
+
| Wire code | Meaning |
|
|
323
|
+
| --- | --- |
|
|
324
|
+
| INVALID_MESSAGE | Unsupported or malformed record |
|
|
325
|
+
| LIMIT | Resource, size or ledger limit exceeded |
|
|
326
|
+
| AUTH_FAILED | Authentication, signature or owner mismatch |
|
|
327
|
+
| EXPIRED | Credential outside its validity interval |
|
|
328
|
+
| REPLAY | Reuse of a consumed identifier |
|
|
329
|
+
| FRAME_CONFLICT | Conflicting authenticated pieces |
|
|
330
|
+
| SESSION_CLOSED | Session is no longer accepting records |
|
|
331
|
+
|
|
332
|
+
| JSON-RPC code | Meaning |
|
|
333
|
+
| ---: | --- |
|
|
334
|
+
| -32700 | Invalid JSON |
|
|
335
|
+
| -32600 | Invalid request, including conflicting ID |
|
|
336
|
+
| -32601 | Unsupported method |
|
|
337
|
+
| -32602 | Invalid parameters, schema, cursor or unknown tool |
|
|
338
|
+
| -32603 | Internal error or invalid/oversized result |
|
|
339
|
+
| -32001 | Authorization or confirmation denied |
|
|
340
|
+
| -32002 | Busy (call/write limit) |
|
|
341
|
+
| -32003 | Deadline exceeded before execution |
|
|
342
|
+
| -32004 | Cancelled before execution |
|
|
343
|
+
| -32005 | Execution started, result unknown |
|
|
344
|
+
| -32006 | Session ledger exhausted (session renewal required) |
|
|
345
|
+
|
|
346
|
+
An exhausted session may close without an error response. Transport errors
|
|
347
|
+
are not tool results. Do not disclose secrets or raw internal exception
|
|
348
|
+
messages in errors.
|
|
349
|
+
|
|
350
|
+
## 9. Fixtures
|
|
351
|
+
|
|
352
|
+
`vectors/wire-v1.json` contains canonical JSON, tool names, boundary
|
|
353
|
+
splitting and signature-input fixtures. The framing fixture uses an
|
|
354
|
+
identity transformation solely to expose exact pre-encryption bytes;
|
|
355
|
+
it is not a secure channel.
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 1,
|
|
3
|
+
"canonical": [
|
|
4
|
+
{
|
|
5
|
+
"value": {
|
|
6
|
+
"z": [
|
|
7
|
+
true,
|
|
8
|
+
null,
|
|
9
|
+
1e-7
|
|
10
|
+
],
|
|
11
|
+
"a": "é",
|
|
12
|
+
"n": 1e+21
|
|
13
|
+
},
|
|
14
|
+
"expected": "{\"a\":\"é\",\"n\":1e+21,\"z\":[true,null,1e-7]}"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"value": {
|
|
18
|
+
"🦊": 1,
|
|
19
|
+
"": 2,
|
|
20
|
+
"b": 3
|
|
21
|
+
},
|
|
22
|
+
"expected": "{\"b\":3,\"🦊\":1,\"\":2}"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"value": {
|
|
26
|
+
"b": "\n",
|
|
27
|
+
"a": "\t"
|
|
28
|
+
},
|
|
29
|
+
"expected": "{\"a\":\"\\t\",\"b\":\"\\n\"}"
|
|
30
|
+
}
|
|
31
|
+
],
|
|
32
|
+
"framing": {
|
|
33
|
+
"utf8": "{\"x\":\"é\"}",
|
|
34
|
+
"sid": "01010101010101010101010101010101",
|
|
35
|
+
"mid": "02020202020202020202020202020202",
|
|
36
|
+
"frames": [
|
|
37
|
+
{
|
|
38
|
+
"v": 1,
|
|
39
|
+
"type": "mcp.frame",
|
|
40
|
+
"sid": "01010101010101010101010101010101",
|
|
41
|
+
"mid": "02020202020202020202020202020202",
|
|
42
|
+
"seq": 0,
|
|
43
|
+
"count": 1,
|
|
44
|
+
"size": 10,
|
|
45
|
+
"data": "eyJjb3VudCI6MSwibWlkIjoiMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIwMjAyMDIiLCJzZXEiOjAsInNpZCI6IjAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxMDEwMTAxIiwic2l6ZSI6MTAsInR5cGUiOiJtY3AuZnJhbWUiLCJ2IjoxfQp7IngiOiLDqSJ9"
|
|
46
|
+
}
|
|
47
|
+
]
|
|
48
|
+
},
|
|
49
|
+
"boundary": {
|
|
50
|
+
"repeatByte": 97,
|
|
51
|
+
"repeatCount": 12289,
|
|
52
|
+
"expected": [
|
|
53
|
+
{
|
|
54
|
+
"seq": 0,
|
|
55
|
+
"count": 2,
|
|
56
|
+
"size": 12289,
|
|
57
|
+
"chunkBytes": 12288
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"seq": 1,
|
|
61
|
+
"count": 2,
|
|
62
|
+
"size": 12289,
|
|
63
|
+
"chunkBytes": 1
|
|
64
|
+
}
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
"names": [
|
|
68
|
+
{
|
|
69
|
+
"name": "tc-note__list",
|
|
70
|
+
"valid": true
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"name": "tc-lingo__card_due",
|
|
74
|
+
"valid": true
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"name": "a___x",
|
|
78
|
+
"valid": true
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
"name": "A__get",
|
|
82
|
+
"valid": false
|
|
83
|
+
},
|
|
84
|
+
{
|
|
85
|
+
"name": "tc-note__foo__bar",
|
|
86
|
+
"valid": false
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"name": "tc-note__a/b",
|
|
90
|
+
"valid": false
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
"name": "tc-note__",
|
|
94
|
+
"valid": false
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
"name": "tc-note__aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
|
98
|
+
"valid": false
|
|
99
|
+
}
|
|
100
|
+
],
|
|
101
|
+
"ticket": {
|
|
102
|
+
"body": {
|
|
103
|
+
"id": "00112233445566778899aabbccddeeff",
|
|
104
|
+
"iss": "did:example:gateway",
|
|
105
|
+
"aud": "did:example:leaf",
|
|
106
|
+
"origin": "https://example.org",
|
|
107
|
+
"actions": [
|
|
108
|
+
"register"
|
|
109
|
+
],
|
|
110
|
+
"instance": "dev",
|
|
111
|
+
"epoch": 3,
|
|
112
|
+
"nbf": 1700000000,
|
|
113
|
+
"exp": 1700003600
|
|
114
|
+
},
|
|
115
|
+
"signingBytesHex": "5b226d6973742d6d63702f70726f76696465722f7631222c7b22616374696f6e73223a5b227265676973746572225d2c22617564223a226469643a6578616d706c653a6c656166222c2265706f6368223a332c22657870223a313730303030333630302c226964223a223030313132323333343435353636373738383939616162626363646465656666222c22696e7374616e6365223a22646576222c22697373223a226469643a6578616d706c653a67617465776179222c226e6266223a313730303030303030302c226f726967696e223a2268747470733a2f2f6578616d706c652e6f7267227d5d"
|
|
116
|
+
}
|
|
117
|
+
}
|