@aiready/mcp-server 0.2.5 → 0.2.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/.turbo/turbo-build.log +17 -16
- package/.turbo/turbo-test.log +22 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.js +95 -14
- package/package.json +5 -5
- package/src/index.ts +103 -12
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
DTS
|
|
16
|
-
DTS
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @aiready/mcp-server@0.2.6 build /Users/pengcao/projects/aiready/packages/mcp-server
|
|
4
|
+
> tsup src/index.ts --format esm --clean --dts
|
|
5
|
+
|
|
6
|
+
[34mCLI[39m Building entry: src/index.ts
|
|
7
|
+
[34mCLI[39m Using tsconfig: tsconfig.json
|
|
8
|
+
[34mCLI[39m tsup v8.5.1
|
|
9
|
+
[34mCLI[39m Using tsup config: /Users/pengcao/projects/aiready/packages/mcp-server/tsup.config.ts
|
|
10
|
+
[34mCLI[39m Target: node20
|
|
11
|
+
[34mCLI[39m Cleaning output folder
|
|
12
|
+
[34mESM[39m Build start
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m7.22 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 12ms
|
|
15
|
+
DTS Build start
|
|
16
|
+
DTS ⚡️ Build success in 1269ms
|
|
17
|
+
DTS dist/index.d.ts 461.00 B
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @aiready/mcp-server@0.2.5 test /Users/pengcao/projects/aiready/packages/mcp-server
|
|
4
|
+
> vitest run
|
|
5
|
+
|
|
6
|
+
[?25l
|
|
7
|
+
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/Users/pengcao/projects/aiready/packages/mcp-server[39m
|
|
8
|
+
|
|
9
|
+
AIReady MCP Server started
|
|
10
|
+
[MCP] Dynamically loading @aiready/pattern-detect for tool pattern-detect
|
|
11
|
+
[MCP] Executing pattern-detect on /Users/pengcao/projects/aiready/packages/core
|
|
12
|
+
[MCP] Dynamically loading @aiready/non-existent-tool for tool non-existent-tool
|
|
13
|
+
[MCP] Failed to load tool package @aiready/non-existent-tool: Cannot find package '@aiready/non-existent-tool' imported from /Users/pengcao/projects/aiready/packages/mcp-server/dist/index.js
|
|
14
|
+
[32m✓[39m src/__tests__/server.test.ts [2m([22m[2m5 tests[22m[2m)[22m[33m 1987[2mms[22m[39m
|
|
15
|
+
[33m[2m✓[22m[39m should execute pattern-detect and return results [33m 1353[2mms[22m[39m
|
|
16
|
+
|
|
17
|
+
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
18
|
+
[2m Tests [22m [1m[32m5 passed[39m[22m[90m (5)[39m
|
|
19
|
+
[2m Start at [22m 22:07:58
|
|
20
|
+
[2m Duration [22m 2.34s[2m (transform 174ms, setup 0ms, import 216ms, tests 1.99s, environment 0ms)[22m
|
|
21
|
+
|
|
22
|
+
[?25h
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -48,6 +48,61 @@ var AIReadyMcpServer = class {
|
|
|
48
48
|
console.error("[MCP Error]", error);
|
|
49
49
|
};
|
|
50
50
|
}
|
|
51
|
+
async handleRemediation(args) {
|
|
52
|
+
const apiKey = process.env.AIREADY_API_KEY;
|
|
53
|
+
const serverUrl = process.env.AIREADY_PLATFORM_URL || "https://platform.getaiready.dev";
|
|
54
|
+
if (!apiKey) {
|
|
55
|
+
throw new Error(
|
|
56
|
+
"AIREADY_API_KEY is not set. Remediation requires an active subscription."
|
|
57
|
+
);
|
|
58
|
+
}
|
|
59
|
+
console.error(`[MCP] Requesting remediation for ${args.issue_id}...`);
|
|
60
|
+
try {
|
|
61
|
+
const response = await fetch(`${serverUrl}/api/v1/remediate`, {
|
|
62
|
+
method: "POST",
|
|
63
|
+
headers: {
|
|
64
|
+
"Content-Type": "application/json",
|
|
65
|
+
"X-API-KEY": apiKey
|
|
66
|
+
},
|
|
67
|
+
body: JSON.stringify({
|
|
68
|
+
issueId: args.issue_id,
|
|
69
|
+
filePath: args.file_path,
|
|
70
|
+
context: args.context,
|
|
71
|
+
agent: "mcp-server"
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
if (!response.ok) {
|
|
75
|
+
const errorData = await response.json().catch(() => ({}));
|
|
76
|
+
throw new Error(
|
|
77
|
+
`Platform Error: ${errorData.message || response.statusText}`
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
const data = await response.json();
|
|
81
|
+
return {
|
|
82
|
+
content: [
|
|
83
|
+
{
|
|
84
|
+
type: "text",
|
|
85
|
+
text: `Recommended Fix (Diff):
|
|
86
|
+
|
|
87
|
+
${data.diff}
|
|
88
|
+
|
|
89
|
+
Rationale:
|
|
90
|
+
${data.rationale}`
|
|
91
|
+
}
|
|
92
|
+
]
|
|
93
|
+
};
|
|
94
|
+
} catch (error) {
|
|
95
|
+
return {
|
|
96
|
+
content: [
|
|
97
|
+
{
|
|
98
|
+
type: "text",
|
|
99
|
+
text: `Failed to get remediation: ${error.message}. Please visit the dashboard to fix manually.`
|
|
100
|
+
}
|
|
101
|
+
],
|
|
102
|
+
isError: true
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
}
|
|
51
106
|
setupHandlers() {
|
|
52
107
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
53
108
|
const toolsToAdvertise = [
|
|
@@ -62,26 +117,52 @@ var AIReadyMcpServer = class {
|
|
|
62
117
|
ToolName.ChangeAmplification
|
|
63
118
|
];
|
|
64
119
|
return {
|
|
65
|
-
tools:
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
120
|
+
tools: [
|
|
121
|
+
...toolsToAdvertise.map((id) => ({
|
|
122
|
+
name: id,
|
|
123
|
+
description: `Scan the directory for ${id} issues to improve AI-readiness.`,
|
|
124
|
+
inputSchema: {
|
|
125
|
+
type: "object",
|
|
126
|
+
properties: {
|
|
127
|
+
path: {
|
|
128
|
+
type: "string",
|
|
129
|
+
description: "Path to the directory to analyze"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
required: ["path"]
|
|
133
|
+
}
|
|
134
|
+
})),
|
|
135
|
+
{
|
|
136
|
+
name: "get_remediation_diff",
|
|
137
|
+
description: "Get a precise code diff to fix a specific AI-readiness issue (Requires AIReady API Key).",
|
|
138
|
+
inputSchema: {
|
|
139
|
+
type: "object",
|
|
140
|
+
properties: {
|
|
141
|
+
issue_id: {
|
|
142
|
+
type: "string",
|
|
143
|
+
description: "The unique ID of the issue to fix (from a scan)."
|
|
144
|
+
},
|
|
145
|
+
file_path: {
|
|
146
|
+
type: "string",
|
|
147
|
+
description: "The path to the file containing the issue."
|
|
148
|
+
},
|
|
149
|
+
context: {
|
|
150
|
+
type: "string",
|
|
151
|
+
description: "The content of the file or surrounding code."
|
|
152
|
+
}
|
|
153
|
+
},
|
|
154
|
+
required: ["issue_id", "file_path", "context"]
|
|
155
|
+
}
|
|
78
156
|
}
|
|
79
|
-
|
|
157
|
+
]
|
|
80
158
|
};
|
|
81
159
|
});
|
|
82
160
|
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
83
161
|
const { name, arguments: args } = request.params;
|
|
84
162
|
try {
|
|
163
|
+
if (name === "get_remediation_diff") {
|
|
164
|
+
return await this.handleRemediation(args);
|
|
165
|
+
}
|
|
85
166
|
let provider = ToolRegistry.find(name);
|
|
86
167
|
if (!provider) {
|
|
87
168
|
const packageName = TOOL_PACKAGE_MAP[name] ?? (name.startsWith("@aiready/") ? name : `@aiready/${name}`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/mcp-server",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
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,10 @@
|
|
|
13
13
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
14
14
|
"chalk": "^5.3.0",
|
|
15
15
|
"zod": "^4.3.6",
|
|
16
|
-
"@aiready/consistency": "0.21.
|
|
17
|
-
"@aiready/context-analyzer": "0.22.
|
|
18
|
-
"@aiready/core": "0.24.
|
|
19
|
-
"@aiready/pattern-detect": "0.17.
|
|
16
|
+
"@aiready/consistency": "0.21.7",
|
|
17
|
+
"@aiready/context-analyzer": "0.22.7",
|
|
18
|
+
"@aiready/core": "0.24.7",
|
|
19
|
+
"@aiready/pattern-detect": "0.17.7"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^24.0.0",
|
package/src/index.ts
CHANGED
|
@@ -59,6 +59,68 @@ export class AIReadyMcpServer {
|
|
|
59
59
|
};
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
+
private async handleRemediation(args: {
|
|
63
|
+
issue_id: string;
|
|
64
|
+
file_path: string;
|
|
65
|
+
context: string;
|
|
66
|
+
}) {
|
|
67
|
+
const apiKey = process.env.AIREADY_API_KEY;
|
|
68
|
+
const serverUrl =
|
|
69
|
+
process.env.AIREADY_PLATFORM_URL || 'https://platform.getaiready.dev';
|
|
70
|
+
|
|
71
|
+
if (!apiKey) {
|
|
72
|
+
throw new Error(
|
|
73
|
+
'AIREADY_API_KEY is not set. Remediation requires an active subscription.'
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
console.error(`[MCP] Requesting remediation for ${args.issue_id}...`);
|
|
78
|
+
|
|
79
|
+
try {
|
|
80
|
+
const response = await fetch(`${serverUrl}/api/v1/remediate`, {
|
|
81
|
+
method: 'POST',
|
|
82
|
+
headers: {
|
|
83
|
+
'Content-Type': 'application/json',
|
|
84
|
+
'X-API-KEY': apiKey,
|
|
85
|
+
},
|
|
86
|
+
body: JSON.stringify({
|
|
87
|
+
issueId: args.issue_id,
|
|
88
|
+
filePath: args.file_path,
|
|
89
|
+
context: args.context,
|
|
90
|
+
agent: 'mcp-server',
|
|
91
|
+
}),
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
if (!response.ok) {
|
|
95
|
+
const errorData = await response.json().catch(() => ({}));
|
|
96
|
+
throw new Error(
|
|
97
|
+
`Platform Error: ${errorData.message || response.statusText}`
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const data = await response.json();
|
|
102
|
+
|
|
103
|
+
return {
|
|
104
|
+
content: [
|
|
105
|
+
{
|
|
106
|
+
type: 'text',
|
|
107
|
+
text: `Recommended Fix (Diff):\n\n${data.diff}\n\nRationale:\n${data.rationale}`,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
};
|
|
111
|
+
} catch (error: any) {
|
|
112
|
+
return {
|
|
113
|
+
content: [
|
|
114
|
+
{
|
|
115
|
+
type: 'text',
|
|
116
|
+
text: `Failed to get remediation: ${error.message}. Please visit the dashboard to fix manually.`,
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
isError: true,
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
62
124
|
private setupHandlers() {
|
|
63
125
|
// List available tools
|
|
64
126
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
@@ -77,21 +139,46 @@ export class AIReadyMcpServer {
|
|
|
77
139
|
];
|
|
78
140
|
|
|
79
141
|
return {
|
|
80
|
-
tools:
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
142
|
+
tools: [
|
|
143
|
+
...toolsToAdvertise.map((id) => ({
|
|
144
|
+
name: id,
|
|
145
|
+
description: `Scan the directory for ${id} issues to improve AI-readiness.`,
|
|
146
|
+
inputSchema: {
|
|
147
|
+
type: 'object',
|
|
148
|
+
properties: {
|
|
149
|
+
path: {
|
|
150
|
+
type: 'string',
|
|
151
|
+
description: 'Path to the directory to analyze',
|
|
152
|
+
},
|
|
153
|
+
},
|
|
154
|
+
required: ['path'],
|
|
155
|
+
},
|
|
156
|
+
})),
|
|
157
|
+
{
|
|
158
|
+
name: 'get_remediation_diff',
|
|
159
|
+
description:
|
|
160
|
+
'Get a precise code diff to fix a specific AI-readiness issue (Requires AIReady API Key).',
|
|
161
|
+
inputSchema: {
|
|
162
|
+
type: 'object',
|
|
163
|
+
properties: {
|
|
164
|
+
issue_id: {
|
|
165
|
+
type: 'string',
|
|
166
|
+
description:
|
|
167
|
+
'The unique ID of the issue to fix (from a scan).',
|
|
168
|
+
},
|
|
169
|
+
file_path: {
|
|
170
|
+
type: 'string',
|
|
171
|
+
description: 'The path to the file containing the issue.',
|
|
172
|
+
},
|
|
173
|
+
context: {
|
|
174
|
+
type: 'string',
|
|
175
|
+
description: 'The content of the file or surrounding code.',
|
|
176
|
+
},
|
|
89
177
|
},
|
|
90
|
-
|
|
178
|
+
required: ['issue_id', 'file_path', 'context'],
|
|
91
179
|
},
|
|
92
|
-
required: ['path'],
|
|
93
180
|
},
|
|
94
|
-
|
|
181
|
+
],
|
|
95
182
|
};
|
|
96
183
|
});
|
|
97
184
|
|
|
@@ -100,6 +187,10 @@ export class AIReadyMcpServer {
|
|
|
100
187
|
const { name, arguments: args } = request.params;
|
|
101
188
|
|
|
102
189
|
try {
|
|
190
|
+
if (name === 'get_remediation_diff') {
|
|
191
|
+
return await this.handleRemediation(args as any);
|
|
192
|
+
}
|
|
193
|
+
|
|
103
194
|
let provider = ToolRegistry.find(name);
|
|
104
195
|
|
|
105
196
|
// Dynamic loading if not already registered (CLI pattern)
|