@emilia-protocol/mcp-server 1.0.0 → 1.0.3

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.
Files changed (4) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +3 -1
  3. package/index.js +186 -31
  4. package/package.json +17 -17
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by the Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding any notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2024–2026 EMILIA Protocol, Inc. and contributors
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  ## What This Is
12
12
 
13
- EMILIA Protocol enforces trust before high-risk action. EP verifies whether a specific high-risk action should proceed under a specific authority context, governing policy, and transaction binding. This MCP server gives any Claude conversation or agent pipeline direct access to EP's trust-decision surfaces: 34 tools covering trust profiles, policy evaluation, handshake verification, signoff orchestration, and pre-action binding. Add it to Claude Desktop in 60 seconds. No self-hosted EP backend required.
13
+ EMILIA Protocol enforces trust before a high-risk action. This MCP server gives any Claude conversation or agent pipeline EP's gate: call **`ep_guard_action`** before any irreversible action a payment, deletion, or account change — to require a named human's signoff and get a verifiable receipt, then poll **`ep_check_signoff`** until it's approved. 36 tools in all, but by default the server advertises a **focused 17** the trust gate plus the pre-action protocol (handshake + commit binding, signoff orchestration, policy evaluation, offline receipt verification, delegation, install preflight). Set `EP_INCLUDE_REGISTRY_TOOLS=true` to also expose the legacy registry and reputation tools. Add it to Claude Desktop in 60 seconds. No self-hosted EP backend required.
14
14
 
15
15
  ---
16
16
 
@@ -255,6 +255,8 @@ The submitter has 7 days to respond. Trust is suspended pending resolution.
255
255
 
256
256
  | Tool | Description | Auth Required |
257
257
  |------|-------------|:---:|
258
+ | `ep_guard_action` | THE GATE — call before any irreversible action; mints a receipt, opens signoff | Yes |
259
+ | `ep_check_signoff` | Poll a pending signoff until a named human approves or denies | Yes |
258
260
  | `ep_trust_profile` | Full trust profile — the canonical read surface | No |
259
261
  | `ep_trust_evaluate` | Policy evaluation with Trust Decision (allow/review/deny) and failure reasons | No |
260
262
  | `ep_trust_gate` | Pre-action trust check — call before irreversible actions | No |
package/index.js CHANGED
@@ -48,7 +48,7 @@
48
48
  * ep_bind_receipt_to_commit — Bind a post-action receipt to a commit
49
49
  *
50
50
  * Setup:
51
- * EP_BASE_URL=https://emiliaprotocol.ai
51
+ * EP_BASE_URL=https://www.emiliaprotocol.ai
52
52
  * EP_API_KEY=ep_live_... (for authenticated writes; registration is public)
53
53
  *
54
54
  * @license Apache-2.0
@@ -60,13 +60,16 @@ import {
60
60
  CallToolRequestSchema,
61
61
  ListToolsRequestSchema,
62
62
  ListResourcesRequestSchema,
63
+ ListResourceTemplatesRequestSchema,
63
64
  ReadResourceRequestSchema,
64
65
  ListPromptsRequestSchema,
65
66
  GetPromptRequestSchema,
66
67
  } from '@modelcontextprotocol/sdk/types.js';
67
68
  import { AutoReceiptMiddleware } from './auto-receipt.js';
68
69
 
69
- const BASE_URL = process.env.EP_BASE_URL || 'https://emiliaprotocol.ai';
70
+ // NOTE: use the www host. The apex 307-redirects to www, and fetch drops the
71
+ // Authorization header on the cross-origin redirect — which would 401 authed calls.
72
+ const BASE_URL = process.env.EP_BASE_URL || 'https://www.emiliaprotocol.ai';
70
73
  const API_KEY = process.env.EP_API_KEY || '';
71
74
 
72
75
  // =============================================================================
@@ -108,6 +111,48 @@ async function epFetch(path, options = {}) {
108
111
  // =============================================================================
109
112
 
110
113
  const TOOLS = [
114
+ // ═══════════════════════════════════════════════════════════════════════════
115
+ // HERO — the gate. Use these before any irreversible action. This is the product.
116
+ // ═══════════════════════════════════════════════════════════════════════════
117
+ {
118
+ name: 'ep_guard_action',
119
+ description:
120
+ 'REQUIRED before any irreversible action: payments, wire transfers, fund releases, ' +
121
+ 'deletions, record or account changes, or sending messages with real-world effect. ' +
122
+ 'Submits the exact action for policy evaluation and human authorization. Returns ' +
123
+ 'APPROVED with a receipt the action may proceed under, or BLOCKED with a receipt_id + ' +
124
+ 'signoff_id while a named human reviews. Do NOT execute the action without an APPROVED ' +
125
+ 'result — if BLOCKED, poll ep_check_signoff with the receipt_id.',
126
+ inputSchema: {
127
+ type: 'object',
128
+ properties: {
129
+ organization_id: { type: 'string', description: 'The organization this action belongs to.' },
130
+ action_type: { type: 'string', description: 'Kind of action, e.g. "large_payment_release", "vendor_bank_account_change", "ai_agent_payment_action".' },
131
+ target_resource_id: { type: 'string', description: 'What is being acted on — an invoice id, account id, or record id.' },
132
+ amount: { type: 'number', description: 'Amount, for payments/releases.' },
133
+ currency: { type: 'string', description: 'ISO currency code, e.g. "USD".' },
134
+ destination: { type: 'string', description: 'Where funds or data are going (account, address).' },
135
+ summary: { type: 'string', description: 'One-line, human-readable description the approver will see.' },
136
+ risk_flags: { type: 'array', items: { type: 'string' }, description: 'Optional risk signals, e.g. ["new_destination","after_hours"].' },
137
+ },
138
+ required: ['organization_id', 'action_type', 'target_resource_id'],
139
+ },
140
+ },
141
+ {
142
+ name: 'ep_check_signoff',
143
+ description:
144
+ 'Poll a pending authorization after ep_guard_action returns BLOCKED. Pass the ' +
145
+ 'receipt_id. Returns PENDING, APPROVED (the action may now proceed), or DENIED (with ' +
146
+ 'reason). Safe to call repeatedly until a decision is reached.',
147
+ inputSchema: {
148
+ type: 'object',
149
+ properties: {
150
+ receipt_id: { type: 'string', description: 'The receipt_id returned by ep_guard_action.' },
151
+ },
152
+ required: ['receipt_id'],
153
+ },
154
+ },
155
+
111
156
  // PRIMARY: Trust profile (canonical read surface)
112
157
  {
113
158
  name: 'ep_trust_profile',
@@ -194,19 +239,27 @@ const TOOLS = [
194
239
  // SECONDARY
195
240
  {
196
241
  name: 'ep_search_entities',
197
- description: 'Search for entities by name, capability, or category.',
242
+ description:
243
+ 'Search the EP registry for entities by name, capability, or category. ' +
244
+ 'Read-only, no side effects. Returns a list of matching entities with their ' +
245
+ 'ids, types, and current trust scores — use it to discover an entity before ' +
246
+ 'evaluating or referencing it.',
198
247
  inputSchema: {
199
248
  type: 'object',
200
249
  properties: {
201
250
  query: { type: 'string', description: 'Search query' },
202
- entity_type: { type: 'string', enum: ['agent','merchant','service_provider','github_app','github_action','mcp_server','npm_package','chrome_extension','shopify_app','marketplace_plugin','agent_tool'] },
251
+ entity_type: { type: 'string', description: 'Optional filter — restrict results to a single entity type.', enum: ['agent','merchant','service_provider','github_app','github_action','mcp_server','npm_package','chrome_extension','shopify_app','marketplace_plugin','agent_tool'] },
203
252
  },
204
253
  required: ['query'],
205
254
  },
206
255
  },
207
256
  {
208
257
  name: 'ep_verify_receipt',
209
- description: 'Verify a receipt against the on-chain Merkle root.',
258
+ description:
259
+ 'Verify a trust receipt — its signature and Merkle inclusion against the ' +
260
+ 'anchored root. Read-only. Returns valid/invalid plus the verified claim ' +
261
+ '(action, approver, outcome) and anchor status; use it to independently ' +
262
+ 'confirm a receipt was issued by EP and has not been tampered with.',
210
263
  inputSchema: {
211
264
  type: 'object',
212
265
  properties: {
@@ -217,27 +270,35 @@ const TOOLS = [
217
270
  },
218
271
  {
219
272
  name: 'ep_register_entity',
220
- description: 'Register a new entity. Public — returns the first API key.',
273
+ description:
274
+ 'Create a new entity in the EP registry. SIDE EFFECT: persists the entity ' +
275
+ 'and returns its API key once — store it, it cannot be retrieved later. ' +
276
+ 'Public, no auth required. Use to onboard an agent or service before it ' +
277
+ 'submits receipts or is evaluated.',
221
278
  inputSchema: {
222
279
  type: 'object',
223
280
  properties: {
224
- entity_id: { type: 'string', description: 'Slug (lowercase, hyphens)' },
225
- display_name: { type: 'string' },
226
- entity_type: { type: 'string', enum: ['agent','merchant','service_provider','github_app','github_action','mcp_server','npm_package','chrome_extension','shopify_app','marketplace_plugin','agent_tool'] },
227
- description: { type: 'string' },
228
- capabilities: { type: 'array', items: { type: 'string' } },
281
+ entity_id: { type: 'string', description: 'Unique slug for the entity (lowercase, hyphens), e.g. "acme-treasury-agent". Becomes its permanent id.' },
282
+ display_name: { type: 'string', description: 'Human-readable name shown in trust profiles and receipts, e.g. "Acme Treasury Agent".' },
283
+ entity_type: { type: 'string', description: 'What kind of actor this is — determines which trust policies apply.', enum: ['agent','merchant','service_provider','github_app','github_action','mcp_server','npm_package','chrome_extension','shopify_app','marketplace_plugin','agent_tool'] },
284
+ description: { type: 'string', description: 'One or two sentences on what the entity does; used for discovery and capability matching.' },
285
+ capabilities: { type: 'array', items: { type: 'string' }, description: 'Optional list of capability tags, e.g. ["payments","kyc"], used by ep_search_entities.' },
229
286
  },
230
287
  required: ['entity_id', 'display_name', 'entity_type', 'description'],
231
288
  },
232
289
  },
233
290
  {
234
291
  name: 'ep_leaderboard',
235
- description: 'Get top entities ranked by trust confidence.',
292
+ description:
293
+ 'List the top entities ranked by trust confidence. Read-only. Returns up to ' +
294
+ 'the requested limit (default 10, max 50) with scores, optionally filtered by ' +
295
+ 'entity_type. For discovery and benchmarking — for a go/no-go decision on a ' +
296
+ 'specific action, use ep_guard_action instead.',
236
297
  inputSchema: {
237
298
  type: 'object',
238
299
  properties: {
239
300
  limit: { type: 'number', description: 'Max entities (default 10, max 50)' },
240
- entity_type: { type: 'string', enum: ['agent','merchant','service_provider','github_app','github_action','mcp_server','npm_package','chrome_extension','shopify_app','marketplace_plugin','agent_tool'] },
301
+ entity_type: { type: 'string', description: 'Optional filter — restrict results to a single entity type.', enum: ['agent','merchant','service_provider','github_app','github_action','mcp_server','npm_package','chrome_extension','shopify_app','marketplace_plugin','agent_tool'] },
241
302
  },
242
303
  },
243
304
  },
@@ -261,7 +322,10 @@ const TOOLS = [
261
322
  },
262
323
  {
263
324
  name: 'ep_dispute_status',
264
- description: 'Check the status of a dispute. Public — transparency is a protocol value.',
325
+ description:
326
+ 'Look up the current state of a dispute by id. Read-only, public (no auth) — ' +
327
+ 'transparency is a protocol value. Returns the dispute status (open, ' +
328
+ 'under_review, upheld, rejected), the entity it concerns, and any resolution.',
265
329
  inputSchema: {
266
330
  type: 'object',
267
331
  properties: {
@@ -310,9 +374,10 @@ const TOOLS = [
310
374
  {
311
375
  name: 'ep_install_preflight',
312
376
  description:
313
- 'EP-SX: Should I install this plugin/app/package/extension? ' +
314
- 'Evaluates a software entity against a software-specific trust policy with context. ' +
315
- 'Returns allow/review/deny with specific reasons covering publisher, permissions, provenance, and trust history.',
377
+ 'BEFORE installing or enabling third-party software an agent depends on — an npm ' +
378
+ 'package, GitHub app, browser extension, or MCP server check it here. Evaluates the ' +
379
+ 'software against a fit-for-purpose trust policy and returns allow / review / deny with ' +
380
+ 'reasons covering publisher, requested permissions, provenance, and trust history.',
316
381
  inputSchema: {
317
382
  type: 'object',
318
383
  properties: {
@@ -362,9 +427,11 @@ const TOOLS = [
362
427
  {
363
428
  name: 'ep_create_delegation',
364
429
  description:
365
- 'Create a delegation record: a human or principal authorizes an agent to act on their behalf. ' +
366
- 'The delegation is recorded in the EP ledger with scope, expiry, and optional constraints. ' +
367
- 'Every delegated action can reference this delegation to prove authorization.',
430
+ 'Create a delegation record. WRITE: persists to the EP ledger that a human or ' +
431
+ 'principal authorizes an agent to act on their behalf, with scope, expiry, and ' +
432
+ 'optional constraints. Requires auth. Returns a delegation_id that later actions ' +
433
+ 'reference (via ep_verify_delegation) to prove authorization. Use when a principal ' +
434
+ 'grants an agent standing authority for a bounded set of actions.',
368
435
  inputSchema: {
369
436
  type: 'object',
370
437
  properties: {
@@ -610,8 +677,10 @@ const TOOLS = [
610
677
  {
611
678
  name: 'ep_verify_commit',
612
679
  description:
613
- 'Verify a commit\'s signature, status, and validity. ' +
614
- 'Returns valid/invalid, current status, decision, and expiry.',
680
+ 'Verify a pre-action commit read-only, no side effects. Checks its signature, ' +
681
+ 'status, and validity and returns valid/invalid plus the current status, decision, ' +
682
+ 'and expiry. Use before relying on or consuming a commit to confirm it is genuine ' +
683
+ 'and still active.',
615
684
  inputSchema: {
616
685
  type: 'object',
617
686
  properties: {
@@ -622,7 +691,10 @@ const TOOLS = [
622
691
  },
623
692
  {
624
693
  name: 'ep_get_commit_status',
625
- description: 'Get the current state of a commit (active, revoked, expired, fulfilled).',
694
+ description:
695
+ 'Get the current state of a pre-action commit by id. Read-only. Returns one ' +
696
+ 'of active, revoked, expired, or fulfilled, plus the bound action hash and ' +
697
+ 'expiry — poll this to learn whether a commit may still be consumed.',
626
698
  inputSchema: {
627
699
  type: 'object',
628
700
  properties: {
@@ -633,7 +705,11 @@ const TOOLS = [
633
705
  },
634
706
  {
635
707
  name: 'ep_revoke_commit',
636
- description: 'Revoke an active commit before it is fulfilled or expires.',
708
+ description:
709
+ 'Revoke an active pre-action commit before it is fulfilled or expires. ' +
710
+ 'SIDE EFFECT: terminally cancels the commit — it can never be consumed after ' +
711
+ 'this, and the change is irreversible. Requires auth. Returns the revoked ' +
712
+ 'status; use when a pending action should be called off.',
637
713
  inputSchema: {
638
714
  type: 'object',
639
715
  properties: {
@@ -691,9 +767,11 @@ const TOOLS = [
691
767
  {
692
768
  name: 'ep_add_presentation',
693
769
  description:
694
- 'Add an identity presentation (proof) to an active handshake. ' +
695
- 'Each party presents their identity claims for evaluation against the handshake policy. ' +
696
- 'Supports full, selective, or zero-knowledge disclosure modes.',
770
+ 'Add an identity presentation (proof) to an active handshake. WRITE: appends ' +
771
+ 'the party\'s identity claims to the handshake for evaluation against its policy; ' +
772
+ 'supports full, selective, or zero-knowledge disclosure. Requires auth. Returns ' +
773
+ 'the updated presentation count and handshake state. Call after ' +
774
+ 'ep_initiate_handshake and before ep_verify_handshake.',
697
775
  inputSchema: {
698
776
  type: 'object',
699
777
  properties: {
@@ -710,9 +788,11 @@ const TOOLS = [
710
788
  {
711
789
  name: 'ep_verify_handshake',
712
790
  description:
713
- 'Evaluate all presentations in a handshake against the governing policy. ' +
714
- 'Returns: accepted (all requirements met), rejected (policy violations), or partial (awaiting presentations). ' +
715
- 'Includes reason_codes explaining the outcome.',
791
+ 'Evaluate all presentations in a handshake against its governing policy — read-only, ' +
792
+ 'no mutation. Returns accepted (all requirements met), rejected (policy violations), ' +
793
+ 'or partial (awaiting presentations), each with reason_codes explaining the outcome. ' +
794
+ 'Call after the parties have added their presentations to decide whether the ' +
795
+ 'handshake clears.',
716
796
  inputSchema: {
717
797
  type: 'object',
718
798
  properties: {
@@ -756,6 +836,54 @@ const TOOLS = [
756
836
 
757
837
  async function handleTool(name, args) {
758
838
  switch (name) {
839
+ // ─── HERO: the gate ──────────────────────────────────────────────────────
840
+ case 'ep_guard_action': {
841
+ if (!API_KEY) return 'Error: EP_API_KEY required to guard actions. Set it in MCP server config.';
842
+ // 1. Mint a pre-action trust receipt — runs the formally-verified policy engine server-side.
843
+ const mint = await epFetch('/api/v1/trust-receipts', {
844
+ method: 'POST', auth: true,
845
+ body: {
846
+ organization_id: args.organization_id,
847
+ action_type: args.action_type,
848
+ target_resource_id: args.target_resource_id,
849
+ amount: args.amount,
850
+ currency: args.currency,
851
+ risk_flags: args.risk_flags || [],
852
+ target_changed_fields: args.action_type === 'vendor_bank_account_change' ? ['bank_account'] : [],
853
+ },
854
+ });
855
+ if (mint.decision === 'deny') {
856
+ return `BLOCKED — denied by policy.\nreason: ${(mint.reasons || []).join('; ') || 'policy denial'}\n` +
857
+ `receipt_id: ${mint.receipt_id}\nDo not execute this action.`;
858
+ }
859
+ if (!mint.signoff_required) {
860
+ return `APPROVED — no human signoff required.\nreceipt_id: ${mint.receipt_id}\nThe action may proceed.`;
861
+ }
862
+ // 2. Signoff required → open the signoff request for a named human.
863
+ const sign = await epFetch('/api/v1/signoffs/request', {
864
+ method: 'POST', auth: true,
865
+ body: { receipt_id: mint.receipt_id, comment: args.summary || undefined },
866
+ });
867
+ return `BLOCKED — a named human must authorize this before it runs.\n` +
868
+ `receipt_id: ${mint.receipt_id}\nsignoff_id: ${sign.signoff_id}\nstatus: ${sign.status}\n` +
869
+ `reason: ${(mint.reasons || []).join('; ') || 'policy requires signoff'}\n` +
870
+ `Do NOT execute the action. Poll ep_check_signoff with this receipt_id until approved.`;
871
+ }
872
+
873
+ case 'ep_check_signoff': {
874
+ if (!API_KEY) return 'Error: EP_API_KEY required. Set it in MCP server config.';
875
+ const data = await epFetch(`/api/v1/trust-receipts/${encodeURIComponent(args.receipt_id)}`, { auth: true });
876
+ const status = data.receipt_status || data.status || 'pending_signoff';
877
+ // approved_pending_consume = signoff granted, not yet consumed; consumed = fully done.
878
+ if (['approved_pending_consume', 'approved', 'consumed', 'fulfilled'].includes(status)) {
879
+ return `APPROVED — the action is authorized and may proceed.\nreceipt_id: ${args.receipt_id}`;
880
+ }
881
+ if (['denied', 'rejected', 'revoked'].includes(status)) {
882
+ return `DENIED — a human rejected this action.\nreceipt_id: ${args.receipt_id}\nreason: ${data.reason || 'not stated'}\nDo not execute the action.`;
883
+ }
884
+ return `PENDING — awaiting a named human's signoff.\nreceipt_id: ${args.receipt_id}\nstatus: ${status}\nSafe to call again shortly.`;
885
+ }
886
+
759
887
  case 'ep_trust_profile': {
760
888
  const data = await epFetch(`/api/trust/profile/${encodeURIComponent(args.entity_id)}`);
761
889
  return formatTrustProfile(data);
@@ -1417,7 +1545,28 @@ const server = new Server(
1417
1545
  { capabilities: { tools: {}, resources: {}, prompts: {} } }
1418
1546
  );
1419
1547
 
1420
- server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
1548
+ // The default surface is the trust-gate + pre-action protocol — the reason
1549
+ // to install this server. The legacy registry/reputation tools (entity
1550
+ // scoring, leaderboards, disputes, identity continuity, ZK proofs) remain
1551
+ // fully implemented and callable, but are hidden from tool discovery unless
1552
+ // EP_INCLUDE_REGISTRY_TOOLS=true, so an agent sees a focused, coherent set.
1553
+ const CORE_TOOL_NAMES = new Set([
1554
+ 'ep_guard_action', 'ep_check_signoff', // the gate
1555
+ 'ep_initiate_handshake', 'ep_add_presentation', // pre-action binding
1556
+ 'ep_verify_handshake', 'ep_get_handshake', 'ep_revoke_handshake',
1557
+ 'ep_issue_commit', 'ep_verify_commit', 'ep_get_commit_status',
1558
+ 'ep_revoke_commit', 'ep_bind_receipt_to_commit',
1559
+ 'ep_verify_receipt', // offline-verify a receipt
1560
+ 'ep_list_policies', // discover policies
1561
+ 'ep_create_delegation', 'ep_verify_delegation', // delegated authority
1562
+ 'ep_install_preflight', // vet software before install
1563
+ ]);
1564
+ const INCLUDE_REGISTRY_TOOLS = process.env.EP_INCLUDE_REGISTRY_TOOLS === 'true';
1565
+ const ADVERTISED_TOOLS = INCLUDE_REGISTRY_TOOLS
1566
+ ? TOOLS
1567
+ : TOOLS.filter((t) => CORE_TOOL_NAMES.has(t.name));
1568
+
1569
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: ADVERTISED_TOOLS }));
1421
1570
 
1422
1571
  server.setRequestHandler(CallToolRequestSchema, async (request) => {
1423
1572
  const { name, arguments: args } = request.params;
@@ -1472,6 +1621,12 @@ const RESOURCES = [
1472
1621
 
1473
1622
  server.setRequestHandler(ListResourcesRequestSchema, async () => ({ resources: RESOURCES }));
1474
1623
 
1624
+ // Clients (Claude included) probe resources/templates/list on startup whenever
1625
+ // a server advertises the `resources` capability. We expose no URI templates,
1626
+ // but the method must exist — without it the client gets MCP -32601
1627
+ // "Method not found" on every connect.
1628
+ server.setRequestHandler(ListResourceTemplatesRequestSchema, async () => ({ resourceTemplates: [] }));
1629
+
1475
1630
  server.setRequestHandler(ReadResourceRequestSchema, async (request) => {
1476
1631
  const { uri } = request.params;
1477
1632
  let data;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@emilia-protocol/mcp-server",
3
3
  "mcpName": "io.github.emiliaprotocol/mcp-server",
4
- "version": "1.0.0",
4
+ "version": "1.0.3",
5
5
  "description": "EMILIA Protocol MCP Server — trust enforcement for high-risk actions via MCP. Pre-action binding, policy-bound verification, and accountable human signoff.",
6
6
  "main": "index.js",
7
7
  "type": "module",
@@ -11,7 +11,8 @@
11
11
  "files": [
12
12
  "index.js",
13
13
  "auto-receipt.js",
14
- "README.md"
14
+ "README.md",
15
+ "LICENSE"
15
16
  ],
16
17
  "scripts": {
17
18
  "test": "vitest run"
@@ -25,22 +26,21 @@
25
26
  "keywords": [
26
27
  "mcp",
27
28
  "model-context-protocol",
28
- "trust",
29
- "trust-profile",
30
- "trust-score",
31
- "policy-evaluation",
32
- "install-preflight",
33
- "appeals",
34
- "disputes",
35
- "software-trust",
36
- "marketplace-trust",
37
- "machine-actors",
38
- "counterparties",
39
- "ai-agents",
40
- "behavioral-receipts",
41
- "emilia-protocol",
29
+ "human-in-the-loop",
30
+ "human-signoff",
31
+ "webauthn",
32
+ "passkey",
33
+ "irreversible-actions",
34
+ "payment-guard",
35
+ "agent-accountability",
42
36
  "agent-safety",
43
- "delegation"
37
+ "ai-agents",
38
+ "trust-receipt",
39
+ "offline-verification",
40
+ "separation-of-duties",
41
+ "policy-evaluation",
42
+ "delegation",
43
+ "emilia-protocol"
44
44
  ],
45
45
  "license": "Apache-2.0",
46
46
  "engines": {