agent-passport-system-mcp 2.8.6 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  MCP server for the [Agent Passport System](https://github.com/aeoess/agent-passport-system) — cryptographic identity, delegation, governance, and commerce for AI agents.
10
10
 
11
- **61 tools** across all 27 protocol modules. Works with any MCP client: Claude Desktop, Cursor, Windsurf, and more.
11
+ **61 tools** across all 36 protocol modules. Works with any MCP client: Claude Desktop, Cursor, Windsurf, and more.
12
12
 
13
13
  ## Quick Start
14
14
 
@@ -204,7 +204,7 @@ Layer 1 — Agent Passport Protocol (Ed25959 identity)
204
204
 
205
205
  ## Links
206
206
 
207
- - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.15.0, 785 tests)
207
+ - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.18.0, 894 tests)
208
208
  - Python SDK: [agent-passport-system](https://pypi.org/project/agent-passport-system/) (v0.4.0, 86 tests)
209
209
  - Paper: [doi.org/10.5281/zenodo.18749779](https://doi.org/10.5281/zenodo.18749779)
210
210
  - Docs: [aeoess.com/llms-full.txt](https://aeoess.com/llms-full.txt)
package/build/index.js CHANGED
@@ -35,7 +35,21 @@ createPrincipalIdentity, endorseAgent, verifyEndorsement, revokeEndorsement, cre
35
35
  // Reputation-Gated Authority (Layer 9)
36
36
  computeEffectiveScore, createScopedReputation, resolveAuthorityTier, checkTierForIntent, advisoryTierPrecheck, createPromotionReview, updateReputationFromResult, DEFAULT_TIERS, createProxyGateway,
37
37
  // Intent Network (Agent-Mediated Matching) — card creation only, API handles persistence
38
- createIntentCard, } from "agent-passport-system";
38
+ createIntentCard,
39
+ // v2: Constitutional Governance Extensions
40
+ createPolicyContext, createArtifactProvenance,
41
+ // v2: Delegation Versioning
42
+ createV2Delegation, supersedeV2Delegation,
43
+ // v2: Outcome Registration
44
+ createV2OutcomeRecord, addV2PrincipalReport, getV2EffectiveDivergence,
45
+ // v2: Anomaly Detection
46
+ recordV2Action, checkV2FirstMaxAuthority, computeV2ConcentrationMetrics,
47
+ // v2: Emergency Pathways
48
+ defineV2EmergencyPathway, activateV2Emergency,
49
+ // v2: Migration
50
+ requestV2Migration,
51
+ // v2: Attestation
52
+ createV2Attestation, assessV2AttestationQuality, } from "agent-passport-system";
39
53
  // ═══════════════════════════════════════
40
54
  // State Management
41
55
  // ═══════════════════════════════════════
@@ -2639,6 +2653,336 @@ server.tool("remove_intent_card", "Remove your IntentCard from the Intent Networ
2639
2653
  }
2640
2654
  });
2641
2655
  // ═══════════════════════════════════════
2656
+ // v2: Constitutional Governance Tools
2657
+ // ═══════════════════════════════════════
2658
+ server.tool("create_policy_context", "Create a v2 PolicyContext with mandatory sunset. Every v2 object requires one.", {
2659
+ policy_version: z.string().default("2.0.0"),
2660
+ values_floor_version: z.string().default("1.0.0"),
2661
+ trust_epoch: z.number().default(1),
2662
+ valid_until: z.string().describe("ISO 8601 expiration (mandatory, max 180 days)"),
2663
+ }, async (args) => {
2664
+ const keyErr = requireKey();
2665
+ if (keyErr)
2666
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2667
+ try {
2668
+ const ctx = createPolicyContext({
2669
+ policy_version: args.policy_version,
2670
+ values_floor_version: args.values_floor_version,
2671
+ trust_epoch: args.trust_epoch,
2672
+ issuer_id: state.agentKey,
2673
+ valid_until: args.valid_until,
2674
+ });
2675
+ return { content: [{ type: "text", text: JSON.stringify(ctx, null, 2) }] };
2676
+ }
2677
+ catch (e) {
2678
+ return { content: [{ type: "text", text: safeError("PolicyContext creation failed", e) }], isError: true };
2679
+ }
2680
+ });
2681
+ server.tool("create_v2_delegation", "Create a v2 delegation with versioning, mandatory sunset, and PolicyContext binding.", {
2682
+ delegatee: z.string().describe("Public key of the agent receiving authority"),
2683
+ scope_categories: z.array(z.string()).describe("Action categories (e.g., ['analysis', 'communication'])"),
2684
+ valid_until: z.string().describe("ISO 8601 expiration"),
2685
+ trust_epoch: z.number().default(1),
2686
+ }, async (args) => {
2687
+ const keyErr = requireKey();
2688
+ if (keyErr)
2689
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2690
+ try {
2691
+ const ctx = createPolicyContext({
2692
+ policy_version: "2.0.0", values_floor_version: "1.0.0",
2693
+ trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
2694
+ valid_until: args.valid_until,
2695
+ });
2696
+ const del = createV2Delegation({
2697
+ delegator: state.agentKey, delegatee: args.delegatee,
2698
+ scope: { action_categories: args.scope_categories },
2699
+ policy_context: ctx, delegator_private_key: state.privateKey,
2700
+ });
2701
+ return { content: [{ type: "text", text: JSON.stringify(del, null, 2) }] };
2702
+ }
2703
+ catch (e) {
2704
+ return { content: [{ type: "text", text: safeError("v2 delegation failed", e) }], isError: true };
2705
+ }
2706
+ });
2707
+ server.tool("supersede_v2_delegation", "Supersede a v2 delegation. Scope narrowing needs justification. Scope expansion also needs independent reviewer.", {
2708
+ original_delegation_id: z.string(),
2709
+ new_scope_categories: z.array(z.string()),
2710
+ justification: z.string(),
2711
+ valid_until: z.string(),
2712
+ trust_epoch: z.number().default(1),
2713
+ expansion_reviewer: z.string().optional().describe("Required if scope expands"),
2714
+ expansion_reviewer_private_key: z.string().optional(),
2715
+ }, async (args) => {
2716
+ const keyErr = requireKey();
2717
+ if (keyErr)
2718
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2719
+ try {
2720
+ const ctx = createPolicyContext({
2721
+ policy_version: "2.0.0", values_floor_version: "1.0.0",
2722
+ trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
2723
+ valid_until: args.valid_until,
2724
+ });
2725
+ const del = supersedeV2Delegation({
2726
+ original_delegation_id: args.original_delegation_id,
2727
+ new_scope: { action_categories: args.new_scope_categories },
2728
+ justification: args.justification,
2729
+ policy_context: ctx, delegator_private_key: state.privateKey,
2730
+ expansion_reviewer: args.expansion_reviewer,
2731
+ expansion_reviewer_private_key: args.expansion_reviewer_private_key,
2732
+ });
2733
+ return { content: [{ type: "text", text: JSON.stringify(del, null, 2) }] };
2734
+ }
2735
+ catch (e) {
2736
+ return { content: [{ type: "text", text: safeError("Supersession failed", e) }], isError: true };
2737
+ }
2738
+ });
2739
+ server.tool("create_outcome_record", "Register an action outcome (agent perspective). Part of three-way reporting.", {
2740
+ action_id: z.string(), declared_intent: z.string(),
2741
+ semantic_uncertainty: z.enum(["low", "medium", "high", "critical"]),
2742
+ observed_outcome: z.string(),
2743
+ outcome_class: z.enum(["success", "partial_success", "failure", "unintended_effect", "unknown"]),
2744
+ divergence_score: z.number().min(0).max(1),
2745
+ valid_until: z.string(),
2746
+ trust_epoch: z.number().default(1),
2747
+ }, async (args) => {
2748
+ const keyErr = requireKey();
2749
+ if (keyErr)
2750
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2751
+ try {
2752
+ const ctx = createPolicyContext({
2753
+ policy_version: "2.0.0", values_floor_version: "1.0.0",
2754
+ trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
2755
+ valid_until: args.valid_until,
2756
+ });
2757
+ const record = createV2OutcomeRecord({
2758
+ action_id: args.action_id, agent_id: state.agentKey,
2759
+ declared_intent: args.declared_intent,
2760
+ semantic_uncertainty: args.semantic_uncertainty,
2761
+ observed_outcome: args.observed_outcome,
2762
+ outcome_class: args.outcome_class,
2763
+ divergence_score: args.divergence_score,
2764
+ agent_private_key: state.privateKey,
2765
+ policy_context: ctx,
2766
+ });
2767
+ return { content: [{ type: "text", text: JSON.stringify(record, null, 2) }] };
2768
+ }
2769
+ catch (e) {
2770
+ return { content: [{ type: "text", text: safeError("Outcome registration failed", e) }], isError: true };
2771
+ }
2772
+ });
2773
+ server.tool("add_principal_report", "Add principal's perspective to an outcome record. Enables three-way divergence reporting.", {
2774
+ outcome_id: z.string(), observed_outcome: z.string(),
2775
+ outcome_class: z.enum(["success", "partial_success", "failure", "unintended_effect", "unknown"]),
2776
+ divergence_score: z.number().min(0).max(1),
2777
+ }, async (args) => {
2778
+ const keyErr = requireKey();
2779
+ if (keyErr)
2780
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2781
+ try {
2782
+ const record = addV2PrincipalReport({
2783
+ outcome_id: args.outcome_id, principal_id: state.agentKey,
2784
+ observed_outcome: args.observed_outcome,
2785
+ outcome_class: args.outcome_class,
2786
+ divergence_score: args.divergence_score,
2787
+ principal_private_key: state.privateKey,
2788
+ });
2789
+ return { content: [{ type: "text", text: JSON.stringify({ id: record.id, consensus: record.consensus, effective_divergence: getV2EffectiveDivergence(record) }, null, 2) }] };
2790
+ }
2791
+ catch (e) {
2792
+ return { content: [{ type: "text", text: safeError("Principal report failed", e) }], isError: true };
2793
+ }
2794
+ });
2795
+ server.tool("define_emergency_pathway", "Define a pre-authorized emergency pathway at delegation time. Only the delegator can define these.", {
2796
+ delegation_ref: z.string(), description: z.string(),
2797
+ trigger_field: z.string(), trigger_operator: z.enum(["eq", "neq", "gt", "lt", "gte", "lte"]),
2798
+ trigger_value: z.union([z.string(), z.number(), z.boolean()]),
2799
+ expanded_scope_categories: z.array(z.string()),
2800
+ max_duration: z.string().default("PT1H"),
2801
+ review_deadline: z.string().default("PT24H"),
2802
+ review_authority: z.string(),
2803
+ valid_until: z.string(), trust_epoch: z.number().default(1),
2804
+ }, async (args) => {
2805
+ const keyErr = requireKey();
2806
+ if (keyErr)
2807
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2808
+ try {
2809
+ const ctx = createPolicyContext({
2810
+ policy_version: "2.0.0", values_floor_version: "1.0.0",
2811
+ trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
2812
+ valid_until: args.valid_until,
2813
+ });
2814
+ const pw = defineV2EmergencyPathway({
2815
+ delegation_ref: args.delegation_ref,
2816
+ trigger_conditions: { any_of: [{ field: args.trigger_field, operator: args.trigger_operator, value: args.trigger_value }] },
2817
+ expanded_scope: { action_categories: args.expanded_scope_categories },
2818
+ max_duration: args.max_duration, mandatory_review_deadline: args.review_deadline,
2819
+ review_authority: args.review_authority, description: args.description,
2820
+ policy_context: ctx, delegator_private_key: state.privateKey,
2821
+ });
2822
+ return { content: [{ type: "text", text: JSON.stringify(pw, null, 2) }] };
2823
+ }
2824
+ catch (e) {
2825
+ return { content: [{ type: "text", text: safeError("Emergency pathway failed", e) }], isError: true };
2826
+ }
2827
+ });
2828
+ server.tool("activate_emergency", "Activate a pre-authorized emergency pathway with evidence.", {
2829
+ pathway_id: z.string(),
2830
+ trigger_evidence: z.string().describe("Evidence that trigger conditions are met"),
2831
+ valid_until: z.string(), trust_epoch: z.number().default(1),
2832
+ }, async (args) => {
2833
+ const keyErr = requireKey();
2834
+ if (keyErr)
2835
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2836
+ try {
2837
+ const ctx = createPolicyContext({
2838
+ policy_version: "2.0.0", values_floor_version: "1.0.0",
2839
+ trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
2840
+ valid_until: args.valid_until,
2841
+ });
2842
+ const act = activateV2Emergency({
2843
+ pathway_id: args.pathway_id, agent_id: state.agentKey,
2844
+ trigger_evidence: args.trigger_evidence,
2845
+ agent_private_key: state.privateKey, policy_context: ctx,
2846
+ });
2847
+ return { content: [{ type: "text", text: JSON.stringify(act, null, 2) }] };
2848
+ }
2849
+ catch (e) {
2850
+ return { content: [{ type: "text", text: safeError("Emergency activation failed", e) }], isError: true };
2851
+ }
2852
+ });
2853
+ server.tool("create_attestation", "Create a contextual attestation — pre-action reasoning record for medium+ risk actions.", {
2854
+ action_id: z.string(), delegation_ref: z.string(),
2855
+ context_understanding: z.string().describe("Agent's assessment of the situation"),
2856
+ factors_considered: z.array(z.string()).describe("Key decision factors"),
2857
+ alternatives_rejected: z.array(z.object({ alternative: z.string(), reason: z.string() })).default([]),
2858
+ expected_outcome: z.string(),
2859
+ confidence: z.number().min(0).max(1),
2860
+ semantic_uncertainty: z.enum(["low", "medium", "high", "critical"]),
2861
+ required: z.boolean().default(true),
2862
+ valid_until: z.string(), trust_epoch: z.number().default(1),
2863
+ }, async (args) => {
2864
+ const keyErr = requireKey();
2865
+ if (keyErr)
2866
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2867
+ try {
2868
+ const ctx = createPolicyContext({
2869
+ policy_version: "2.0.0", values_floor_version: "1.0.0",
2870
+ trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
2871
+ valid_until: args.valid_until,
2872
+ });
2873
+ const att = createV2Attestation({
2874
+ action_id: args.action_id, agent_id: state.agentKey,
2875
+ delegation_ref: args.delegation_ref,
2876
+ context_understanding: args.context_understanding,
2877
+ factors_considered: args.factors_considered,
2878
+ alternatives_rejected: args.alternatives_rejected,
2879
+ expected_outcome: args.expected_outcome,
2880
+ confidence: args.confidence,
2881
+ semantic_uncertainty: args.semantic_uncertainty,
2882
+ required: args.required, policy_context: ctx,
2883
+ agent_private_key: state.privateKey,
2884
+ });
2885
+ const quality = assessV2AttestationQuality(att);
2886
+ return { content: [{ type: "text", text: JSON.stringify({ attestation: att, quality }, null, 2) }] };
2887
+ }
2888
+ catch (e) {
2889
+ return { content: [{ type: "text", text: safeError("Attestation failed", e) }], isError: true };
2890
+ }
2891
+ });
2892
+ server.tool("request_migration", "Request fork-and-sunset migration when current delegation scope is insufficient.", {
2893
+ source_delegation: z.string(),
2894
+ limitation: z.string().describe("What the agent cannot do under current scope"),
2895
+ requested_scope_change: z.string(),
2896
+ justification: z.string(),
2897
+ valid_until: z.string(), trust_epoch: z.number().default(1),
2898
+ }, async (args) => {
2899
+ const keyErr = requireKey();
2900
+ if (keyErr)
2901
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2902
+ try {
2903
+ const ctx = createPolicyContext({
2904
+ policy_version: "2.0.0", values_floor_version: "1.0.0",
2905
+ trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
2906
+ valid_until: args.valid_until,
2907
+ });
2908
+ const req = requestV2Migration({
2909
+ source_agent: state.agentKey, source_delegation: args.source_delegation,
2910
+ limitation: args.limitation, requested_scope_change: args.requested_scope_change,
2911
+ justification: args.justification, agent_private_key: state.privateKey,
2912
+ policy_context: ctx,
2913
+ });
2914
+ return { content: [{ type: "text", text: JSON.stringify(req, null, 2) }] };
2915
+ }
2916
+ catch (e) {
2917
+ return { content: [{ type: "text", text: safeError("Migration request failed", e) }], isError: true };
2918
+ }
2919
+ });
2920
+ server.tool("create_artifact_provenance", "Tag an agent-generated artifact with provenance metadata (content hash, risk class, authoring agent).", {
2921
+ delegation_ref: z.string(), intended_use: z.string(),
2922
+ risk_class: z.enum(["low", "medium", "high", "critical"]),
2923
+ requires_human_execution: z.boolean().default(false),
2924
+ content: z.string().describe("The artifact content (used for hash, not stored)"),
2925
+ artifact_type: z.string().describe("e.g. email_draft, code_script, database_query"),
2926
+ valid_until: z.string(), trust_epoch: z.number().default(1),
2927
+ }, async (args) => {
2928
+ const keyErr = requireKey();
2929
+ if (keyErr)
2930
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2931
+ try {
2932
+ const ctx = createPolicyContext({
2933
+ policy_version: "2.0.0", values_floor_version: "1.0.0",
2934
+ trust_epoch: args.trust_epoch, issuer_id: state.agentKey,
2935
+ valid_until: args.valid_until,
2936
+ });
2937
+ const prov = createArtifactProvenance({
2938
+ authoring_agent: state.agentKey,
2939
+ authority_scope: { action_categories: ["*"] },
2940
+ delegation_ref: args.delegation_ref, intended_use: args.intended_use,
2941
+ risk_class: args.risk_class,
2942
+ requires_human_execution: args.requires_human_execution,
2943
+ content: args.content, artifact_type: args.artifact_type,
2944
+ policy_context: ctx, agent_private_key: state.privateKey,
2945
+ });
2946
+ return { content: [{ type: "text", text: JSON.stringify(prov, null, 2) }] };
2947
+ }
2948
+ catch (e) {
2949
+ return { content: [{ type: "text", text: safeError("Provenance failed", e) }], isError: true };
2950
+ }
2951
+ });
2952
+ server.tool("check_anomaly", "Record an action and check for anomalies (first-max-authority, concentration).", {
2953
+ action_id: z.string(), authority_level: z.number(),
2954
+ semantic_uncertainty: z.enum(["low", "medium", "high", "critical"]),
2955
+ risk_class: z.enum(["low", "medium", "high", "critical"]),
2956
+ delegation_ref: z.string(),
2957
+ was_delegated: z.boolean().default(false),
2958
+ complexity: z.number().min(0).max(1).default(0.5),
2959
+ }, async (args) => {
2960
+ const keyErr = requireKey();
2961
+ if (keyErr)
2962
+ return { content: [{ type: "text", text: keyErr }], isError: true };
2963
+ try {
2964
+ const record = {
2965
+ action_id: args.action_id, agent_id: state.agentKey,
2966
+ authority_level: args.authority_level,
2967
+ semantic_uncertainty: args.semantic_uncertainty,
2968
+ risk_class: args.risk_class,
2969
+ delegation_ref: args.delegation_ref,
2970
+ was_delegated: args.was_delegated,
2971
+ complexity: args.complexity,
2972
+ timestamp: new Date().toISOString(),
2973
+ };
2974
+ recordV2Action(record);
2975
+ const anomaly = checkV2FirstMaxAuthority(record);
2976
+ const concentration = computeV2ConcentrationMetrics(state.agentKey);
2977
+ return { content: [{ type: "text", text: JSON.stringify({
2978
+ action_recorded: true, anomaly_flag: anomaly, concentration,
2979
+ }, null, 2) }] };
2980
+ }
2981
+ catch (e) {
2982
+ return { content: [{ type: "text", text: safeError("Anomaly check failed", e) }], isError: true };
2983
+ }
2984
+ });
2985
+ // ═══════════════════════════════════════
2642
2986
  // MCP Prompts — Role-Specific
2643
2987
  // ═══════════════════════════════════════
2644
2988
  server.prompt("coordination_role", "Get instructions for your assigned coordination role", {}, async () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-passport-system-mcp",
3
- "version": "2.8.6",
3
+ "version": "2.9.0",
4
4
  "mcpName": "io.github.aeoess/agent-passport-mcp",
5
5
  "description": "MCP server for Agent Passport System — cryptographic identity, delegation, governance, and deliberation for AI agents",
6
6
  "type": "module",
@@ -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.15.0",
52
+ "agent-passport-system": "^1.18.0",
53
53
  "zod": "^3.25.0"
54
54
  },
55
55
  "devDependencies": {
56
- "@types/node": "^25.3.5",
56
+ "@types/node": "^25.5.0",
57
57
  "typescript": "^5.9.3"
58
58
  },
59
59
  "peerDependencies": {