agent-passport-system-mcp 2.21.0 → 2.21.2

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
- **131 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. 131 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>
@@ -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.34.0, 2306 tests)
211
+ - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.36.3, 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
@@ -365,6 +365,7 @@ const server = new McpServer({
365
365
  });
366
366
  // Track server start time for Tier 0 connection timing
367
367
  globalThis.__mcpStartTime = Date.now();
368
+ // (try/catch wrapper merged into profile filter below)
368
369
  // ═══════════════════════════════════════
369
370
  // Tool Profiles — expose only relevant tools
370
371
  // ═══════════════════════════════════════
@@ -448,14 +449,179 @@ const TOOL_PROFILES = {
448
449
  };
449
450
  const activeProfile = (process.env.APS_PROFILE || 'full').toLowerCase();
450
451
  const profileFilter = TOOL_PROFILES[activeProfile];
451
- // Wrap server.tool to respect profile filtering
452
+ // Wrap server.tool: profile filtering + try/catch on all handlers
452
453
  const _origTool = server.tool.bind(server);
453
454
  server.tool = function (name, ...rest) {
454
- if (name === 'list_profiles')
455
- return _origTool(name, ...rest);
456
- if (activeProfile === 'full' || !profileFilter || profileFilter.has(name)) {
457
- return _origTool(name, ...rest);
455
+ if (name !== 'list_profiles' && activeProfile !== 'full' && profileFilter && !profileFilter.has(name)) {
456
+ return; // filtered out by profile
458
457
  }
458
+ // Wrap the handler (last arg) with try/catch to prevent crashes
459
+ const handlerIdx = rest.length - 1;
460
+ const origHandler = rest[handlerIdx];
461
+ if (typeof origHandler === 'function') {
462
+ rest[handlerIdx] = async (...args) => {
463
+ try {
464
+ return await origHandler(...args);
465
+ }
466
+ catch (e) {
467
+ return { content: [{ type: "text", text: JSON.stringify({ error: e.message || String(e) }) }], isError: true };
468
+ }
469
+ };
470
+ }
471
+ return _origTool(name, ...rest);
472
+ };
473
+ // ═══════════════════════════════════════
474
+ // Scope-Based Tool Filtering (Primitive #9: Tool Pool Assembly)
475
+ // ═══════════════════════════════════════
476
+ // Maps every tool to an APS delegation scope.
477
+ // Agents with scoped delegations can query which tools match their scopes.
478
+ // Tools mapped to '*' are always available (meta/utility tools).
479
+ const TOOL_SCOPE_MAP = {
480
+ // Meta tools — always available
481
+ 'list_profiles': '*',
482
+ 'list_tools_for_scope': '*',
483
+ // Identity tools → 'identity'
484
+ 'identify': 'identity',
485
+ 'generate_keys': 'identity',
486
+ 'issue_passport': 'identity',
487
+ 'verify_issuer': 'identity',
488
+ 'get_passport_grade': 'identity',
489
+ 'list_issuance_records': 'identity',
490
+ 'get_behavioral_sequence': 'identity',
491
+ 'get_my_role': 'identity',
492
+ 'compute_action_ref': 'identity',
493
+ 'is_evidence_fresh': 'identity',
494
+ 'classify_evidence_quality': 'identity',
495
+ 'rotate_key': 'identity',
496
+ 'verify_rotation_chain': 'identity',
497
+ 'is_key_active': 'identity',
498
+ // Delegation tools → 'delegation'
499
+ 'create_delegation': 'delegation',
500
+ 'verify_delegation': 'delegation',
501
+ 'revoke_delegation': 'delegation',
502
+ 'sub_delegate': 'delegation',
503
+ 'create_v2_delegation': 'delegation',
504
+ 'supersede_v2_delegation': 'delegation',
505
+ // Principal/Endorsement tools → 'principal'
506
+ 'create_principal': 'principal',
507
+ 'endorse_agent': 'principal',
508
+ 'verify_endorsement': 'principal',
509
+ 'revoke_endorsement': 'principal',
510
+ 'create_disclosure': 'principal',
511
+ 'get_fleet_status': 'principal',
512
+ // Reputation tools → 'reputation'
513
+ 'resolve_authority': 'reputation',
514
+ 'check_tier': 'reputation',
515
+ 'review_promotion': 'reputation',
516
+ 'update_reputation': 'reputation',
517
+ 'get_promotion_history': 'reputation',
518
+ 'vouch_reputation': 'reputation',
519
+ 'apply_reputation_downgrade': 'reputation',
520
+ // Coordination tools → 'coordination'
521
+ 'create_task_brief': 'coordination',
522
+ 'assign_agent': 'coordination',
523
+ 'accept_assignment': 'coordination',
524
+ 'submit_evidence': 'coordination',
525
+ 'review_evidence': 'coordination',
526
+ 'handoff_evidence': 'coordination',
527
+ 'submit_deliverable': 'coordination',
528
+ 'complete_task': 'coordination',
529
+ 'list_tasks': 'coordination',
530
+ 'get_task_detail': 'coordination',
531
+ 'get_evidence': 'coordination',
532
+ // Communication tools → 'communication'
533
+ 'send_message': 'communication',
534
+ 'check_messages': 'communication',
535
+ 'broadcast': 'communication',
536
+ 'list_agents': 'communication',
537
+ 'post_agora_message': 'communication',
538
+ 'get_agora_topics': 'communication',
539
+ 'get_agora_thread': 'communication',
540
+ 'get_agora_by_topic': 'communication',
541
+ 'register_agora_agent': 'communication',
542
+ 'register_agora_public': 'communication',
543
+ // Governance tools → 'governance'
544
+ 'load_values_floor': 'governance',
545
+ 'attest_to_floor': 'governance',
546
+ 'create_intent': 'governance',
547
+ 'evaluate_intent': 'governance',
548
+ 'create_agent_context': 'governance',
549
+ 'execute_with_context': 'governance',
550
+ 'complete_action': 'governance',
551
+ 'create_policy_context': 'governance',
552
+ 'create_attestation': 'governance',
553
+ 'create_outcome_record': 'governance',
554
+ 'add_principal_report': 'governance',
555
+ 'check_anomaly': 'governance',
556
+ 'define_emergency_pathway': 'governance',
557
+ 'activate_emergency': 'governance',
558
+ 'request_migration': 'governance',
559
+ 'create_artifact_provenance': 'governance',
560
+ 'create_charter': 'governance',
561
+ 'verify_charter': 'governance',
562
+ 'sign_charter': 'governance',
563
+ 'evaluate_threshold': 'governance',
564
+ 'create_approval_request': 'governance',
565
+ 'add_approval_signature': 'governance',
566
+ 'generate_governance_block': 'governance',
567
+ 'verify_governance_block': 'governance',
568
+ 'parse_governance_block_html': 'governance',
569
+ 'governance_360': 'governance',
570
+ 'generate_aps_txt': 'governance',
571
+ 'verify_aps_txt': 'governance',
572
+ 'resolve_path_terms': 'governance',
573
+ 'create_chained_governance_block': 'governance',
574
+ 'compute_governance_taint': 'governance',
575
+ // Commerce tools → 'commerce'
576
+ 'commerce_preflight': 'commerce',
577
+ 'get_commerce_spend': 'commerce',
578
+ 'request_human_approval': 'commerce',
579
+ // Data tools → 'data'
580
+ 'register_data_source': 'data',
581
+ 'create_data_enforcement_gate': 'data',
582
+ 'check_data_access': 'data',
583
+ 'query_contributions': 'data',
584
+ 'get_source_metrics': 'data',
585
+ 'get_agent_data_footprint': 'data',
586
+ 'generate_settlement': 'data',
587
+ 'generate_compliance_report': 'data',
588
+ 'record_training_use': 'data',
589
+ 'get_model_data_sources': 'data',
590
+ 'create_access_receipt': 'data',
591
+ 'create_access_snapshot': 'data',
592
+ 'create_derivation_receipt': 'data',
593
+ 'create_decision_lineage_receipt': 'data',
594
+ 'resolve_lineage': 'data',
595
+ 'evaluate_revocation_impact': 'data',
596
+ 'check_purpose_permitted': 'data',
597
+ 'check_retention_expired': 'data',
598
+ 'check_aggregate_constraints': 'data',
599
+ 'check_jurisdiction_transfer': 'data',
600
+ 'check_combination_permitted': 'data',
601
+ 'detect_purpose_drift': 'data',
602
+ 'resolve_rights_propagation': 'data',
603
+ 'declare_reidentification_risk': 'data',
604
+ 'file_data_dispute': 'data',
605
+ 'check_usage_permitted': 'data',
606
+ // Gateway tools → 'gateway'
607
+ 'create_gateway': 'gateway',
608
+ 'register_gateway_agent': 'gateway',
609
+ 'gateway_process_tool_call': 'gateway',
610
+ 'gateway_approve': 'gateway',
611
+ 'gateway_execute_approval': 'gateway',
612
+ 'gateway_stats': 'gateway',
613
+ // Network tools → 'network'
614
+ 'publish_intent_card': 'network',
615
+ 'search_matches': 'network',
616
+ 'get_digest': 'network',
617
+ 'request_intro': 'network',
618
+ 'respond_to_intro': 'network',
619
+ 'remove_intent_card': 'network',
620
+ // Temporal tools → 'temporal'
621
+ 'create_hybrid_timestamp': 'temporal',
622
+ 'compare_timestamps': 'temporal',
623
+ 'validate_temporal_rights': 'temporal',
624
+ 'create_reserve_attestation': 'temporal',
459
625
  };
460
626
  // ═══════════════════════════════════════
461
627
  // TOOL: list_profiles
@@ -465,6 +631,33 @@ server.tool("list_profiles", "Show available tool profiles. Set APS_PROFILE env
465
631
  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)` }] };
466
632
  });
467
633
  // ═══════════════════════════════════════
634
+ // TOOL: list_tools_for_scope (Primitive #9: Tool Pool Assembly)
635
+ // ═══════════════════════════════════════
636
+ 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.", {
637
+ scopes: z.array(z.string()).describe("Your delegation scopes, e.g. ['identity', 'delegation', 'commerce']"),
638
+ }, async ({ scopes }) => {
639
+ const allTools = Object.entries(TOOL_SCOPE_MAP);
640
+ const scopeSet = new Set(scopes);
641
+ const filtered = allTools.filter(([_, scope]) => scope === '*' || scopeSet.has(scope) || scopeSet.has('*'));
642
+ // Group by scope for readability
643
+ const byScope = {};
644
+ for (const [name, scope] of filtered) {
645
+ (byScope[scope] ??= []).push(name);
646
+ }
647
+ return {
648
+ content: [{
649
+ type: "text",
650
+ text: JSON.stringify({
651
+ total_tools: allTools.length,
652
+ accessible_tools: filtered.length,
653
+ scopes_provided: scopes,
654
+ tools_by_scope: byScope,
655
+ tools: filtered.map(([name, scope]) => ({ name, scope })),
656
+ }, null, 2),
657
+ }],
658
+ };
659
+ });
660
+ // ═══════════════════════════════════════
468
661
  // TOOL: identify
469
662
  // ═══════════════════════════════════════
470
663
  server.tool("identify", "Identify yourself to the coordination server. Sets your role and scopes tools accordingly.", {
@@ -514,14 +707,17 @@ server.tool("identify", "Identify yourself to the coordination server. Sets your
514
707
  // ═══════════════════════════════════════
515
708
  server.tool("generate_keys", "Generate an Ed25519 keypair for agent identity.", {}, async () => {
516
709
  const keys = generateKeyPair();
710
+ const isRemote = process.env.MCP_TRANSPORT === 'sse' || process.env.MCP_REMOTE === '1';
517
711
  return {
518
712
  content: [{
519
713
  type: "text",
520
714
  text: JSON.stringify({
521
715
  publicKey: keys.publicKey,
522
- privateKey: keys.privateKey,
716
+ privateKey: isRemote ? '[REDACTED — use local MCP for key generation]' : keys.privateKey,
523
717
  algorithm: "Ed25519",
524
- note: "Use these with the identify tool or AGENT_KEY/AGENT_PRIVATE_KEY env vars.",
718
+ note: isRemote
719
+ ? "WARNING: Private key redacted because this is a remote MCP server. Generate keys locally via stdio transport for security."
720
+ : "Use these with the identify tool or AGENT_KEY/AGENT_PRIVATE_KEY env vars. WARNING: Private keys should not be transmitted over remote transports.",
525
721
  }, null, 2),
526
722
  }],
527
723
  };
@@ -615,7 +811,9 @@ server.tool("issue_passport", "Issue a complete agent passport with keys, signed
615
811
  text: JSON.stringify({
616
812
  passport: attestedPassport,
617
813
  publicKey: attestedPassport.passport.publicKey,
618
- privateKey: agent.keyPair.privateKey,
814
+ privateKey: (process.env.MCP_TRANSPORT === 'sse' || process.env.MCP_REMOTE === '1')
815
+ ? '[REDACTED — use local MCP for key generation]'
816
+ : agent.keyPair.privateKey,
619
817
  agentId: attestedPassport.passport.agentId,
620
818
  attestation: agent.attestation || null,
621
819
  passportAttestation: attestedPassport.attestation,
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "agent-passport-system-mcp",
3
- "version": "2.21.0",
3
+ "version": "2.21.2",
4
4
  "mcpName": "io.github.aeoess/agent-passport-mcp",
5
- "description": "MCP server for the Agent Passport System — enforcement infrastructure for the agent economy. 131 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",
@@ -49,7 +49,7 @@
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.34.0",
52
+ "agent-passport-system": "^1.36.3",
53
53
  "zod": "^3.25.76"
54
54
  },
55
55
  "devDependencies": {