@parad0x_labs/mcp-server 0.1.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 +88 -0
- package/dist/anchor.d.ts +29 -0
- package/dist/anchor.d.ts.map +1 -0
- package/dist/anchor.js +54 -0
- package/dist/anchor.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +985 -0
- package/dist/index.js.map +1 -0
- package/dist/resolve.d.ts +32 -0
- package/dist/resolve.d.ts.map +1 -0
- package/dist/resolve.js +79 -0
- package/dist/resolve.js.map +1 -0
- package/dist/scope.d.ts +38 -0
- package/dist/scope.d.ts.map +1 -0
- package/dist/scope.js +63 -0
- package/dist/scope.js.map +1 -0
- package/dist/wallet.d.ts +25 -0
- package/dist/wallet.d.ts.map +1 -0
- package/dist/wallet.js +32 -0
- package/dist/wallet.js.map +1 -0
- package/package.json +32 -0
package/README.md
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# @parad0x_labs/mcp-server
|
|
2
|
+
|
|
3
|
+
Exposes the Parad0x Labs stack as MCP tools. Works with Claude Desktop, Cursor, Windsurf, and any MCP-compatible agent runtime.
|
|
4
|
+
|
|
5
|
+
## Tools
|
|
6
|
+
|
|
7
|
+
| Tool | Description |
|
|
8
|
+
|---|---|
|
|
9
|
+
| `x402_get_quote` | Get a payment quote for an x402-gated API endpoint |
|
|
10
|
+
| `anchor_receipt` | Anchor a 32-byte receipt hash on Solana mainnet via `receipt_anchor` |
|
|
11
|
+
| `lookup_passport` | Check if an ETH address or Solana wallet has a verified Dark Passport binding |
|
|
12
|
+
| `build_outcome_receipt` | Build a signed outcome receipt with PnL, accuracy, or delivery result |
|
|
13
|
+
| `compress_receipts` | Compress a batch of receipts (Liquefy format, 83x typical ratio) |
|
|
14
|
+
| `get_stack_status` | Discover all live Parad0x Labs mainnet program addresses |
|
|
15
|
+
|
|
16
|
+
## Install
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install -g @parad0x_labs/mcp-server
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Or use directly via `npx` without installing.
|
|
23
|
+
|
|
24
|
+
## Claude Desktop config
|
|
25
|
+
|
|
26
|
+
Add to `~/Library/Application Support/Claude/claude_desktop_config.json` (macOS) or `%APPDATA%\Claude\claude_desktop_config.json` (Windows):
|
|
27
|
+
|
|
28
|
+
```json
|
|
29
|
+
{
|
|
30
|
+
"mcpServers": {
|
|
31
|
+
"parad0x": {
|
|
32
|
+
"command": "npx",
|
|
33
|
+
"args": ["-y", "@parad0x_labs/mcp-server"],
|
|
34
|
+
"env": {
|
|
35
|
+
"SOLANA_RPC_URL": "https://api.mainnet-beta.solana.com",
|
|
36
|
+
"SOLANA_KEYPAIR": "[1,2,3,...]"
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`SOLANA_KEYPAIR` is a JSON array of 64 bytes (the standard Solana keypair format output by `solana-keygen`). Without it, `anchor_receipt` runs in dry-run mode and returns a mock transaction for format inspection.
|
|
44
|
+
|
|
45
|
+
## Cursor / Windsurf config
|
|
46
|
+
|
|
47
|
+
Add to `.cursor/mcp.json` or `.windsurf/mcp.json` in your project root:
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"parad0x": {
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": ["-y", "@parad0x_labs/mcp-server"],
|
|
55
|
+
"env": {
|
|
56
|
+
"SOLANA_RPC_URL": "https://api.mainnet-beta.solana.com"
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
## Build from source
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
cd packages/mcp-server
|
|
67
|
+
npm install
|
|
68
|
+
npm run build
|
|
69
|
+
npm start
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Env vars
|
|
73
|
+
|
|
74
|
+
| Variable | Default | Description |
|
|
75
|
+
|---|---|---|
|
|
76
|
+
| `SOLANA_RPC_URL` | `https://api.mainnet-beta.solana.com` | Solana RPC endpoint |
|
|
77
|
+
| `SOLANA_KEYPAIR` | _(unset)_ | JSON array of 64 bytes — enables real transaction submission |
|
|
78
|
+
|
|
79
|
+
## Programs (mainnet)
|
|
80
|
+
|
|
81
|
+
| Program | Address |
|
|
82
|
+
|---|---|
|
|
83
|
+
| receipt_anchor | `6HSRGivdYR5D7yTDy1TFMCM8h3LzXxRtKU1RA3RnCMRN` |
|
|
84
|
+
| dark_secp256r1_vault | `3hbbtjeSrTVYXq6eRwjeofDe2DCPh3n8cfN6kZcQfewi` |
|
|
85
|
+
| dark_secp256k1_auth | `AqwBbV13AoczhoELwP8oxT3nDqB6MsLWXauNzHkssZ9B` |
|
|
86
|
+
| dark_bn254_gate | `GCptvBYF8S6eVYoh15B7WAESc54FUHCpN1Ui6aHeQYZd` |
|
|
87
|
+
| dark_semaphore | `Ev7HEFhhKTXk6kS2Y6ssbUcK9C7E6yZ589jJNjUrQV5p` |
|
|
88
|
+
| null_token | `8EeDdvCRmFAzVD4takkBrNNwkeUTUQh4MscRK5Fzpump` |
|
package/dist/anchor.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* receipt_anchor instruction encoder (host-free, byte-exact, unit-tested).
|
|
3
|
+
*
|
|
4
|
+
* Built from the verified on-chain ABI of receipt_anchor (6HSRGivd…):
|
|
5
|
+
* data = [0x01 version][flags][32-byte hash]( [u64 LE bucket_id] )
|
|
6
|
+
* - 34-byte form: flags=0x00, program derives the bucket from its Clock hour
|
|
7
|
+
* - 42-byte form: flags=0x01, client pins bucket_id (this is what we use)
|
|
8
|
+
* keys = [payer(signer,writable), bucket PDA(writable), system_program]
|
|
9
|
+
* bucket PDA seeds = ["bucket", u64 LE bucket_id], bucket_id = floor(unix/3600)
|
|
10
|
+
*
|
|
11
|
+
* We use the 42-byte pinned-bucket form so the bucket PDA the client derives
|
|
12
|
+
* always matches the one the program writes (the 34-byte form would let the
|
|
13
|
+
* validator's Clock hour drift from the client's near an hour boundary).
|
|
14
|
+
*/
|
|
15
|
+
import { PublicKey, TransactionInstruction } from "@solana/web3.js";
|
|
16
|
+
export declare const RECEIPT_ANCHOR_VERSION = 1;
|
|
17
|
+
export declare const FLAG_HAS_BUCKET_ID = 1;
|
|
18
|
+
/** The program's hourly bucket id: floor(unix_seconds / 3600); 0 for non-positive. */
|
|
19
|
+
export declare function bucketIdForUnix(unixSeconds: number): bigint;
|
|
20
|
+
/** Derive the AnchorBucket PDA for a bucket id: ["bucket", u64 LE bucket_id]. */
|
|
21
|
+
export declare function deriveBucketPda(bucketId: bigint, programId: string): PublicKey;
|
|
22
|
+
/** Build the single-anchor instruction (42-byte pinned-bucket form). */
|
|
23
|
+
export declare function buildAnchorIx(opts: {
|
|
24
|
+
payer: string;
|
|
25
|
+
receiptHashHex: string;
|
|
26
|
+
programId: string;
|
|
27
|
+
bucketId: bigint;
|
|
28
|
+
}): TransactionInstruction;
|
|
29
|
+
//# sourceMappingURL=anchor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../src/anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAiB,MAAM,iBAAiB,CAAC;AAEnF,eAAO,MAAM,sBAAsB,IAAO,CAAC;AAC3C,eAAO,MAAM,kBAAkB,IAAO,CAAC;AAIvC,sFAAsF;AACtF,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAE3D;AAQD,iFAAiF;AACjF,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,SAAS,CAM9E;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,IAAI,EAAE;IAClC,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;CAClB,GAAG,sBAAsB,CAkBzB"}
|
package/dist/anchor.js
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* receipt_anchor instruction encoder (host-free, byte-exact, unit-tested).
|
|
3
|
+
*
|
|
4
|
+
* Built from the verified on-chain ABI of receipt_anchor (6HSRGivd…):
|
|
5
|
+
* data = [0x01 version][flags][32-byte hash]( [u64 LE bucket_id] )
|
|
6
|
+
* - 34-byte form: flags=0x00, program derives the bucket from its Clock hour
|
|
7
|
+
* - 42-byte form: flags=0x01, client pins bucket_id (this is what we use)
|
|
8
|
+
* keys = [payer(signer,writable), bucket PDA(writable), system_program]
|
|
9
|
+
* bucket PDA seeds = ["bucket", u64 LE bucket_id], bucket_id = floor(unix/3600)
|
|
10
|
+
*
|
|
11
|
+
* We use the 42-byte pinned-bucket form so the bucket PDA the client derives
|
|
12
|
+
* always matches the one the program writes (the 34-byte form would let the
|
|
13
|
+
* validator's Clock hour drift from the client's near an hour boundary).
|
|
14
|
+
*/
|
|
15
|
+
import { PublicKey, TransactionInstruction, SystemProgram } from "@solana/web3.js";
|
|
16
|
+
export const RECEIPT_ANCHOR_VERSION = 0x01;
|
|
17
|
+
export const FLAG_HAS_BUCKET_ID = 0x01;
|
|
18
|
+
const BUCKET_SEED_PREFIX = "bucket";
|
|
19
|
+
const BUCKET_WINDOW_SECONDS = 3600;
|
|
20
|
+
/** The program's hourly bucket id: floor(unix_seconds / 3600); 0 for non-positive. */
|
|
21
|
+
export function bucketIdForUnix(unixSeconds) {
|
|
22
|
+
return unixSeconds <= 0 ? 0n : BigInt(Math.floor(unixSeconds / BUCKET_WINDOW_SECONDS));
|
|
23
|
+
}
|
|
24
|
+
function u64le(n) {
|
|
25
|
+
const b = Buffer.alloc(8);
|
|
26
|
+
b.writeBigUInt64LE(n);
|
|
27
|
+
return b;
|
|
28
|
+
}
|
|
29
|
+
/** Derive the AnchorBucket PDA for a bucket id: ["bucket", u64 LE bucket_id]. */
|
|
30
|
+
export function deriveBucketPda(bucketId, programId) {
|
|
31
|
+
const [pda] = PublicKey.findProgramAddressSync([Buffer.from(BUCKET_SEED_PREFIX), u64le(bucketId)], new PublicKey(programId));
|
|
32
|
+
return pda;
|
|
33
|
+
}
|
|
34
|
+
/** Build the single-anchor instruction (42-byte pinned-bucket form). */
|
|
35
|
+
export function buildAnchorIx(opts) {
|
|
36
|
+
if (!/^[0-9a-fA-F]{64}$/.test(opts.receiptHashHex)) {
|
|
37
|
+
throw new Error("receipt_hash_hex must be exactly 64 hex characters (32 bytes).");
|
|
38
|
+
}
|
|
39
|
+
const data = Buffer.concat([
|
|
40
|
+
Buffer.from([RECEIPT_ANCHOR_VERSION, FLAG_HAS_BUCKET_ID]),
|
|
41
|
+
Buffer.from(opts.receiptHashHex, "hex"),
|
|
42
|
+
u64le(opts.bucketId),
|
|
43
|
+
]);
|
|
44
|
+
return new TransactionInstruction({
|
|
45
|
+
programId: new PublicKey(opts.programId),
|
|
46
|
+
keys: [
|
|
47
|
+
{ pubkey: new PublicKey(opts.payer), isSigner: true, isWritable: true },
|
|
48
|
+
{ pubkey: deriveBucketPda(opts.bucketId, opts.programId), isSigner: false, isWritable: true },
|
|
49
|
+
{ pubkey: SystemProgram.programId, isSigner: false, isWritable: false },
|
|
50
|
+
],
|
|
51
|
+
data,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=anchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.js","sourceRoot":"","sources":["../src/anchor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,SAAS,EAAE,sBAAsB,EAAE,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