@aiready/mcp-server 0.1.18 → 0.1.20
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-lint.log +4 -5
- package/.turbo/turbo-test.log +20 -19
- package/dist/index.js +58 -10
- package/package.json +5 -5
- package/src/index.ts +70 -13
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 430.00 B
|
|
1
|
+
|
|
2
|
+
> @aiready/mcp-server@0.1.20 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 21ms
|
|
14
|
+
DTS Build start
|
|
15
|
+
DTS ⚡️ Build success in 1852ms
|
|
16
|
+
DTS dist/index.d.ts 430.00 B
|
package/.turbo/turbo-lint.log
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
|
|
2
|
+
> @aiready/mcp-server@0.1.19 lint /Users/pengcao/projects/aiready/packages/mcp-server
|
|
3
|
+
> eslint src
|
|
4
|
+
|
package/.turbo/turbo-test.log
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
>
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[MCP] Executing pattern-detect on /Users/pengcao/projects/aiready/packages/core
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
[2m
|
|
15
|
-
|
|
16
|
-
[2m
|
|
17
|
-
[2m
|
|
18
|
-
|
|
19
|
-
[
|
|
1
|
+
|
|
2
|
+
> @aiready/mcp-server@0.1.19 test /Users/pengcao/projects/aiready/packages/mcp-server
|
|
3
|
+
> vitest run
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
[1m[46m RUN [49m[22m [36mv4.0.18 [39m[90m/Users/pengcao/projects/aiready/packages/mcp-server[39m
|
|
7
|
+
|
|
8
|
+
AIReady MCP Server started
|
|
9
|
+
[MCP] Dynamically loading @aiready/pattern-detect for tool pattern-detect
|
|
10
|
+
[MCP] Executing pattern-detect on /Users/pengcao/projects/aiready/packages/core
|
|
11
|
+
[MCP] Dynamically loading @aiready/non-existent-tool for tool non-existent-tool
|
|
12
|
+
[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
|
|
13
|
+
[32m✓[39m src/__tests__/server.test.ts [2m([22m[2m5 tests[22m[2m)[22m[33m 760[2mms[22m[39m
|
|
14
|
+
[33m[2m✓[22m[39m should execute pattern-detect and return results [33m 423[2mms[22m[39m
|
|
15
|
+
|
|
16
|
+
[2m Test Files [22m [1m[32m1 passed[39m[22m[90m (1)[39m
|
|
17
|
+
[2m Tests [22m [1m[32m5 passed[39m[22m[90m (5)[39m
|
|
18
|
+
[2m Start at [22m 19:03:38
|
|
19
|
+
[2m Duration [22m 1.03s[2m (transform 38ms, setup 0ms, import 75ms, tests 760ms, environment 0ms)[22m
|
|
20
|
+
|
package/dist/index.js
CHANGED
|
@@ -7,10 +7,29 @@ import {
|
|
|
7
7
|
CallToolRequestSchema,
|
|
8
8
|
ListToolsRequestSchema
|
|
9
9
|
} from "@modelcontextprotocol/sdk/types.js";
|
|
10
|
-
import { ToolRegistry } from "@aiready/core";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
import { ToolRegistry, ToolName } from "@aiready/core";
|
|
11
|
+
var TOOL_PACKAGE_MAP = {
|
|
12
|
+
[ToolName.PatternDetect]: "@aiready/pattern-detect",
|
|
13
|
+
[ToolName.ContextAnalyzer]: "@aiready/context-analyzer",
|
|
14
|
+
[ToolName.NamingConsistency]: "@aiready/consistency",
|
|
15
|
+
[ToolName.AiSignalClarity]: "@aiready/ai-signal-clarity",
|
|
16
|
+
[ToolName.AgentGrounding]: "@aiready/agent-grounding",
|
|
17
|
+
[ToolName.TestabilityIndex]: "@aiready/testability",
|
|
18
|
+
[ToolName.DocDrift]: "@aiready/doc-drift",
|
|
19
|
+
[ToolName.DependencyHealth]: "@aiready/deps",
|
|
20
|
+
[ToolName.ChangeAmplification]: "@aiready/change-amplification",
|
|
21
|
+
// Aliases
|
|
22
|
+
patterns: "@aiready/pattern-detect",
|
|
23
|
+
duplicates: "@aiready/pattern-detect",
|
|
24
|
+
context: "@aiready/context-analyzer",
|
|
25
|
+
fragmentation: "@aiready/context-analyzer",
|
|
26
|
+
consistency: "@aiready/consistency",
|
|
27
|
+
"ai-signal": "@aiready/ai-signal-clarity",
|
|
28
|
+
grounding: "@aiready/agent-grounding",
|
|
29
|
+
testability: "@aiready/testability",
|
|
30
|
+
"deps-health": "@aiready/deps",
|
|
31
|
+
"change-amp": "@aiready/change-amplification"
|
|
32
|
+
};
|
|
14
33
|
var AIReadyMcpServer = class {
|
|
15
34
|
constructor() {
|
|
16
35
|
this.server = new Server(
|
|
@@ -31,11 +50,21 @@ var AIReadyMcpServer = class {
|
|
|
31
50
|
}
|
|
32
51
|
setupHandlers() {
|
|
33
52
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
34
|
-
const
|
|
53
|
+
const toolsToAdvertise = [
|
|
54
|
+
ToolName.PatternDetect,
|
|
55
|
+
ToolName.ContextAnalyzer,
|
|
56
|
+
ToolName.NamingConsistency,
|
|
57
|
+
ToolName.AiSignalClarity,
|
|
58
|
+
ToolName.AgentGrounding,
|
|
59
|
+
ToolName.TestabilityIndex,
|
|
60
|
+
ToolName.DocDrift,
|
|
61
|
+
ToolName.DependencyHealth,
|
|
62
|
+
ToolName.ChangeAmplification
|
|
63
|
+
];
|
|
35
64
|
return {
|
|
36
|
-
tools:
|
|
37
|
-
name:
|
|
38
|
-
description: `AIReady analysis tool: ${
|
|
65
|
+
tools: toolsToAdvertise.map((id) => ({
|
|
66
|
+
name: id,
|
|
67
|
+
description: `AIReady analysis tool: ${id}`,
|
|
39
68
|
inputSchema: {
|
|
40
69
|
type: "object",
|
|
41
70
|
properties: {
|
|
@@ -53,9 +82,28 @@ var AIReadyMcpServer = class {
|
|
|
53
82
|
this.server.setRequestHandler(CallToolRequestSchema, async (request) => {
|
|
54
83
|
const { name, arguments: args } = request.params;
|
|
55
84
|
try {
|
|
56
|
-
|
|
85
|
+
let provider = ToolRegistry.find(name);
|
|
86
|
+
if (!provider) {
|
|
87
|
+
const packageName = TOOL_PACKAGE_MAP[name] ?? (name.startsWith("@aiready/") ? name : `@aiready/${name}`);
|
|
88
|
+
try {
|
|
89
|
+
console.error(
|
|
90
|
+
`[MCP] Dynamically loading ${packageName} for tool ${name}`
|
|
91
|
+
);
|
|
92
|
+
await import(packageName);
|
|
93
|
+
provider = ToolRegistry.find(name);
|
|
94
|
+
} catch (importError) {
|
|
95
|
+
console.error(
|
|
96
|
+
`[MCP] Failed to load tool package ${packageName}: ${importError.message}`
|
|
97
|
+
);
|
|
98
|
+
const error = new Error(
|
|
99
|
+
`Tool ${name} not found and failed to load package ${packageName}: ${importError.message}`
|
|
100
|
+
);
|
|
101
|
+
error.cause = importError;
|
|
102
|
+
throw error;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
57
105
|
if (!provider) {
|
|
58
|
-
throw new Error(`Tool ${name} not found`);
|
|
106
|
+
throw new Error(`Tool ${name} not found after attempting to load`);
|
|
59
107
|
}
|
|
60
108
|
if (!args || typeof args.path !== "string") {
|
|
61
109
|
throw new Error("Missing required argument: path");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aiready/mcp-server",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.20",
|
|
4
4
|
"description": "AIReady Model Context Protocol (MCP) Server",
|
|
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/
|
|
17
|
-
"@aiready/
|
|
18
|
-
"@aiready/core": "0.23.
|
|
19
|
-
"@aiready/
|
|
16
|
+
"@aiready/consistency": "0.20.21",
|
|
17
|
+
"@aiready/context-analyzer": "0.21.25",
|
|
18
|
+
"@aiready/core": "0.23.22",
|
|
19
|
+
"@aiready/pattern-detect": "0.16.21"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^24.0.0",
|
package/src/index.ts
CHANGED
|
@@ -4,14 +4,34 @@ import {
|
|
|
4
4
|
CallToolRequestSchema,
|
|
5
5
|
ListToolsRequestSchema,
|
|
6
6
|
} from '@modelcontextprotocol/sdk/types.js';
|
|
7
|
-
import { ToolRegistry } from '@aiready/core';
|
|
7
|
+
import { ToolRegistry, ToolName } from '@aiready/core';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
/**
|
|
10
|
+
* Mapping between tool names and @aiready/ package names.
|
|
11
|
+
* Used for dynamic registration on-demand to minimize initial context budget.
|
|
12
|
+
*/
|
|
13
|
+
const TOOL_PACKAGE_MAP: Record<string, string> = {
|
|
14
|
+
[ToolName.PatternDetect]: '@aiready/pattern-detect',
|
|
15
|
+
[ToolName.ContextAnalyzer]: '@aiready/context-analyzer',
|
|
16
|
+
[ToolName.NamingConsistency]: '@aiready/consistency',
|
|
17
|
+
[ToolName.AiSignalClarity]: '@aiready/ai-signal-clarity',
|
|
18
|
+
[ToolName.AgentGrounding]: '@aiready/agent-grounding',
|
|
19
|
+
[ToolName.TestabilityIndex]: '@aiready/testability',
|
|
20
|
+
[ToolName.DocDrift]: '@aiready/doc-drift',
|
|
21
|
+
[ToolName.DependencyHealth]: '@aiready/deps',
|
|
22
|
+
[ToolName.ChangeAmplification]: '@aiready/change-amplification',
|
|
23
|
+
// Aliases
|
|
24
|
+
patterns: '@aiready/pattern-detect',
|
|
25
|
+
duplicates: '@aiready/pattern-detect',
|
|
26
|
+
context: '@aiready/context-analyzer',
|
|
27
|
+
fragmentation: '@aiready/context-analyzer',
|
|
28
|
+
consistency: '@aiready/consistency',
|
|
29
|
+
'ai-signal': '@aiready/ai-signal-clarity',
|
|
30
|
+
grounding: '@aiready/agent-grounding',
|
|
31
|
+
testability: '@aiready/testability',
|
|
32
|
+
'deps-health': '@aiready/deps',
|
|
33
|
+
'change-amp': '@aiready/change-amplification',
|
|
34
|
+
};
|
|
15
35
|
|
|
16
36
|
/**
|
|
17
37
|
* AIReady MCP Server Implementation
|
|
@@ -42,12 +62,24 @@ export class AIReadyMcpServer {
|
|
|
42
62
|
private setupHandlers() {
|
|
43
63
|
// List available tools
|
|
44
64
|
this.server.setRequestHandler(ListToolsRequestSchema, async () => {
|
|
45
|
-
|
|
65
|
+
// Define canonical tool names to advertise to the client
|
|
66
|
+
// These will be dynamically loaded on demand
|
|
67
|
+
const toolsToAdvertise = [
|
|
68
|
+
ToolName.PatternDetect,
|
|
69
|
+
ToolName.ContextAnalyzer,
|
|
70
|
+
ToolName.NamingConsistency,
|
|
71
|
+
ToolName.AiSignalClarity,
|
|
72
|
+
ToolName.AgentGrounding,
|
|
73
|
+
ToolName.TestabilityIndex,
|
|
74
|
+
ToolName.DocDrift,
|
|
75
|
+
ToolName.DependencyHealth,
|
|
76
|
+
ToolName.ChangeAmplification,
|
|
77
|
+
];
|
|
46
78
|
|
|
47
79
|
return {
|
|
48
|
-
tools:
|
|
49
|
-
name:
|
|
50
|
-
description: `AIReady analysis tool: ${
|
|
80
|
+
tools: toolsToAdvertise.map((id) => ({
|
|
81
|
+
name: id,
|
|
82
|
+
description: `AIReady analysis tool: ${id}`,
|
|
51
83
|
inputSchema: {
|
|
52
84
|
type: 'object',
|
|
53
85
|
properties: {
|
|
@@ -68,9 +100,34 @@ export class AIReadyMcpServer {
|
|
|
68
100
|
const { name, arguments: args } = request.params;
|
|
69
101
|
|
|
70
102
|
try {
|
|
71
|
-
|
|
103
|
+
let provider = ToolRegistry.find(name);
|
|
104
|
+
|
|
105
|
+
// Dynamic loading if not already registered (CLI pattern)
|
|
106
|
+
if (!provider) {
|
|
107
|
+
const packageName =
|
|
108
|
+
TOOL_PACKAGE_MAP[name] ??
|
|
109
|
+
(name.startsWith('@aiready/') ? name : `@aiready/${name}`);
|
|
110
|
+
|
|
111
|
+
try {
|
|
112
|
+
console.error(
|
|
113
|
+
`[MCP] Dynamically loading ${packageName} for tool ${name}`
|
|
114
|
+
);
|
|
115
|
+
await import(packageName);
|
|
116
|
+
provider = ToolRegistry.find(name);
|
|
117
|
+
} catch (importError: any) {
|
|
118
|
+
console.error(
|
|
119
|
+
`[MCP] Failed to load tool package ${packageName}: ${importError.message}`
|
|
120
|
+
);
|
|
121
|
+
const error = new Error(
|
|
122
|
+
`Tool ${name} not found and failed to load package ${packageName}: ${importError.message}`
|
|
123
|
+
);
|
|
124
|
+
(error as any).cause = importError;
|
|
125
|
+
throw error;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
72
129
|
if (!provider) {
|
|
73
|
-
throw new Error(`Tool ${name} not found`);
|
|
130
|
+
throw new Error(`Tool ${name} not found after attempting to load`);
|
|
74
131
|
}
|
|
75
132
|
|
|
76
133
|
if (!args || typeof args.path !== 'string') {
|