@macbookgenesis/genesis-mcp 1.0.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.
Files changed (2) hide show
  1. package/index.js +204 -0
  2. package/package.json +25 -0
package/index.js ADDED
@@ -0,0 +1,204 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { McpServer } from '@modelcontextprotocol/server';
4
+ import { StdioServerTransport } from '@modelcontextprotocol/server/stdio';
5
+ import { z } from 'zod';
6
+
7
+ const BASE =
8
+ 'https://genesis.palsus2023.workers.dev';
9
+
10
+ const TOOLS = [
11
+ {
12
+ name: 'repair_json',
13
+ price: '$0.003',
14
+ description:
15
+ 'Repair malformed or broken JSON into valid parseable JSON.'
16
+ },
17
+ {
18
+ name: 'normalize_json',
19
+ price: '$0.001',
20
+ description:
21
+ 'Canonicalize JSON with deterministic recursively sorted keys.'
22
+ },
23
+ {
24
+ name: 'compact_json',
25
+ price: '$0.001',
26
+ description:
27
+ 'Minify valid JSON into compact form.'
28
+ },
29
+ {
30
+ name: 'repair_validate_attest',
31
+ price: '$0.015',
32
+ description:
33
+ 'Repair malformed JSON, canonicalize it, validate it, generate a SHA-256 fingerprint, and return a signed machine-verifiable attestation.'
34
+ },
35
+ {
36
+ name: 'attestation_receipt',
37
+ price: '$0.005',
38
+ description:
39
+ 'Generate a signed SHA-256 integrity attestation receipt.'
40
+ },
41
+ {
42
+ name: 'sha256_digest',
43
+ price: '$0.001',
44
+ description:
45
+ 'Generate a deterministic SHA-256 digest.'
46
+ },
47
+ {
48
+ name: 'entropy_score',
49
+ price: '$0.002',
50
+ description:
51
+ 'Calculate Shannon entropy and randomness characteristics.'
52
+ },
53
+ {
54
+ name: 'html_to_text',
55
+ price: '$0.002',
56
+ description:
57
+ 'Convert HTML into readable plain text.'
58
+ },
59
+ {
60
+ name: 'html_to_markdown',
61
+ price: '$0.004',
62
+ description:
63
+ 'Convert HTML into Markdown.'
64
+ },
65
+ {
66
+ name: 'csv_to_json',
67
+ price: '$0.003',
68
+ description:
69
+ 'Convert CSV text into structured JSON rows.'
70
+ },
71
+ {
72
+ name: 'extract_entities',
73
+ price: '$0.003',
74
+ description:
75
+ 'Extract emails, URLs, IPv4 addresses, ISO dates, and phone numbers from text.'
76
+ }
77
+ ];
78
+
79
+ const server =
80
+ new McpServer({
81
+ name: 'UOS Genesis',
82
+ version: '1.0.0'
83
+ });
84
+
85
+ for (const tool of TOOLS) {
86
+ server.registerTool(
87
+ tool.name,
88
+ {
89
+ title:
90
+ `Genesis ${tool.name}`,
91
+
92
+ description:
93
+ `${tool.description} Price: ${tool.price} USDC via x402 on Base mainnet.`,
94
+
95
+ inputSchema: {
96
+ input:
97
+ z.union([
98
+ z.string(),
99
+ z.record(z.string(), z.any()),
100
+ z.array(z.any()),
101
+ z.number(),
102
+ z.boolean()
103
+ ])
104
+ }
105
+ },
106
+
107
+ async ({ input }) => {
108
+ const response =
109
+ await fetch(
110
+ `${BASE}/v1/${tool.name}`,
111
+ {
112
+ method: 'POST',
113
+
114
+ headers: {
115
+ 'Content-Type':
116
+ 'application/json'
117
+ },
118
+
119
+ body:
120
+ JSON.stringify({
121
+ input
122
+ })
123
+ }
124
+ );
125
+
126
+ if (
127
+ response.status === 402
128
+ ) {
129
+ const paymentRequired =
130
+ response.headers.get(
131
+ 'payment-required'
132
+ );
133
+
134
+ return {
135
+ content: [
136
+ {
137
+ type: 'text',
138
+
139
+ text:
140
+ JSON.stringify(
141
+ {
142
+ status:
143
+ 'payment_required',
144
+
145
+ tool:
146
+ tool.name,
147
+
148
+ price:
149
+ tool.price,
150
+
151
+ protocol:
152
+ 'x402',
153
+
154
+ network:
155
+ 'eip155:8453',
156
+
157
+ endpoint:
158
+ `${BASE}/v1/${tool.name}`,
159
+
160
+ paymentRequired
161
+ },
162
+ null,
163
+ 2
164
+ )
165
+ }
166
+ ]
167
+ };
168
+ }
169
+
170
+ const text =
171
+ await response.text();
172
+
173
+ if (!response.ok) {
174
+ return {
175
+ isError: true,
176
+
177
+ content: [
178
+ {
179
+ type: 'text',
180
+ text:
181
+ `Genesis returned HTTP ${response.status}: ${text}`
182
+ }
183
+ ]
184
+ };
185
+ }
186
+
187
+ return {
188
+ content: [
189
+ {
190
+ type: 'text',
191
+ text
192
+ }
193
+ ]
194
+ };
195
+ }
196
+ );
197
+ }
198
+
199
+ const transport =
200
+ new StdioServerTransport();
201
+
202
+ await server.connect(
203
+ transport
204
+ );
package/package.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "name": "@macbookgenesis/genesis-mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for UOS Genesis x402 machine utilities on Base mainnet",
5
+ "type": "module",
6
+ "main": "index.js",
7
+ "bin": {
8
+ "genesis-mcp": "./index.js"
9
+ },
10
+ "keywords": [
11
+ "mcp",
12
+ "x402",
13
+ "ai-agents",
14
+ "usdc",
15
+ "base",
16
+ "json",
17
+ "attestation",
18
+ "machine-tools"
19
+ ],
20
+ "author": "palsus2023",
21
+ "license": "MIT",
22
+ "dependencies": {
23
+ "@modelcontextprotocol/server": "^2.0.0"
24
+ }
25
+ }