@aiready/mcp-server 0.2.8 → 0.2.10
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/.turbo/turbo-build.log +16 -17
- package/.turbo/turbo-format-check.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-type-check.log +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +59 -46
- package/package.json +11 -5
- package/src/__tests__/server.test.ts +1 -1
- package/src/index.ts +69 -55
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
DTS Build
|
|
16
|
-
DTS
|
|
17
|
-
DTS dist/index.d.ts 461.00 B
|
|
1
|
+
|
|
2
|
+
> @aiready/mcp-server@0.2.8 build /Users/pengcao/projects/aiready/packages/mcp-server
|
|
3
|
+
> tsup src/index.ts --format esm --clean --dts
|
|
4
|
+
|
|
5
|
+
CLI Building entry: src/index.ts
|
|
6
|
+
CLI Using tsconfig: tsconfig.json
|
|
7
|
+
CLI tsup v8.5.1
|
|
8
|
+
CLI Using tsup config: /Users/pengcao/projects/aiready/packages/mcp-server/tsup.config.ts
|
|
9
|
+
CLI Target: node20
|
|
10
|
+
CLI Cleaning output folder
|
|
11
|
+
ESM Build start
|
|
12
|
+
ESM dist/index.js 7.52 KB
|
|
13
|
+
ESM ⚡️ Build success in 10ms
|
|
14
|
+
DTS Build start
|
|
15
|
+
DTS ⚡️ Build success in 1358ms
|
|
16
|
+
DTS dist/index.d.ts 461.00 B
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/mcp-server@0.2.
|
|
3
|
+
> @aiready/mcp-server@0.2.10 format-check /Users/pengcao/projects/aiready/packages/mcp-server
|
|
4
4
|
> prettier --check . --ignore-path ../../.prettierignore
|
|
5
5
|
|
|
6
6
|
Checking formatting...
|
package/.turbo/turbo-lint.log
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -8,6 +8,15 @@ import {
|
|
|
8
8
|
ListToolsRequestSchema
|
|
9
9
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
10
10
|
import { ToolRegistry, ToolName } from "@aiready/core";
|
|
11
|
+
import { z } from "zod";
|
|
12
|
+
var AnalysisArgsSchema = z.object({
|
|
13
|
+
path: z.string().describe("Path to the directory to analyze")
|
|
14
|
+
});
|
|
15
|
+
var RemediationArgsSchema = z.object({
|
|
16
|
+
issue_id: z.string().describe("The unique ID of the issue to fix"),
|
|
17
|
+
file_path: z.string().describe("The path to the file containing the issue"),
|
|
18
|
+
context: z.string().describe("The content of the file or surrounding code")
|
|
19
|
+
});
|
|
11
20
|
var TOOL_PACKAGE_MAP = {
|
|
12
21
|
[ToolName.PatternDetect]: "@aiready/pattern-detect",
|
|
13
22
|
[ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
|
|
@@ -32,10 +41,11 @@ var TOOL_PACKAGE_MAP = {
|
|
|
32
41
|
};
|
|
33
42
|
var AIReadyMcpServer = class {
|
|
34
43
|
constructor() {
|
|
44
|
+
this.version = "0.2.10";
|
|
35
45
|
this.server = new Server(
|
|
36
46
|
{
|
|
37
47
|
name: "aiready-server",
|
|
38
|
-
version:
|
|
48
|
+
version: this.version
|
|
39
49
|
},
|
|
40
50
|
{
|
|
41
51
|
capabilities: {
|
|
@@ -117,55 +127,61 @@ ${data.rationale}`
|
|
|
117
127
|
ToolName.DependencyHealth,
|
|
118
128
|
ToolName.ChangeAmplification
|
|
119
129
|
];
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
const tools = [
|
|
131
|
+
...toolsToAdvertise.map((id) => ({
|
|
132
|
+
name: id,
|
|
133
|
+
description: `Scan the directory for ${id} issues to improve AI-readiness.`,
|
|
134
|
+
inputSchema: {
|
|
135
|
+
type: "object",
|
|
136
|
+
properties: {
|
|
137
|
+
path: {
|
|
138
|
+
type: "string",
|
|
139
|
+
description: "Path to the directory to analyze"
|
|
140
|
+
}
|
|
141
|
+
},
|
|
142
|
+
required: ["path"]
|
|
143
|
+
}
|
|
144
|
+
})),
|
|
145
|
+
{
|
|
146
|
+
name: "get_remediation_diff",
|
|
147
|
+
description: "Get a precise code diff to fix a specific AI-readiness issue (Requires AIReady API Key).",
|
|
148
|
+
inputSchema: {
|
|
149
|
+
type: "object",
|
|
150
|
+
properties: {
|
|
151
|
+
issue_id: {
|
|
152
|
+
type: "string",
|
|
153
|
+
description: "The unique ID of the issue to fix (from a scan)."
|
|
132
154
|
},
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
{
|
|
137
|
-
name: "get_remediation_diff",
|
|
138
|
-
description: "Get a precise code diff to fix a specific AI-readiness issue (Requires AIReady API Key).",
|
|
139
|
-
inputSchema: {
|
|
140
|
-
type: "object",
|
|
141
|
-
properties: {
|
|
142
|
-
issue_id: {
|
|
143
|
-
type: "string",
|
|
144
|
-
description: "The unique ID of the issue to fix (from a scan)."
|
|
145
|
-
},
|
|
146
|
-
file_path: {
|
|
147
|
-
type: "string",
|
|
148
|
-
description: "The path to the file containing the issue."
|
|
149
|
-
},
|
|
150
|
-
context: {
|
|
151
|
-
type: "string",
|
|
152
|
-
description: "The content of the file or surrounding code."
|
|
153
|
-
}
|
|
155
|
+
file_path: {
|
|
156
|
+
type: "string",
|
|
157
|
+
description: "The path to the file containing the issue."
|
|
154
158
|
},
|
|
155
|
-
|
|
156
|
-
|
|
159
|
+
context: {
|
|
160
|
+
type: "string",
|
|
161
|
+
description: "The content of the file or surrounding code."
|
|
162
|
+
}
|
|
163
|
+
},
|
|
164
|
+
required: ["issue_id", "file_path", "context"]
|
|
157
165
|
}
|
|
158
|
-
|
|
159
|
-
|
|
166
|
+
}
|
|
167
|
+
];
|
|
168
|
+
return { tools };
|
|
160
169
|
});
|
|
161
170
|
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
162
171
|
const { name, arguments: args } = request.params;
|
|
163
172
|
try {
|
|
164
173
|
if (name === "get_remediation_diff") {
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
174
|
+
const parsedArgs2 = RemediationArgsSchema.safeParse(args);
|
|
175
|
+
if (!parsedArgs2.success) {
|
|
176
|
+
throw new Error(`Invalid arguments for ${name}: ${parsedArgs2.error.message}`);
|
|
177
|
+
}
|
|
178
|
+
return await this.handleRemediation(parsedArgs2.data);
|
|
179
|
+
}
|
|
180
|
+
const parsedArgs = AnalysisArgsSchema.safeParse(args);
|
|
181
|
+
if (!parsedArgs.success) {
|
|
182
|
+
throw new Error(`Invalid arguments for ${name}: ${parsedArgs.error.message}`);
|
|
168
183
|
}
|
|
184
|
+
const { path: rootDir } = parsedArgs.data;
|
|
169
185
|
let provider = ToolRegistry.find(name);
|
|
170
186
|
if (!provider) {
|
|
171
187
|
const packageName = TOOL_PACKAGE_MAP[name] ?? (name.startsWith("@aiready/") ? name : `@aiready/${name}`);
|
|
@@ -190,12 +206,9 @@ ${data.rationale}`
|
|
|
190
206
|
if (!provider) {
|
|
191
207
|
throw new Error(`Tool ${name} not found after attempting to load`);
|
|
192
208
|
}
|
|
193
|
-
|
|
194
|
-
throw new Error("Missing required argument: path");
|
|
195
|
-
}
|
|
196
|
-
console.error(`[MCP] Executing ${name} on ${args.path}`);
|
|
209
|
+
console.error(`[MCP] Executing ${name} on ${rootDir}`);
|
|
197
210
|
const results = await provider.analyze({
|
|
198
|
-
rootDir
|
|
211
|
+
rootDir
|
|
199
212
|
});
|
|
200
213
|
return {
|
|
201
214
|
content: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.10",
|
|
4
4
|
"description": "The AIReady Model Context Protocol (MCP) Server for Agentic Readiness. Optimize codebases for AI agents like Cursor, Windsurf, and Claude directly via MCP.",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -13,10 +13,16 @@
|
|
|
13
13
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
14
14
|
"chalk": "^5.3.0",
|
|
15
15
|
"zod": "^4.3.6",
|
|
16
|
-
"@aiready/
|
|
17
|
-
"@aiready/
|
|
18
|
-
"@aiready/
|
|
19
|
-
"@aiready/
|
|
16
|
+
"@aiready/agent-grounding": "0.14.13",
|
|
17
|
+
"@aiready/ai-signal-clarity": "0.14.15",
|
|
18
|
+
"@aiready/consistency": "0.21.13",
|
|
19
|
+
"@aiready/context-analyzer": "0.22.13",
|
|
20
|
+
"@aiready/core": "0.24.14",
|
|
21
|
+
"@aiready/pattern-detect": "0.17.13",
|
|
22
|
+
"@aiready/testability": "0.7.14",
|
|
23
|
+
"@aiready/doc-drift": "0.14.13",
|
|
24
|
+
"@aiready/change-amplification": "0.14.13",
|
|
25
|
+
"@aiready/deps": "0.14.13"
|
|
20
26
|
},
|
|
21
27
|
"devDependencies": {
|
|
22
28
|
"@types/node": "^24.0.0",
|
|
@@ -104,7 +104,7 @@ describe('AIReady MCP Server Integration', () => {
|
|
|
104
104
|
expect(typedResult.isError).toBe(true);
|
|
105
105
|
expect(typedResult.content[0].type).toBe('text');
|
|
106
106
|
expect((typedResult.content[0] as any).text).toContain(
|
|
107
|
-
'
|
|
107
|
+
'Invalid arguments for pattern-detect'
|
|
108
108
|
);
|
|
109
109
|
});
|
|
110
110
|
});
|
package/src/index.ts
CHANGED
|
@@ -5,6 +5,20 @@ import {
|
|
|
5
5
|
ListToolsRequestSchema,
|
|
6
6
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
7
7
|
import { ToolRegistry, ToolName } from '@aiready/core';
|
|
8
|
+
import { z } from 'zod';
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Zod schemas for tool arguments
|
|
12
|
+
*/
|
|
13
|
+
const AnalysisArgsSchema = z.object({
|
|
14
|
+
path: z.string().describe('Path to the directory to analyze'),
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
const RemediationArgsSchema = z.object({
|
|
18
|
+
issue_id: z.string().describe('The unique ID of the issue to fix'),
|
|
19
|
+
file_path: z.string().describe('The path to the file containing the issue'),
|
|
20
|
+
context: z.string().describe('The content of the file or surrounding code'),
|
|
21
|
+
});
|
|
8
22
|
|
|
9
23
|
/**
|
|
10
24
|
* Mapping between tool names and @aiready/ package names.
|
|
@@ -38,12 +52,13 @@ const TOOL_PACKAGE_MAP: Record<string, string> = {
|
|
|
38
52
|
*/
|
|
39
53
|
export class AIReadyMcpServer {
|
|
40
54
|
private server: Server;
|
|
55
|
+
private version: string = '0.2.10';
|
|
41
56
|
|
|
42
57
|
constructor() {
|
|
43
58
|
this.server = new Server(
|
|
44
59
|
{
|
|
45
60
|
name: 'aiready-server',
|
|
46
|
-
version:
|
|
61
|
+
version: this.version,
|
|
47
62
|
},
|
|
48
63
|
{
|
|
49
64
|
capabilities: {
|
|
@@ -59,11 +74,7 @@ export class AIReadyMcpServer {
|
|
|
59
74
|
};
|
|
60
75
|
}
|
|
61
76
|
|
|
62
|
-
private async handleRemediation(args: {
|
|
63
|
-
issue_id: string;
|
|
64
|
-
file_path: string;
|
|
65
|
-
context: string;
|
|
66
|
-
}) {
|
|
77
|
+
private async handleRemediation(args: z.infer<typeof RemediationArgsSchema>) {
|
|
67
78
|
const apiKey = process.env.AIREADY_API_KEY;
|
|
68
79
|
const serverUrl =
|
|
69
80
|
process.env.AIREADY_PLATFORM_URL || 'https://platform.getaiready.dev';
|
|
@@ -140,48 +151,47 @@ export class AIReadyMcpServer {
|
|
|
140
151
|
ToolName.ChangeAmplification,
|
|
141
152
|
];
|
|
142
153
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
description: 'Path to the directory to analyze',
|
|
154
|
-
},
|
|
154
|
+
const tools: any[] = [
|
|
155
|
+
...toolsToAdvertise.map((id) => ({
|
|
156
|
+
name: id,
|
|
157
|
+
description: `Scan the directory for ${id} issues to improve AI-readiness.`,
|
|
158
|
+
inputSchema: {
|
|
159
|
+
type: 'object',
|
|
160
|
+
properties: {
|
|
161
|
+
path: {
|
|
162
|
+
type: 'string',
|
|
163
|
+
description: 'Path to the directory to analyze',
|
|
155
164
|
},
|
|
156
|
-
required: ['path'],
|
|
157
165
|
},
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
166
|
+
required: ['path'],
|
|
167
|
+
},
|
|
168
|
+
})),
|
|
169
|
+
{
|
|
170
|
+
name: 'get_remediation_diff',
|
|
171
|
+
description:
|
|
172
|
+
'Get a precise code diff to fix a specific AI-readiness issue (Requires AIReady API Key).',
|
|
173
|
+
inputSchema: {
|
|
174
|
+
type: 'object',
|
|
175
|
+
properties: {
|
|
176
|
+
issue_id: {
|
|
177
|
+
type: 'string',
|
|
178
|
+
description: 'The unique ID of the issue to fix (from a scan).',
|
|
179
|
+
},
|
|
180
|
+
file_path: {
|
|
181
|
+
type: 'string',
|
|
182
|
+
description: 'The path to the file containing the issue.',
|
|
183
|
+
},
|
|
184
|
+
context: {
|
|
185
|
+
type: 'string',
|
|
186
|
+
description: 'The content of the file or surrounding code.',
|
|
179
187
|
},
|
|
180
|
-
required: ['issue_id', 'file_path', 'context'],
|
|
181
188
|
},
|
|
189
|
+
required: ['issue_id', 'file_path', 'context'],
|
|
182
190
|
},
|
|
183
|
-
|
|
184
|
-
|
|
191
|
+
},
|
|
192
|
+
];
|
|
193
|
+
|
|
194
|
+
return { tools };
|
|
185
195
|
});
|
|
186
196
|
|
|
187
197
|
// Handle tool execution
|
|
@@ -190,14 +200,22 @@ export class AIReadyMcpServer {
|
|
|
190
200
|
|
|
191
201
|
try {
|
|
192
202
|
if (name === 'get_remediation_diff') {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
203
|
+
const parsedArgs = RemediationArgsSchema.safeParse(args);
|
|
204
|
+
if (!parsedArgs.success) {
|
|
205
|
+
throw new Error(
|
|
206
|
+
`Invalid arguments for ${name}: ${parsedArgs.error.message}`
|
|
207
|
+
);
|
|
208
|
+
}
|
|
209
|
+
return await this.handleRemediation(parsedArgs.data);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const parsedArgs = AnalysisArgsSchema.safeParse(args);
|
|
213
|
+
if (!parsedArgs.success) {
|
|
214
|
+
throw new Error(
|
|
215
|
+
`Invalid arguments for ${name}: ${parsedArgs.error.message}`
|
|
199
216
|
);
|
|
200
217
|
}
|
|
218
|
+
const { path: rootDir } = parsedArgs.data;
|
|
201
219
|
|
|
202
220
|
let provider = ToolRegistry.find(name);
|
|
203
221
|
|
|
@@ -233,14 +251,10 @@ export class AIReadyMcpServer {
|
|
|
233
251
|
throw new Error(`Tool ${name} not found after attempting to load`);
|
|
234
252
|
}
|
|
235
253
|
|
|
236
|
-
|
|
237
|
-
throw new Error('Missing required argument: path');
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
console.error(`[MCP] Executing ${name} on ${args.path}`);
|
|
254
|
+
console.error(`[MCP] Executing ${name} on ${rootDir}`);
|
|
241
255
|
|
|
242
256
|
const results = await provider.analyze({
|
|
243
|
-
rootDir
|
|
257
|
+
rootDir,
|
|
244
258
|
});
|
|
245
259
|
|
|
246
260
|
// Format results for the agent
|