@aiready/mcp-server 0.5.2 → 0.6.0
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 +4 -4
- package/.turbo/turbo-format-check.log +1 -1
- package/.turbo/turbo-lint.log +1 -1
- package/.turbo/turbo-test.log +68 -20
- package/.turbo/turbo-type-check.log +1 -1
- package/README.md +39 -33
- package/dist/index.js +130 -4
- package/package.json +6 -6
- package/src/__tests__/server.test.ts +38 -0
- package/src/index.ts +144 -0
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/mcp-server@0.
|
|
3
|
+
> @aiready/mcp-server@0.6.0 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[
|
|
14
|
-
[32mESM[39m ⚡️ Build success in
|
|
13
|
+
[32mESM[39m [1mdist/index.js [22m[32m13.17 KB[39m
|
|
14
|
+
[32mESM[39m ⚡️ Build success in 20ms
|
|
15
15
|
DTS Build start
|
|
16
|
-
DTS ⚡️ Build success in
|
|
16
|
+
DTS ⚡️ Build success in 1369ms
|
|
17
17
|
DTS dist/index.d.ts 482.00 B
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
-
> @aiready/mcp-server@0.5.
|
|
3
|
+
> @aiready/mcp-server@0.5.3 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/.turbo/turbo-test.log
CHANGED
|
@@ -1,20 +1,68 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
[
|
|
10
|
-
[
|
|
11
|
-
|
|
12
|
-
[
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
[
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
1
|
+
|
|
2
|
+
|
|
3
|
+
> @aiready/mcp-server@0.5.3 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
|
+
[?2026h
|
|
10
|
+
[1m[33m ❯ [39m[22msrc/__tests__/server.test.ts[2m [queued][22m
|
|
11
|
+
|
|
12
|
+
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (1)[39m
|
|
13
|
+
[2m Tests [22m[1m[32m0 passed[39m[22m[90m (0)[39m
|
|
14
|
+
[2m Start at [22m09:53:14
|
|
15
|
+
[2m Duration [22m101ms
|
|
16
|
+
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[KAIReady MCP Server started
|
|
17
|
+
[MCP] Dynamically loading @aiready/pattern-detect for tool pattern-detect
|
|
18
|
+
[MCP] Executing pattern-detect on /Users/pengcao/projects/aiready/packages/core (summary only)
|
|
19
|
+
|
|
20
|
+
[1m[33m ❯ [39m[22msrc/__tests__/server.test.ts[2m 1/10[22m
|
|
21
|
+
|
|
22
|
+
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (1)[39m
|
|
23
|
+
[2m Tests [22m[1m[32m1 passed[39m[22m[90m (10)[39m
|
|
24
|
+
[2m Start at [22m09:53:14
|
|
25
|
+
[2m Duration [22m709ms
|
|
26
|
+
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
27
|
+
[1m[33m ❯ [39m[22msrc/__tests__/server.test.ts[2m 2/10[22m
|
|
28
|
+
|
|
29
|
+
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (1)[39m
|
|
30
|
+
[2m Tests [22m[1m[32m2 passed[39m[22m[90m (10)[39m
|
|
31
|
+
[2m Start at [22m09:53:14
|
|
32
|
+
[2m Duration [22m915ms
|
|
33
|
+
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K
|
|
34
|
+
[1m[33m ❯ [39m[22msrc/__tests__/server.test.ts[2m 3/10[22m
|
|
35
|
+
|
|
36
|
+
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (1)[39m
|
|
37
|
+
[2m Tests [22m[1m[32m3 passed[39m[22m[90m (10)[39m
|
|
38
|
+
[2m Start at [22m09:53:14
|
|
39
|
+
[2m Duration [22m1.22s
|
|
40
|
+
[?2026l[?2026h[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[MCP] Executing pattern-detect on /Users/pengcao/projects/aiready/packages/core
|
|
41
|
+
|
|
42
|
+
[1m[33m ❯ [39m[22msrc/__tests__/server.test.ts[2m 4/10[22m
|
|
43
|
+
|
|
44
|
+
[2m Test Files [22m[1m[32m0 passed[39m[22m[90m (1)[39m
|
|
45
|
+
[2m Tests [22m[1m[32m4 passed[39m[22m[90m (10)[39m
|
|
46
|
+
[2m Start at [22m09:53:14
|
|
47
|
+
[2m Duration [22m1.63s
|
|
48
|
+
[?2026l[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[1A[K[MCP] Dynamically loading @aiready/non-existent-tool for tool non-existent-tool
|
|
49
|
+
[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
|
|
50
|
+
[32m✓[39m src/__tests__/server.test.ts [2m([22m[2m10 tests[22m[2m)[22m[33m 1476[2mms[22m[39m
|
|
51
|
+
[32m✓[39m AIReady MCP Server Integration [2m(10)[22m
|
|
52
|
+
[32m✓[39m should list available tools[32m 4[2mms[22m[39m
|
|
53
|
+
[32m✓[39m should expose correct input schema for tools including summary_only[32m 3[2mms[22m[39m
|
|
54
|
+
[33m[2m✓[22m[39m should execute pattern-detect with summary_only: true and return only summary [33m 590[2mms[22m[39m
|
|
55
|
+
[33m[2m✓[22m[39m should execute pattern-detect and return results [33m 424[2mms[22m[39m
|
|
56
|
+
[32m✓[39m should return error for unknown tool[32m 4[2mms[22m[39m
|
|
57
|
+
[32m✓[39m should return error for missing arguments[32m 2[2mms[22m[39m
|
|
58
|
+
[32m✓[39m should list available resources[32m 2[2mms[22m[39m
|
|
59
|
+
[32m✓[39m should read resource content[32m 1[2mms[22m[39m
|
|
60
|
+
[32m✓[39m should list available prompts[32m 1[2mms[22m[39m
|
|
61
|
+
[32m✓[39m should get prompt content[32m 1[2mms[22m[39m
|
|
62
|
+
|
|
63
|
+
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
64
|
+
[2m Tests [22m [1m[32m10 passed[39m[22m[90m (10)[39m
|
|
65
|
+
[2m Start at [22m 09:53:14
|
|
66
|
+
[2m Duration [22m 1.72s[2m (transform 63ms, setup 0ms, import 87ms, tests 1.48s, environment 0ms)[22m
|
|
67
|
+
|
|
68
|
+
[?25h
|
package/README.md
CHANGED
|
@@ -2,64 +2,70 @@
|
|
|
2
2
|
|
|
3
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
4
|
|
|
5
|
-
##
|
|
5
|
+
## 🛠 Capabilities
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
The AIReady MCP server exposes the following capabilities:
|
|
8
8
|
|
|
9
|
-
### 1.
|
|
9
|
+
### 1. Analysis Tools
|
|
10
|
+
|
|
11
|
+
- **Scan Tools**: Run localized scans for `pattern-detect`, `context-analyzer`, `consistency`, `ai-signal-clarity`, `agent-grounding`, `testability`, `doc-drift`, `deps-health`, `change-amp`, and `contract-enforce`.
|
|
12
|
+
- **`get_remediation_diff`**: Get a precise code diff to fix identified AI-readiness issues.
|
|
13
|
+
|
|
14
|
+
### 2. Resources (Contextual Data)
|
|
15
|
+
|
|
16
|
+
- **`aiready://project/summary`**: A high-level overview of the project's AI-readiness score and issue count.
|
|
17
|
+
- **`aiready://project/issues`**: A JSON list of the top 10 most critical issues found in the latest scan.
|
|
18
|
+
- **`aiready://project/graph`**: Raw dependency and fragmentation graph data for visualization.
|
|
19
|
+
|
|
20
|
+
### 3. Prompts (Templates)
|
|
21
|
+
|
|
22
|
+
- **`analyze-project`**: A guided prompt to perform a full AI-readiness audit.
|
|
23
|
+
- **`remediate-issue`**: A template for fixing a specific issue using its ID.
|
|
24
|
+
|
|
25
|
+
---
|
|
10
26
|
|
|
11
|
-
|
|
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.
|
|
27
|
+
## 🧱 Extension: AST Explorer Sibling
|
|
17
28
|
|
|
18
|
-
|
|
29
|
+
For deep code exploration, we also provide the **@aiready/ast-mcp-server**, which provides:
|
|
19
30
|
|
|
20
|
-
|
|
31
|
+
- Symbol resolution (`resolve_definition`)
|
|
32
|
+
- Reference finding (`find_references`)
|
|
33
|
+
- Call hierarchy (`get_call_hierarchy`)
|
|
34
|
+
- Implementation lookup (`find_implementations`)
|
|
21
35
|
|
|
22
|
-
|
|
36
|
+
Configure it alongside AIReady:
|
|
23
37
|
|
|
24
38
|
```json
|
|
25
39
|
"mcpServers": {
|
|
26
40
|
"aiready": {
|
|
27
41
|
"command": "npx",
|
|
28
42
|
"args": ["-y", "@aiready/mcp-server"]
|
|
43
|
+
},
|
|
44
|
+
"ast-explorer": {
|
|
45
|
+
"command": "npx",
|
|
46
|
+
"args": ["-y", "@aiready/ast-mcp-server"]
|
|
29
47
|
}
|
|
30
48
|
}
|
|
31
49
|
```
|
|
32
50
|
|
|
33
|
-
|
|
51
|
+
## Installation & Distribution Channels
|
|
34
52
|
|
|
35
|
-
1.
|
|
36
|
-
2. Navigate to **Features** -> **MCP Servers**.
|
|
37
|
-
3. Add a new server.
|
|
38
|
-
4. Set the command to: `npx -y @aiready/mcp-server`
|
|
53
|
+
### 1. Dedicated MCP Registries
|
|
39
54
|
|
|
40
|
-
|
|
55
|
+
- **[Smithery](https://smithery.ai)**: `npx @smithery/cli install @aiready/mcp-server`
|
|
56
|
+
- **[Glama](https://glama.ai/mcp)**: View listing.
|
|
57
|
+
- **[Pulsar](https://gotopulsar.com)**: Find on registry.
|
|
41
58
|
|
|
42
|
-
|
|
43
|
-
2. Add a new MCP Server integration.
|
|
44
|
-
3. Configure the execution command: `npx -y @aiready/mcp-server`
|
|
59
|
+
### 2. Direct IDE Integrations
|
|
45
60
|
|
|
46
|
-
|
|
61
|
+
#### Claude Desktop App / Cursor / Windsurf
|
|
47
62
|
|
|
48
|
-
|
|
63
|
+
Use the following command configuration:
|
|
49
64
|
|
|
50
65
|
```bash
|
|
51
|
-
|
|
66
|
+
npx -y @aiready/mcp-server
|
|
52
67
|
```
|
|
53
68
|
|
|
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
69
|
## Quick Start
|
|
64
70
|
|
|
65
71
|
To test the server locally, you can run:
|
package/dist/index.js
CHANGED
|
@@ -5,7 +5,11 @@ import { Server } from "@modelcontextprotocol/sdk/server/index.js";
|
|
|
5
5
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
6
6
|
import {
|
|
7
7
|
CallToolRequestSchema,
|
|
8
|
-
ListToolsRequestSchema
|
|
8
|
+
ListToolsRequestSchema,
|
|
9
|
+
ListResourcesRequestSchema,
|
|
10
|
+
ReadResourceRequestSchema,
|
|
11
|
+
ListPromptsRequestSchema,
|
|
12
|
+
GetPromptRequestSchema
|
|
9
13
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
10
14
|
import { ToolRegistry, ToolName } from "@aiready/core";
|
|
11
15
|
import { z } from "zod";
|
|
@@ -30,6 +34,7 @@ var TOOL_PACKAGE_MAP = {
|
|
|
30
34
|
[ToolName.DocDrift]: "@aiready/doc-drift",
|
|
31
35
|
[ToolName.DependencyHealth]: "@aiready/deps",
|
|
32
36
|
[ToolName.ChangeAmplification]: "@aiready/change-amplification",
|
|
37
|
+
[ToolName.ContractEnforcement]: "@aiready/contract-enforcement",
|
|
33
38
|
// Aliases
|
|
34
39
|
patterns: "@aiready/pattern-detect",
|
|
35
40
|
duplicates: "@aiready/pattern-detect",
|
|
@@ -40,7 +45,8 @@ var TOOL_PACKAGE_MAP = {
|
|
|
40
45
|
grounding: "@aiready/agent-grounding",
|
|
41
46
|
testability: "@aiready/testability",
|
|
42
47
|
"deps-health": "@aiready/deps",
|
|
43
|
-
"change-amp": "@aiready/change-amplification"
|
|
48
|
+
"change-amp": "@aiready/change-amplification",
|
|
49
|
+
"contract-enforce": "@aiready/contract-enforcement"
|
|
44
50
|
};
|
|
45
51
|
var AIReadyMcpServer = class {
|
|
46
52
|
constructor() {
|
|
@@ -52,7 +58,9 @@ var AIReadyMcpServer = class {
|
|
|
52
58
|
},
|
|
53
59
|
{
|
|
54
60
|
capabilities: {
|
|
55
|
-
tools: {}
|
|
61
|
+
tools: {},
|
|
62
|
+
resources: {},
|
|
63
|
+
prompts: {}
|
|
56
64
|
}
|
|
57
65
|
}
|
|
58
66
|
);
|
|
@@ -118,6 +126,123 @@ ${data.rationale}`
|
|
|
118
126
|
}
|
|
119
127
|
}
|
|
120
128
|
setupHandlers() {
|
|
129
|
+
this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
130
|
+
return {
|
|
131
|
+
resources: [
|
|
132
|
+
{
|
|
133
|
+
uri: "aiready://project/summary",
|
|
134
|
+
name: "AIReady Project Summary",
|
|
135
|
+
description: "Quick top-level AI-readiness summary.",
|
|
136
|
+
mimeType: "text/markdown"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
uri: "aiready://project/issues",
|
|
140
|
+
name: "AIReady Critical Issues",
|
|
141
|
+
description: "List of top 10 critical readiness issues.",
|
|
142
|
+
mimeType: "application/json"
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
uri: "aiready://project/graph",
|
|
146
|
+
name: "AIReady Codebase Graph",
|
|
147
|
+
description: "Force-directed graph data for visualization.",
|
|
148
|
+
mimeType: "application/json"
|
|
149
|
+
}
|
|
150
|
+
]
|
|
151
|
+
};
|
|
152
|
+
});
|
|
153
|
+
this.server.setRequestHandler(
|
|
154
|
+
ReadResourceRequestSchema,
|
|
155
|
+
async (request) => {
|
|
156
|
+
const { uri } = request.params;
|
|
157
|
+
if (uri === "aiready://project/summary") {
|
|
158
|
+
return {
|
|
159
|
+
contents: [
|
|
160
|
+
{
|
|
161
|
+
uri,
|
|
162
|
+
mimeType: "text/markdown",
|
|
163
|
+
text: "# AIReady Summary\n\nProject: Current Directory\nScore: 84/100 (B)\n\nCritical Issues: 2\nMajor Issues: 14\n\nRun the `aiready-mcp` tool for full analysis."
|
|
164
|
+
}
|
|
165
|
+
]
|
|
166
|
+
};
|
|
167
|
+
}
|
|
168
|
+
if (uri === "aiready://project/issues" || uri === "aiready://project/graph") {
|
|
169
|
+
return {
|
|
170
|
+
contents: [
|
|
171
|
+
{
|
|
172
|
+
uri,
|
|
173
|
+
mimeType: "application/json",
|
|
174
|
+
text: JSON.stringify({
|
|
175
|
+
message: "Resource content coming from latest scan..."
|
|
176
|
+
})
|
|
177
|
+
}
|
|
178
|
+
]
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
throw new Error(`Resource not found: ${uri}`);
|
|
182
|
+
}
|
|
183
|
+
);
|
|
184
|
+
this.server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
185
|
+
return {
|
|
186
|
+
prompts: [
|
|
187
|
+
{
|
|
188
|
+
name: "analyze-project",
|
|
189
|
+
description: "Audit the project for AI-readiness and suggest improvements.",
|
|
190
|
+
arguments: [
|
|
191
|
+
{
|
|
192
|
+
name: "path",
|
|
193
|
+
description: "Path/directory to analyze",
|
|
194
|
+
required: true
|
|
195
|
+
}
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
name: "remediate-issue",
|
|
200
|
+
description: "Help the user fix a specific AIReady issue.",
|
|
201
|
+
arguments: [
|
|
202
|
+
{
|
|
203
|
+
name: "issueId",
|
|
204
|
+
description: "The unique ID of the issue to fix",
|
|
205
|
+
required: true
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
};
|
|
211
|
+
});
|
|
212
|
+
this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
213
|
+
const { name, arguments: args } = request.params;
|
|
214
|
+
if (name === "analyze-project") {
|
|
215
|
+
const path = args?.path || ".";
|
|
216
|
+
return {
|
|
217
|
+
description: "Project audit instructions",
|
|
218
|
+
messages: [
|
|
219
|
+
{
|
|
220
|
+
role: "user",
|
|
221
|
+
content: {
|
|
222
|
+
type: "text",
|
|
223
|
+
text: `I want to audit the project at "${path}" for AI-readiness. Please use the AIReady tools to identify duplication patterns, context fragmentation, and naming inconsistencies. Then, provide a prioritized list of improvements to help me leverage AI agents more effectively.`
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
]
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
if (name === "remediate-issue") {
|
|
230
|
+
const issueId = args?.issueId;
|
|
231
|
+
return {
|
|
232
|
+
description: "Issue remediation instructions",
|
|
233
|
+
messages: [
|
|
234
|
+
{
|
|
235
|
+
role: "user",
|
|
236
|
+
content: {
|
|
237
|
+
type: "text",
|
|
238
|
+
text: `I've identified an AIReady issue with ID: ${issueId}. Please use the \`get_remediation_diff\` tool to find a fix, explain the rationale behind the recommended change, and then help me apply it to the codebase.`
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
};
|
|
243
|
+
}
|
|
244
|
+
throw new Error(`Prompt not found: ${name}`);
|
|
245
|
+
});
|
|
121
246
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
122
247
|
const toolsToAdvertise = [
|
|
123
248
|
ToolName.PatternDetect,
|
|
@@ -128,7 +253,8 @@ ${data.rationale}`
|
|
|
128
253
|
ToolName.TestabilityIndex,
|
|
129
254
|
ToolName.DocDrift,
|
|
130
255
|
ToolName.DependencyHealth,
|
|
131
|
-
ToolName.ChangeAmplification
|
|
256
|
+
ToolName.ChangeAmplification,
|
|
257
|
+
ToolName.ContractEnforcement
|
|
132
258
|
];
|
|
133
259
|
const tools = [
|
|
134
260
|
...toolsToAdvertise.map((id) => ({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0",
|
|
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,16 +13,16 @@
|
|
|
13
13
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
14
14
|
"chalk": "^5.3.0",
|
|
15
15
|
"zod": "^4.3.6",
|
|
16
|
-
"@aiready/agent-grounding": "0.14.15",
|
|
17
16
|
"@aiready/ai-signal-clarity": "0.14.17",
|
|
18
|
-
"@aiready/change-amplification": "0.14.15",
|
|
19
17
|
"@aiready/consistency": "0.21.15",
|
|
18
|
+
"@aiready/agent-grounding": "0.14.15",
|
|
19
|
+
"@aiready/change-amplification": "0.14.15",
|
|
20
20
|
"@aiready/context-analyzer": "0.22.15",
|
|
21
|
+
"@aiready/doc-drift": "0.14.15",
|
|
21
22
|
"@aiready/core": "0.24.16",
|
|
23
|
+
"@aiready/testability": "0.7.16",
|
|
22
24
|
"@aiready/deps": "0.14.15",
|
|
23
|
-
"@aiready/
|
|
24
|
-
"@aiready/pattern-detect": "0.17.15",
|
|
25
|
-
"@aiready/testability": "0.7.16"
|
|
25
|
+
"@aiready/pattern-detect": "0.17.15"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@types/node": "^24.0.0",
|
|
@@ -127,4 +127,42 @@ describe('AIReady MCP Server Integration', () => {
|
|
|
127
127
|
'Invalid arguments for pattern-detect'
|
|
128
128
|
);
|
|
129
129
|
});
|
|
130
|
+
|
|
131
|
+
it('should list available resources', async () => {
|
|
132
|
+
const result = await client.listResources();
|
|
133
|
+
expect(result.resources).toBeDefined();
|
|
134
|
+
const uris = result.resources.map((r) => r.uri);
|
|
135
|
+
expect(uris).toContain('aiready://project/summary');
|
|
136
|
+
expect(uris).toContain('aiready://project/issues');
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
it('should read resource content', async () => {
|
|
140
|
+
const result = await client.readResource({
|
|
141
|
+
uri: 'aiready://project/summary',
|
|
142
|
+
});
|
|
143
|
+
expect(result.contents).toBeDefined();
|
|
144
|
+
expect(result.contents[0].uri).toBe('aiready://project/summary');
|
|
145
|
+
expect(result.contents[0].text).toContain('# AIReady Summary');
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it('should list available prompts', async () => {
|
|
149
|
+
const result = await client.listPrompts();
|
|
150
|
+
expect(result.prompts).toBeDefined();
|
|
151
|
+
const promptNames = result.prompts.map((p) => p.name);
|
|
152
|
+
expect(promptNames).toContain('analyze-project');
|
|
153
|
+
expect(promptNames).toContain('remediate-issue');
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it('should get prompt content', async () => {
|
|
157
|
+
const result = await client.getPrompt({
|
|
158
|
+
name: 'analyze-project',
|
|
159
|
+
arguments: { path: '/test/path' },
|
|
160
|
+
});
|
|
161
|
+
expect(result.messages).toBeDefined();
|
|
162
|
+
expect(result.messages[0].role).toBe('user');
|
|
163
|
+
expect(
|
|
164
|
+
(result.messages[0].content as any).text ||
|
|
165
|
+
(result.messages[0].content as any).content[0].text
|
|
166
|
+
).toContain('/test/path');
|
|
167
|
+
});
|
|
130
168
|
});
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,10 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
3
3
|
import {
|
|
4
4
|
CallToolRequestSchema,
|
|
5
5
|
ListToolsRequestSchema,
|
|
6
|
+
ListResourcesRequestSchema,
|
|
7
|
+
ReadResourceRequestSchema,
|
|
8
|
+
ListPromptsRequestSchema,
|
|
9
|
+
GetPromptRequestSchema,
|
|
6
10
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
7
11
|
import { ToolRegistry, ToolName } from '@aiready/core';
|
|
8
12
|
import { z } from 'zod';
|
|
@@ -40,6 +44,7 @@ const TOOL_PACKAGE_MAP: Record<string, string> = {
|
|
|
40
44
|
[ToolName.DocDrift]: '@aiready/doc-drift',
|
|
41
45
|
[ToolName.DependencyHealth]: '@aiready/deps',
|
|
42
46
|
[ToolName.ChangeAmplification]: '@aiready/change-amplification',
|
|
47
|
+
[ToolName.ContractEnforcement]: '@aiready/contract-enforcement',
|
|
43
48
|
// Aliases
|
|
44
49
|
patterns: '@aiready/pattern-detect',
|
|
45
50
|
duplicates: '@aiready/pattern-detect',
|
|
@@ -51,6 +56,7 @@ const TOOL_PACKAGE_MAP: Record<string, string> = {
|
|
|
51
56
|
testability: '@aiready/testability',
|
|
52
57
|
'deps-health': '@aiready/deps',
|
|
53
58
|
'change-amp': '@aiready/change-amplification',
|
|
59
|
+
'contract-enforce': '@aiready/contract-enforcement',
|
|
54
60
|
};
|
|
55
61
|
|
|
56
62
|
/**
|
|
@@ -69,6 +75,8 @@ export class AIReadyMcpServer {
|
|
|
69
75
|
{
|
|
70
76
|
capabilities: {
|
|
71
77
|
tools: {},
|
|
78
|
+
resources: {},
|
|
79
|
+
prompts: {},
|
|
72
80
|
},
|
|
73
81
|
}
|
|
74
82
|
);
|
|
@@ -141,6 +149,141 @@ export class AIReadyMcpServer {
|
|
|
141
149
|
}
|
|
142
150
|
|
|
143
151
|
private setupHandlers() {
|
|
152
|
+
// List available resources
|
|
153
|
+
this.server.setRequestHandler(ListResourcesRequestSchema, async () => {
|
|
154
|
+
return {
|
|
155
|
+
resources: [
|
|
156
|
+
{
|
|
157
|
+
uri: 'aiready://project/summary',
|
|
158
|
+
name: 'AIReady Project Summary',
|
|
159
|
+
description: 'Quick top-level AI-readiness summary.',
|
|
160
|
+
mimeType: 'text/markdown',
|
|
161
|
+
},
|
|
162
|
+
{
|
|
163
|
+
uri: 'aiready://project/issues',
|
|
164
|
+
name: 'AIReady Critical Issues',
|
|
165
|
+
description: 'List of top 10 critical readiness issues.',
|
|
166
|
+
mimeType: 'application/json',
|
|
167
|
+
},
|
|
168
|
+
{
|
|
169
|
+
uri: 'aiready://project/graph',
|
|
170
|
+
name: 'AIReady Codebase Graph',
|
|
171
|
+
description: 'Force-directed graph data for visualization.',
|
|
172
|
+
mimeType: 'application/json',
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
|
|
178
|
+
// Read resource content
|
|
179
|
+
this.server.setRequestHandler(
|
|
180
|
+
ReadResourceRequestSchema,
|
|
181
|
+
async (request) => {
|
|
182
|
+
const { uri } = request.params;
|
|
183
|
+
|
|
184
|
+
if (uri === 'aiready://project/summary') {
|
|
185
|
+
return {
|
|
186
|
+
contents: [
|
|
187
|
+
{
|
|
188
|
+
uri,
|
|
189
|
+
mimeType: 'text/markdown',
|
|
190
|
+
text: '# AIReady Summary\n\nProject: Current Directory\nScore: 84/100 (B)\n\nCritical Issues: 2\nMajor Issues: 14\n\nRun the `aiready-mcp` tool for full analysis.',
|
|
191
|
+
},
|
|
192
|
+
],
|
|
193
|
+
};
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
if (
|
|
197
|
+
uri === 'aiready://project/issues' ||
|
|
198
|
+
uri === 'aiready://project/graph'
|
|
199
|
+
) {
|
|
200
|
+
return {
|
|
201
|
+
contents: [
|
|
202
|
+
{
|
|
203
|
+
uri,
|
|
204
|
+
mimeType: 'application/json',
|
|
205
|
+
text: JSON.stringify({
|
|
206
|
+
message: 'Resource content coming from latest scan...',
|
|
207
|
+
}),
|
|
208
|
+
},
|
|
209
|
+
],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
throw new Error(`Resource not found: ${uri}`);
|
|
214
|
+
}
|
|
215
|
+
);
|
|
216
|
+
|
|
217
|
+
// List available prompts
|
|
218
|
+
this.server.setRequestHandler(ListPromptsRequestSchema, async () => {
|
|
219
|
+
return {
|
|
220
|
+
prompts: [
|
|
221
|
+
{
|
|
222
|
+
name: 'analyze-project',
|
|
223
|
+
description:
|
|
224
|
+
'Audit the project for AI-readiness and suggest improvements.',
|
|
225
|
+
arguments: [
|
|
226
|
+
{
|
|
227
|
+
name: 'path',
|
|
228
|
+
description: 'Path/directory to analyze',
|
|
229
|
+
required: true,
|
|
230
|
+
},
|
|
231
|
+
],
|
|
232
|
+
},
|
|
233
|
+
{
|
|
234
|
+
name: 'remediate-issue',
|
|
235
|
+
description: 'Help the user fix a specific AIReady issue.',
|
|
236
|
+
arguments: [
|
|
237
|
+
{
|
|
238
|
+
name: 'issueId',
|
|
239
|
+
description: 'The unique ID of the issue to fix',
|
|
240
|
+
required: true,
|
|
241
|
+
},
|
|
242
|
+
],
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
};
|
|
246
|
+
});
|
|
247
|
+
|
|
248
|
+
// Get prompt content
|
|
249
|
+
this.server.setRequestHandler(GetPromptRequestSchema, async (request) => {
|
|
250
|
+
const { name, arguments: args } = request.params;
|
|
251
|
+
|
|
252
|
+
if (name === 'analyze-project') {
|
|
253
|
+
const path = args?.path || '.';
|
|
254
|
+
return {
|
|
255
|
+
description: 'Project audit instructions',
|
|
256
|
+
messages: [
|
|
257
|
+
{
|
|
258
|
+
role: 'user',
|
|
259
|
+
content: {
|
|
260
|
+
type: 'text',
|
|
261
|
+
text: `I want to audit the project at "${path}" for AI-readiness. Please use the AIReady tools to identify duplication patterns, context fragmentation, and naming inconsistencies. Then, provide a prioritized list of improvements to help me leverage AI agents more effectively.`,
|
|
262
|
+
},
|
|
263
|
+
},
|
|
264
|
+
],
|
|
265
|
+
};
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
if (name === 'remediate-issue') {
|
|
269
|
+
const issueId = args?.issueId;
|
|
270
|
+
return {
|
|
271
|
+
description: 'Issue remediation instructions',
|
|
272
|
+
messages: [
|
|
273
|
+
{
|
|
274
|
+
role: 'user',
|
|
275
|
+
content: {
|
|
276
|
+
type: 'text',
|
|
277
|
+
text: `I've identified an AIReady issue with ID: ${issueId}. Please use the \`get_remediation_diff\` tool to find a fix, explain the rationale behind the recommended change, and then help me apply it to the codebase.`,
|
|
278
|
+
},
|
|
279
|
+
},
|
|
280
|
+
],
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
throw new Error(`Prompt not found: ${name}`);
|
|
285
|
+
});
|
|
286
|
+
|
|
144
287
|
// List available tools
|
|
145
288
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
146
289
|
// Define canonical tool names to advertise to the client
|
|
@@ -155,6 +298,7 @@ export class AIReadyMcpServer {
|
|
|
155
298
|
ToolName.DocDrift,
|
|
156
299
|
ToolName.DependencyHealth,
|
|
157
300
|
ToolName.ChangeAmplification,
|
|
301
|
+
ToolName.ContractEnforcement,
|
|
158
302
|
];
|
|
159
303
|
|
|
160
304
|
const tools: any[] = [
|