@aiready/mcp-server 0.1.0 → 0.1.2
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/.env.smithery +1 -0
- package/.smithery/shttp/manifest.json +73 -0
- package/.smithery/shttp/module.js +270740 -0
- package/.smithery/shttp/module.js.map +7 -0
- package/.turbo/turbo-build.log +5 -5
- package/.turbo/turbo-lint.log +10 -0
- package/.turbo/turbo-test.log +18 -0
- package/.well-known/mcp/server-card.json +55 -0
- package/README.md +71 -0
- package/dist/index.d.ts +6 -1
- package/dist/index.js +17 -8
- package/package.json +8 -7
- package/smithery.yaml +7 -0
- package/src/__tests__/server.test.ts +15 -11
- package/src/index.ts +18 -8
- package/test-mcp.ts +21 -20
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/mcp-server@0.1.
|
|
3
|
+
> @aiready/mcp-server@0.1.2 build /Users/pengcao/projects/aiready/packages/mcp-server
|
|
4
4
|
> tsup src/index.ts --format esm --clean --dts
|
|
5
5
|
|
|
6
6
|
[34mCLI[39m Building entry: src/index.ts
|
|
@@ -10,8 +10,8 @@
|
|
|
10
10
|
[34mCLI[39m Target: node20
|
|
11
11
|
[34mCLI[39m Cleaning output folder
|
|
12
12
|
[34mESM[39m Build start
|
|
13
|
-
[32mESM[39m [1mdist/index.js [22m[32m2.
|
|
14
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m2.90 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 31ms
|
|
15
15
|
DTS Build start
|
|
16
|
-
DTS ⚡️ Build success in
|
|
17
|
-
DTS dist/index.d.ts
|
|
16
|
+
DTS ⚡️ Build success in 1016ms
|
|
17
|
+
DTS dist/index.d.ts 430.00 B
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
|
|
2
|
+
> @aiready/mcp-server@0.1.0 lint /Users/pengcao/projects/aiready/packages/mcp-server
|
|
3
|
+
> eslint src
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/Users/pengcao/projects/aiready/packages/mcp-server/src/index.ts
|
|
7
|
+
7:24 warning 'ToolName' is defined but never used @typescript-eslint/no-unused-vars
|
|
8
|
+
|
|
9
|
+
✖ 1 problem (0 errors, 1 warning)
|
|
10
|
+
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @aiready/mcp-server@0.1.1 test /Users/pengcao/projects/aiready/packages/mcp-server
|
|
4
|
+
> vitest run
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
[1m[7m[36m RUN [39m[27m[22m [36mv2.1.9 [39m[90m/Users/pengcao/projects/aiready/packages/mcp-server[39m
|
|
8
|
+
|
|
9
|
+
AIReady MCP Server started
|
|
10
|
+
[MCP] Executing pattern-detect on /Users/pengcao/projects/aiready/packages/core
|
|
11
|
+
[32m✓[39m src/__tests__/server.test.ts [2m([22m[2m5 tests[22m[2m)[22m[33m 663[2mms[22m[39m
|
|
12
|
+
|
|
13
|
+
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
14
|
+
[2m Tests [22m [1m[32m5 passed[39m[22m[90m (5)[39m
|
|
15
|
+
[2m Start at [22m 22:22:09
|
|
16
|
+
[2m Duration [22m 1.17s[2m (transform 73ms, setup 0ms, collect 81ms, tests 663ms, environment 0ms, prepare 116ms)[22m
|
|
17
|
+
|
|
18
|
+
[?25h
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
{
|
|
2
|
+
"serverInfo": {
|
|
3
|
+
"name": "AIReady MCP Server",
|
|
4
|
+
"version": "0.1.0"
|
|
5
|
+
},
|
|
6
|
+
"authentication": {
|
|
7
|
+
"required": false
|
|
8
|
+
},
|
|
9
|
+
"tools": [
|
|
10
|
+
{
|
|
11
|
+
"name": "pattern-detect",
|
|
12
|
+
"description": "AIReady analysis tool: pattern-detect",
|
|
13
|
+
"inputSchema": {
|
|
14
|
+
"type": "object",
|
|
15
|
+
"properties": {
|
|
16
|
+
"path": {
|
|
17
|
+
"type": "string",
|
|
18
|
+
"description": "Path to the directory to analyze"
|
|
19
|
+
}
|
|
20
|
+
},
|
|
21
|
+
"required": ["path"]
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"name": "context-analyzer",
|
|
26
|
+
"description": "AIReady analysis tool: context-analyzer",
|
|
27
|
+
"inputSchema": {
|
|
28
|
+
"type": "object",
|
|
29
|
+
"properties": {
|
|
30
|
+
"path": {
|
|
31
|
+
"type": "string",
|
|
32
|
+
"description": "Path to the directory to analyze"
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"required": ["path"]
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
"name": "consistency",
|
|
40
|
+
"description": "AIReady analysis tool: consistency",
|
|
41
|
+
"inputSchema": {
|
|
42
|
+
"type": "object",
|
|
43
|
+
"properties": {
|
|
44
|
+
"path": {
|
|
45
|
+
"type": "string",
|
|
46
|
+
"description": "Path to the directory to analyze"
|
|
47
|
+
}
|
|
48
|
+
},
|
|
49
|
+
"required": ["path"]
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
],
|
|
53
|
+
"resources": [],
|
|
54
|
+
"prompts": []
|
|
55
|
+
}
|
package/README.md
ADDED
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
# AIReady MCP Server
|
|
2
|
+
|
|
3
|
+
The AIReady MCP Server provides an integration point for AI agents (like Claude Desktop, Cursor, Windsurf, etc.) to assess AI-readiness and improve AI leverage directly within their conversational interfaces using the Model Context Protocol (MCP).
|
|
4
|
+
|
|
5
|
+
## Installation & Distribution Channels
|
|
6
|
+
|
|
7
|
+
You can install and use the AIReady MCP server through several supported channels.
|
|
8
|
+
|
|
9
|
+
### 1. Dedicated MCP Registries
|
|
10
|
+
|
|
11
|
+
- **[Smithery](https://smithery.ai)**: Discover and install our server directly via the Smithery CLI:
|
|
12
|
+
```bash
|
|
13
|
+
npx @smithery/cli install @aiready/mcp-server
|
|
14
|
+
```
|
|
15
|
+
- **[Glama](https://glama.ai/mcp)**: View our listing and integration options on the Glama directory.
|
|
16
|
+
- **[Pulsar](https://gotopulsar.com)**: Find us on the Pulsar registry for MCP servers.
|
|
17
|
+
|
|
18
|
+
### 2. Direct IDE / Assistant Integrations
|
|
19
|
+
|
|
20
|
+
#### Claude Desktop App
|
|
21
|
+
|
|
22
|
+
To use the AIReady MCP server in the Claude Desktop app, add the following configuration to your `claude_desktop_config.json`:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
"mcpServers": {
|
|
26
|
+
"aiready": {
|
|
27
|
+
"command": "npx",
|
|
28
|
+
"args": ["-y", "@aiready/mcp-server"]
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
#### Cursor IDE
|
|
34
|
+
|
|
35
|
+
1. Open Cursor Settings.
|
|
36
|
+
2. Navigate to **Features** -> **MCP Servers**.
|
|
37
|
+
3. Add a new server.
|
|
38
|
+
4. Set the command to: `npx -y @aiready/mcp-server`
|
|
39
|
+
|
|
40
|
+
#### Windsurf IDE
|
|
41
|
+
|
|
42
|
+
1. Open Windsurf Settings or local environment configuration.
|
|
43
|
+
2. Add a new MCP Server integration.
|
|
44
|
+
3. Configure the execution command: `npx -y @aiready/mcp-server`
|
|
45
|
+
|
|
46
|
+
### 3. Containerized Distribution (Docker)
|
|
47
|
+
|
|
48
|
+
If you prefer running MCP servers in isolated environments, you can use our Docker image:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
docker run -i --rm ghcr.io/caopengau/aiready-mcp-server
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
_(Note: Docker image distribution is currently being set up. Use the command above once published.)_
|
|
55
|
+
|
|
56
|
+
### 4. Existing AIReady Channels
|
|
57
|
+
|
|
58
|
+
We are also integrating the MCP server with our existing distribution methods:
|
|
59
|
+
|
|
60
|
+
- **Homebrew**: `brew install aiready-mcp` (Coming soon)
|
|
61
|
+
- **VS Code Extension**: Bundled within the AIReady extension for editor-native AI chats. (Coming soon)
|
|
62
|
+
|
|
63
|
+
## Quick Start
|
|
64
|
+
|
|
65
|
+
To test the server locally, you can run:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
npx @aiready/mcp-server
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For more details on AIReady, visit [getaiready.dev](https://getaiready.dev).
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { Server } from '@modelcontextprotocol/sdk/server/index.js';
|
|
2
|
+
|
|
1
3
|
/**
|
|
2
4
|
* AIReady MCP Server Implementation
|
|
3
5
|
*/
|
|
@@ -6,6 +8,9 @@ declare class AIReadyMcpServer {
|
|
|
6
8
|
constructor();
|
|
7
9
|
private setupHandlers;
|
|
8
10
|
run(): Promise<void>;
|
|
11
|
+
getServer(): Server;
|
|
9
12
|
}
|
|
13
|
+
declare function createSandboxServer(): Server;
|
|
14
|
+
declare const mcpServer: AIReadyMcpServer;
|
|
10
15
|
|
|
11
|
-
export { AIReadyMcpServer };
|
|
16
|
+
export { AIReadyMcpServer, createSandboxServer, mcpServer as default };
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,6 @@ import {
|
|
|
8
8
|
ListToolsRequestSchema
|
|
9
9
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
10
10
|
import { ToolRegistry } from "@aiready/core";
|
|
11
|
-
import chalk from "chalk";
|
|
12
11
|
import "@aiready/pattern-detect";
|
|
13
12
|
import "@aiready/context-analyzer";
|
|
14
13
|
import "@aiready/consistency";
|
|
@@ -27,7 +26,7 @@ var AIReadyMcpServer = class {
|
|
|
27
26
|
);
|
|
28
27
|
this.setupHandlers();
|
|
29
28
|
this.server.onerror = (error) => {
|
|
30
|
-
console.error(
|
|
29
|
+
console.error("[MCP Error]", error);
|
|
31
30
|
};
|
|
32
31
|
}
|
|
33
32
|
setupHandlers() {
|
|
@@ -61,7 +60,7 @@ var AIReadyMcpServer = class {
|
|
|
61
60
|
if (!args || typeof args.path !== "string") {
|
|
62
61
|
throw new Error("Missing required argument: path");
|
|
63
62
|
}
|
|
64
|
-
console.error(
|
|
63
|
+
console.error(`[MCP] Executing ${name} on ${args.path}`);
|
|
65
64
|
const results = await provider.analyze({
|
|
66
65
|
rootDir: args.path
|
|
67
66
|
});
|
|
@@ -89,14 +88,24 @@ var AIReadyMcpServer = class {
|
|
|
89
88
|
async run() {
|
|
90
89
|
const transport = new StdioServerTransport();
|
|
91
90
|
await this.server.connect(transport);
|
|
92
|
-
console.error(
|
|
91
|
+
console.error("AIReady MCP Server started");
|
|
92
|
+
}
|
|
93
|
+
getServer() {
|
|
94
|
+
return this.server;
|
|
93
95
|
}
|
|
94
96
|
};
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
function createSandboxServer() {
|
|
98
|
+
const mcp = new AIReadyMcpServer();
|
|
99
|
+
return mcp.getServer();
|
|
100
|
+
}
|
|
101
|
+
var mcpServer = new AIReadyMcpServer();
|
|
102
|
+
mcpServer.run().catch((error) => {
|
|
103
|
+
console.error("Fatal error starting AIReady MCP Server:", error);
|
|
98
104
|
process.exit(1);
|
|
99
105
|
});
|
|
106
|
+
var index_default = mcpServer;
|
|
100
107
|
export {
|
|
101
|
-
AIReadyMcpServer
|
|
108
|
+
AIReadyMcpServer,
|
|
109
|
+
createSandboxServer,
|
|
110
|
+
index_default as default
|
|
102
111
|
};
|
package/package.json
CHANGED
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "AIReady Model Context Protocol (MCP) Server",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
|
-
"module": "./dist/index.mjs",
|
|
7
6
|
"types": "./dist/index.d.ts",
|
|
8
7
|
"type": "module",
|
|
9
8
|
"bin": {
|
|
10
|
-
"aiready-mcp": "./dist/index.js"
|
|
9
|
+
"aiready-mcp": "./dist/index.js",
|
|
10
|
+
"mcp-server": "./dist/index.js"
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@modelcontextprotocol/sdk": "^0.6.0",
|
|
14
14
|
"chalk": "^5.3.0",
|
|
15
15
|
"zod": "^4.3.6",
|
|
16
|
-
"@aiready/
|
|
17
|
-
"@aiready/context-analyzer": "0.21.
|
|
18
|
-
"@aiready/
|
|
19
|
-
"@aiready/pattern-detect": "0.16.
|
|
16
|
+
"@aiready/consistency": "0.20.3",
|
|
17
|
+
"@aiready/context-analyzer": "0.21.7",
|
|
18
|
+
"@aiready/core": "0.23.3",
|
|
19
|
+
"@aiready/pattern-detect": "0.16.3"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^24.0.0",
|
|
23
|
+
"esbuild": "^0.27.3",
|
|
23
24
|
"tsup": "^8.3.5",
|
|
24
25
|
"typescript": "^5.9.3",
|
|
25
26
|
"vitest": "^2.1.0"
|
package/smithery.yaml
ADDED
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, beforeAll, afterAll } from 'vitest';
|
|
2
2
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
3
3
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
4
|
-
import {
|
|
5
|
-
ListToolsRequestSchema,
|
|
6
|
-
CallToolRequestSchema,
|
|
7
|
-
} from '@modelcontextprotocol/sdk/types.js';
|
|
8
4
|
import path from 'path';
|
|
9
5
|
import { fileURLToPath } from 'url';
|
|
10
6
|
|
|
@@ -12,6 +8,11 @@ const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
|
12
8
|
// Point to the built JS to ensure we are testing the actual distribution
|
|
13
9
|
const serverPath = path.resolve(__dirname, '../../dist/index.js');
|
|
14
10
|
|
|
11
|
+
type ToolCallResponse = {
|
|
12
|
+
content: Array<{ type: string; text: string }>;
|
|
13
|
+
isError?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
15
16
|
describe('AIReady MCP Server Integration', () => {
|
|
16
17
|
let client: Client;
|
|
17
18
|
let transport: StdioClientTransport;
|
|
@@ -66,11 +67,12 @@ describe('AIReady MCP Server Integration', () => {
|
|
|
66
67
|
path: path.resolve(__dirname, '../../../core'), // Test on core package
|
|
67
68
|
},
|
|
68
69
|
});
|
|
70
|
+
const typedResult = result as ToolCallResponse;
|
|
69
71
|
|
|
70
72
|
// Check if result has content
|
|
71
|
-
expect(
|
|
73
|
+
expect(typedResult.content).toBeDefined();
|
|
72
74
|
|
|
73
|
-
const firstContent =
|
|
75
|
+
const firstContent = typedResult.content[0];
|
|
74
76
|
expect(firstContent.type).toBe('text');
|
|
75
77
|
|
|
76
78
|
const data = JSON.parse((firstContent as any).text);
|
|
@@ -83,9 +85,10 @@ describe('AIReady MCP Server Integration', () => {
|
|
|
83
85
|
name: 'non-existent-tool',
|
|
84
86
|
arguments: { path: '.' },
|
|
85
87
|
});
|
|
88
|
+
const typedResult = result as ToolCallResponse;
|
|
86
89
|
|
|
87
|
-
expect(
|
|
88
|
-
expect((
|
|
90
|
+
expect(typedResult.isError).toBe(true);
|
|
91
|
+
expect((typedResult.content[0] as any).text).toContain(
|
|
89
92
|
'Tool non-existent-tool not found'
|
|
90
93
|
);
|
|
91
94
|
});
|
|
@@ -96,10 +99,11 @@ describe('AIReady MCP Server Integration', () => {
|
|
|
96
99
|
name: 'pattern-detect',
|
|
97
100
|
arguments: {},
|
|
98
101
|
});
|
|
102
|
+
const typedResult = result as ToolCallResponse;
|
|
99
103
|
|
|
100
|
-
expect(
|
|
101
|
-
expect(
|
|
102
|
-
expect((
|
|
104
|
+
expect(typedResult.isError).toBe(true);
|
|
105
|
+
expect(typedResult.content[0].type).toBe('text');
|
|
106
|
+
expect((typedResult.content[0] as any).text).toContain(
|
|
103
107
|
'Missing required argument: path'
|
|
104
108
|
);
|
|
105
109
|
});
|
package/src/index.ts
CHANGED
|
@@ -4,8 +4,7 @@ import {
|
|
|
4
4
|
CallToolRequestSchema,
|
|
5
5
|
ListToolsRequestSchema,
|
|
6
6
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import { ToolRegistry
|
|
8
|
-
import chalk from 'chalk';
|
|
7
|
+
import { ToolRegistry } from '@aiready/core';
|
|
9
8
|
|
|
10
9
|
// Pre-load essential tools (following CLI pattern)
|
|
11
10
|
// In a real implementation, we would want to dynamically load these
|
|
@@ -36,7 +35,7 @@ export class AIReadyMcpServer {
|
|
|
36
35
|
this.setupHandlers();
|
|
37
36
|
|
|
38
37
|
this.server.onerror = (error) => {
|
|
39
|
-
console.error(
|
|
38
|
+
console.error('[MCP Error]', error);
|
|
40
39
|
};
|
|
41
40
|
}
|
|
42
41
|
|
|
@@ -78,7 +77,7 @@ export class AIReadyMcpServer {
|
|
|
78
77
|
throw new Error('Missing required argument: path');
|
|
79
78
|
}
|
|
80
79
|
|
|
81
|
-
console.error(
|
|
80
|
+
console.error(`[MCP] Executing ${name} on ${args.path}`);
|
|
82
81
|
|
|
83
82
|
const results = await provider.analyze({
|
|
84
83
|
rootDir: args.path,
|
|
@@ -110,13 +109,24 @@ export class AIReadyMcpServer {
|
|
|
110
109
|
async run() {
|
|
111
110
|
const transport = new StdioServerTransport();
|
|
112
111
|
await this.server.connect(transport);
|
|
113
|
-
console.error(
|
|
112
|
+
console.error('AIReady MCP Server started');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
getServer(): Server {
|
|
116
|
+
return this.server;
|
|
114
117
|
}
|
|
115
118
|
}
|
|
116
119
|
|
|
120
|
+
export function createSandboxServer(): Server {
|
|
121
|
+
const mcp = new AIReadyMcpServer();
|
|
122
|
+
return mcp.getServer();
|
|
123
|
+
}
|
|
124
|
+
|
|
117
125
|
// Bootstrap the server
|
|
118
|
-
const
|
|
119
|
-
|
|
120
|
-
console.error(
|
|
126
|
+
const mcpServer = new AIReadyMcpServer();
|
|
127
|
+
mcpServer.run().catch((error) => {
|
|
128
|
+
console.error('Fatal error starting AIReady MCP Server:', error);
|
|
121
129
|
process.exit(1);
|
|
122
130
|
});
|
|
131
|
+
|
|
132
|
+
export default mcpServer;
|
package/test-mcp.ts
CHANGED
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import { Client } from '@modelcontextprotocol/sdk/client/index.js';
|
|
2
2
|
import { StdioClientTransport } from '@modelcontextprotocol/sdk/client/stdio.js';
|
|
3
|
-
import {
|
|
4
|
-
ListToolsRequestSchema,
|
|
5
|
-
CallToolRequestSchema,
|
|
6
|
-
} from '@modelcontextprotocol/sdk/types.js';
|
|
7
3
|
import path from 'path';
|
|
8
4
|
import { fileURLToPath } from 'url';
|
|
9
5
|
|
|
10
6
|
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
|
11
7
|
const serverPath = path.join(__dirname, 'dist', 'index.js');
|
|
12
8
|
|
|
9
|
+
type ListToolsResponse = {
|
|
10
|
+
tools: Array<{ name: string }>;
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
type ToolCallResponse = {
|
|
14
|
+
isError?: boolean;
|
|
15
|
+
content?: Array<{ type: string; text: string }>;
|
|
16
|
+
};
|
|
17
|
+
|
|
13
18
|
async function testServer() {
|
|
14
19
|
console.log('🚀 Starting MCP Server verification test...');
|
|
15
20
|
|
|
@@ -37,10 +42,7 @@ async function testServer() {
|
|
|
37
42
|
console.log('✅ Connected to MCP Server');
|
|
38
43
|
|
|
39
44
|
// Test ListTools
|
|
40
|
-
const tools = await client.
|
|
41
|
-
{ method: 'tools/list' },
|
|
42
|
-
ListToolsRequestSchema
|
|
43
|
-
);
|
|
45
|
+
const tools = (await client.listTools()) as ListToolsResponse;
|
|
44
46
|
console.log(
|
|
45
47
|
'📋 Available Tools:',
|
|
46
48
|
tools.tools.map((t) => t.name).join(', ')
|
|
@@ -53,25 +55,24 @@ async function testServer() {
|
|
|
53
55
|
// Test CallTool (pattern-detect)
|
|
54
56
|
console.log("🔍 Testing 'pattern-detect'...");
|
|
55
57
|
const rootDir = '/Users/pengcao/projects/aiready'; // Test on current repo
|
|
56
|
-
const result = await client.
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
name: 'pattern-detect',
|
|
61
|
-
arguments: { path: rootDir },
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
CallToolRequestSchema
|
|
65
|
-
);
|
|
58
|
+
const result = (await client.callTool({
|
|
59
|
+
name: 'pattern-detect',
|
|
60
|
+
arguments: { path: rootDir },
|
|
61
|
+
})) as ToolCallResponse;
|
|
66
62
|
|
|
67
63
|
if (result.isError) {
|
|
68
|
-
console.error(
|
|
69
|
-
|
|
64
|
+
console.error(
|
|
65
|
+
'❌ Tool execution failed:',
|
|
66
|
+
result.content?.[0]?.text || 'Unknown MCP error'
|
|
67
|
+
);
|
|
68
|
+
} else if (result.content?.[0]?.text) {
|
|
70
69
|
console.log('✅ Tool execution success!');
|
|
71
70
|
const data = JSON.parse(result.content[0].text);
|
|
72
71
|
console.log(
|
|
73
72
|
`📊 Found ${data.duplicates?.length || 0} duplicate patterns.`
|
|
74
73
|
);
|
|
74
|
+
} else {
|
|
75
|
+
throw new Error('Tool call returned no content');
|
|
75
76
|
}
|
|
76
77
|
} catch (error) {
|
|
77
78
|
console.error('💥 Test failed:', error);
|