agent-passport-system-mcp 2.27.0 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/build/index.js +213 -737
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -12,13 +12,13 @@ Enforcement and accountability layer for AI agents. Bring your own identity. 20
|
|
|
12
12
|
APS_PROFILE=essential npx agent-passport-system-mcp
|
|
13
13
|
```
|
|
14
14
|
|
|
15
|
-
`essential` is the default profile — the
|
|
15
|
+
`essential` is the default profile — the 20 tools 90% of integrations need. Set `APS_PROFILE=full` for all 146 tools.
|
|
16
16
|
|
|
17
17
|
Available profiles: essential (default), identity, governance, coordination, commerce, data, gateway, comms, minimal, full.
|
|
18
18
|
|
|
19
19
|
> **For AI agents:** visit [aeoess.com/llms.txt](https://aeoess.com/llms.txt) for machine-readable documentation or [llms-full.txt](https://aeoess.com/llms-full.txt) for the complete technical reference. MCP discovery: [.well-known/mcp.json](https://aeoess.com/.well-known/mcp.json).
|
|
20
20
|
|
|
21
|
-
Works with any MCP client: Claude Desktop, Claude Code, Cursor, Windsurf, and more. Full surface area under `APS_PROFILE=full`:
|
|
21
|
+
Works with any MCP client: Claude Desktop, Claude Code, Cursor, Windsurf, and more. Full surface area under `APS_PROFILE=full`: 146 tools across 125 modules (84 core + 39 v2 constitutional governance). Independently cited by [PDR in Production (Nanook & Gerundium, UBC)](https://doi.org/10.5281/zenodo.19323172).
|
|
22
22
|
|
|
23
23
|
## Quick Start
|
|
24
24
|
|
|
@@ -69,7 +69,7 @@ Or for remote SSE:
|
|
|
69
69
|
```
|
|
70
70
|
</details>
|
|
71
71
|
|
|
72
|
-
## Tools (
|
|
72
|
+
## Tools (154)
|
|
73
73
|
|
|
74
74
|
### Identity (Layer 1) — 5 tools
|
|
75
75
|
|
|
@@ -216,8 +216,8 @@ Layer 1 — Agent Passport Protocol (Ed25519 identity)
|
|
|
216
216
|
|
|
217
217
|
## Links
|
|
218
218
|
|
|
219
|
-
- npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (
|
|
220
|
-
- Python SDK: [agent-passport-system](https://pypi.org/project/agent-passport-system/) (
|
|
219
|
+
- npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v2.2.0, 2395 tests)
|
|
220
|
+
- Python SDK: [agent-passport-system](https://pypi.org/project/agent-passport-system/) (v2.2.0)
|
|
221
221
|
- Paper (Protocol): [doi.org/10.5281/zenodo.18749779](https://doi.org/10.5281/zenodo.18749779)
|
|
222
222
|
- Paper (Faceted Narrowing): [doi.org/10.5281/zenodo.19260073](https://doi.org/10.5281/zenodo.19260073)
|
|
223
223
|
- Paper (Behavioral Derivation Rights): [doi.org/10.5281/zenodo.19476002](https://doi.org/10.5281/zenodo.19476002)
|
package/build/index.js
CHANGED
|
@@ -18,9 +18,7 @@ import { readFileSync, writeFileSync, existsSync } from "node:fs";
|
|
|
18
18
|
import { join, resolve } from "node:path";
|
|
19
19
|
import {
|
|
20
20
|
// Identity + Crypto
|
|
21
|
-
joinSocialContract, generateKeyPair,
|
|
22
|
-
// Agent Context (enforcement middleware)
|
|
23
|
-
createAgentContext,
|
|
21
|
+
joinSocialContract, generateKeyPair, sign, countersignPassport, verifyIssuerSignature, isIssuerVerified,
|
|
24
22
|
// Coordination (Layer 6)
|
|
25
23
|
createTaskBrief, assignTask, acceptTask, submitEvidence, reviewEvidence, handoffEvidence, submitDeliverable, completeTask, createTaskUnit, getTaskStatus, validateTaskUnit,
|
|
26
24
|
// Delegation (Layer 1)
|
|
@@ -30,35 +28,28 @@ createAgoraMessage, createFeed, appendToFeed, getThread, getByTopic, getTopics,
|
|
|
30
28
|
// Values/Policy (Layer 2 + 5)
|
|
31
29
|
loadFloor, attestFloor, createActionIntent, evaluateIntent, FloorValidatorV1,
|
|
32
30
|
// Commerce (Layer 8)
|
|
33
|
-
commercePreflight, createCommerceDelegation, getSpendSummary, requestHumanApproval,
|
|
31
|
+
commercePreflight, createCommerceDelegation, getSpendSummary, requestHumanApproval,
|
|
34
32
|
// Principal Identity
|
|
35
33
|
createPrincipalIdentity, endorseAgent, verifyEndorsement, revokeEndorsement, createDisclosure, createFleet, addToFleet, getFleetStatus, revokeFromFleet,
|
|
36
34
|
// Reputation-Gated Authority (Layer 9)
|
|
37
|
-
computeEffectiveScore, createScopedReputation, resolveAuthorityTier, checkTierForIntent, advisoryTierPrecheck, createPromotionReview, updateReputationFromResult, DEFAULT_TIERS,
|
|
38
|
-
// Intent Network (Agent-Mediated Matching) — card creation only, API handles persistence
|
|
39
|
-
createIntentCard,
|
|
35
|
+
computeEffectiveScore, createScopedReputation, resolveAuthorityTier, checkTierForIntent, advisoryTierPrecheck, createPromotionReview, updateReputationFromResult, DEFAULT_TIERS,
|
|
40
36
|
// v2: Constitutional Governance Extensions
|
|
41
37
|
createPolicyContext, createArtifactProvenance,
|
|
42
38
|
// v2: Delegation Versioning
|
|
43
39
|
createV2Delegation, supersedeV2Delegation,
|
|
44
40
|
// v2: Outcome Registration
|
|
45
41
|
createV2OutcomeRecord, addV2PrincipalReport, getV2EffectiveDivergence,
|
|
46
|
-
// v2: Anomaly Detection
|
|
47
|
-
recordV2Action, checkV2FirstMaxAuthority, computeV2ConcentrationMetrics,
|
|
48
42
|
// v2: Emergency Pathways
|
|
49
|
-
defineV2EmergencyPathway, activateV2Emergency,
|
|
50
|
-
// v2: Migration
|
|
51
|
-
requestV2Migration,
|
|
52
|
-
// v2: Attestation
|
|
53
|
-
createV2Attestation, assessV2AttestationQuality, } from "agent-passport-system";
|
|
43
|
+
defineV2EmergencyPathway, activateV2Emergency, } from "agent-passport-system";
|
|
54
44
|
// Agent Attestation Architecture (Phase 1 — Consilium Build)
|
|
55
45
|
import { createIssuanceContext, bindAttestation, createEmptyEvidenceRecord, PASSPORT_GRADE_LABELS,
|
|
56
46
|
// v1.33.0 — action_ref + freshness + evidence-based grade
|
|
57
47
|
computeActionRef, isEvidenceFresh, computeEvidenceAge, classifyEvidenceQuality, evidenceQualityToGrade,
|
|
58
48
|
// key rotation
|
|
59
49
|
createDIDDocument, verifyRotationChain, isKeyActive, rotateAndInvalidate, } from "agent-passport-system";
|
|
60
|
-
// Data Governance (Modules 36A, 38, 39
|
|
61
|
-
|
|
50
|
+
// Data Governance (Modules 36A, 38, 39 — protocol primitives only;
|
|
51
|
+
// ContributionLedger/DataEnforcementGate/settlement generation moved to gateway.)
|
|
52
|
+
import { registerSelfAttestedSource, } from "agent-passport-system";
|
|
62
53
|
// Data Lifecycle Governance (Modules 43+)
|
|
63
54
|
import { createDerivationReceipt, resolveExtendedLineage, evaluateRevocationImpact, createDecisionLineageReceipt, isPurposePermitted, purposeCategory, isRetentionExpired, checkAggregateConstraints, isTransferPermitted, computeGovernanceTaint, fileDispute, checkCombinationPermitted, createAccessSnapshot, resolveRightsPropagation, DEFAULT_RIGHTS_PROPAGATION, detectPurposeDrift, declareReidentificationRisk, verifyGovernanceBlock, parseGovernanceBlockFromHTML, isUsagePermitted, embedGovernance, generateApsTxt, verifyApsTxt, resolveTermsForPath, createChainedGovernanceBlock, createAccessReceipt, governanceLoop360, } from "agent-passport-system";
|
|
64
55
|
// Rome-Complete: Charter, Approval, Time, Reserve, Federation
|
|
@@ -72,6 +63,10 @@ computeDataAxisWeights, computeComputeAxisWeights, DEFAULT_WEIGHT_PROFILE,
|
|
|
72
63
|
// Attribution Settlement (Build C — per-period signed settlement record)
|
|
73
64
|
aggregateAttributionPrimitives, buildContributorQueryResponse, signSettlementRecord, verifySettlementRecord, } from "agent-passport-system";
|
|
74
65
|
// ═══════════════════════════════════════
|
|
66
|
+
// Mutual Authentication v1 (SDK v2.2.0)
|
|
67
|
+
// ═══════════════════════════════════════
|
|
68
|
+
import { buildCertificate, signCertificate, certificateId, verifyBundle, verifyAttest, deriveSession, } from "agent-passport-system";
|
|
69
|
+
// ═══════════════════════════════════════
|
|
75
70
|
// State Management
|
|
76
71
|
// ═══════════════════════════════════════
|
|
77
72
|
const STORE_PATH = join(process.env.HOME || '.', '.agent-passport-tasks.json');
|
|
@@ -144,7 +139,6 @@ const state = {
|
|
|
144
139
|
floorYaml: null,
|
|
145
140
|
commerceSpendLog: [],
|
|
146
141
|
intents: new Map(),
|
|
147
|
-
agentContext: null,
|
|
148
142
|
floor: null,
|
|
149
143
|
pendingActions: new Map(),
|
|
150
144
|
principal: null,
|
|
@@ -153,12 +147,7 @@ const state = {
|
|
|
153
147
|
fleet: null,
|
|
154
148
|
reputations: new Map(),
|
|
155
149
|
promotionHistory: [],
|
|
156
|
-
gateway: null,
|
|
157
|
-
gatewayKeys: null,
|
|
158
|
-
dataEnforcementGate: null,
|
|
159
|
-
contributionLedger: createContributionLedger(),
|
|
160
150
|
sourceReceipts: new Map(),
|
|
161
|
-
trainingLedger: createTrainingLedger(),
|
|
162
151
|
derivationStore: new Map(),
|
|
163
152
|
sessionAgent: null,
|
|
164
153
|
charters: new Map(),
|
|
@@ -320,28 +309,11 @@ function persistAgoraFeed() {
|
|
|
320
309
|
// Non-fatal: coordination still works even if persistence fails
|
|
321
310
|
}
|
|
322
311
|
}
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
const result = coordinationToAgora({
|
|
329
|
-
event,
|
|
330
|
-
taskId,
|
|
331
|
-
agentId: state.agentId || 'anonymous',
|
|
332
|
-
agentName: getAgentName(),
|
|
333
|
-
publicKey: state.agentKey,
|
|
334
|
-
privateKey: state.privateKey,
|
|
335
|
-
feed: state.agoraFeed,
|
|
336
|
-
registry: state.agoraRegistry,
|
|
337
|
-
detail,
|
|
338
|
-
});
|
|
339
|
-
state.agoraFeed = result.feed;
|
|
340
|
-
persistAgoraFeed();
|
|
341
|
-
}
|
|
342
|
-
catch {
|
|
343
|
-
// Non-fatal: coordination still works even if Agora post fails
|
|
344
|
-
}
|
|
312
|
+
// Coordination→Agora bridge moved to gateway in v3.0.0.
|
|
313
|
+
// Task-lifecycle events still happen locally; cross-agent broadcast is a
|
|
314
|
+
// gateway concern now.
|
|
315
|
+
function emitAgoraEvent(_event, _taskId, _detail) {
|
|
316
|
+
// No-op in protocol-only MCP. Gateway callers handle Agora propagation.
|
|
345
317
|
}
|
|
346
318
|
function loadAgentsRegistry() {
|
|
347
319
|
if (!existsSync(AGENTS_PATH))
|
|
@@ -365,6 +337,26 @@ async function signMessage(content) {
|
|
|
365
337
|
}
|
|
366
338
|
}
|
|
367
339
|
// ═══════════════════════════════════════
|
|
340
|
+
// Gateway Deprecation Helper (v3.0.0)
|
|
341
|
+
// ═══════════════════════════════════════
|
|
342
|
+
// Tools that required product-layer code (ProxyGateway, DataEnforcementGate,
|
|
343
|
+
// ContributionLedger, AgentContext) now live in the private gateway product.
|
|
344
|
+
// Stubs preserve discoverability so callers learn where to migrate.
|
|
345
|
+
function movedToGateway(toolName) {
|
|
346
|
+
return {
|
|
347
|
+
content: [{
|
|
348
|
+
type: "text",
|
|
349
|
+
text: JSON.stringify({
|
|
350
|
+
error: `[deprecated in MCP v3.0.0] This tool (${toolName}) was removed because it required product-layer code that now lives in the private gateway. Use the gateway.aeoess.com REST API for this functionality, or stay on agent-passport-system-mcp@2.27.0 (pins to agent-passport-system@^1.46.0) if you need the old tools.`,
|
|
351
|
+
migration: "https://gateway.aeoess.com/docs",
|
|
352
|
+
deprecated_in: "3.0.0",
|
|
353
|
+
last_working_mcp: "2.27.0",
|
|
354
|
+
}),
|
|
355
|
+
}],
|
|
356
|
+
isError: true,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
// ═══════════════════════════════════════
|
|
368
360
|
// Server Setup
|
|
369
361
|
// ═══════════════════════════════════════
|
|
370
362
|
const server = new McpServer({
|
|
@@ -397,9 +389,9 @@ const TOOL_PROFILES = {
|
|
|
397
389
|
'create_delegation', 'verify_delegation', 'revoke_delegation',
|
|
398
390
|
'create_charter', 'sign_charter', 'verify_charter',
|
|
399
391
|
'evaluate_threshold', 'create_approval_request', 'add_approval_signature',
|
|
400
|
-
'
|
|
401
|
-
'
|
|
402
|
-
'
|
|
392
|
+
'create_outcome_record', 'add_principal_report',
|
|
393
|
+
'activate_emergency', 'define_emergency_pathway',
|
|
394
|
+
'create_artifact_provenance', 'create_policy_context',
|
|
403
395
|
'generate_governance_block', 'verify_governance_block',
|
|
404
396
|
'parse_governance_block_html', 'governance_360',
|
|
405
397
|
'generate_aps_txt', 'verify_aps_txt', 'resolve_path_terms',
|
|
@@ -418,10 +410,8 @@ const TOOL_PROFILES = {
|
|
|
418
410
|
]),
|
|
419
411
|
data: new Set([
|
|
420
412
|
'identify', 'generate_keys', 'create_principal',
|
|
421
|
-
'register_data_source', 'create_data_enforcement_gate',
|
|
422
|
-
'query_contributions', '
|
|
423
|
-
'generate_settlement', 'generate_compliance_report',
|
|
424
|
-
'record_training_use', 'get_model_data_sources',
|
|
413
|
+
'register_data_source', 'create_data_enforcement_gate',
|
|
414
|
+
'query_contributions', 'generate_settlement',
|
|
425
415
|
'create_access_receipt', 'create_access_snapshot',
|
|
426
416
|
'create_derivation_receipt', 'create_decision_lineage_receipt',
|
|
427
417
|
'resolve_lineage', 'evaluate_revocation_impact',
|
|
@@ -433,8 +423,8 @@ const TOOL_PROFILES = {
|
|
|
433
423
|
]),
|
|
434
424
|
gateway: new Set([
|
|
435
425
|
'identify', 'generate_keys', 'create_principal',
|
|
436
|
-
'create_gateway',
|
|
437
|
-
'gateway_process_tool_call', 'gateway_approve',
|
|
426
|
+
'create_gateway',
|
|
427
|
+
'gateway_process_tool_call', 'gateway_approve',
|
|
438
428
|
'gateway_stats', 'create_delegation', 'load_values_floor', 'attest_to_floor',
|
|
439
429
|
'create_hybrid_timestamp', 'compare_timestamps', 'validate_temporal_rights',
|
|
440
430
|
'create_reserve_attestation', 'vouch_reputation', 'apply_reputation_downgrade',
|
|
@@ -445,7 +435,7 @@ const TOOL_PROFILES = {
|
|
|
445
435
|
'post_agora_message', 'get_agora_topics', 'get_agora_thread',
|
|
446
436
|
'get_agora_by_topic', 'register_agora_agent',
|
|
447
437
|
'send_message', 'check_messages', 'broadcast', 'list_agents',
|
|
448
|
-
'
|
|
438
|
+
'remove_intent_card', 'search_matches',
|
|
449
439
|
'request_intro', 'respond_to_intro', 'get_digest',
|
|
450
440
|
'register_agora_public',
|
|
451
441
|
]),
|
|
@@ -573,13 +563,10 @@ const TOOL_SCOPE_MAP = {
|
|
|
573
563
|
'execute_with_context': 'governance',
|
|
574
564
|
'complete_action': 'governance',
|
|
575
565
|
'create_policy_context': 'governance',
|
|
576
|
-
'create_attestation': 'governance',
|
|
577
566
|
'create_outcome_record': 'governance',
|
|
578
567
|
'add_principal_report': 'governance',
|
|
579
|
-
'check_anomaly': 'governance',
|
|
580
568
|
'define_emergency_pathway': 'governance',
|
|
581
569
|
'activate_emergency': 'governance',
|
|
582
|
-
'request_migration': 'governance',
|
|
583
570
|
'create_artifact_provenance': 'governance',
|
|
584
571
|
'create_charter': 'governance',
|
|
585
572
|
'verify_charter': 'governance',
|
|
@@ -603,14 +590,8 @@ const TOOL_SCOPE_MAP = {
|
|
|
603
590
|
// Data tools → 'data'
|
|
604
591
|
'register_data_source': 'data',
|
|
605
592
|
'create_data_enforcement_gate': 'data',
|
|
606
|
-
'check_data_access': 'data',
|
|
607
593
|
'query_contributions': 'data',
|
|
608
|
-
'get_source_metrics': 'data',
|
|
609
|
-
'get_agent_data_footprint': 'data',
|
|
610
594
|
'generate_settlement': 'data',
|
|
611
|
-
'generate_compliance_report': 'data',
|
|
612
|
-
'record_training_use': 'data',
|
|
613
|
-
'get_model_data_sources': 'data',
|
|
614
595
|
'create_access_receipt': 'data',
|
|
615
596
|
'create_access_snapshot': 'data',
|
|
616
597
|
'create_derivation_receipt': 'data',
|
|
@@ -629,13 +610,10 @@ const TOOL_SCOPE_MAP = {
|
|
|
629
610
|
'check_usage_permitted': 'data',
|
|
630
611
|
// Gateway tools → 'gateway'
|
|
631
612
|
'create_gateway': 'gateway',
|
|
632
|
-
'register_gateway_agent': 'gateway',
|
|
633
613
|
'gateway_process_tool_call': 'gateway',
|
|
634
614
|
'gateway_approve': 'gateway',
|
|
635
|
-
'gateway_execute_approval': 'gateway',
|
|
636
615
|
'gateway_stats': 'gateway',
|
|
637
616
|
// Network tools → 'network'
|
|
638
|
-
'publish_intent_card': 'network',
|
|
639
617
|
'search_matches': 'network',
|
|
640
618
|
'get_digest': 'network',
|
|
641
619
|
'request_intro': 'network',
|
|
@@ -1013,7 +991,7 @@ server.tool("get_behavioral_sequence", "Get the post-issuance behavioral sequenc
|
|
|
1013
991
|
}
|
|
1014
992
|
// Classify the behavioral pattern
|
|
1015
993
|
const toolNames = sequence.map(s => s.tool);
|
|
1016
|
-
const hasWork = toolNames.some(t => ['submit_evidence', '
|
|
994
|
+
const hasWork = toolNames.some(t => ['submit_evidence', 'create_agora_message', 'submit_deliverable'].includes(t));
|
|
1017
995
|
const hasExtraction = toolNames.some(t => ['commerce_preflight', 'create_checkout'].includes(t));
|
|
1018
996
|
const pattern = hasWork ? 'productive' : hasExtraction ? 'extractive' : 'neutral';
|
|
1019
997
|
return {
|
|
@@ -2309,7 +2287,7 @@ server.tool("commerce_preflight", "Run preflight checks before a purchase. Valid
|
|
|
2309
2287
|
const actualSpendLimit = sessionDel?.spendLimit ?? 1000;
|
|
2310
2288
|
const hasCommerceScope = sessionDel
|
|
2311
2289
|
? sessionDel.scope.some((s) => s === 'commerce' || s === 'commerce:checkout' || s.startsWith('commerce'))
|
|
2312
|
-
:
|
|
2290
|
+
: false; // no delegation → no commerce scope (agent-context fallback removed with gateway move)
|
|
2313
2291
|
// Use session agent if available (created by identify), fallback to throwaway
|
|
2314
2292
|
const agent = state.sessionAgent || joinSocialContract({
|
|
2315
2293
|
name: args.agent_id,
|
|
@@ -2394,161 +2372,24 @@ server.tool("request_human_approval", "Request human approval for a high-value p
|
|
|
2394
2372
|
// ═══════════════════════════════════════
|
|
2395
2373
|
// AGENT CONTEXT — Enforcement Middleware
|
|
2396
2374
|
// ═══════════════════════════════════════
|
|
2397
|
-
server.tool("create_agent_context", "Create an enforcement context that automatically runs every action through the 3-signature policy chain.
|
|
2375
|
+
server.tool("create_agent_context", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Create an enforcement context that automatically runs every action through the 3-signature policy chain.", {
|
|
2398
2376
|
name: z.string().describe("Agent name"),
|
|
2399
2377
|
mission: z.string().describe("Agent mission statement"),
|
|
2400
|
-
enforcement: z.enum(["auto", "manual", "strict"]).default("auto").describe("Enforcement level
|
|
2401
|
-
delegated_scopes: z.array(z.string()).default([]).describe("Scopes to delegate
|
|
2378
|
+
enforcement: z.enum(["auto", "manual", "strict"]).default("auto").describe("Enforcement level"),
|
|
2379
|
+
delegated_scopes: z.array(z.string()).default([]).describe("Scopes to delegate"),
|
|
2402
2380
|
spend_limit: z.number().default(1000).describe("Maximum spend allowed"),
|
|
2403
|
-
}, async (
|
|
2404
|
-
|
|
2405
|
-
if (keyErr)
|
|
2406
|
-
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
2407
|
-
if (!state.floorYaml) {
|
|
2408
|
-
return { content: [{ type: "text", text: 'No floor loaded. Use load_values_floor first.' }], isError: true };
|
|
2409
|
-
}
|
|
2410
|
-
try {
|
|
2411
|
-
const floor = loadFloor(state.floorYaml);
|
|
2412
|
-
// Create the agent with floor attestation
|
|
2413
|
-
const agent = joinSocialContract({
|
|
2414
|
-
name: args.name,
|
|
2415
|
-
mission: args.mission,
|
|
2416
|
-
owner: 'mcp-session',
|
|
2417
|
-
capabilities: args.delegated_scopes,
|
|
2418
|
-
platform: 'node',
|
|
2419
|
-
models: ['mcp'],
|
|
2420
|
-
floor,
|
|
2421
|
-
});
|
|
2422
|
-
// Create the enforced context
|
|
2423
|
-
const ctx = createAgentContext(agent, floor, {
|
|
2424
|
-
enforcement: args.enforcement,
|
|
2425
|
-
});
|
|
2426
|
-
// Add delegation if scopes provided
|
|
2427
|
-
if (args.delegated_scopes.length > 0) {
|
|
2428
|
-
const principal = joinSocialContract({
|
|
2429
|
-
name: 'mcp-principal',
|
|
2430
|
-
mission: 'MCP session principal',
|
|
2431
|
-
owner: 'human',
|
|
2432
|
-
capabilities: ['admin'],
|
|
2433
|
-
platform: 'node',
|
|
2434
|
-
models: ['mcp'],
|
|
2435
|
-
floor,
|
|
2436
|
-
});
|
|
2437
|
-
const del = delegate({
|
|
2438
|
-
from: principal,
|
|
2439
|
-
toPublicKey: agent.publicKey,
|
|
2440
|
-
scope: args.delegated_scopes,
|
|
2441
|
-
spendLimit: args.spend_limit,
|
|
2442
|
-
maxDepth: 3,
|
|
2443
|
-
expiresInHours: 24,
|
|
2444
|
-
});
|
|
2445
|
-
ctx.addDelegation(del);
|
|
2446
|
-
}
|
|
2447
|
-
state.agentContext = ctx;
|
|
2448
|
-
state.floor = floor;
|
|
2449
|
-
// F-4 fix: also register in state.agents so gateway and other tools can find this agent
|
|
2450
|
-
state.agents.set(agent.agentId, agent);
|
|
2451
|
-
return {
|
|
2452
|
-
content: [{
|
|
2453
|
-
type: "text",
|
|
2454
|
-
text: JSON.stringify({
|
|
2455
|
-
created: true,
|
|
2456
|
-
enforcement: args.enforcement,
|
|
2457
|
-
agentId: agent.agentId,
|
|
2458
|
-
scopes: args.delegated_scopes,
|
|
2459
|
-
spendLimit: args.spend_limit,
|
|
2460
|
-
note: `Agent Context active (${args.enforcement} mode). Use execute_with_context to run actions through the 3-signature chain.`,
|
|
2461
|
-
}, null, 2),
|
|
2462
|
-
}],
|
|
2463
|
-
};
|
|
2464
|
-
}
|
|
2465
|
-
catch (e) {
|
|
2466
|
-
return { content: [{ type: "text", text: safeError("Failed to create context", e) }], isError: true };
|
|
2467
|
-
}
|
|
2468
|
-
});
|
|
2469
|
-
server.tool("execute_with_context", "Execute an action through the enforcement context. Automatically runs the 3-signature chain: creates intent (sig 1), evaluates against floor + delegation (sig 2), returns verdict. Action is DENIED if outside delegated scope.", {
|
|
2381
|
+
}, async (_args) => movedToGateway("create_agent_context"));
|
|
2382
|
+
server.tool("execute_with_context", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Execute an action through the enforcement context.", {
|
|
2470
2383
|
action_type: z.string().describe("Action type (e.g. 'api:fetch', 'data:write', 'commerce:checkout')"),
|
|
2471
2384
|
target: z.string().describe("Target of the action (e.g. URL, file path, resource ID)"),
|
|
2472
2385
|
scope: z.string().describe("Required scope for this action (must match a delegated scope)"),
|
|
2473
2386
|
estimated_spend: z.number().optional().describe("Estimated spend for commerce actions"),
|
|
2474
|
-
}, async (
|
|
2475
|
-
|
|
2476
|
-
return { content: [{ type: "text", text: 'No agent context. Use create_agent_context first.' }], isError: true };
|
|
2477
|
-
}
|
|
2478
|
-
try {
|
|
2479
|
-
const result = state.agentContext.execute({
|
|
2480
|
-
type: args.action_type,
|
|
2481
|
-
target: args.target,
|
|
2482
|
-
scope: args.scope,
|
|
2483
|
-
spend: args.estimated_spend ? { amount: args.estimated_spend, currency: 'USD' } : undefined,
|
|
2484
|
-
});
|
|
2485
|
-
// Store for later completion
|
|
2486
|
-
if (result.permitted && result.intent) {
|
|
2487
|
-
state.pendingActions.set(result.intent.intentId, result);
|
|
2488
|
-
}
|
|
2489
|
-
return {
|
|
2490
|
-
content: [{
|
|
2491
|
-
type: "text",
|
|
2492
|
-
text: JSON.stringify({
|
|
2493
|
-
permitted: result.permitted,
|
|
2494
|
-
verdict: result.verdict,
|
|
2495
|
-
intentId: result.intent?.intentId,
|
|
2496
|
-
evaluatorId: result.decision?.evaluatorId,
|
|
2497
|
-
reason: result.reason,
|
|
2498
|
-
stats: state.agentContext.stats,
|
|
2499
|
-
note: result.permitted
|
|
2500
|
-
? `Action PERMITTED. Call complete_action with intent_id="${result.intent.intentId}" when done.`
|
|
2501
|
-
: `Action DENIED: ${result.reason}`,
|
|
2502
|
-
}, null, 2),
|
|
2503
|
-
}],
|
|
2504
|
-
};
|
|
2505
|
-
}
|
|
2506
|
-
catch (e) {
|
|
2507
|
-
return { content: [{ type: "text", text: safeError("Execute failed", e) }], isError: true };
|
|
2508
|
-
}
|
|
2509
|
-
});
|
|
2510
|
-
server.tool("complete_action", "Complete a permitted action and get the full 3-signature proof chain (intent + decision + receipt + policy receipt). Call this after successfully executing the action.", {
|
|
2387
|
+
}, async (_args) => movedToGateway("execute_with_context"));
|
|
2388
|
+
server.tool("complete_action", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Complete a permitted action and get the full 3-signature proof chain.", {
|
|
2511
2389
|
intent_id: z.string().describe("Intent ID from execute_with_context result"),
|
|
2512
2390
|
status: z.enum(["success", "failure", "partial"]).describe("Outcome of the action"),
|
|
2513
2391
|
summary: z.string().describe("Brief description of what was accomplished"),
|
|
2514
|
-
}, async (
|
|
2515
|
-
if (!state.agentContext) {
|
|
2516
|
-
return { content: [{ type: "text", text: 'No agent context. Use create_agent_context first.' }], isError: true };
|
|
2517
|
-
}
|
|
2518
|
-
// Find the pending execute result
|
|
2519
|
-
const executeResult = state.pendingActions.get(args.intent_id);
|
|
2520
|
-
if (!executeResult) {
|
|
2521
|
-
return { content: [{ type: "text", text: `No pending action found for intent ${args.intent_id}. Was it permitted?` }], isError: true };
|
|
2522
|
-
}
|
|
2523
|
-
try {
|
|
2524
|
-
const completed = state.agentContext.complete(executeResult, {
|
|
2525
|
-
status: args.status,
|
|
2526
|
-
summary: args.summary,
|
|
2527
|
-
});
|
|
2528
|
-
// Clean up
|
|
2529
|
-
state.pendingActions.delete(args.intent_id);
|
|
2530
|
-
return {
|
|
2531
|
-
content: [{
|
|
2532
|
-
type: "text",
|
|
2533
|
-
text: JSON.stringify({
|
|
2534
|
-
completed: true,
|
|
2535
|
-
receiptId: completed.receipt.receiptId,
|
|
2536
|
-
policyReceiptId: completed.policyReceipt?.receiptId,
|
|
2537
|
-
signatures: {
|
|
2538
|
-
intent: '✓ (agent declared intent)',
|
|
2539
|
-
decision: '✓ (policy engine evaluated)',
|
|
2540
|
-
receipt: '✓ (execution recorded)',
|
|
2541
|
-
},
|
|
2542
|
-
stats: state.agentContext.stats,
|
|
2543
|
-
auditTrail: state.agentContext.auditLog.length + ' entries',
|
|
2544
|
-
}, null, 2),
|
|
2545
|
-
}],
|
|
2546
|
-
};
|
|
2547
|
-
}
|
|
2548
|
-
catch (e) {
|
|
2549
|
-
return { content: [{ type: "text", text: safeError("Complete failed", e) }], isError: true };
|
|
2550
|
-
}
|
|
2551
|
-
});
|
|
2392
|
+
}, async (_args) => movedToGateway("complete_action"));
|
|
2552
2393
|
// ═══════════════════════════════════════
|
|
2553
2394
|
// PRINCIPAL IDENTITY TOOLS
|
|
2554
2395
|
// ═══════════════════════════════════════
|
|
@@ -2897,226 +2738,34 @@ server.tool("get_promotion_history", "Get the promotion review history for this
|
|
|
2897
2738
|
};
|
|
2898
2739
|
});
|
|
2899
2740
|
// ═══════════════════════════════════════
|
|
2900
|
-
// Proxy Gateway (
|
|
2741
|
+
// Proxy Gateway (moved to gateway product in v3.0.0)
|
|
2901
2742
|
// ═══════════════════════════════════════
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
2926
|
-
|
|
2927
|
-
|
|
2928
|
-
content: [{
|
|
2929
|
-
type: "text",
|
|
2930
|
-
text: JSON.stringify({
|
|
2931
|
-
created: true,
|
|
2932
|
-
gatewayId: id,
|
|
2933
|
-
publicKey: keys.publicKey,
|
|
2934
|
-
approvalTTLSeconds: config.approvalTTLSeconds,
|
|
2935
|
-
maxPendingPerAgent: config.maxPendingPerAgent,
|
|
2936
|
-
note: "Gateway ready. Register agents with register_gateway_agent, then process calls with gateway_process_tool_call.",
|
|
2937
|
-
}, null, 2),
|
|
2938
|
-
}],
|
|
2939
|
-
};
|
|
2940
|
-
});
|
|
2941
|
-
server.tool("register_gateway_agent", "Register an agent with the gateway. The agent must have a valid passport and floor attestation. Delegations define what scopes the agent can use through the gateway.", {
|
|
2942
|
-
agentId: z.string().describe("Agent ID to register"),
|
|
2943
|
-
}, async ({ agentId }) => {
|
|
2944
|
-
if (!state.gateway) {
|
|
2945
|
-
return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
|
|
2946
|
-
}
|
|
2947
|
-
// F-4 fix: check both state.agents AND state.agentContext for agent data
|
|
2948
|
-
let agent = state.agents.get(agentId);
|
|
2949
|
-
if (!agent && state.agentContext && state.agentId === agentId) {
|
|
2950
|
-
// Agent was created via create_agent_context, bridge to gateway
|
|
2951
|
-
const ctx = state.agentContext;
|
|
2952
|
-
agent = {
|
|
2953
|
-
passport: ctx.agent?.passport || ctx.passport,
|
|
2954
|
-
publicKey: state.agentKey,
|
|
2955
|
-
agentId: state.agentId,
|
|
2956
|
-
attestation: ctx.agent?.attestation || ctx.attestation,
|
|
2957
|
-
};
|
|
2958
|
-
}
|
|
2959
|
-
if (!agent) {
|
|
2960
|
-
return { content: [{ type: "text", text: `Error: Agent "${agentId}" not found in session. Join social contract or create_agent_context first.` }] };
|
|
2961
|
-
}
|
|
2962
|
-
const agentDelegations = Array.from(state.delegations.values()).filter(d => d.delegatedTo === agent.publicKey);
|
|
2963
|
-
if (agentDelegations.length === 0) {
|
|
2964
|
-
return { content: [{ type: "text", text: `Error: No delegations found for agent "${agentId}". Create a delegation first.` }] };
|
|
2965
|
-
}
|
|
2966
|
-
if (!agent.attestation) {
|
|
2967
|
-
return { content: [{ type: "text", text: `Error: Agent "${agentId}" has no floor attestation. Attest to floor first.` }] };
|
|
2968
|
-
}
|
|
2969
|
-
state.gateway.registerAgent(agent.passport, agent.attestation, agentDelegations);
|
|
2970
|
-
return {
|
|
2971
|
-
content: [{
|
|
2972
|
-
type: "text",
|
|
2973
|
-
text: JSON.stringify({
|
|
2974
|
-
registered: true,
|
|
2975
|
-
agentId,
|
|
2976
|
-
delegationCount: agentDelegations.length,
|
|
2977
|
-
scopes: agentDelegations.flatMap(d => d.scope),
|
|
2978
|
-
}, null, 2),
|
|
2979
|
-
}],
|
|
2980
|
-
};
|
|
2981
|
-
});
|
|
2982
|
-
server.tool("gateway_process_tool_call", "Process a tool call through the gateway enforcement boundary. Validates identity, delegation, policy, and replay protection in a single atomic operation. Returns execution result with full 3-signature proof chain.", {
|
|
2983
|
-
agentId: z.string().describe("ID of the requesting agent"),
|
|
2984
|
-
tool: z.string().describe("Tool name to execute"),
|
|
2985
|
-
params: z.record(z.unknown()).optional().describe("Tool parameters"),
|
|
2986
|
-
scopeRequired: z.string().describe("Delegation scope needed for this tool"),
|
|
2987
|
-
spendAmount: z.number().optional().describe("Spend amount if commerce action"),
|
|
2988
|
-
spendCurrency: z.string().optional().describe("Currency code (e.g. USD)"),
|
|
2989
|
-
context: z.string().optional().describe("Human-readable context for audit"),
|
|
2990
|
-
}, async ({ agentId, tool, params, scopeRequired, spendAmount, spendCurrency, context }) => {
|
|
2991
|
-
if (!state.gateway) {
|
|
2992
|
-
return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
|
|
2993
|
-
}
|
|
2994
|
-
const agent = state.agents.get(agentId);
|
|
2995
|
-
if (!agent) {
|
|
2996
|
-
return { content: [{ type: "text", text: `Error: Agent "${agentId}" not found in session.` }] };
|
|
2997
|
-
}
|
|
2998
|
-
const { canonicalize } = await import("agent-passport-system");
|
|
2999
|
-
const requestId = `mcp-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
3000
|
-
const payload = canonicalize({ requestId, agentId, tool, params: params || {}, scopeRequired, spend: spendAmount ? { amount: spendAmount, currency: spendCurrency || 'USD' } : undefined });
|
|
3001
|
-
const request = {
|
|
3002
|
-
requestId,
|
|
3003
|
-
agentId,
|
|
3004
|
-
agentPublicKey: agent.publicKey,
|
|
3005
|
-
signature: sign(payload, agent.keyPair.privateKey),
|
|
3006
|
-
tool,
|
|
3007
|
-
params: params || {},
|
|
3008
|
-
scopeRequired,
|
|
3009
|
-
spend: spendAmount ? { amount: spendAmount, currency: spendCurrency || 'USD' } : undefined,
|
|
3010
|
-
context,
|
|
3011
|
-
};
|
|
3012
|
-
const result = await state.gateway.processToolCall(request);
|
|
3013
|
-
return {
|
|
3014
|
-
content: [{
|
|
3015
|
-
type: "text",
|
|
3016
|
-
text: JSON.stringify({
|
|
3017
|
-
executed: result.executed,
|
|
3018
|
-
requestId: result.requestId,
|
|
3019
|
-
result: result.result ?? undefined,
|
|
3020
|
-
denialReason: result.denialReason ?? undefined,
|
|
3021
|
-
toolError: result.toolError ?? undefined,
|
|
3022
|
-
...(result.decision && { verdict: result.decision.verdict, reason: result.decision.reason }),
|
|
3023
|
-
...(result.proof && {
|
|
3024
|
-
proof: {
|
|
3025
|
-
hasRequestSignature: !!result.proof.requestSignature,
|
|
3026
|
-
hasDecisionSignature: !!result.proof.decisionSignature,
|
|
3027
|
-
hasReceiptSignature: !!result.proof.receiptSignature,
|
|
3028
|
-
policyReceiptId: result.proof.policyReceipt?.policyReceiptId,
|
|
3029
|
-
},
|
|
3030
|
-
}),
|
|
3031
|
-
...(result.receipt && {
|
|
3032
|
-
receipt: {
|
|
3033
|
-
receiptId: result.receipt.receiptId,
|
|
3034
|
-
agentId: result.receipt.agentId,
|
|
3035
|
-
action: result.receipt.action,
|
|
3036
|
-
},
|
|
3037
|
-
}),
|
|
3038
|
-
}, null, 2),
|
|
3039
|
-
}],
|
|
3040
|
-
};
|
|
3041
|
-
});
|
|
3042
|
-
server.tool("gateway_approve", "Two-phase execution: approve a tool call without executing it. Returns an approval ID that can be executed later with gateway_execute_approval. Useful for human-in-the-loop workflows.", {
|
|
3043
|
-
agentId: z.string().describe("ID of the requesting agent"),
|
|
3044
|
-
tool: z.string().describe("Tool name to approve"),
|
|
3045
|
-
params: z.record(z.unknown()).optional().describe("Tool parameters"),
|
|
3046
|
-
scopeRequired: z.string().describe("Delegation scope needed"),
|
|
3047
|
-
context: z.string().optional().describe("Human-readable context"),
|
|
3048
|
-
}, async ({ agentId, tool, params, scopeRequired, context }) => {
|
|
3049
|
-
if (!state.gateway) {
|
|
3050
|
-
return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
|
|
3051
|
-
}
|
|
3052
|
-
const agent = state.agents.get(agentId);
|
|
3053
|
-
if (!agent) {
|
|
3054
|
-
return { content: [{ type: "text", text: `Error: Agent "${agentId}" not found in session.` }] };
|
|
3055
|
-
}
|
|
3056
|
-
const { canonicalize } = await import("agent-passport-system");
|
|
3057
|
-
const requestId = `mcp-approve-${Date.now()}-${Math.random().toString(36).slice(2, 8)}`;
|
|
3058
|
-
const payload = canonicalize({ requestId, agentId, tool, params: params || {}, scopeRequired, spend: undefined });
|
|
3059
|
-
const request = {
|
|
3060
|
-
requestId,
|
|
3061
|
-
agentId,
|
|
3062
|
-
agentPublicKey: agent.publicKey,
|
|
3063
|
-
signature: sign(payload, agent.keyPair.privateKey),
|
|
3064
|
-
tool,
|
|
3065
|
-
params: params || {},
|
|
3066
|
-
scopeRequired,
|
|
3067
|
-
context,
|
|
3068
|
-
};
|
|
3069
|
-
const result = state.gateway.approve(request);
|
|
3070
|
-
return {
|
|
3071
|
-
content: [{
|
|
3072
|
-
type: "text",
|
|
3073
|
-
text: JSON.stringify({
|
|
3074
|
-
approved: result.approved,
|
|
3075
|
-
...(result.approval && {
|
|
3076
|
-
approvalId: result.approval.approvalId,
|
|
3077
|
-
expiresAt: result.approval.expiresAt,
|
|
3078
|
-
nonce: result.approval.nonce,
|
|
3079
|
-
}),
|
|
3080
|
-
...(result.denial && { denial: result.denial }),
|
|
3081
|
-
}, null, 2),
|
|
3082
|
-
}],
|
|
3083
|
-
};
|
|
3084
|
-
});
|
|
3085
|
-
server.tool("gateway_execute_approval", "Execute a previously approved tool call. Rechecks delegation validity before execution — if delegation was revoked since approval, execution is denied.", {
|
|
3086
|
-
approvalId: z.string().describe("Approval ID from gateway_approve"),
|
|
3087
|
-
}, async ({ approvalId }) => {
|
|
3088
|
-
if (!state.gateway) {
|
|
3089
|
-
return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
|
|
3090
|
-
}
|
|
3091
|
-
const result = await state.gateway.executeApproval(approvalId);
|
|
3092
|
-
return {
|
|
3093
|
-
content: [{
|
|
3094
|
-
type: "text",
|
|
3095
|
-
text: JSON.stringify({
|
|
3096
|
-
executed: result.executed,
|
|
3097
|
-
requestId: result.requestId,
|
|
3098
|
-
result: result.result ?? undefined,
|
|
3099
|
-
denialReason: result.denialReason ?? undefined,
|
|
3100
|
-
...(result.proof && {
|
|
3101
|
-
proof: {
|
|
3102
|
-
policyReceiptId: result.proof.policyReceipt?.policyReceiptId,
|
|
3103
|
-
},
|
|
3104
|
-
}),
|
|
3105
|
-
}, null, 2),
|
|
3106
|
-
}],
|
|
3107
|
-
};
|
|
3108
|
-
});
|
|
3109
|
-
server.tool("gateway_stats", "Get gateway statistics: total requests, permits, denials, replay attempts blocked, active agents, and pending approvals.", {}, async () => {
|
|
3110
|
-
if (!state.gateway) {
|
|
3111
|
-
return { content: [{ type: "text", text: "Error: Create gateway first (create_gateway)" }] };
|
|
3112
|
-
}
|
|
3113
|
-
return {
|
|
3114
|
-
content: [{
|
|
3115
|
-
type: "text",
|
|
3116
|
-
text: JSON.stringify(state.gateway.getStats(), null, 2),
|
|
3117
|
-
}],
|
|
3118
|
-
};
|
|
3119
|
-
});
|
|
2743
|
+
// ProxyGateway is a product-layer enforcement runtime. The primitives it
|
|
2744
|
+
// was built on (delegation verification, policy evaluation, replay nonces)
|
|
2745
|
+
// remain in the SDK — rebuild a gateway locally from those, or use the
|
|
2746
|
+
// hosted gateway at gateway.aeoess.com.
|
|
2747
|
+
server.tool("create_gateway", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Create a ProxyGateway enforcement boundary.", {
|
|
2748
|
+
gatewayId: z.string().optional().describe("Custom gateway ID"),
|
|
2749
|
+
approvalTTLSeconds: z.number().optional().describe("Two-phase approval timeout"),
|
|
2750
|
+
maxPendingPerAgent: z.number().optional().describe("Max pending approvals per agent"),
|
|
2751
|
+
}, async (_args) => movedToGateway("create_gateway"));
|
|
2752
|
+
server.tool("gateway_process_tool_call", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Process a tool call through the gateway enforcement boundary.", {
|
|
2753
|
+
agentId: z.string(),
|
|
2754
|
+
tool: z.string(),
|
|
2755
|
+
params: z.record(z.unknown()).optional(),
|
|
2756
|
+
scopeRequired: z.string(),
|
|
2757
|
+
spendAmount: z.number().optional(),
|
|
2758
|
+
spendCurrency: z.string().optional(),
|
|
2759
|
+
context: z.string().optional(),
|
|
2760
|
+
}, async (_args) => movedToGateway("gateway_process_tool_call"));
|
|
2761
|
+
server.tool("gateway_approve", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Two-phase execution: approve a tool call without executing it.", {
|
|
2762
|
+
agentId: z.string(),
|
|
2763
|
+
tool: z.string(),
|
|
2764
|
+
params: z.record(z.unknown()).optional(),
|
|
2765
|
+
scopeRequired: z.string(),
|
|
2766
|
+
context: z.string().optional(),
|
|
2767
|
+
}, async (_args) => movedToGateway("gateway_approve"));
|
|
2768
|
+
server.tool("gateway_stats", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Get gateway statistics.", {}, async (_args) => movedToGateway("gateway_stats"));
|
|
3120
2769
|
// ═══════════════════════════════════════
|
|
3121
2770
|
// Intent Network (Agent-Mediated Matching)
|
|
3122
2771
|
// Calls the hosted API at api.aeoess.com
|
|
@@ -3129,83 +2778,9 @@ async function intentApiFetch(path, opts) {
|
|
|
3129
2778
|
});
|
|
3130
2779
|
return res.json();
|
|
3131
2780
|
}
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
category: z.string().describe("Category (e.g. 'engineering', 'design', 'funding')"),
|
|
3136
|
-
description: z.string().describe("What is needed"),
|
|
3137
|
-
priority: z.enum(["critical", "high", "medium", "low"]).default("medium"),
|
|
3138
|
-
tags: z.array(z.string()).optional(),
|
|
3139
|
-
budget_amount: z.number().optional(),
|
|
3140
|
-
budget_currency: z.string().optional(),
|
|
3141
|
-
})).optional().describe("What the human needs"),
|
|
3142
|
-
offers: z.array(z.object({
|
|
3143
|
-
category: z.string().describe("Category of what's offered"),
|
|
3144
|
-
description: z.string().describe("What is offered"),
|
|
3145
|
-
priority: z.enum(["critical", "high", "medium", "low"]).default("medium"),
|
|
3146
|
-
tags: z.array(z.string()).optional(),
|
|
3147
|
-
budget_amount: z.number().optional(),
|
|
3148
|
-
budget_currency: z.string().optional(),
|
|
3149
|
-
})).optional().describe("What the human offers"),
|
|
3150
|
-
open_to: z.array(z.string()).optional().describe("Categories open to (e.g. ['introductions', 'partnerships'])"),
|
|
3151
|
-
not_open_to: z.array(z.string()).optional().describe("Categories explicitly not open to"),
|
|
3152
|
-
approval_required: z.array(z.string()).optional().describe("What needs human approval before sharing"),
|
|
3153
|
-
visibility: z.enum(["public", "verified", "minimal"]).default("public"),
|
|
3154
|
-
ttl_hours: z.number().default(24).describe("Hours until card expires"),
|
|
3155
|
-
}, async (args) => {
|
|
3156
|
-
recordBehavior('publish_intent_card');
|
|
3157
|
-
const keyErr = requireKey();
|
|
3158
|
-
if (keyErr)
|
|
3159
|
-
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
3160
|
-
const mapItem = (item) => ({
|
|
3161
|
-
category: item.category,
|
|
3162
|
-
description: item.description,
|
|
3163
|
-
priority: item.priority || 'medium',
|
|
3164
|
-
tags: item.tags || [],
|
|
3165
|
-
budget: item.budget_amount ? { amount: item.budget_amount, currency: item.budget_currency || 'USD' } : undefined,
|
|
3166
|
-
visibility: 'public',
|
|
3167
|
-
});
|
|
3168
|
-
const card = createIntentCard({
|
|
3169
|
-
agentId: state.agentId || 'anonymous',
|
|
3170
|
-
principalAlias: args.principal_alias,
|
|
3171
|
-
publicKey: state.agentKey,
|
|
3172
|
-
privateKey: state.privateKey,
|
|
3173
|
-
needs: (args.needs || []).map(mapItem),
|
|
3174
|
-
offers: (args.offers || []).map(mapItem),
|
|
3175
|
-
openTo: args.open_to || [],
|
|
3176
|
-
notOpenTo: args.not_open_to || [],
|
|
3177
|
-
approvalRequired: args.approval_required || [],
|
|
3178
|
-
ttlSeconds: (args.ttl_hours || 24) * 3600,
|
|
3179
|
-
});
|
|
3180
|
-
try {
|
|
3181
|
-
const result = await intentApiFetch('/api/cards', {
|
|
3182
|
-
method: 'POST',
|
|
3183
|
-
body: JSON.stringify({ ...card, publicKey: state.agentKey, signature: card.signature }),
|
|
3184
|
-
});
|
|
3185
|
-
if (result.error) {
|
|
3186
|
-
return { content: [{ type: "text", text: `Failed to publish: ${result.error}` }], isError: true };
|
|
3187
|
-
}
|
|
3188
|
-
return {
|
|
3189
|
-
content: [{
|
|
3190
|
-
type: "text",
|
|
3191
|
-
text: JSON.stringify({
|
|
3192
|
-
published: true,
|
|
3193
|
-
cardId: result.cardId,
|
|
3194
|
-
agentId: card.agentId,
|
|
3195
|
-
principalAlias: card.principalAlias,
|
|
3196
|
-
needs: card.needs.length,
|
|
3197
|
-
offers: card.offers.length,
|
|
3198
|
-
expiresAt: result.expiresAt,
|
|
3199
|
-
networkSize: result.networkSize,
|
|
3200
|
-
note: 'Card published to Intent Network (api.aeoess.com). Other agents worldwide can now discover matches.',
|
|
3201
|
-
}, null, 2),
|
|
3202
|
-
}],
|
|
3203
|
-
};
|
|
3204
|
-
}
|
|
3205
|
-
catch (e) {
|
|
3206
|
-
return { content: [{ type: "text", text: safeError("API error", e) }], isError: true };
|
|
3207
|
-
}
|
|
3208
|
-
});
|
|
2781
|
+
// publish_intent_card removed in v3.0.0: createIntentCard was gateway-side
|
|
2782
|
+
// signing glue. Cards are still publishable directly via the Intent Network
|
|
2783
|
+
// REST API at api.aeoess.com/api/cards — sign with your agent private key.
|
|
3209
2784
|
server.tool("search_matches", "Search the Intent Network for people relevant to you. Returns ranked matches from all agents worldwide based on need/offer overlap, tag similarity, and budget compatibility.", {
|
|
3210
2785
|
min_score: z.number().optional().describe("Minimum relevance score 0-1 (default: 0.1)"),
|
|
3211
2786
|
max_results: z.number().optional().describe("Maximum results to return (default: 10)"),
|
|
@@ -3281,7 +2856,7 @@ server.tool("get_digest", "Get a personalized digest from the Intent Network: re
|
|
|
3281
2856
|
message: intro.message,
|
|
3282
2857
|
status: intro.status,
|
|
3283
2858
|
})),
|
|
3284
|
-
note: !digest.hasCard ? 'No card published yet.
|
|
2859
|
+
note: !digest.hasCard ? 'No card published yet. POST to api.aeoess.com/api/cards to join the network (publish_intent_card tool removed in v3.0.0).' : undefined,
|
|
3285
2860
|
}, null, 2),
|
|
3286
2861
|
}],
|
|
3287
2862
|
};
|
|
@@ -3601,73 +3176,12 @@ server.tool("activate_emergency", "Activate a pre-authorized emergency pathway w
|
|
|
3601
3176
|
return { content: [{ type: "text", text: safeError("Emergency activation failed", e) }], isError: true };
|
|
3602
3177
|
}
|
|
3603
3178
|
});
|
|
3604
|
-
|
|
3605
|
-
|
|
3606
|
-
|
|
3607
|
-
|
|
3608
|
-
|
|
3609
|
-
|
|
3610
|
-
confidence: z.number().min(0).max(1),
|
|
3611
|
-
semantic_uncertainty: z.enum(["low", "medium", "high", "critical"]),
|
|
3612
|
-
required: z.boolean().default(true),
|
|
3613
|
-
valid_until: z.string(), trust_epoch: z.number().default(1),
|
|
3614
|
-
}, async (args) => {
|
|
3615
|
-
const keyErr = requireKey();
|
|
3616
|
-
if (keyErr)
|
|
3617
|
-
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
3618
|
-
try {
|
|
3619
|
-
const ctx = createPolicyContext({
|
|
3620
|
-
policy_version: "2.0.0", values_floor_version: "1.0.0",
|
|
3621
|
-
trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
|
|
3622
|
-
valid_until: args.valid_until,
|
|
3623
|
-
});
|
|
3624
|
-
const att = createV2Attestation({
|
|
3625
|
-
action_id: args.action_id, agent_id: state.agentKey,
|
|
3626
|
-
delegation_ref: args.delegation_ref,
|
|
3627
|
-
context_understanding: args.context_understanding,
|
|
3628
|
-
factors_considered: args.factors_considered,
|
|
3629
|
-
alternatives_rejected: args.alternatives_rejected,
|
|
3630
|
-
expected_outcome: args.expected_outcome,
|
|
3631
|
-
confidence: args.confidence,
|
|
3632
|
-
semantic_uncertainty: args.semantic_uncertainty,
|
|
3633
|
-
required: args.required, policy_context: ctx,
|
|
3634
|
-
agent_private_key: state.privateKey,
|
|
3635
|
-
});
|
|
3636
|
-
const quality = assessV2AttestationQuality(att);
|
|
3637
|
-
return { content: [{ type: "text", text: JSON.stringify({ attestation: att, quality }, null, 2) }] };
|
|
3638
|
-
}
|
|
3639
|
-
catch (e) {
|
|
3640
|
-
return { content: [{ type: "text", text: safeError("Attestation failed", e) }], isError: true };
|
|
3641
|
-
}
|
|
3642
|
-
});
|
|
3643
|
-
server.tool("request_migration", "Request fork-and-sunset migration when current delegation scope is insufficient.", {
|
|
3644
|
-
source_delegation: z.string(),
|
|
3645
|
-
limitation: z.string().describe("What the agent cannot do under current scope"),
|
|
3646
|
-
requested_scope_change: z.string(),
|
|
3647
|
-
justification: z.string(),
|
|
3648
|
-
valid_until: z.string(), trust_epoch: z.number().default(1),
|
|
3649
|
-
}, async (args) => {
|
|
3650
|
-
const keyErr = requireKey();
|
|
3651
|
-
if (keyErr)
|
|
3652
|
-
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
3653
|
-
try {
|
|
3654
|
-
const ctx = createPolicyContext({
|
|
3655
|
-
policy_version: "2.0.0", values_floor_version: "1.0.0",
|
|
3656
|
-
trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
|
|
3657
|
-
valid_until: args.valid_until,
|
|
3658
|
-
});
|
|
3659
|
-
const req = requestV2Migration({
|
|
3660
|
-
source_agent: state.agentKey, source_delegation: args.source_delegation,
|
|
3661
|
-
limitation: args.limitation, requested_scope_change: args.requested_scope_change,
|
|
3662
|
-
justification: args.justification, agent_private_key: state.privateKey,
|
|
3663
|
-
policy_context: ctx,
|
|
3664
|
-
});
|
|
3665
|
-
return { content: [{ type: "text", text: JSON.stringify(req, null, 2) }] };
|
|
3666
|
-
}
|
|
3667
|
-
catch (e) {
|
|
3668
|
-
return { content: [{ type: "text", text: safeError("Migration request failed", e) }], isError: true };
|
|
3669
|
-
}
|
|
3670
|
-
});
|
|
3179
|
+
// create_attestation (contextual attestation lifecycle) removed in v3.0.0:
|
|
3180
|
+
// createV2Attestation / getV2AgentAttestationQualityAvg / clearV2AttestationStore
|
|
3181
|
+
// were gateway-side lifecycle helpers. The primitive assessV2AttestationQuality
|
|
3182
|
+
// remains in the SDK for direct use.
|
|
3183
|
+
// request_migration removed in v3.0.0: requestV2Migration / approveV2Migration /
|
|
3184
|
+
// executeV2Migration were gateway-side migration orchestration.
|
|
3671
3185
|
server.tool("create_artifact_provenance", "Tag an agent-generated artifact with provenance metadata (content hash, risk class, authoring agent).", {
|
|
3672
3186
|
delegation_ref: z.string(), intended_use: z.string(),
|
|
3673
3187
|
risk_class: z.enum(["low", "medium", "high", "critical"]),
|
|
@@ -3700,39 +3214,10 @@ server.tool("create_artifact_provenance", "Tag an agent-generated artifact with
|
|
|
3700
3214
|
return { content: [{ type: "text", text: safeError("Provenance failed", e) }], isError: true };
|
|
3701
3215
|
}
|
|
3702
3216
|
});
|
|
3703
|
-
|
|
3704
|
-
|
|
3705
|
-
|
|
3706
|
-
|
|
3707
|
-
delegation_ref: z.string(),
|
|
3708
|
-
was_delegated: z.boolean().default(false),
|
|
3709
|
-
complexity: z.number().min(0).max(1).default(0.5),
|
|
3710
|
-
}, async (args) => {
|
|
3711
|
-
const keyErr = requireKey();
|
|
3712
|
-
if (keyErr)
|
|
3713
|
-
return { content: [{ type: "text", text: keyErr }], isError: true };
|
|
3714
|
-
try {
|
|
3715
|
-
const record = {
|
|
3716
|
-
action_id: args.action_id, agent_id: state.agentKey,
|
|
3717
|
-
authority_level: args.authority_level,
|
|
3718
|
-
semantic_uncertainty: args.semantic_uncertainty,
|
|
3719
|
-
risk_class: args.risk_class,
|
|
3720
|
-
delegation_ref: args.delegation_ref,
|
|
3721
|
-
was_delegated: args.was_delegated,
|
|
3722
|
-
complexity: args.complexity,
|
|
3723
|
-
timestamp: new Date().toISOString(),
|
|
3724
|
-
};
|
|
3725
|
-
recordV2Action(record);
|
|
3726
|
-
const anomaly = checkV2FirstMaxAuthority(record);
|
|
3727
|
-
const concentration = computeV2ConcentrationMetrics(state.agentKey);
|
|
3728
|
-
return { content: [{ type: "text", text: JSON.stringify({
|
|
3729
|
-
action_recorded: true, anomaly_flag: anomaly, concentration,
|
|
3730
|
-
}, null, 2) }] };
|
|
3731
|
-
}
|
|
3732
|
-
catch (e) {
|
|
3733
|
-
return { content: [{ type: "text", text: safeError("Anomaly check failed", e) }], isError: true };
|
|
3734
|
-
}
|
|
3735
|
-
});
|
|
3217
|
+
// check_anomaly removed in v3.0.0: anomaly detection is a cross-session
|
|
3218
|
+
// product capability (recordV2Action / checkV2FirstMaxAuthority /
|
|
3219
|
+
// computeV2ConcentrationMetrics). The gateway maintains the per-agent action
|
|
3220
|
+
// history; MCP tools operate per-session and cannot supply meaningful trends.
|
|
3736
3221
|
// ═══════════════════════════════════════
|
|
3737
3222
|
// Data Governance Tools (Modules 36A, 38, 39)
|
|
3738
3223
|
// ═══════════════════════════════════════
|
|
@@ -3777,142 +3262,31 @@ server.tool("register_data_source", "Register a data source with terms for agent
|
|
|
3777
3262
|
state.sourceReceipts.set(receipt.sourceReceiptId, receipt);
|
|
3778
3263
|
return { content: [{ type: "text", text: `✅ Data source registered.\n\nSource Receipt ID: ${receipt.sourceReceiptId}\nDescriptor: ${p.contentDescriptor}\nAllowed purposes: ${p.allowedPurposes.join(', ')}\nCompensation: ${p.compensationType}${p.compensationAmount ? ' $' + p.compensationAmount : ''}\nMax accesses: ${p.maxAccessCount || 'unlimited'}\nDerivative policy: ${p.derivativePolicy}` }] };
|
|
3779
3264
|
});
|
|
3780
|
-
server.tool("create_data_enforcement_gate", "Create a data enforcement gate that checks terms before allowing data access.
|
|
3265
|
+
server.tool("create_data_enforcement_gate", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Create a data enforcement gate that checks terms before allowing data access.", {
|
|
3781
3266
|
mode: z.enum(["enforce", "audit", "off"]).default("enforce").describe("Enforcement mode"),
|
|
3782
|
-
}, async (
|
|
3783
|
-
|
|
3784
|
-
state.dataEnforcementGate = new DataEnforcementGate({
|
|
3785
|
-
gatewayId: 'gw_data_' + Date.now().toString(36),
|
|
3786
|
-
gatewayPublicKey: kp.publicKey,
|
|
3787
|
-
gatewayPrivateKey: kp.privateKey,
|
|
3788
|
-
mode: p.mode,
|
|
3789
|
-
}, state.contributionLedger);
|
|
3790
|
-
// Register all known sources
|
|
3791
|
-
for (const [id, receipt] of state.sourceReceipts) {
|
|
3792
|
-
state.dataEnforcementGate.registerSource(receipt, receipt.contentDescriptor);
|
|
3793
|
-
}
|
|
3794
|
-
return { content: [{ type: "text", text: `✅ Data enforcement gate created.\n\nMode: ${p.mode}\nRegistered sources: ${state.sourceReceipts.size}\nContribution ledger: active` }] };
|
|
3795
|
-
});
|
|
3796
|
-
server.tool("check_data_access", "Check if an agent can access a data source through the enforcement gate. Generates receipt and feeds contribution ledger.", {
|
|
3797
|
-
sourceReceiptId: z.string().describe("Source receipt ID to access"),
|
|
3798
|
-
declaredPurpose: z.enum(["read", "analyze", "summarize", "generate", "recommend", "train", "embed", "redistribute", "commercial"]).describe("Declared purpose"),
|
|
3799
|
-
accessMethod: z.enum(["api_call", "file_read", "database_query", "web_fetch", "memory_retrieval", "embedding_lookup", "stream", "human_provided"]).default("api_call"),
|
|
3800
|
-
}, async (p) => {
|
|
3801
|
-
if (!state.dataEnforcementGate)
|
|
3802
|
-
return { content: [{ type: "text", text: "❌ No enforcement gate. Call create_data_enforcement_gate first." }] };
|
|
3803
|
-
if (!state.agentKey)
|
|
3804
|
-
return { content: [{ type: "text", text: "❌ Not identified." }] };
|
|
3805
|
-
const decision = state.dataEnforcementGate.checkAccess({
|
|
3806
|
-
agentId: state.agentId || 'unknown',
|
|
3807
|
-
agentPublicKey: state.agentKey,
|
|
3808
|
-
principalId: state.principal?.principalId || 'unknown',
|
|
3809
|
-
sourceReceiptId: p.sourceReceiptId,
|
|
3810
|
-
declaredPurpose: p.declaredPurpose,
|
|
3811
|
-
accessMethod: p.accessMethod,
|
|
3812
|
-
accessScope: 'data:' + p.declaredPurpose,
|
|
3813
|
-
executionFrameId: 'frame_' + Date.now().toString(36),
|
|
3814
|
-
});
|
|
3815
|
-
const status = decision.allowed ? '✅ Access ALLOWED' : '❌ Access DENIED';
|
|
3816
|
-
let text = `${status}\n\nSource: ${p.sourceReceiptId}\nPurpose: ${p.declaredPurpose}`;
|
|
3817
|
-
if (decision.hardViolations.length)
|
|
3818
|
-
text += `\nViolations: ${decision.hardViolations.join('; ')}`;
|
|
3819
|
-
if (decision.advisoryWarnings.length)
|
|
3820
|
-
text += `\nWarnings: ${decision.advisoryWarnings.join('; ')}`;
|
|
3821
|
-
if (decision.receipt)
|
|
3822
|
-
text += `\nReceipt ID: ${decision.receipt.accessReceiptId}`;
|
|
3823
|
-
if (decision.accessesRemaining !== undefined)
|
|
3824
|
-
text += `\nAccesses remaining: ${decision.accessesRemaining}`;
|
|
3825
|
-
return { content: [{ type: "text", text }] };
|
|
3826
|
-
});
|
|
3827
|
-
server.tool("query_contributions", "Query the data contribution ledger. Filter by source, agent, principal, purpose, or time range.", {
|
|
3267
|
+
}, async (_args) => movedToGateway("create_data_enforcement_gate"));
|
|
3268
|
+
server.tool("query_contributions", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Query the data contribution ledger.", {
|
|
3828
3269
|
sourceReceiptId: z.string().optional(),
|
|
3829
3270
|
agentId: z.string().optional(),
|
|
3830
3271
|
principalId: z.string().optional(),
|
|
3831
3272
|
purpose: z.string().optional(),
|
|
3832
3273
|
minAccessCount: z.number().optional(),
|
|
3833
|
-
}, async (
|
|
3834
|
-
|
|
3835
|
-
if (records.length === 0)
|
|
3836
|
-
return { content: [{ type: "text", text: "No contributions found matching query." }] };
|
|
3837
|
-
const lines = records.map(r => `• ${r.sourceDescriptor || r.sourceReceiptId}: ${r.accessCount} accesses by ${r.agentId}, purposes: ${r.purposes.join('/')}, owed: $${r.compensationAccrued.totalOwed.toFixed(4)}`);
|
|
3838
|
-
return { content: [{ type: "text", text: `📊 ${records.length} contribution records:\n\n${lines.join('\n')}` }] };
|
|
3839
|
-
});
|
|
3840
|
-
server.tool("get_source_metrics", "Get aggregate metrics for a data source: total accesses, unique agents, compensation owed.", {
|
|
3841
|
-
sourceReceiptId: z.string().describe("Source receipt ID"),
|
|
3842
|
-
}, async (p) => {
|
|
3843
|
-
const metrics = getSourceMetrics(state.contributionLedger, p.sourceReceiptId);
|
|
3844
|
-
if (!metrics)
|
|
3845
|
-
return { content: [{ type: "text", text: "No data found for this source." }] };
|
|
3846
|
-
return { content: [{ type: "text", text: `📊 Source Metrics: ${metrics.sourceDescriptor}\n\nTotal accesses: ${metrics.totalAccesses}\nUnique agents: ${metrics.uniqueAgents}\nUnique principals: ${metrics.uniquePrincipals}\nCompensation owed: $${metrics.compensationOwed.totalOwed.toFixed(4)} ${metrics.compensationOwed.currency}\nPurpose breakdown: ${JSON.stringify(metrics.purposeBreakdown)}\nTop agents: ${metrics.topAgents.map(a => `${a.agentId} (${a.accessCount})`).join(', ')}` }] };
|
|
3847
|
-
});
|
|
3848
|
-
server.tool("get_agent_data_footprint", "Show every data source an agent has accessed, with compensation status.", {
|
|
3849
|
-
agentId: z.string().describe("Agent ID to check"),
|
|
3850
|
-
}, async (p) => {
|
|
3851
|
-
const footprint = getAgentDataFootprint(state.contributionLedger, p.agentId);
|
|
3852
|
-
if (!footprint)
|
|
3853
|
-
return { content: [{ type: "text", text: "No data access found for this agent." }] };
|
|
3854
|
-
const sources = footprint.sourcesAccessed.map(s => `• ${s.sourceDescriptor || s.sourceReceiptId}: ${s.accessCount} accesses, purposes: ${s.purposes.join('/')}, status: ${s.compensationStatus}`);
|
|
3855
|
-
return { content: [{ type: "text", text: `🔍 Agent Data Footprint: ${p.agentId}\n\nTotal sources: ${footprint.totalSources}\nTotal accesses: ${footprint.totalAccesses}\nTotal compensation accrued: $${footprint.totalCompensationAccrued.toFixed(4)} ${footprint.currency}\n\nSources:\n${sources.join('\n')}` }] };
|
|
3856
|
-
});
|
|
3857
|
-
server.tool("generate_settlement", "Generate a Merkle-committed, signed settlement record for a period. Shows what's owed to each data source.", {
|
|
3274
|
+
}, async (_args) => movedToGateway("query_contributions"));
|
|
3275
|
+
server.tool("generate_settlement", "[deprecated in v3.0.0 — use gateway.aeoess.com REST API] Generate a Merkle-committed, signed settlement record for a period.", {
|
|
3858
3276
|
startDate: z.string().describe("Period start (YYYY-MM-DD)"),
|
|
3859
3277
|
endDate: z.string().describe("Period end (YYYY-MM-DD)"),
|
|
3860
3278
|
periodLabel: z.string().describe("Label (e.g. '2026-Q1', '2026-03')"),
|
|
3861
|
-
}, async (
|
|
3862
|
-
|
|
3863
|
-
|
|
3864
|
-
|
|
3865
|
-
|
|
3866
|
-
|
|
3867
|
-
|
|
3868
|
-
|
|
3869
|
-
|
|
3870
|
-
|
|
3871
|
-
|
|
3872
|
-
periodLabel: z.string().describe("Label"),
|
|
3873
|
-
agentId: z.string().optional().describe("Filter by agent"),
|
|
3874
|
-
principalId: z.string().optional().describe("Filter by principal"),
|
|
3875
|
-
}, async (p) => {
|
|
3876
|
-
const kp = generateKeyPair();
|
|
3877
|
-
const report = generateDataComplianceReport(state.contributionLedger, { startDate: p.startDate, endDate: p.endDate, periodLabel: p.periodLabel }, p.reportType, kp.privateKey, { agentId: p.agentId, principalId: p.principalId });
|
|
3878
|
-
return { content: [{ type: "text", text: `📋 Compliance Report: ${report.reportId}\n\nType: ${p.reportType}\nPeriod: ${p.periodLabel}\nTotal data accesses: ${report.summary.totalDataAccesses}\nUnique data sources: ${report.summary.uniqueDataSources}\nPurpose breakdown: ${JSON.stringify(report.summary.purposeBreakdown)}\nCompensation: $${report.summary.compensationSummary.total.toFixed(4)} (pending: $${report.summary.compensationSummary.pending.toFixed(4)})\nTerms violations: ${report.summary.termsViolations}\nAdvisory warnings: ${report.summary.advisoryWarnings}\nSigned: ✅` }] };
|
|
3879
|
-
});
|
|
3880
|
-
server.tool("record_training_use", "Record that agent output derived from data sources was used for training/fine-tuning/embedding. Creates a signed training attribution receipt.", {
|
|
3881
|
-
trainingUseType: z.enum(["fine_tune", "lora_adapter", "embedding", "rag_index", "distillation", "evaluation", "synthetic_data"]).describe("Type of training use"),
|
|
3882
|
-
modelId: z.string().describe("Model being trained"),
|
|
3883
|
-
sourceAccessReceiptIds: z.array(z.string()).describe("Access receipt IDs of source data used"),
|
|
3884
|
-
outputContentHash: z.string().describe("SHA-256 of the output used for training"),
|
|
3885
|
-
contributionWeights: z.record(z.number()).optional().describe("Fractional weights per source (sum to 1.0)"),
|
|
3886
|
-
datasetSize: z.number().optional().describe("Number of training examples"),
|
|
3887
|
-
}, async (p) => {
|
|
3888
|
-
if (!state.agentKey || !state.privateKey)
|
|
3889
|
-
return { content: [{ type: "text", text: "❌ Not identified." }] };
|
|
3890
|
-
const receipt = createTrainingAttribution({
|
|
3891
|
-
trainingUseType: p.trainingUseType,
|
|
3892
|
-
modelId: p.modelId,
|
|
3893
|
-
trainerId: state.agentId || 'unknown',
|
|
3894
|
-
trainerPublicKey: state.agentKey,
|
|
3895
|
-
trainerPrivateKey: state.privateKey,
|
|
3896
|
-
sourceAccessReceiptIds: p.sourceAccessReceiptIds,
|
|
3897
|
-
executionFrameId: 'frame_train_' + Date.now().toString(36),
|
|
3898
|
-
outputContentHash: p.outputContentHash,
|
|
3899
|
-
inputDataHashes: p.sourceAccessReceiptIds.map(id => id), // simplified
|
|
3900
|
-
contributionWeights: p.contributionWeights,
|
|
3901
|
-
datasetSize: p.datasetSize,
|
|
3902
|
-
});
|
|
3903
|
-
recordTrainingAttribution(state.trainingLedger, receipt);
|
|
3904
|
-
const v = verifyTrainingAttribution(receipt);
|
|
3905
|
-
return { content: [{ type: "text", text: `✅ Training attribution recorded.\n\nReceipt: ${receipt.trainingReceiptId}\nType: ${p.trainingUseType}\nModel: ${p.modelId}\nSources: ${p.sourceAccessReceiptIds.length}\nDataset size: ${p.datasetSize || 'N/A'}\nWeights: ${p.contributionWeights ? JSON.stringify(p.contributionWeights) : 'equal'}\nVerification: ${v.valid ? '✅' : '❌'}` }] };
|
|
3906
|
-
});
|
|
3907
|
-
server.tool("get_model_data_sources", "Show which data sources contributed to a model's training, with fractional weights.", {
|
|
3908
|
-
modelId: z.string().describe("Model ID to check"),
|
|
3909
|
-
}, async (p) => {
|
|
3910
|
-
const sources = getModelDataSources(state.trainingLedger, p.modelId);
|
|
3911
|
-
if (sources.length === 0)
|
|
3912
|
-
return { content: [{ type: "text", text: "No training data found for this model." }] };
|
|
3913
|
-
const lines = sources.map(s => `• ${s.accessReceiptId}: weight ${s.weight.toFixed(4)}, type: ${s.trainingUseType}`);
|
|
3914
|
-
return { content: [{ type: "text", text: `🧠 Model Training Sources: ${p.modelId}\n\n${sources.length} data sources contributed:\n${lines.join('\n')}` }] };
|
|
3915
|
-
});
|
|
3279
|
+
}, async (_args) => movedToGateway("generate_settlement"));
|
|
3280
|
+
// Removed in v3.0.0 (moved to gateway product — no stub to keep tool count bounded):
|
|
3281
|
+
// check_data_access (DataEnforcementGate.checkAccess)
|
|
3282
|
+
// get_source_metrics (cross-agent ledger aggregation)
|
|
3283
|
+
// get_agent_data_footprint (cross-agent ledger aggregation)
|
|
3284
|
+
// generate_compliance_report (generateDataComplianceReport)
|
|
3285
|
+
// record_training_use (createTrainingAttribution + ledger)
|
|
3286
|
+
// get_model_data_sources (training ledger aggregation)
|
|
3287
|
+
// All of these required ContributionLedger / TrainingAttributionLedger
|
|
3288
|
+
// (ledger classes are gateway-product). The underlying primitives
|
|
3289
|
+
// (access receipts, settlement signing) remain in the SDK at aps_* tools.
|
|
3916
3290
|
// ═══════════════════════════════════════
|
|
3917
3291
|
// Data Lifecycle Governance Tools
|
|
3918
3292
|
// ═══════════════════════════════════════
|
|
@@ -4983,6 +4357,108 @@ server.tool("aps_build_contributor_query", "Build a contributor-query response:
|
|
|
4983
4357
|
return { content: [{ type: "text", text: safeError("buildContributorQuery failed", e) }], isError: true };
|
|
4984
4358
|
}
|
|
4985
4359
|
});
|
|
4360
|
+
// ═══════════════════════════════════════
|
|
4361
|
+
// Mutual Authentication v1 tools (SDK v2.2.0)
|
|
4362
|
+
// ═══════════════════════════════════════
|
|
4363
|
+
server.tool("mutualAuthBuildCertificate", "Build and sign a mutual-auth certificate identifying an agent or information system. Returns the signed MutualAuthCertificate object ready to carry into a handshake. The issuer's Ed25519 private key (hex) signs over the canonical (JCS) form.", {
|
|
4364
|
+
role: z.enum(["agent", "information_system"]).describe("Role of the subject this cert identifies"),
|
|
4365
|
+
subject_id: z.string().describe("Stable subject identifier (e.g., agent DID, IS endpoint URL)"),
|
|
4366
|
+
subject_pubkey_hex: z.string().describe("Ed25519 public key (hex) of the subject"),
|
|
4367
|
+
issuer_id: z.string().describe("Issuer identifier"),
|
|
4368
|
+
issuer_role: z.enum(["agent", "information_system", "trust_anchor"]).describe("Role of the issuer"),
|
|
4369
|
+
issuer_pubkey_hex: z.string().describe("Ed25519 public key (hex) of the issuer"),
|
|
4370
|
+
issuer_privkey_hex: z.string().describe("Ed25519 private key (hex) of the issuer — used to sign"),
|
|
4371
|
+
binding: z.string().describe("For an agent: the APS agent_id. For an IS: the resource domain (e.g., mcp://api.bank.com)"),
|
|
4372
|
+
not_before: z.number().describe("Earliest valid time (unix ms)"),
|
|
4373
|
+
not_after: z.number().describe("Latest valid time (unix ms)"),
|
|
4374
|
+
supported_versions: z.array(z.string()).describe("Protocol versions supported, highest first (e.g., ['1.0'])"),
|
|
4375
|
+
attestation_grade: z.union([z.literal(0), z.literal(1), z.literal(2), z.literal(3)]).optional().describe("For agents: APS attestation grade 0-3"),
|
|
4376
|
+
capabilities: z.array(z.string()).optional().describe("Optional capability tags"),
|
|
4377
|
+
}, async (args) => {
|
|
4378
|
+
try {
|
|
4379
|
+
const unsigned = buildCertificate({
|
|
4380
|
+
role: args.role,
|
|
4381
|
+
subject_id: args.subject_id,
|
|
4382
|
+
subject_pubkey_hex: args.subject_pubkey_hex,
|
|
4383
|
+
issuer_id: args.issuer_id,
|
|
4384
|
+
issuer_role: args.issuer_role,
|
|
4385
|
+
binding: args.binding,
|
|
4386
|
+
not_before: args.not_before,
|
|
4387
|
+
not_after: args.not_after,
|
|
4388
|
+
supported_versions: args.supported_versions,
|
|
4389
|
+
attestation_grade: args.attestation_grade,
|
|
4390
|
+
capabilities: args.capabilities,
|
|
4391
|
+
}, args.issuer_pubkey_hex);
|
|
4392
|
+
const cert = signCertificate(unsigned, args.issuer_privkey_hex);
|
|
4393
|
+
return {
|
|
4394
|
+
content: [{ type: "text", text: JSON.stringify({
|
|
4395
|
+
certificate: cert,
|
|
4396
|
+
certificate_id: certificateId(cert),
|
|
4397
|
+
}, null, 2) }],
|
|
4398
|
+
};
|
|
4399
|
+
}
|
|
4400
|
+
catch (e) {
|
|
4401
|
+
return { content: [{ type: "text", text: safeError("mutualAuthBuildCertificate failed", e) }], isError: true };
|
|
4402
|
+
}
|
|
4403
|
+
});
|
|
4404
|
+
server.tool("mutualAuthVerifyAttest", "Verify a MutualAuthAttest against policy and trust anchors. Runs all 10 verification checks: signature, version negotiation, nonce match, timestamp freshness, certificate validity, issuer anchor check, binding constraints, downgrade detection, attestation grade policy, capability policy. Returns ok:true on success or a failure reason on rejection.", {
|
|
4405
|
+
attest: z.any().describe("MutualAuthAttest to verify"),
|
|
4406
|
+
expected_peer_nonce_b64: z.string().describe("The nonce the peer sent in their prior hello or attest"),
|
|
4407
|
+
expected_own_nonce_b64: z.string().describe("The nonce we sent in our own prior hello or attest"),
|
|
4408
|
+
policy: z.any().describe("MutualAuthPolicy (accepted_versions, min_agent_grade, required_capabilities, max_clock_skew_ms, max_session_ms)"),
|
|
4409
|
+
trust_anchors: z.array(z.any()).describe("TrustAnchor[] — local trusted roots"),
|
|
4410
|
+
revoked_anchor_ids: z.array(z.string()).optional().describe("IDs of anchors revoked since the bundle was issued"),
|
|
4411
|
+
now_ms: z.number().optional().describe("Current unix ms — defaults to Date.now()"),
|
|
4412
|
+
}, async (args) => {
|
|
4413
|
+
try {
|
|
4414
|
+
const res = verifyAttest({
|
|
4415
|
+
attest: args.attest,
|
|
4416
|
+
expected_peer_nonce_b64: args.expected_peer_nonce_b64,
|
|
4417
|
+
expected_own_nonce_b64: args.expected_own_nonce_b64,
|
|
4418
|
+
policy: args.policy,
|
|
4419
|
+
trust_anchors: args.trust_anchors,
|
|
4420
|
+
revoked_anchor_ids: args.revoked_anchor_ids,
|
|
4421
|
+
now_ms: args.now_ms ?? Date.now(),
|
|
4422
|
+
});
|
|
4423
|
+
return {
|
|
4424
|
+
content: [{ type: "text", text: JSON.stringify(res, null, 2) }],
|
|
4425
|
+
};
|
|
4426
|
+
}
|
|
4427
|
+
catch (e) {
|
|
4428
|
+
return { content: [{ type: "text", text: safeError("mutualAuthVerifyAttest failed", e) }], isError: true };
|
|
4429
|
+
}
|
|
4430
|
+
});
|
|
4431
|
+
server.tool("mutualAuthDeriveSession", "Derive the shared mutual-auth session record from both sides' Attests. Both parties MUST compute identical session_id given identical inputs (canonical JCS + sha256 of chosen_version, both cert ids, both nonces). Returns a MutualAuthSession with session_id + both certificates + expiry bounds, or failure reason.", {
|
|
4432
|
+
agent_attest: z.any().describe("The agent's MutualAuthAttest"),
|
|
4433
|
+
is_attest: z.any().describe("The information system's MutualAuthAttest"),
|
|
4434
|
+
policy: z.any().describe("MutualAuthPolicy"),
|
|
4435
|
+
now_ms: z.number().optional().describe("Current unix ms — defaults to Date.now()"),
|
|
4436
|
+
}, async (args) => {
|
|
4437
|
+
try {
|
|
4438
|
+
const res = deriveSession(args.agent_attest, args.is_attest, args.policy, args.now_ms ?? Date.now());
|
|
4439
|
+
return {
|
|
4440
|
+
content: [{ type: "text", text: JSON.stringify(res, null, 2) }],
|
|
4441
|
+
};
|
|
4442
|
+
}
|
|
4443
|
+
catch (e) {
|
|
4444
|
+
return { content: [{ type: "text", text: safeError("mutualAuthDeriveSession failed", e) }], isError: true };
|
|
4445
|
+
}
|
|
4446
|
+
});
|
|
4447
|
+
server.tool("mutualAuthVerifyTrustBundle", "Verify a TrustAnchorBundle signature and freshness. Caller supplies the list of trusted publisher public keys (root configuration). Returns ok:true on success or failure reason (untrusted_publisher, signature_invalid, bundle_expired, not_yet_valid).", {
|
|
4448
|
+
bundle: z.any().describe("TrustAnchorBundle to verify"),
|
|
4449
|
+
trusted_publisher_pubkeys_hex: z.array(z.string()).describe("List of Ed25519 pubkeys (hex) authorized to publish bundles"),
|
|
4450
|
+
now_ms: z.number().optional().describe("Current unix ms — defaults to Date.now()"),
|
|
4451
|
+
}, async (args) => {
|
|
4452
|
+
try {
|
|
4453
|
+
const res = verifyBundle(args.bundle, args.trusted_publisher_pubkeys_hex, args.now_ms ?? Date.now());
|
|
4454
|
+
return {
|
|
4455
|
+
content: [{ type: "text", text: JSON.stringify(res, null, 2) }],
|
|
4456
|
+
};
|
|
4457
|
+
}
|
|
4458
|
+
catch (e) {
|
|
4459
|
+
return { content: [{ type: "text", text: safeError("mutualAuthVerifyTrustBundle failed", e) }], isError: true };
|
|
4460
|
+
}
|
|
4461
|
+
});
|
|
4986
4462
|
server.prompt("coordination_role", "Get instructions for your assigned coordination role", {}, async () => {
|
|
4987
4463
|
const role = state.agentRole || 'default';
|
|
4988
4464
|
const instructions = ROLE_PROMPTS[role] || ROLE_PROMPTS['default'];
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agent-passport-system-mcp",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"mcpName": "io.github.aeoess/agent-passport-mcp",
|
|
5
|
-
"description": "MCP server for the Agent Passport System —
|
|
5
|
+
"description": "MCP server for the Agent Passport System — protocol-layer tools only. 146 tools (132 protocol + 10 gateway deprecation stubs). Identity, delegation, reputation, attestation, coordination, commerce, attribution primitive, attribution settlement. Tracks SDK v2.2.0. For gateway-runtime tools (ProxyGateway, AgentContext, DataEnforcementGate), use gateway.aeoess.com REST API or pin to v3.1.0.",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"bin": {
|
|
8
8
|
"agent-passport-system-mcp": "./build/bin.js",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"homepage": "https://github.com/aeoess/agent-passport-mcp",
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
53
|
-
"agent-passport-system": "^
|
|
53
|
+
"agent-passport-system": "^2.2.0",
|
|
54
54
|
"zod": "^3.25.76"
|
|
55
55
|
},
|
|
56
56
|
"devDependencies": {
|