@cortexcloud.org/mcp 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 +60 -0
- package/dist/client.d.ts +8 -0
- package/dist/client.js +25 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/tools.d.ts +170 -0
- package/dist/tools.js +114 -0
- package/dist/tools.js.map +1 -0
- package/package.json +43 -0
package/README.md
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# @cortexcloud/mcp
|
|
2
|
+
|
|
3
|
+
MCP (Model Context Protocol) server for **CortexCloud** — an agent-native AI & on-chain
|
|
4
|
+
data gateway. Agents pay per call in **USDC on Base via x402** — no API keys, no signup,
|
|
5
|
+
no subscriptions. Payment *is* authentication.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @cortexcloud/mcp
|
|
11
|
+
# or run directly:
|
|
12
|
+
npx @cortexcloud/mcp
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Configure (Claude Code / Codex / any MCP client)
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
claude mcp add cortexcloud -s user -- npx @cortexcloud/mcp
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Set your agent wallet (pays for x402 calls):
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
export CORTEXCLOUD_PRIVATE_KEY=0xYOUR_BASE_WALLET_PRIVATE_KEY # funds in USDC on Base
|
|
25
|
+
export CORTEXCLOUD_BASE_URL=https://api.cortexcloud.org # optional, this is the default
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
> The wallet needs USDC on Base (`eip155:8453`). No ETH required — x402 uses gasless
|
|
29
|
+
> EIP-3009 authorization. The merchant (CortexCloud) settles on-chain.
|
|
30
|
+
|
|
31
|
+
## Tools
|
|
32
|
+
|
|
33
|
+
| Tool | Paid? | Description |
|
|
34
|
+
|------|-------|-------------|
|
|
35
|
+
| `cortexcloud_models` | free | List all available models |
|
|
36
|
+
| `cortexcloud_chat` | ✅ USDC | OpenAI-compatible chat completion |
|
|
37
|
+
| `cortexcloud_base_balance` | ✅ USDC | Native ETH balance of a Base address |
|
|
38
|
+
| `cortexcloud_base_token_balance` | ✅ USDC | ERC-20 token balance on Base |
|
|
39
|
+
| `cortexcloud_prices` | ✅ USDC | Crypto prices (CoinGecko) |
|
|
40
|
+
| `cortexcloud_dex_search` | ✅ USDC | DEX pair search (DEXScreener) |
|
|
41
|
+
|
|
42
|
+
## Example (Claude Code)
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
> Use cortexcloud_chat with model "groq/llama-3.3-70b-versatile" to summarize this doc.
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
The agent signs an x402 payment, the call settles in USDC, the receipt is on-chain.
|
|
49
|
+
|
|
50
|
+
## Local development
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
npm install
|
|
54
|
+
npm run build
|
|
55
|
+
CORTEXCLOUD_PRIVATE_KEY=0x... npm run dev
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## License
|
|
59
|
+
|
|
60
|
+
MIT
|
package/dist/client.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DEFAULT_BASE_URL = "https://api.cortexcloud.org";
|
|
2
|
+
/**
|
|
3
|
+
* Build (and cache) an x402-enabled fetch that auto-handles 402 Payment
|
|
4
|
+
* Required against CortexCloud. Lazily initialized so free tools can load
|
|
5
|
+
* without a wallet key present.
|
|
6
|
+
*/
|
|
7
|
+
export declare function getPaidFetch(): typeof fetch;
|
|
8
|
+
export declare const CORTEXCLOUD_BASE_URL: string;
|
package/dist/client.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { x402Client, wrapFetchWithPayment } from "@x402/fetch";
|
|
2
|
+
import { registerExactEvmScheme } from "@x402/evm/exact/client";
|
|
3
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
4
|
+
export const DEFAULT_BASE_URL = "https://api.cortexcloud.org";
|
|
5
|
+
let cachedFetch = null;
|
|
6
|
+
/**
|
|
7
|
+
* Build (and cache) an x402-enabled fetch that auto-handles 402 Payment
|
|
8
|
+
* Required against CortexCloud. Lazily initialized so free tools can load
|
|
9
|
+
* without a wallet key present.
|
|
10
|
+
*/
|
|
11
|
+
export function getPaidFetch() {
|
|
12
|
+
if (cachedFetch)
|
|
13
|
+
return cachedFetch;
|
|
14
|
+
const pk = process.env.CORTEXCLOUD_PRIVATE_KEY;
|
|
15
|
+
if (!pk) {
|
|
16
|
+
throw new Error("CORTEXCLOUD_PRIVATE_KEY is required to call paid CortexCloud endpoints.");
|
|
17
|
+
}
|
|
18
|
+
const signer = privateKeyToAccount((pk.startsWith("0x") ? pk : `0x${pk}`));
|
|
19
|
+
const client = new x402Client();
|
|
20
|
+
registerExactEvmScheme(client, { signer });
|
|
21
|
+
cachedFetch = wrapFetchWithPayment(fetch, client);
|
|
22
|
+
return cachedFetch;
|
|
23
|
+
}
|
|
24
|
+
export const CORTEXCLOUD_BASE_URL = process.env.CORTEXCLOUD_BASE_URL ?? DEFAULT_BASE_URL;
|
|
25
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.js","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,MAAM,CAAC,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AAE9D,IAAI,WAAW,GAAwB,IAAI,CAAC;AAE5C;;;;GAIG;AACH,MAAM,UAAU,YAAY;IAC1B,IAAI,WAAW;QAAE,OAAO,WAAW,CAAC;IACpC,MAAM,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC;IAC/C,IAAI,CAAC,EAAE,EAAE,CAAC;QACR,MAAM,IAAI,KAAK,CACb,yEAAyE,CAC1E,CAAC;IACJ,CAAC;IACD,MAAM,MAAM,GAAG,mBAAmB,CAChC,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,EAAE,EAAE,CAAkB,CACxD,CAAC;IACF,MAAM,MAAM,GAAG,IAAI,UAAU,EAAE,CAAC;IAChC,sBAAsB,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;IAC3C,WAAW,GAAG,oBAAoB,CAAC,KAAK,EAAE,MAAM,CAAiB,CAAC;IAClE,OAAO,WAAW,CAAC;AACrB,CAAC;AAED,MAAM,CAAC,MAAM,oBAAoB,GAC/B,OAAO,CAAC,GAAG,CAAC,oBAAoB,IAAI,gBAAgB,CAAC"}
|
package/dist/index.d.ts
ADDED
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { allTools } from "./tools.js";
|
|
5
|
+
const server = new McpServer({
|
|
6
|
+
name: "cortexcloud",
|
|
7
|
+
version: "0.1.0",
|
|
8
|
+
});
|
|
9
|
+
// Register each CortexCloud tool. Input schemas are defined with zod in tools.ts.
|
|
10
|
+
for (const tool of allTools) {
|
|
11
|
+
// Build a zod raw shape from the tool's inputSchema (skip the empty {} case).
|
|
12
|
+
const shape = Object.keys(tool.inputSchema).length === 0
|
|
13
|
+
? {}
|
|
14
|
+
: tool.inputSchema;
|
|
15
|
+
server.tool(tool.name, tool.description, shape, async (args) => {
|
|
16
|
+
const { status, body } = await tool.run(args);
|
|
17
|
+
return {
|
|
18
|
+
content: [
|
|
19
|
+
{
|
|
20
|
+
type: "text",
|
|
21
|
+
text: typeof body === "string"
|
|
22
|
+
? body
|
|
23
|
+
: JSON.stringify(body, null, 2),
|
|
24
|
+
},
|
|
25
|
+
],
|
|
26
|
+
isError: status >= 400,
|
|
27
|
+
};
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
async function main() {
|
|
31
|
+
const transport = new StdioServerTransport();
|
|
32
|
+
await server.connect(transport);
|
|
33
|
+
// stderr only — stdio must stay clean for the MCP protocol.
|
|
34
|
+
console.error("CortexCloud MCP server running on stdio.");
|
|
35
|
+
}
|
|
36
|
+
main().catch((err) => {
|
|
37
|
+
console.error("Fatal:", err);
|
|
38
|
+
process.exit(1);
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,MAAM,MAAM,GAAG,IAAI,SAAS,CAAC;IAC3B,IAAI,EAAE,aAAa;IACnB,OAAO,EAAE,OAAO;CACjB,CAAC,CAAC;AAEH,kFAAkF;AAClF,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;IAC5B,8EAA8E;IAC9E,MAAM,KAAK,GACT,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,KAAK,CAAC;QACxC,CAAC,CAAC,EAAE;QACJ,CAAC,CAAE,IAAI,CAAC,WAA4C,CAAC;IACzD,MAAM,CAAC,IAAI,CACT,IAAI,CAAC,IAAI,EACT,IAAI,CAAC,WAAW,EAChB,KAAK,EACL,KAAK,EAAE,IAAS,EAAE,EAAE;QAClB,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QAC9C,OAAO;YACL,OAAO,EAAE;gBACP;oBACE,IAAI,EAAE,MAAe;oBACrB,IAAI,EACF,OAAO,IAAI,KAAK,QAAQ;wBACtB,CAAC,CAAC,IAAI;wBACN,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;iBACpC;aACF;YACD,OAAO,EAAE,MAAM,IAAI,GAAG;SACvB,CAAC;IACJ,CAAC,CACF,CAAC;AACJ,CAAC;AAED,KAAK,UAAU,IAAI;IACjB,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;IAChC,4DAA4D;IAC5D,OAAO,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;AAC5D,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC;IAC7B,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/tools.d.ts
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const chatTool: {
|
|
3
|
+
name: string;
|
|
4
|
+
description: string;
|
|
5
|
+
inputSchema: {
|
|
6
|
+
model: z.ZodString;
|
|
7
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
8
|
+
role: z.ZodEnum<["system", "user", "assistant"]>;
|
|
9
|
+
content: z.ZodString;
|
|
10
|
+
}, "strip", z.ZodTypeAny, {
|
|
11
|
+
role: "assistant" | "system" | "user";
|
|
12
|
+
content: string;
|
|
13
|
+
}, {
|
|
14
|
+
role: "assistant" | "system" | "user";
|
|
15
|
+
content: string;
|
|
16
|
+
}>, "many">;
|
|
17
|
+
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
18
|
+
stream: z.ZodOptional<z.ZodBoolean>;
|
|
19
|
+
};
|
|
20
|
+
run(args: {
|
|
21
|
+
model: string;
|
|
22
|
+
messages: {
|
|
23
|
+
role: "system" | "user" | "assistant";
|
|
24
|
+
content: string;
|
|
25
|
+
}[];
|
|
26
|
+
max_tokens?: number;
|
|
27
|
+
stream?: boolean;
|
|
28
|
+
}): Promise<{
|
|
29
|
+
status: number;
|
|
30
|
+
body: unknown;
|
|
31
|
+
}>;
|
|
32
|
+
};
|
|
33
|
+
export declare const modelsTool: {
|
|
34
|
+
name: string;
|
|
35
|
+
description: string;
|
|
36
|
+
inputSchema: {};
|
|
37
|
+
run(): Promise<{
|
|
38
|
+
status: number;
|
|
39
|
+
body: any;
|
|
40
|
+
}>;
|
|
41
|
+
};
|
|
42
|
+
export declare const baseBalanceTool: {
|
|
43
|
+
name: string;
|
|
44
|
+
description: string;
|
|
45
|
+
inputSchema: {
|
|
46
|
+
address: z.ZodString;
|
|
47
|
+
};
|
|
48
|
+
run(args: {
|
|
49
|
+
address: string;
|
|
50
|
+
}): Promise<{
|
|
51
|
+
status: number;
|
|
52
|
+
body: unknown;
|
|
53
|
+
}>;
|
|
54
|
+
};
|
|
55
|
+
export declare const baseTokenBalanceTool: {
|
|
56
|
+
name: string;
|
|
57
|
+
description: string;
|
|
58
|
+
inputSchema: {
|
|
59
|
+
address: z.ZodString;
|
|
60
|
+
token: z.ZodString;
|
|
61
|
+
};
|
|
62
|
+
run(args: {
|
|
63
|
+
address: string;
|
|
64
|
+
token: string;
|
|
65
|
+
}): Promise<{
|
|
66
|
+
status: number;
|
|
67
|
+
body: unknown;
|
|
68
|
+
}>;
|
|
69
|
+
};
|
|
70
|
+
export declare const pricesTool: {
|
|
71
|
+
name: string;
|
|
72
|
+
description: string;
|
|
73
|
+
inputSchema: {
|
|
74
|
+
ids: z.ZodOptional<z.ZodString>;
|
|
75
|
+
};
|
|
76
|
+
run(args: {
|
|
77
|
+
ids?: string;
|
|
78
|
+
}): Promise<{
|
|
79
|
+
status: number;
|
|
80
|
+
body: unknown;
|
|
81
|
+
}>;
|
|
82
|
+
};
|
|
83
|
+
export declare const dexSearchTool: {
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
inputSchema: {
|
|
87
|
+
query: z.ZodString;
|
|
88
|
+
};
|
|
89
|
+
run(args: {
|
|
90
|
+
query: string;
|
|
91
|
+
}): Promise<{
|
|
92
|
+
status: number;
|
|
93
|
+
body: unknown;
|
|
94
|
+
}>;
|
|
95
|
+
};
|
|
96
|
+
export declare const allTools: ({
|
|
97
|
+
name: string;
|
|
98
|
+
description: string;
|
|
99
|
+
inputSchema: {
|
|
100
|
+
model: z.ZodString;
|
|
101
|
+
messages: z.ZodArray<z.ZodObject<{
|
|
102
|
+
role: z.ZodEnum<["system", "user", "assistant"]>;
|
|
103
|
+
content: z.ZodString;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
role: "assistant" | "system" | "user";
|
|
106
|
+
content: string;
|
|
107
|
+
}, {
|
|
108
|
+
role: "assistant" | "system" | "user";
|
|
109
|
+
content: string;
|
|
110
|
+
}>, "many">;
|
|
111
|
+
max_tokens: z.ZodOptional<z.ZodNumber>;
|
|
112
|
+
stream: z.ZodOptional<z.ZodBoolean>;
|
|
113
|
+
};
|
|
114
|
+
run(args: {
|
|
115
|
+
model: string;
|
|
116
|
+
messages: {
|
|
117
|
+
role: "system" | "user" | "assistant";
|
|
118
|
+
content: string;
|
|
119
|
+
}[];
|
|
120
|
+
max_tokens?: number;
|
|
121
|
+
stream?: boolean;
|
|
122
|
+
}): Promise<{
|
|
123
|
+
status: number;
|
|
124
|
+
body: unknown;
|
|
125
|
+
}>;
|
|
126
|
+
} | {
|
|
127
|
+
name: string;
|
|
128
|
+
description: string;
|
|
129
|
+
inputSchema: {};
|
|
130
|
+
run(): Promise<{
|
|
131
|
+
status: number;
|
|
132
|
+
body: any;
|
|
133
|
+
}>;
|
|
134
|
+
} | {
|
|
135
|
+
name: string;
|
|
136
|
+
description: string;
|
|
137
|
+
inputSchema: {
|
|
138
|
+
address: z.ZodString;
|
|
139
|
+
};
|
|
140
|
+
run(args: {
|
|
141
|
+
address: string;
|
|
142
|
+
}): Promise<{
|
|
143
|
+
status: number;
|
|
144
|
+
body: unknown;
|
|
145
|
+
}>;
|
|
146
|
+
} | {
|
|
147
|
+
name: string;
|
|
148
|
+
description: string;
|
|
149
|
+
inputSchema: {
|
|
150
|
+
ids: z.ZodOptional<z.ZodString>;
|
|
151
|
+
};
|
|
152
|
+
run(args: {
|
|
153
|
+
ids?: string;
|
|
154
|
+
}): Promise<{
|
|
155
|
+
status: number;
|
|
156
|
+
body: unknown;
|
|
157
|
+
}>;
|
|
158
|
+
} | {
|
|
159
|
+
name: string;
|
|
160
|
+
description: string;
|
|
161
|
+
inputSchema: {
|
|
162
|
+
query: z.ZodString;
|
|
163
|
+
};
|
|
164
|
+
run(args: {
|
|
165
|
+
query: string;
|
|
166
|
+
}): Promise<{
|
|
167
|
+
status: number;
|
|
168
|
+
body: unknown;
|
|
169
|
+
}>;
|
|
170
|
+
})[];
|
package/dist/tools.js
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { getPaidFetch, CORTEXCLOUD_BASE_URL } from "./client.js";
|
|
3
|
+
const BASE = CORTEXCLOUD_BASE_URL;
|
|
4
|
+
async function paidJson(path, init) {
|
|
5
|
+
const paidFetch = getPaidFetch();
|
|
6
|
+
const res = await paidFetch(`${BASE}${path}`, {
|
|
7
|
+
...init,
|
|
8
|
+
headers: {
|
|
9
|
+
"content-type": "application/json",
|
|
10
|
+
...(init?.headers ?? {}),
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
const text = await res.text();
|
|
14
|
+
let body = null;
|
|
15
|
+
try {
|
|
16
|
+
body = text ? JSON.parse(text) : null;
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
body = text;
|
|
20
|
+
}
|
|
21
|
+
return { status: res.status, body };
|
|
22
|
+
}
|
|
23
|
+
export const chatTool = {
|
|
24
|
+
name: "cortexcloud_chat",
|
|
25
|
+
description: "Send an OpenAI-compatible chat completion to CortexCloud. Paid per call in USDC via x402.",
|
|
26
|
+
inputSchema: {
|
|
27
|
+
model: z.string().describe("Model id, e.g. 'groq/llama-3.3-70b-versatile'"),
|
|
28
|
+
messages: z
|
|
29
|
+
.array(z.object({
|
|
30
|
+
role: z.enum(["system", "user", "assistant"]),
|
|
31
|
+
content: z.string(),
|
|
32
|
+
}))
|
|
33
|
+
.describe("Conversation messages"),
|
|
34
|
+
max_tokens: z.number().optional().describe("Max tokens to generate"),
|
|
35
|
+
stream: z.boolean().optional().describe("Stream SSE (returns raw body)"),
|
|
36
|
+
},
|
|
37
|
+
async run(args) {
|
|
38
|
+
return paidJson("/x402/v1/chat/completions", {
|
|
39
|
+
method: "POST",
|
|
40
|
+
body: JSON.stringify({
|
|
41
|
+
model: args.model,
|
|
42
|
+
messages: args.messages,
|
|
43
|
+
max_tokens: args.max_tokens,
|
|
44
|
+
stream: args.stream,
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
export const modelsTool = {
|
|
50
|
+
name: "cortexcloud_models",
|
|
51
|
+
description: "List all available CortexCloud models (free, no payment required).",
|
|
52
|
+
inputSchema: {},
|
|
53
|
+
async run() {
|
|
54
|
+
const res = await fetch(`${BASE}/x402/v1/models`);
|
|
55
|
+
const text = await res.text();
|
|
56
|
+
try {
|
|
57
|
+
return { status: res.status, body: JSON.parse(text) };
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
return { status: res.status, body: text };
|
|
61
|
+
}
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
export const baseBalanceTool = {
|
|
65
|
+
name: "cortexcloud_base_balance",
|
|
66
|
+
description: "Get the native ETH balance of a Base address. Paid per call in USDC via x402.",
|
|
67
|
+
inputSchema: {
|
|
68
|
+
address: z.string().describe("Base address, e.g. 0xabc..."),
|
|
69
|
+
},
|
|
70
|
+
async run(args) {
|
|
71
|
+
return paidJson(`/x402/v1/data/base/balance?address=${encodeURIComponent(args.address)}`);
|
|
72
|
+
},
|
|
73
|
+
};
|
|
74
|
+
export const baseTokenBalanceTool = {
|
|
75
|
+
name: "cortexcloud_base_token_balance",
|
|
76
|
+
description: "Get an ERC-20 token balance for a Base address. Paid per call in USDC via x402.",
|
|
77
|
+
inputSchema: {
|
|
78
|
+
address: z.string().describe("Base address"),
|
|
79
|
+
token: z.string().describe("ERC-20 token contract address"),
|
|
80
|
+
},
|
|
81
|
+
async run(args) {
|
|
82
|
+
return paidJson(`/x402/v1/data/base/token-balance?address=${encodeURIComponent(args.address)}&token=${encodeURIComponent(args.token)}`);
|
|
83
|
+
},
|
|
84
|
+
};
|
|
85
|
+
export const pricesTool = {
|
|
86
|
+
name: "cortexcloud_prices",
|
|
87
|
+
description: "Get current crypto prices from CoinGecko via CortexCloud. Paid per call in USDC via x402.",
|
|
88
|
+
inputSchema: {
|
|
89
|
+
ids: z.string().optional().describe("Comma-separated coin ids, e.g. 'bitcoin,ethereum'"),
|
|
90
|
+
},
|
|
91
|
+
async run(args) {
|
|
92
|
+
const q = args.ids ? `?ids=${encodeURIComponent(args.ids)}` : "";
|
|
93
|
+
return paidJson(`/x402/v1/data/prices${q}`);
|
|
94
|
+
},
|
|
95
|
+
};
|
|
96
|
+
export const dexSearchTool = {
|
|
97
|
+
name: "cortexcloud_dex_search",
|
|
98
|
+
description: "Search DEX token pairs via DEXScreener through CortexCloud. Paid per call in USDC via x402.",
|
|
99
|
+
inputSchema: {
|
|
100
|
+
query: z.string().describe("Token symbol or address to search"),
|
|
101
|
+
},
|
|
102
|
+
async run(args) {
|
|
103
|
+
return paidJson(`/x402/v1/data/dex/search?q=${encodeURIComponent(args.query)}`);
|
|
104
|
+
},
|
|
105
|
+
};
|
|
106
|
+
export const allTools = [
|
|
107
|
+
chatTool,
|
|
108
|
+
modelsTool,
|
|
109
|
+
baseBalanceTool,
|
|
110
|
+
baseTokenBalanceTool,
|
|
111
|
+
pricesTool,
|
|
112
|
+
dexSearchTool,
|
|
113
|
+
];
|
|
114
|
+
//# sourceMappingURL=tools.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tools.js","sourceRoot":"","sources":["../src/tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AAEjE,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAElC,KAAK,UAAU,QAAQ,CAAC,IAAY,EAAE,IAAkB;IACtD,MAAM,SAAS,GAAG,YAAY,EAAE,CAAC;IACjC,MAAM,GAAG,GAAG,MAAM,SAAS,CAAC,GAAG,IAAI,GAAG,IAAI,EAAE,EAAE;QAC5C,GAAG,IAAI;QACP,OAAO,EAAE;YACP,cAAc,EAAE,kBAAkB;YAClC,GAAG,CAAC,IAAI,EAAE,OAAO,IAAI,EAAE,CAAC;SACzB;KACF,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC;IAC9B,IAAI,IAAI,GAAY,IAAI,CAAC;IACzB,IAAI,CAAC;QACH,IAAI,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IACxC,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,GAAG,IAAI,CAAC;IACd,CAAC;IACD,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC;AACtC,CAAC;AAED,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,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AAmD,CAAC;KACzF;IACD,KAAK,CAAC,GAAG,CAAC,IAAsB;QAC9B,MAAM,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,kBAAkB,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,OAAO,QAAQ,CAAC,uBAAuB,CAAC,EAAE,CAAC,CAAC;IAC9C,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,IAAI,EAAE,wBAAwB;IAC9B,WAAW,EACT,6FAA6F;IAC/F,WAAW,EAAE;QACX,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,mCAAmC,CAAC;KAChE;IACD,KAAK,CAAC,GAAG,CAAC,IAAuB;QAC/B,OAAO,QAAQ,CACb,8BAA8B,kBAAkB,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAC/D,CAAC;IACJ,CAAC;CACF,CAAC;AAEF,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,QAAQ;IACR,UAAU;IACV,eAAe;IACf,oBAAoB;IACpB,UAAU;IACV,aAAa;CACd,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cortexcloud.org/mcp",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "MCP server for CortexCloud — agent-native AI & on-chain data gateway. Pay per call in USDC via x402, no API keys.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"cortexcloud-mcp": "dist/index.js"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"files": [
|
|
12
|
+
"dist"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc -p tsconfig.json",
|
|
16
|
+
"start": "node dist/index.js",
|
|
17
|
+
"dev": "tsx src/index.ts"
|
|
18
|
+
},
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=18"
|
|
21
|
+
},
|
|
22
|
+
"dependencies": {
|
|
23
|
+
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
24
|
+
"@x402/evm": "^2.0.0",
|
|
25
|
+
"@x402/fetch": "^2.0.0",
|
|
26
|
+
"viem": "^2.0.0",
|
|
27
|
+
"zod": "^3.23.0"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/node": "^26.1.1",
|
|
31
|
+
"tsx": "^4.0.0",
|
|
32
|
+
"typescript": "^7.0.2"
|
|
33
|
+
},
|
|
34
|
+
"keywords": [
|
|
35
|
+
"mcp",
|
|
36
|
+
"x402",
|
|
37
|
+
"cortexcloud",
|
|
38
|
+
"ai",
|
|
39
|
+
"agents",
|
|
40
|
+
"usdc",
|
|
41
|
+
"base"
|
|
42
|
+
]
|
|
43
|
+
}
|