@integraledger/lcp-mcp-server 0.9.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 +40 -0
- package/LICENSE +202 -0
- package/NOTICE +16 -0
- package/README.md +121 -0
- package/dist/annotations.d.ts +41 -0
- package/dist/annotations.d.ts.map +1 -0
- package/dist/annotations.js +41 -0
- package/dist/annotations.js.map +1 -0
- package/dist/bin.d.ts +3 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +5 -0
- package/dist/bin.js.map +1 -0
- package/dist/dispatch.d.ts +53 -0
- package/dist/dispatch.d.ts.map +1 -0
- package/dist/dispatch.js +81 -0
- package/dist/dispatch.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/node-ports.d.ts +21 -0
- package/dist/node-ports.d.ts.map +1 -0
- package/dist/node-ports.js +33 -0
- package/dist/node-ports.js.map +1 -0
- package/dist/ports.d.ts +23 -0
- package/dist/ports.d.ts.map +1 -0
- package/dist/ports.js +2 -0
- package/dist/ports.js.map +1 -0
- package/dist/server.d.ts +45 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +67 -0
- package/dist/server.js.map +1 -0
- package/dist/stdio.d.ts +15 -0
- package/dist/stdio.d.ts.map +1 -0
- package/dist/stdio.js +17 -0
- package/dist/stdio.js.map +1 -0
- package/dist/tools/compute-atrhash.d.ts +15 -0
- package/dist/tools/compute-atrhash.d.ts.map +1 -0
- package/dist/tools/compute-atrhash.js +66 -0
- package/dist/tools/compute-atrhash.js.map +1 -0
- package/dist/tools/extract-reference.d.ts +19 -0
- package/dist/tools/extract-reference.d.ts.map +1 -0
- package/dist/tools/extract-reference.js +65 -0
- package/dist/tools/extract-reference.js.map +1 -0
- package/dist/tools/generate-legal-context.d.ts +20 -0
- package/dist/tools/generate-legal-context.d.ts.map +1 -0
- package/dist/tools/generate-legal-context.js +99 -0
- package/dist/tools/generate-legal-context.js.map +1 -0
- package/dist/tools/place-reference.d.ts +19 -0
- package/dist/tools/place-reference.d.ts.map +1 -0
- package/dist/tools/place-reference.js +69 -0
- package/dist/tools/place-reference.js.map +1 -0
- package/dist/tools/scaffold-integration.d.ts +15 -0
- package/dist/tools/scaffold-integration.d.ts.map +1 -0
- package/dist/tools/scaffold-integration.js +168 -0
- package/dist/tools/scaffold-integration.js.map +1 -0
- package/dist/tools/verify-before-pay.d.ts +29 -0
- package/dist/tools/verify-before-pay.d.ts.map +1 -0
- package/dist/tools/verify-before-pay.js +158 -0
- package/dist/tools/verify-before-pay.js.map +1 -0
- package/dist/version.d.ts +25 -0
- package/dist/version.d.ts.map +1 -0
- package/dist/version.js +37 -0
- package/dist/version.js.map +1 -0
- package/dist/well-known.d.ts +33 -0
- package/dist/well-known.d.ts.map +1 -0
- package/dist/well-known.js +45 -0
- package/dist/well-known.js.map +1 -0
- package/package.json +73 -0
- package/src/annotations.ts +53 -0
- package/src/bin.ts +5 -0
- package/src/dispatch.ts +122 -0
- package/src/index.ts +15 -0
- package/src/node-ports.ts +38 -0
- package/src/ports.ts +23 -0
- package/src/server.ts +70 -0
- package/src/stdio.ts +25 -0
- package/src/tools/compute-atrhash.ts +87 -0
- package/src/tools/extract-reference.ts +86 -0
- package/src/tools/generate-legal-context.ts +127 -0
- package/src/tools/place-reference.ts +96 -0
- package/src/tools/scaffold-integration.ts +183 -0
- package/src/tools/verify-before-pay.ts +194 -0
- package/src/version.ts +42 -0
- package/src/well-known.ts +51 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @integraledger/lcp-mcp-server
|
|
2
|
+
|
|
3
|
+
## 0.9.0
|
|
4
|
+
|
|
5
|
+
**First public release** — Apache-2.0, free forever, no account and no token to install.
|
|
6
|
+
|
|
7
|
+
`lcp-mcp-server` exposes read-only Legal Context Protocol tools to an AI agent over the Model Context
|
|
8
|
+
Protocol: verify before pay, compute an atrHash, and extract or place a terms reference across the nine
|
|
9
|
+
commerce protocols that have a defined placement.
|
|
10
|
+
|
|
11
|
+
### Six tools, all read-only
|
|
12
|
+
|
|
13
|
+
`lcp_verify_before_pay` · `lcp_compute_atrhash` · `lcp_extract_reference` · `lcp_place_reference` ·
|
|
14
|
+
`lcp_generate_legal_context` · `lcp_scaffold_integration`
|
|
15
|
+
|
|
16
|
+
Every tool declares `readOnlyHint` to the host. The annotations are stated rather than omitted because
|
|
17
|
+
MCP documents `destructiveHint` and `openWorldHint` as defaulting to **true** — an unannotated tool reads
|
|
18
|
+
to a client as possibly destructive and open to an arbitrary external world, which is the most alarming
|
|
19
|
+
reading available and not the honest one for this surface.
|
|
20
|
+
|
|
21
|
+
The **only** network egress is the counterparty terms fetch, and it goes through the same injected,
|
|
22
|
+
SSRF-guarded port the guard uses: HTTPS-only, no redirects, public-unicast re-checked on every fetch, and
|
|
23
|
+
a streaming byte cap. Nothing calls home.
|
|
24
|
+
|
|
25
|
+
### Wiring
|
|
26
|
+
|
|
27
|
+
Stdio transport for desktop agent hosts, served so that both current and `2026-07-28` clients resolve
|
|
28
|
+
correctly from one registration. Built against the live MCP `ToolAnnotations` definition
|
|
29
|
+
(`schema/2026-07-28/schema.ts`); the specification check behind that date is recorded in this package's
|
|
30
|
+
README.
|
|
31
|
+
|
|
32
|
+
### Packaging
|
|
33
|
+
|
|
34
|
+
- Apache-2.0. LICENSE and NOTICE ship in the tarball; NOTICE states the trademark reservation, names
|
|
35
|
+
Integra Ledger and AAA-ICDR as the Legal Context Protocol's co-stewards, and records that the
|
|
36
|
+
seller-side application is separately licensed and not part of this distribution.
|
|
37
|
+
- Consumed as a runnable server over `npx`, so the `@integraledger/lcp-*` protocol line and
|
|
38
|
+
`@integraledger/agent-guard` are ordinary exact dependencies — there is no second line for it to
|
|
39
|
+
collide with.
|
|
40
|
+
- `files` ships `src` alongside `dist`, so published source maps resolve inside the tarball.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
package/NOTICE
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Integra LCP MCP Server
|
|
2
|
+
Copyright 2026 Integra Ledger
|
|
3
|
+
|
|
4
|
+
This product includes software developed by Integra Ledger (https://integraledger.com).
|
|
5
|
+
|
|
6
|
+
"Integra", "Integra Ledger", and the Integra logo are trademarks of Integra Ledger.
|
|
7
|
+
Trademark use is not granted by the Apache License 2.0 (see Section 6).
|
|
8
|
+
|
|
9
|
+
The Legal Context Protocol is co-stewarded by Integra Ledger and AAA-ICDR. This package exposes
|
|
10
|
+
read-only LCP tools over the Model Context Protocol and is published free under the Apache License 2.0;
|
|
11
|
+
the specification itself is published at https://legalcontextprotocol.org/standard and is not part of
|
|
12
|
+
this distribution.
|
|
13
|
+
|
|
14
|
+
Its tools read and verify documents served by ANY party, whether or not that party uses Integra
|
|
15
|
+
software. The seller-side application referenced in the scaffolding output is separately licensed and is
|
|
16
|
+
not part of this distribution.
|
package/README.md
ADDED
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
# @integraledger/lcp-mcp-server
|
|
2
|
+
|
|
3
|
+
The LCP delivery surface for MCP. An agent host that already speaks the Model Context Protocol gains
|
|
4
|
+
legal-context capability with no per-platform integration — and the same server works whichever commerce
|
|
5
|
+
protocol the agent is transacting under, because where the reference belongs is the placement registry's
|
|
6
|
+
decision, not this server's.
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @integraledger/lcp-mcp-server
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
> **Free and open source (Apache-2.0). No account, no key, no token, nothing to sign up for.**
|
|
13
|
+
>
|
|
14
|
+
> Every tool is **read-only** and works against **any** counterparty's documents — whether or not they use
|
|
15
|
+
> Integra software. Nothing here calls home: no telemetry, no callback.
|
|
16
|
+
|
|
17
|
+
Run it over stdio, which is what every desktop agent host speaks:
|
|
18
|
+
|
|
19
|
+
```jsonc
|
|
20
|
+
// .mcp.json
|
|
21
|
+
{
|
|
22
|
+
"mcpServers": {
|
|
23
|
+
"lcp": { "command": "npx", "args": ["-y", "@integraledger/lcp-mcp-server"] }
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Or mount it yourself, supplying the ports:
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import {
|
|
32
|
+
createLcpMcpServer,
|
|
33
|
+
nodePorts,
|
|
34
|
+
serveLcpStdio,
|
|
35
|
+
} from "@integraledger/lcp-mcp-server";
|
|
36
|
+
|
|
37
|
+
const ports = nodePorts(process.env);
|
|
38
|
+
|
|
39
|
+
serveLcpStdio(ports); // stdio, ports wired for Node
|
|
40
|
+
const server = createLcpMcpServer(ports); // or build one and connect any MCP transport
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## The tools
|
|
44
|
+
|
|
45
|
+
| Tool | What it does |
|
|
46
|
+
|---|---|
|
|
47
|
+
| `lcp_compute_atrhash` | SHA-256 over terms bytes (inline or fetched) → `atrHash` and the `lcp:sha256:0x…` carrier |
|
|
48
|
+
| `lcp_generate_legal_context` | Builds a validated, ready-to-publish `/.well-known/legal-context.json` |
|
|
49
|
+
| `lcp_verify_before_pay` | Verify before sign (LCP §5.3): fetch, recompute, compare, and say whether an agent must halt |
|
|
50
|
+
| `lcp_scaffold_integration` | Starter code for the seller side or the buyer side |
|
|
51
|
+
| `lcp_place_reference` | Puts a reference into any registered commerce protocol's own document |
|
|
52
|
+
| `lcp_extract_reference` | Reads one back out |
|
|
53
|
+
|
|
54
|
+
**These `lcp_*` names are stable.** LCP v1.38 §C.9 illustrates a different vocabulary
|
|
55
|
+
(`get_legal_context`, `verify_terms`, …) and says in the same breath that the standard canonizes no tool
|
|
56
|
+
registry. Names a deployed server already answers to are the stronger interoperability fact, so renaming
|
|
57
|
+
them to match an appendix's example would break working integrations and make nothing canonical.
|
|
58
|
+
|
|
59
|
+
**There is no `create_agreement`, `accept_terms`, `initiate_dispute` or `get_dispute_status`, and there will
|
|
60
|
+
not be.** §C.9's table lists all four. Each asserts a custodian or forum role: holding the agreement record,
|
|
61
|
+
recording the acceptance, running the dispute. Integra is the record engine; the custodian and the forum are
|
|
62
|
+
the deployment's and the counterparties' own. A test asserts their absence.
|
|
63
|
+
|
|
64
|
+
Every tool **reads**. Nothing here publishes a document, transmits one, or holds a credential:
|
|
65
|
+
`lcp_generate_legal_context` returns a document for you to serve, and `lcp_place_reference` returns a
|
|
66
|
+
document for your agent to send with its own keys.
|
|
67
|
+
|
|
68
|
+
## Ports
|
|
69
|
+
|
|
70
|
+
`LcpMcpPorts` has no defaults, and both entries are the reason:
|
|
71
|
+
|
|
72
|
+
- **`fetcher`** — `agent-guard`'s `makeCachingFetcher`: HTTPS-only, `redirect: "error"`, every resolved
|
|
73
|
+
address checked public unicast on *every* network fetch, body capped while streaming, LCP §2.6 cache
|
|
74
|
+
discipline. The URLs this server fetches are chosen by a counterparty, so bare `fetch` here would turn
|
|
75
|
+
`lcp_verify_before_pay` into an SSRF primitive an agent can be talked into aiming anywhere.
|
|
76
|
+
- **`deployment.reverseDomain`** — optional, and absent by default. Only namespaced placements need it
|
|
77
|
+
(Mastercard VI's custom Layer-2 constraint type). LCP §8 canonizes no per-protocol integration profile, so
|
|
78
|
+
a default would write *our* domain into someone else's signed document. Set `LCP_MCP_REVERSE_DOMAIN` and
|
|
79
|
+
`nodePorts` passes it through.
|
|
80
|
+
|
|
81
|
+
## One protocol line in the tree
|
|
82
|
+
|
|
83
|
+
Every `@integraledger/*` package pins its own dependencies **exactly**, so a published version states the
|
|
84
|
+
protocol line it was cut against and cannot be argued out of it. This server and `agent-guard` release
|
|
85
|
+
against the same `@integraledger/lcp-*` line, so installing this puts **one** line of the protocol packages
|
|
86
|
+
in `node_modules`. If a mixed install ever puts two lines in one tree — exact pinning makes that expected
|
|
87
|
+
rather than pathological — the seam stays safe: what this package takes from `agent-guard` is the fetcher
|
|
88
|
+
and nothing else — `makeCachingFetcher`, `nodeDnsLookup`, and the `TermsFetcher` type — whose entire
|
|
89
|
+
vocabulary is `fetch(url: string)` in, `{ bytes, format, fetchedAt }` out, plus a `{ address, family }` DNS
|
|
90
|
+
answer. Not one of those names an `lcp-kernel`, `lcp-binding-core` or `lcp-discovery` type in either
|
|
91
|
+
direction, so two lines never exchange a value.
|
|
92
|
+
|
|
93
|
+
## Checked against the live MCP specification — 2026-07-30
|
|
94
|
+
|
|
95
|
+
Checked against the **live MCP specification**, revision `2026-07-28`, not against LCP's Appendix C.
|
|
96
|
+
|
|
97
|
+
| Checked | Source | Finding |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| Tool registration | `modelcontextprotocol.io/specification/2026-07-28/server/tools` | `tools/list` + `tools/call`; a server supporting tools MUST declare the capability; tool names SHOULD be `[A-Za-z0-9_.-]`, 1–128 chars, unique per server. `lcp_*` conforms. |
|
|
100
|
+
| Annotation semantics | `schema/2026-07-28/schema.ts`, `ToolAnnotations` | **Defaults are `readOnlyHint: false`, `destructiveHint: true`, `idempotentHint: false`, `openWorldHint: true`.** `destructiveHint` is "meaningful only when `readOnlyHint == false`". |
|
|
101
|
+
| Trust posture | same page, Data Types → Tool | "clients **MUST** consider tool annotations to be untrusted unless they come from trusted servers". |
|
|
102
|
+
| Result shape | same page, Tool Result | Structured results conform to `outputSchema` when declared; a tool returning structured content SHOULD also return the serialized JSON in a text block. Business-logic failures are `isError: true` in the result, not JSON-RPC errors. |
|
|
103
|
+
| SDK | `@modelcontextprotocol/server@2.0.0`, published 2026-07-27T23:55Z | v2 is the stable line implementing this revision; v1's monolithic `@modelcontextprotocol/sdk` is superseded. Age checked against the workspace's 24h `minimumReleaseAge` on 2026-07-30 — clear. The quarantine exclusion covers `@integraledger/*` only. |
|
|
104
|
+
|
|
105
|
+
**One finding corrects the plan.** LCP §C.9 says annotations "such as `destructiveHint` and `openWorldHint`
|
|
106
|
+
signal that LCP-aware tools perform legally significant actions". MCP defines `destructiveHint` as *may
|
|
107
|
+
perform destructive updates to its environment* — there is no annotation meaning "legally significant", and
|
|
108
|
+
repurposing one would assert something no client can read. Every tool here is therefore
|
|
109
|
+
`readOnlyHint: true`, `destructiveHint: false`, `idempotentHint: true`, with `openWorldHint` true for
|
|
110
|
+
exactly the three that fetch. The legal significance is carried where a client *does* read it: in each
|
|
111
|
+
tool's `description`. Stating `destructiveHint: false` rather than omitting it is load-bearing — the default
|
|
112
|
+
is `true`, so silence would describe every one of these as possibly destructive.
|
|
113
|
+
|
|
114
|
+
**One finding narrows a tool.** A verifier that reads an ES256 `signing` block out of
|
|
115
|
+
`legal-context.json` is reading a field LCP does not define — Level 3 is the *buyer's* signed acceptance over the
|
|
116
|
+
fingerprint (§3, §4.2), and the discovery document carries no seller signature at any level. Re-grounding on
|
|
117
|
+
`@integraledger/lcp-discovery` drops it, because promoting it would have shipped a private extension as LCP.
|
|
118
|
+
`lcp_verify_before_pay` also inherits DSC-2's machine-readable-format rule, so a `pdf` listing is reported
|
|
119
|
+
`unverifiable` rather than passed through.
|
|
120
|
+
|
|
121
|
+
Part of [Integra Agent Guard](https://github.com/IntegraLedger/integra-agent-guard).
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ToolAnnotations } from "@modelcontextprotocol/server";
|
|
2
|
+
/**
|
|
3
|
+
* Does the tool reach outside this process?
|
|
4
|
+
*
|
|
5
|
+
* The ONLY axis on which this server's tools differ. Everything here reads; nothing writes, publishes,
|
|
6
|
+
* files, or settles — see the mandate boundary in `server.ts`.
|
|
7
|
+
*/
|
|
8
|
+
export type ToolReach = "network" | "closed";
|
|
9
|
+
/**
|
|
10
|
+
* The annotations every tool on this server carries, per the LIVE MCP `ToolAnnotations` definition
|
|
11
|
+
* (`schema/2026-07-28/schema.ts`, read 2026-07-30; the specification check behind that date is recorded in
|
|
12
|
+
* this package's README).
|
|
13
|
+
*
|
|
14
|
+
* THE DEFAULTS ARE WHY THESE ARE STATED RATHER THAN OMITTED. MCP documents `destructiveHint` as
|
|
15
|
+
* **`Default: true`** and `openWorldHint` as **`Default: true`**, with `readOnlyHint` and `idempotentHint`
|
|
16
|
+
* defaulting to `false`. An unannotated tool therefore reads to a client as *possibly destructive, possibly
|
|
17
|
+
* non-idempotent, open to an arbitrary external world* — the most alarming reading available. Every value
|
|
18
|
+
* below is the honest one for a surface that computes, fetches and reads, so stating them is not decoration:
|
|
19
|
+
* omission would actively misdescribe the tools.
|
|
20
|
+
*
|
|
21
|
+
* THIS IS ALSO WHERE LCP's APPENDIX C IS AN ILLUSTRATION AND THE HOST PROTOCOL BINDS. LCP v1.38 §C.9
|
|
22
|
+
* says tool annotations "such as `destructiveHint` and `openWorldHint` signal that LCP-aware tools perform
|
|
23
|
+
* legally significant actions". MCP's own definition says something narrower and different:
|
|
24
|
+
* `destructiveHint` means "the tool may perform destructive updates to **its environment**", and it is
|
|
25
|
+
* "meaningful only when `readOnlyHint == false`". There is no MCP annotation that means "legally
|
|
26
|
+
* significant", and repurposing one to imply it would be an assertion MCP's clients cannot read. So the
|
|
27
|
+
* annotations here say what MCP defines them to say — `destructiveHint: false`, because none of these tools
|
|
28
|
+
* updates anything — and the legal significance is carried where a client can actually read it: in each
|
|
29
|
+
* tool's `description`.
|
|
30
|
+
*
|
|
31
|
+
* `destructiveHint: false` is stated even though `readOnlyHint: true` makes it formally not-meaningful. The
|
|
32
|
+
* spec says the property is meaningful only when `readOnlyHint === false`; it does not require a client to
|
|
33
|
+
* consult `readOnlyHint` first, and a client that reads `annotations.destructiveHint` directly would
|
|
34
|
+
* otherwise inherit the `true` default. Stating it closes that read at no cost.
|
|
35
|
+
*
|
|
36
|
+
* A last honesty note that belongs in the code rather than only in a doc: MCP requires clients to
|
|
37
|
+
* "consider tool annotations to be untrusted unless they come from trusted servers". These are hints a
|
|
38
|
+
* server asserts about itself. They are not a security control and nothing here treats them as one.
|
|
39
|
+
*/
|
|
40
|
+
export declare function readOnlyToolAnnotations(title: string, reach: ToolReach): ToolAnnotations;
|
|
41
|
+
//# sourceMappingURL=annotations.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.d.ts","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;GAKG;AACH,MAAM,MAAM,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;AAE7C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,SAAS,GACf,eAAe,CAQjB"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The annotations every tool on this server carries, per the LIVE MCP `ToolAnnotations` definition
|
|
3
|
+
* (`schema/2026-07-28/schema.ts`, read 2026-07-30; the specification check behind that date is recorded in
|
|
4
|
+
* this package's README).
|
|
5
|
+
*
|
|
6
|
+
* THE DEFAULTS ARE WHY THESE ARE STATED RATHER THAN OMITTED. MCP documents `destructiveHint` as
|
|
7
|
+
* **`Default: true`** and `openWorldHint` as **`Default: true`**, with `readOnlyHint` and `idempotentHint`
|
|
8
|
+
* defaulting to `false`. An unannotated tool therefore reads to a client as *possibly destructive, possibly
|
|
9
|
+
* non-idempotent, open to an arbitrary external world* — the most alarming reading available. Every value
|
|
10
|
+
* below is the honest one for a surface that computes, fetches and reads, so stating them is not decoration:
|
|
11
|
+
* omission would actively misdescribe the tools.
|
|
12
|
+
*
|
|
13
|
+
* THIS IS ALSO WHERE LCP's APPENDIX C IS AN ILLUSTRATION AND THE HOST PROTOCOL BINDS. LCP v1.38 §C.9
|
|
14
|
+
* says tool annotations "such as `destructiveHint` and `openWorldHint` signal that LCP-aware tools perform
|
|
15
|
+
* legally significant actions". MCP's own definition says something narrower and different:
|
|
16
|
+
* `destructiveHint` means "the tool may perform destructive updates to **its environment**", and it is
|
|
17
|
+
* "meaningful only when `readOnlyHint == false`". There is no MCP annotation that means "legally
|
|
18
|
+
* significant", and repurposing one to imply it would be an assertion MCP's clients cannot read. So the
|
|
19
|
+
* annotations here say what MCP defines them to say — `destructiveHint: false`, because none of these tools
|
|
20
|
+
* updates anything — and the legal significance is carried where a client can actually read it: in each
|
|
21
|
+
* tool's `description`.
|
|
22
|
+
*
|
|
23
|
+
* `destructiveHint: false` is stated even though `readOnlyHint: true` makes it formally not-meaningful. The
|
|
24
|
+
* spec says the property is meaningful only when `readOnlyHint === false`; it does not require a client to
|
|
25
|
+
* consult `readOnlyHint` first, and a client that reads `annotations.destructiveHint` directly would
|
|
26
|
+
* otherwise inherit the `true` default. Stating it closes that read at no cost.
|
|
27
|
+
*
|
|
28
|
+
* A last honesty note that belongs in the code rather than only in a doc: MCP requires clients to
|
|
29
|
+
* "consider tool annotations to be untrusted unless they come from trusted servers". These are hints a
|
|
30
|
+
* server asserts about itself. They are not a security control and nothing here treats them as one.
|
|
31
|
+
*/
|
|
32
|
+
export function readOnlyToolAnnotations(title, reach) {
|
|
33
|
+
return {
|
|
34
|
+
title,
|
|
35
|
+
readOnlyHint: true,
|
|
36
|
+
destructiveHint: false,
|
|
37
|
+
idempotentHint: true,
|
|
38
|
+
openWorldHint: reach === "network",
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=annotations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"annotations.js","sourceRoot":"","sources":["../src/annotations.ts"],"names":[],"mappings":"AAUA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,UAAU,uBAAuB,CACrC,KAAa,EACb,KAAgB;IAEhB,OAAO;QACL,KAAK;QACL,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE,KAAK;QACtB,cAAc,EAAE,IAAI;QACpB,aAAa,EAAE,KAAK,KAAK,SAAS;KACnC,CAAC;AACJ,CAAC"}
|
package/dist/bin.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":""}
|
package/dist/bin.js
ADDED
package/dist/bin.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAC5C,OAAO,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAE3C,aAAa,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { type PlacementManifest, type ReferencePlacementAdapter, type Refusal } from "@integraledger/lcp-binding-core";
|
|
2
|
+
import type { CallToolResult } from "@modelcontextprotocol/server";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import type { LcpMcpPorts } from "./ports.js";
|
|
5
|
+
/**
|
|
6
|
+
* The one place this server turns a wire token into a placement adapter — `@integraledger/lcp-placements`,
|
|
7
|
+
* the placement registry, and nothing else. No local map, no `switch`, no import of an individual
|
|
8
|
+
* `placement-*` package: a protocol added to the registry is served here the moment it is published, and
|
|
9
|
+
* a protocol the registry does not carry is reported as an absence rather than guessed at.
|
|
10
|
+
*
|
|
11
|
+
* TWO DISTINCT FAILURES, and collapsing them would lose the fix. `"acp2"` is not a protocol — a typo, and
|
|
12
|
+
* the answer is the closed set. `"mcp"` IS a protocol id and has no field placement at all: LCP §C.9 and
|
|
13
|
+
* §10 make MCP a delivery mechanism, which is what THIS PACKAGE is, so there is no document field for a
|
|
14
|
+
* reference to ride in. Answering "unknown protocol" there would invite someone to go build
|
|
15
|
+
* `placement-mcp`, which should not exist.
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveAdapter(protocol: string, ports: LcpMcpPorts): ReferencePlacementAdapter;
|
|
18
|
+
/**
|
|
19
|
+
* The manifest facts a caller needs to understand where the reference went, without shipping the whole
|
|
20
|
+
* manifest (its `specRef` prose and alias table are documentation, not a tool result).
|
|
21
|
+
*
|
|
22
|
+
* DECLARED ONCE, and both placement tools use it, so the two cannot describe the same block differently.
|
|
23
|
+
*
|
|
24
|
+
* `container` reports the KIND only. The container is a discriminated union whose tagged-array arm carries
|
|
25
|
+
* the array path, tag field, tag value and value field — everything a reader needs is already in `field`,
|
|
26
|
+
* which the manifest keeps as the human-readable locator precisely so a stranger does not have to
|
|
27
|
+
* reassemble one from the walker's parts.
|
|
28
|
+
*/
|
|
29
|
+
export declare const PLACEMENT_SUMMARY_SCHEMA: z.ZodObject<{
|
|
30
|
+
protocol: z.ZodString;
|
|
31
|
+
tier: z.ZodString;
|
|
32
|
+
pattern: z.ZodString;
|
|
33
|
+
container: z.ZodString;
|
|
34
|
+
encoding: z.ZodString;
|
|
35
|
+
field: z.ZodString;
|
|
36
|
+
}>;
|
|
37
|
+
export declare function manifestSummary(manifest: PlacementManifest): {
|
|
38
|
+
protocol: string;
|
|
39
|
+
tier: string;
|
|
40
|
+
pattern: string;
|
|
41
|
+
container: string;
|
|
42
|
+
encoding: string;
|
|
43
|
+
field: string;
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A placement refusal, as MCP sees it.
|
|
47
|
+
*
|
|
48
|
+
* Refusals are VALUES in this codebase, never exceptions — and they stay values here: the halt class and
|
|
49
|
+
* the stable code travel in `structuredContent` where a caller can branch on them, while `isError: true` is
|
|
50
|
+
* what makes MCP hand the whole thing to the model instead of swallowing it.
|
|
51
|
+
*/
|
|
52
|
+
export declare function refusalResult(refusal: Refusal): CallToolResult;
|
|
53
|
+
//# sourceMappingURL=dispatch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.d.ts","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EACtB,KAAK,yBAAyB,EAC9B,KAAK,OAAO,EACb,MAAM,iCAAiC,CAAC;AAKzC,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9C;;;;;;;;;;;GAWG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,WAAW,GACjB,yBAAyB,CAW3B;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,wBAAwB,EAAE,CAAC,CAAC,SAAS,CAAC;IACjD,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC;IACtB,IAAI,EAAE,CAAC,CAAC,SAAS,CAAC;IAClB,OAAO,EAAE,CAAC,CAAC,SAAS,CAAC;IACrB,SAAS,EAAE,CAAC,CAAC,SAAS,CAAC;IACvB,QAAQ,EAAE,CAAC,CAAC,SAAS,CAAC;IACtB,KAAK,EAAE,CAAC,CAAC,SAAS,CAAC;CACpB,CAqBE,CAAC;AAEJ,wBAAgB,eAAe,CAAC,QAAQ,EAAE,iBAAiB,GAAG;IAC5D,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf,CASA;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,cAAc,CAY9D"}
|
package/dist/dispatch.js
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { isKnownProtocolId, KNOWN_PROTOCOL_IDS, } from "@integraledger/lcp-binding-core";
|
|
2
|
+
import { placementFor, supportedProtocols, } from "@integraledger/lcp-placements";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
/**
|
|
5
|
+
* The one place this server turns a wire token into a placement adapter — `@integraledger/lcp-placements`,
|
|
6
|
+
* the placement registry, and nothing else. No local map, no `switch`, no import of an individual
|
|
7
|
+
* `placement-*` package: a protocol added to the registry is served here the moment it is published, and
|
|
8
|
+
* a protocol the registry does not carry is reported as an absence rather than guessed at.
|
|
9
|
+
*
|
|
10
|
+
* TWO DISTINCT FAILURES, and collapsing them would lose the fix. `"acp2"` is not a protocol — a typo, and
|
|
11
|
+
* the answer is the closed set. `"mcp"` IS a protocol id and has no field placement at all: LCP §C.9 and
|
|
12
|
+
* §10 make MCP a delivery mechanism, which is what THIS PACKAGE is, so there is no document field for a
|
|
13
|
+
* reference to ride in. Answering "unknown protocol" there would invite someone to go build
|
|
14
|
+
* `placement-mcp`, which should not exist.
|
|
15
|
+
*/
|
|
16
|
+
export function resolveAdapter(protocol, ports) {
|
|
17
|
+
if (!isKnownProtocolId(protocol))
|
|
18
|
+
throw new Error(`"${protocol}" is not an LCP protocol id — known ids: ${KNOWN_PROTOCOL_IDS.join(", ")}`);
|
|
19
|
+
const adapter = placementFor(protocol, ports.deployment);
|
|
20
|
+
if (adapter === undefined)
|
|
21
|
+
throw new Error(`no reference placement is registered for "${protocol}" — this build can place into: ${supportedProtocols().join(", ")}`);
|
|
22
|
+
return adapter;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The manifest facts a caller needs to understand where the reference went, without shipping the whole
|
|
26
|
+
* manifest (its `specRef` prose and alias table are documentation, not a tool result).
|
|
27
|
+
*
|
|
28
|
+
* DECLARED ONCE, and both placement tools use it, so the two cannot describe the same block differently.
|
|
29
|
+
*
|
|
30
|
+
* `container` reports the KIND only. The container is a discriminated union whose tagged-array arm carries
|
|
31
|
+
* the array path, tag field, tag value and value field — everything a reader needs is already in `field`,
|
|
32
|
+
* which the manifest keeps as the human-readable locator precisely so a stranger does not have to
|
|
33
|
+
* reassemble one from the walker's parts.
|
|
34
|
+
*/
|
|
35
|
+
export const PLACEMENT_SUMMARY_SCHEMA = z
|
|
36
|
+
.object({
|
|
37
|
+
protocol: z.string().describe("The LCP protocol id."),
|
|
38
|
+
tier: z
|
|
39
|
+
.string()
|
|
40
|
+
.describe("§8.3 wire compatibility: A works against stock today, B needs upstream change."),
|
|
41
|
+
pattern: z.string().describe("The §8.3 binding pattern this carrier is."),
|
|
42
|
+
container: z
|
|
43
|
+
.string()
|
|
44
|
+
.describe("How the field is reached: object-path, tagged-array or header-map."),
|
|
45
|
+
encoding: z.string().describe("How the reference sits in the field."),
|
|
46
|
+
field: z
|
|
47
|
+
.string()
|
|
48
|
+
.describe("The host-protocol field the reference occupies."),
|
|
49
|
+
})
|
|
50
|
+
.describe("The placement manifest's own account of where the reference sits.");
|
|
51
|
+
export function manifestSummary(manifest) {
|
|
52
|
+
return {
|
|
53
|
+
protocol: manifest.protocol,
|
|
54
|
+
tier: manifest.tier,
|
|
55
|
+
pattern: manifest.pattern,
|
|
56
|
+
container: manifest.container.kind,
|
|
57
|
+
encoding: manifest.encoding,
|
|
58
|
+
field: manifest.field,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* A placement refusal, as MCP sees it.
|
|
63
|
+
*
|
|
64
|
+
* Refusals are VALUES in this codebase, never exceptions — and they stay values here: the halt class and
|
|
65
|
+
* the stable code travel in `structuredContent` where a caller can branch on them, while `isError: true` is
|
|
66
|
+
* what makes MCP hand the whole thing to the model instead of swallowing it.
|
|
67
|
+
*/
|
|
68
|
+
export function refusalResult(refusal) {
|
|
69
|
+
const out = {
|
|
70
|
+
refused: true,
|
|
71
|
+
haltClass: refusal.haltClass,
|
|
72
|
+
code: refusal.code,
|
|
73
|
+
...(refusal.detail !== undefined ? { detail: refusal.detail } : {}),
|
|
74
|
+
};
|
|
75
|
+
return {
|
|
76
|
+
content: [{ type: "text", text: JSON.stringify(out, null, 2) }],
|
|
77
|
+
structuredContent: out,
|
|
78
|
+
isError: true,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=dispatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dispatch.js","sourceRoot":"","sources":["../src/dispatch.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,iBAAiB,EACjB,kBAAkB,GAInB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,YAAY,EACZ,kBAAkB,GACnB,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,cAAc,CAC5B,QAAgB,EAChB,KAAkB;IAElB,IAAI,CAAC,iBAAiB,CAAC,QAAQ,CAAC;QAC9B,MAAM,IAAI,KAAK,CACb,IAAI,QAAQ,4CAA4C,kBAAkB,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACxF,CAAC;IACJ,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IACzD,IAAI,OAAO,KAAK,SAAS;QACvB,MAAM,IAAI,KAAK,CACb,6CAA6C,QAAQ,kCAAkC,kBAAkB,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CACzH,CAAC;IACJ,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAOhC,CAAC;KACH,MAAM,CAAC;IACN,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sBAAsB,CAAC;IACrD,IAAI,EAAE,CAAC;SACJ,MAAM,EAAE;SACR,QAAQ,CACP,gFAAgF,CACjF;IACH,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,2CAA2C,CAAC;IACzE,SAAS,EAAE,CAAC;SACT,MAAM,EAAE;SACR,QAAQ,CACP,oEAAoE,CACrE;IACH,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,sCAAsC,CAAC;IACrE,KAAK,EAAE,CAAC;SACL,MAAM,EAAE;SACR,QAAQ,CAAC,iDAAiD,CAAC;CAC/D,CAAC;KACD,QAAQ,CACP,mEAAmE,CACpE,CAAC;AAEJ,MAAM,UAAU,eAAe,CAAC,QAA2B;IAQzD,OAAO;QACL,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,IAAI,EAAE,QAAQ,CAAC,IAAI;QACnB,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,SAAS,EAAE,QAAQ,CAAC,SAAS,CAAC,IAAI;QAClC,QAAQ,EAAE,QAAQ,CAAC,QAAQ;QAC3B,KAAK,EAAE,QAAQ,CAAC,KAAK;KACtB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,MAAM,GAAG,GAAG;QACV,OAAO,EAAE,IAAI;QACb,SAAS,EAAE,OAAO,CAAC,SAAS;QAC5B,IAAI,EAAE,OAAO,CAAC,IAAI;QAClB,GAAG,CAAC,OAAO,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KACpE,CAAC;IACF,OAAO;QACL,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,MAAe,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,EAAE,CAAC;QACxE,iBAAiB,EAAE,GAAG;QACtB,OAAO,EAAE,IAAI;KACd,CAAC;AACJ,CAAC"}
|