@integraledger/lcp-mcp-server 0.9.0 → 0.10.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/CHANGELOG.md +37 -0
- package/dist/tools/extract-reference.d.ts.map +1 -1
- package/dist/tools/extract-reference.js +18 -3
- package/dist/tools/extract-reference.js.map +1 -1
- package/dist/tools/place-reference.d.ts.map +1 -1
- package/dist/tools/place-reference.js +10 -1
- package/dist/tools/place-reference.js.map +1 -1
- package/package.json +11 -11
- package/src/tools/extract-reference.ts +20 -3
- package/src/tools/place-reference.ts +15 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,42 @@
|
|
|
1
1
|
# @integraledger/lcp-mcp-server
|
|
2
2
|
|
|
3
|
+
## 0.10.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- 06a25ac: Read the whole advertisement, and move to protocol 0.12.0.
|
|
8
|
+
|
|
9
|
+
The peer range was `^0.10.1`, which on a `0.x` version admits only patches — so this guard declared it did
|
|
10
|
+
not support the line every seller now writes, and a tree holding both resolved a second copy of the protocol
|
|
11
|
+
packages to satisfy it. The peers are `^0.12.0` and the build pins 0.12.0 exactly.
|
|
12
|
+
|
|
13
|
+
**The terms URL is no longer read by hand.** `PlacementManifest.termsUrlField` was singular and named one
|
|
14
|
+
path; it is now `termsUrlFields`, plural, and a slot that rides a container the placement owns is declared on
|
|
15
|
+
that container. Reading that by hand here would have been a second implementation of a manifest rule, so the
|
|
16
|
+
locator now comes from the placement's own `extract`, which reconciles every declared slot and refuses two
|
|
17
|
+
that disagree. The reference walk stays this package's own: "integrity carriers only" is a BUYER rule — a
|
|
18
|
+
discovery link locates a standing page and attests nothing — and the placement's reader does not apply it.
|
|
19
|
+
|
|
20
|
+
**`AdvertisedTermsUrl` loses a state, and could not keep it.** `undeclared-at-answering-carrier` existed
|
|
21
|
+
because the singular member could not reach the carrier a §C.4 challenge actually used: the hash answered
|
|
22
|
+
from `accepts[].extra` while the one declared path sat empty inside `extensions`, and reporting that as "no
|
|
23
|
+
terms advertised" would have asserted a silence this reader could not see. With every slot declared and
|
|
24
|
+
reconciled there is no such carrier, so the state is unreachable rather than merely unused, and the §C.4
|
|
25
|
+
challenge now simply reads its URL. `declared-field-empty` becomes `declared-fields-empty` and carries every
|
|
26
|
+
slot it looked at.
|
|
27
|
+
|
|
28
|
+
`lcp_place_reference` takes an optional `termsUrl` — required where the protocol declares a slot and the
|
|
29
|
+
reference is a digest, refused where it declares none — and `lcp_extract_reference` reports the locator
|
|
30
|
+
beside the reference, with its two absences distinguished: a protocol with no slot is not a seller who left
|
|
31
|
+
one empty.
|
|
32
|
+
|
|
33
|
+
Wire identities are unchanged apart from the protocol line itself.
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [06a25ac]
|
|
38
|
+
- @integraledger/agent-guard@0.10.0
|
|
39
|
+
|
|
3
40
|
## 0.9.0
|
|
4
41
|
|
|
5
42
|
**First public release** — Apache-2.0, free forever, no account and no token to install.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extract-reference.d.ts","sourceRoot":"","sources":["../../src/tools/extract-reference.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAS9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"extract-reference.d.ts","sourceRoot":"","sources":["../../src/tools/extract-reference.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAS9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAkC/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,WAAW,GACjB,IAAI,CAuCN"}
|
|
@@ -17,6 +17,16 @@ const outputSchema = z.object({
|
|
|
17
17
|
.describe("The LCP §8.1 carrier string recovered from the document."),
|
|
18
18
|
type: z.string().describe("The §8.2 carrier type, e.g. `sha256`."),
|
|
19
19
|
value: z.string().describe("The carrier value, e.g. the 0x ATR hash."),
|
|
20
|
+
termsUrl: z
|
|
21
|
+
.discriminatedUnion("kind", [
|
|
22
|
+
z.object({ kind: z.literal("read"), url: z.string() }),
|
|
23
|
+
z.object({ kind: z.literal("no-field-declared") }),
|
|
24
|
+
z.object({
|
|
25
|
+
kind: z.literal("declared-fields-empty"),
|
|
26
|
+
fields: z.array(z.string()),
|
|
27
|
+
}),
|
|
28
|
+
])
|
|
29
|
+
.describe("Where the document says its terms live. The absences are DISTINCT and both are answers: `no-field-declared` is a fact about the PROTOCOL — it has no slot for a locator — while `declared-fields-empty` is a fact about this DOCUMENT, whose seller left every declared slot empty. Collapsing them would report a seller's silence as a protocol's."),
|
|
20
30
|
placement: PLACEMENT_SUMMARY_SCHEMA,
|
|
21
31
|
});
|
|
22
32
|
/**
|
|
@@ -48,10 +58,15 @@ export function registerExtractReference(server, ports) {
|
|
|
48
58
|
const outcome = adapter.extract(args.document);
|
|
49
59
|
if (!("ok" in outcome))
|
|
50
60
|
return refusalResult(outcome);
|
|
61
|
+
// `extract` answers with the whole advertisement — the reference, and what the document says about
|
|
62
|
+
// where its terms live. The locator's ABSENCE is typed, so the reader is told whether the protocol
|
|
63
|
+
// has no slot at all or the seller left a declared one empty.
|
|
64
|
+
const { ref, termsUrl } = outcome.value;
|
|
51
65
|
const out = {
|
|
52
|
-
reference: encodeLegalContextString(
|
|
53
|
-
type:
|
|
54
|
-
value:
|
|
66
|
+
reference: encodeLegalContextString(ref),
|
|
67
|
+
type: ref.type,
|
|
68
|
+
value: ref.value,
|
|
69
|
+
termsUrl,
|
|
55
70
|
placement: manifestSummary(adapter.manifest),
|
|
56
71
|
};
|
|
57
72
|
return {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"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nG,8DAA8D;QAC9D,MAAM,EAAE,GAAG,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAC,KAAK,CAAC;QACxC,MAAM,GAAG,GAAG;YACV,SAAS,EAAE,wBAAwB,CAAC,GAAG,CAAC;YACxC,IAAI,EAAE,GAAG,CAAC,IAAI;YACd,KAAK,EAAE,GAAG,CAAC,KAAK;YAChB,QAAQ;YACR,SAAS,EAAE,eAAe,CAAC,OAAO,CAAC,QAAQ,CAAC;SAC7C,CAAC;QACF,OAAO;YACL,OAAO,EAAE;gBACP,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE;aAC9D;YACD,iBAAiB,EAAE,GAAG;SACvB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-reference.d.ts","sourceRoot":"","sources":["../../src/tools/place-reference.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAS9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"place-reference.d.ts","sourceRoot":"","sources":["../../src/tools/place-reference.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AAS9D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAkC/C;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,sBAAsB,CACpC,MAAM,EAAE,SAAS,EACjB,KAAK,EAAE,WAAW,GACjB,IAAI,CA8CN"}
|
|
@@ -12,6 +12,10 @@ const inputSchema = z.object({
|
|
|
12
12
|
reference: z
|
|
13
13
|
.string()
|
|
14
14
|
.describe("The LCP §8.1 carrier string, `lcp:{type}:{value}` — exactly what `lcp_compute_atrhash` returns as `reference`."),
|
|
15
|
+
termsUrl: z
|
|
16
|
+
.string()
|
|
17
|
+
.optional()
|
|
18
|
+
.describe("Where the terms document the reference identifies can be fetched — `https://` only. REQUIRED where the protocol declares a slot for it and the reference is a digest: a hash no counterparty can resolve is unverifiable to anyone who does not already hold the terms, so the placement refuses one. Where the protocol declares no slot, supplying it is refused rather than silently dropped."),
|
|
15
19
|
document: documentShape.describe("The host protocol's own document, as JSON. Returned unchanged with the reference added; the input is never mutated."),
|
|
16
20
|
});
|
|
17
21
|
const outputSchema = z.object({
|
|
@@ -48,7 +52,12 @@ export function registerPlaceReference(server, ports) {
|
|
|
48
52
|
const ref = decodeLegalContextString(args.reference);
|
|
49
53
|
if (ref === undefined)
|
|
50
54
|
throw new Error(`"${args.reference}" is not a recognized LCP §8.1 carrier string — expected lcp:{type}:{value} with a registered type`);
|
|
51
|
-
|
|
55
|
+
// An ADVERTISEMENT: the reference, and — where the protocol has room for one — the locator. Passed
|
|
56
|
+
// through by omission rather than as an explicit `undefined`, because the manifest decides which of
|
|
57
|
+
// the two refusals an incomplete one earns.
|
|
58
|
+
const outcome = adapter.place(args.termsUrl === undefined
|
|
59
|
+
? { ref }
|
|
60
|
+
: { ref, termsUrl: args.termsUrl }, args.document);
|
|
52
61
|
if (!("ok" in outcome))
|
|
53
62
|
return refusalResult(outcome);
|
|
54
63
|
// `place` is typed `Outcome<unknown>` because a host document is whatever the host protocol says it
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"place-reference.js","sourceRoot":"","sources":["../../src/tools/place-reference.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,wBAAwB,EAAE,MAAM,iCAAiC,CAAC;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,+BAA+B,CAAC;AAEnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EACL,eAAe,EACf,wBAAwB,EACxB,aAAa,EACb,cA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AC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@integraledger/lcp-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": {
|
|
@@ -28,18 +28,18 @@
|
|
|
28
28
|
"directory": "packages/lcp-mcp-server"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@integraledger/lcp-authority": "0.
|
|
32
|
-
"@integraledger/lcp-binding-core": "0.
|
|
33
|
-
"@integraledger/lcp-discovery": "0.
|
|
34
|
-
"@integraledger/lcp-evidence": "0.
|
|
35
|
-
"@integraledger/lcp-kernel": "0.
|
|
36
|
-
"@integraledger/lcp-placement-ack": "0.
|
|
37
|
-
"@integraledger/lcp-placement-ap2": "0.
|
|
38
|
-
"@integraledger/lcp-placements": "0.
|
|
39
|
-
"@integraledger/lcp-verify": "0.
|
|
31
|
+
"@integraledger/lcp-authority": "0.12.0",
|
|
32
|
+
"@integraledger/lcp-binding-core": "0.12.0",
|
|
33
|
+
"@integraledger/lcp-discovery": "0.12.0",
|
|
34
|
+
"@integraledger/lcp-evidence": "0.12.0",
|
|
35
|
+
"@integraledger/lcp-kernel": "0.12.0",
|
|
36
|
+
"@integraledger/lcp-placement-ack": "0.12.0",
|
|
37
|
+
"@integraledger/lcp-placement-ap2": "0.12.0",
|
|
38
|
+
"@integraledger/lcp-placements": "0.12.0",
|
|
39
|
+
"@integraledger/lcp-verify": "0.12.0",
|
|
40
40
|
"@modelcontextprotocol/server": "2.0.0",
|
|
41
41
|
"zod": "4.4.3",
|
|
42
|
-
"@integraledger/agent-guard": "0.
|
|
42
|
+
"@integraledger/agent-guard": "0.10.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"@modelcontextprotocol/client": "2.0.0",
|
|
@@ -28,6 +28,18 @@ const outputSchema = z.object({
|
|
|
28
28
|
.describe("The LCP §8.1 carrier string recovered from the document."),
|
|
29
29
|
type: z.string().describe("The §8.2 carrier type, e.g. `sha256`."),
|
|
30
30
|
value: z.string().describe("The carrier value, e.g. the 0x ATR hash."),
|
|
31
|
+
termsUrl: z
|
|
32
|
+
.discriminatedUnion("kind", [
|
|
33
|
+
z.object({ kind: z.literal("read"), url: z.string() }),
|
|
34
|
+
z.object({ kind: z.literal("no-field-declared") }),
|
|
35
|
+
z.object({
|
|
36
|
+
kind: z.literal("declared-fields-empty"),
|
|
37
|
+
fields: z.array(z.string()),
|
|
38
|
+
}),
|
|
39
|
+
])
|
|
40
|
+
.describe(
|
|
41
|
+
"Where the document says its terms live. The absences are DISTINCT and both are answers: `no-field-declared` is a fact about the PROTOCOL — it has no slot for a locator — while `declared-fields-empty` is a fact about this DOCUMENT, whose seller left every declared slot empty. Collapsing them would report a seller's silence as a protocol's.",
|
|
42
|
+
),
|
|
31
43
|
placement: PLACEMENT_SUMMARY_SCHEMA,
|
|
32
44
|
});
|
|
33
45
|
|
|
@@ -69,10 +81,15 @@ export function registerExtractReference(
|
|
|
69
81
|
const adapter = resolveAdapter(args.protocol, ports);
|
|
70
82
|
const outcome = adapter.extract(args.document);
|
|
71
83
|
if (!("ok" in outcome)) return refusalResult(outcome);
|
|
84
|
+
// `extract` answers with the whole advertisement — the reference, and what the document says about
|
|
85
|
+
// where its terms live. The locator's ABSENCE is typed, so the reader is told whether the protocol
|
|
86
|
+
// has no slot at all or the seller left a declared one empty.
|
|
87
|
+
const { ref, termsUrl } = outcome.value;
|
|
72
88
|
const out = {
|
|
73
|
-
reference: encodeLegalContextString(
|
|
74
|
-
type:
|
|
75
|
-
value:
|
|
89
|
+
reference: encodeLegalContextString(ref),
|
|
90
|
+
type: ref.type,
|
|
91
|
+
value: ref.value,
|
|
92
|
+
termsUrl,
|
|
76
93
|
placement: manifestSummary(adapter.manifest),
|
|
77
94
|
};
|
|
78
95
|
return {
|
|
@@ -25,6 +25,12 @@ const inputSchema = z.object({
|
|
|
25
25
|
.describe(
|
|
26
26
|
"The LCP §8.1 carrier string, `lcp:{type}:{value}` — exactly what `lcp_compute_atrhash` returns as `reference`.",
|
|
27
27
|
),
|
|
28
|
+
termsUrl: z
|
|
29
|
+
.string()
|
|
30
|
+
.optional()
|
|
31
|
+
.describe(
|
|
32
|
+
"Where the terms document the reference identifies can be fetched — `https://` only. REQUIRED where the protocol declares a slot for it and the reference is a digest: a hash no counterparty can resolve is unverifiable to anyone who does not already hold the terms, so the placement refuses one. Where the protocol declares no slot, supplying it is refused rather than silently dropped.",
|
|
33
|
+
),
|
|
28
34
|
document: documentShape.describe(
|
|
29
35
|
"The host protocol's own document, as JSON. Returned unchanged with the reference added; the input is never mutated.",
|
|
30
36
|
),
|
|
@@ -76,7 +82,15 @@ export function registerPlaceReference(
|
|
|
76
82
|
throw new Error(
|
|
77
83
|
`"${args.reference}" is not a recognized LCP §8.1 carrier string — expected lcp:{type}:{value} with a registered type`,
|
|
78
84
|
);
|
|
79
|
-
|
|
85
|
+
// An ADVERTISEMENT: the reference, and — where the protocol has room for one — the locator. Passed
|
|
86
|
+
// through by omission rather than as an explicit `undefined`, because the manifest decides which of
|
|
87
|
+
// the two refusals an incomplete one earns.
|
|
88
|
+
const outcome = adapter.place(
|
|
89
|
+
args.termsUrl === undefined
|
|
90
|
+
? { ref }
|
|
91
|
+
: { ref, termsUrl: args.termsUrl },
|
|
92
|
+
args.document,
|
|
93
|
+
);
|
|
80
94
|
if (!("ok" in outcome)) return refusalResult(outcome);
|
|
81
95
|
// `place` is typed `Outcome<unknown>` because a host document is whatever the host protocol says it
|
|
82
96
|
// is. Parsing rather than casting keeps the widening honest: an adapter that somehow returned a
|