agent-passport-system-mcp 2.20.0 → 2.21.1

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 CHANGED
@@ -10,7 +10,7 @@ MCP server for the [Agent Passport System](https://github.com/aeoess/agent-passp
10
10
 
11
11
  > **šŸ¤– For AI agents:** If you are an agent reading this, 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). This README is designed for humans.
12
12
 
13
- **125 tools** across 96 modules (64 core + 32 v2 constitutional governance). Separation of powers, circuit breakers, approval fatigue detection, and more. Independently cited by [PDR in Production (Nanook & Gerundium, UBC)](https://doi.org/10.5281/zenodo.19323172). Works with any MCP client: Claude Desktop, Cursor, Windsurf, and more.
13
+ **132 tools** across 96 modules (64 core + 32 v2 constitutional governance). Separation of powers, circuit breakers, approval fatigue detection, and more. Independently cited by [PDR in Production (Nanook & Gerundium, UBC)](https://doi.org/10.5281/zenodo.19323172). Works with any MCP client: Claude Desktop, Cursor, Windsurf, and more.
14
14
 
15
15
  ## Quick Start
16
16
 
@@ -29,7 +29,7 @@ npm install -g agent-passport-system-mcp
29
29
  npx agent-passport-system-mcp setup
30
30
  ```
31
31
 
32
- Auto-configures Claude Desktop and Cursor. Restart your AI client. 125 tools ready.
32
+ Auto-configures Claude Desktop and Cursor. Restart your AI client. 132 tools ready.
33
33
 
34
34
  <details>
35
35
  <summary>Manual config (if setup doesn't detect your client)</summary>
@@ -61,7 +61,7 @@ Or for remote SSE:
61
61
  ```
62
62
  </details>
63
63
 
64
- ## Tools (125)
64
+ ## Tools (128)
65
65
 
66
66
  ### Identity (Layer 1) — 5 tools
67
67
 
@@ -208,7 +208,7 @@ Layer 1 — Agent Passport Protocol (Ed25519 identity)
208
208
 
209
209
  ## Links
210
210
 
211
- - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.33.0, 2230 tests)
211
+ - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.36.2, 2468 tests)
212
212
  - Python SDK: [agent-passport-system](https://pypi.org/project/agent-passport-system/) (v0.8.0)
213
213
  - Paper (Protocol): [doi.org/10.5281/zenodo.18749779](https://doi.org/10.5281/zenodo.18749779)
214
214
  - Paper (Faceted Narrowing): [doi.org/10.5281/zenodo.19260073](https://doi.org/10.5281/zenodo.19260073)
package/build/index.js CHANGED
@@ -54,7 +54,9 @@ createV2Attestation, assessV2AttestationQuality, } from "agent-passport-system";
54
54
  // Agent Attestation Architecture (Phase 1 — Consilium Build)
55
55
  import { createIssuanceContext, bindAttestation, createEmptyEvidenceRecord, PASSPORT_GRADE_LABELS,
56
56
  // v1.33.0 — action_ref + freshness + evidence-based grade
57
- computeActionRef, isEvidenceFresh, computeEvidenceAge, classifyEvidenceQuality, evidenceQualityToGrade, } from "agent-passport-system";
57
+ computeActionRef, isEvidenceFresh, computeEvidenceAge, classifyEvidenceQuality, evidenceQualityToGrade,
58
+ // key rotation
59
+ createDIDDocument, verifyRotationChain, isKeyActive, rotateAndInvalidate, } from "agent-passport-system";
58
60
  // Data Governance (Modules 36A, 38, 39 + Enforcement Gate + Training Attribution)
59
61
  import { registerSelfAttestedSource, createContributionLedger, queryContributions, getSourceMetrics, getAgentDataFootprint, generateSettlement, verifySettlement, generateDataComplianceReport, DataEnforcementGate, createTrainingAttribution, verifyTrainingAttribution, createTrainingLedger, recordTrainingAttribution, getModelDataSources, } from "agent-passport-system";
60
62
  // Data Lifecycle Governance (Modules 43+)
@@ -456,6 +458,159 @@ server.tool = function (name, ...rest) {
456
458
  }
457
459
  };
458
460
  // ═══════════════════════════════════════
461
+ // Scope-Based Tool Filtering (Primitive #9: Tool Pool Assembly)
462
+ // ═══════════════════════════════════════
463
+ // Maps every tool to an APS delegation scope.
464
+ // Agents with scoped delegations can query which tools match their scopes.
465
+ // Tools mapped to '*' are always available (meta/utility tools).
466
+ const TOOL_SCOPE_MAP = {
467
+ // Meta tools — always available
468
+ 'list_profiles': '*',
469
+ 'list_tools_for_scope': '*',
470
+ // Identity tools → 'identity'
471
+ 'identify': 'identity',
472
+ 'generate_keys': 'identity',
473
+ 'issue_passport': 'identity',
474
+ 'verify_issuer': 'identity',
475
+ 'get_passport_grade': 'identity',
476
+ 'list_issuance_records': 'identity',
477
+ 'get_behavioral_sequence': 'identity',
478
+ 'get_my_role': 'identity',
479
+ 'compute_action_ref': 'identity',
480
+ 'is_evidence_fresh': 'identity',
481
+ 'classify_evidence_quality': 'identity',
482
+ 'rotate_key': 'identity',
483
+ 'verify_rotation_chain': 'identity',
484
+ 'is_key_active': 'identity',
485
+ // Delegation tools → 'delegation'
486
+ 'create_delegation': 'delegation',
487
+ 'verify_delegation': 'delegation',
488
+ 'revoke_delegation': 'delegation',
489
+ 'sub_delegate': 'delegation',
490
+ 'create_v2_delegation': 'delegation',
491
+ 'supersede_v2_delegation': 'delegation',
492
+ // Principal/Endorsement tools → 'principal'
493
+ 'create_principal': 'principal',
494
+ 'endorse_agent': 'principal',
495
+ 'verify_endorsement': 'principal',
496
+ 'revoke_endorsement': 'principal',
497
+ 'create_disclosure': 'principal',
498
+ 'get_fleet_status': 'principal',
499
+ // Reputation tools → 'reputation'
500
+ 'resolve_authority': 'reputation',
501
+ 'check_tier': 'reputation',
502
+ 'review_promotion': 'reputation',
503
+ 'update_reputation': 'reputation',
504
+ 'get_promotion_history': 'reputation',
505
+ 'vouch_reputation': 'reputation',
506
+ 'apply_reputation_downgrade': 'reputation',
507
+ // Coordination tools → 'coordination'
508
+ 'create_task_brief': 'coordination',
509
+ 'assign_agent': 'coordination',
510
+ 'accept_assignment': 'coordination',
511
+ 'submit_evidence': 'coordination',
512
+ 'review_evidence': 'coordination',
513
+ 'handoff_evidence': 'coordination',
514
+ 'submit_deliverable': 'coordination',
515
+ 'complete_task': 'coordination',
516
+ 'list_tasks': 'coordination',
517
+ 'get_task_detail': 'coordination',
518
+ 'get_evidence': 'coordination',
519
+ // Communication tools → 'communication'
520
+ 'send_message': 'communication',
521
+ 'check_messages': 'communication',
522
+ 'broadcast': 'communication',
523
+ 'list_agents': 'communication',
524
+ 'post_agora_message': 'communication',
525
+ 'get_agora_topics': 'communication',
526
+ 'get_agora_thread': 'communication',
527
+ 'get_agora_by_topic': 'communication',
528
+ 'register_agora_agent': 'communication',
529
+ 'register_agora_public': 'communication',
530
+ // Governance tools → 'governance'
531
+ 'load_values_floor': 'governance',
532
+ 'attest_to_floor': 'governance',
533
+ 'create_intent': 'governance',
534
+ 'evaluate_intent': 'governance',
535
+ 'create_agent_context': 'governance',
536
+ 'execute_with_context': 'governance',
537
+ 'complete_action': 'governance',
538
+ 'create_policy_context': 'governance',
539
+ 'create_attestation': 'governance',
540
+ 'create_outcome_record': 'governance',
541
+ 'add_principal_report': 'governance',
542
+ 'check_anomaly': 'governance',
543
+ 'define_emergency_pathway': 'governance',
544
+ 'activate_emergency': 'governance',
545
+ 'request_migration': 'governance',
546
+ 'create_artifact_provenance': 'governance',
547
+ 'create_charter': 'governance',
548
+ 'verify_charter': 'governance',
549
+ 'sign_charter': 'governance',
550
+ 'evaluate_threshold': 'governance',
551
+ 'create_approval_request': 'governance',
552
+ 'add_approval_signature': 'governance',
553
+ 'generate_governance_block': 'governance',
554
+ 'verify_governance_block': 'governance',
555
+ 'parse_governance_block_html': 'governance',
556
+ 'governance_360': 'governance',
557
+ 'generate_aps_txt': 'governance',
558
+ 'verify_aps_txt': 'governance',
559
+ 'resolve_path_terms': 'governance',
560
+ 'create_chained_governance_block': 'governance',
561
+ 'compute_governance_taint': 'governance',
562
+ // Commerce tools → 'commerce'
563
+ 'commerce_preflight': 'commerce',
564
+ 'get_commerce_spend': 'commerce',
565
+ 'request_human_approval': 'commerce',
566
+ // Data tools → 'data'
567
+ 'register_data_source': 'data',
568
+ 'create_data_enforcement_gate': 'data',
569
+ 'check_data_access': 'data',
570
+ 'query_contributions': 'data',
571
+ 'get_source_metrics': 'data',
572
+ 'get_agent_data_footprint': 'data',
573
+ 'generate_settlement': 'data',
574
+ 'generate_compliance_report': 'data',
575
+ 'record_training_use': 'data',
576
+ 'get_model_data_sources': 'data',
577
+ 'create_access_receipt': 'data',
578
+ 'create_access_snapshot': 'data',
579
+ 'create_derivation_receipt': 'data',
580
+ 'create_decision_lineage_receipt': 'data',
581
+ 'resolve_lineage': 'data',
582
+ 'evaluate_revocation_impact': 'data',
583
+ 'check_purpose_permitted': 'data',
584
+ 'check_retention_expired': 'data',
585
+ 'check_aggregate_constraints': 'data',
586
+ 'check_jurisdiction_transfer': 'data',
587
+ 'check_combination_permitted': 'data',
588
+ 'detect_purpose_drift': 'data',
589
+ 'resolve_rights_propagation': 'data',
590
+ 'declare_reidentification_risk': 'data',
591
+ 'file_data_dispute': 'data',
592
+ 'check_usage_permitted': 'data',
593
+ // Gateway tools → 'gateway'
594
+ 'create_gateway': 'gateway',
595
+ 'register_gateway_agent': 'gateway',
596
+ 'gateway_process_tool_call': 'gateway',
597
+ 'gateway_approve': 'gateway',
598
+ 'gateway_execute_approval': 'gateway',
599
+ 'gateway_stats': 'gateway',
600
+ // Network tools → 'network'
601
+ 'publish_intent_card': 'network',
602
+ 'search_matches': 'network',
603
+ 'get_digest': 'network',
604
+ 'request_intro': 'network',
605
+ 'respond_to_intro': 'network',
606
+ 'remove_intent_card': 'network',
607
+ // Temporal tools → 'temporal'
608
+ 'create_hybrid_timestamp': 'temporal',
609
+ 'compare_timestamps': 'temporal',
610
+ 'validate_temporal_rights': 'temporal',
611
+ 'create_reserve_attestation': 'temporal',
612
+ };
613
+ // ═══════════════════════════════════════
459
614
  // TOOL: list_profiles
460
615
  // ═══════════════════════════════════════
461
616
  server.tool("list_profiles", "Show available tool profiles. Set APS_PROFILE env var to limit exposed tools (e.g. APS_PROFILE=data).", {}, async () => {
@@ -463,6 +618,33 @@ server.tool("list_profiles", "Show available tool profiles. Set APS_PROFILE env
463
618
  return { content: [{ type: "text", text: `šŸ“‹ Tool Profiles (set APS_PROFILE env var):\n\nActive: ${activeProfile} (${activeProfile === 'full' ? '122' : profileFilter?.size || '122'} tools)\n\n${lines.join('\n')}\n\n• full (122 tools): All tools exposed (default)` }] };
464
619
  });
465
620
  // ═══════════════════════════════════════
621
+ // TOOL: list_tools_for_scope (Primitive #9: Tool Pool Assembly)
622
+ // ═══════════════════════════════════════
623
+ server.tool("list_tools_for_scope", "List available MCP tools filtered by delegation scope. Pass your delegation scopes to see which tools you can use. Scopes: identity, delegation, principal, reputation, coordination, communication, governance, commerce, data, gateway, network, temporal. Use ['*'] for all tools.", {
624
+ scopes: z.array(z.string()).describe("Your delegation scopes, e.g. ['identity', 'delegation', 'commerce']"),
625
+ }, async ({ scopes }) => {
626
+ const allTools = Object.entries(TOOL_SCOPE_MAP);
627
+ const scopeSet = new Set(scopes);
628
+ const filtered = allTools.filter(([_, scope]) => scope === '*' || scopeSet.has(scope) || scopeSet.has('*'));
629
+ // Group by scope for readability
630
+ const byScope = {};
631
+ for (const [name, scope] of filtered) {
632
+ (byScope[scope] ??= []).push(name);
633
+ }
634
+ return {
635
+ content: [{
636
+ type: "text",
637
+ text: JSON.stringify({
638
+ total_tools: allTools.length,
639
+ accessible_tools: filtered.length,
640
+ scopes_provided: scopes,
641
+ tools_by_scope: byScope,
642
+ tools: filtered.map(([name, scope]) => ({ name, scope })),
643
+ }, null, 2),
644
+ }],
645
+ };
646
+ });
647
+ // ═══════════════════════════════════════
466
648
  // TOOL: identify
467
649
  // ═══════════════════════════════════════
468
650
  server.tool("identify", "Identify yourself to the coordination server. Sets your role and scopes tools accordingly.", {
@@ -4276,6 +4458,53 @@ server.tool("classify_evidence_quality", "Classify attestation evidence quality
4276
4458
  const grade = evidenceQualityToGrade(quality);
4277
4459
  return { content: [{ type: "text", text: `šŸŽ–ļø Evidence Quality: ${quality}\nGrade: ${grade}\n\nInputs:\n method: ${args.method ?? 'none'}\n issuerSignature: ${args.has_issuer_signature ?? false}\n principalBinding: ${args.has_principal_binding ?? false}\n evidence keys: ${args.evidence ? Object.keys(args.evidence).join(', ') || '(empty)' : '(none)'}` }] };
4278
4460
  });
4461
+ // ═══════════════════════════════════════
4462
+ // Key Rotation — DID Document + Identity Continuity
4463
+ // ═══════════════════════════════════════
4464
+ server.tool("rotate_key", "Rotate an agent's Ed25519 key. Planned mode: configurable overlap (default 24h). Emergency mode: immediate old-key retirement. Returns updated DID document, rotation state, and revocation results.", {
4465
+ mode: z.enum(['planned', 'emergency']),
4466
+ old_private_key: z.string().describe("Hex-encoded private key being rotated FROM"),
4467
+ agent_name: z.string().optional().describe("Agent name for the passport (default: current session)"),
4468
+ activation_delay_hours: z.number().optional().describe("Planned mode overlap hours (default: 24)"),
4469
+ delegation_ids_to_revoke: z.array(z.string()).optional().describe("Delegation IDs to cascade-revoke during rotation"),
4470
+ }, async (args) => {
4471
+ const { generateKeyPair } = await import("agent-passport-system");
4472
+ const oldPublicKey = (await import("agent-passport-system")).publicKeyFromPrivate(args.old_private_key);
4473
+ const newKeyPair = generateKeyPair();
4474
+ const passport = {
4475
+ version: '1.0', agentId: `agent-${oldPublicKey.slice(0, 8)}`, agentName: args.agent_name || 'MCP Agent',
4476
+ ownerAlias: 'mcp', publicKey: oldPublicKey, mission: 'key rotation', capabilities: ['rotate'],
4477
+ runtime: { platform: 'mcp', models: ['claude'], toolsCount: 128, memoryType: 'session' },
4478
+ createdAt: new Date().toISOString(), expiresAt: new Date(Date.now() + 86400000).toISOString(),
4479
+ voteWeight: 1, reputation: { overall: 0, collaborationsCompleted: 0, proposalsSubmitted: 0, proposalsApproved: 0, tokensContributed: 0, tasksCompleted: 0, lastUpdated: new Date().toISOString() },
4480
+ delegations: [], metadata: {},
4481
+ };
4482
+ const doc = createDIDDocument(passport);
4483
+ const delayMs = args.activation_delay_hours != null ? args.activation_delay_hours * 3600000 : undefined;
4484
+ const result = rotateAndInvalidate(doc, args.old_private_key, newKeyPair, args.delegation_ids_to_revoke || [], { mode: args.mode, activationDelayMs: delayMs });
4485
+ return { content: [{ type: "text", text: `šŸ”‘ Key Rotation (${args.mode})\n\nState: ${result.rotationState}\nOld key: ${oldPublicKey.slice(0, 16)}...\nNew key: ${newKeyPair.publicKey.slice(0, 16)}...\nNew private key: ${newKeyPair.privateKey}\nDID: ${result.didDocument.id}\nRotation log entries: ${result.didDocument.rotationLog.length}\nRevocations: ${result.revocationResults.length} (${result.revocationResults.filter(r => !r.error).length} succeeded)\n\nActivation time: ${result.didDocument.pendingRotation?.activationTime || 'immediate'}` }] };
4486
+ });
4487
+ server.tool("verify_rotation_chain", "Verify all rotation signatures in a DID document's rotation log. Returns true if the full chain is cryptographically valid.", {
4488
+ did_document: z.any().describe("RotatableDIDDocument JSON object with rotationLog"),
4489
+ }, async (args) => {
4490
+ const doc = args.did_document;
4491
+ if (!doc || !Array.isArray(doc.rotationLog)) {
4492
+ return { content: [{ type: "text", text: `āŒ Invalid DID document: missing rotationLog array` }] };
4493
+ }
4494
+ const valid = verifyRotationChain(doc);
4495
+ return { content: [{ type: "text", text: `${valid ? 'āœ…' : 'āŒ'} Rotation chain valid: ${valid}\n\nEntries verified: ${doc.rotationLog.length}\nDID: ${doc.id || 'unknown'}` }] };
4496
+ });
4497
+ server.tool("is_key_active", "Check if a public key is currently authorized for active operations in a DID document. SDK convenience check; gateway enforcement is authoritative.", {
4498
+ did_document: z.any().describe("RotatableDIDDocument JSON object"),
4499
+ public_key: z.string().describe("Hex-encoded Ed25519 public key to check"),
4500
+ }, async (args) => {
4501
+ const doc = args.did_document;
4502
+ if (!doc || !Array.isArray(doc.verificationMethod)) {
4503
+ return { content: [{ type: "text", text: `āŒ Invalid DID document: missing verificationMethod` }] };
4504
+ }
4505
+ const active = isKeyActive(doc, args.public_key);
4506
+ return { content: [{ type: "text", text: `${active ? 'āœ… Active' : 'šŸ”’ Inactive/Retired'}\n\nKey: ${args.public_key.slice(0, 16)}...\nDID: ${doc.id || 'unknown'}\nVerification methods: ${doc.verificationMethod.length}\nRotation log entries: ${(doc.rotationLog || []).length}` }] };
4507
+ });
4279
4508
  server.prompt("coordination_role", "Get instructions for your assigned coordination role", {}, async () => {
4280
4509
  const role = state.agentRole || 'default';
4281
4510
  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": "2.20.0",
3
+ "version": "2.21.1",
4
4
  "mcpName": "io.github.aeoess/agent-passport-mcp",
5
- "description": "MCP server for the Agent Passport System — enforcement infrastructure for the agent economy. 128 tools across 103 modules. Policy eval <2ms. Identity, delegation, reputation, enforcement, attestation, feeless Nano wallet, commerce.",
5
+ "description": "MCP server for the Agent Passport System — enforcement infrastructure for the agent economy. 132 tools across 103 modules. Policy eval <2ms. Identity, delegation, reputation, enforcement, attestation, feeless Nano wallet, commerce.",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "agent-passport-system-mcp": "./build/bin.js",
@@ -14,7 +14,7 @@
14
14
  "CODE_OF_CONDUCT.md"
15
15
  ],
16
16
  "scripts": {
17
- "build": "tsc && chmod 755 build/bin.js build/index.js build/setup.js",
17
+ "build": "npx tsc && chmod 755 build/bin.js build/index.js build/setup.js",
18
18
  "watch": "tsc --watch",
19
19
  "inspector": "npx @modelcontextprotocol/inspector build/index.js",
20
20
  "prepublishOnly": "npm run build",
@@ -49,11 +49,11 @@
49
49
  "homepage": "https://github.com/aeoess/agent-passport-mcp",
50
50
  "dependencies": {
51
51
  "@modelcontextprotocol/sdk": "^1.27.1",
52
- "agent-passport-system": "^1.33.0",
52
+ "agent-passport-system": "^1.36.1",
53
53
  "zod": "^3.25.76"
54
54
  },
55
55
  "devDependencies": {
56
- "@types/node": "^22.19.15",
56
+ "@types/node": "^22.19.17",
57
57
  "typescript": "^5.9.3"
58
58
  }
59
59
  }