@wastech-mdlint/mcp-server 0.4.0 → 0.5.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 +5 -5
- package/dist/index.js +5 -5
- package/dist/shared/operational-error.d.ts +2 -2
- package/dist/shared/operational-error.js +4 -4
- package/dist/shared/since.d.ts +7 -2
- package/dist/shared/since.js +10 -3
- package/dist/shared/tool-context.d.ts +4 -4
- package/dist/shared/tool-context.js +7 -7
- package/dist/shared/tool-input-error.js +1 -1
- package/dist/shared/tool-response.js +8 -8
- package/dist/tool-docs.js +4 -4
- package/dist/tools/compile-context.js +4 -4
- package/dist/tools/context-graph.js +6 -6
- package/dist/tools/context-slice.js +1 -1
- package/dist/tools/impact-analysis.js +5 -4
- package/dist/tools/index.js +2 -2
- package/dist/tools/lint-files.js +4 -4
- package/dist/tools/lint.js +9 -9
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
A [Model Context Protocol](https://modelcontextprotocol.io) server that gives an agent read-only access to a repository's Markdown context: lint findings, the context graph, reachability slices, change impact, and a compiled skill.
|
|
4
4
|
|
|
5
|
-
**stdio only, read-only, six tools.** No HTTP or SSE transport, no mutating tools, no code-plugin execution. Every tool runs through [`@wastech-mdlint/core`](https://github.com/VladimirMakarevich/wastech-mdlint/blob/main/packages/core/README.md), the same pipeline the CLI uses
|
|
5
|
+
**stdio only, read-only, six tools.** No HTTP or SSE transport, no mutating tools, no code-plugin execution. Every tool runs through [`@wastech-mdlint/core`](https://github.com/VladimirMakarevich/wastech-mdlint/blob/main/packages/core/README.md), the same pipeline the CLI uses - this package is the host adapter around it: tool registration, input validation, structured output, and error wrapping.
|
|
6
6
|
|
|
7
7
|
## Run it
|
|
8
8
|
|
|
@@ -32,14 +32,14 @@ Node.js `>=24.17.0`. Readiness is announced on stderr; stdout carries only the p
|
|
|
32
32
|
| --- | --- |
|
|
33
33
|
| `lint` | Lint ad-hoc Markdown content against an explicit rule list. Does not load project config. |
|
|
34
34
|
| `lint-files` | Lint the project's Markdown files using the resolved config, or the zero-config default. With `since` (a branch, tag or commit), only the findings the work tree adds since where it left that ref, read with git. |
|
|
35
|
-
| `context-graph` | Build the project's context graph
|
|
35
|
+
| `context-graph` | Build the project's context graph - nodes, edges, cycles, or a summary document. |
|
|
36
36
|
| `context-slice` | The files reachable within `depth` hops of a query resolved by exact match. |
|
|
37
37
|
| `impact-analysis` | The blast radius of changing one file: direct and transitive dependents. With `since` in place of `file`, the same for every document the work tree changed since where it left that ref. |
|
|
38
38
|
| `compile-context` | Compile the project skill (`SKILL.md`) from `config.compile`. |
|
|
39
39
|
|
|
40
40
|
All six carry a `readOnlyHint` annotation. Five return `structuredContent` alongside an `outputSchema`; `compile-context` returns two plain-text content blocks instead.
|
|
41
41
|
|
|
42
|
-
The five file-based tools accept a `cwd`. A `cwd` that does not exist, or that names a file rather than a directory, is rejected with an actionable error rather than answered with an empty result
|
|
42
|
+
The five file-based tools accept a `cwd`. A `cwd` that does not exist, or that names a file rather than a directory, is rejected with an actionable error rather than answered with an empty result - an empty corpus is indistinguishable from a clean repository, so a plausible-looking success would answer a different question than the one asked. Omit it to analyze the server process's own working directory.
|
|
43
43
|
|
|
44
44
|
## Errors
|
|
45
45
|
|
|
@@ -49,9 +49,9 @@ One limit is deliberate: that contract covers failures the tool itself detects.
|
|
|
49
49
|
|
|
50
50
|
## Documentation
|
|
51
51
|
|
|
52
|
-
- [MCP server guide](https://github.com/VladimirMakarevich/wastech-mdlint/blob/main/docs/guide/mcp-server.md)
|
|
52
|
+
- [MCP server guide](https://github.com/VladimirMakarevich/wastech-mdlint/blob/main/docs/guide/mcp-server.md) - every tool's arguments, the full error contract, and host wiring
|
|
53
53
|
- [Project README](https://github.com/VladimirMakarevich/wastech-mdlint#readme) · [Configuration](https://github.com/VladimirMakarevich/wastech-mdlint/blob/main/docs/guide/configuration.md) · [Output & exit codes](https://github.com/VladimirMakarevich/wastech-mdlint/blob/main/docs/guide/output.md)
|
|
54
54
|
|
|
55
55
|
## License
|
|
56
56
|
|
|
57
|
-
MIT
|
|
57
|
+
MIT - see [LICENSE](./LICENSE).
|
package/dist/index.js
CHANGED
|
@@ -6,13 +6,13 @@ import { fileURLToPath } from "node:url";
|
|
|
6
6
|
import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
7
7
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
8
8
|
import { registerTools } from "./tools/index.js";
|
|
9
|
-
// The server shell. Tools are registered through the modular seam in tools/index.ts
|
|
10
|
-
// module per tool
|
|
9
|
+
// The server shell. Tools are registered through the modular seam in tools/index.ts - one
|
|
10
|
+
// module per tool - so this file stays the transport/lifecycle owner, not a tool mega-file.
|
|
11
11
|
// Every read-only tool is appended to that seam rather than registered here.
|
|
12
12
|
// The invariants this shell locks in: transport is stdio-only and the server never loads
|
|
13
13
|
// code-plugins.
|
|
14
14
|
// Resolves relative to the compiled module (dist/index.js), one level under dist/, so the read
|
|
15
|
-
// keeps finding packages/mcp-server/package.json regardless of the caller's cwd
|
|
15
|
+
// keeps finding packages/mcp-server/package.json regardless of the caller's cwd - the same
|
|
16
16
|
// approach the CLI uses for its version lookup.
|
|
17
17
|
async function readPackageVersion() {
|
|
18
18
|
const moduleDir = path.dirname(fileURLToPath(import.meta.url));
|
|
@@ -39,7 +39,7 @@ export async function startServer() {
|
|
|
39
39
|
}
|
|
40
40
|
const invokedPath = process.argv[1];
|
|
41
41
|
const modulePath = fileURLToPath(import.meta.url);
|
|
42
|
-
// Same symlink defect as the CLI entrypoint (packages/cli/src/index.ts)
|
|
42
|
+
// Same symlink defect as the CLI entrypoint (packages/cli/src/index.ts) - see its comment for the
|
|
43
43
|
// full explanation. process.argv[1] keeps the node_modules/.bin symlink path while import.meta.url
|
|
44
44
|
// resolves to the realpath, so dereferencing before comparing is required for the guard to ever
|
|
45
45
|
// match a symlinked invocation.
|
|
@@ -54,7 +54,7 @@ function realOrSelf(candidate) {
|
|
|
54
54
|
// Only auto-start when run as the real bin; importing this module (e.g. from a smoke test) must
|
|
55
55
|
// not spin up a transport that seizes stdio, mirroring the CLI entrypoint guard. Both sides are
|
|
56
56
|
// dereferenced (not just invokedPath): import.meta.url is only a realpath under Node's default
|
|
57
|
-
// module resolution
|
|
57
|
+
// module resolution - under --preserve-symlinks/--preserve-symlinks-main it stays the symlink path
|
|
58
58
|
// too, and an unresolved comparison there would reject a legitimate bin invocation in that mode.
|
|
59
59
|
if (invokedPath !== undefined &&
|
|
60
60
|
realOrSelf(path.resolve(invokedPath)) === realOrSelf(modulePath)) {
|
|
@@ -4,7 +4,7 @@ import { type StructuredErrorInfo } from "@wastech-mdlint/core";
|
|
|
4
4
|
* anything the caller should keep treating as a sanitized `INTERNAL_ERROR`.
|
|
5
5
|
*
|
|
6
6
|
* **Both fields are required.** An errno with no `path` (`ENOSPC: no space left on device, write`)
|
|
7
|
-
* has nothing to name, and its own message is the only diagnostic there is
|
|
7
|
+
* has nothing to name, and its own message is the only diagnostic there is - but that message is
|
|
8
8
|
* exactly the unvetted text `INTERNAL_ERROR` exists to withhold, so it falls through rather than
|
|
9
9
|
* being surfaced. The CLI can afford the opposite choice because its output is a terminal, not a
|
|
10
10
|
* machine contract.
|
|
@@ -15,7 +15,7 @@ import { type StructuredErrorInfo } from "@wastech-mdlint/core";
|
|
|
15
15
|
* naming a file outside the analyzed root. Two caller-supplied paths do come back: the `cwd`, in the
|
|
16
16
|
* `INVALID_INPUT` message (`tool-context.ts`), where the value is the caller's own and is the broken
|
|
17
17
|
* thing being reported; and a `configPath`, which core renders relative to `cwd` with no containment
|
|
18
|
-
* check of its own. What this function must not do is add a *third*
|
|
18
|
+
* check of its own. What this function must not do is add a *third* - a path the run discovered
|
|
19
19
|
* rather than the caller named. The CLI keeps the `../` form on purpose (see
|
|
20
20
|
* `operational-errors.ts`); the two hosts differ here by decision, which is why this is not that
|
|
21
21
|
* function.
|
|
@@ -2,7 +2,7 @@ import path from "node:path";
|
|
|
2
2
|
import { normalizeRelativePath, } from "@wastech-mdlint/core";
|
|
3
3
|
// Classify a raw Node errno into the shared `OPERATIONAL_ERROR` payload. The code lives
|
|
4
4
|
// in core's closed taxonomy; the mapping lives here because deciding that a throwable is an
|
|
5
|
-
// environment failure rather than an internal one is a host-boundary judgement
|
|
5
|
+
// environment failure rather than an internal one is a host-boundary judgement - the same split
|
|
6
6
|
// `INVALID_INPUT`/`ToolInputError` already uses. Core's `isStructuredError` is deliberately NOT
|
|
7
7
|
// widened to duck-type errnos (its comment says why), so this is the only door such an error has.
|
|
8
8
|
//
|
|
@@ -29,7 +29,7 @@ function errnoPath(error) {
|
|
|
29
29
|
* anything the caller should keep treating as a sanitized `INTERNAL_ERROR`.
|
|
30
30
|
*
|
|
31
31
|
* **Both fields are required.** An errno with no `path` (`ENOSPC: no space left on device, write`)
|
|
32
|
-
* has nothing to name, and its own message is the only diagnostic there is
|
|
32
|
+
* has nothing to name, and its own message is the only diagnostic there is - but that message is
|
|
33
33
|
* exactly the unvetted text `INTERNAL_ERROR` exists to withhold, so it falls through rather than
|
|
34
34
|
* being surfaced. The CLI can afford the opposite choice because its output is a terminal, not a
|
|
35
35
|
* machine contract.
|
|
@@ -40,7 +40,7 @@ function errnoPath(error) {
|
|
|
40
40
|
* naming a file outside the analyzed root. Two caller-supplied paths do come back: the `cwd`, in the
|
|
41
41
|
* `INVALID_INPUT` message (`tool-context.ts`), where the value is the caller's own and is the broken
|
|
42
42
|
* thing being reported; and a `configPath`, which core renders relative to `cwd` with no containment
|
|
43
|
-
* check of its own. What this function must not do is add a *third*
|
|
43
|
+
* check of its own. What this function must not do is add a *third* - a path the run discovered
|
|
44
44
|
* rather than the caller named. The CLI keeps the `../` form on purpose (see
|
|
45
45
|
* `operational-errors.ts`); the two hosts differ here by decision, which is why this is not that
|
|
46
46
|
* function.
|
|
@@ -63,7 +63,7 @@ export function toOperationalErrorInfo(error, cwd) {
|
|
|
63
63
|
}
|
|
64
64
|
// Byte-identical to the CLI's stderr line (`formatOperationalError` behind its `Operational error:`
|
|
65
65
|
// prefix), so "both hosts name the errno and the path" is literally true and a user comparing the
|
|
66
|
-
// two surfaces sees one sentence. `""`
|
|
66
|
+
// two surfaces sees one sentence. `""` - the failing path being `cwd` itself - renders as `.`.
|
|
67
67
|
const rendered = normalizeRelativePath(relative);
|
|
68
68
|
return {
|
|
69
69
|
code: "OPERATIONAL_ERROR",
|
package/dist/shared/since.d.ts
CHANGED
|
@@ -3,6 +3,11 @@ import { z } from "zod";
|
|
|
3
3
|
export declare const sinceInput: z.ZodOptional<z.ZodString>;
|
|
4
4
|
export declare const sinceSummarySchema: z.ZodObject<{
|
|
5
5
|
ref: z.ZodString;
|
|
6
|
+
source: z.ZodEnum<{
|
|
7
|
+
config: "config";
|
|
8
|
+
given: "given";
|
|
9
|
+
detected: "detected";
|
|
10
|
+
}>;
|
|
6
11
|
base: z.ZodString;
|
|
7
12
|
mergeBase: z.ZodString;
|
|
8
13
|
head: z.ZodString;
|
|
@@ -24,8 +29,8 @@ export declare const sinceSummarySchema: z.ZodObject<{
|
|
|
24
29
|
}, z.core.$strip>>;
|
|
25
30
|
}, z.core.$strip>;
|
|
26
31
|
/**
|
|
27
|
-
* The work tree's changes since `ref`, or an input error naming why there is nothing to compare
|
|
28
|
-
* not a git work tree, no `git`, a ref that names nothing
|
|
32
|
+
* The work tree's changes since `ref`, or an input error naming why there is nothing to compare -
|
|
33
|
+
* not a git work tree, no `git`, a ref that names nothing - with git's remedy as the hint. An error
|
|
29
34
|
* rather than an empty answer, because "no new findings" from a comparison that never ran is the
|
|
30
35
|
* plausible answer to a different question.
|
|
31
36
|
*/
|
package/dist/shared/since.js
CHANGED
|
@@ -8,6 +8,9 @@ import { ToolInputError } from "./tool-input-error.js";
|
|
|
8
8
|
export const sinceInput = z.string().optional();
|
|
9
9
|
export const sinceSummarySchema = z.object({
|
|
10
10
|
ref: z.string(),
|
|
11
|
+
// Where the ref came from. Always "given" here, since `since` names its ref, but the record is the
|
|
12
|
+
// one the CLI writes, where a bare `--since` takes the config's `git.base` or a detected base.
|
|
13
|
+
source: z.enum(["given", "config", "detected"]),
|
|
11
14
|
base: z.string(),
|
|
12
15
|
mergeBase: z.string(),
|
|
13
16
|
head: z.string(),
|
|
@@ -15,14 +18,18 @@ export const sinceSummarySchema = z.object({
|
|
|
15
18
|
removed: z.array(lintMessageSchema),
|
|
16
19
|
});
|
|
17
20
|
/**
|
|
18
|
-
* The work tree's changes since `ref`, or an input error naming why there is nothing to compare
|
|
19
|
-
* not a git work tree, no `git`, a ref that names nothing
|
|
21
|
+
* The work tree's changes since `ref`, or an input error naming why there is nothing to compare -
|
|
22
|
+
* not a git work tree, no `git`, a ref that names nothing - with git's remedy as the hint. An error
|
|
20
23
|
* rather than an empty answer, because "no new findings" from a comparison that never ran is the
|
|
21
24
|
* plausible answer to a different question.
|
|
22
25
|
*/
|
|
23
26
|
export async function analyzeSinceOrThrow(cwd, configuration, ref) {
|
|
24
27
|
if (ref.trim() === "") {
|
|
25
|
-
throw new ToolInputError("since must name a branch, tag or commit",
|
|
28
|
+
throw new ToolInputError("since must name a branch, tag or commit",
|
|
29
|
+
// The project's own base branch, when its config names one, rather than a default such as
|
|
30
|
+
// "main": a team whose work starts from `develop` would otherwise get every finding `develop`
|
|
31
|
+
// added reported as the branch's own.
|
|
32
|
+
'Pass the base branch - the config\'s git.base when it sets one, otherwise for example "main" - or omit "since".');
|
|
26
33
|
}
|
|
27
34
|
const analysis = await analyzeSince({ cwd, configuration, ref });
|
|
28
35
|
if ("available" in analysis) {
|
|
@@ -8,13 +8,13 @@ export type ToolFileInput = {
|
|
|
8
8
|
*
|
|
9
9
|
* `cwd ?? process.cwd()` is a deliberate departure from the CLI's layering, where commander supplies
|
|
10
10
|
* the default; MCP tools have no argument-parsing layer. It lives here alone so the callers below and
|
|
11
|
-
* the tool modules that need the value read it back rather than recomputing it
|
|
11
|
+
* the tool modules that need the value read it back rather than recomputing it - four copies of the
|
|
12
12
|
* same line was how `resolveToolCwd`'s guard came to be missed at three of them.
|
|
13
13
|
*
|
|
14
14
|
* Split out of `resolveToolCwd` so a tool's `catch` block can name the base its failure happened
|
|
15
|
-
* under
|
|
15
|
+
* under - `errorResult` renders an errno's path relative to it - even when the failure is the
|
|
16
16
|
* `stat` inside `resolveToolCwd` itself, and so the requirement that `cwd ?? process.cwd()`
|
|
17
|
-
* appears in exactly one place
|
|
17
|
+
* appears in exactly one place - keeps holding. Deliberately not async and deliberately not
|
|
18
18
|
* validating: a `catch` handler cannot afford a second throw.
|
|
19
19
|
*/
|
|
20
20
|
export declare function toolCwdBase(input: ToolFileInput): string;
|
|
@@ -24,7 +24,7 @@ export declare function toolCwdBase(input: ToolFileInput): string;
|
|
|
24
24
|
* Core deliberately does not do this: `loadDocuments` answers a root that does not stat as a
|
|
25
25
|
* directory with a silent empty map, pinned as intentional by core's own test and relied on by other
|
|
26
26
|
* callers. Left unguarded that reads to a client as `No problems found.` / an empty graph / `No match
|
|
27
|
-
* for query`
|
|
27
|
+
* for query` - a plausible answer to a different question, which is the CLI's own stated rationale
|
|
28
28
|
* for its identical check ("indistinguishable from a clean repository").
|
|
29
29
|
*
|
|
30
30
|
* Runs on every call, including when `cwd` is omitted: one `stat` against a whole corpus walk is not
|
|
@@ -13,13 +13,13 @@ function toPosixPath(value) {
|
|
|
13
13
|
*
|
|
14
14
|
* `cwd ?? process.cwd()` is a deliberate departure from the CLI's layering, where commander supplies
|
|
15
15
|
* the default; MCP tools have no argument-parsing layer. It lives here alone so the callers below and
|
|
16
|
-
* the tool modules that need the value read it back rather than recomputing it
|
|
16
|
+
* the tool modules that need the value read it back rather than recomputing it - four copies of the
|
|
17
17
|
* same line was how `resolveToolCwd`'s guard came to be missed at three of them.
|
|
18
18
|
*
|
|
19
19
|
* Split out of `resolveToolCwd` so a tool's `catch` block can name the base its failure happened
|
|
20
|
-
* under
|
|
20
|
+
* under - `errorResult` renders an errno's path relative to it - even when the failure is the
|
|
21
21
|
* `stat` inside `resolveToolCwd` itself, and so the requirement that `cwd ?? process.cwd()`
|
|
22
|
-
* appears in exactly one place
|
|
22
|
+
* appears in exactly one place - keeps holding. Deliberately not async and deliberately not
|
|
23
23
|
* validating: a `catch` handler cannot afford a second throw.
|
|
24
24
|
*/
|
|
25
25
|
export function toolCwdBase(input) {
|
|
@@ -31,7 +31,7 @@ export function toolCwdBase(input) {
|
|
|
31
31
|
* Core deliberately does not do this: `loadDocuments` answers a root that does not stat as a
|
|
32
32
|
* directory with a silent empty map, pinned as intentional by core's own test and relied on by other
|
|
33
33
|
* callers. Left unguarded that reads to a client as `No problems found.` / an empty graph / `No match
|
|
34
|
-
* for query`
|
|
34
|
+
* for query` - a plausible answer to a different question, which is the CLI's own stated rationale
|
|
35
35
|
* for its identical check ("indistinguishable from a clean repository").
|
|
36
36
|
*
|
|
37
37
|
* Runs on every call, including when `cwd` is omitted: one `stat` against a whole corpus walk is not
|
|
@@ -44,7 +44,7 @@ export async function resolveToolCwd(input) {
|
|
|
44
44
|
const hint = 'Pass an absolute path to an existing directory, or omit "cwd" to analyze the server\'s working directory.';
|
|
45
45
|
// Rejected before `path.resolve`, because it cannot be caught after: `path.resolve("")` returns
|
|
46
46
|
// `process.cwd()`, so an explicit empty (or blank) `cwd` would pass every check below and silently
|
|
47
|
-
// analyze the server's own working directory
|
|
47
|
+
// analyze the server's own working directory - a plausible answer to a different question, which is
|
|
48
48
|
// the exact failure this guard exists to name. Not expressed as `.min(1)` on the tools'
|
|
49
49
|
// `inputSchema`s: a schema rejection is refused before the handler runs, arriving as a bare
|
|
50
50
|
// `InvalidParams` with no `structuredContent` and no `hint`.
|
|
@@ -62,7 +62,7 @@ export async function resolveToolCwd(input) {
|
|
|
62
62
|
const stats = await stat(resolved).catch((error) => {
|
|
63
63
|
// Mirrors the CLI's `resolveDirectoryArgument`: only these two errnos mean "no usable directory
|
|
64
64
|
// here". Anything else (EACCES, ELOOP, …) is a *different* operational failure and must not be
|
|
65
|
-
// misreported as bad input, so it rethrows
|
|
65
|
+
// misreported as bad input, so it rethrows - and it reaches `errorResult`'s errno
|
|
66
66
|
// classifier, which answers `OPERATIONAL_ERROR` naming the errno (or a sanitized INTERNAL_ERROR
|
|
67
67
|
// when the errno names no path) instead of the flat INTERNAL_ERROR it used to get.
|
|
68
68
|
const code = error instanceof Error && "code" in error ? error.code : undefined;
|
|
@@ -82,7 +82,7 @@ export async function resolveToolCwd(input) {
|
|
|
82
82
|
export async function resolveToolConfiguration(input) {
|
|
83
83
|
// Before `loadConfiguration`, not after: a bad `cwd` is the more fundamental of the two failures,
|
|
84
84
|
// and checking it second would report `CONFIG_NOT_FOUND` for a `configPath` under a root that does
|
|
85
|
-
// not exist
|
|
85
|
+
// not exist - naming the wrong cause.
|
|
86
86
|
const cwd = await resolveToolCwd(input);
|
|
87
87
|
const loaded = await loadConfiguration({
|
|
88
88
|
cwd,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
// so this class translates a throwable that carries no `ToolErrorCode` into one `errorResult` will
|
|
3
3
|
// pass through verbatim. Without it, `isStructuredError`'s allowlist rejects the throwable and it
|
|
4
4
|
// degrades to a sanitized `INTERNAL_ERROR`, losing exactly the actionable text the error contract exists to preserve
|
|
5
|
-
//
|
|
5
|
+
// - the "did you mean" suggestion behind `lint`'s `RuleResolutionError`, or the offending path behind
|
|
6
6
|
// a bad tool `cwd`.
|
|
7
7
|
//
|
|
8
8
|
// Shared *within mcp-server* (it started local to `tools/lint.ts` when there was one call site, and
|
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import { toOperationalErrorInfo } from "./operational-error.js";
|
|
4
4
|
// Output/error/annotation conventions as reusable wrappers so every tool
|
|
5
5
|
// renders the same success/error shape without re-deriving it.
|
|
6
|
-
// The annotation every tool carries. openWorldHint/idempotentHint are intentionally omitted
|
|
6
|
+
// The annotation every tool carries. openWorldHint/idempotentHint are intentionally omitted - they
|
|
7
7
|
// are not part of the decided read-only contract, and adding them would advertise hints the shipped
|
|
8
8
|
// tools never agreed to.
|
|
9
9
|
export const READ_ONLY_ANNOTATIONS = { readOnlyHint: true };
|
|
@@ -24,13 +24,13 @@ const INTERNAL_ERROR_MESSAGE = "An unexpected internal error occurred.";
|
|
|
24
24
|
/**
|
|
25
25
|
* The text block a host renders and a model reads. It carries the `hint` too: the
|
|
26
26
|
* structured payload had the actionable sentence and the text did not, so a host that renders only
|
|
27
|
-
* `content[].text`
|
|
27
|
+
* `content[].text` - the common case - saw `Unknown rule "SIZE-002".` with the did-you-mean dropped,
|
|
28
28
|
* while the CLI prints both for the same typo.
|
|
29
29
|
*
|
|
30
30
|
* The `includes` test is not defensive noise, it is the whole reason this is a function. Some core
|
|
31
|
-
* errors already interpolate their hint INTO the message
|
|
31
|
+
* errors already interpolate their hint INTO the message - `CompileConfigMissingError` and
|
|
32
32
|
* `ImpactAnalysisError` build theirs from it, and a `CONFIG_INVALID` `ConfigError`'s hint is the
|
|
33
|
-
* first of the issue lines its message lists
|
|
33
|
+
* first of the issue lines its message lists - so a blind concatenation would print those sentences
|
|
34
34
|
* twice. Others do not (`CONFIG_NOT_FOUND`, `ToolInputError`), which is why the choice is per-error
|
|
35
35
|
* rather than per-class. Doing it here rather than at the one offending call site is what makes a
|
|
36
36
|
* newly added error path inherit the behavior.
|
|
@@ -50,15 +50,15 @@ function renderErrorText(structured) {
|
|
|
50
50
|
// `content` message and the structured payload only ever expose vetted text.
|
|
51
51
|
//
|
|
52
52
|
// `cwd` is optional because the classifier needs a base to render the failing path against and
|
|
53
|
-
// cannot invent one
|
|
53
|
+
// cannot invent one - without it the errno branch is skipped and the old INTERNAL_ERROR behavior
|
|
54
54
|
// stands, which is the safe direction.
|
|
55
55
|
//
|
|
56
56
|
// For this to round-trip over the wire on the five tools that declare an `outputSchema`, each such
|
|
57
57
|
// error payload may need schema-compatible placeholder success fields attached to it: a
|
|
58
58
|
// spec-compliant client validates any present `structuredContent` against the advertised schema,
|
|
59
59
|
// even on `isError` results. `compile-context` has no `outputSchema`, so it passes no placeholders.
|
|
60
|
-
// An options object rather than positional parameters so that tool
|
|
61
|
-
// placeholders
|
|
60
|
+
// An options object rather than positional parameters so that tool - which supplies a `cwd` and no
|
|
61
|
+
// placeholders - does not have to pass a mid-list `undefined`.
|
|
62
62
|
export function errorResult(error, options = {}) {
|
|
63
63
|
const structured = isStructuredError(error)
|
|
64
64
|
? { code: error.code, message: error.message, hint: error.hint }
|
|
@@ -89,7 +89,7 @@ const ERROR_OUTPUT_SHAPE = {
|
|
|
89
89
|
};
|
|
90
90
|
// Extend a success output shape with the optional error fields WITHOUT weakening the success
|
|
91
91
|
// contract. The pinned MCP SDK (1.29) validates any present `structuredContent` against the
|
|
92
|
-
// advertised schema even on errors, but it only advertises object schemas
|
|
92
|
+
// advertised schema even on errors, but it only advertises object schemas - a Zod union / `oneOf`
|
|
93
93
|
// is silently dropped. So the safe expressible shape is "success schema plus optional error
|
|
94
94
|
// metadata", and each tool's error path supplies schema-compatible placeholder success fields via
|
|
95
95
|
// `errorResult(..., successFields)`.
|
package/dist/tool-docs.js
CHANGED
|
@@ -3,12 +3,12 @@ import { InMemoryTransport } from "@modelcontextprotocol/sdk/inMemory.js";
|
|
|
3
3
|
import { createServer } from "./index.js";
|
|
4
4
|
// Renders the README's MCP tool inventory from the *live* registered tools rather than
|
|
5
5
|
// a hand-maintained name list. `tools/index.ts` deliberately keeps its registrars function-only so
|
|
6
|
-
// no second source of truth can drift ("5 vs 6 tools"); introspecting a connected client
|
|
7
|
-
// `createServer()` + `InMemoryTransport` + `listTools()` technique `smoke.test.ts` uses
|
|
6
|
+
// no second source of truth can drift ("5 vs 6 tools"); introspecting a connected client - the same
|
|
7
|
+
// `createServer()` + `InMemoryTransport` + `listTools()` technique `smoke.test.ts` uses - is the
|
|
8
8
|
// only generic, non-private-field way to enumerate what is actually advertised.
|
|
9
9
|
// Guard the table's Markdown against free-text descriptions: a `|` would split a cell and a newline
|
|
10
10
|
// would break the row. None of the six current descriptions contain either, but the table is
|
|
11
|
-
// machine-generated from prose a future tool author could grow one into
|
|
11
|
+
// machine-generated from prose a future tool author could grow one into - escaping here closes that
|
|
12
12
|
// off permanently rather than leaving a latent doc-corruption risk.
|
|
13
13
|
function escapeCell(text) {
|
|
14
14
|
return text.replace(/\r?\n/g, " ").replace(/\|/g, "\\|");
|
|
@@ -30,7 +30,7 @@ export async function generateToolInventory() {
|
|
|
30
30
|
const divider = "| --- | --- | --- | --- |";
|
|
31
31
|
// Registration order is preserved deliberately (not alphabetized): it groups by family
|
|
32
32
|
// (lint/lint-files, the three graph tools, then compile-context last as the structured-output
|
|
33
|
-
// exception), which reads better than alphabetical and is still fully deterministic
|
|
33
|
+
// exception), which reads better than alphabetical and is still fully deterministic - the order
|
|
34
34
|
// comes from a fixed registrar array, not filesystem or Map-iteration order.
|
|
35
35
|
const rows = tools.map((tool) => {
|
|
36
36
|
const readOnly = tool.annotations?.readOnlyHint === true ? "yes" : "no";
|
|
@@ -2,7 +2,7 @@ import { compileContext } from "@wastech-mdlint/core";
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { resolveToolConfiguration, toolCwdBase, } from "../shared/tool-context.js";
|
|
4
4
|
import { errorResult, READ_ONLY_ANNOTATIONS } from "../shared/tool-response.js";
|
|
5
|
-
// `compile-context`
|
|
5
|
+
// `compile-context` - compile the project skill (the same deterministic `SKILL.md` the CLI's
|
|
6
6
|
// `compile` command produces) over MCP. Core owns the whole pipeline; this handler is a thin
|
|
7
7
|
// adapter.
|
|
8
8
|
//
|
|
@@ -11,7 +11,7 @@ import { errorResult, READ_ONLY_ANNOTATIONS } from "../shared/tool-response.js";
|
|
|
11
11
|
// `context-slice`, `impact-analysis`), and this one returns two content blocks instead. A compiled
|
|
12
12
|
// SKILL.md is a document, not a record set: there is no field a client would read out of it that
|
|
13
13
|
// the text does not already carry. So the
|
|
14
|
-
// `registerTool` call omits `outputSchema` and the handler returns exactly two text blocks
|
|
14
|
+
// `registerTool` call omits `outputSchema` and the handler returns exactly two text blocks - hence
|
|
15
15
|
// `successResult` (which always attaches `structuredContent`) is deliberately not reused here.
|
|
16
16
|
// Identical `cwd?`/`configPath?` shape to `ToolFileInput`; this tool adds no field, so it takes
|
|
17
17
|
// `ToolFileInput` directly rather than aliasing a one-field-wider input type.
|
|
@@ -27,7 +27,7 @@ export async function handleCompileContext(input) {
|
|
|
27
27
|
const loaded = await resolveToolConfiguration(input);
|
|
28
28
|
// `compileContext` throws `CompileConfigMissingError` (code `COMPILE_CONFIG_MISSING`, already in
|
|
29
29
|
// `TOOL_ERROR_CODES`, carrying `.hint`) when `config.compile` is absent, so `errorResult` passes
|
|
30
|
-
// it through verbatim with no translation wrapper
|
|
30
|
+
// it through verbatim with no translation wrapper - exactly like `impact-analysis`, and unlike
|
|
31
31
|
// `lint.ts` whose `RuleResolutionError` codes aren't in the taxonomy.
|
|
32
32
|
const result = await compileContext(loaded, loaded.cwd);
|
|
33
33
|
const { documentCount, ruleCount, componentCount } = result.metadata;
|
|
@@ -37,7 +37,7 @@ export async function handleCompileContext(input) {
|
|
|
37
37
|
// CLI and this tool share the same `compileContext` call boundary, so returning it verbatim
|
|
38
38
|
// guarantees identical output. The metadata line is a plain-text summary, not Markdown, and
|
|
39
39
|
// lives here as a local template because it has exactly one call site today (the CLI prints
|
|
40
|
-
// `skillContent` or a write confirmation, never this line)
|
|
40
|
+
// `skillContent` or a write confirmation, never this line) - promote it to core only if a
|
|
41
41
|
// second consumer appears.
|
|
42
42
|
{ type: "text", text: result.skillContent },
|
|
43
43
|
{
|
|
@@ -2,16 +2,16 @@ import { computeGraphCoverage, formatContextGraphSummary, summarizeContextGraph,
|
|
|
2
2
|
import { z } from "zod";
|
|
3
3
|
import { resolveToolContext, toolCwdBase, } from "../shared/tool-context.js";
|
|
4
4
|
import { errorResult, READ_ONLY_ANNOTATIONS, successResult, withErrorOutput, } from "../shared/tool-response.js";
|
|
5
|
-
// `context-graph`
|
|
5
|
+
// `context-graph` - build the project's `ContextGraph` and return it either verbatim
|
|
6
6
|
// (`format: "raw"`, the default) or as the derived `ContextGraphSummary` (`format: "summary"`). Core
|
|
7
7
|
// owns graph construction via `resolveToolContext` → `loadContext`; this handler only picks
|
|
8
8
|
// which projection to return, and calls `computeGraphCoverage` for the one that carries coverage.
|
|
9
9
|
//
|
|
10
10
|
// The branch was once named `"json"`. On a JSON-RPC tool *every* projection is JSON,
|
|
11
|
-
// so `json` never named an axis here
|
|
11
|
+
// so `json` never named an axis here - and it collided with the CLI's `graph --format json`, which
|
|
12
12
|
// denotes the summary document, not the raw graph. `raw` vs `summary` names the axis that exists.
|
|
13
13
|
// Local Zod mirrors of `ContextGraphNode`/`ContextGraphEdge` (hand-maintained per this package's
|
|
14
|
-
// `lint-message-schema.ts` convention
|
|
14
|
+
// `lint-message-schema.ts` convention - each has a single consumer here, so it stays local rather
|
|
15
15
|
// than promoted to a shared schema module).
|
|
16
16
|
const contextGraphNodeSchema = z.object({
|
|
17
17
|
path: z.string(),
|
|
@@ -39,9 +39,9 @@ const contextGraphInputShape = {
|
|
|
39
39
|
};
|
|
40
40
|
// One tool, two structured shapes: `format: "raw"` returns `{ nodes, edges, cycles }` (the verbatim
|
|
41
41
|
// `ContextGraph`), `format: "summary"` returns
|
|
42
|
-
// `{ nodes, edges, components, readingOrder, excluded, coverage }`
|
|
42
|
+
// `{ nodes, edges, components, readingOrder, excluded, coverage }` - the same document the CLI's
|
|
43
43
|
// `graph --format json` prints, which is the parity between hosts. `registerTool` takes a
|
|
44
|
-
// single `outputSchema`, so the format-specific fields are individually optional
|
|
44
|
+
// single `outputSchema`, so the format-specific fields are individually optional - a superset schema
|
|
45
45
|
// rather than a discriminated union, which would require echoing a `format` field neither core type
|
|
46
46
|
// carries. `nodes`/`edges` stay required because both shapes always carry them.
|
|
47
47
|
const contextGraphOutputShape = {
|
|
@@ -107,7 +107,7 @@ export function registerContextGraphTool(server) {
|
|
|
107
107
|
description: 'Build the project\'s context graph. `format: "raw"` (default) returns the graph verbatim ' +
|
|
108
108
|
'(nodes, edges, cycles); `format: "summary"` returns nodes, edges, connected components, ' +
|
|
109
109
|
"topological reading order, the nodes a cycle excluded from that order, and the coverage " +
|
|
110
|
-
"signal (node/edge counts plus Markdown files linked-to but outside the corpus)
|
|
110
|
+
"signal (node/edge counts plus Markdown files linked-to but outside the corpus) - the same " +
|
|
111
111
|
"document the CLI's `graph --format json` prints. Read-only.",
|
|
112
112
|
inputSchema: contextGraphInputShape,
|
|
113
113
|
outputSchema: withErrorOutput(contextGraphOutputShape),
|
|
@@ -38,7 +38,7 @@ export async function handleContextSlice(input) {
|
|
|
38
38
|
idRef: settings.idRef,
|
|
39
39
|
});
|
|
40
40
|
// An unresolved query is not an error: it returns `matchKind: null` with empty arrays. This is
|
|
41
|
-
// the honest-empty-result contract
|
|
41
|
+
// the honest-empty-result contract - do not throw.
|
|
42
42
|
return successResult({
|
|
43
43
|
summary: renderContextSliceSummary(result),
|
|
44
44
|
structured: result,
|
|
@@ -11,7 +11,7 @@ const impactAnalysisInputShape = {
|
|
|
11
11
|
cwd: z.string().optional(),
|
|
12
12
|
};
|
|
13
13
|
// Local mirrors of `DirectlyAffected`/`TransitivelyAffected`, matching `ImpactClassification`
|
|
14
|
-
// exactly. `via` on a transitive entry is always a real predecessor path (never null)
|
|
14
|
+
// exactly. `via` on a transitive entry is always a real predecessor path (never null) - every
|
|
15
15
|
// depth≥2 visit has one, per impact-analysis.ts's own invariant.
|
|
16
16
|
const directlyAffectedSchema = z.object({
|
|
17
17
|
path: z.string(),
|
|
@@ -38,7 +38,7 @@ export async function handleImpactAnalysis(input) {
|
|
|
38
38
|
const cwd = toolCwdBase(input);
|
|
39
39
|
try {
|
|
40
40
|
if ((input.file === undefined) === (input.since === undefined)) {
|
|
41
|
-
throw new ToolInputError('impact-analysis takes either "file" or "since"', 'Pass "file" for one changed Markdown file, or "since" (a branch, tag or commit) for every document the work tree changed since where it left that ref.');
|
|
41
|
+
throw new ToolInputError('impact-analysis takes either "file" or "since"', 'Pass "file" for one changed Markdown file, or "since" (a branch, tag or commit - git.base in the config, when it sets one) for every document the work tree changed since where it left that ref.');
|
|
42
42
|
}
|
|
43
43
|
if (input.since !== undefined) {
|
|
44
44
|
const loaded = await resolveToolConfiguration(input);
|
|
@@ -52,7 +52,7 @@ export async function handleImpactAnalysis(input) {
|
|
|
52
52
|
const { graph } = await resolveToolContext(input);
|
|
53
53
|
// `classifyImpact` throws `ImpactAnalysisError` (code `TARGET_NOT_FOUND`, already in
|
|
54
54
|
// `TOOL_ERROR_CODES`) when `file` is not in the corpus, so `errorResult` passes it through with
|
|
55
|
-
// no translation wrapper
|
|
55
|
+
// no translation wrapper - unlike `lint.ts`, whose `RuleResolutionError` codes aren't in the
|
|
56
56
|
// taxonomy.
|
|
57
57
|
const classification = classifyImpact(graph, file);
|
|
58
58
|
// Identity transform: this tool's `cwd` is both the corpus root the graph is built from and the
|
|
@@ -84,7 +84,8 @@ export function registerImpactAnalysisTool(server) {
|
|
|
84
84
|
title: "Analyze change impact",
|
|
85
85
|
description: "Compute the blast radius of changing a Markdown file: files that reference it directly, " +
|
|
86
86
|
"files affected transitively, and the reading order over the affected subgraph. A file not " +
|
|
87
|
-
"in the corpus returns an actionable error. With `since` (a branch, tag or commit
|
|
87
|
+
"in the corpus returns an actionable error. With `since` (a branch, tag or commit; a project " +
|
|
88
|
+
"config may name its base branch in `git.base`) in place " +
|
|
88
89
|
"of `file`, the same for every document the work tree changed since where it left that ref, " +
|
|
89
90
|
"read with git. Read-only.",
|
|
90
91
|
inputSchema: impactAnalysisInputShape,
|
package/dist/tools/index.js
CHANGED
|
@@ -5,11 +5,11 @@ import { registerImpactAnalysisTool } from "./impact-analysis.js";
|
|
|
5
5
|
import { registerLintFilesTool } from "./lint-files.js";
|
|
6
6
|
import { registerLintTool } from "./lint.js";
|
|
7
7
|
// Modular tool layout: the single registration seam. Each tool is its own
|
|
8
|
-
// module and appends its registrar here
|
|
8
|
+
// module and appends its registrar here - one module per tool, registered from this
|
|
9
9
|
// index, so no single mega-file.
|
|
10
10
|
//
|
|
11
11
|
// The list stays function-only (not `{ name, register }[]`): a parallel name list would be a second
|
|
12
|
-
// hand-maintained source of truth that could drift from the real registerTool() calls
|
|
12
|
+
// hand-maintained source of truth that could drift from the real registerTool() calls - exactly the
|
|
13
13
|
// "5 vs 6 tools" mismatch the generated inventory exists to prevent. Doc generation introspects the
|
|
14
14
|
// live McpServer instance instead of reading a name array here.
|
|
15
15
|
const TOOL_REGISTRARS = [
|
package/dist/tools/lint-files.js
CHANGED
|
@@ -10,7 +10,7 @@ const lintFilesInputShape = {
|
|
|
10
10
|
cwd: z.string().optional(),
|
|
11
11
|
since: sinceInput,
|
|
12
12
|
};
|
|
13
|
-
// Mirrors `LintResult` directly
|
|
13
|
+
// Mirrors `LintResult` directly - field names already match, so `structured: result` needs no
|
|
14
14
|
// reshaping.
|
|
15
15
|
const lintFilesOutputShape = {
|
|
16
16
|
messages: z.array(lintMessageSchema),
|
|
@@ -35,10 +35,10 @@ export async function handleLintFiles(input) {
|
|
|
35
35
|
try {
|
|
36
36
|
const loaded = await resolveToolConfiguration(input);
|
|
37
37
|
// An explicit `patterns` arg *replaces* `config.include` (not merges). When it's absent we leave
|
|
38
|
-
// `config.include` untouched so core's own defaults apply
|
|
38
|
+
// `config.include` untouched so core's own defaults apply - `resolveCorpusScope`
|
|
39
39
|
// (`config/corpus-scope.ts`) supplies both `DEFAULT_INCLUDE_GLOBS` and the default `exclude`.
|
|
40
40
|
// That "what is the corpus when the config is silent" decision stays core's job, not
|
|
41
|
-
// reimplemented here
|
|
41
|
+
// reimplemented here - which also means an explicit `patterns` naming a path under a
|
|
42
42
|
// default-excluded tree still resolves to nothing.
|
|
43
43
|
const config = input.patterns === undefined
|
|
44
44
|
? loaded.config
|
|
@@ -71,7 +71,7 @@ export function registerLintFilesTool(server) {
|
|
|
71
71
|
server.registerTool("lint-files", {
|
|
72
72
|
title: "Lint project files",
|
|
73
73
|
description: "Lint the project's Markdown files using the resolved config (or the zero-config `**/*.md` default). " +
|
|
74
|
-
"With `since` (a branch, tag or commit), report only the findings the work tree adds since where it left that ref, read with git. Read-only.",
|
|
74
|
+
"With `since` (a branch, tag or commit; a project config may name its base branch in `git.base`), report only the findings the work tree adds since where it left that ref, read with git. Read-only.",
|
|
75
75
|
inputSchema: lintFilesInputShape,
|
|
76
76
|
outputSchema: withErrorOutput(lintFilesOutputShape),
|
|
77
77
|
annotations: READ_ONLY_ANNOTATIONS,
|
package/dist/tools/lint.js
CHANGED
|
@@ -3,7 +3,7 @@ import { z } from "zod";
|
|
|
3
3
|
import { lintMessageSchema } from "../shared/lint-message-schema.js";
|
|
4
4
|
import { ToolInputError } from "../shared/tool-input-error.js";
|
|
5
5
|
import { errorResult, READ_ONLY_ANNOTATIONS, successResult, withErrorOutput, } from "../shared/tool-response.js";
|
|
6
|
-
// `lint`
|
|
6
|
+
// `lint` - lint ad-hoc Markdown text against an explicit set of rules. This tool never loads a
|
|
7
7
|
// project config (that is `lint-files`' job): the whole contract is "content + rules in, findings
|
|
8
8
|
// out", so the input carries the rules to run rather than resolving them from a config. Core still
|
|
9
9
|
// owns rule semantics, so file-resolving rules may inspect paths under the server cwd.
|
|
@@ -18,7 +18,7 @@ const AD_HOC_DOCUMENT_PATH = "content.md";
|
|
|
18
18
|
//
|
|
19
19
|
// Widened to a union so "executes declarative custom rules" holds for ad-hoc `lint`
|
|
20
20
|
// too. Custom-first, because the strict built-in branch would reject a custom entry's `id`/`target`
|
|
21
|
-
// keys. The second branch is `ruleEntrySchema`
|
|
21
|
+
// keys. The second branch is `ruleEntrySchema` - the permissive one - deliberately NOT the config-only
|
|
22
22
|
// `ruleEntryUnionSchema`, whose standard branch refine-rejects the literal `"custom"`: the SDK
|
|
23
23
|
// `safeParseAsync`s this schema *before* the handler runs and turns a failure into an
|
|
24
24
|
// `InvalidParams` result carrying raw validation text and no `structuredContent`, so any shape
|
|
@@ -62,9 +62,9 @@ function toToolInputError(error) {
|
|
|
62
62
|
}
|
|
63
63
|
// Re-validate a `rule: "custom"` request inside the handler. The wire schema's permissive branch lets
|
|
64
64
|
// a malformed custom entry through on purpose (see `ruleRequestSchema`), and `entry.rule === "custom"`
|
|
65
|
-
// does not narrow `RuleConfigEntry` away
|
|
65
|
+
// does not narrow `RuleConfigEntry` away - its `rule` is an open `z.string()` - so this parses rather
|
|
66
66
|
// than casts. That also means `handleLint`, which tests call directly, never reaches
|
|
67
|
-
// `resolveCustomRule` with an absent `id`
|
|
67
|
+
// `resolveCustomRule` with an absent `id` - the same crash the config boundary already guards.
|
|
68
68
|
function resolveCustomRequest(entry) {
|
|
69
69
|
const parsed = customRuleEntrySchema.safeParse(entry);
|
|
70
70
|
if (!parsed.success) {
|
|
@@ -76,11 +76,11 @@ function resolveCustomRequest(entry) {
|
|
|
76
76
|
return resolveCustomRule(parsed.data, ruleRegistry);
|
|
77
77
|
}
|
|
78
78
|
// Resolve requested entries to runnable rules, mirroring lintFiles' resolve-then-filter of `"off"`
|
|
79
|
-
// (that helper isn't exported and is only ~6 lines
|
|
79
|
+
// (that helper isn't exported and is only ~6 lines - not worth a core export for one caller).
|
|
80
80
|
function resolveRequestedRules(entries) {
|
|
81
81
|
// Checked here as well as in the config loader because this tool resolves its rules from the
|
|
82
82
|
// request rather than from a config, so it never passes through that check. Two custom entries
|
|
83
|
-
// under one id both run and produce findings labelled identically
|
|
83
|
+
// under one id both run and produce findings labelled identically - which on this host means a
|
|
84
84
|
// model reading them cannot attribute either. Refused before any rule resolves, since the whole
|
|
85
85
|
// request is unusable rather than one entry of it.
|
|
86
86
|
const collision = findDuplicateCustomIds(entries)[0];
|
|
@@ -128,8 +128,8 @@ function resolveRequestedRules(entries) {
|
|
|
128
128
|
}
|
|
129
129
|
export function handleLint(input) {
|
|
130
130
|
try {
|
|
131
|
-
// Rule *resolution* stays here
|
|
132
|
-
// into this host's `{ code, message, hint }` contract
|
|
131
|
+
// Rule *resolution* stays here - `resolveRequestedRules` owns translating a `RuleResolutionError`
|
|
132
|
+
// into this host's `{ code, message, hint }` contract - and every step after it is core's
|
|
133
133
|
// `lintContent`: parse, corpus of one, scope split, inline-disable, counts. Those steps used to
|
|
134
134
|
// be assembled in this function, which made this the one place `lintFiles`' step
|
|
135
135
|
// order existed twice; a step added there would silently not have reached this tool.
|
|
@@ -137,7 +137,7 @@ export function handleLint(input) {
|
|
|
137
137
|
// `rootDir` is the server cwd, mirroring the fallback `resolveToolCwd` applies to the file-based
|
|
138
138
|
// tools. It is a bare `process.cwd()` call, not that helper: this tool takes no `cwd` input, so
|
|
139
139
|
// there is nothing caller-supplied to validate. Passing a real directory rather than a bespoke
|
|
140
|
-
// corpus-only mode is deliberate
|
|
140
|
+
// corpus-only mode is deliberate - REF-001/003 resolve `rootDir` into `existsSync` for targets
|
|
141
141
|
// outside the corpus, so on-disk targets resolve exactly as they do under `lint-files`, and core
|
|
142
142
|
// stays the single owner of REF/SEC resolution semantics.
|
|
143
143
|
const result = lintContent({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wastech-mdlint/mcp-server",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "MCP server for Markdown linting: read-only Model Context Protocol tools for lint findings, the context graph, and change impact.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"@modelcontextprotocol/sdk": "^1.29.0",
|
|
44
|
-
"@wastech-mdlint/core": "0.
|
|
44
|
+
"@wastech-mdlint/core": "0.5.0",
|
|
45
45
|
"zod": "^4.6.6"
|
|
46
46
|
},
|
|
47
47
|
"publishConfig": {
|