@lintsure/mcp 0.3.8 → 0.3.10
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/dist/src/index.js +37 -6
- package/package.json +51 -51
package/dist/src/index.js
CHANGED
|
@@ -6,24 +6,47 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
6
6
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
7
7
|
import { resolve } from "node:path";
|
|
8
8
|
import { z } from "zod";
|
|
9
|
-
import { AGENT_GUIDANCE, APPROVAL_RULES, ALL_FRAMEWORKS, DISCLAIMER, classify, getKnowledge, nextSteps, readConfig, rules, scan, toMarkdown } from "@lintsure/core";
|
|
10
|
-
const server = new McpServer({ name: "lintsure", version: "0.3.
|
|
9
|
+
import { AGENT_GUIDANCE, APPROVAL_RULES, TRIAGE_GUIDE, ALL_FRAMEWORKS, DISCLAIMER, classify, getKnowledge, nextSteps, readConfig, rules, scan, toMarkdown } from "@lintsure/core";
|
|
10
|
+
const server = new McpServer({ name: "lintsure", version: "0.3.10" }, { instructions: AGENT_GUIDANCE });
|
|
11
11
|
// Every tool only reads. Clients can show this; none of them may treat a Lintsure tool as making changes.
|
|
12
12
|
const RO = { readOnlyHint: true, destructiveHint: false, idempotentHint: true, openWorldHint: false };
|
|
13
13
|
const fw = z.array(z.enum(ALL_FRAMEWORKS)).optional()
|
|
14
14
|
.describe("Frameworks to check, for example [\"gdpr\", \"owasp-top10\"]. Leave out to use lintsure.config.yaml in the repo, or all six if there is none.");
|
|
15
15
|
// Every answer ends with the same disclaimer, so no tool output can be read as a verdict.
|
|
16
16
|
const reply = (...texts) => ({ content: [...texts, `---\n${DISCLAIMER}`].map((text) => ({ type: "text", text })) });
|
|
17
|
-
server.tool("scan", "Scan a repository's source code for compliance and security gaps against the chosen frameworks. Use when the user asks things like 'is this ready to ship?', 'are we GDPR ready?' or 'check this repo for security issues'.
|
|
17
|
+
server.tool("scan", "Scan a repository's source code for compliance and security gaps against the chosen frameworks. Use when the user asks things like 'is this ready to ship?', 'are we GDPR ready?' or 'check this repo for security issues'. By default returns a short list: Gaps first, each with file, line, rule, risk level and a one-line fix, plus counts and what was not covered. To check a fix, call it again with files and rules set to the file and rule you changed. Set format to \"full\" for the whole Markdown report and JSON. Read-only: it never changes files. Call classify first if you don't know which frameworks apply. Results are for a person to review, never a pass, certification or decision.", {
|
|
18
18
|
path: z.string().default(".").describe("Folder to scan, absolute or relative to where the server runs. Example: \".\" for the current project, or \"apps/web\"."),
|
|
19
19
|
frameworks: fw,
|
|
20
|
-
|
|
20
|
+
files: z.array(z.string()).optional().describe("Only list findings in these files or folders, relative to path. Example: [\"src/api/users.ts\"]. Use after a fix to re-check just that file."),
|
|
21
|
+
rules: z.array(z.string()).optional().describe("Only list findings from these rule ids, for example [\"pii.logged\"]. Use with files to confirm one fix."),
|
|
22
|
+
status: z.enum(["gap", "partial", "all"]).default("all").describe("\"gap\" for findings the code itself shows, \"partial\" for ones that need a person to confirm context, or \"all\"."),
|
|
23
|
+
limit: z.number().int().min(1).max(500).default(25).describe("Most findings to list. The counts always cover everything."),
|
|
24
|
+
all: z.boolean().default(false).describe("Also include medium-confidence findings, which are held back by default because they are often not real."),
|
|
25
|
+
format: z.enum(["summary", "full"]).default("summary").describe("\"summary\" keeps the reply small; \"full\" returns the Markdown report and the JSON."),
|
|
26
|
+
}, RO, async ({ path, frameworks, files, rules: only, status, limit, all, format }) => {
|
|
21
27
|
const root = resolve(path);
|
|
22
28
|
const cfg = (await readConfig(root)).frameworks;
|
|
23
29
|
const why = frameworks ? "Chosen by the user through their coding agent." : cfg ? "Listed in lintsure.config.yaml." : undefined;
|
|
24
|
-
const report = await scan(root, frameworks ?? cfg ?? ALL_FRAMEWORKS, { why, source: "mcp" });
|
|
30
|
+
const report = await scan(root, frameworks ?? cfg ?? ALL_FRAMEWORKS, { why, source: "mcp", all });
|
|
25
31
|
const steps = nextSteps(report).map((s, i) => `${i + 1}. ${s}`).join("\n");
|
|
26
|
-
|
|
32
|
+
if (format === "full")
|
|
33
|
+
return reply(toMarkdown(report), JSON.stringify(report), `${APPROVAL_RULES}\n\nEach finding above already has its proposal (where, what, why, benefit). Ask the user which one to work on first.\n\nNext steps for the user:\n${steps}`);
|
|
34
|
+
const norm = (p) => p.replace(/\\/g, "/").replace(/^\.?\//, "").replace(/\/+$/, "");
|
|
35
|
+
const scope = files?.map(norm);
|
|
36
|
+
const picked = report.findings.filter((f) => (!scope || scope.some((p) => f.file === p || f.file.startsWith(p + "/")))
|
|
37
|
+
&& (!only || only.includes(f.ruleId)) && (status === "all" || f.status === status) && !(f.accepted && !f.accepted.expired));
|
|
38
|
+
const rank = (f) => (f.status === "gap" ? 0 : 3) + { high: 0, medium: 1, low: 2 }[f.severity];
|
|
39
|
+
const shown = [...picked].sort((a, b) => rank(a) - rank(b)).slice(0, limit);
|
|
40
|
+
const gaps = picked.filter((f) => f.status === "gap").length;
|
|
41
|
+
return reply([
|
|
42
|
+
`Lintsure ${report.rulesVersion}: ${picked.length} open finding${picked.length === 1 ? "" : "s"} (${gaps} gap, ${picked.length - gaps} partial)${scope || only ? " in the files and rules asked for" : ""}, ${report.filesChecked} files read.`,
|
|
43
|
+
...(picked.length > shown.length ? [`Showing the first ${shown.length}; raise limit or narrow with files to see more.`] : []),
|
|
44
|
+
"",
|
|
45
|
+
...shown.map((f) => `- ${f.id} ${f.status === "gap" ? "Gap" : "Partial"} · ${f.severity} · ${f.file}:${f.line} · ${f.ruleId}: ${f.title}. Fix: ${f.fix}`),
|
|
46
|
+
...(picked.length ? [] : [scope || only ? "No open findings for these files and rules. If you just fixed one, it is no longer reported." : "No open findings from the rules that ran."]),
|
|
47
|
+
"", "Not covered:", ...(report.notCovered ?? []).map((s) => `- ${s}`),
|
|
48
|
+
"", `${APPROVAL_RULES}\n\nAsk the user which finding to work on first. Call explain_rule for detail on a rule, or format "full" for the complete report.`,
|
|
49
|
+
].join("\n"));
|
|
27
50
|
});
|
|
28
51
|
server.tool("explain_rule", "Explain one Lintsure rule in plain words: what it looks for, which framework controls it relates to (for example GDPR Art. 32 or OWASP A05), why it matters and how to fix it. Use after scan, when the user asks about a finding ('what does pii.logged mean?', 'why is this a problem?'). Returns text; read-only.", { ruleId: z.string().describe("The rule id shown on a scan finding. Examples: \"pii.logged\" (personal data in logs), \"secret.in-source\", \"supabase.rls-disabled\". The full list is at lintsure.com/rules.") }, RO, async ({ ruleId }) => {
|
|
29
52
|
const r = rules.find((x) => x.id === ruleId);
|
|
@@ -90,4 +113,12 @@ server.tool("explain_framework", "Explain a compliance framework in plain words:
|
|
|
90
113
|
"", `Summary in our own words, checked on ${k.checkedOn}. Read the official text for anything you rely on.`,
|
|
91
114
|
].join("\n"));
|
|
92
115
|
});
|
|
116
|
+
// The triage method as an MCP prompt, so every client gets it without installing anything
|
|
117
|
+
// (in Claude Code it shows as /mcp__lintsure__triage). Same text as skills/lintsure-triage/SKILL.md.
|
|
118
|
+
server.registerPrompt("triage", {
|
|
119
|
+
title: "Triage Lintsure findings",
|
|
120
|
+
description: "Sort each Lintsure finding into confirmed, not a problem, or needs a person, by reading the code around it. Read-only.",
|
|
121
|
+
argsSchema: { path: z.string().optional().describe("Folder to scan and triage. Default: the current project."),
|
|
122
|
+
files: z.string().optional().describe("Optional: comma-separated files or folders to focus on, for example \"src/api\".") },
|
|
123
|
+
}, ({ path, files }) => ({ messages: [{ role: "user", content: { type: "text", text: `${TRIAGE_GUIDE}\n\nStart now: run the Lintsure scan tool on ${path ? `"${path}"` : "this project"}${files ? ` with files ${JSON.stringify(files.split(",").map((s) => s.trim()).filter(Boolean))}` : ""}, then triage the findings as described above.` } }] }));
|
|
93
124
|
await server.connect(new StdioServerTransport());
|
package/package.json
CHANGED
|
@@ -1,51 +1,51 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@lintsure/mcp",
|
|
3
|
-
"version": "0.3.
|
|
4
|
-
"mcpName": "io.github.lintsure/lintsure",
|
|
5
|
-
"description": "Lintsure MCP server for Claude Code, Cursor, Codex and Windsurf. Readiness checks, not an audit or legal advice.",
|
|
6
|
-
"license": "Apache-2.0",
|
|
7
|
-
"type": "module",
|
|
8
|
-
"bin": {
|
|
9
|
-
"lintsure-mcp": "dist/src/index.js"
|
|
10
|
-
},
|
|
11
|
-
"files": [
|
|
12
|
-
"dist/src",
|
|
13
|
-
"README.md",
|
|
14
|
-
"LICENSE"
|
|
15
|
-
],
|
|
16
|
-
"dependencies": {
|
|
17
|
-
"@lintsure/core": "0.3.
|
|
18
|
-
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
19
|
-
"zod": "^4.6.7"
|
|
20
|
-
},
|
|
21
|
-
"author": "Lintsure <hello@lintsure.com>",
|
|
22
|
-
"homepage": "https://lintsure.com/docs",
|
|
23
|
-
"repository": {
|
|
24
|
-
"type": "git",
|
|
25
|
-
"url": "git+https://github.com/lintsure/lintsure.git"
|
|
26
|
-
},
|
|
27
|
-
"bugs": {
|
|
28
|
-
"url": "https://github.com/lintsure/lintsure/issues",
|
|
29
|
-
"email": "support@lintsure.com"
|
|
30
|
-
},
|
|
31
|
-
"engines": {
|
|
32
|
-
"node": ">=22"
|
|
33
|
-
},
|
|
34
|
-
"publishConfig": {
|
|
35
|
-
"access": "public"
|
|
36
|
-
},
|
|
37
|
-
"keywords": [
|
|
38
|
-
"compliance",
|
|
39
|
-
"gdpr",
|
|
40
|
-
"eu-ai-act",
|
|
41
|
-
"mcp",
|
|
42
|
-
"static-analysis",
|
|
43
|
-
"readiness",
|
|
44
|
-
"mcp-server",
|
|
45
|
-
"claude-code",
|
|
46
|
-
"cursor"
|
|
47
|
-
],
|
|
48
|
-
"scripts": {
|
|
49
|
-
"prepublishOnly": "cd ../.. && npm test"
|
|
50
|
-
}
|
|
51
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@lintsure/mcp",
|
|
3
|
+
"version": "0.3.10",
|
|
4
|
+
"mcpName": "io.github.lintsure/lintsure",
|
|
5
|
+
"description": "Lintsure MCP server for Claude Code, Cursor, Codex and Windsurf. Readiness checks, not an audit or legal advice.",
|
|
6
|
+
"license": "Apache-2.0",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"lintsure-mcp": "dist/src/index.js"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/src",
|
|
13
|
+
"README.md",
|
|
14
|
+
"LICENSE"
|
|
15
|
+
],
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@lintsure/core": "0.3.10",
|
|
18
|
+
"@modelcontextprotocol/sdk": "^1.12.0",
|
|
19
|
+
"zod": "^4.6.7"
|
|
20
|
+
},
|
|
21
|
+
"author": "Lintsure <hello@lintsure.com>",
|
|
22
|
+
"homepage": "https://lintsure.com/docs",
|
|
23
|
+
"repository": {
|
|
24
|
+
"type": "git",
|
|
25
|
+
"url": "git+https://github.com/lintsure/lintsure.git"
|
|
26
|
+
},
|
|
27
|
+
"bugs": {
|
|
28
|
+
"url": "https://github.com/lintsure/lintsure/issues",
|
|
29
|
+
"email": "support@lintsure.com"
|
|
30
|
+
},
|
|
31
|
+
"engines": {
|
|
32
|
+
"node": ">=22"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"keywords": [
|
|
38
|
+
"compliance",
|
|
39
|
+
"gdpr",
|
|
40
|
+
"eu-ai-act",
|
|
41
|
+
"mcp",
|
|
42
|
+
"static-analysis",
|
|
43
|
+
"readiness",
|
|
44
|
+
"mcp-server",
|
|
45
|
+
"claude-code",
|
|
46
|
+
"cursor"
|
|
47
|
+
],
|
|
48
|
+
"scripts": {
|
|
49
|
+
"prepublishOnly": "cd ../.. && npm test"
|
|
50
|
+
}
|
|
51
|
+
}
|