aegis-x402-mcp 1.0.0 → 1.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Antigravity Autonomous Systems & Goatincrypto
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -114,13 +114,14 @@ Add to `~/.codeium/windsurf/mcp_config.json`:
114
114
  ## Publishing & Registry Registration
115
115
 
116
116
  ### Official Model Context Protocol Registry
117
- Submit PR to: [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers)
117
+ Published on the official MCP Registry: [registry.modelcontextprotocol.io](https://registry.modelcontextprotocol.io) via `mcp-publisher`.
118
118
 
119
- ### Community Registries
120
- - **Smithery:** Run `npx -y @smithery/cli install aegis-x402-mcp`
121
- - **mcp.so:** Submit package `aegis-x402-mcp`
119
+ ### Community Registries & Discovery
120
+ - **NPM:** [https://www.npmjs.com/package/aegis-x402-mcp](https://www.npmjs.com/package/aegis-x402-mcp)
121
+ - **GitHub:** [https://github.com/Goatincrypto/aegis-x402-mcp](https://github.com/Goatincrypto/aegis-x402-mcp)
122
122
  - **Glama:** [glama.ai/mcp/servers](https://glama.ai/mcp/servers)
123
123
  - **PulseMCP:** [pulsemcp.com](https://pulsemcp.com)
124
+ - **Smithery:** `npx -y @smithery/cli install aegis-x402-mcp`
124
125
 
125
126
  ---
126
127
 
package/dist/index.js CHANGED
@@ -3,6 +3,7 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
3
3
  import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
4
4
  import { CallToolRequestSchema, ListToolsRequestSchema, } from '@modelcontextprotocol/sdk/types.js';
5
5
  import { privateKeyToAccount } from 'viem/accounts';
6
+ import { getAddress } from 'viem';
6
7
  import { randomBytes } from 'crypto';
7
8
  const GATEWAY_URL = process.env.AEGIS_GATEWAY_URL || 'https://aegis-audit-x402.project-easy-x.workers.dev';
8
9
  const API_KEY = process.env.AEGIS_API_KEY || process.env.AEGIS_CREDIT_TOKEN || '';
@@ -15,7 +16,7 @@ const BASE_USDC = '0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913'.toLowerCase();
15
16
  * Keys never leave the local machine.
16
17
  * Protected by strict recipient allowlist guard: only signs toward official Aegis address.
17
18
  */
18
- async function signEip3009Payment(privateKeyHex, accepts) {
19
+ async function signEip3009Payment(privateKeyHex, accepts, resource) {
19
20
  const cleanKey = privateKeyHex.trim().startsWith('0x')
20
21
  ? privateKeyHex.trim()
21
22
  : `0x${privateKeyHex.trim()}`;
@@ -25,14 +26,18 @@ async function signEip3009Payment(privateKeyHex, accepts) {
25
26
  throw new Error(`SECURITY_RECIPIENT_GUARD: Recipient ${recipient} is not official Aegis receiver (${ALLOWED_PAYTO}). Signing refused.`);
26
27
  }
27
28
  const nonce = `0x${randomBytes(32).toString('hex')}`;
28
- const validAfter = 0n;
29
- const validBefore = BigInt(Math.floor(Date.now() / 1000) + 3600);
30
- const value = BigInt(accepts.amount || '10000');
29
+ const validAfterStr = '0';
30
+ const maxTimeout = typeof accepts.maxTimeoutSeconds === 'number' ? accepts.maxTimeoutSeconds : 300;
31
+ const validBeforeStr = String(Math.floor(Date.now() / 1000) + maxTimeout);
32
+ const valueStr = String(accepts.amount || '10000');
33
+ const fromChecksum = getAddress(account.address);
34
+ const toChecksum = getAddress(accepts.payTo || accepts.recipient);
35
+ const assetChecksum = getAddress(accepts.asset || BASE_USDC);
31
36
  const domain = {
32
37
  name: accepts.extra?.name || 'USD Coin',
33
38
  version: accepts.extra?.version || '2',
34
39
  chainId: 8453,
35
- verifyingContract: (accepts.asset || BASE_USDC),
40
+ verifyingContract: assetChecksum,
36
41
  };
37
42
  const types = {
38
43
  TransferWithAuthorization: [
@@ -49,29 +54,33 @@ async function signEip3009Payment(privateKeyHex, accepts) {
49
54
  types,
50
55
  primaryType: 'TransferWithAuthorization',
51
56
  message: {
52
- from: account.address,
53
- to: accepts.payTo,
54
- value,
55
- validAfter,
56
- validBefore,
57
+ from: fromChecksum,
58
+ to: toChecksum,
59
+ value: BigInt(valueStr),
60
+ validAfter: BigInt(validAfterStr),
61
+ validBefore: BigInt(validBeforeStr),
57
62
  nonce,
58
63
  },
59
64
  });
65
+ const authorization = {
66
+ from: fromChecksum,
67
+ to: toChecksum,
68
+ value: valueStr,
69
+ validAfter: validAfterStr,
70
+ validBefore: validBeforeStr,
71
+ nonce,
72
+ };
60
73
  const paymentPayload = {
61
74
  x402Version: 2,
62
- scheme: 'exact',
63
- network: 'eip155:8453',
64
- asset: accepts.asset || BASE_USDC,
65
75
  payload: {
66
- from: account.address,
67
- to: accepts.payTo,
68
- value: value.toString(),
69
- validAfter: Number(validAfter),
70
- validBefore: Number(validBefore),
71
- nonce,
76
+ authorization,
72
77
  signature,
73
78
  },
79
+ accepted: accepts,
74
80
  };
81
+ if (resource) {
82
+ paymentPayload.resource = resource;
83
+ }
75
84
  return Buffer.from(JSON.stringify(paymentPayload)).toString('base64');
76
85
  }
77
86
  /**
@@ -101,7 +110,7 @@ async function fetchFromAegis(endpoint, options = {}) {
101
110
  // Tier 3: If user provided a local private key, sign and retry in-flight
102
111
  if (PRIVATE_KEY && accepts) {
103
112
  try {
104
- const signedHeader = await signEip3009Payment(PRIVATE_KEY, accepts);
113
+ const signedHeader = await signEip3009Payment(PRIVATE_KEY, accepts, paymentReq?.resource);
105
114
  const retryHeaders = {
106
115
  ...headers,
107
116
  'X-PAYMENT': signedHeader,
@@ -136,7 +145,7 @@ async function fetchFromAegis(endpoint, options = {}) {
136
145
  }
137
146
  const server = new Server({
138
147
  name: 'aegis-x402-mcp',
139
- version: '1.0.0',
148
+ version: '1.0.2',
140
149
  }, {
141
150
  capabilities: {
142
151
  tools: {},
package/dist/test.d.ts ADDED
@@ -0,0 +1 @@
1
+ export {};
package/dist/test.js ADDED
@@ -0,0 +1,10 @@
1
+ import test from 'node:test';
2
+ import assert from 'node:assert/strict';
3
+ test('aegis-x402-mcp package configuration', () => {
4
+ assert.ok(true, 'Test harness operates correctly');
5
+ });
6
+ test('official payTo allowlist contains official Aegis node', () => {
7
+ const officialPayTo = '0x111ef680B6EFdd859FbEc473b907aCe95F0D1acB'.toLowerCase();
8
+ assert.equal(officialPayTo.length, 42);
9
+ assert.ok(officialPayTo.startsWith('0x111ef'));
10
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aegis-x402-mcp",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "Model Context Protocol (MCP) server for AegisAudit x402 Security Intelligence, PreFlight Bundles, KYA, and Grounded AI on Base",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -9,13 +9,23 @@
9
9
  },
10
10
  "files": [
11
11
  "dist",
12
- "README.md"
12
+ "README.md",
13
+ "LICENSE"
13
14
  ],
14
15
  "scripts": {
15
16
  "build": "tsc",
16
17
  "start": "node dist/index.js",
18
+ "test": "node --test dist/test.js",
17
19
  "prepublishOnly": "npm run build"
18
20
  },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "git+https://github.com/Goatincrypto/aegis-x402-mcp.git"
24
+ },
25
+ "homepage": "https://github.com/Goatincrypto/aegis-x402-mcp#readme",
26
+ "bugs": {
27
+ "url": "https://github.com/Goatincrypto/aegis-x402-mcp/issues"
28
+ },
19
29
  "keywords": [
20
30
  "mcp",
21
31
  "model-context-protocol",
@@ -32,5 +42,9 @@
32
42
  "dependencies": {
33
43
  "@modelcontextprotocol/sdk": "^1.29.0",
34
44
  "viem": "^2.21.0"
45
+ },
46
+ "devDependencies": {
47
+ "@types/node": "^20.11.0",
48
+ "typescript": "^5.4.5"
35
49
  }
36
50
  }