coinopai-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 (3) hide show
  1. package/README.md +54 -0
  2. package/index.js +144 -0
  3. package/package.json +46 -0
package/README.md ADDED
@@ -0,0 +1,54 @@
1
+ # coinopai-mcp
2
+
3
+ MCP server for [CoinOpAI](https://x402.coinopai.com) — agent automation prompts and crypto signals, paid per-call with USDC on Base via the x402 protocol.
4
+
5
+ ## What you get
6
+
7
+ | Tool | What it does | Cost |
8
+ |------|-------------|------|
9
+ | `search_agent_automations` | Search 819 agent automation prompts | $0.01 |
10
+ | `get_agent_automation` | Full prompt + workflow steps by slug | $0.01 |
11
+ | `list_automation_categories` | All 35 categories with counts | $0.005 |
12
+ | `get_crypto_signals` | Latest hourly BTC/ETH/SOL/XRP/ADA signals | $0.05 |
13
+ | `get_crypto_risk` | Current risk state + regime detection | $0.02 |
14
+ | `get_crypto_signal_history` | Up to 168h of signal history | $0.05 |
15
+
16
+ No API keys. No subscriptions. Pay only for what you use.
17
+
18
+ ## Requirements
19
+
20
+ - A Base wallet with USDC funded (any amount — $1 goes a long way at these prices)
21
+ - Node.js 18+
22
+
23
+ ## Install in Claude Code
24
+
25
+ Add to your `~/.claude/settings.json`:
26
+
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "coinopai": {
31
+ "command": "npx",
32
+ "args": ["coinopai-mcp"],
33
+ "env": {
34
+ "WALLET_PRIVATE_KEY": "0x<your-base-wallet-private-key>"
35
+ }
36
+ }
37
+ }
38
+ }
39
+ ```
40
+
41
+ Then restart Claude Code. The tools appear automatically.
42
+
43
+ ## Get a wallet
44
+
45
+ 1. Install [Coinbase Wallet](https://wallet.coinbase.com) or use any EVM wallet
46
+ 2. Switch to Base network
47
+ 3. Buy or bridge a small amount of USDC
48
+ 4. Export your private key and add it to the config above
49
+
50
+ ## How payment works
51
+
52
+ Each tool call makes a real HTTP request to `x402.coinopai.com`. The server returns a `402 Payment Required` response with the price. The MCP server automatically signs a USDC micropayment using your wallet and resends the request. You get the data. The fee lands on Base mainnet.
53
+
54
+ No human approval needed per call — configure once, pay automatically.
package/index.js ADDED
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ const { Server } = require("@modelcontextprotocol/sdk/server/index.js");
5
+ const { StdioServerTransport } = require("@modelcontextprotocol/sdk/server/stdio.js");
6
+ const { CallToolRequestSchema, ListToolsRequestSchema } = require("@modelcontextprotocol/sdk/types.js");
7
+ const { x402Client, x402HTTPClient } = require("@x402/core/client");
8
+ const { ExactEvmScheme, registerExactEvmScheme } = require("@x402/evm/exact/client");
9
+ const { toClientEvmSigner } = require("@x402/evm");
10
+ const { x402Facilitator } = require("@x402/core/facilitator");
11
+ const { createWalletClient, http, publicActions } = require("viem");
12
+ const { base } = require("viem/chains");
13
+ const { privateKeyToAccount } = require("viem/accounts");
14
+ const { facilitator: coinbaseFacilitator } = require("@coinbase/x402");
15
+
16
+ const BASE_URL = "https://x402.coinopai.com";
17
+
18
+ const TOOLS = [
19
+ {
20
+ name: "search_agent_automations",
21
+ description: "Search 819 agent automation prompts by keyword. Returns matching automations with title, description, complexity and services. Costs $0.01 USDC.",
22
+ inputSchema: {
23
+ type: "object",
24
+ properties: {
25
+ query: { type: "string", description: "Search keyword (e.g. 'slack', 'notion', 'github')" },
26
+ limit: { type: "number", description: "Max results to return (default 20, max 50)" }
27
+ },
28
+ required: ["query"]
29
+ }
30
+ },
31
+ {
32
+ name: "get_agent_automation",
33
+ description: "Get the full agent automation prompt and workflow steps by slug. Costs $0.01 USDC.",
34
+ inputSchema: {
35
+ type: "object",
36
+ properties: {
37
+ slug: { type: "string", description: "Automation slug (e.g. 'slack-to-notion')" }
38
+ },
39
+ required: ["slug"]
40
+ }
41
+ },
42
+ {
43
+ name: "list_automation_categories",
44
+ description: "List all 35 automation categories with counts. Costs $0.005 USDC.",
45
+ inputSchema: { type: "object", properties: {} }
46
+ },
47
+ {
48
+ name: "get_crypto_signals",
49
+ description: "Latest hourly directional signals for BTC, ETH, SOL, XRP, ADA from the Kronos model. Positive = bullish, negative = bearish. Costs $0.05 USDC.",
50
+ inputSchema: { type: "object", properties: {} }
51
+ },
52
+ {
53
+ name: "get_crypto_risk",
54
+ description: "Current crypto market risk state (NORMAL/ELEVATED/HIGH), regime detection, equity tracking, signal streaks. Costs $0.02 USDC.",
55
+ inputSchema: { type: "object", properties: {} }
56
+ },
57
+ {
58
+ name: "get_crypto_signal_history",
59
+ description: "Historical hourly crypto signals from Kronos — up to 168 hours of BTC/ETH/SOL/XRP/ADA data. Costs $0.05 USDC.",
60
+ inputSchema: {
61
+ type: "object",
62
+ properties: {
63
+ hours: { type: "number", description: "Hours of history to fetch (default 24, max 168)" }
64
+ }
65
+ }
66
+ }
67
+ ];
68
+
69
+ function buildHttpClient() {
70
+ const key = process.env.WALLET_PRIVATE_KEY;
71
+ if (!key) throw new Error("WALLET_PRIVATE_KEY required — set a Base wallet private key with USDC funded");
72
+
73
+ const pk = key.startsWith("0x") ? key : "0x" + key;
74
+ const account = privateKeyToAccount(pk);
75
+ const walletClient = createWalletClient({ account, chain: base, transport: http() }).extend(publicActions);
76
+ const signer = toClientEvmSigner(account, walletClient);
77
+ const facilitator = new x402Facilitator(coinbaseFacilitator);
78
+ const client = x402Client.from({ schemes: [registerExactEvmScheme(new ExactEvmScheme(), signer)] });
79
+
80
+ return new x402HTTPClient(client);
81
+ }
82
+
83
+ async function call(httpClient, path) {
84
+ const resp = await httpClient.fetch(BASE_URL + path);
85
+ if (!resp.ok) {
86
+ const body = await resp.text().catch(() => resp.statusText);
87
+ throw new Error(`HTTP ${resp.status}: ${body.slice(0, 200)}`);
88
+ }
89
+ return resp.json();
90
+ }
91
+
92
+ async function main() {
93
+ let httpClient;
94
+ try {
95
+ httpClient = buildHttpClient();
96
+ } catch (e) {
97
+ process.stderr.write("[coinopai-mcp] " + e.message + "\n");
98
+ process.exit(1);
99
+ }
100
+
101
+ const server = new Server(
102
+ { name: "coinopai-mcp", version: "1.0.0" },
103
+ { capabilities: { tools: {} } }
104
+ );
105
+
106
+ server.setRequestHandler(ListToolsRequestSchema, async () => ({ tools: TOOLS }));
107
+
108
+ server.setRequestHandler(CallToolRequestSchema, async (req) => {
109
+ const { name, arguments: args } = req.params;
110
+ try {
111
+ let data;
112
+ switch (name) {
113
+ case "search_agent_automations":
114
+ data = await call(httpClient, `/api/search?q=${encodeURIComponent(args.query || "")}&limit=${args.limit || 20}`);
115
+ break;
116
+ case "get_agent_automation":
117
+ data = await call(httpClient, `/api/automation/${encodeURIComponent(args.slug)}`);
118
+ break;
119
+ case "list_automation_categories":
120
+ data = await call(httpClient, "/api/categories");
121
+ break;
122
+ case "get_crypto_signals":
123
+ data = await call(httpClient, "/api/kronos/signals");
124
+ break;
125
+ case "get_crypto_risk":
126
+ data = await call(httpClient, "/api/kronos/risk");
127
+ break;
128
+ case "get_crypto_signal_history":
129
+ data = await call(httpClient, `/api/kronos/history?hours=${args.hours || 24}`);
130
+ break;
131
+ default:
132
+ throw new Error("Unknown tool: " + name);
133
+ }
134
+ return { content: [{ type: "text", text: JSON.stringify(data, null, 2) }] };
135
+ } catch (e) {
136
+ return { content: [{ type: "text", text: "Error: " + e.message }], isError: true };
137
+ }
138
+ });
139
+
140
+ const transport = new StdioServerTransport();
141
+ await server.connect(transport);
142
+ }
143
+
144
+ main();
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "coinopai-mcp",
3
+ "version": "1.0.0",
4
+ "description": "MCP server for CoinOpAI — agent automation prompts and crypto signals via x402 micropayments on Base",
5
+ "main": "index.js",
6
+ "bin": {
7
+ "coinopai-mcp": "index.js"
8
+ },
9
+ "files": [
10
+ "index.js",
11
+ "README.md"
12
+ ],
13
+ "scripts": {
14
+ "start": "node index.js"
15
+ },
16
+ "engines": {
17
+ "node": ">=18"
18
+ },
19
+ "keywords": [
20
+ "mcp",
21
+ "x402",
22
+ "agent",
23
+ "automation",
24
+ "crypto",
25
+ "signals",
26
+ "coinbase",
27
+ "base",
28
+ "usdc",
29
+ "micropayments",
30
+ "claude"
31
+ ],
32
+ "author": "CoinOpAI",
33
+ "license": "MIT",
34
+ "repository": {
35
+ "type": "git",
36
+ "url": "https://github.com/coinopai/coinopai-mcp"
37
+ },
38
+ "homepage": "https://x402.coinopai.com",
39
+ "dependencies": {
40
+ "@coinbase/x402": "^2.1.0",
41
+ "@modelcontextprotocol/sdk": "^1.10.1",
42
+ "@x402/core": "^2.11.0",
43
+ "@x402/evm": "^2.11.0",
44
+ "viem": "^2.0.0"
45
+ }
46
+ }