phoenix-mcp-server 1.0.1 → 1.2.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
@@ -1,53 +1,53 @@
1
- # Phoenix Zero MCP Server
2
-
3
- Model Context Protocol server exposing L2 network health telemetry to AI agents.
4
-
5
- ## Tool: `preflight_network_health`
6
-
7
- Determine whether an L2 network is currently suitable for transaction execution using kernel-level network telemetry.
8
-
9
- **Parameters:**
10
- - `chain` (optional) — one of: base, arbitrum, optimism, zksync, scroll, mantle, linea, blast, mode, taiko, polygon_zkevm, casper
11
- - `metric` — `health_check` (free) | `rtt_ns` (x402 $0.01) | `revert_ratio` (x402 $0.01)
12
-
13
- **Returns:** `PASS`, `DEGRADED`, or `FAIL` with evidence (uptime, staleness, sampling interval).
14
-
15
- ## Setup
16
-
17
- ```bash
18
- npm install
19
- npm run build
20
- ```
21
-
22
- ### Claude Desktop
23
-
24
- Add to `claude_desktop_config.json`:
25
-
26
- ```json
27
- {
28
- "mcpServers": {
29
- "phoenix-zero": {
30
- "command": "node",
31
- "args": ["/absolute/path/to/mcp-server/dist/index.js"]
32
- }
33
- }
34
- }
35
- ```
36
-
37
- ### Test with Inspector
38
-
39
- ```bash
40
- npx @modelcontextprotocol/inspector node dist/index.js
41
- ```
42
-
43
- ## Data Source
44
-
45
- Live production oracle at `rtt.phoenix-ai.work`:
46
- - 12 L2 chains monitored every 2 seconds
47
- - eBPF XDP kernel-level probes
48
- - BLAKE3 + Ed25519 integrity on every measurement
49
- - x402 micropayment for premium data ($0.01/query)
50
-
51
- ## License
52
-
53
- MIT
1
+ # Phoenix Zero MCP Server
2
+
3
+ Model Context Protocol server exposing L2 network health telemetry to AI agents.
4
+
5
+ ## Tool: `preflight_network_health`
6
+
7
+ Determine whether an L2 network is currently suitable for transaction execution using kernel-level network telemetry.
8
+
9
+ **Parameters:**
10
+ - `chain` (optional) — one of: base, arbitrum, optimism, zksync, scroll, mantle, linea, blast, mode, taiko, polygon_zkevm, casper
11
+ - `metric` — `health_check` (free) | `rtt_ns` (x402 $0.01) | `revert_ratio` (x402 $0.01)
12
+
13
+ **Returns:** `PASS`, `DEGRADED`, or `FAIL` with evidence (uptime, staleness, sampling interval).
14
+
15
+ ## Setup
16
+
17
+ ```bash
18
+ npm install
19
+ npm run build
20
+ ```
21
+
22
+ ### Claude Desktop
23
+
24
+ Add to `claude_desktop_config.json`:
25
+
26
+ ```json
27
+ {
28
+ "mcpServers": {
29
+ "phoenix-zero": {
30
+ "command": "node",
31
+ "args": ["/absolute/path/to/mcp-server/dist/index.js"]
32
+ }
33
+ }
34
+ }
35
+ ```
36
+
37
+ ### Test with Inspector
38
+
39
+ ```bash
40
+ npx @modelcontextprotocol/inspector node dist/index.js
41
+ ```
42
+
43
+ ## Data Source
44
+
45
+ Live production oracle at `rtt.phoenix-ai.work`:
46
+ - 12 L2 chains monitored every 2 seconds
47
+ - eBPF XDP kernel-level probes
48
+ - BLAKE3 + Ed25519 integrity on every measurement
49
+ - x402 micropayment for premium data ($0.01/query)
50
+
51
+ ## License
52
+
53
+ MIT
package/dist/index.js CHANGED
@@ -27,6 +27,16 @@ async function fetchHealth() {
27
27
  }
28
28
  return res.json();
29
29
  }
30
+ async function fetchDemoSafe(chain) {
31
+ const url = chain
32
+ ? `${PHOENIX_BASE}/api/v1/demo/safe?chain=${chain}`
33
+ : `${PHOENIX_BASE}/api/v1/demo/safe`;
34
+ const res = await fetch(url);
35
+ if (!res.ok) {
36
+ throw new Error(`Demo endpoint returned ${res.status}`);
37
+ }
38
+ return res.json();
39
+ }
30
40
  async function fetchChainHealth(chain) {
31
41
  const res = await fetch(`${PHOENIX_BASE}/api/v1/chains/${chain}`);
32
42
  if (res.status === 402)
@@ -37,7 +47,42 @@ async function fetchChainHealth(chain) {
37
47
  }
38
48
  const server = new McpServer({
39
49
  name: "phoenix-zero",
40
- version: "1.0.0",
50
+ version: "1.2.0",
51
+ });
52
+ server.tool("check_safety_free", `FREE safety check for L2 networks — no payment required (100 calls/IP/day). Returns safe/unsafe verdict with reason code. Use this first to sample data before committing to paid x402 endpoints. Prevents $5-$15 gas loss on failed transactions during sequencer stalls.`, {
53
+ chain: z
54
+ .enum(CHAINS)
55
+ .optional()
56
+ .describe("L2 chain to check. Defaults to Base if omitted."),
57
+ }, {
58
+ readOnlyHint: true,
59
+ destructiveHint: false,
60
+ idempotentHint: true,
61
+ openWorldHint: true,
62
+ }, async ({ chain }) => {
63
+ try {
64
+ const data = await fetchDemoSafe(chain);
65
+ return {
66
+ content: [
67
+ {
68
+ type: "text",
69
+ text: JSON.stringify(data, null, 2),
70
+ },
71
+ ],
72
+ };
73
+ }
74
+ catch (err) {
75
+ const message = err instanceof Error ? err.message : String(err);
76
+ return {
77
+ content: [
78
+ {
79
+ type: "text",
80
+ text: JSON.stringify({ error: message, source: PHOENIX_BASE }, null, 2),
81
+ },
82
+ ],
83
+ isError: true,
84
+ };
85
+ }
41
86
  });
42
87
  server.tool("preflight_network_health", `Determine whether an L2 network is currently suitable for transaction execution using kernel-level network telemetry. Returns PASS, DEGRADED, or FAIL with RTT, packet-loss and timestamp evidence. Covers 12 L2 chains (Base, Arbitrum, Optimism, zkSync, Scroll, Mantle, Linea, Blast, Mode, Taiko, Polygon zkEVM, Casper). Data sourced from eBPF XDP probes with 2-second sampling interval, signed with BLAKE3+Ed25519.`, {
43
88
  chain: z
@@ -48,6 +93,11 @@ server.tool("preflight_network_health", `Determine whether an L2 network is curr
48
93
  .enum(["health_check", "rtt_ns", "revert_ratio"])
49
94
  .default("health_check")
50
95
  .describe("health_check = PASS/DEGRADED/FAIL verdict (free). rtt_ns = nanosecond RTT (x402 $0.01). revert_ratio = transaction revert rate (x402 $0.01)."),
96
+ }, {
97
+ readOnlyHint: true,
98
+ destructiveHint: false,
99
+ idempotentHint: true,
100
+ openWorldHint: true,
51
101
  }, async ({ chain, metric }) => {
52
102
  try {
53
103
  const health = await fetchHealth();
@@ -97,12 +147,13 @@ server.tool("preflight_network_health", `Determine whether an L2 network is curr
97
147
  price: "$0.01 USDC",
98
148
  payment_protocol: "x402 (HTTP 402 micropayment)",
99
149
  endpoint: premiumEndpoint,
150
+ preflight_endpoint: `${PHOENIX_BASE}/api/v1/preflight`,
151
+ preflight_note: "POST /api/v1/preflight with {chain} body returns deterministic PASS/DEGRADED/FAIL with evidence_id proving exact network state at decision time.",
100
152
  payment_rails: [
101
153
  { network: "Base mainnet (eip155:8453)", asset: "USDC" },
102
154
  { network: "Hedera testnet", asset: "native HBAR" },
103
155
  ],
104
- how_to_pay: "Send GET request to the endpoint. Server returns 402 with X-PAYMENT header containing payment challenge. Complete x402 payment flow to receive full telemetry.",
105
- discovery: `${PHOENIX_BASE}/.well-known/x402`,
156
+ how_to_pay: "Send request to the endpoint. Server returns 402 with payment-required header containing x402 challenge. Complete payment flow to receive data.",
106
157
  }, null, 2),
107
158
  },
108
159
  ],
package/package.json CHANGED
@@ -1,51 +1,51 @@
1
- {
2
- "name": "phoenix-mcp-server",
3
- "mcpName": "io.github.kant19801201behax5/phoenix-mcp-server",
4
- "version": "1.0.1",
5
- "description": "MCP server for Phoenix Zero L2 health oracle — kernel-level network telemetry for AI agents",
6
- "type": "module",
7
- "bin": {
8
- "phoenix-mcp-server": "./dist/index.js"
9
- },
10
- "files": [
11
- "dist",
12
- "server.json"
13
- ],
14
- "scripts": {
15
- "build": "tsc",
16
- "start": "node dist/index.js",
17
- "dev": "tsx src/index.ts",
18
- "test": "vitest run",
19
- "prepublishOnly": "npm run build"
20
- },
21
- "keywords": [
22
- "mcp",
23
- "mcp-server",
24
- "l2",
25
- "sequencer",
26
- "health",
27
- "oracle",
28
- "ebpf",
29
- "x402",
30
- "phoenix-zero",
31
- "preflight",
32
- "defi",
33
- "agent"
34
- ],
35
- "author": "Kent <aleksandrkent64@gmail.com>",
36
- "license": "MIT",
37
- "repository": {
38
- "type": "git",
39
- "url": "https://github.com/kant19801201behax5/x402-health-oracle"
40
- },
41
- "dependencies": {
42
- "@modelcontextprotocol/sdk": "^1.11.0",
43
- "zod": "^3.23.0"
44
- },
45
- "devDependencies": {
46
- "@types/node": "^22.14.0",
47
- "tsx": "^4.23.1",
48
- "typescript": "~5.8.2",
49
- "vitest": "^4.1.10"
50
- }
51
- }
1
+ {
2
+ "name": "phoenix-mcp-server",
3
+ "mcpName": "io.github.kant19801201behax5/phoenix-mcp-server",
4
+ "version": "1.2.0",
5
+ "description": "MCP server for Phoenix Zero L2 health oracle — kernel-level network telemetry for AI agents",
6
+ "type": "module",
7
+ "bin": {
8
+ "phoenix-mcp-server": "./dist/index.js"
9
+ },
10
+ "files": [
11
+ "dist",
12
+ "server.json"
13
+ ],
14
+ "scripts": {
15
+ "build": "tsc",
16
+ "start": "node dist/index.js",
17
+ "dev": "tsx src/index.ts",
18
+ "test": "vitest run",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "keywords": [
22
+ "mcp",
23
+ "mcp-server",
24
+ "l2",
25
+ "sequencer",
26
+ "health",
27
+ "oracle",
28
+ "ebpf",
29
+ "x402",
30
+ "phoenix-zero",
31
+ "preflight",
32
+ "defi",
33
+ "agent"
34
+ ],
35
+ "author": "Kent <aleksandrkent64@gmail.com>",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/kant19801201behax5/x402-health-oracle"
40
+ },
41
+ "dependencies": {
42
+ "@modelcontextprotocol/sdk": "^1.30.0",
43
+ "zod": "^3.23.0"
44
+ },
45
+ "devDependencies": {
46
+ "@types/node": "^22.14.0",
47
+ "tsx": "^4.23.1",
48
+ "typescript": "~5.8.2",
49
+ "vitest": "^4.1.10"
50
+ }
51
+ }
package/server.json CHANGED
@@ -1,26 +1,42 @@
1
- {
2
- "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
- "name": "io.github.kant19801201behax5/phoenix-mcp-server",
4
- "title": "Phoenix Zero — L2 Health Oracle",
5
- "description": "Pre-flight L2 health check using kernel-level eBPF telemetry. PASS/DEGRADED/FAIL verdict.",
6
- "repository": {
7
- "url": "https://github.com/kant19801201behax5/x402-health-oracle",
8
- "source": "github"
9
- },
10
- "version": "1.0.1",
11
- "packages": [
12
- {
13
- "registryType": "npm",
14
- "registryBaseUrl": "https://registry.npmjs.org",
15
- "identifier": "phoenix-mcp-server",
16
- "version": "1.0.1",
17
- "transport": { "type": "stdio" }
18
- }
19
- ],
20
- "tools": [
21
- {
22
- "name": "preflight_network_health",
23
- "description": "Determine whether an L2 network is suitable for transaction execution using kernel-level telemetry."
24
- }
25
- ]
26
- }
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.kant19801201behax5/phoenix-mcp-server",
4
+ "title": "Phoenix Zero — L2 Health Oracle",
5
+ "description": "Pre-flight L2 health check using kernel-level eBPF telemetry. PASS/DEGRADED/FAIL verdict.",
6
+ "repository": {
7
+ "url": "https://github.com/kant19801201behax5/x402-health-oracle",
8
+ "source": "github"
9
+ },
10
+ "version": "1.2.0",
11
+ "packages": [
12
+ {
13
+ "registryType": "npm",
14
+ "registryBaseUrl": "https://registry.npmjs.org",
15
+ "identifier": "phoenix-mcp-server",
16
+ "version": "1.2.0",
17
+ "transport": { "type": "stdio" }
18
+ }
19
+ ],
20
+ "tools": [
21
+ {
22
+ "name": "check_safety_free",
23
+ "description": "FREE safety check for L2 networks (100 calls/IP/day). Returns safe/unsafe verdict with reason code for any of 12 chains. No payment required.",
24
+ "annotations": {
25
+ "readOnlyHint": true,
26
+ "destructiveHint": false,
27
+ "idempotentHint": true,
28
+ "openWorldHint": true
29
+ }
30
+ },
31
+ {
32
+ "name": "preflight_network_health",
33
+ "description": "Determine whether an L2 network is suitable for transaction execution using kernel-level eBPF telemetry. Returns PASS/DEGRADED/FAIL with RTT, revert ratio, and timestamp evidence. Covers 12 L2 chains. health_check metric is free; rtt_ns and revert_ratio require x402 $0.01.",
34
+ "annotations": {
35
+ "readOnlyHint": true,
36
+ "destructiveHint": false,
37
+ "idempotentHint": true,
38
+ "openWorldHint": true
39
+ }
40
+ }
41
+ ]
42
+ }