agent-passport-system-mcp 2.25.0 → 2.27.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
@@ -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 149 tools 90% of integrations need. Set `APS_PROFILE=full` for all 149 tools.
15
+ `essential` is the default profile — the 154 tools 90% of integrations need. Set `APS_PROFILE=full` for all 154 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`: 149 tools across 103 modules (71 core + 32 v2 constitutional governance). Independently cited by [PDR in Production (Nanook & Gerundium, UBC)](https://doi.org/10.5281/zenodo.19323172).
21
+ Works with any MCP client: Claude Desktop, Claude Code, Cursor, Windsurf, and more. Full surface area under `APS_PROFILE=full`: 154 tools across 122 modules (84 core + 38 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
 
@@ -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) (v1.44.0, 2910 tests)
220
- - Python SDK: [agent-passport-system](https://pypi.org/project/agent-passport-system/) (v0.8.0)
219
+ - npm SDK: [agent-passport-system](https://www.npmjs.com/package/agent-passport-system) (v1.46.0, 2972 tests)
220
+ - Python SDK: [agent-passport-system](https://pypi.org/project/agent-passport-system/) (v0.13.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
@@ -66,7 +66,11 @@ import { createCharter, signCharter, verifyCharter, evaluateThreshold, createApp
66
66
  // v2 boundary primitives (AttributionConsent, ProvisionalStatement, HumanEscalationFlag)
67
67
  createAttributionReceipt, signAttributionConsent, verifyAttributionConsent, checkArtifactCitations, receiptCore, createProvisional, promoteStatement, verifyPromotion, withdrawProvisional, withdrawalPayload, isBinding, checkEscalationRequired, requestOwnerConfirmation, recordOwnerConfirmation,
68
68
  // Attribution Primitive (unified four-axis signed Merkle receipt)
69
- computeAttributionActionRef, constructAttributionPrimitive, projectAttribution, verifyAttributionProjection, verifyAttributionPrimitive, checkProjectionConsistency, } from "agent-passport-system";
69
+ computeAttributionActionRef, constructAttributionPrimitive, projectAttribution, verifyAttributionProjection, verifyAttributionPrimitive, checkProjectionConsistency,
70
+ // Attribution Weights (Build B — fractional D/C axis weight formulas)
71
+ computeDataAxisWeights, computeComputeAxisWeights, DEFAULT_WEIGHT_PROFILE,
72
+ // Attribution Settlement (Build C — per-period signed settlement record)
73
+ aggregateAttributionPrimitives, buildContributorQueryResponse, signSettlementRecord, verifySettlementRecord, } from "agent-passport-system";
70
74
  // ═══════════════════════════════════════
71
75
  // State Management
72
76
  // ═══════════════════════════════════════
@@ -462,6 +466,9 @@ const TOOL_PROFILES = {
462
466
  'aps_create_attribution_receipt',
463
467
  'aps_create_provisional',
464
468
  'aps_check_escalation_required',
469
+ // Build A attribution primitive — most-used entry points
470
+ 'aps_construct_attribution_primitive',
471
+ 'aps_verify_attribution_primitive',
465
472
  ]),
466
473
  };
467
474
  const activeProfile = (process.env.APS_PROFILE || 'full').toLowerCase();
@@ -658,6 +665,16 @@ const TOOL_SCOPE_MAP = {
658
665
  'aps_verify_attribution_primitive': 'governance',
659
666
  'aps_check_projection_consistency': 'governance',
660
667
  'aps_compute_attribution_action_ref': 'identity',
668
+ // Attribution Weights — Build B (fractional D/C axis formulas). Spec
669
+ // calls for a dedicated 'attribution' scope; integration-layer tools,
670
+ // not in the essential profile.
671
+ 'aps_compute_data_axis_weights': 'attribution',
672
+ 'aps_compute_compute_axis_weights': 'attribution',
673
+ // Attribution Settlement (Build C) — new 'settlement' scope, not in
674
+ // essentials profile. Integration-layer tools only.
675
+ 'aps_aggregate_settlement': 'settlement',
676
+ 'aps_verify_settlement': 'settlement',
677
+ 'aps_build_contributor_query': 'settlement',
661
678
  };
662
679
  // ═══════════════════════════════════════
663
680
  // TOOL: list_profiles
@@ -669,7 +686,7 @@ server.tool("list_profiles", "Show available tool profiles. Set APS_PROFILE env
669
686
  // ═══════════════════════════════════════
670
687
  // TOOL: list_tools_for_scope (Primitive #9: Tool Pool Assembly)
671
688
  // ═══════════════════════════════════════
672
- 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.", {
689
+ 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, attribution. Use ['*'] for all tools.", {
673
690
  scopes: z.array(z.string()).describe("Your delegation scopes, e.g. ['identity', 'delegation', 'commerce']"),
674
691
  }, async ({ scopes }) => {
675
692
  const allTools = Object.entries(TOOL_SCOPE_MAP);
@@ -4850,6 +4867,122 @@ server.tool("aps_compute_attribution_action_ref", "Derive the action_ref (hex sh
4850
4867
  return { content: [{ type: "text", text: safeError("computeAttributionActionRef failed", e) }], isError: true };
4851
4868
  }
4852
4869
  });
4870
+ // ═══════════════════════════════════════
4871
+ // Attribution Weights — Build B fractional weight formulas
4872
+ // Spec: BUILD-B-FRACTIONAL-WEIGHTS.md. Upstream of constructAttributionPrimitive:
4873
+ // compute canonical D/C axis weights from raw per-source / per-provider records,
4874
+ // then hand the resulting axis entries to aps_construct_attribution_primitive.
4875
+ // ═══════════════════════════════════════
4876
+ server.tool("aps_compute_data_axis_weights", "Compute the D-axis fractional weight vector from a list of AccessReceipt records with role, timestamp, and content length. Returns canonical DataAxisEntry[] with 6-digit decimal contribution_weight strings that sum to ~1.0 and feed directly into aps_construct_attribution_primitive. Empty input → empty array; all-zero raw weights → error. Weights = role × recency_decay × length_weight, normalized per spec BUILD-B §'The D-axis formula'. Parameter names match the SDK: `sources`, `action_timestamp`, optional `profile`.", {
4877
+ sources: z.array(z.object({
4878
+ source_did: z.string(),
4879
+ access_receipt_hash: z.string(),
4880
+ role: z.enum([
4881
+ 'primary_source', 'supporting_evidence', 'context_only', 'background_retrieval',
4882
+ ]),
4883
+ timestamp: z.string().describe("ISO-8601 UTC with millisecond precision + Z (t_source)"),
4884
+ content_length: z.number().nonnegative().describe("Tokens"),
4885
+ })).describe("Per-source records with retrieval metadata"),
4886
+ action_timestamp: z.string().describe("ISO-8601 UTC ms when the action ran (t_action)"),
4887
+ profile: z.any().optional().describe("Optional WeightProfile override; defaults to DEFAULT_WEIGHT_PROFILE"),
4888
+ }, async (args) => {
4889
+ try {
4890
+ const entries = computeDataAxisWeights(args.sources, {
4891
+ action_timestamp: args.action_timestamp,
4892
+ profile: args.profile,
4893
+ });
4894
+ return { content: [{ type: "text", text: JSON.stringify(entries, null, 2) }] };
4895
+ }
4896
+ catch (e) {
4897
+ return { content: [{ type: "text", text: safeError("computeDataAxisWeights failed", e) }], isError: true };
4898
+ }
4899
+ });
4900
+ server.tool("aps_compute_compute_axis_weights", "Compute the C-axis fractional weight vector from a list of inference billing records (prompt_tokens, completion_tokens). Returns canonical ComputeAxisEntry[] with 6-digit decimal compute_share strings that sum to ~1.0 and feed directly into aps_construct_attribution_primitive. Weights = prompt_tokens + completion_tokens × COMPLETION_MULTIPLIER (default 3.0), normalized per spec BUILD-B §'The C-axis formula'. Parameter names match the SDK: `providers`, optional `profile`.", {
4901
+ providers: z.array(z.object({
4902
+ provider_did: z.string(),
4903
+ hardware_attestation_hash: z.string(),
4904
+ prompt_tokens: z.number().nonnegative(),
4905
+ completion_tokens: z.number().nonnegative(),
4906
+ })).describe("Per-provider billing records"),
4907
+ profile: z.any().optional().describe("Optional WeightProfile override; defaults to DEFAULT_WEIGHT_PROFILE"),
4908
+ }, async (args) => {
4909
+ try {
4910
+ const entries = computeComputeAxisWeights(args.providers, { profile: args.profile });
4911
+ return { content: [{ type: "text", text: JSON.stringify(entries, null, 2) }] };
4912
+ }
4913
+ catch (e) {
4914
+ return { content: [{ type: "text", text: safeError("computeComputeAxisWeights failed", e) }], isError: true };
4915
+ }
4916
+ });
4917
+ // Keep DEFAULT_WEIGHT_PROFILE referenced so tree-shakers don't drop it
4918
+ // from the compiled bundle — consumers of the two tools above will want
4919
+ // to introspect the defaults.
4920
+ void DEFAULT_WEIGHT_PROFILE;
4921
+ // ═══════════════════════════════════════
4922
+ // Attribution Settlement — Build C per-period settlement record.
4923
+ // Spec: BUILD-C-SETTLEMENT-PIPELINE.md. Aggregates a stream of
4924
+ // AttributionPrimitives over [t0, t1) into one signed record per axis
4925
+ // with a balanced-Merkle commitment. Settlement is evidence, not
4926
+ // payment — economic conversion is gateway-private.
4927
+ // ═══════════════════════════════════════
4928
+ const SettlementPeriodSchema = z.object({
4929
+ t0: z.string().describe("Period start (canonical ISO-8601 UTC ms + Z). Inclusive."),
4930
+ t1: z.string().describe("Period end (canonical ISO-8601 UTC ms + Z). Exclusive."),
4931
+ period_id: z.string().describe("Gateway-scoped period identifier"),
4932
+ });
4933
+ server.tool("aps_aggregate_settlement", "Aggregate a batch of Attribution Primitives over a half-open settlement period [t0, t1) into a signed SettlementRecord. Each axis (D, P, G, C) produces a per-contributor total with a balanced-Merkle commitment. Residual buckets pool sub-threshold contributors per Build A §4.1. Output is a fully signed record ready for third-party verification. Spec: BUILD-C-SETTLEMENT-PIPELINE.md.", {
4934
+ receipts: z.array(z.any()).describe("Array of AttributionPrimitives to aggregate"),
4935
+ period: SettlementPeriodSchema,
4936
+ gateway_did: z.string().describe("Gateway DID that signs the record"),
4937
+ gateway_private_key: z.string().describe("Ed25519 gateway private key (hex)"),
4938
+ issued_at: z.string().optional().describe("Override issued_at (canonical ISO-8601 UTC ms + Z); defaults to now"),
4939
+ }, async (args) => {
4940
+ try {
4941
+ const unsigned = aggregateAttributionPrimitives(args.receipts, args.period, {
4942
+ gateway_did: args.gateway_did,
4943
+ issued_at: args.issued_at,
4944
+ });
4945
+ const signature = signSettlementRecord(unsigned, args.gateway_private_key);
4946
+ const record = { ...unsigned, signature };
4947
+ return { content: [{ type: "text", text: JSON.stringify(record, null, 2) }] };
4948
+ }
4949
+ catch (e) {
4950
+ return { content: [{ type: "text", text: safeError("aggregateSettlement failed", e) }], isError: true };
4951
+ }
4952
+ });
4953
+ server.tool("aps_verify_settlement", "Verify a signed SettlementRecord under S1-S5 (signature, Merkle roots, conservation, residual shape, optional input-receipts cross-check). S3 conservation is the strongest invariant: a gateway cannot inflate or suppress any contributor's share without breaking it. Returns {valid: true} or {valid: false, reason, detail}. Pass inputReceipts to also recompute input_receipts_hash.", {
4954
+ record: z.any().describe("A signed SettlementRecord"),
4955
+ gateway_public_key: z.string().describe("Gateway Ed25519 public key hex"),
4956
+ input_receipts: z.array(z.any()).optional().describe("Optional — the input Attribution Primitives that fed the settlement. When supplied, S5 cross-checks input_receipts_hash and verifies each receipt individually."),
4957
+ }, async (args) => {
4958
+ try {
4959
+ const result = verifySettlementRecord(args.record, {
4960
+ gatewayPublicKeyHex: args.gateway_public_key,
4961
+ inputReceipts: args.input_receipts,
4962
+ });
4963
+ return { content: [{ type: "text", text: JSON.stringify(result, null, 2) }] };
4964
+ }
4965
+ catch (e) {
4966
+ return { content: [{ type: "text", text: safeError("verifySettlement failed", e) }], isError: true };
4967
+ }
4968
+ });
4969
+ server.tool("aps_build_contributor_query", "Build a contributor-query response: given a signed SettlementRecord and a contributor DID, return per-axis (total_weight, contribution_count, merkle_path, axis_root) plus the full signed record so a third party can verify the contributor's share end-to-end without trusting the gateway beyond its public key. Returns null if the contributor has no share in the period.", {
4970
+ record: z.any().describe("A signed SettlementRecord"),
4971
+ contributor_did: z.string().describe("Contributor DID (data source, compute provider, governance signer, or protocol module identifier)"),
4972
+ gateway_jwks: z.string().optional().describe("Advisory JWKS URL; not part of the signed material"),
4973
+ }, async (args) => {
4974
+ try {
4975
+ const response = buildContributorQueryResponse(args.record, args.contributor_did, {
4976
+ gateway_jwks: args.gateway_jwks,
4977
+ });
4978
+ return {
4979
+ content: [{ type: "text", text: JSON.stringify(response, null, 2) }],
4980
+ };
4981
+ }
4982
+ catch (e) {
4983
+ return { content: [{ type: "text", text: safeError("buildContributorQuery failed", e) }], isError: true };
4984
+ }
4985
+ });
4853
4986
  server.prompt("coordination_role", "Get instructions for your assigned coordination role", {}, async () => {
4854
4987
  const role = state.agentRole || 'default';
4855
4988
  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.25.0",
3
+ "version": "2.27.0",
4
4
  "mcpName": "io.github.aeoess/agent-passport-mcp",
5
- "description": "MCP server for the Agent Passport System — enforcement infrastructure for the agent economy. 149 tools across 122 modules. Policy eval <2ms. Identity, delegation, reputation, enforcement, attestation, feeless Nano wallet, commerce, attribution primitive. Tracks SDK v1.44.0 (2,910 tests).",
5
+ "description": "MCP server for the Agent Passport System — enforcement infrastructure for the agent economy. 154 tools across 123 modules. Policy eval <2ms. Identity, delegation, reputation, enforcement, attestation, feeless Nano wallet, commerce, attribution primitive, attribution settlement. Tracks SDK v1.46.0 (2,972 tests).",
6
6
  "type": "module",
7
7
  "bin": {
8
8
  "agent-passport-system-mcp": "./build/bin.js",
@@ -15,10 +15,10 @@
15
15
  ],
16
16
  "scripts": {
17
17
  "build": "npx tsc && chmod 755 build/bin.js build/index.js build/setup.js",
18
- "test": "node --test tests/",
18
+ "test": "node --test tests/*.test.mjs",
19
19
  "watch": "tsc --watch",
20
20
  "inspector": "npx @modelcontextprotocol/inspector build/index.js",
21
- "prepublishOnly": "npm run build",
21
+ "prepublishOnly": "npm run build && npm test",
22
22
  "postinstall": "echo '\\n🔑 Agent Passport MCP installed! Run: npx agent-passport-system-mcp setup\\n Or for zero-install remote: npx agent-passport-system-mcp setup --remote\\n'",
23
23
  "postpublish": "cd ~/aeoess_web && node scripts/propagate.mjs --apply --commit 2>/dev/null || echo 'Propagation skipped (aeoess_web not found)'"
24
24
  },
@@ -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": "^1.44.0",
53
+ "agent-passport-system": "^1.46.0",
54
54
  "zod": "^3.25.76"
55
55
  },
56
56
  "devDependencies": {