vcluster-yaml-mcp-server 1.2.4 → 1.3.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/README.md +13 -0
- package/package.json +1 -1
- package/src/server-info.js +33 -5
- package/src/server.js +20 -1
package/README.md
CHANGED
|
@@ -204,6 +204,19 @@ extract-validation-rules --section="controlPlane" --version="v0.24.0"
|
|
|
204
204
|
// Extracts constraints like "Valid values: a, b, c"
|
|
205
205
|
```
|
|
206
206
|
|
|
207
|
+
### Resources
|
|
208
|
+
|
|
209
|
+
**server://info** - Server metadata including version and available tools
|
|
210
|
+
```javascript
|
|
211
|
+
// Returns: name, version, description, availableTools, build info, runtime
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
**server://changelog** - Release history
|
|
215
|
+
```javascript
|
|
216
|
+
// Returns: version, content (from CHANGELOG.md)
|
|
217
|
+
// AI assistants check this on first use to mention relevant recent changes
|
|
218
|
+
```
|
|
219
|
+
|
|
207
220
|
## Usage Examples
|
|
208
221
|
|
|
209
222
|
### Interactive Config Creation (Primary Workflow)
|
package/package.json
CHANGED
package/src/server-info.js
CHANGED
|
@@ -1,14 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
2
|
import { fileURLToPath } from 'url';
|
|
3
3
|
import { dirname, join } from 'path';
|
|
4
4
|
|
|
5
|
-
// Load package.json once at module level
|
|
6
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
7
6
|
const __dirname = dirname(__filename);
|
|
8
7
|
const packageJson = JSON.parse(
|
|
9
|
-
|
|
8
|
+
readFileSync(join(__dirname, '../package.json'), 'utf-8')
|
|
10
9
|
);
|
|
11
10
|
|
|
11
|
+
// Available tools (static list for changelog)
|
|
12
|
+
const availableTools = [
|
|
13
|
+
{ name: 'list-versions', description: 'Discover available vCluster versions (tags and branches)' },
|
|
14
|
+
{ name: 'smart-query', description: 'Natural language search for vCluster configuration' },
|
|
15
|
+
{ name: 'create-vcluster-config', description: 'Generate and validate vCluster YAML configs' },
|
|
16
|
+
{ name: 'validate-config', description: 'Validate existing vCluster YAML against schema' },
|
|
17
|
+
{ name: 'extract-validation-rules', description: 'Extract semantic validation rules from values.yaml' }
|
|
18
|
+
];
|
|
19
|
+
|
|
12
20
|
// Build metadata from environment (injected by Docker/CI)
|
|
13
21
|
const buildInfo = {
|
|
14
22
|
version: packageJson.version,
|
|
@@ -38,7 +46,8 @@ export function getServerInfo() {
|
|
|
38
46
|
nodeVersion: process.version,
|
|
39
47
|
platform: process.platform,
|
|
40
48
|
arch: process.arch
|
|
41
|
-
}
|
|
49
|
+
},
|
|
50
|
+
availableTools
|
|
42
51
|
};
|
|
43
52
|
}
|
|
44
53
|
|
|
@@ -114,6 +123,25 @@ export function getMcpServerOptions() {
|
|
|
114
123
|
tools: {},
|
|
115
124
|
resources: {}
|
|
116
125
|
},
|
|
117
|
-
instructions: "vCluster configuration assistant. Use smart-query for any configuration questions (natural language search). Use create-vcluster-config when generating configs - it auto-validates. Use list-versions first to discover available versions. Use validate-config for user-provided YAML. Use extract-validation-rules to understand semantic constraints."
|
|
126
|
+
instructions: "vCluster configuration assistant. Read server://changelog on first use. If changes are dated within the current week AND relevant to your current task, briefly mention and offer details. Otherwise adapt silently. Use smart-query for any configuration questions (natural language search). Use create-vcluster-config when generating configs - it auto-validates. Use list-versions first to discover available versions. Use validate-config for user-provided YAML. Use extract-validation-rules to understand semantic constraints."
|
|
118
127
|
};
|
|
119
128
|
}
|
|
129
|
+
|
|
130
|
+
/**
|
|
131
|
+
* Get changelog from CHANGELOG.md file
|
|
132
|
+
* @returns {Object} Changelog with version and content
|
|
133
|
+
*/
|
|
134
|
+
export function getChangelog() {
|
|
135
|
+
try {
|
|
136
|
+
const content = readFileSync(join(__dirname, '../CHANGELOG.md'), 'utf-8');
|
|
137
|
+
return {
|
|
138
|
+
version: packageJson.version,
|
|
139
|
+
content
|
|
140
|
+
};
|
|
141
|
+
} catch {
|
|
142
|
+
return {
|
|
143
|
+
version: packageJson.version,
|
|
144
|
+
content: 'Changelog unavailable'
|
|
145
|
+
};
|
|
146
|
+
}
|
|
147
|
+
}
|
package/src/server.js
CHANGED
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
handleExtractRules,
|
|
9
9
|
handleValidateConfig
|
|
10
10
|
} from './tool-handlers.js';
|
|
11
|
-
import { getMcpServerInfo, getMcpServerOptions, getServerInfo } from './server-info.js';
|
|
11
|
+
import { getMcpServerInfo, getMcpServerOptions, getServerInfo, getChangelog } from './server-info.js';
|
|
12
12
|
|
|
13
13
|
export function createServer() {
|
|
14
14
|
const serverInfo = getMcpServerInfo();
|
|
@@ -131,5 +131,24 @@ export function createServer() {
|
|
|
131
131
|
})
|
|
132
132
|
);
|
|
133
133
|
|
|
134
|
+
// Register resource: server://changelog
|
|
135
|
+
server.registerResource(
|
|
136
|
+
'server-changelog',
|
|
137
|
+
'server://changelog',
|
|
138
|
+
{
|
|
139
|
+
description: 'Recent release history with dates and changes',
|
|
140
|
+
mimeType: 'application/json'
|
|
141
|
+
},
|
|
142
|
+
async (uri) => ({
|
|
143
|
+
contents: [
|
|
144
|
+
{
|
|
145
|
+
uri: uri.href,
|
|
146
|
+
mimeType: 'application/json',
|
|
147
|
+
text: JSON.stringify(getChangelog(), null, 2)
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
})
|
|
151
|
+
);
|
|
152
|
+
|
|
134
153
|
return server;
|
|
135
154
|
}
|