@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.
@@ -1,16 +1,17 @@
1
-
2
- > @aiready/mcp-server@0.2.5 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 4.81 KB
13
- ESM ⚡️ Build success in 26ms
14
- DTS Build start
15
- DTS ⚡️ Build success in 3004ms
16
- DTS dist/index.d.ts 430.00 B
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
+ CLI Building entry: src/index.ts
7
+ CLI Using tsconfig: tsconfig.json
8
+ CLI tsup v8.5.1
9
+ CLI Using tsup config: /Users/pengcao/projects/aiready/packages/mcp-server/tsup.config.ts
10
+ CLI Target: node20
11
+ CLI Cleaning output folder
12
+ ESM Build start
13
+ ESM dist/index.js 7.22 KB
14
+ ESM ⚡️ Build success in 12ms
15
+ DTS Build start
16
+ DTS ⚡️ Build success in 1269ms
17
+ DTS dist/index.d.ts 461.00 B
@@ -1,8 +1,22 @@
1
-
2
- > @aiready/mcp-server@0.2.4 test /Users/pengcao/projects/aiready/packages/mcp-server
3
- > vitest run
4
-
5
-
6
-  RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/mcp-server
7
-
8
-  ELIFECYCLE  Test failed. See above for more details.
1
+
2
+ 
3
+ > @aiready/mcp-server@0.2.5 test /Users/pengcao/projects/aiready/packages/mcp-server
4
+ > vitest run
5
+
6
+ [?25l
7
+  RUN  v4.0.18 /Users/pengcao/projects/aiready/packages/mcp-server
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
+ ✓ src/__tests__/server.test.ts (5 tests) 1987ms
15
+ ✓ should execute pattern-detect and return results  1353ms
16
+
17
+  Test Files  1 passed (1)
18
+  Tests  5 passed (5)
19
+  Start at  22:07:58
20
+  Duration  2.34s (transform 174ms, setup 0ms, import 216ms, tests 1.99s, environment 0ms)
21
+
22
+ [?25h
package/dist/index.d.ts CHANGED
@@ -6,6 +6,7 @@ import { Server } from '@modelcontextprotocol/sdk/server/index.js';
6
6
  declare class AIReadyMcpServer {
7
7
  private server;
8
8
  constructor();
9
+ private handleRemediation;
9
10
  private setupHandlers;
10
11
  run(): Promise<void>;
11
12
  getServer(): Server;
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: toolsToAdvertise.map((id) => ({
66
- name: id,
67
- description: `AIReady analysis tool: ${id}`,
68
- inputSchema: {
69
- type: "object",
70
- properties: {
71
- path: {
72
- type: "string",
73
- description: "Path to the directory to analyze"
74
- }
75
- // Future: expose tool-specific options
76
- },
77
- required: ["path"]
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.5",
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.6",
17
- "@aiready/context-analyzer": "0.22.6",
18
- "@aiready/core": "0.24.6",
19
- "@aiready/pattern-detect": "0.17.6"
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: toolsToAdvertise.map((id) => ({
81
- name: id,
82
- description: `AIReady analysis tool: ${id}`,
83
- inputSchema: {
84
- type: 'object',
85
- properties: {
86
- path: {
87
- type: 'string',
88
- description: 'Path to the directory to analyze',
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
- // Future: expose tool-specific options
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)