vale-mcp 0.0.0-stage → 0.1.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/LICENSE +21 -0
- package/build/config.d.ts +18 -0
- package/build/config.d.ts.map +1 -0
- package/build/config.js +50 -0
- package/build/config.js.map +1 -0
- package/build/index.d.ts +3 -0
- package/build/index.d.ts.map +1 -0
- package/build/index.js +493 -0
- package/build/index.js.map +1 -0
- package/build/types.d.ts +70 -0
- package/build/types.d.ts.map +1 -0
- package/build/types.js +2 -0
- package/build/types.js.map +1 -0
- package/build/vale-runner.d.ts +31 -0
- package/build/vale-runner.d.ts.map +1 -0
- package/build/vale-runner.js +361 -0
- package/build/vale-runner.js.map +1 -0
- package/package.json +46 -4
- package/readme.md +501 -0
- package/README.md +0 -3
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Chris Chinchilla and Fabrizio Ferri-Benedetti
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ValeServerConfig } from "./types.js";
|
|
2
|
+
/**
|
|
3
|
+
* Loads configuration from environment variables
|
|
4
|
+
*/
|
|
5
|
+
export declare function loadConfig(): ValeServerConfig;
|
|
6
|
+
/**
|
|
7
|
+
* Checks if a .vale.ini file exists in the current working directory (async)
|
|
8
|
+
*/
|
|
9
|
+
export declare function findValeIniInWorkingDir(): Promise<string | null>;
|
|
10
|
+
/**
|
|
11
|
+
* Verifies that a Vale config file exists and is readable (async)
|
|
12
|
+
*/
|
|
13
|
+
export declare function verifyConfigFile(configPath: string): Promise<boolean>;
|
|
14
|
+
/**
|
|
15
|
+
* Gets the absolute path for a config file
|
|
16
|
+
*/
|
|
17
|
+
export declare function resolveConfigPath(configPath: string): string;
|
|
18
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;GAEG;AACH,wBAAgB,UAAU,IAAI,gBAAgB,CAS7C;AAED;;GAEG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAUtE;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAO3E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,UAAU,EAAE,MAAM,GAAG,MAAM,CAK5D"}
|
package/build/config.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as fs from "fs/promises";
|
|
2
|
+
import * as fsSync from "fs";
|
|
3
|
+
import * as path from "path";
|
|
4
|
+
/**
|
|
5
|
+
* Loads configuration from environment variables
|
|
6
|
+
*/
|
|
7
|
+
export function loadConfig() {
|
|
8
|
+
const config = {};
|
|
9
|
+
// Load config path if specified
|
|
10
|
+
if (process.env.VALE_CONFIG_PATH) {
|
|
11
|
+
config.configPath = process.env.VALE_CONFIG_PATH;
|
|
12
|
+
}
|
|
13
|
+
return config;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Checks if a .vale.ini file exists in the current working directory (async)
|
|
17
|
+
*/
|
|
18
|
+
export async function findValeIniInWorkingDir() {
|
|
19
|
+
const cwd = process.cwd();
|
|
20
|
+
const valeIniPath = path.join(cwd, ".vale.ini");
|
|
21
|
+
try {
|
|
22
|
+
await fs.access(valeIniPath, fsSync.constants.R_OK);
|
|
23
|
+
return valeIniPath;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Verifies that a Vale config file exists and is readable (async)
|
|
31
|
+
*/
|
|
32
|
+
export async function verifyConfigFile(configPath) {
|
|
33
|
+
try {
|
|
34
|
+
await fs.access(configPath, fsSync.constants.R_OK);
|
|
35
|
+
return true;
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Gets the absolute path for a config file
|
|
43
|
+
*/
|
|
44
|
+
export function resolveConfigPath(configPath) {
|
|
45
|
+
if (path.isAbsolute(configPath)) {
|
|
46
|
+
return configPath;
|
|
47
|
+
}
|
|
48
|
+
return path.resolve(process.cwd(), configPath);
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["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AI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,UAAU,CAAC,CAAC;AACjD,CAAC"}
|
package/build/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/build/index.js
ADDED
|
@@ -0,0 +1,493 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
3
|
+
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { checkValeInstalled, checkFile, checkText, syncValeStyles } from "./vale-runner.js";
|
|
6
|
+
import { loadConfig, verifyConfigFile, resolveConfigPath, findValeIniInWorkingDir, } from "./config.js";
|
|
7
|
+
import * as path from "path";
|
|
8
|
+
import * as fs from "fs";
|
|
9
|
+
import { fileURLToPath } from "url";
|
|
10
|
+
// Get version from package.json
|
|
11
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
12
|
+
const __dirname = path.dirname(__filename);
|
|
13
|
+
const packageJsonPath = path.join(__dirname, "..", "package.json");
|
|
14
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, "utf-8"));
|
|
15
|
+
const VERSION = packageJson.version;
|
|
16
|
+
// Parse command line arguments for debug mode
|
|
17
|
+
const args = process.argv.slice(2);
|
|
18
|
+
const DEBUG = args.includes("--debug") || args.includes("--verbose") || args.includes("-v");
|
|
19
|
+
// Show help and exit
|
|
20
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
21
|
+
console.error(`
|
|
22
|
+
Vale MCP Server v${VERSION}
|
|
23
|
+
|
|
24
|
+
A Model Context Protocol server for Vale prose linting.
|
|
25
|
+
|
|
26
|
+
Usage:
|
|
27
|
+
vale-cli [options]
|
|
28
|
+
|
|
29
|
+
Options:
|
|
30
|
+
--debug, --verbose, -v Enable debug logging
|
|
31
|
+
--help, -h Show this help message
|
|
32
|
+
--version Show version number
|
|
33
|
+
|
|
34
|
+
The server communicates via stdio for MCP protocol.
|
|
35
|
+
|
|
36
|
+
Configuration priority:
|
|
37
|
+
1. Per-file: Config discovered from file's directory (check_file)
|
|
38
|
+
2. Server-wide: VALE_CONFIG_PATH environment variable
|
|
39
|
+
3. Working directory: .vale.ini in process.cwd()
|
|
40
|
+
4. Vale defaults: Global config or built-in rules
|
|
41
|
+
|
|
42
|
+
Environment variables:
|
|
43
|
+
VALE_CONFIG_PATH Path to specific .vale.ini file (overrides auto-detection)
|
|
44
|
+
|
|
45
|
+
Example:
|
|
46
|
+
# Use specific config file
|
|
47
|
+
VALE_CONFIG_PATH=/path/to/.vale.ini vale-cli
|
|
48
|
+
|
|
49
|
+
# Enable debug logging
|
|
50
|
+
vale-cli --debug
|
|
51
|
+
|
|
52
|
+
Documentation: https://vale.sh/docs/
|
|
53
|
+
`);
|
|
54
|
+
process.exit(0);
|
|
55
|
+
}
|
|
56
|
+
// Show version and exit
|
|
57
|
+
if (args.includes("--version")) {
|
|
58
|
+
console.error(VERSION);
|
|
59
|
+
process.exit(0);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Debug logger - only logs if DEBUG is enabled
|
|
63
|
+
*/
|
|
64
|
+
function debug(...args) {
|
|
65
|
+
if (DEBUG) {
|
|
66
|
+
console.error("[DEBUG]", new Date().toISOString(), ...args);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Server configuration
|
|
70
|
+
const config = loadConfig();
|
|
71
|
+
let valeConfigPath;
|
|
72
|
+
/**
|
|
73
|
+
* Get platform-specific installation instructions for Vale
|
|
74
|
+
*/
|
|
75
|
+
function getInstallationInstructions() {
|
|
76
|
+
const platform = process.platform;
|
|
77
|
+
const instructions = {
|
|
78
|
+
platform,
|
|
79
|
+
documentation: "https://vale.sh/docs/vale-cli/installation/",
|
|
80
|
+
methods: [],
|
|
81
|
+
};
|
|
82
|
+
switch (platform) {
|
|
83
|
+
case "darwin":
|
|
84
|
+
instructions.methods = [
|
|
85
|
+
{
|
|
86
|
+
name: "Homebrew (recommended)",
|
|
87
|
+
command: "brew install vale",
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
name: "Download binary",
|
|
91
|
+
command: "Download from GitHub releases",
|
|
92
|
+
url: "https://github.com/errata-ai/vale/releases",
|
|
93
|
+
},
|
|
94
|
+
];
|
|
95
|
+
break;
|
|
96
|
+
case "linux":
|
|
97
|
+
instructions.methods = [
|
|
98
|
+
{
|
|
99
|
+
name: "Snap",
|
|
100
|
+
command: "sudo snap install vale",
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: "Download binary",
|
|
104
|
+
command: "Download from GitHub releases and add to PATH",
|
|
105
|
+
url: "https://github.com/errata-ai/vale/releases",
|
|
106
|
+
},
|
|
107
|
+
];
|
|
108
|
+
break;
|
|
109
|
+
case "win32":
|
|
110
|
+
instructions.methods = [
|
|
111
|
+
{
|
|
112
|
+
name: "Chocolatey",
|
|
113
|
+
command: "choco install vale",
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
name: "Scoop",
|
|
117
|
+
command: "scoop install vale",
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
name: "Download binary",
|
|
121
|
+
command: "Download from GitHub releases",
|
|
122
|
+
url: "https://github.com/errata-ai/vale/releases",
|
|
123
|
+
},
|
|
124
|
+
];
|
|
125
|
+
break;
|
|
126
|
+
default:
|
|
127
|
+
instructions.methods = [
|
|
128
|
+
{
|
|
129
|
+
name: "Download binary",
|
|
130
|
+
command: "Download from GitHub releases",
|
|
131
|
+
url: "https://github.com/errata-ai/vale/releases",
|
|
132
|
+
},
|
|
133
|
+
];
|
|
134
|
+
}
|
|
135
|
+
return instructions;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Helper function to generate "Vale not installed" error response
|
|
139
|
+
*/
|
|
140
|
+
function createValeNotInstalledResponse() {
|
|
141
|
+
return {
|
|
142
|
+
isError: true,
|
|
143
|
+
content: [
|
|
144
|
+
{
|
|
145
|
+
type: "text",
|
|
146
|
+
text: JSON.stringify({
|
|
147
|
+
error: "Vale is not installed or not found in PATH",
|
|
148
|
+
vale_required: true,
|
|
149
|
+
installation_instructions: getInstallationInstructions(),
|
|
150
|
+
message: "Please install Vale to use this feature. Vale is a command-line tool for prose linting.",
|
|
151
|
+
}, null, 2),
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Check if an error is an E100 styles directory error
|
|
158
|
+
*/
|
|
159
|
+
function isStylesDirectoryError(errorMessage) {
|
|
160
|
+
// E100 errors typically contain these patterns
|
|
161
|
+
return /E100|does not exist|Runtime error/i.test(errorMessage);
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* Builds the CallToolResult for a caught linting error, with dedicated
|
|
165
|
+
* guidance when it looks like Vale's styles directory hasn't been synced.
|
|
166
|
+
*/
|
|
167
|
+
function handleValeLintError(error) {
|
|
168
|
+
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
169
|
+
const errorDetails = error instanceof Error ? error.stack : "No details available";
|
|
170
|
+
if (isStylesDirectoryError(errorMessage)) {
|
|
171
|
+
return {
|
|
172
|
+
isError: true,
|
|
173
|
+
content: [
|
|
174
|
+
{
|
|
175
|
+
type: "text",
|
|
176
|
+
text: `❌ **Vale configuration error**
|
|
177
|
+
|
|
178
|
+
${errorMessage}
|
|
179
|
+
|
|
180
|
+
This error indicates that Vale's styles directory is missing or the configured packages haven't been downloaded yet.
|
|
181
|
+
|
|
182
|
+
**Solution:**
|
|
183
|
+
Run the \`vale_sync\` tool to download the required style packages:
|
|
184
|
+
|
|
185
|
+
\`\`\`
|
|
186
|
+
vale_sync
|
|
187
|
+
\`\`\`
|
|
188
|
+
|
|
189
|
+
This will:
|
|
190
|
+
1. Read your .vale.ini configuration
|
|
191
|
+
2. Download all configured style packages
|
|
192
|
+
3. Create the necessary styles directory
|
|
193
|
+
|
|
194
|
+
After running \`vale_sync\`, you can try \`check_file\` again.
|
|
195
|
+
|
|
196
|
+
For more information, see: https://vale.sh/docs/topics/packages/`,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
isError: true,
|
|
203
|
+
content: [
|
|
204
|
+
{
|
|
205
|
+
type: "text",
|
|
206
|
+
text: JSON.stringify({
|
|
207
|
+
error: errorMessage,
|
|
208
|
+
details: errorDetails,
|
|
209
|
+
}),
|
|
210
|
+
},
|
|
211
|
+
],
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
// Initialize the MCP server
|
|
215
|
+
const server = new McpServer({
|
|
216
|
+
name: "vale-mcp",
|
|
217
|
+
version: VERSION,
|
|
218
|
+
});
|
|
219
|
+
server.registerTool("vale_status", {
|
|
220
|
+
description: "Check if Vale (vale.sh) is installed and accessible. Use this first if other Vale tools fail. Returns installation status, version if available, and installation instructions for the current platform.",
|
|
221
|
+
annotations: {
|
|
222
|
+
readOnlyHint: true,
|
|
223
|
+
openWorldHint: false,
|
|
224
|
+
},
|
|
225
|
+
}, async () => {
|
|
226
|
+
debug("Checking Vale installation status...");
|
|
227
|
+
const valeCheck = await checkValeInstalled();
|
|
228
|
+
debug(`Vale installed: ${valeCheck.installed}, version: ${valeCheck.version}`);
|
|
229
|
+
return {
|
|
230
|
+
content: [
|
|
231
|
+
{
|
|
232
|
+
type: "text",
|
|
233
|
+
text: JSON.stringify({
|
|
234
|
+
installed: valeCheck.installed,
|
|
235
|
+
version: valeCheck.version,
|
|
236
|
+
platform: process.platform,
|
|
237
|
+
installation_instructions: valeCheck.installed
|
|
238
|
+
? null
|
|
239
|
+
: getInstallationInstructions(),
|
|
240
|
+
message: valeCheck.installed
|
|
241
|
+
? `Vale is installed and ready to use (${valeCheck.version})`
|
|
242
|
+
: "Vale is not installed. Please install it to use Vale linting tools.",
|
|
243
|
+
}, null, 2),
|
|
244
|
+
},
|
|
245
|
+
],
|
|
246
|
+
};
|
|
247
|
+
});
|
|
248
|
+
server.registerTool("vale_sync", {
|
|
249
|
+
description: "Download Vale styles and packages by running 'vale sync'. Use this when you see errors about missing styles directories (E100 errors like 'The path does not exist'). This command reads the .vale.ini configuration and downloads the required style packages.",
|
|
250
|
+
inputSchema: {
|
|
251
|
+
config_path: z
|
|
252
|
+
.string()
|
|
253
|
+
.optional()
|
|
254
|
+
.describe("Optional path to .vale.ini file. If not provided, uses the server's configured path or searches in the current directory."),
|
|
255
|
+
},
|
|
256
|
+
annotations: {
|
|
257
|
+
readOnlyHint: false,
|
|
258
|
+
destructiveHint: false,
|
|
259
|
+
openWorldHint: true,
|
|
260
|
+
},
|
|
261
|
+
}, async ({ config_path }) => {
|
|
262
|
+
debug(`vale_sync called - config_path: ${config_path}`);
|
|
263
|
+
const valeCheck = await checkValeInstalled();
|
|
264
|
+
if (!valeCheck.installed) {
|
|
265
|
+
return createValeNotInstalledResponse();
|
|
266
|
+
}
|
|
267
|
+
const effectiveConfigPath = config_path || valeConfigPath;
|
|
268
|
+
const syncResult = await syncValeStyles(effectiveConfigPath);
|
|
269
|
+
debug(`vale_sync result - success: ${syncResult.success}`);
|
|
270
|
+
if (syncResult.success) {
|
|
271
|
+
return {
|
|
272
|
+
content: [
|
|
273
|
+
{
|
|
274
|
+
type: "text",
|
|
275
|
+
text: `✅ **Vale sync successful**
|
|
276
|
+
|
|
277
|
+
${syncResult.message}
|
|
278
|
+
|
|
279
|
+
${syncResult.output ? `**Output:**\n\`\`\`\n${syncResult.output}\n\`\`\`` : ""}
|
|
280
|
+
|
|
281
|
+
The styles have been downloaded and are ready to use. You can now run \`check_file\` again.`,
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
};
|
|
285
|
+
}
|
|
286
|
+
return {
|
|
287
|
+
isError: true,
|
|
288
|
+
content: [
|
|
289
|
+
{
|
|
290
|
+
type: "text",
|
|
291
|
+
text: `❌ **Vale sync failed**
|
|
292
|
+
|
|
293
|
+
${syncResult.message}
|
|
294
|
+
|
|
295
|
+
${syncResult.error ? `**Error:**\n\`\`\`\n${syncResult.error}\n\`\`\`` : ""}
|
|
296
|
+
|
|
297
|
+
Please check your .vale.ini configuration and ensure:
|
|
298
|
+
1. The StylesPath is correct
|
|
299
|
+
2. Packages are properly defined
|
|
300
|
+
3. You have internet connectivity to download packages
|
|
301
|
+
|
|
302
|
+
See Vale documentation: https://vale.sh/docs/topics/packages/`,
|
|
303
|
+
},
|
|
304
|
+
],
|
|
305
|
+
};
|
|
306
|
+
});
|
|
307
|
+
server.registerTool("check_file", {
|
|
308
|
+
description: "Lint a file at a specific path against Vale style rules. Returns issues found with their locations and severity. If Vale is not installed, returns error with installation guidance.",
|
|
309
|
+
inputSchema: {
|
|
310
|
+
path: z.string().describe("Absolute or relative path to the file to check"),
|
|
311
|
+
config_path: z
|
|
312
|
+
.string()
|
|
313
|
+
.optional()
|
|
314
|
+
.describe("Optional path to .vale.ini file. If not provided, Vale will search for .vale.ini starting from the file's directory and moving upward through parent directories."),
|
|
315
|
+
},
|
|
316
|
+
annotations: {
|
|
317
|
+
readOnlyHint: true,
|
|
318
|
+
openWorldHint: false,
|
|
319
|
+
},
|
|
320
|
+
}, async ({ path: filePath, config_path }) => {
|
|
321
|
+
debug(`check_file called - path: ${filePath}, config_path: ${config_path}`);
|
|
322
|
+
const valeCheck = await checkValeInstalled();
|
|
323
|
+
if (!valeCheck.installed) {
|
|
324
|
+
return createValeNotInstalledResponse();
|
|
325
|
+
}
|
|
326
|
+
try {
|
|
327
|
+
// Only pass config_path if explicitly provided by the user
|
|
328
|
+
// This allows Vale to use its natural upward search from the file's directory
|
|
329
|
+
const result = await checkFile(filePath, config_path);
|
|
330
|
+
debug(`check_file result - file: ${result.file}, issues found: ${result.issues.length}, errors: ${result.summary.errors}, warnings: ${result.summary.warnings}, suggestions: ${result.summary.suggestions}`);
|
|
331
|
+
return {
|
|
332
|
+
content: [
|
|
333
|
+
{
|
|
334
|
+
type: "text",
|
|
335
|
+
text: result.formatted,
|
|
336
|
+
},
|
|
337
|
+
],
|
|
338
|
+
structuredContent: {
|
|
339
|
+
file: result.file,
|
|
340
|
+
issues: result.issues,
|
|
341
|
+
summary: result.summary,
|
|
342
|
+
},
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
return handleValeLintError(error);
|
|
347
|
+
}
|
|
348
|
+
});
|
|
349
|
+
server.registerTool("check_text", {
|
|
350
|
+
description: "Lint text content directly against Vale style rules without requiring a file. Useful for checking text snippets, clipboard content, or dynamically generated content. Returns issues found with their locations and severity.",
|
|
351
|
+
inputSchema: {
|
|
352
|
+
text: z.string().describe("The text content to check with Vale"),
|
|
353
|
+
text_file_ext: z
|
|
354
|
+
.string()
|
|
355
|
+
.optional()
|
|
356
|
+
.describe("Optional file extension for Vale to apply when checking the text (e.g., '.md', '.txt'). This can help Vale apply file format-specific rules if needed."),
|
|
357
|
+
config_path: z
|
|
358
|
+
.string()
|
|
359
|
+
.optional()
|
|
360
|
+
.describe("Optional path to .vale.ini file. If not provided, uses the server's configured path or searches in the current directory."),
|
|
361
|
+
},
|
|
362
|
+
annotations: {
|
|
363
|
+
readOnlyHint: true,
|
|
364
|
+
openWorldHint: false,
|
|
365
|
+
},
|
|
366
|
+
}, async ({ text, text_file_ext, config_path }) => {
|
|
367
|
+
debug(`check_text called - text length: ${text?.length}, text_file_ext: ${text_file_ext}, config_path: ${config_path}`);
|
|
368
|
+
const valeCheck = await checkValeInstalled();
|
|
369
|
+
if (!valeCheck.installed) {
|
|
370
|
+
return createValeNotInstalledResponse();
|
|
371
|
+
}
|
|
372
|
+
try {
|
|
373
|
+
// Use the provided config_path if given, otherwise fall back to the
|
|
374
|
+
// server's configured path since there's no file directory to search from
|
|
375
|
+
const effectiveConfigPath = config_path !== undefined ? config_path : valeConfigPath;
|
|
376
|
+
const result = await checkText(text, text_file_ext, effectiveConfigPath);
|
|
377
|
+
debug(`check_text result - issues found: ${result.issues.length}, errors: ${result.summary.errors}, warnings: ${result.summary.warnings}, suggestions: ${result.summary.suggestions}`);
|
|
378
|
+
return {
|
|
379
|
+
content: [
|
|
380
|
+
{
|
|
381
|
+
type: "text",
|
|
382
|
+
text: result.formatted,
|
|
383
|
+
},
|
|
384
|
+
],
|
|
385
|
+
structuredContent: {
|
|
386
|
+
file: result.file,
|
|
387
|
+
issues: result.issues,
|
|
388
|
+
summary: result.summary,
|
|
389
|
+
},
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
catch (error) {
|
|
393
|
+
return handleValeLintError(error);
|
|
394
|
+
}
|
|
395
|
+
});
|
|
396
|
+
/**
|
|
397
|
+
* Initialize Vale configuration
|
|
398
|
+
*/
|
|
399
|
+
async function initializeValeConfig() {
|
|
400
|
+
// Check if Vale is installed
|
|
401
|
+
const valeCheck = await checkValeInstalled();
|
|
402
|
+
if (!valeCheck.installed) {
|
|
403
|
+
console.error("WARNING: Vale is not installed or not in PATH");
|
|
404
|
+
console.error("The server will start, but linting tools will not work until Vale is installed.");
|
|
405
|
+
console.error("");
|
|
406
|
+
console.error("Installation instructions:");
|
|
407
|
+
const instructions = getInstallationInstructions();
|
|
408
|
+
instructions.methods.forEach((method) => {
|
|
409
|
+
console.error(` ${method.name}: ${method.command}`);
|
|
410
|
+
if (method.url) {
|
|
411
|
+
console.error(` ${method.url}`);
|
|
412
|
+
}
|
|
413
|
+
});
|
|
414
|
+
console.error("");
|
|
415
|
+
console.error(`Documentation: ${instructions.documentation}`);
|
|
416
|
+
console.error("");
|
|
417
|
+
console.error("Use the 'vale_status' tool to check installation status after installing.");
|
|
418
|
+
console.error("");
|
|
419
|
+
// Don't exit - allow server to start
|
|
420
|
+
return;
|
|
421
|
+
}
|
|
422
|
+
console.error(`Vale version: ${valeCheck.version}`);
|
|
423
|
+
// Priority 1: Check for VALE_CONFIG_PATH environment variable
|
|
424
|
+
if (config.configPath) {
|
|
425
|
+
const resolvedPath = resolveConfigPath(config.configPath);
|
|
426
|
+
if (await verifyConfigFile(resolvedPath)) {
|
|
427
|
+
valeConfigPath = resolvedPath;
|
|
428
|
+
console.error(`Using Vale config from VALE_CONFIG_PATH: ${valeConfigPath}`);
|
|
429
|
+
return;
|
|
430
|
+
}
|
|
431
|
+
else {
|
|
432
|
+
console.error(`WARNING: VALE_CONFIG_PATH points to non-existent file: ${config.configPath}`);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
// Priority 2: Check for .vale.ini in the current working directory
|
|
436
|
+
const workingDirConfig = await findValeIniInWorkingDir();
|
|
437
|
+
if (workingDirConfig) {
|
|
438
|
+
// Use .vale.ini from working directory
|
|
439
|
+
valeConfigPath = workingDirConfig;
|
|
440
|
+
console.error(`Using .vale.ini from working directory: ${valeConfigPath}`);
|
|
441
|
+
}
|
|
442
|
+
else {
|
|
443
|
+
// No .vale.ini found - warn but continue
|
|
444
|
+
console.error("WARNING: No .vale.ini file found in the current working directory");
|
|
445
|
+
console.error(`Current working directory: ${process.cwd()}`);
|
|
446
|
+
console.error("");
|
|
447
|
+
console.error("Vale will use default settings or search parent directories.");
|
|
448
|
+
console.error("For best results, create a .vale.ini file in your project directory.");
|
|
449
|
+
console.error("");
|
|
450
|
+
console.error("Example .vale.ini:");
|
|
451
|
+
console.error(" StylesPath = styles");
|
|
452
|
+
console.error(" Packages = write-good, proselint");
|
|
453
|
+
console.error("");
|
|
454
|
+
console.error(" [*]");
|
|
455
|
+
console.error(" BasedOnStyles = write-good, proselint");
|
|
456
|
+
console.error("");
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* Main entry point
|
|
461
|
+
*/
|
|
462
|
+
async function main() {
|
|
463
|
+
try {
|
|
464
|
+
// Show version and startup info
|
|
465
|
+
const title = `Vale MCP Server v${VERSION}`;
|
|
466
|
+
const boxWidth = Math.max(title.length + 4, 43); // At least 43 chars wide
|
|
467
|
+
const padding = ' '.repeat(Math.floor((boxWidth - title.length - 2) / 2));
|
|
468
|
+
const titleLine = `║${padding}${title}${padding}${title.length % 2 === 0 ? ' ' : ''}║`;
|
|
469
|
+
const border = '═'.repeat(boxWidth - 2);
|
|
470
|
+
console.error(`\n╔${border}╗`);
|
|
471
|
+
console.error(titleLine);
|
|
472
|
+
console.error(`╚${border}╝\n`);
|
|
473
|
+
if (DEBUG) {
|
|
474
|
+
console.error("🐛 Debug mode enabled\n");
|
|
475
|
+
}
|
|
476
|
+
// Initialize Vale configuration
|
|
477
|
+
await initializeValeConfig();
|
|
478
|
+
// Start the server
|
|
479
|
+
const transport = new StdioServerTransport();
|
|
480
|
+
await server.connect(transport);
|
|
481
|
+
console.error(`✓ Vale MCP Server v${VERSION} running on stdio`);
|
|
482
|
+
if (DEBUG) {
|
|
483
|
+
console.error("✓ Debug logging active - tool calls will be logged");
|
|
484
|
+
}
|
|
485
|
+
console.error("");
|
|
486
|
+
}
|
|
487
|
+
catch (error) {
|
|
488
|
+
console.error("Failed to start server:", error);
|
|
489
|
+
process.exit(1);
|
|
490
|
+
}
|
|
491
|
+
}
|
|
492
|
+
main();
|
|
493
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,yCAAyC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AAEjF,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,kBAAkB,EAAE,SAAS,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC5F,OAAO,EACL,UAAU,EACV,gBAAgB,EAChB,iBAAiB,EACjB,uBAAuB,GACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,EAAE,MAAM,IAAI,CA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