kaito-mcp-server 0.2.17 → 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.
- package/README.md +45 -35
- package/build/__tests__/proxy.test.d.ts +2 -0
- package/build/__tests__/proxy.test.d.ts.map +1 -0
- package/build/__tests__/proxy.test.js +132 -0
- package/build/__tests__/proxy.test.js.map +1 -0
- package/build/index.js +76 -14
- package/build/index.js.map +1 -1
- package/package.json +2 -3
- package/build/__tests__/reference-search.test.d.ts +0 -2
- package/build/__tests__/reference-search.test.d.ts.map +0 -1
- package/build/__tests__/reference-search.test.js +0 -73
- package/build/__tests__/reference-search.test.js.map +0 -1
- package/build/__tests__/server-consistency.test.d.ts +0 -2
- package/build/__tests__/server-consistency.test.d.ts.map +0 -1
- package/build/__tests__/server-consistency.test.js +0 -221
- package/build/__tests__/server-consistency.test.js.map +0 -1
- package/build/__tests__/smoke.test.d.ts +0 -2
- package/build/__tests__/smoke.test.d.ts.map +0 -1
- package/build/__tests__/smoke.test.js +0 -99
- package/build/__tests__/smoke.test.js.map +0 -1
- package/build/client.d.ts +0 -9
- package/build/client.d.ts.map +0 -1
- package/build/client.js +0 -41
- package/build/client.js.map +0 -1
- package/build/prompts/analyze-token.d.ts +0 -3
- package/build/prompts/analyze-token.d.ts.map +0 -1
- package/build/prompts/analyze-token.js +0 -97
- package/build/prompts/analyze-token.js.map +0 -1
- package/build/prompts/discover-trending.d.ts +0 -3
- package/build/prompts/discover-trending.d.ts.map +0 -1
- package/build/prompts/discover-trending.js +0 -106
- package/build/prompts/discover-trending.js.map +0 -1
- package/build/prompts/market-roundup.d.ts +0 -3
- package/build/prompts/market-roundup.d.ts.map +0 -1
- package/build/prompts/market-roundup.js +0 -77
- package/build/prompts/market-roundup.js.map +0 -1
- package/build/prompts/social-listening.d.ts +0 -3
- package/build/prompts/social-listening.d.ts.map +0 -1
- package/build/prompts/social-listening.js +0 -139
- package/build/prompts/social-listening.js.map +0 -1
- package/build/prompts/watchlist-portfolio.d.ts +0 -3
- package/build/prompts/watchlist-portfolio.d.ts.map +0 -1
- package/build/prompts/watchlist-portfolio.js +0 -117
- package/build/prompts/watchlist-portfolio.js.map +0 -1
- package/build/prompts/workflows.d.ts +0 -3
- package/build/prompts/workflows.d.ts.map +0 -1
- package/build/prompts/workflows.js +0 -13
- package/build/prompts/workflows.js.map +0 -1
- package/build/reference-search.d.ts +0 -73
- package/build/reference-search.d.ts.map +0 -1
- package/build/reference-search.js +0 -113
- package/build/reference-search.js.map +0 -1
- package/build/resources/reference.d.ts +0 -4
- package/build/resources/reference.d.ts.map +0 -1
- package/build/resources/reference.js +0 -33
- package/build/resources/reference.js.map +0 -1
- package/build/server-instructions.d.ts +0 -10
- package/build/server-instructions.d.ts.map +0 -1
- package/build/server-instructions.js +0 -42
- package/build/server-instructions.js.map +0 -1
- package/build/server.d.ts +0 -3
- package/build/server.d.ts.map +0 -1
- package/build/server.js +0 -58
- package/build/server.js.map +0 -1
- package/build/tool-guidance.d.ts +0 -5
- package/build/tool-guidance.d.ts.map +0 -1
- package/build/tool-guidance.js +0 -5
- package/build/tool-guidance.js.map +0 -1
- package/build/tools/advanced-search.d.ts +0 -4
- package/build/tools/advanced-search.d.ts.map +0 -1
- package/build/tools/advanced-search.js +0 -197
- package/build/tools/advanced-search.js.map +0 -1
- package/build/tools/engagement.d.ts +0 -4
- package/build/tools/engagement.d.ts.map +0 -1
- package/build/tools/engagement.js +0 -42
- package/build/tools/engagement.js.map +0 -1
- package/build/tools/events.d.ts +0 -4
- package/build/tools/events.d.ts.map +0 -1
- package/build/tools/events.js +0 -77
- package/build/tools/events.js.map +0 -1
- package/build/tools/get-twitter-user.d.ts +0 -4
- package/build/tools/get-twitter-user.d.ts.map +0 -1
- package/build/tools/get-twitter-user.js +0 -24
- package/build/tools/get-twitter-user.js.map +0 -1
- package/build/tools/kol-token-mindshare.d.ts +0 -4
- package/build/tools/kol-token-mindshare.d.ts.map +0 -1
- package/build/tools/kol-token-mindshare.js +0 -38
- package/build/tools/kol-token-mindshare.js.map +0 -1
- package/build/tools/market-smart-following.d.ts +0 -4
- package/build/tools/market-smart-following.d.ts.map +0 -1
- package/build/tools/market-smart-following.js +0 -75
- package/build/tools/market-smart-following.js.map +0 -1
- package/build/tools/mentions.d.ts +0 -4
- package/build/tools/mentions.d.ts.map +0 -1
- package/build/tools/mentions.js +0 -70
- package/build/tools/mentions.js.map +0 -1
- package/build/tools/mindshare-arena.d.ts +0 -4
- package/build/tools/mindshare-arena.d.ts.map +0 -1
- package/build/tools/mindshare-arena.js +0 -59
- package/build/tools/mindshare-arena.js.map +0 -1
- package/build/tools/mindshare-delta.d.ts +0 -4
- package/build/tools/mindshare-delta.d.ts.map +0 -1
- package/build/tools/mindshare-delta.js +0 -39
- package/build/tools/mindshare-delta.js.map +0 -1
- package/build/tools/mindshare.d.ts +0 -4
- package/build/tools/mindshare.d.ts.map +0 -1
- package/build/tools/mindshare.js +0 -46
- package/build/tools/mindshare.js.map +0 -1
- package/build/tools/narrative-mindshare.d.ts +0 -4
- package/build/tools/narrative-mindshare.d.ts.map +0 -1
- package/build/tools/narrative-mindshare.js +0 -43
- package/build/tools/narrative-mindshare.js.map +0 -1
- package/build/tools/reference-lookup.d.ts +0 -4
- package/build/tools/reference-lookup.d.ts.map +0 -1
- package/build/tools/reference-lookup.js +0 -77
- package/build/tools/reference-lookup.js.map +0 -1
- package/build/tools/sentiment.d.ts +0 -4
- package/build/tools/sentiment.d.ts.map +0 -1
- package/build/tools/sentiment.js +0 -65
- package/build/tools/sentiment.js.map +0 -1
- package/build/tools/smart-followers.d.ts +0 -4
- package/build/tools/smart-followers.d.ts.map +0 -1
- package/build/tools/smart-followers.js +0 -45
- package/build/tools/smart-followers.js.map +0 -1
- package/build/tools/smart-following.d.ts +0 -4
- package/build/tools/smart-following.d.ts.map +0 -1
- package/build/tools/smart-following.js +0 -34
- package/build/tools/smart-following.js.map +0 -1
- package/build/tools/tweet-engagement-info.d.ts +0 -4
- package/build/tools/tweet-engagement-info.d.ts.map +0 -1
- package/build/tools/tweet-engagement-info.js +0 -21
- package/build/tools/tweet-engagement-info.js.map +0 -1
- package/build/tools/twitter-account-type.d.ts +0 -4
- package/build/tools/twitter-account-type.d.ts.map +0 -1
- package/build/tools/twitter-account-type.js +0 -35
- package/build/tools/twitter-account-type.js.map +0 -1
- package/build/tools/twitter-official-account.d.ts +0 -4
- package/build/tools/twitter-official-account.d.ts.map +0 -1
- package/build/tools/twitter-official-account.js +0 -28
- package/build/tools/twitter-official-account.js.map +0 -1
package/README.md
CHANGED
|
@@ -4,15 +4,35 @@
|
|
|
4
4
|
[](https://github.com/MetaSearch-IO/kaito-mcp-server/actions/workflows/ci.yml)
|
|
5
5
|
[](./LICENSE)
|
|
6
6
|
|
|
7
|
-
MCP
|
|
7
|
+
MCP proxy for [Kaito AI](https://kaito.ai) crypto market intelligence API. Provides crypto market intelligence tools, reference resources, and prompt templates for sentiment analysis, mindshare tracking, social intelligence, and more.
|
|
8
8
|
|
|
9
9
|
## Getting Started
|
|
10
10
|
|
|
11
11
|
All configurations require a [Kaito API key](https://kaito.ai). Set it as the `KAITO_API_KEY` environment variable.
|
|
12
12
|
|
|
13
|
-
###
|
|
13
|
+
### Option A: Direct HTTP (recommended)
|
|
14
14
|
|
|
15
|
-
|
|
15
|
+
For MCP clients that support remote HTTP servers (Claude.ai, Claude Desktop, Claude Code, etc.):
|
|
16
|
+
|
|
17
|
+
```json
|
|
18
|
+
{
|
|
19
|
+
"mcpServers": {
|
|
20
|
+
"kaito": {
|
|
21
|
+
"type": "http",
|
|
22
|
+
"url": "https://bff.kaito.ai/api/mcp",
|
|
23
|
+
"headers": {
|
|
24
|
+
"Authorization": "Bearer YOUR_API_KEY"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
No local installation required.
|
|
32
|
+
|
|
33
|
+
### Option B: npx (stdio proxy)
|
|
34
|
+
|
|
35
|
+
For MCP clients that only support local stdio servers:
|
|
16
36
|
|
|
17
37
|
```json
|
|
18
38
|
{
|
|
@@ -28,39 +48,34 @@ The following config works across most MCP clients (Claude Desktop, Cursor, Wind
|
|
|
28
48
|
}
|
|
29
49
|
```
|
|
30
50
|
|
|
31
|
-
This
|
|
32
|
-
|
|
33
|
-
### Claude.ai (web)
|
|
51
|
+
This runs a thin local proxy that forwards all requests to the Kaito API over HTTP.
|
|
34
52
|
|
|
35
|
-
|
|
53
|
+
### Client-specific setup
|
|
36
54
|
|
|
37
|
-
|
|
55
|
+
#### Claude.ai (web)
|
|
38
56
|
|
|
39
|
-
|
|
40
|
-
- or use Claude Desktop / another local MCP client instead
|
|
57
|
+
Use [Option A](#option-a-direct-http-recommended) — add it as a remote MCP connector in Claude settings.
|
|
41
58
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
### Claude Desktop (one-click)
|
|
59
|
+
#### Claude Desktop (one-click)
|
|
45
60
|
|
|
46
61
|
Download the latest [kaito-mcp-server.mcpb](https://github.com/MetaSearch-IO/kaito-mcp-server/releases/latest/download/kaito-mcp-server.mcpb) and open it — Claude Desktop will handle the rest.
|
|
47
62
|
|
|
48
|
-
> **Note:** MCPB installs a pinned version and does not auto-update. To get the latest version, re-download the `.mcpb` from the latest release — or switch to the [standard configuration](#
|
|
63
|
+
> **Note:** MCPB installs a pinned version and does not auto-update. To get the latest version, re-download the `.mcpb` from the latest release — or switch to the [standard configuration](#option-b-npx-stdio-proxy) which uses `@latest` to always pull the newest version.
|
|
49
64
|
|
|
50
|
-
|
|
65
|
+
#### Claude Desktop (manual)
|
|
51
66
|
|
|
52
|
-
Add
|
|
67
|
+
Add [Option A](#option-a-direct-http-recommended) or [Option B](#option-b-npx-stdio-proxy) to your `claude_desktop_config.json`:
|
|
53
68
|
|
|
54
69
|
- macOS: `~/Library/Application Support/Claude/claude_desktop_config.json`
|
|
55
70
|
- Windows: `%APPDATA%\Claude\claude_desktop_config.json`
|
|
56
71
|
|
|
57
|
-
|
|
72
|
+
#### Claude Code
|
|
58
73
|
|
|
59
74
|
```bash
|
|
60
75
|
claude mcp add kaito -e KAITO_API_KEY=your-api-key -- npx -y kaito-mcp-server@latest
|
|
61
76
|
```
|
|
62
77
|
|
|
63
|
-
|
|
78
|
+
#### VS Code
|
|
64
79
|
|
|
65
80
|
Add the following to your User Settings (JSON) or `.vscode/settings.json`:
|
|
66
81
|
|
|
@@ -80,11 +95,11 @@ Add the following to your User Settings (JSON) or `.vscode/settings.json`:
|
|
|
80
95
|
}
|
|
81
96
|
```
|
|
82
97
|
|
|
83
|
-
|
|
98
|
+
#### Cursor
|
|
84
99
|
|
|
85
|
-
Go to **Cursor Settings → MCP → Add new MCP Server**, and paste
|
|
100
|
+
Go to **Cursor Settings → MCP → Add new MCP Server**, and paste [Option B](#option-b-npx-stdio-proxy).
|
|
86
101
|
|
|
87
|
-
|
|
102
|
+
#### Other MCP Clients
|
|
88
103
|
|
|
89
104
|
For any MCP-compatible client, the server can be started with:
|
|
90
105
|
|
|
@@ -94,6 +109,13 @@ KAITO_API_KEY=your-api-key npx -y kaito-mcp-server@latest
|
|
|
94
109
|
|
|
95
110
|
The transport is **stdio**. Use this command in your client's MCP server configuration.
|
|
96
111
|
|
|
112
|
+
### Environment Variables
|
|
113
|
+
|
|
114
|
+
| Variable | Required | Default | Description |
|
|
115
|
+
|---|---|---|---|
|
|
116
|
+
| `KAITO_API_KEY` | Yes | — | Your Kaito API key |
|
|
117
|
+
| `KAITO_MCP_URL` | No | `https://bff.kaito.ai/api/mcp` | Override the remote MCP endpoint (e.g., for staging) |
|
|
118
|
+
|
|
97
119
|
## Tools
|
|
98
120
|
|
|
99
121
|
### Reference
|
|
@@ -103,8 +125,6 @@ The transport is **stdio**. Use this command in your client's MCP server configu
|
|
|
103
125
|
| `kaito_tokens` | List or search supported token values, symbols, and project names |
|
|
104
126
|
| `kaito_narratives` | List or search supported narrative IDs and display names |
|
|
105
127
|
|
|
106
|
-
These two tools exist specifically so clients that expose tools but not `resources/read` can still resolve valid token and narrative values before calling other Kaito tools.
|
|
107
|
-
|
|
108
128
|
### Search & Discovery
|
|
109
129
|
|
|
110
130
|
| Tool | Description |
|
|
@@ -154,14 +174,6 @@ These two tools exist specifically so clients that expose tools but not `resourc
|
|
|
154
174
|
| Tokens | `kaito://tokens` | All supported token values, symbols, and project names (no auth required) |
|
|
155
175
|
| Narratives | `kaito://narratives` | All supported narrative IDs (no auth required) |
|
|
156
176
|
|
|
157
|
-
Some MCP clients expose resources directly and some only expose tools. `kaito_tokens` and `kaito_narratives` provide the same reference data through normal tool calls, so token and narrative resolution still works even when `resources/read` is unavailable.
|
|
158
|
-
|
|
159
|
-
Practical example:
|
|
160
|
-
|
|
161
|
-
- if the user asks about "Hyperliquid", call `kaito_tokens` with `query="Hyperliquid"` first
|
|
162
|
-
- use the returned `token` value such as `HYPERLIQUID` in downstream tools
|
|
163
|
-
- keep `symbol` values such as `HYPE` as reference metadata, not as the canonical tool parameter unless that is also the returned token value
|
|
164
|
-
|
|
165
177
|
## Prompt Templates
|
|
166
178
|
|
|
167
179
|
| Prompt | Description |
|
|
@@ -183,15 +195,13 @@ npm run build
|
|
|
183
195
|
|
|
184
196
|
### Testing
|
|
185
197
|
|
|
186
|
-
|
|
198
|
+
Integration tests hit the real Kaito API via the proxy:
|
|
187
199
|
|
|
188
200
|
```bash
|
|
189
201
|
KAITO_API_KEY=your-key npm test
|
|
190
|
-
KAITO_API_KEY=your-key npm test -- -t "Mindshare & Sentiment"
|
|
191
|
-
KAITO_API_KEY=your-key npm test -- -t "KOL Analytics"
|
|
192
202
|
```
|
|
193
203
|
|
|
194
|
-
|
|
204
|
+
Tests are skipped if `KAITO_API_KEY` is not set.
|
|
195
205
|
|
|
196
206
|
### MCP Inspector
|
|
197
207
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/proxy.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
import { spawn } from "node:child_process";
|
|
2
|
+
import { resolve } from "node:path";
|
|
3
|
+
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
|
4
|
+
const ENTRY = resolve(import.meta.dirname, "../../build/index.js");
|
|
5
|
+
const API_KEY = process.env.KAITO_API_KEY;
|
|
6
|
+
const MCP_URL = process.env.KAITO_MCP_URL ?? "https://bff.kaito.ai/api/mcp";
|
|
7
|
+
function shouldSkip() {
|
|
8
|
+
return !API_KEY;
|
|
9
|
+
}
|
|
10
|
+
/** Send a JSON-RPC request over stdin and read the JSON-RPC response from stdout. */
|
|
11
|
+
function sendRequest(proc, request) {
|
|
12
|
+
return new Promise((resolve, reject) => {
|
|
13
|
+
const timeout = setTimeout(() => reject(new Error("Timed out waiting for response")), 30_000);
|
|
14
|
+
let buffer = "";
|
|
15
|
+
const onData = (chunk) => {
|
|
16
|
+
buffer += chunk.toString();
|
|
17
|
+
// JSON-RPC messages are newline-delimited
|
|
18
|
+
const lines = buffer.split("\n");
|
|
19
|
+
for (const line of lines) {
|
|
20
|
+
if (!line.trim())
|
|
21
|
+
continue;
|
|
22
|
+
try {
|
|
23
|
+
const parsed = JSON.parse(line);
|
|
24
|
+
if (parsed.id === request.id) {
|
|
25
|
+
clearTimeout(timeout);
|
|
26
|
+
proc.stdout.off("data", onData);
|
|
27
|
+
resolve(parsed);
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
// incomplete JSON, keep buffering
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
// Keep the last incomplete line in the buffer
|
|
36
|
+
buffer = lines[lines.length - 1];
|
|
37
|
+
};
|
|
38
|
+
proc.stdout.on("data", onData);
|
|
39
|
+
proc.stdin.write(JSON.stringify(request) + "\n");
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
describe.skipIf(shouldSkip())("proxy integration", () => {
|
|
43
|
+
let proc;
|
|
44
|
+
beforeEach(() => {
|
|
45
|
+
proc = spawn("node", [ENTRY], {
|
|
46
|
+
env: {
|
|
47
|
+
...process.env,
|
|
48
|
+
KAITO_API_KEY: API_KEY,
|
|
49
|
+
KAITO_MCP_URL: MCP_URL,
|
|
50
|
+
},
|
|
51
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
afterEach(() => {
|
|
55
|
+
proc?.kill("SIGTERM");
|
|
56
|
+
});
|
|
57
|
+
it("initializes and lists tools", async () => {
|
|
58
|
+
// Initialize
|
|
59
|
+
const initRes = await sendRequest(proc, {
|
|
60
|
+
jsonrpc: "2.0",
|
|
61
|
+
id: 1,
|
|
62
|
+
method: "initialize",
|
|
63
|
+
params: {
|
|
64
|
+
protocolVersion: "2025-03-26",
|
|
65
|
+
capabilities: {},
|
|
66
|
+
clientInfo: { name: "test", version: "0.1.0" },
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
expect(initRes.result).toBeDefined();
|
|
70
|
+
expect(initRes.result.serverInfo?.name).toBe("kaito");
|
|
71
|
+
// Send initialized notification (required before requests)
|
|
72
|
+
proc.stdin.write(JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }) +
|
|
73
|
+
"\n");
|
|
74
|
+
// Wait briefly for notification to be processed
|
|
75
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
76
|
+
// List tools
|
|
77
|
+
const toolsRes = await sendRequest(proc, {
|
|
78
|
+
jsonrpc: "2.0",
|
|
79
|
+
id: 2,
|
|
80
|
+
method: "tools/list",
|
|
81
|
+
});
|
|
82
|
+
expect(toolsRes.result).toBeDefined();
|
|
83
|
+
const tools = toolsRes.result.tools;
|
|
84
|
+
expect(Array.isArray(tools)).toBe(true);
|
|
85
|
+
expect(tools.length).toBeGreaterThan(0);
|
|
86
|
+
// Verify known tools exist
|
|
87
|
+
const toolNames = tools.map((t) => t.name);
|
|
88
|
+
expect(toolNames).toContain("kaito_entities");
|
|
89
|
+
expect(toolNames).toContain("kaito_advanced_search");
|
|
90
|
+
});
|
|
91
|
+
it("forwards tool calls to remote", async () => {
|
|
92
|
+
// Initialize
|
|
93
|
+
await sendRequest(proc, {
|
|
94
|
+
jsonrpc: "2.0",
|
|
95
|
+
id: 1,
|
|
96
|
+
method: "initialize",
|
|
97
|
+
params: {
|
|
98
|
+
protocolVersion: "2025-03-26",
|
|
99
|
+
capabilities: {},
|
|
100
|
+
clientInfo: { name: "test", version: "0.1.0" },
|
|
101
|
+
},
|
|
102
|
+
});
|
|
103
|
+
proc.stdin.write(JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" }) +
|
|
104
|
+
"\n");
|
|
105
|
+
await new Promise((r) => setTimeout(r, 200));
|
|
106
|
+
// Call kaito_entities (reference lookup)
|
|
107
|
+
const entitiesRes = await sendRequest(proc, {
|
|
108
|
+
jsonrpc: "2.0",
|
|
109
|
+
id: 2,
|
|
110
|
+
method: "tools/call",
|
|
111
|
+
params: {
|
|
112
|
+
name: "kaito_entities",
|
|
113
|
+
arguments: {},
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
expect(entitiesRes.result).toBeDefined();
|
|
117
|
+
expect(entitiesRes.result.content).toBeDefined();
|
|
118
|
+
// Call kaito_sentiment_entity (requires auth, exercises full proxy path)
|
|
119
|
+
const sentimentRes = await sendRequest(proc, {
|
|
120
|
+
jsonrpc: "2.0",
|
|
121
|
+
id: 3,
|
|
122
|
+
method: "tools/call",
|
|
123
|
+
params: {
|
|
124
|
+
name: "kaito_sentiment_entity",
|
|
125
|
+
arguments: { token: "BTC" },
|
|
126
|
+
},
|
|
127
|
+
});
|
|
128
|
+
expect(sentimentRes.result).toBeDefined();
|
|
129
|
+
expect(sentimentRes.result.content).toBeDefined();
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
//# sourceMappingURL=proxy.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proxy.test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AC3C,OAAO,EAAE,KAAK;YACd,EAAE,EAAE,CAAC;YACL,MAAM,EAAE,YAAY;YACpB,MAAM,EAAE;gBACN,IAAI,EAAE,wBAAwB;gBAC9B,SAAS,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE;aAC5B;SACF,CAAC,CAAC;QACH,MAAM,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QAC1C,MAAM,CAAE,YAAY,CAAC,MAAc,CAAC,OAAO,CAAC,CAAC,WAAW,EAAE,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/build/index.js
CHANGED
|
@@ -1,26 +1,88 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { Client } from "@modelcontextprotocol/sdk/client/index.js";
|
|
3
|
+
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
|
|
4
|
+
import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
2
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
6
|
+
import { CallToolRequestSchema, GetPromptRequestSchema, ListPromptsRequestSchema, ListResourcesRequestSchema, ListResourceTemplatesRequestSchema, ListToolsRequestSchema, ReadResourceRequestSchema, } from "@modelcontextprotocol/sdk/types.js";
|
|
7
|
+
import { CURRENT_VERSION, SERVER_NAME } from "./package-metadata.js";
|
|
8
|
+
const DEFAULT_MCP_URL = "https://bff.kaito.ai/api/mcp";
|
|
9
|
+
function checkForUpdates() {
|
|
10
|
+
fetch("https://registry.npmjs.org/kaito-mcp-server/latest")
|
|
11
|
+
.then((res) => {
|
|
8
12
|
if (!res.ok)
|
|
9
13
|
return;
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
14
|
+
return res.json();
|
|
15
|
+
})
|
|
16
|
+
.then((data) => {
|
|
17
|
+
if (data?.version && data.version !== CURRENT_VERSION) {
|
|
18
|
+
console.error(`\n kaito-mcp-server update available: ${CURRENT_VERSION} → ${data.version}\n Run: npx kaito-mcp-server@latest\n`);
|
|
13
19
|
}
|
|
14
|
-
}
|
|
15
|
-
|
|
20
|
+
})
|
|
21
|
+
.catch(() => {
|
|
16
22
|
// silently ignore — network issues should never block the server
|
|
17
|
-
}
|
|
23
|
+
});
|
|
18
24
|
}
|
|
19
25
|
async function main() {
|
|
20
|
-
|
|
21
|
-
const
|
|
26
|
+
// 1. Validate env
|
|
27
|
+
const apiKey = process.env.KAITO_API_KEY;
|
|
28
|
+
if (!apiKey) {
|
|
29
|
+
console.error("Error: KAITO_API_KEY environment variable is required.\n" +
|
|
30
|
+
"Get your API key at https://kaito.ai and set it in your MCP config.");
|
|
31
|
+
process.exit(1);
|
|
32
|
+
}
|
|
33
|
+
const mcpUrl = process.env.KAITO_MCP_URL ?? DEFAULT_MCP_URL;
|
|
34
|
+
// 2. Connect to remote MCP server
|
|
35
|
+
const remoteTransport = new StreamableHTTPClientTransport(new URL(mcpUrl), {
|
|
36
|
+
requestInit: {
|
|
37
|
+
headers: {
|
|
38
|
+
Authorization: `Bearer ${apiKey}`,
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
});
|
|
42
|
+
const remoteClient = new Client({ name: `${SERVER_NAME}-proxy`, version: CURRENT_VERSION }, { capabilities: {} });
|
|
43
|
+
try {
|
|
44
|
+
await remoteClient.connect(remoteTransport, { timeout: 30_000 });
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
console.error(`Failed to connect to Kaito MCP server at ${mcpUrl}: ${err instanceof Error ? err.message : err}`);
|
|
48
|
+
process.exit(1);
|
|
49
|
+
}
|
|
50
|
+
// 3. Create local server with forwarding handlers
|
|
51
|
+
const localServer = new Server({ name: SERVER_NAME, version: CURRENT_VERSION }, {
|
|
52
|
+
capabilities: {
|
|
53
|
+
tools: {},
|
|
54
|
+
resources: {},
|
|
55
|
+
prompts: {},
|
|
56
|
+
},
|
|
57
|
+
});
|
|
58
|
+
// Forward tools
|
|
59
|
+
localServer.setRequestHandler(ListToolsRequestSchema, (req) => remoteClient.listTools(req.params));
|
|
60
|
+
localServer.setRequestHandler(CallToolRequestSchema, (req) => remoteClient.callTool(req.params));
|
|
61
|
+
// Forward resources
|
|
62
|
+
localServer.setRequestHandler(ListResourcesRequestSchema, (req) => remoteClient.listResources(req.params));
|
|
63
|
+
localServer.setRequestHandler(ReadResourceRequestSchema, (req) => remoteClient.readResource(req.params));
|
|
64
|
+
localServer.setRequestHandler(ListResourceTemplatesRequestSchema, (req) => remoteClient.listResourceTemplates(req.params));
|
|
65
|
+
// Forward prompts
|
|
66
|
+
localServer.setRequestHandler(ListPromptsRequestSchema, (req) => remoteClient.listPrompts(req.params));
|
|
67
|
+
localServer.setRequestHandler(GetPromptRequestSchema, (req) => remoteClient.getPrompt(req.params));
|
|
68
|
+
// 4. Serve locally via stdio
|
|
69
|
+
const stdioTransport = new StdioServerTransport();
|
|
70
|
+
await localServer.connect(stdioTransport);
|
|
71
|
+
// 5. Graceful shutdown
|
|
72
|
+
const cleanup = async () => {
|
|
73
|
+
try {
|
|
74
|
+
await localServer.close();
|
|
75
|
+
await remoteClient.close();
|
|
76
|
+
}
|
|
77
|
+
catch {
|
|
78
|
+
// best-effort cleanup
|
|
79
|
+
}
|
|
80
|
+
process.exit(0);
|
|
81
|
+
};
|
|
82
|
+
process.on("SIGINT", cleanup);
|
|
83
|
+
process.on("SIGTERM", cleanup);
|
|
84
|
+
// 6. Background update check
|
|
22
85
|
checkForUpdates();
|
|
23
|
-
await server.connect(transport);
|
|
24
86
|
}
|
|
25
87
|
main().catch((error) => {
|
|
26
88
|
console.error("Fatal error:", error);
|
package/build/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,
|
|
1
|
+
{"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OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAE/B,6BAA6B;IAC7B,eAAe,EAAE,CAAC;AACpB,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,OAAO,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kaito-mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "MCP server for Kaito AI crypto market intelligence API",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -19,8 +19,7 @@
|
|
|
19
19
|
"postversion": "node scripts/sync-manifest-version.js && git add manifest.json && git commit --amend --no-edit && git push"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@modelcontextprotocol/sdk": "^1.27.0"
|
|
23
|
-
"zod": "^3.23.0"
|
|
22
|
+
"@modelcontextprotocol/sdk": "^1.27.0"
|
|
24
23
|
},
|
|
25
24
|
"devDependencies": {
|
|
26
25
|
"@types/node": "^22",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reference-search.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/reference-search.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { describe, expect, it } from "vitest";
|
|
2
|
-
import { lookupNarratives, lookupTokens } from "../reference-search.js";
|
|
3
|
-
describe("lookupTokens", () => {
|
|
4
|
-
const tokens = [
|
|
5
|
-
{
|
|
6
|
-
token: "BTC",
|
|
7
|
-
symbol: "BTC",
|
|
8
|
-
fullname: "Bitcoin",
|
|
9
|
-
coingecko_id: "bitcoin",
|
|
10
|
-
},
|
|
11
|
-
{
|
|
12
|
-
token: "HYPERLIQUID",
|
|
13
|
-
symbol: "HYPE",
|
|
14
|
-
fullname: "Hyperliquid",
|
|
15
|
-
coingecko_id: "hyperliquid",
|
|
16
|
-
},
|
|
17
|
-
{
|
|
18
|
-
token: "ETH",
|
|
19
|
-
symbol: "ETH",
|
|
20
|
-
fullname: "Ethereum",
|
|
21
|
-
coingecko_id: "ethereum",
|
|
22
|
-
},
|
|
23
|
-
];
|
|
24
|
-
it("matches project names to canonical token values", () => {
|
|
25
|
-
const result = lookupTokens(tokens, "hyperliquid");
|
|
26
|
-
expect(result.matches[0]?.token).toBe("HYPERLIQUID");
|
|
27
|
-
expect(result.matches[0]?.symbol).toBe("HYPE");
|
|
28
|
-
});
|
|
29
|
-
it("matches symbols directly", () => {
|
|
30
|
-
const result = lookupTokens(tokens, "hype");
|
|
31
|
-
expect(result.matches[0]?.token).toBe("HYPERLIQUID");
|
|
32
|
-
});
|
|
33
|
-
it("returns 50 rows by default when browsing without a query", () => {
|
|
34
|
-
const manyTokens = Array.from({ length: 60 }, (_, index) => ({
|
|
35
|
-
token: `TOKEN${index}`,
|
|
36
|
-
symbol: `T${index}`,
|
|
37
|
-
fullname: `Token ${index}`,
|
|
38
|
-
}));
|
|
39
|
-
const result = lookupTokens(manyTokens);
|
|
40
|
-
expect(result.returned).toBe(50);
|
|
41
|
-
expect(result.matches).toHaveLength(50);
|
|
42
|
-
expect(result.browse_note).toContain("first 50 tokens");
|
|
43
|
-
});
|
|
44
|
-
it("caps explicit limits at 100", () => {
|
|
45
|
-
const manyTokens = Array.from({ length: 120 }, (_, index) => ({
|
|
46
|
-
token: `TOKEN${index}`,
|
|
47
|
-
symbol: `T${index}`,
|
|
48
|
-
fullname: `Token ${index}`,
|
|
49
|
-
}));
|
|
50
|
-
const result = lookupTokens(manyTokens, undefined, 999);
|
|
51
|
-
expect(result.returned).toBe(100);
|
|
52
|
-
expect(result.matches).toHaveLength(100);
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
describe("lookupNarratives", () => {
|
|
56
|
-
const narratives = [
|
|
57
|
-
{
|
|
58
|
-
narrative: "AI",
|
|
59
|
-
fullname: "Artificial Intelligence",
|
|
60
|
-
description: "AI-related crypto projects.",
|
|
61
|
-
},
|
|
62
|
-
{
|
|
63
|
-
narrative: "L2",
|
|
64
|
-
fullname: "Layer 2",
|
|
65
|
-
description: "Rollups and scaling networks.",
|
|
66
|
-
},
|
|
67
|
-
];
|
|
68
|
-
it("matches narrative display names", () => {
|
|
69
|
-
const result = lookupNarratives(narratives, "layer 2");
|
|
70
|
-
expect(result.matches[0]?.narrative).toBe("L2");
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
//# sourceMappingURL=reference-search.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"reference-search.test.js","sourceRoot":"","sources":["../../src/__tests__/reference-search.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAExE,QAAQ,CAAC,cAAc,EAAE,GAAG,EAAE;IAC5B,MAAM,MAAM,GAAG;QACb;YACE,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,SAAS;YACnB,YAAY,EAAE,SAAS;SACxB;QACD;YACE,KAAK,EAAE,aAAa;YACpB,MAAM,EAAE,MAAM;YACd,QAAQ,EAAE,aAAa;YACvB,YAAY,EAAE,aAAa;SAC5B;QACD;YACE,KAAK,EAAE,KAAK;YACZ,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,UAAU;YACpB,YAAY,EAAE,UAAU;SACzB;KACF,CAAC;IAEF,EAAE,CAAC,iDAAiD,EAAE,GAAG,EAAE;QACzD,MA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