@crush-protocol/mcp-client 0.1.4 → 0.1.6

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
@@ -106,10 +106,10 @@ Add to `~/.cursor/mcp.json`:
106
106
 
107
107
  ## Environment Variables
108
108
 
109
- | Variable | Description |
110
- | ---------------------- | ----------------------------------------------------- |
111
- | `CRUSH_MCP_SERVER_URL` | MCP server URL (default: `http://localhost:8080/mcp`) |
112
- | `CRUSH_MCP_TOKEN` | MCP auth token (`mcp_xxx`) |
109
+ | Variable | Description |
110
+ | ---------------------- | -------------------------------------------------------------------- |
111
+ | `CRUSH_MCP_SERVER_URL` | MCP server URL (default: `https://crush-mcp-ats.dev.xexlab.com/mcp`) |
112
+ | `CRUSH_MCP_TOKEN` | MCP auth token (`mcp_xxx`) |
113
113
 
114
114
  ---
115
115
 
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,50 @@
1
+ import { describe, it, expect, beforeAll, afterAll } from "vitest";
2
+ import { RemoteMcpClient } from "../mcp/remoteClient.js";
3
+ import { BacktestClient } from "../backtest/backtestClient.js";
4
+ /**
5
+ * E2E 测试:验证 MCP client 能成功连接服务端并调用工具。
6
+ *
7
+ * 前置条件(通过环境变量或 .env.e2e 配置):
8
+ * CRUSH_MCP_SERVER_URL — 指向运行中的 MCP server(默认 http://localhost:3333/mcp)
9
+ * CRUSH_MCP_TOKEN — 有效的 mcp_xxx token
10
+ */
11
+ const serverUrl = process.env.CRUSH_MCP_SERVER_URL ?? "http://localhost:3333/mcp";
12
+ const token = process.env.CRUSH_MCP_TOKEN ?? "";
13
+ // 没有 token 时跳过所有 e2e 测试
14
+ const describeE2E = token ? describe : describe.skip;
15
+ describeE2E("MCP Client E2E", () => {
16
+ let mcp;
17
+ let backtest;
18
+ beforeAll(async () => {
19
+ mcp = new RemoteMcpClient({ serverUrl, token });
20
+ await mcp.connect();
21
+ backtest = new BacktestClient(mcp);
22
+ });
23
+ afterAll(async () => {
24
+ await mcp.close();
25
+ });
26
+ it("ping — 服务端可达", async () => {
27
+ const result = await mcp.ping();
28
+ expect(result).toBeDefined();
29
+ });
30
+ it("listTools — 返回至少一个工具", async () => {
31
+ const { tools } = await mcp.listTools();
32
+ expect(tools.length).toBeGreaterThan(0);
33
+ });
34
+ it("backtest:schema — 返回支持的配置 schema", async () => {
35
+ const schema = await backtest.getConfigSchema();
36
+ expect(schema).toHaveProperty("platforms");
37
+ expect(schema).toHaveProperty("timeframes");
38
+ expect(Array.isArray(schema.platforms)).toBe(true);
39
+ });
40
+ it("backtest:tokens — 返回可用交易对列表", async () => {
41
+ const result = await backtest.getAvailableTokens();
42
+ expect(result).toHaveProperty("tokens");
43
+ expect(Array.isArray(result.tokens)).toBe(true);
44
+ });
45
+ it("backtest:list — 返回当前用户的回测列表", async () => {
46
+ const result = await backtest.list({ limit: 5 });
47
+ expect(result).toHaveProperty("backtests");
48
+ expect(typeof result.total).toBe("number");
49
+ });
50
+ });
package/dist/cli.js CHANGED
@@ -32,7 +32,7 @@ const requireString = (value, message) => {
32
32
  const createRemoteClient = (flags) => {
33
33
  const serverUrl = typeof flags.url === "string"
34
34
  ? flags.url
35
- : (process.env.CRUSH_MCP_SERVER_URL ?? "http://localhost:8080/mcp");
35
+ : (process.env.CRUSH_MCP_SERVER_URL ?? "https://crush-mcp-ats.dev.xexlab.com/mcp");
36
36
  const token = typeof flags.token === "string"
37
37
  ? flags.token
38
38
  : requireString(process.env.CRUSH_MCP_TOKEN, "Missing token. Use --token or CRUSH_MCP_TOKEN");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crush-protocol/mcp-client",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Crush MCP npm client package (remote Streamable HTTP + optional ClickHouse direct)",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -18,22 +18,26 @@
18
18
  "default": "./dist/index.js"
19
19
  }
20
20
  },
21
+ "scripts": {
22
+ "build": "tsc -p tsconfig.json",
23
+ "dev": "tsx src/cli.ts",
24
+ "test:e2e": "dotenv -e .env.e2e vitest run src/__tests__/e2e.test.ts",
25
+ "prepublishOnly": "pnpm run build"
26
+ },
21
27
  "dependencies": {
28
+ "@crush-protocol/mcp-contracts": "workspace:*",
22
29
  "@modelcontextprotocol/sdk": "^1.26.0",
23
30
  "dotenv": "^17.2.1",
24
- "zod": "^3.25.76",
25
- "@crush-protocol/mcp-contracts": "0.1.0"
31
+ "zod": "^3.25.76"
26
32
  },
27
33
  "devDependencies": {
28
34
  "@types/node": "^24.3.0",
35
+ "dotenv-cli": "^8.0.0",
29
36
  "tsx": "^4.20.4",
30
- "typescript": "^5.9.2"
37
+ "typescript": "^5.9.2",
38
+ "vitest": "^3.2.4"
31
39
  },
32
40
  "engines": {
33
41
  "node": ">=20"
34
- },
35
- "scripts": {
36
- "build": "tsc -p tsconfig.json",
37
- "dev": "tsx src/cli.ts"
38
42
  }
39
- }
43
+ }
package/LICENSE DELETED
@@ -1,21 +0,0 @@
1
- MIT License
2
-
3
- Copyright (c) 2025 Edwin Hernandez
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.